aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.travis.yml40
-rw-r--r--HOWTO/INSTALL-CROSS.md23
-rw-r--r--HOWTO/INSTALL.md16
-rw-r--r--OTP_VERSION2
-rw-r--r--bootstrap/bin/start.bootbin5285 -> 5285 bytes
-rw-r--r--bootstrap/bin/start_clean.bootbin5285 -> 5285 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/beam_a.beambin2700 -> 2684 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/beam_asm.beambin11536 -> 11456 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/beam_block.beambin14776 -> 9564 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/beam_bool.beambin16436 -> 16352 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/beam_bs.beambin0 -> 5928 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/beam_bsm.beambin12740 -> 12624 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/beam_clean.beambin9416 -> 8948 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/beam_dead.beambin12156 -> 12972 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/beam_dict.beambin5300 -> 5248 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/beam_disasm.beambin26320 -> 26216 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/beam_except.beambin3564 -> 3540 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/beam_flatten.beambin3020 -> 2996 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/beam_jump.beambin9444 -> 9372 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/beam_listing.beambin2992 -> 2964 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/beam_peep.beambin2780 -> 2424 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/beam_receive.beambin6444 -> 6384 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/beam_reorder.beambin0 -> 1992 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/beam_split.beambin2416 -> 2396 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/beam_trim.beambin7928 -> 7864 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/beam_type.beambin14692 -> 17148 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/beam_utils.beambin13620 -> 13756 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/beam_validator.beambin29640 -> 30160 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/beam_z.beambin2652 -> 2636 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/cerl.beambin32112 -> 31688 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/cerl_clauses.beambin2956 -> 2956 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/cerl_inline.beambin38940 -> 38716 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/cerl_sets.beambin2868 -> 2868 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/cerl_trees.beambin20368 -> 20360 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/compile.beambin39368 -> 38984 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/compiler.app4
-rw-r--r--bootstrap/lib/compiler/ebin/compiler.appup2
-rw-r--r--bootstrap/lib/compiler/ebin/core_lib.beambin5240 -> 4408 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/core_lint.beambin13656 -> 13580 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/core_parse.beambin50920 -> 50896 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/core_pp.beambin13252 -> 13148 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/core_scan.beambin6692 -> 6636 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/rec_env.beambin4772 -> 4720 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/sys_core_dsetel.beambin7340 -> 7308 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/sys_core_fold.beambin50068 -> 49728 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/sys_core_fold_lists.beambin4596 -> 4596 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/sys_core_inline.beambin4276 -> 4236 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/sys_pre_attributes.beambin3348 -> 3308 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/sys_pre_expand.beambin14940 -> 14764 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/v3_codegen.beambin56912 -> 56164 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/v3_core.beambin53608 -> 53116 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/v3_kernel.beambin47352 -> 46896 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/v3_kernel_pp.beambin12556 -> 12472 bytes
-rw-r--r--bootstrap/lib/compiler/ebin/v3_life.beambin19172 -> 19044 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/application.beambin4620 -> 4604 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/application_controller.beambin32152 -> 31932 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/application_master.beambin6696 -> 6632 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/application_starter.beambin1256 -> 1256 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/auth.beambin6552 -> 6516 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/code.beambin7136 -> 7140 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/code_server.beambin28580 -> 28688 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/disk_log.beambin36492 -> 35860 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/disk_log_1.beambin25016 -> 24640 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/disk_log_server.beambin6668 -> 6624 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/dist_ac.beambin26656 -> 26328 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/dist_util.beambin10568 -> 10352 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/erl_boot_server.beambin6012 -> 5964 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/erl_ddll.beambin2916 -> 2908 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/erl_distribution.beambin1832 -> 1832 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/erl_epmd.beambin7092 -> 7068 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/erl_reply.beambin924 -> 920 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/error_handler.beambin1660 -> 1660 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/error_logger.beambin4480 -> 4464 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/erts_debug.beambin5460 -> 5452 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/file.beambin14556 -> 14460 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/file_io_server.beambin15348 -> 15184 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/file_server.beambin5436 -> 5408 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/gen_sctp.beambin3636 -> 3612 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/gen_tcp.beambin2416 -> 2404 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/gen_udp.beambin1632 -> 1616 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/global.beambin32764 -> 32348 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/global_group.beambin17740 -> 17568 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/group.beambin14160 -> 14040 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/heart.beambin4072 -> 4064 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/hipe_unified_loader.beambin13516 -> 13712 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/inet.beambin23076 -> 23072 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/inet6_sctp.beambin1556 -> 1536 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/inet6_tcp.beambin2676 -> 3032 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/inet6_tcp_dist.beambin6248 -> 768 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/inet6_udp.beambin1728 -> 1728 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/inet_config.beambin7796 -> 7728 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/inet_db.beambin26652 -> 26652 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/inet_dns.beambin19808 -> 19596 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/inet_gethost_native.beambin10500 -> 10436 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/inet_hosts.beambin2144 -> 2140 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/inet_parse.beambin12940 -> 12924 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/inet_res.beambin14976 -> 14868 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/inet_sctp.beambin2324 -> 2304 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/inet_tcp.beambin2484 -> 2744 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/inet_tcp_dist.beambin6808 -> 7184 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/inet_udp.beambin1916 -> 1916 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/kernel.app6
-rw-r--r--bootstrap/lib/kernel/ebin/kernel.appup8
-rw-r--r--bootstrap/lib/kernel/ebin/kernel.beambin3796 -> 3776 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/kernel_config.beambin2768 -> 2764 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/net_adm.beambin3016 -> 3008 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/net_kernel.beambin22760 -> 22600 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/os.beambin5848 -> 5836 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/pg2.beambin7916 -> 7912 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/ram_file.beambin7044 -> 6996 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/rpc.beambin8616 -> 8580 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/seq_trace.beambin1336 -> 1332 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/standard_error.beambin3864 -> 3864 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/user.beambin11588 -> 11572 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/user_drv.beambin11428 -> 11352 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/user_sup.beambin1764 -> 1752 bytes
-rw-r--r--bootstrap/lib/kernel/ebin/wrap_log_reader.beambin3372 -> 3320 bytes
-rw-r--r--bootstrap/lib/kernel/include/file.hrl31
-rw-r--r--bootstrap/lib/stdlib/ebin/array.beambin12032 -> 12008 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/base64.beambin4544 -> 4540 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/beam_lib.beambin18612 -> 18532 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/binary.beambin8408 -> 2828 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/c.beambin14660 -> 14608 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/calendar.beambin5172 -> 5136 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/dets.beambin53600 -> 53116 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/dets_server.beambin7028 -> 6988 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/dets_utils.beambin28764 -> 28684 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/dets_v8.beambin27592 -> 27448 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/dets_v9.beambin50200 -> 49804 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/dict.beambin9332 -> 9272 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/digraph.beambin8308 -> 8192 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/digraph_utils.beambin6844 -> 6824 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/edlin.beambin10196 -> 10196 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/edlin_expand.beambin3164 -> 3156 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/epp.beambin28220 -> 28004 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/erl_anno.beambin4900 -> 4016 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/erl_bits.beambin2552 -> 2528 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/erl_compile.beambin7324 -> 7280 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/erl_eval.beambin30980 -> 30624 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/erl_expand_records.beambin22536 -> 22328 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/erl_lint.beambin89840 -> 89268 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/erl_parse.beambin308128 -> 83340 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/erl_pp.beambin26880 -> 26956 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/erl_scan.beambin31380 -> 28844 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/erl_tar.beambin17256 -> 17156 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/error_logger_file_h.beambin5124 -> 4656 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/error_logger_tty_h.beambin5052 -> 4936 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/escript.beambin17676 -> 17592 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/ets.beambin22604 -> 22604 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/eval_bits.beambin8136 -> 8096 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/file_sorter.beambin30668 -> 30436 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/filelib.beambin8088 -> 8056 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/filename.beambin12512 -> 12444 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/gb_sets.beambin8432 -> 8396 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/gb_trees.beambin5176 -> 5128 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/gen.beambin4296 -> 4276 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/gen_event.beambin19752 -> 19484 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/gen_fsm.beambin17412 -> 17324 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/gen_server.beambin19648 -> 19508 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/io.beambin6696 -> 6680 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/io_lib.beambin10008 -> 9984 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/io_lib_format.beambin13404 -> 13348 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/io_lib_fread.beambin7384 -> 7280 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/io_lib_pretty.beambin15224 -> 15156 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/lib.beambin9660 -> 9600 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/lists.beambin29708 -> 29708 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/log_mf_h.beambin2672 -> 2636 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/maps.beambin2628 -> 2624 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/ms_transform.beambin20632 -> 20420 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/orddict.beambin2792 -> 2772 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/otp_internal.beambin11248 -> 11656 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/pool.beambin3848 -> 3836 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/proc_lib.beambin10460 -> 10656 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/proplists.beambin4948 -> 4944 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/qlc.beambin70644 -> 70124 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/qlc_pt.beambin76520 -> 76072 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/rand.beambin13452 -> 13444 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/random.beambin1712 -> 1704 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/re.beambin13844 -> 13600 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/sets.beambin7096 -> 7060 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/shell.beambin30452 -> 30272 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/slave.beambin5200 -> 4852 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/sofs.beambin40816 -> 40656 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/stdlib.app4
-rw-r--r--bootstrap/lib/stdlib/ebin/stdlib.appup8
-rw-r--r--bootstrap/lib/stdlib/ebin/supervisor.beambin24072 -> 23896 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/supervisor_bridge.beambin2932 -> 2900 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/sys.beambin8620 -> 8564 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/timer.beambin5488 -> 5476 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/unicode.beambin11616 -> 11552 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/win32reg.beambin5632 -> 5600 bytes
-rw-r--r--bootstrap/lib/stdlib/ebin/zip.beambin27080 -> 26568 bytes
-rw-r--r--bootstrap/lib/stdlib/include/assert.hrl261
-rw-r--r--bootstrap/lib/stdlib/include/erl_bits.hrl10
-rw-r--r--configure.in4
-rw-r--r--erts/aclocal.m475
-rw-r--r--erts/configure.in78
-rw-r--r--erts/doc/src/absform.xml10
-rw-r--r--erts/doc/src/driver_entry.xml13
-rw-r--r--erts/doc/src/erl.xml83
-rw-r--r--erts/doc/src/erl_dist_protocol.xml4
-rw-r--r--erts/doc/src/erl_driver.xml22
-rw-r--r--erts/doc/src/erl_ext_dist.xml4
-rw-r--r--erts/doc/src/erl_nif.xml7
-rw-r--r--erts/doc/src/erlang.xml7327
-rw-r--r--erts/doc/src/erts_alloc.xml74
-rw-r--r--erts/doc/src/escript.xml6
-rw-r--r--erts/doc/src/notes.xml180
-rw-r--r--erts/doc/src/run_erl.xml2
-rw-r--r--erts/doc/src/time_correction.xml772
-rw-r--r--erts/emulator/Makefile.in45
-rw-r--r--erts/emulator/beam/atom.names8
-rw-r--r--erts/emulator/beam/beam_bif_load.c6
-rw-r--r--erts/emulator/beam/beam_debug.c108
-rw-r--r--erts/emulator/beam/beam_emu.c1639
-rw-r--r--erts/emulator/beam/beam_load.c168
-rw-r--r--erts/emulator/beam/beam_load.h1
-rw-r--r--erts/emulator/beam/bif.c17
-rw-r--r--erts/emulator/beam/big.c25
-rw-r--r--erts/emulator/beam/big.h9
-rw-r--r--erts/emulator/beam/break.c4
-rw-r--r--erts/emulator/beam/copy.c117
-rw-r--r--erts/emulator/beam/dist.c32
-rw-r--r--erts/emulator/beam/erl_alloc.c142
-rw-r--r--erts/emulator/beam/erl_alloc.types51
-rw-r--r--erts/emulator/beam/erl_alloc_util.c38
-rw-r--r--erts/emulator/beam/erl_alloc_util.h3
-rw-r--r--erts/emulator/beam/erl_arith.c11
-rw-r--r--erts/emulator/beam/erl_async.c1
-rw-r--r--erts/emulator/beam/erl_bif_binary.c3
-rw-r--r--erts/emulator/beam/erl_bif_info.c13
-rw-r--r--erts/emulator/beam/erl_bif_op.c2
-rw-r--r--erts/emulator/beam/erl_bif_port.c10
-rw-r--r--erts/emulator/beam/erl_bif_re.c4
-rw-r--r--erts/emulator/beam/erl_bif_unique.c6
-rw-r--r--erts/emulator/beam/erl_binary.h15
-rw-r--r--erts/emulator/beam/erl_bits.c4
-rw-r--r--erts/emulator/beam/erl_db.c13
-rw-r--r--erts/emulator/beam/erl_db_hash.c16
-rw-r--r--erts/emulator/beam/erl_db_tree.c238
-rw-r--r--erts/emulator/beam/erl_db_util.c365
-rw-r--r--erts/emulator/beam/erl_db_util.h15
-rw-r--r--erts/emulator/beam/erl_debug.c25
-rw-r--r--erts/emulator/beam/erl_debug.h6
-rw-r--r--erts/emulator/beam/erl_driver.h19
-rw-r--r--erts/emulator/beam/erl_gc.c35
-rw-r--r--erts/emulator/beam/erl_init.c5
-rw-r--r--erts/emulator/beam/erl_lock_check.c3
-rw-r--r--erts/emulator/beam/erl_map.c28
-rw-r--r--erts/emulator/beam/erl_map.h19
-rw-r--r--erts/emulator/beam/erl_message.h3
-rw-r--r--erts/emulator/beam/erl_nif.h15
-rw-r--r--erts/emulator/beam/erl_nif_api_funcs.h2
-rw-r--r--erts/emulator/beam/erl_node_container_utils.h4
-rw-r--r--erts/emulator/beam/erl_node_tables.c16
-rw-r--r--erts/emulator/beam/erl_node_tables.h2
-rw-r--r--erts/emulator/beam/erl_port_task.c2
-rw-r--r--erts/emulator/beam/erl_printf_term.c31
-rw-r--r--erts/emulator/beam/erl_printf_term.h3
-rw-r--r--erts/emulator/beam/erl_process.c109
-rw-r--r--erts/emulator/beam/erl_process.h15
-rw-r--r--erts/emulator/beam/erl_process_dump.c6
-rw-r--r--erts/emulator/beam/erl_process_lock.h6
-rw-r--r--erts/emulator/beam/erl_term.c6
-rw-r--r--erts/emulator/beam/erl_term.h203
-rw-r--r--erts/emulator/beam/erl_threads.h10
-rw-r--r--erts/emulator/beam/erl_trace.c30
-rw-r--r--erts/emulator/beam/erl_utils.h17
-rw-r--r--erts/emulator/beam/erl_vm.h15
-rw-r--r--erts/emulator/beam/external.c86
-rw-r--r--erts/emulator/beam/global.h95
-rw-r--r--erts/emulator/beam/io.c63
-rw-r--r--erts/emulator/beam/ops.tab863
-rw-r--r--erts/emulator/beam/packet_parser.c5
-rw-r--r--erts/emulator/beam/packet_parser.h3
-rw-r--r--erts/emulator/beam/sys.h57
-rw-r--r--erts/emulator/beam/utils.c278
-rw-r--r--erts/emulator/drivers/common/efile_drv.c10
-rw-r--r--erts/emulator/drivers/common/inet_drv.c590
-rw-r--r--erts/emulator/drivers/ose/ose_efile.c1125
-rw-r--r--erts/emulator/drivers/ose/ose_signal_drv.c897
-rw-r--r--erts/emulator/drivers/ose/ttsl_drv.c69
-rw-r--r--erts/emulator/drivers/unix/ttsl_drv.c15
-rw-r--r--erts/emulator/drivers/unix/unix_efile.c10
-rw-r--r--erts/emulator/hipe/hipe_native_bif.c3
-rw-r--r--erts/emulator/sys/common/erl_check_io.c24
-rw-r--r--erts/emulator/sys/common/erl_mmap.c3
-rw-r--r--erts/emulator/sys/common/erl_mseg.c378
-rw-r--r--erts/emulator/sys/common/erl_mseg.h3
-rw-r--r--erts/emulator/sys/common/erl_poll.h22
-rw-r--r--erts/emulator/sys/ose/beam.lmconf26
-rw-r--r--erts/emulator/sys/ose/driver_int.h42
-rw-r--r--erts/emulator/sys/ose/erl_main.c54
-rw-r--r--erts/emulator/sys/ose/erl_ose_sys.h356
-rw-r--r--erts/emulator/sys/ose/erl_ose_sys_ddll.c127
-rw-r--r--erts/emulator/sys/ose/erl_poll.c818
-rw-r--r--erts/emulator/sys/ose/erts.sig17
-rw-r--r--erts/emulator/sys/ose/gcc_4.4.3_lm_ppc.lcf182
-rw-r--r--erts/emulator/sys/ose/gcc_4.6.3_lm_ppc.lcf242
-rw-r--r--erts/emulator/sys/ose/sys.c1847
-rw-r--r--erts/emulator/sys/ose/sys_float.c845
-rw-r--r--erts/emulator/sys/ose/sys_time.c57
-rw-r--r--erts/emulator/test/alloc_SUITE.erl14
-rw-r--r--erts/emulator/test/bif_SUITE.erl21
-rw-r--r--erts/emulator/test/driver_SUITE.erl12
-rw-r--r--erts/emulator/test/emulator.spec.ose2
-rw-r--r--erts/emulator/test/num_bif_SUITE.erl2
-rw-r--r--erts/emulator/test/process_SUITE.erl10
-rw-r--r--erts/emulator/test/system_info_SUITE.erl2
-rwxr-xr-xerts/emulator/utils/beam_makeops89
-rwxr-xr-xerts/emulator/utils/make_alloc_types2
-rwxr-xr-xerts/emulator/utils/make_version6
-rw-r--r--erts/emulator/utils/mkver.c6
-rw-r--r--erts/emulator/valgrind/suppress.halfword56
-rw-r--r--erts/epmd/src/Makefile.in37
-rw-r--r--erts/epmd/src/epmd.c2
-rw-r--r--erts/epmd/src/epmd_int.h18
-rw-r--r--erts/epmd/src/epmd_srv.c7
-rw-r--r--erts/etc/common/Makefile.in83
-rw-r--r--erts/etc/common/run_erl_common.c696
-rw-r--r--erts/etc/common/run_erl_common.h97
-rw-r--r--erts/etc/common/to_erl_common.c717
-rw-r--r--erts/etc/common/to_erl_common.h29
-rw-r--r--erts/etc/ose/etc.lmconf20
-rw-r--r--erts/etc/ose/run_erl.c664
-rw-r--r--erts/etc/ose/run_erl.h30
-rw-r--r--erts/etc/ose/run_erl_main.c80
-rw-r--r--erts/etc/unix/etp-commands.in16
-rw-r--r--erts/etc/unix/run_erl.c610
-rw-r--r--erts/etc/unix/run_erl.h (renamed from erts/etc/common/run_erl_vsn.h)7
-rw-r--r--erts/etc/unix/safe_string.c (renamed from erts/etc/common/safe_string.c)11
-rw-r--r--erts/etc/unix/safe_string.h (renamed from erts/etc/common/safe_string.h)11
-rw-r--r--erts/etc/unix/to_erl.c591
-rw-r--r--erts/etc/win32/msys_tools/vc/cc.sh10
-rw-r--r--erts/etc/win32/msys_tools/vc/emu_cc.sh1
-rw-r--r--erts/etc/win32/msys_tools/vc/mc.sh7
-rw-r--r--erts/etc/win32/msys_tools/vc/rc.sh7
-rw-r--r--erts/etc/win32/nsis/Makefile10
-rwxr-xr-xerts/etc/win32/nsis/find_redist.sh2
-rw-r--r--erts/include/erl_int_sizes_config.h.in3
-rw-r--r--erts/include/internal/erl_printf_format.h11
-rw-r--r--erts/include/internal/ethr_mutex.h8
-rw-r--r--erts/include/internal/ethread.h96
-rw-r--r--erts/include/internal/ose/ethr_event.h114
-rw-r--r--erts/include/internal/pthread/ethr_event.h11
-rw-r--r--erts/include/internal/win/ethr_event.h1
-rw-r--r--erts/lib_src/common/erl_misc_utils.c6
-rw-r--r--erts/lib_src/common/erl_printf_format.c25
-rw-r--r--erts/lib_src/common/ethr_aux.c15
-rw-r--r--erts/lib_src/common/ethr_mutex.c2
-rw-r--r--erts/lib_src/ose/ethr_event.c220
-rw-r--r--erts/lib_src/ose/ethread.c833
-rw-r--r--erts/lib_src/pthread/ethr_event.c97
-rw-r--r--erts/lib_src/win/ethr_event.c6
-rw-r--r--erts/preloaded/ebin/prim_inet.beambin72748 -> 72628 bytes
-rw-r--r--erts/preloaded/src/erlang.erl3
-rw-r--r--erts/preloaded/src/prim_inet.erl3
-rw-r--r--erts/test/otp_SUITE.erl27
-rw-r--r--erts/test/upgrade_SUITE.erl2
-rw-r--r--erts/vsn.mk2
-rw-r--r--lib/Makefile4
-rw-r--r--lib/asn1/c_src/Makefile7
-rw-r--r--lib/compiler/doc/src/notes.xml20
-rw-r--r--lib/compiler/src/Makefile2
-rw-r--r--lib/compiler/src/beam_block.erl484
-rw-r--r--lib/compiler/src/beam_bool.erl2
-rw-r--r--lib/compiler/src/beam_bs.erl278
-rw-r--r--lib/compiler/src/beam_clean.erl22
-rw-r--r--lib/compiler/src/beam_dead.erl57
-rw-r--r--lib/compiler/src/beam_jump.erl2
-rw-r--r--lib/compiler/src/beam_peep.erl44
-rw-r--r--lib/compiler/src/beam_reorder.erl139
-rw-r--r--lib/compiler/src/beam_split.erl4
-rw-r--r--lib/compiler/src/beam_type.erl156
-rw-r--r--lib/compiler/src/beam_utils.erl9
-rw-r--r--lib/compiler/src/beam_validator.erl31
-rw-r--r--lib/compiler/src/compile.erl8
-rw-r--r--lib/compiler/src/compiler.app.src2
-rw-r--r--lib/compiler/src/core_lib.erl38
-rw-r--r--lib/compiler/src/core_lint.erl4
-rwxr-xr-xlib/compiler/src/genop.tab10
-rw-r--r--lib/compiler/src/sys_core_fold.erl6
-rw-r--r--lib/compiler/src/v3_codegen.erl25
-rw-r--r--lib/compiler/src/v3_core.erl3
-rw-r--r--lib/compiler/test/Makefile4
-rw-r--r--lib/compiler/test/beam_reorder_SUITE.erl69
-rw-r--r--lib/compiler/test/beam_type_SUITE.erl98
-rw-r--r--lib/compiler/test/beam_validator_SUITE.erl6
-rw-r--r--lib/compiler/test/beam_validator_SUITE_data/xrange.S4
-rw-r--r--lib/compiler/test/bs_match_SUITE.erl18
-rw-r--r--lib/compiler/test/compile_SUITE.erl46
-rw-r--r--lib/compiler/test/misc_SUITE.erl12
-rw-r--r--lib/compiler/vsn.mk2
-rw-r--r--lib/crypto/Makefile4
-rw-r--r--lib/crypto/c_src/Makefile.in7
-rw-r--r--lib/crypto/c_src/crypto.c132
-rw-r--r--lib/crypto/doc/src/crypto.xml4
-rw-r--r--lib/crypto/doc/src/notes.xml16
-rw-r--r--lib/crypto/test/crypto_SUITE.erl6
-rw-r--r--lib/crypto/vsn.mk2
-rw-r--r--lib/debugger/doc/src/notes.xml16
-rw-r--r--lib/debugger/src/dbg_iload.erl2
-rw-r--r--lib/debugger/src/dbg_wx_win.erl7
-rw-r--r--lib/debugger/vsn.mk2
-rw-r--r--lib/dialyzer/doc/src/notes.xml74
-rw-r--r--lib/dialyzer/src/dialyzer.app.src2
-rw-r--r--lib/dialyzer/src/dialyzer.hrl10
-rw-r--r--lib/dialyzer/src/dialyzer_callgraph.erl21
-rw-r--r--lib/dialyzer/src/dialyzer_cl.erl2
-rw-r--r--lib/dialyzer/src/dialyzer_codeserver.erl10
-rw-r--r--lib/dialyzer/src/dialyzer_coordinator.erl21
-rw-r--r--lib/dialyzer/src/dialyzer_dataflow.erl28
-rw-r--r--lib/dialyzer/src/dialyzer_gui_wx.erl9
-rw-r--r--lib/dialyzer/src/dialyzer_races.erl40
-rw-r--r--lib/dialyzer/src/dialyzer_succ_typings.erl3
-rw-r--r--lib/dialyzer/src/dialyzer_typesig.erl37
-rw-r--r--lib/dialyzer/src/dialyzer_worker.erl7
-rw-r--r--lib/dialyzer/test/behaviour_SUITE_data/results/callbacks_and_specs6
-rw-r--r--lib/dialyzer/test/opaque_SUITE_data/results/crash10
-rw-r--r--lib/dialyzer/test/opaque_SUITE_data/results/simple2
-rw-r--r--lib/dialyzer/test/r9c_SUITE_data/results/mnesia2
-rw-r--r--lib/dialyzer/test/small_SUITE_data/results/bif13
-rw-r--r--lib/dialyzer/test/small_SUITE_data/results/fun_arity35
-rw-r--r--lib/dialyzer/test/small_SUITE_data/results/literals12
-rw-r--r--lib/dialyzer/test/small_SUITE_data/results/record_creation_diffs2
-rw-r--r--lib/dialyzer/test/small_SUITE_data/results/record_pat2
-rw-r--r--lib/dialyzer/test/small_SUITE_data/results/relevant_record_warning2
-rw-r--r--lib/dialyzer/test/small_SUITE_data/results/undefined2
-rw-r--r--lib/dialyzer/test/small_SUITE_data/src/bif1/bif1.erl16
-rw-r--r--lib/dialyzer/test/small_SUITE_data/src/bif1/bif1_adt.erl12
-rw-r--r--lib/dialyzer/test/small_SUITE_data/src/big_external_type.erl6
-rw-r--r--lib/dialyzer/test/small_SUITE_data/src/big_local_type.erl6
-rw-r--r--lib/dialyzer/test/small_SUITE_data/src/fun_arity.erl127
-rw-r--r--lib/dialyzer/test/small_SUITE_data/src/trec.erl2
-rw-r--r--lib/dialyzer/test/small_SUITE_data/undefined.erl29
-rw-r--r--lib/dialyzer/vsn.mk2
-rw-r--r--lib/diameter/doc/src/diameter.xml43
-rw-r--r--lib/diameter/doc/src/notes.xml69
-rw-r--r--lib/diameter/include/diameter_gen.hrl8
-rw-r--r--lib/diameter/src/base/diameter.erl1
-rw-r--r--lib/diameter/src/base/diameter_codec.erl10
-rw-r--r--lib/diameter/src/base/diameter_config.erl3
-rw-r--r--lib/diameter/src/base/diameter_peer_fsm.erl2
-rw-r--r--lib/diameter/src/base/diameter_service.erl6
-rw-r--r--lib/diameter/src/base/diameter_traffic.erl4
-rw-r--r--lib/diameter/src/base/diameter_watchdog.erl8
-rw-r--r--lib/diameter/src/diameter.appup.src4
-rw-r--r--lib/diameter/src/transport/diameter_sctp.erl12
-rw-r--r--lib/diameter/src/transport/diameter_tcp.erl2
-rw-r--r--lib/eldap/src/eldap.erl9
-rw-r--r--lib/erl_docgen/doc/src/erl_docgen_app.xml3
-rw-r--r--lib/erl_docgen/priv/css/otp_doc.css4
-rw-r--r--lib/erl_interface/src/Makefile.in63
-rw-r--r--lib/eunit/doc/overview.edoc2
-rw-r--r--lib/eunit/doc/src/notes.xml15
-rw-r--r--lib/eunit/src/eunit_surefire.erl6
-rw-r--r--lib/eunit/vsn.mk2
-rw-r--r--lib/hipe/cerl/cerl_cconv.erl13
-rw-r--r--lib/hipe/cerl/cerl_hipeify.erl12
-rw-r--r--lib/hipe/cerl/erl_bif_types.erl106
-rw-r--r--lib/hipe/cerl/erl_types.erl13
-rw-r--r--lib/hipe/doc/src/hipe_app.xml17
-rw-r--r--lib/hipe/doc/src/notes.xml76
-rw-r--r--lib/hipe/flow/cfg.hrl8
-rw-r--r--lib/hipe/icode/hipe_icode.erl36
-rw-r--r--lib/hipe/icode/hipe_icode.hrl3
-rw-r--r--lib/hipe/icode/hipe_icode_exceptions.erl20
-rw-r--r--lib/hipe/icode/hipe_icode_ssa_struct_reuse.erl6
-rw-r--r--lib/hipe/main/hipe.erl5
-rw-r--r--lib/hipe/main/hipe.hrl.src5
-rw-r--r--lib/hipe/main/hipe_main.erl16
-rw-r--r--lib/hipe/rtl/hipe_rtl_binary_construct.erl9
-rw-r--r--lib/hipe/test/bs_SUITE_data/bs_construct.erl16
-rw-r--r--lib/hipe/vsn.mk2
-rw-r--r--lib/inets/doc/src/Makefile1
-rw-r--r--lib/inets/doc/src/ftp.xml471
-rw-r--r--lib/inets/doc/src/ftp_client.xml50
-rw-r--r--lib/inets/doc/src/http_client.xml96
-rw-r--r--lib/inets/doc/src/http_server.xml860
-rw-r--r--lib/inets/doc/src/http_uri.xml148
-rw-r--r--lib/inets/doc/src/httpc.xml839
-rw-r--r--lib/inets/doc/src/httpd.xml1028
-rw-r--r--lib/inets/doc/src/httpd_conf.xml163
-rw-r--r--lib/inets/doc/src/httpd_custom_api.xml16
-rw-r--r--lib/inets/doc/src/httpd_socket.xml24
-rw-r--r--lib/inets/doc/src/httpd_util.xml260
-rw-r--r--lib/inets/doc/src/inets.xml109
-rw-r--r--lib/inets/doc/src/inets_services.xml59
-rw-r--r--lib/inets/doc/src/introduction.xml57
-rw-r--r--lib/inets/doc/src/mod_alias.xml60
-rw-r--r--lib/inets/doc/src/mod_auth.xml384
-rw-r--r--lib/inets/doc/src/mod_esi.xml73
-rw-r--r--lib/inets/doc/src/mod_security.xml140
-rw-r--r--lib/inets/doc/src/notes.xml126
-rw-r--r--lib/inets/doc/src/part.xml14
-rw-r--r--lib/inets/doc/src/ref_man.xml7
-rw-r--r--lib/inets/doc/src/tftp.xml555
-rw-r--r--lib/inets/src/http_client/httpc_handler.erl10
-rw-r--r--lib/inets/src/http_client/httpc_response.erl2
-rw-r--r--lib/inets/src/http_lib/http_response.erl30
-rw-r--r--lib/inets/src/http_lib/http_transport.erl2
-rw-r--r--lib/inets/src/http_lib/http_uri.erl31
-rw-r--r--lib/inets/src/http_server/Makefile12
-rw-r--r--lib/inets/src/http_server/httpd_custom.erl31
-rw-r--r--lib/inets/src/http_server/httpd_custom_api.erl (renamed from lib/webtool/src/webtool.app.src)23
-rw-r--r--lib/inets/src/http_server/httpd_request_handler.erl14
-rw-r--r--lib/inets/src/http_server/httpd_response.erl21
-rw-r--r--lib/inets/src/http_server/httpd_sup.erl34
-rw-r--r--lib/inets/src/http_server/mod_auth_server.erl2
-rw-r--r--lib/inets/src/http_server/mod_security_server.erl4
-rw-r--r--lib/inets/src/inets_app/inets.appup.src2
-rw-r--r--lib/inets/src/tftp/tftp_engine.erl15
-rw-r--r--lib/inets/test/Makefile7
-rw-r--r--lib/inets/test/httpc_SUITE.erl15
-rw-r--r--lib/inets/test/httpc_proxy_SUITE.erl20
-rwxr-xr-xlib/inets/test/httpc_proxy_SUITE_data/server_proxy.sh2
-rw-r--r--lib/inets/test/httpd_SUITE.erl38
-rw-r--r--lib/inets/test/httpd_test_lib.erl4
-rw-r--r--lib/inets/test/inets_SUITE.erl167
-rw-r--r--lib/inets/test/inets_socketwrap_SUITE.erl154
-rw-r--r--lib/inets/test/inets_socketwrap_SUITE_data/Makefile.src (renamed from lib/ose/Makefile)38
-rw-r--r--lib/inets/test/inets_socketwrap_SUITE_data/setuid_socket_wrap.c259
-rw-r--r--lib/inets/test/inets_test_lib.erl9
-rw-r--r--lib/inets/test/uri_SUITE.erl23
-rw-r--r--lib/inets/vsn.mk2
-rw-r--r--lib/kernel/doc/src/app.xml2
-rw-r--r--lib/kernel/doc/src/application.xml5
-rw-r--r--lib/kernel/doc/src/auth.xml8
-rw-r--r--lib/kernel/doc/src/code.xml4
-rw-r--r--lib/kernel/doc/src/disk_log.xml12
-rw-r--r--lib/kernel/doc/src/erl_ddll.xml22
-rw-r--r--lib/kernel/doc/src/error_logger.xml2
-rw-r--r--lib/kernel/doc/src/file.xml25
-rw-r--r--lib/kernel/doc/src/gen_sctp.xml14
-rw-r--r--lib/kernel/doc/src/gen_tcp.xml5
-rw-r--r--lib/kernel/doc/src/gen_udp.xml4
-rw-r--r--lib/kernel/doc/src/inet.xml35
-rw-r--r--lib/kernel/doc/src/inet_res.xml31
-rw-r--r--lib/kernel/doc/src/net_adm.xml4
-rw-r--r--lib/kernel/doc/src/notes.xml36
-rw-r--r--lib/kernel/doc/src/os.xml4
-rw-r--r--lib/kernel/doc/src/ref_man.xml.src68
-rw-r--r--lib/kernel/include/file.hrl31
-rw-r--r--lib/kernel/src/disk_log.erl68
-rw-r--r--lib/kernel/src/disk_log.hrl6
-rw-r--r--lib/kernel/src/global.erl20
-rw-r--r--lib/kernel/src/global_group.erl4
-rw-r--r--lib/kernel/src/inet.erl4
-rw-r--r--lib/kernel/src/inet6_tcp.erl19
-rw-r--r--lib/kernel/src/inet6_tcp_dist.erl365
-rw-r--r--lib/kernel/src/inet_config.erl3
-rw-r--r--lib/kernel/src/inet_dns_record_adts.pl6
-rw-r--r--lib/kernel/src/inet_int.hrl1
-rw-r--r--lib/kernel/src/inet_tcp.erl16
-rw-r--r--lib/kernel/src/inet_tcp_dist.erl157
-rw-r--r--lib/kernel/src/kernel.app.src4
-rw-r--r--lib/kernel/src/kernel.appup.src6
-rw-r--r--lib/kernel/src/os.erl2
-rw-r--r--lib/kernel/test/bif_SUITE.erl10
-rw-r--r--lib/kernel/test/erl_prim_loader_SUITE.erl71
-rw-r--r--lib/kernel/test/file_SUITE.erl22
-rw-r--r--lib/kernel/test/gen_tcp_api_SUITE.erl19
-rw-r--r--lib/kernel/test/gen_tcp_misc_SUITE.erl16
-rw-r--r--lib/kernel/test/prim_file_SUITE.erl12
-rw-r--r--lib/kernel/vsn.mk2
-rw-r--r--lib/mnesia/doc/src/notes.xml34
-rw-r--r--lib/mnesia/src/mnesia_bup.erl14
-rw-r--r--lib/mnesia/src/mnesia_index.erl27
-rw-r--r--lib/mnesia/test/mnesia_dirty_access_test.erl19
-rw-r--r--lib/mnesia/test/mnesia_evil_backup.erl10
-rw-r--r--lib/mnesia/vsn.mk2
-rw-r--r--lib/observer/src/cdv_ets_cb.erl2
-rw-r--r--lib/observer/src/crashdump_viewer.erl2
-rw-r--r--lib/observer/src/observer_sys_wx.erl6
-rw-r--r--lib/odbc/doc/src/notes.xml26
-rw-r--r--lib/odbc/vsn.mk2
-rw-r--r--lib/os_mon/doc/src/cpu_sup.xml2
-rw-r--r--lib/ose/doc/man3/.gitignore0
-rw-r--r--lib/ose/doc/man6/.gitignore0
-rw-r--r--lib/ose/doc/pdf/.gitignore0
-rw-r--r--lib/ose/doc/src/.gitignore1
-rw-r--r--lib/ose/doc/src/Makefile133
-rw-r--r--lib/ose/doc/src/book.xml49
-rw-r--r--lib/ose/doc/src/notes.xml109
-rw-r--r--lib/ose/doc/src/ose_app.xml38
-rw-r--r--lib/ose/doc/src/ose_erl_driver.xml111
-rw-r--r--lib/ose/doc/src/ose_intro.xml154
-rw-r--r--lib/ose/doc/src/ose_signals_chapter.xml240
-rw-r--r--lib/ose/doc/src/part.xml39
-rw-r--r--lib/ose/doc/src/ref_man.xml40
-rw-r--r--lib/ose/ebin/.gitignore0
-rw-r--r--lib/ose/include/.gitignore0
-rw-r--r--lib/ose/info2
-rw-r--r--lib/ose/src/Makefile107
-rw-r--r--lib/ose/src/ose.app.src28
-rw-r--r--lib/ose/src/ose.appup.src23
-rw-r--r--lib/ose/src/ose.erl453
-rw-r--r--lib/ose/test/Makefile67
-rw-r--r--lib/ose/test/ose.cover2
-rw-r--r--lib/ose/test/ose.spec1
-rw-r--r--lib/ose/test/ose_SUITE.erl766
-rw-r--r--lib/ose/vsn.mk1
-rw-r--r--lib/parsetools/doc/src/leex.xml2
-rw-r--r--lib/parsetools/doc/src/yecc.xml2
-rw-r--r--lib/public_key/doc/src/notes.xml15
-rw-r--r--lib/public_key/doc/src/public_key.xml4
-rw-r--r--lib/public_key/src/pubkey_ssh.erl146
-rw-r--r--lib/public_key/src/public_key.erl36
-rw-r--r--lib/public_key/test/public_key_SUITE.erl32
-rw-r--r--lib/public_key/test/public_key_SUITE_data/openssh_ecdsa_pub1
-rw-r--r--lib/public_key/test/public_key_SUITE_data/ssh2_ecdsa_pub6
-rw-r--r--lib/public_key/vsn.mk2
-rw-r--r--lib/reltool/src/reltool.hrl46
-rw-r--r--lib/runtime_tools/c_src/Makefile.in7
-rw-r--r--lib/runtime_tools/doc/src/dbg.xml7
-rw-r--r--lib/sasl/doc/src/notes.xml26
-rw-r--r--lib/sasl/src/sasl.app.src4
-rw-r--r--lib/sasl/src/sasl.appup.src6
-rw-r--r--lib/sasl/test/systools_SUITE.erl5
-rw-r--r--lib/sasl/vsn.mk2
-rw-r--r--lib/snmp/doc/src/snmp_advanced_agent.xml2
-rw-r--r--lib/ssh/doc/src/notes.xml134
-rw-r--r--lib/ssh/doc/src/ssh.xml29
-rw-r--r--lib/ssh/src/ssh.erl15
-rw-r--r--lib/ssh/src/ssh.hrl14
-rw-r--r--lib/ssh/src/ssh_auth.erl113
-rw-r--r--lib/ssh/src/ssh_auth.hrl2
-rw-r--r--lib/ssh/src/ssh_connection.erl27
-rw-r--r--lib/ssh/src/ssh_connection_handler.erl130
-rw-r--r--lib/ssh/src/ssh_file.erl64
-rw-r--r--lib/ssh/src/ssh_message.erl153
-rw-r--r--lib/ssh/src/ssh_transport.erl420
-rw-r--r--lib/ssh/src/ssh_transport.hrl7
-rw-r--r--lib/ssh/test/ssh_algorithms_SUITE.erl46
-rw-r--r--lib/ssh/test/ssh_basic_SUITE.erl151
-rw-r--r--lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa2565
-rw-r--r--lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa256.pub1
-rw-r--r--lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa3846
-rw-r--r--lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa384.pub1
-rw-r--r--lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa5217
-rw-r--r--lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa521.pub1
-rw-r--r--lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key2565
-rw-r--r--lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key256.pub1
-rw-r--r--lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key3846
-rw-r--r--lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key384.pub1
-rw-r--r--lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key5217
-rw-r--r--lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key521.pub1
-rw-r--r--lib/ssh/test/ssh_connection_SUITE.erl121
-rw-r--r--lib/ssh/test/ssh_options_SUITE.erl14
-rw-r--r--lib/ssh/test/ssh_protocol_SUITE.erl169
-rw-r--r--lib/ssh/test/ssh_renegotiate_SUITE.erl13
-rw-r--r--lib/ssh/test/ssh_sftp_SUITE.erl6
-rw-r--r--lib/ssh/test/ssh_sftpd_SUITE.erl2
-rw-r--r--lib/ssh/test/ssh_test_lib.erl213
-rw-r--r--lib/ssh/test/ssh_to_openssh_SUITE.erl285
-rw-r--r--lib/ssh/test/ssh_trpt_test_lib.erl16
-rw-r--r--lib/ssh/test/ssh_upgrade_SUITE.erl23
-rw-r--r--lib/ssh/vsn.mk2
-rw-r--r--lib/ssl/doc/src/notes.xml58
-rw-r--r--lib/ssl/doc/src/ssl.xml15
-rw-r--r--lib/ssl/doc/src/ssl_app.xml11
-rw-r--r--lib/ssl/src/ssl.appup.src12
-rw-r--r--lib/ssl/src/ssl.erl41
-rw-r--r--lib/ssl/src/ssl_connection.erl95
-rw-r--r--lib/ssl/src/ssl_connection.hrl23
-rw-r--r--lib/ssl/src/ssl_internal.hrl14
-rw-r--r--lib/ssl/src/ssl_session.erl4
-rw-r--r--lib/ssl/src/ssl_session_cache.erl2
-rw-r--r--lib/ssl/src/tls_connection.erl55
-rw-r--r--lib/ssl/test/ssl_ECC_SUITE.erl44
-rw-r--r--lib/ssl/test/ssl_basic_SUITE.erl79
-rw-r--r--lib/ssl/test/ssl_session_cache_SUITE.erl71
-rw-r--r--lib/ssl/test/ssl_test_lib.erl29
-rw-r--r--lib/ssl/test/ssl_upgrade_SUITE.erl204
-rw-r--r--lib/ssl/vsn.mk2
-rw-r--r--lib/stdlib/doc/src/array.xml4
-rw-r--r--lib/stdlib/doc/src/assert_hrl.xml11
-rw-r--r--lib/stdlib/doc/src/beam_lib.xml18
-rw-r--r--lib/stdlib/doc/src/binary.xml4
-rw-r--r--lib/stdlib/doc/src/c.xml2
-rw-r--r--lib/stdlib/doc/src/calendar.xml4
-rw-r--r--lib/stdlib/doc/src/dets.xml56
-rw-r--r--lib/stdlib/doc/src/digraph.xml6
-rw-r--r--lib/stdlib/doc/src/digraph_utils.xml5
-rw-r--r--lib/stdlib/doc/src/epp.xml2
-rw-r--r--lib/stdlib/doc/src/erl_anno.xml34
-rw-r--r--lib/stdlib/doc/src/erl_parse.xml2
-rw-r--r--lib/stdlib/doc/src/erl_pp.xml4
-rw-r--r--lib/stdlib/doc/src/erl_scan.xml187
-rw-r--r--lib/stdlib/doc/src/erl_tar.xml3
-rw-r--r--lib/stdlib/doc/src/ets.xml15
-rw-r--r--lib/stdlib/doc/src/file_sorter.xml52
-rw-r--r--lib/stdlib/doc/src/gen_event.xml4
-rw-r--r--lib/stdlib/doc/src/gen_fsm.xml7
-rw-r--r--lib/stdlib/doc/src/gen_server.xml2
-rw-r--r--lib/stdlib/doc/src/io.xml18
-rw-r--r--lib/stdlib/doc/src/lists.xml6
-rw-r--r--lib/stdlib/doc/src/math.xml2
-rw-r--r--lib/stdlib/doc/src/notes.xml118
-rw-r--r--lib/stdlib/doc/src/random.xml12
-rw-r--r--lib/stdlib/doc/src/re.xml16
-rw-r--r--lib/stdlib/doc/src/sofs.xml5
-rw-r--r--lib/stdlib/doc/src/supervisor.xml2
-rw-r--r--lib/stdlib/doc/src/sys.xml4
-rw-r--r--lib/stdlib/doc/src/timer.xml8
-rw-r--r--lib/stdlib/doc/src/unicode.xml2
-rw-r--r--lib/stdlib/doc/src/zip.xml2
-rw-r--r--lib/stdlib/include/erl_bits.hrl10
-rw-r--r--lib/stdlib/src/beam_lib.erl19
-rw-r--r--lib/stdlib/src/edlin.erl4
-rw-r--r--lib/stdlib/src/epp.erl3
-rw-r--r--lib/stdlib/src/erl_anno.erl96
-rw-r--r--lib/stdlib/src/erl_lint.erl22
-rw-r--r--lib/stdlib/src/erl_parse.yrl49
-rw-r--r--lib/stdlib/src/erl_scan.erl267
-rw-r--r--lib/stdlib/src/error_logger_file_h.erl10
-rw-r--r--lib/stdlib/src/escript.erl8
-rw-r--r--lib/stdlib/src/otp_internal.erl55
-rw-r--r--lib/stdlib/src/re.erl101
-rw-r--r--lib/stdlib/src/shell.erl2
-rw-r--r--lib/stdlib/src/slave.erl23
-rw-r--r--lib/stdlib/src/stdlib.app.src2
-rw-r--r--lib/stdlib/src/stdlib.appup.src6
-rw-r--r--lib/stdlib/src/supervisor.erl76
-rw-r--r--lib/stdlib/test/base64_SUITE.erl38
-rw-r--r--lib/stdlib/test/epp_SUITE.erl23
-rw-r--r--lib/stdlib/test/erl_anno_SUITE.erl72
-rw-r--r--lib/stdlib/test/erl_lint_SUITE.erl38
-rw-r--r--lib/stdlib/test/erl_pp_SUITE.erl6
-rw-r--r--lib/stdlib/test/erl_scan_SUITE.erl279
-rw-r--r--lib/stdlib/test/error_logger_h_SUITE.erl6
-rw-r--r--lib/stdlib/test/ets_SUITE.erl18
-rw-r--r--lib/stdlib/test/filename_SUITE.erl35
-rw-r--r--lib/stdlib/test/gen_event_SUITE.erl11
-rw-r--r--lib/stdlib/test/id_transform_SUITE.erl53
-rw-r--r--lib/stdlib/test/io_SUITE.erl213
-rw-r--r--lib/stdlib/test/io_proto_SUITE.erl162
-rw-r--r--lib/stdlib/test/lists_SUITE.erl163
-rw-r--r--lib/stdlib/test/proc_lib_SUITE.erl178
-rw-r--r--lib/stdlib/test/rand_SUITE.erl23
-rw-r--r--lib/stdlib/test/re_SUITE.erl129
-rw-r--r--lib/stdlib/vsn.mk2
-rw-r--r--lib/syntax_tools/src/erl_syntax.erl2
-rw-r--r--lib/syntax_tools/src/erl_tidy.erl10
-rw-r--r--lib/syntax_tools/src/igor.erl5
-rw-r--r--lib/syntax_tools/src/merl.erl22
-rw-r--r--lib/syntax_tools/src/merl_transform.erl16
-rw-r--r--lib/test_server/doc/src/notes.xml12
-rw-r--r--lib/test_server/src/erl2html2.erl31
-rw-r--r--lib/test_server/src/test_server_gl.erl4
-rw-r--r--lib/test_server/src/ts_lib.erl4
-rw-r--r--lib/tools/Makefile2
-rw-r--r--lib/tools/c_src/Makefile.in8
-rw-r--r--lib/tools/doc/src/cover_chapter.xml43
-rw-r--r--lib/tools/doc/src/eprof.xml2
-rw-r--r--lib/tools/doc/src/notes.xml19
-rw-r--r--lib/tools/emacs/erlang.el2
-rw-r--r--lib/tools/priv/.gitignore (renamed from lib/ose/doc/html/.gitignore)0
-rw-r--r--lib/tools/priv/Makefile69
-rw-r--r--lib/tools/priv/cover.tool2
-rw-r--r--lib/tools/priv/index.html10
-rw-r--r--lib/tools/src/Makefile1
-rw-r--r--lib/tools/src/cover.erl6
-rw-r--r--lib/tools/src/cover_web.erl1185
-rw-r--r--lib/tools/src/lcnt.erl8
-rw-r--r--lib/tools/src/tools.app.src5
-rw-r--r--lib/tools/test/cover_SUITE.erl24
-rw-r--r--lib/tools/test/cover_SUITE_data/include_eunit_hrl/cover_inc_eunit.erl6
-rw-r--r--lib/tools/test/xref_SUITE.erl28
-rw-r--r--lib/tools/vsn.mk2
-rw-r--r--lib/typer/src/typer.erl10
-rw-r--r--lib/webtool/AUTHORS4
-rw-r--r--lib/webtool/Makefile39
-rw-r--r--lib/webtool/doc/html/.gitignore0
-rw-r--r--lib/webtool/doc/man1/.gitignore0
-rw-r--r--lib/webtool/doc/man3/.gitignore0
-rw-r--r--lib/webtool/doc/pdf/.gitignore0
-rw-r--r--lib/webtool/doc/src/Makefile132
-rw-r--r--lib/webtool/doc/src/book.xml48
-rw-r--r--lib/webtool/doc/src/fascicules.xml18
-rw-r--r--lib/webtool/doc/src/notes.xml253
-rw-r--r--lib/webtool/doc/src/notes_history.xml74
-rw-r--r--lib/webtool/doc/src/part.xml38
-rw-r--r--lib/webtool/doc/src/part_notes.xml40
-rw-r--r--lib/webtool/doc/src/part_notes_history.xml40
-rw-r--r--lib/webtool/doc/src/ref_man.xml39
-rw-r--r--lib/webtool/doc/src/start_webtool.xml104
-rw-r--r--lib/webtool/doc/src/webtool.xml157
-rw-r--r--lib/webtool/doc/src/webtool_chapter.xml246
-rw-r--r--lib/webtool/ebin/.gitignore0
-rw-r--r--lib/webtool/info2
-rw-r--r--lib/webtool/priv/Makefile82
-rwxr-xr-xlib/webtool/priv/bin/start_webtool3
-rw-r--r--lib/webtool/priv/bin/start_webtool.bat2
-rw-r--r--lib/webtool/priv/root/conf/mime.types99
-rw-r--r--lib/webtool/priv/root/doc/index.html11
-rw-r--r--lib/webtool/priv/root/doc/start_info.html28
-rw-r--r--lib/webtool/priv/root/doc/tool_management.html9
-rw-r--r--lib/webtool/src/Makefile98
-rw-r--r--lib/webtool/src/webtool.appup.src22
-rw-r--r--lib/webtool/src/webtool.erl1208
-rw-r--r--lib/webtool/src/webtool_sup.erl75
-rw-r--r--lib/webtool/test/Makefile65
-rw-r--r--lib/webtool/test/webtool.spec1
-rw-r--r--lib/webtool/test/webtool_SUITE.erl51
-rw-r--r--lib/webtool/vsn.mk1
-rw-r--r--lib/wx/api_gen/Makefile2
-rw-r--r--lib/wx/api_gen/wx_extra/added_func.h28
-rw-r--r--lib/wx/api_gen/wx_gen.erl9
-rw-r--r--lib/wx/api_gen/wx_gen_cpp.erl26
-rw-r--r--lib/wx/api_gen/wxapi.conf54
-rw-r--r--lib/wx/c_src/gen/wxe_events.cpp575
-rw-r--r--lib/wx/c_src/gen/wxe_funcs.cpp248
-rw-r--r--lib/wx/c_src/gen/wxe_macros.h1826
-rw-r--r--lib/wx/doc/src/notes.xml15
-rw-r--r--lib/wx/examples/demo/ex_aui.erl81
-rw-r--r--lib/wx/include/wx.hrl2
-rw-r--r--lib/wx/src/gen/wxAuiDockArt.erl59
-rw-r--r--lib/wx/src/gen/wxAuiManager.erl4
-rw-r--r--lib/wx/src/gen/wxAuiManagerEvent.erl4
-rw-r--r--lib/wx/src/gen/wxAuiPaneInfo.erl90
-rw-r--r--lib/wx/src/gen/wxAuiSimpleTabArt.erl67
-rw-r--r--lib/wx/src/gen/wxAuiTabArt.erl59
-rw-r--r--lib/wx/src/gen/wxe_debug.hrl1826
-rw-r--r--lib/wx/src/gen/wxe_funcs.hrl1826
-rw-r--r--lib/wx/vsn.mk2
-rw-r--r--lib/xmerl/src/xmerl_xsd.erl127
-rw-r--r--lib/xmerl/test/xmerl_xsd_SUITE.erl18
-rw-r--r--lib/xmerl/test/xmerl_xsd_SUITE_data/book.xml5
-rw-r--r--lib/xmerl/test/xmerl_xsd_SUITE_data/book.xsd13
-rw-r--r--lib/xmerl/test/xmerl_xsd_SUITE_data/xml.xsd287
-rw-r--r--make/ose_lm.mk.in76
-rw-r--r--make/otp.mk.in10
-rwxr-xr-xotp_build4
-rw-r--r--otp_versions.table5
-rw-r--r--system/doc/design_principles/des_princ.xml2
-rw-r--r--system/doc/efficiency_guide/binaryhandling.xml6
-rw-r--r--system/doc/tutorial/ei.c2
-rw-r--r--system/doc/tutorial/example.xmlsrc6
-rw-r--r--xcomp/erl-xcomp-powerpc-ose5.conf358
-rw-r--r--xcomp/erl-xcomp-sfk-linux-ose5.conf305
-rw-r--r--xcomp/erl-xcomp-vars.sh2
842 files changed, 21904 insertions, 37475 deletions
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000000..48d8031bd0
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,40 @@
+language: erlang
+
+otp_release:
+ - 18.0
+
+sudo: false
+
+addons:
+ apt:
+ packages:
+ - autoconf
+ - libncurses-dev
+ - build-essential
+ - libssl-dev
+ - libwxgtk2.8-dev
+ - libgl1-mesa-dev
+ - libglu1-mesa-dev
+ - libpng3
+ - default-jdk
+ - g++
+ - xsltproc
+
+before_script:
+ - set -e
+ - export ERL_TOP=$PWD
+ - export PATH=$ERL_TOP/bin:$PATH
+ - export ERL_LIBS=''
+ - export MAKEFLAGS=-j6
+ - kerl_deactivate
+
+script:
+ - ./otp_build all -a
+
+after_success:
+ - ./otp_build tests && make release_docs
+
+after_script:
+ - cd $ERL_TOP/release/tests/test_server && $ERL_TOP/bin/erl -s ts install -s ts smoke_test batch -s init stop
+
+
diff --git a/HOWTO/INSTALL-CROSS.md b/HOWTO/INSTALL-CROSS.md
index 224f238fd0..0c984a825d 100644
--- a/HOWTO/INSTALL-CROSS.md
+++ b/HOWTO/INSTALL-CROSS.md
@@ -520,29 +520,6 @@ When a variable has been set, no warning will be issued.
`posix_memalign` implementation that accepts larger than page size
alignment.
-* `erl_xcomp_ose_ldflags_pass1` - Linker flags for the OSE module (pass 1)
-
-* `erl_xcomp_ose_ldflags_pass2` - Linker flags for the OSE module (pass 2)
-
-* `erl_xcomp_ose_OSEROOT` - OSE installation root directory
-
-* `erl_xcomp_ose_STRIP` - Strip utility shipped with the OSE distribution
-
-* `erl_xcomp_ose_LM_POST_LINK` - OSE postlink tool
-
-* `erl_xcomp_ose_LM_SET_CONF` - Sets the configuration for an OSE load module
-
-* `erl_xcomp_ose_LM_ELF_SIZE` - Prints the section size information for an
- OSE load module
-
-* `erl_xcomp_ose_LM_LCF` - OSE load module linker configuration file
-
-* `erl_xcomp_ose_BEAM_LM_CONF` - Beam OSE load module configuration file
-
-* `erl_xcomp_ose_EPMD_LM_CONF` - EPMD OSE load module configuration file
-
-* `erl_xcomp_ose_RUN_ERL_LM_CONF` - run_erl_lm OSE load module configuration file
-
Copyright and License
---------------------
diff --git a/HOWTO/INSTALL.md b/HOWTO/INSTALL.md
index 837e6cbd76..51e8648a4a 100644
--- a/HOWTO/INSTALL.md
+++ b/HOWTO/INSTALL.md
@@ -210,6 +210,14 @@ the `$PATH`.
$ export PATH=$ERL_TOP/bin:$PATH # Assuming bash/sh
+For the FOP print formatter, two steps must be taken:
+
+* Adding the location of your installation of `fop` in `$FOP_HOME`.
+
+ $ export FOP_HOME=/path/to/fop/dir # Assuming bash/sh
+
+* Adding the `fop` script (in `$FOP_HOME`) to your `$PATH`, either by adding `$FOP_HOME` to `$PATH`, or by copying the `fop` script to a directory already in your `$PATH`.
+
Build the documentation.
$ make docs
@@ -406,6 +414,12 @@ Some of the available `configure` options are:
time source with elapsed time during suspend.
* `--disable-prefer-elapsed-monotonic-time-during-suspend` - Do not prefer an OS
monotonic time source with elapsed time during suspend.
+* `--with-clock-resolution=high|low` - Try to find clock sources for OS system
+ time, and OS monotonic time with higher or lower resolution than chosen by
+ default. Note that both alternatives may have a negative impact on the performance
+ and scalability compared to the default clock sources chosen.
+* `--disable-saved-compile-time` - Disable saving of compile date and time
+ in the emulator binary.
* `--enable-dirty-schedulers` - Enable the **experimental** dirty schedulers
functionality. Note that the dirty schedulers functionality is experimental,
and **not supported**. This functionality **will** be subject to backward
@@ -502,7 +516,7 @@ If you have Xcode 4.3, or later, you will also need to download
If you want to build the `wx` application, you will need to get wxWidgets-3.0
(`wxWidgets-3.0.0.tar.bz2` from <http://sourceforge.net/projects/wxwindows/files/3.0.0/>) or get it from github with bug fixes:
- $ git clone --branch WX_3_0_branch [email protected]:wxWidgets/wxWidgets.git
+ $ git clone --branch WX_3_0_BRANCH [email protected]:wxWidgets/wxWidgets.git
Be aware that the wxWidgets-3.0 is a new release of wxWidgets, it is not as
mature as the old releases and the OS X port still lags behind the other ports.
diff --git a/OTP_VERSION b/OTP_VERSION
index d1ac72de28..0b602e3cc8 100644
--- a/OTP_VERSION
+++ b/OTP_VERSION
@@ -1 +1 @@
-18.0.3
+19.0-rc0
diff --git a/bootstrap/bin/start.boot b/bootstrap/bin/start.boot
index 25c092961c..b93d49f146 100644
--- a/bootstrap/bin/start.boot
+++ b/bootstrap/bin/start.boot
Binary files differ
diff --git a/bootstrap/bin/start_clean.boot b/bootstrap/bin/start_clean.boot
index 25c092961c..b93d49f146 100644
--- a/bootstrap/bin/start_clean.boot
+++ b/bootstrap/bin/start_clean.boot
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/beam_a.beam b/bootstrap/lib/compiler/ebin/beam_a.beam
index 3ff689bd81..599f9cb073 100644
--- a/bootstrap/lib/compiler/ebin/beam_a.beam
+++ b/bootstrap/lib/compiler/ebin/beam_a.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/beam_asm.beam b/bootstrap/lib/compiler/ebin/beam_asm.beam
index b25c33084f..3656edb0a0 100644
--- a/bootstrap/lib/compiler/ebin/beam_asm.beam
+++ b/bootstrap/lib/compiler/ebin/beam_asm.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/beam_block.beam b/bootstrap/lib/compiler/ebin/beam_block.beam
index 59084464a0..2854b91bae 100644
--- a/bootstrap/lib/compiler/ebin/beam_block.beam
+++ b/bootstrap/lib/compiler/ebin/beam_block.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/beam_bool.beam b/bootstrap/lib/compiler/ebin/beam_bool.beam
index 0fa7612114..15ca7ee757 100644
--- a/bootstrap/lib/compiler/ebin/beam_bool.beam
+++ b/bootstrap/lib/compiler/ebin/beam_bool.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/beam_bs.beam b/bootstrap/lib/compiler/ebin/beam_bs.beam
new file mode 100644
index 0000000000..0823cb2dd7
--- /dev/null
+++ b/bootstrap/lib/compiler/ebin/beam_bs.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/beam_bsm.beam b/bootstrap/lib/compiler/ebin/beam_bsm.beam
index a6757dfcfb..4294fcb23f 100644
--- a/bootstrap/lib/compiler/ebin/beam_bsm.beam
+++ b/bootstrap/lib/compiler/ebin/beam_bsm.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/beam_clean.beam b/bootstrap/lib/compiler/ebin/beam_clean.beam
index 2fd2d2a82f..0f24e040e3 100644
--- a/bootstrap/lib/compiler/ebin/beam_clean.beam
+++ b/bootstrap/lib/compiler/ebin/beam_clean.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/beam_dead.beam b/bootstrap/lib/compiler/ebin/beam_dead.beam
index 6ae6de1d8b..10926614e6 100644
--- a/bootstrap/lib/compiler/ebin/beam_dead.beam
+++ b/bootstrap/lib/compiler/ebin/beam_dead.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/beam_dict.beam b/bootstrap/lib/compiler/ebin/beam_dict.beam
index 17b3c40eda..1576d1bb8f 100644
--- a/bootstrap/lib/compiler/ebin/beam_dict.beam
+++ b/bootstrap/lib/compiler/ebin/beam_dict.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/beam_disasm.beam b/bootstrap/lib/compiler/ebin/beam_disasm.beam
index b63864c96c..5c2308ef9d 100644
--- a/bootstrap/lib/compiler/ebin/beam_disasm.beam
+++ b/bootstrap/lib/compiler/ebin/beam_disasm.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/beam_except.beam b/bootstrap/lib/compiler/ebin/beam_except.beam
index f4fccfeef7..e5d2c51c4d 100644
--- a/bootstrap/lib/compiler/ebin/beam_except.beam
+++ b/bootstrap/lib/compiler/ebin/beam_except.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/beam_flatten.beam b/bootstrap/lib/compiler/ebin/beam_flatten.beam
index c1d5604349..f6fc8dfc50 100644
--- a/bootstrap/lib/compiler/ebin/beam_flatten.beam
+++ b/bootstrap/lib/compiler/ebin/beam_flatten.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/beam_jump.beam b/bootstrap/lib/compiler/ebin/beam_jump.beam
index 8dd6375403..7382cafb48 100644
--- a/bootstrap/lib/compiler/ebin/beam_jump.beam
+++ b/bootstrap/lib/compiler/ebin/beam_jump.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/beam_listing.beam b/bootstrap/lib/compiler/ebin/beam_listing.beam
index 4d8f94c4ea..41fac49d23 100644
--- a/bootstrap/lib/compiler/ebin/beam_listing.beam
+++ b/bootstrap/lib/compiler/ebin/beam_listing.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/beam_peep.beam b/bootstrap/lib/compiler/ebin/beam_peep.beam
index 7a7856e247..334047bbf6 100644
--- a/bootstrap/lib/compiler/ebin/beam_peep.beam
+++ b/bootstrap/lib/compiler/ebin/beam_peep.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/beam_receive.beam b/bootstrap/lib/compiler/ebin/beam_receive.beam
index 78c9eb1c39..0aa196f3de 100644
--- a/bootstrap/lib/compiler/ebin/beam_receive.beam
+++ b/bootstrap/lib/compiler/ebin/beam_receive.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/beam_reorder.beam b/bootstrap/lib/compiler/ebin/beam_reorder.beam
new file mode 100644
index 0000000000..0dc44add6b
--- /dev/null
+++ b/bootstrap/lib/compiler/ebin/beam_reorder.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/beam_split.beam b/bootstrap/lib/compiler/ebin/beam_split.beam
index 4821d92c96..a4e2b78938 100644
--- a/bootstrap/lib/compiler/ebin/beam_split.beam
+++ b/bootstrap/lib/compiler/ebin/beam_split.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/beam_trim.beam b/bootstrap/lib/compiler/ebin/beam_trim.beam
index 6878a8a01c..194882f68a 100644
--- a/bootstrap/lib/compiler/ebin/beam_trim.beam
+++ b/bootstrap/lib/compiler/ebin/beam_trim.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/beam_type.beam b/bootstrap/lib/compiler/ebin/beam_type.beam
index cb3bc1a8bd..35bc046ef8 100644
--- a/bootstrap/lib/compiler/ebin/beam_type.beam
+++ b/bootstrap/lib/compiler/ebin/beam_type.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/beam_utils.beam b/bootstrap/lib/compiler/ebin/beam_utils.beam
index fc2e1b6c78..a97fc853a7 100644
--- a/bootstrap/lib/compiler/ebin/beam_utils.beam
+++ b/bootstrap/lib/compiler/ebin/beam_utils.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/beam_validator.beam b/bootstrap/lib/compiler/ebin/beam_validator.beam
index 38b749d9ae..03582d94c3 100644
--- a/bootstrap/lib/compiler/ebin/beam_validator.beam
+++ b/bootstrap/lib/compiler/ebin/beam_validator.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/beam_z.beam b/bootstrap/lib/compiler/ebin/beam_z.beam
index ac156a37e9..7bf77d7d33 100644
--- a/bootstrap/lib/compiler/ebin/beam_z.beam
+++ b/bootstrap/lib/compiler/ebin/beam_z.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/cerl.beam b/bootstrap/lib/compiler/ebin/cerl.beam
index 758861af20..32e0485ff8 100644
--- a/bootstrap/lib/compiler/ebin/cerl.beam
+++ b/bootstrap/lib/compiler/ebin/cerl.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/cerl_clauses.beam b/bootstrap/lib/compiler/ebin/cerl_clauses.beam
index 2357df79f4..95dd3f3cbb 100644
--- a/bootstrap/lib/compiler/ebin/cerl_clauses.beam
+++ b/bootstrap/lib/compiler/ebin/cerl_clauses.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/cerl_inline.beam b/bootstrap/lib/compiler/ebin/cerl_inline.beam
index 0e466ad38e..cc90a53ef9 100644
--- a/bootstrap/lib/compiler/ebin/cerl_inline.beam
+++ b/bootstrap/lib/compiler/ebin/cerl_inline.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/cerl_sets.beam b/bootstrap/lib/compiler/ebin/cerl_sets.beam
index d16543cdbe..20cf324b41 100644
--- a/bootstrap/lib/compiler/ebin/cerl_sets.beam
+++ b/bootstrap/lib/compiler/ebin/cerl_sets.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/cerl_trees.beam b/bootstrap/lib/compiler/ebin/cerl_trees.beam
index fc1a7e04f8..76b19363e9 100644
--- a/bootstrap/lib/compiler/ebin/cerl_trees.beam
+++ b/bootstrap/lib/compiler/ebin/cerl_trees.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/compile.beam b/bootstrap/lib/compiler/ebin/compile.beam
index 111f85acd2..8f60633c81 100644
--- a/bootstrap/lib/compiler/ebin/compile.beam
+++ b/bootstrap/lib/compiler/ebin/compile.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/compiler.app b/bootstrap/lib/compiler/ebin/compiler.app
index d3b2296ea4..d31b449f72 100644
--- a/bootstrap/lib/compiler/ebin/compiler.app
+++ b/bootstrap/lib/compiler/ebin/compiler.app
@@ -19,12 +19,13 @@
{application, compiler,
[{description, "ERTS CXC 138 10"},
- {vsn, "6.0"},
+ {vsn, "6.0.1"},
{modules, [
beam_a,
beam_asm,
beam_block,
beam_bool,
+ beam_bs,
beam_bsm,
beam_clean,
beam_dead,
@@ -37,6 +38,7 @@
beam_opcodes,
beam_peep,
beam_receive,
+ beam_reorder,
beam_split,
beam_trim,
beam_type,
diff --git a/bootstrap/lib/compiler/ebin/compiler.appup b/bootstrap/lib/compiler/ebin/compiler.appup
index 889b72bd6b..1ff223434a 100644
--- a/bootstrap/lib/compiler/ebin/compiler.appup
+++ b/bootstrap/lib/compiler/ebin/compiler.appup
@@ -16,7 +16,7 @@
%% limitations under the License.
%%
%% %CopyrightEnd%
-{"5.0.4",
+{"6.0.1",
[{<<".*">>,[{restart_application, compiler}]}],
[{<<".*">>,[{restart_application, compiler}]}]
}.
diff --git a/bootstrap/lib/compiler/ebin/core_lib.beam b/bootstrap/lib/compiler/ebin/core_lib.beam
index ec87099635..32b770c186 100644
--- a/bootstrap/lib/compiler/ebin/core_lib.beam
+++ b/bootstrap/lib/compiler/ebin/core_lib.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/core_lint.beam b/bootstrap/lib/compiler/ebin/core_lint.beam
index b1cbbf030d..69143cdd23 100644
--- a/bootstrap/lib/compiler/ebin/core_lint.beam
+++ b/bootstrap/lib/compiler/ebin/core_lint.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/core_parse.beam b/bootstrap/lib/compiler/ebin/core_parse.beam
index 025ac1591b..3ef8588f65 100644
--- a/bootstrap/lib/compiler/ebin/core_parse.beam
+++ b/bootstrap/lib/compiler/ebin/core_parse.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/core_pp.beam b/bootstrap/lib/compiler/ebin/core_pp.beam
index 7ba89c698e..f320fd6908 100644
--- a/bootstrap/lib/compiler/ebin/core_pp.beam
+++ b/bootstrap/lib/compiler/ebin/core_pp.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/core_scan.beam b/bootstrap/lib/compiler/ebin/core_scan.beam
index c54edfc0e7..5f7b22ba8b 100644
--- a/bootstrap/lib/compiler/ebin/core_scan.beam
+++ b/bootstrap/lib/compiler/ebin/core_scan.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/rec_env.beam b/bootstrap/lib/compiler/ebin/rec_env.beam
index c49a2e23e9..69d3f62ca0 100644
--- a/bootstrap/lib/compiler/ebin/rec_env.beam
+++ b/bootstrap/lib/compiler/ebin/rec_env.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/sys_core_dsetel.beam b/bootstrap/lib/compiler/ebin/sys_core_dsetel.beam
index 14c69eec6c..10df50e1e5 100644
--- a/bootstrap/lib/compiler/ebin/sys_core_dsetel.beam
+++ b/bootstrap/lib/compiler/ebin/sys_core_dsetel.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/sys_core_fold.beam b/bootstrap/lib/compiler/ebin/sys_core_fold.beam
index 1b5467a54b..809de44217 100644
--- a/bootstrap/lib/compiler/ebin/sys_core_fold.beam
+++ b/bootstrap/lib/compiler/ebin/sys_core_fold.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/sys_core_fold_lists.beam b/bootstrap/lib/compiler/ebin/sys_core_fold_lists.beam
index 58ae7c0393..20cd2af6bc 100644
--- a/bootstrap/lib/compiler/ebin/sys_core_fold_lists.beam
+++ b/bootstrap/lib/compiler/ebin/sys_core_fold_lists.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/sys_core_inline.beam b/bootstrap/lib/compiler/ebin/sys_core_inline.beam
index 4f44297bee..963b7ef6e1 100644
--- a/bootstrap/lib/compiler/ebin/sys_core_inline.beam
+++ b/bootstrap/lib/compiler/ebin/sys_core_inline.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/sys_pre_attributes.beam b/bootstrap/lib/compiler/ebin/sys_pre_attributes.beam
index a1c6466ccd..934a539ad9 100644
--- a/bootstrap/lib/compiler/ebin/sys_pre_attributes.beam
+++ b/bootstrap/lib/compiler/ebin/sys_pre_attributes.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/sys_pre_expand.beam b/bootstrap/lib/compiler/ebin/sys_pre_expand.beam
index 6eba755081..d82f802bd7 100644
--- a/bootstrap/lib/compiler/ebin/sys_pre_expand.beam
+++ b/bootstrap/lib/compiler/ebin/sys_pre_expand.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/v3_codegen.beam b/bootstrap/lib/compiler/ebin/v3_codegen.beam
index e53f0fcd12..aa4b5f9585 100644
--- a/bootstrap/lib/compiler/ebin/v3_codegen.beam
+++ b/bootstrap/lib/compiler/ebin/v3_codegen.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/v3_core.beam b/bootstrap/lib/compiler/ebin/v3_core.beam
index e4c5f51f77..2082153b33 100644
--- a/bootstrap/lib/compiler/ebin/v3_core.beam
+++ b/bootstrap/lib/compiler/ebin/v3_core.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/v3_kernel.beam b/bootstrap/lib/compiler/ebin/v3_kernel.beam
index f5cdbb6e40..d451819f19 100644
--- a/bootstrap/lib/compiler/ebin/v3_kernel.beam
+++ b/bootstrap/lib/compiler/ebin/v3_kernel.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/v3_kernel_pp.beam b/bootstrap/lib/compiler/ebin/v3_kernel_pp.beam
index d54716bbee..306ecb1569 100644
--- a/bootstrap/lib/compiler/ebin/v3_kernel_pp.beam
+++ b/bootstrap/lib/compiler/ebin/v3_kernel_pp.beam
Binary files differ
diff --git a/bootstrap/lib/compiler/ebin/v3_life.beam b/bootstrap/lib/compiler/ebin/v3_life.beam
index 741a702e88..d8822f929f 100644
--- a/bootstrap/lib/compiler/ebin/v3_life.beam
+++ b/bootstrap/lib/compiler/ebin/v3_life.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/application.beam b/bootstrap/lib/kernel/ebin/application.beam
index d8e98c021b..c80144ec65 100644
--- a/bootstrap/lib/kernel/ebin/application.beam
+++ b/bootstrap/lib/kernel/ebin/application.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/application_controller.beam b/bootstrap/lib/kernel/ebin/application_controller.beam
index c4fa46e33e..2b3c8cf454 100644
--- a/bootstrap/lib/kernel/ebin/application_controller.beam
+++ b/bootstrap/lib/kernel/ebin/application_controller.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/application_master.beam b/bootstrap/lib/kernel/ebin/application_master.beam
index b81dfa81d3..24492a6771 100644
--- a/bootstrap/lib/kernel/ebin/application_master.beam
+++ b/bootstrap/lib/kernel/ebin/application_master.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/application_starter.beam b/bootstrap/lib/kernel/ebin/application_starter.beam
index f5059a487a..043e15fb2a 100644
--- a/bootstrap/lib/kernel/ebin/application_starter.beam
+++ b/bootstrap/lib/kernel/ebin/application_starter.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/auth.beam b/bootstrap/lib/kernel/ebin/auth.beam
index 74dde4fd1c..cbe477830b 100644
--- a/bootstrap/lib/kernel/ebin/auth.beam
+++ b/bootstrap/lib/kernel/ebin/auth.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/code.beam b/bootstrap/lib/kernel/ebin/code.beam
index 55d123c6a2..2a61400c9a 100644
--- a/bootstrap/lib/kernel/ebin/code.beam
+++ b/bootstrap/lib/kernel/ebin/code.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/code_server.beam b/bootstrap/lib/kernel/ebin/code_server.beam
index aa75ae9bd1..22ae0e7ce6 100644
--- a/bootstrap/lib/kernel/ebin/code_server.beam
+++ b/bootstrap/lib/kernel/ebin/code_server.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/disk_log.beam b/bootstrap/lib/kernel/ebin/disk_log.beam
index 287a8c0de8..3384baedc0 100644
--- a/bootstrap/lib/kernel/ebin/disk_log.beam
+++ b/bootstrap/lib/kernel/ebin/disk_log.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/disk_log_1.beam b/bootstrap/lib/kernel/ebin/disk_log_1.beam
index 55a9365f05..9111e3c69c 100644
--- a/bootstrap/lib/kernel/ebin/disk_log_1.beam
+++ b/bootstrap/lib/kernel/ebin/disk_log_1.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/disk_log_server.beam b/bootstrap/lib/kernel/ebin/disk_log_server.beam
index 8c1622c7d8..50154045be 100644
--- a/bootstrap/lib/kernel/ebin/disk_log_server.beam
+++ b/bootstrap/lib/kernel/ebin/disk_log_server.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/dist_ac.beam b/bootstrap/lib/kernel/ebin/dist_ac.beam
index ea948cfe88..d2c186f03a 100644
--- a/bootstrap/lib/kernel/ebin/dist_ac.beam
+++ b/bootstrap/lib/kernel/ebin/dist_ac.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/dist_util.beam b/bootstrap/lib/kernel/ebin/dist_util.beam
index c92373c68e..521bdb5d91 100644
--- a/bootstrap/lib/kernel/ebin/dist_util.beam
+++ b/bootstrap/lib/kernel/ebin/dist_util.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/erl_boot_server.beam b/bootstrap/lib/kernel/ebin/erl_boot_server.beam
index 91899fe231..20c41fd06e 100644
--- a/bootstrap/lib/kernel/ebin/erl_boot_server.beam
+++ b/bootstrap/lib/kernel/ebin/erl_boot_server.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/erl_ddll.beam b/bootstrap/lib/kernel/ebin/erl_ddll.beam
index e15e49d61c..0a644d2e38 100644
--- a/bootstrap/lib/kernel/ebin/erl_ddll.beam
+++ b/bootstrap/lib/kernel/ebin/erl_ddll.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/erl_distribution.beam b/bootstrap/lib/kernel/ebin/erl_distribution.beam
index 9a6acc0585..eacacf799c 100644
--- a/bootstrap/lib/kernel/ebin/erl_distribution.beam
+++ b/bootstrap/lib/kernel/ebin/erl_distribution.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/erl_epmd.beam b/bootstrap/lib/kernel/ebin/erl_epmd.beam
index 92d6387af3..267958ae88 100644
--- a/bootstrap/lib/kernel/ebin/erl_epmd.beam
+++ b/bootstrap/lib/kernel/ebin/erl_epmd.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/erl_reply.beam b/bootstrap/lib/kernel/ebin/erl_reply.beam
index 79fb539bd3..6cf7d9e196 100644
--- a/bootstrap/lib/kernel/ebin/erl_reply.beam
+++ b/bootstrap/lib/kernel/ebin/erl_reply.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/error_handler.beam b/bootstrap/lib/kernel/ebin/error_handler.beam
index 740ba28f72..64f44baeb7 100644
--- a/bootstrap/lib/kernel/ebin/error_handler.beam
+++ b/bootstrap/lib/kernel/ebin/error_handler.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/error_logger.beam b/bootstrap/lib/kernel/ebin/error_logger.beam
index 10f7a0b984..64c2d58205 100644
--- a/bootstrap/lib/kernel/ebin/error_logger.beam
+++ b/bootstrap/lib/kernel/ebin/error_logger.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/erts_debug.beam b/bootstrap/lib/kernel/ebin/erts_debug.beam
index bd73ff6c5c..d1a60d5cd9 100644
--- a/bootstrap/lib/kernel/ebin/erts_debug.beam
+++ b/bootstrap/lib/kernel/ebin/erts_debug.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/file.beam b/bootstrap/lib/kernel/ebin/file.beam
index 32a3a27993..a66a2621b9 100644
--- a/bootstrap/lib/kernel/ebin/file.beam
+++ b/bootstrap/lib/kernel/ebin/file.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/file_io_server.beam b/bootstrap/lib/kernel/ebin/file_io_server.beam
index be820676ed..f29483ef36 100644
--- a/bootstrap/lib/kernel/ebin/file_io_server.beam
+++ b/bootstrap/lib/kernel/ebin/file_io_server.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/file_server.beam b/bootstrap/lib/kernel/ebin/file_server.beam
index 48352e9dfd..151293e05c 100644
--- a/bootstrap/lib/kernel/ebin/file_server.beam
+++ b/bootstrap/lib/kernel/ebin/file_server.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/gen_sctp.beam b/bootstrap/lib/kernel/ebin/gen_sctp.beam
index e2bb806f2b..91aaa41063 100644
--- a/bootstrap/lib/kernel/ebin/gen_sctp.beam
+++ b/bootstrap/lib/kernel/ebin/gen_sctp.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/gen_tcp.beam b/bootstrap/lib/kernel/ebin/gen_tcp.beam
index 0182e11345..e40f1f2e45 100644
--- a/bootstrap/lib/kernel/ebin/gen_tcp.beam
+++ b/bootstrap/lib/kernel/ebin/gen_tcp.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/gen_udp.beam b/bootstrap/lib/kernel/ebin/gen_udp.beam
index e49561399d..ec4eda12f7 100644
--- a/bootstrap/lib/kernel/ebin/gen_udp.beam
+++ b/bootstrap/lib/kernel/ebin/gen_udp.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/global.beam b/bootstrap/lib/kernel/ebin/global.beam
index 158fbd1c93..469859fa03 100644
--- a/bootstrap/lib/kernel/ebin/global.beam
+++ b/bootstrap/lib/kernel/ebin/global.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/global_group.beam b/bootstrap/lib/kernel/ebin/global_group.beam
index 85306ef123..1269f7e321 100644
--- a/bootstrap/lib/kernel/ebin/global_group.beam
+++ b/bootstrap/lib/kernel/ebin/global_group.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/group.beam b/bootstrap/lib/kernel/ebin/group.beam
index 0f72880f49..3df8f6030c 100644
--- a/bootstrap/lib/kernel/ebin/group.beam
+++ b/bootstrap/lib/kernel/ebin/group.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/heart.beam b/bootstrap/lib/kernel/ebin/heart.beam
index d4972ecdd2..bd24310b0b 100644
--- a/bootstrap/lib/kernel/ebin/heart.beam
+++ b/bootstrap/lib/kernel/ebin/heart.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/hipe_unified_loader.beam b/bootstrap/lib/kernel/ebin/hipe_unified_loader.beam
index fc12b6b194..e60cf784ea 100644
--- a/bootstrap/lib/kernel/ebin/hipe_unified_loader.beam
+++ b/bootstrap/lib/kernel/ebin/hipe_unified_loader.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/inet.beam b/bootstrap/lib/kernel/ebin/inet.beam
index a76806293f..6353e6564b 100644
--- a/bootstrap/lib/kernel/ebin/inet.beam
+++ b/bootstrap/lib/kernel/ebin/inet.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/inet6_sctp.beam b/bootstrap/lib/kernel/ebin/inet6_sctp.beam
index 10c2644259..5c827589bd 100644
--- a/bootstrap/lib/kernel/ebin/inet6_sctp.beam
+++ b/bootstrap/lib/kernel/ebin/inet6_sctp.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/inet6_tcp.beam b/bootstrap/lib/kernel/ebin/inet6_tcp.beam
index d080a1200b..f1ab2912bb 100644
--- a/bootstrap/lib/kernel/ebin/inet6_tcp.beam
+++ b/bootstrap/lib/kernel/ebin/inet6_tcp.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/inet6_tcp_dist.beam b/bootstrap/lib/kernel/ebin/inet6_tcp_dist.beam
index 3f98206013..1be1dc1c57 100644
--- a/bootstrap/lib/kernel/ebin/inet6_tcp_dist.beam
+++ b/bootstrap/lib/kernel/ebin/inet6_tcp_dist.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/inet6_udp.beam b/bootstrap/lib/kernel/ebin/inet6_udp.beam
index 73f0b52b90..2eb8c09701 100644
--- a/bootstrap/lib/kernel/ebin/inet6_udp.beam
+++ b/bootstrap/lib/kernel/ebin/inet6_udp.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/inet_config.beam b/bootstrap/lib/kernel/ebin/inet_config.beam
index f31fb16742..f49fa7a376 100644
--- a/bootstrap/lib/kernel/ebin/inet_config.beam
+++ b/bootstrap/lib/kernel/ebin/inet_config.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/inet_db.beam b/bootstrap/lib/kernel/ebin/inet_db.beam
index 8c7c6ba218..8b6273610c 100644
--- a/bootstrap/lib/kernel/ebin/inet_db.beam
+++ b/bootstrap/lib/kernel/ebin/inet_db.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/inet_dns.beam b/bootstrap/lib/kernel/ebin/inet_dns.beam
index 0c5b6c73e1..88ecaaf10b 100644
--- a/bootstrap/lib/kernel/ebin/inet_dns.beam
+++ b/bootstrap/lib/kernel/ebin/inet_dns.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/inet_gethost_native.beam b/bootstrap/lib/kernel/ebin/inet_gethost_native.beam
index 098c397936..93f60428a1 100644
--- a/bootstrap/lib/kernel/ebin/inet_gethost_native.beam
+++ b/bootstrap/lib/kernel/ebin/inet_gethost_native.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/inet_hosts.beam b/bootstrap/lib/kernel/ebin/inet_hosts.beam
index 3e70a8b8c1..7278913418 100644
--- a/bootstrap/lib/kernel/ebin/inet_hosts.beam
+++ b/bootstrap/lib/kernel/ebin/inet_hosts.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/inet_parse.beam b/bootstrap/lib/kernel/ebin/inet_parse.beam
index 294afcea30..4323d12bf1 100644
--- a/bootstrap/lib/kernel/ebin/inet_parse.beam
+++ b/bootstrap/lib/kernel/ebin/inet_parse.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/inet_res.beam b/bootstrap/lib/kernel/ebin/inet_res.beam
index f35242f49a..ada7300673 100644
--- a/bootstrap/lib/kernel/ebin/inet_res.beam
+++ b/bootstrap/lib/kernel/ebin/inet_res.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/inet_sctp.beam b/bootstrap/lib/kernel/ebin/inet_sctp.beam
index 19506c14e9..835c7b2928 100644
--- a/bootstrap/lib/kernel/ebin/inet_sctp.beam
+++ b/bootstrap/lib/kernel/ebin/inet_sctp.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/inet_tcp.beam b/bootstrap/lib/kernel/ebin/inet_tcp.beam
index 60e0d9f569..698a94770b 100644
--- a/bootstrap/lib/kernel/ebin/inet_tcp.beam
+++ b/bootstrap/lib/kernel/ebin/inet_tcp.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/inet_tcp_dist.beam b/bootstrap/lib/kernel/ebin/inet_tcp_dist.beam
index a3635e5dde..59cb7ce40e 100644
--- a/bootstrap/lib/kernel/ebin/inet_tcp_dist.beam
+++ b/bootstrap/lib/kernel/ebin/inet_tcp_dist.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/inet_udp.beam b/bootstrap/lib/kernel/ebin/inet_udp.beam
index 6fbdd29f6d..6876ba3892 100644
--- a/bootstrap/lib/kernel/ebin/inet_udp.beam
+++ b/bootstrap/lib/kernel/ebin/inet_udp.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/kernel.app b/bootstrap/lib/kernel/ebin/kernel.app
index 85ba41bcef..644077b9e7 100644
--- a/bootstrap/lib/kernel/ebin/kernel.app
+++ b/bootstrap/lib/kernel/ebin/kernel.app
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2013. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@
{application, kernel,
[
{description, "ERTS CXC 138 10"},
- {vsn, "4.0"},
+ {vsn, "4.1"},
{modules, [application,
application_controller,
application_master,
@@ -116,6 +116,6 @@
{applications, []},
{env, [{error_logger, tty}]},
{mod, {kernel, []}},
- {runtime_dependencies, ["erts-7.0", "stdlib-2.5", "sasl-2.4"]}
+ {runtime_dependencies, ["erts-7.0", "stdlib-2.6", "sasl-2.6"]}
]
}.
diff --git a/bootstrap/lib/kernel/ebin/kernel.appup b/bootstrap/lib/kernel/ebin/kernel.appup
index d09e0c6347..b2a161aa1d 100644
--- a/bootstrap/lib/kernel/ebin/kernel.appup
+++ b/bootstrap/lib/kernel/ebin/kernel.appup
@@ -16,9 +16,11 @@
%% limitations under the License.
%%
%% %CopyrightEnd%
-{"4.0",
+{"4.1",
%% Up from - max one major revision back
- [{<<"3\\.[0-2](\\.[0-9]+)*">>,[restart_new_emulator]}], % OTP-17
+ [{<<"4\\.0(\\.[0-9]+)*">>,[restart_new_emulator]}, % OTP-18.0.*
+ {<<"3\\.[0-2](\\.[0-9]+)*">>,[restart_new_emulator]}], % OTP-17
%% Down to - max one major revision back
- [{<<"3\\.[0-2](\\.[0-9]+)*">>,[restart_new_emulator]}] % OTP-17
+ [{<<"4\\.0(\\.[0-9]+)*">>,[restart_new_emulator]}, % OTP-18.0.*
+ {<<"3\\.[0-2](\\.[0-9]+)*">>,[restart_new_emulator]}] % OTP-17
}.
diff --git a/bootstrap/lib/kernel/ebin/kernel.beam b/bootstrap/lib/kernel/ebin/kernel.beam
index caeda89fa5..1dae85119a 100644
--- a/bootstrap/lib/kernel/ebin/kernel.beam
+++ b/bootstrap/lib/kernel/ebin/kernel.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/kernel_config.beam b/bootstrap/lib/kernel/ebin/kernel_config.beam
index 5a4649a054..8691aff64a 100644
--- a/bootstrap/lib/kernel/ebin/kernel_config.beam
+++ b/bootstrap/lib/kernel/ebin/kernel_config.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/net_adm.beam b/bootstrap/lib/kernel/ebin/net_adm.beam
index 4b09aae8a5..00772b61ff 100644
--- a/bootstrap/lib/kernel/ebin/net_adm.beam
+++ b/bootstrap/lib/kernel/ebin/net_adm.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/net_kernel.beam b/bootstrap/lib/kernel/ebin/net_kernel.beam
index 9a0bfa2ba4..bd15759017 100644
--- a/bootstrap/lib/kernel/ebin/net_kernel.beam
+++ b/bootstrap/lib/kernel/ebin/net_kernel.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/os.beam b/bootstrap/lib/kernel/ebin/os.beam
index 9eaf7dfe5d..054c70e8b1 100644
--- a/bootstrap/lib/kernel/ebin/os.beam
+++ b/bootstrap/lib/kernel/ebin/os.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/pg2.beam b/bootstrap/lib/kernel/ebin/pg2.beam
index 944f6a27a4..2115e46b60 100644
--- a/bootstrap/lib/kernel/ebin/pg2.beam
+++ b/bootstrap/lib/kernel/ebin/pg2.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/ram_file.beam b/bootstrap/lib/kernel/ebin/ram_file.beam
index a8b23f5490..b119b3656c 100644
--- a/bootstrap/lib/kernel/ebin/ram_file.beam
+++ b/bootstrap/lib/kernel/ebin/ram_file.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/rpc.beam b/bootstrap/lib/kernel/ebin/rpc.beam
index 4a8aa5da69..4d1cbdb625 100644
--- a/bootstrap/lib/kernel/ebin/rpc.beam
+++ b/bootstrap/lib/kernel/ebin/rpc.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/seq_trace.beam b/bootstrap/lib/kernel/ebin/seq_trace.beam
index 13489135a2..775f43ce2f 100644
--- a/bootstrap/lib/kernel/ebin/seq_trace.beam
+++ b/bootstrap/lib/kernel/ebin/seq_trace.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/standard_error.beam b/bootstrap/lib/kernel/ebin/standard_error.beam
index be4f9292e7..9dfd66b2f4 100644
--- a/bootstrap/lib/kernel/ebin/standard_error.beam
+++ b/bootstrap/lib/kernel/ebin/standard_error.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/user.beam b/bootstrap/lib/kernel/ebin/user.beam
index d69339866a..5b07718039 100644
--- a/bootstrap/lib/kernel/ebin/user.beam
+++ b/bootstrap/lib/kernel/ebin/user.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/user_drv.beam b/bootstrap/lib/kernel/ebin/user_drv.beam
index 726a130b55..971c19a824 100644
--- a/bootstrap/lib/kernel/ebin/user_drv.beam
+++ b/bootstrap/lib/kernel/ebin/user_drv.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/user_sup.beam b/bootstrap/lib/kernel/ebin/user_sup.beam
index 79dd095896..9e7b95544d 100644
--- a/bootstrap/lib/kernel/ebin/user_sup.beam
+++ b/bootstrap/lib/kernel/ebin/user_sup.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/ebin/wrap_log_reader.beam b/bootstrap/lib/kernel/ebin/wrap_log_reader.beam
index 68578800a0..91ef523b99 100644
--- a/bootstrap/lib/kernel/ebin/wrap_log_reader.beam
+++ b/bootstrap/lib/kernel/ebin/wrap_log_reader.beam
Binary files differ
diff --git a/bootstrap/lib/kernel/include/file.hrl b/bootstrap/lib/kernel/include/file.hrl
index 7cf033f7f5..36112bb040 100644
--- a/bootstrap/lib/kernel/include/file.hrl
+++ b/bootstrap/lib/kernel/include/file.hrl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2013. All Rights Reserved.
+%% Copyright Ericsson AB 1997-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -23,37 +23,40 @@
%%--------------------------------------------------------------------------
-record(file_info,
- {size :: non_neg_integer(), % Size of file in bytes.
- type :: 'device' | 'directory' | 'other' | 'regular' | 'symlink',
- access :: 'read' | 'write' | 'read_write' | 'none',
- atime :: file:date_time() | non_neg_integer(),
+ {size :: non_neg_integer() | 'undefined', % Size of file in bytes.
+ type :: 'device' | 'directory' | 'other' | 'regular' | 'symlink'
+ | 'undefined',
+ access :: 'read' | 'write' | 'read_write' | 'none' | 'undefined',
+ atime :: file:date_time() | non_neg_integer() | 'undefined',
% The local time the file was last read:
% {{Year, Mon, Day}, {Hour, Min, Sec}}.
% atime, ctime, mtime may also be unix epochs()
- mtime :: file:date_time() | non_neg_integer(),
+ mtime :: file:date_time() | non_neg_integer() | 'undefined',
% The local time the file was last written.
- ctime :: file:date_time() | non_neg_integer(),
+ ctime :: file:date_time() | non_neg_integer() | 'undefined',
% The interpretation of this time field
% is dependent on operating system.
% On Unix it is the last time the file
% or the inode was changed. On Windows,
% it is the creation time.
- mode :: non_neg_integer(), % File permissions. On Windows,
+ mode :: non_neg_integer() | 'undefined',
+ % File permissions. On Windows,
% the owner permissions will be
% duplicated for group and user.
- links :: non_neg_integer(),
+ links :: non_neg_integer() | 'undefined',
% Number of links to the file (1 if the
% filesystem doesn't support links).
- major_device :: non_neg_integer(),
+ major_device :: non_neg_integer() | 'undefined',
% Identifies the file system (Unix),
% or the drive number (A: = 0, B: = 1)
% (Windows).
%% The following are Unix specific.
%% They are set to zero on other operating systems.
- minor_device :: non_neg_integer(), % Only valid for devices.
- inode :: non_neg_integer(), % Inode number for file.
- uid :: non_neg_integer(), % User id for owner.
- gid :: non_neg_integer()}). % Group id for owner.
+ minor_device :: non_neg_integer() | 'undefined',
+ % Only valid for devices.
+ inode :: non_neg_integer() | 'undefined', % Inode number for file.
+ uid :: non_neg_integer() | 'undefined', % User id for owner.
+ gid :: non_neg_integer() | 'undefined'}). % Group id for owner.
-record(file_descriptor,
diff --git a/bootstrap/lib/stdlib/ebin/array.beam b/bootstrap/lib/stdlib/ebin/array.beam
index 4ad9c7cd04..4ad8942b06 100644
--- a/bootstrap/lib/stdlib/ebin/array.beam
+++ b/bootstrap/lib/stdlib/ebin/array.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/base64.beam b/bootstrap/lib/stdlib/ebin/base64.beam
index e8d4b44102..ad725f61b9 100644
--- a/bootstrap/lib/stdlib/ebin/base64.beam
+++ b/bootstrap/lib/stdlib/ebin/base64.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/beam_lib.beam b/bootstrap/lib/stdlib/ebin/beam_lib.beam
index abf4949465..67aeb1a587 100644
--- a/bootstrap/lib/stdlib/ebin/beam_lib.beam
+++ b/bootstrap/lib/stdlib/ebin/beam_lib.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/binary.beam b/bootstrap/lib/stdlib/ebin/binary.beam
index 32d68c2504..538d169565 100644
--- a/bootstrap/lib/stdlib/ebin/binary.beam
+++ b/bootstrap/lib/stdlib/ebin/binary.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/c.beam b/bootstrap/lib/stdlib/ebin/c.beam
index 0e07dc1531..133035102e 100644
--- a/bootstrap/lib/stdlib/ebin/c.beam
+++ b/bootstrap/lib/stdlib/ebin/c.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/calendar.beam b/bootstrap/lib/stdlib/ebin/calendar.beam
index 383d66e1a8..e71eebae3f 100644
--- a/bootstrap/lib/stdlib/ebin/calendar.beam
+++ b/bootstrap/lib/stdlib/ebin/calendar.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/dets.beam b/bootstrap/lib/stdlib/ebin/dets.beam
index 100996bf85..d9d34914f9 100644
--- a/bootstrap/lib/stdlib/ebin/dets.beam
+++ b/bootstrap/lib/stdlib/ebin/dets.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/dets_server.beam b/bootstrap/lib/stdlib/ebin/dets_server.beam
index 46c6769dfe..da999f3025 100644
--- a/bootstrap/lib/stdlib/ebin/dets_server.beam
+++ b/bootstrap/lib/stdlib/ebin/dets_server.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/dets_utils.beam b/bootstrap/lib/stdlib/ebin/dets_utils.beam
index f2d1d86a60..964ed4e791 100644
--- a/bootstrap/lib/stdlib/ebin/dets_utils.beam
+++ b/bootstrap/lib/stdlib/ebin/dets_utils.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/dets_v8.beam b/bootstrap/lib/stdlib/ebin/dets_v8.beam
index eca5a85114..6c2a3e9efb 100644
--- a/bootstrap/lib/stdlib/ebin/dets_v8.beam
+++ b/bootstrap/lib/stdlib/ebin/dets_v8.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/dets_v9.beam b/bootstrap/lib/stdlib/ebin/dets_v9.beam
index 711ca0b9f0..46f8d2c6a5 100644
--- a/bootstrap/lib/stdlib/ebin/dets_v9.beam
+++ b/bootstrap/lib/stdlib/ebin/dets_v9.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/dict.beam b/bootstrap/lib/stdlib/ebin/dict.beam
index 6ba808d6af..45cc303498 100644
--- a/bootstrap/lib/stdlib/ebin/dict.beam
+++ b/bootstrap/lib/stdlib/ebin/dict.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/digraph.beam b/bootstrap/lib/stdlib/ebin/digraph.beam
index 40db38c992..28b65ce7b5 100644
--- a/bootstrap/lib/stdlib/ebin/digraph.beam
+++ b/bootstrap/lib/stdlib/ebin/digraph.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/digraph_utils.beam b/bootstrap/lib/stdlib/ebin/digraph_utils.beam
index 458c6d2895..9065fda936 100644
--- a/bootstrap/lib/stdlib/ebin/digraph_utils.beam
+++ b/bootstrap/lib/stdlib/ebin/digraph_utils.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/edlin.beam b/bootstrap/lib/stdlib/ebin/edlin.beam
index 4d052a0c50..136c2d5196 100644
--- a/bootstrap/lib/stdlib/ebin/edlin.beam
+++ b/bootstrap/lib/stdlib/ebin/edlin.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/edlin_expand.beam b/bootstrap/lib/stdlib/ebin/edlin_expand.beam
index 3d9846bdcf..adc0f4ba1c 100644
--- a/bootstrap/lib/stdlib/ebin/edlin_expand.beam
+++ b/bootstrap/lib/stdlib/ebin/edlin_expand.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/epp.beam b/bootstrap/lib/stdlib/ebin/epp.beam
index 00cf6f2a5c..6a585f8a08 100644
--- a/bootstrap/lib/stdlib/ebin/epp.beam
+++ b/bootstrap/lib/stdlib/ebin/epp.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/erl_anno.beam b/bootstrap/lib/stdlib/ebin/erl_anno.beam
index 4807dac5f9..72a255c88f 100644
--- a/bootstrap/lib/stdlib/ebin/erl_anno.beam
+++ b/bootstrap/lib/stdlib/ebin/erl_anno.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/erl_bits.beam b/bootstrap/lib/stdlib/ebin/erl_bits.beam
index 627b9ca711..af8619bac0 100644
--- a/bootstrap/lib/stdlib/ebin/erl_bits.beam
+++ b/bootstrap/lib/stdlib/ebin/erl_bits.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/erl_compile.beam b/bootstrap/lib/stdlib/ebin/erl_compile.beam
index e650afbf6d..82949da20a 100644
--- a/bootstrap/lib/stdlib/ebin/erl_compile.beam
+++ b/bootstrap/lib/stdlib/ebin/erl_compile.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/erl_eval.beam b/bootstrap/lib/stdlib/ebin/erl_eval.beam
index 2354a065ca..c8358c42b8 100644
--- a/bootstrap/lib/stdlib/ebin/erl_eval.beam
+++ b/bootstrap/lib/stdlib/ebin/erl_eval.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/erl_expand_records.beam b/bootstrap/lib/stdlib/ebin/erl_expand_records.beam
index db2d0e6b85..001709532a 100644
--- a/bootstrap/lib/stdlib/ebin/erl_expand_records.beam
+++ b/bootstrap/lib/stdlib/ebin/erl_expand_records.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/erl_lint.beam b/bootstrap/lib/stdlib/ebin/erl_lint.beam
index 16cacefb7c..8c07c78369 100644
--- a/bootstrap/lib/stdlib/ebin/erl_lint.beam
+++ b/bootstrap/lib/stdlib/ebin/erl_lint.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/erl_parse.beam b/bootstrap/lib/stdlib/ebin/erl_parse.beam
index 0522f5c05e..aab674f3c8 100644
--- a/bootstrap/lib/stdlib/ebin/erl_parse.beam
+++ b/bootstrap/lib/stdlib/ebin/erl_parse.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/erl_pp.beam b/bootstrap/lib/stdlib/ebin/erl_pp.beam
index f38ba5fa71..d97b5e075b 100644
--- a/bootstrap/lib/stdlib/ebin/erl_pp.beam
+++ b/bootstrap/lib/stdlib/ebin/erl_pp.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/erl_scan.beam b/bootstrap/lib/stdlib/ebin/erl_scan.beam
index c29200f2e0..6c35d20c46 100644
--- a/bootstrap/lib/stdlib/ebin/erl_scan.beam
+++ b/bootstrap/lib/stdlib/ebin/erl_scan.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/erl_tar.beam b/bootstrap/lib/stdlib/ebin/erl_tar.beam
index e525b3738b..9bcbabc27c 100644
--- a/bootstrap/lib/stdlib/ebin/erl_tar.beam
+++ b/bootstrap/lib/stdlib/ebin/erl_tar.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/error_logger_file_h.beam b/bootstrap/lib/stdlib/ebin/error_logger_file_h.beam
index 5c1bc6045f..0e61e87708 100644
--- a/bootstrap/lib/stdlib/ebin/error_logger_file_h.beam
+++ b/bootstrap/lib/stdlib/ebin/error_logger_file_h.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/error_logger_tty_h.beam b/bootstrap/lib/stdlib/ebin/error_logger_tty_h.beam
index 9711f57e43..46eafce18e 100644
--- a/bootstrap/lib/stdlib/ebin/error_logger_tty_h.beam
+++ b/bootstrap/lib/stdlib/ebin/error_logger_tty_h.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/escript.beam b/bootstrap/lib/stdlib/ebin/escript.beam
index e923cecea8..c006d9a1ad 100644
--- a/bootstrap/lib/stdlib/ebin/escript.beam
+++ b/bootstrap/lib/stdlib/ebin/escript.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/ets.beam b/bootstrap/lib/stdlib/ebin/ets.beam
index 7d30fc9fc1..a15534b365 100644
--- a/bootstrap/lib/stdlib/ebin/ets.beam
+++ b/bootstrap/lib/stdlib/ebin/ets.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/eval_bits.beam b/bootstrap/lib/stdlib/ebin/eval_bits.beam
index 6627e1132c..be20e8c720 100644
--- a/bootstrap/lib/stdlib/ebin/eval_bits.beam
+++ b/bootstrap/lib/stdlib/ebin/eval_bits.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/file_sorter.beam b/bootstrap/lib/stdlib/ebin/file_sorter.beam
index a2a82fb77d..78d9d727eb 100644
--- a/bootstrap/lib/stdlib/ebin/file_sorter.beam
+++ b/bootstrap/lib/stdlib/ebin/file_sorter.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/filelib.beam b/bootstrap/lib/stdlib/ebin/filelib.beam
index 5941f9189f..5ea27fdca6 100644
--- a/bootstrap/lib/stdlib/ebin/filelib.beam
+++ b/bootstrap/lib/stdlib/ebin/filelib.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/filename.beam b/bootstrap/lib/stdlib/ebin/filename.beam
index e4b462f5ff..f1252b1e7e 100644
--- a/bootstrap/lib/stdlib/ebin/filename.beam
+++ b/bootstrap/lib/stdlib/ebin/filename.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/gb_sets.beam b/bootstrap/lib/stdlib/ebin/gb_sets.beam
index 71da2376ba..3cb606350b 100644
--- a/bootstrap/lib/stdlib/ebin/gb_sets.beam
+++ b/bootstrap/lib/stdlib/ebin/gb_sets.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/gb_trees.beam b/bootstrap/lib/stdlib/ebin/gb_trees.beam
index db59d5af19..d8579c63cd 100644
--- a/bootstrap/lib/stdlib/ebin/gb_trees.beam
+++ b/bootstrap/lib/stdlib/ebin/gb_trees.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/gen.beam b/bootstrap/lib/stdlib/ebin/gen.beam
index ccaabd8087..586973a973 100644
--- a/bootstrap/lib/stdlib/ebin/gen.beam
+++ b/bootstrap/lib/stdlib/ebin/gen.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/gen_event.beam b/bootstrap/lib/stdlib/ebin/gen_event.beam
index bc3e71f6a7..4d64451826 100644
--- a/bootstrap/lib/stdlib/ebin/gen_event.beam
+++ b/bootstrap/lib/stdlib/ebin/gen_event.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/gen_fsm.beam b/bootstrap/lib/stdlib/ebin/gen_fsm.beam
index 268b8798c8..5e26fae139 100644
--- a/bootstrap/lib/stdlib/ebin/gen_fsm.beam
+++ b/bootstrap/lib/stdlib/ebin/gen_fsm.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/gen_server.beam b/bootstrap/lib/stdlib/ebin/gen_server.beam
index 1e1e530eea..d40b5808f3 100644
--- a/bootstrap/lib/stdlib/ebin/gen_server.beam
+++ b/bootstrap/lib/stdlib/ebin/gen_server.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/io.beam b/bootstrap/lib/stdlib/ebin/io.beam
index fd64aedde1..1f2a113fdd 100644
--- a/bootstrap/lib/stdlib/ebin/io.beam
+++ b/bootstrap/lib/stdlib/ebin/io.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/io_lib.beam b/bootstrap/lib/stdlib/ebin/io_lib.beam
index c95a88c0f0..c52bf42077 100644
--- a/bootstrap/lib/stdlib/ebin/io_lib.beam
+++ b/bootstrap/lib/stdlib/ebin/io_lib.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/io_lib_format.beam b/bootstrap/lib/stdlib/ebin/io_lib_format.beam
index 032e15eeb1..3fdf08d9e4 100644
--- a/bootstrap/lib/stdlib/ebin/io_lib_format.beam
+++ b/bootstrap/lib/stdlib/ebin/io_lib_format.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/io_lib_fread.beam b/bootstrap/lib/stdlib/ebin/io_lib_fread.beam
index b4af88d5b5..62a4beeb2d 100644
--- a/bootstrap/lib/stdlib/ebin/io_lib_fread.beam
+++ b/bootstrap/lib/stdlib/ebin/io_lib_fread.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/io_lib_pretty.beam b/bootstrap/lib/stdlib/ebin/io_lib_pretty.beam
index eed02e5fa5..9d37b74ad3 100644
--- a/bootstrap/lib/stdlib/ebin/io_lib_pretty.beam
+++ b/bootstrap/lib/stdlib/ebin/io_lib_pretty.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/lib.beam b/bootstrap/lib/stdlib/ebin/lib.beam
index 1cc92d1b8d..8e594d97ad 100644
--- a/bootstrap/lib/stdlib/ebin/lib.beam
+++ b/bootstrap/lib/stdlib/ebin/lib.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/lists.beam b/bootstrap/lib/stdlib/ebin/lists.beam
index 9db37e21d4..56b9d2c88a 100644
--- a/bootstrap/lib/stdlib/ebin/lists.beam
+++ b/bootstrap/lib/stdlib/ebin/lists.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/log_mf_h.beam b/bootstrap/lib/stdlib/ebin/log_mf_h.beam
index 58a8d68ed5..0c4b22c3df 100644
--- a/bootstrap/lib/stdlib/ebin/log_mf_h.beam
+++ b/bootstrap/lib/stdlib/ebin/log_mf_h.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/maps.beam b/bootstrap/lib/stdlib/ebin/maps.beam
index d1aa8bb9dd..d616a902ae 100644
--- a/bootstrap/lib/stdlib/ebin/maps.beam
+++ b/bootstrap/lib/stdlib/ebin/maps.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/ms_transform.beam b/bootstrap/lib/stdlib/ebin/ms_transform.beam
index cc8503fdb3..d3ae7b6775 100644
--- a/bootstrap/lib/stdlib/ebin/ms_transform.beam
+++ b/bootstrap/lib/stdlib/ebin/ms_transform.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/orddict.beam b/bootstrap/lib/stdlib/ebin/orddict.beam
index 665941a17c..f04348f982 100644
--- a/bootstrap/lib/stdlib/ebin/orddict.beam
+++ b/bootstrap/lib/stdlib/ebin/orddict.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/otp_internal.beam b/bootstrap/lib/stdlib/ebin/otp_internal.beam
index 52b13fb974..97b7826149 100644
--- a/bootstrap/lib/stdlib/ebin/otp_internal.beam
+++ b/bootstrap/lib/stdlib/ebin/otp_internal.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/pool.beam b/bootstrap/lib/stdlib/ebin/pool.beam
index 72934a42d7..a06ae1717a 100644
--- a/bootstrap/lib/stdlib/ebin/pool.beam
+++ b/bootstrap/lib/stdlib/ebin/pool.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/proc_lib.beam b/bootstrap/lib/stdlib/ebin/proc_lib.beam
index cb6a8d6049..568015b3e4 100644
--- a/bootstrap/lib/stdlib/ebin/proc_lib.beam
+++ b/bootstrap/lib/stdlib/ebin/proc_lib.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/proplists.beam b/bootstrap/lib/stdlib/ebin/proplists.beam
index 2640cfe4ae..835df8c3a0 100644
--- a/bootstrap/lib/stdlib/ebin/proplists.beam
+++ b/bootstrap/lib/stdlib/ebin/proplists.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/qlc.beam b/bootstrap/lib/stdlib/ebin/qlc.beam
index 652604afc0..51529c5570 100644
--- a/bootstrap/lib/stdlib/ebin/qlc.beam
+++ b/bootstrap/lib/stdlib/ebin/qlc.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/qlc_pt.beam b/bootstrap/lib/stdlib/ebin/qlc_pt.beam
index 0e59d769a4..915c8dfc91 100644
--- a/bootstrap/lib/stdlib/ebin/qlc_pt.beam
+++ b/bootstrap/lib/stdlib/ebin/qlc_pt.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/rand.beam b/bootstrap/lib/stdlib/ebin/rand.beam
index b6e0d20bd7..588bbb3394 100644
--- a/bootstrap/lib/stdlib/ebin/rand.beam
+++ b/bootstrap/lib/stdlib/ebin/rand.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/random.beam b/bootstrap/lib/stdlib/ebin/random.beam
index f576b310df..e1d62c98d5 100644
--- a/bootstrap/lib/stdlib/ebin/random.beam
+++ b/bootstrap/lib/stdlib/ebin/random.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/re.beam b/bootstrap/lib/stdlib/ebin/re.beam
index 9e140def2c..7b2e736a21 100644
--- a/bootstrap/lib/stdlib/ebin/re.beam
+++ b/bootstrap/lib/stdlib/ebin/re.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/sets.beam b/bootstrap/lib/stdlib/ebin/sets.beam
index d8546de28d..4d4a2205f9 100644
--- a/bootstrap/lib/stdlib/ebin/sets.beam
+++ b/bootstrap/lib/stdlib/ebin/sets.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/shell.beam b/bootstrap/lib/stdlib/ebin/shell.beam
index 3b2d0eb0fa..e27b7bcb84 100644
--- a/bootstrap/lib/stdlib/ebin/shell.beam
+++ b/bootstrap/lib/stdlib/ebin/shell.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/slave.beam b/bootstrap/lib/stdlib/ebin/slave.beam
index 532c46cd38..373d65f198 100644
--- a/bootstrap/lib/stdlib/ebin/slave.beam
+++ b/bootstrap/lib/stdlib/ebin/slave.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/sofs.beam b/bootstrap/lib/stdlib/ebin/sofs.beam
index 976483833f..7cc095b953 100644
--- a/bootstrap/lib/stdlib/ebin/sofs.beam
+++ b/bootstrap/lib/stdlib/ebin/sofs.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/stdlib.app b/bootstrap/lib/stdlib/ebin/stdlib.app
index 4a52c6a443..7a76bc0ff1 100644
--- a/bootstrap/lib/stdlib/ebin/stdlib.app
+++ b/bootstrap/lib/stdlib/ebin/stdlib.app
@@ -20,7 +20,7 @@
%%
{application, stdlib,
[{description, "ERTS CXC 138 10"},
- {vsn, "2.5"},
+ {vsn, "2.6"},
{modules, [array,
base64,
beam_lib,
@@ -105,7 +105,7 @@
dets]},
{applications, [kernel]},
{env, []},
- {runtime_dependencies, ["sasl-2.4","kernel-4.0","erts-7.0","crypto-3.3",
+ {runtime_dependencies, ["sasl-2.6","kernel-4.1","erts-7.0","crypto-3.3",
"compiler-5.0"]}
]}.
diff --git a/bootstrap/lib/stdlib/ebin/stdlib.appup b/bootstrap/lib/stdlib/ebin/stdlib.appup
index 689485f421..8cfe41a2e1 100644
--- a/bootstrap/lib/stdlib/ebin/stdlib.appup
+++ b/bootstrap/lib/stdlib/ebin/stdlib.appup
@@ -16,9 +16,11 @@
%% limitations under the License.
%%
%% %CopyrightEnd%
-{"2.5",
+{"2.6",
%% Up from - max one major revision back
- [{<<"2\\.[0-4](\\.[0-9]+)*">>,[restart_new_emulator]}], %% 17.0-17.5
+ [{<<"2\\.5(\\.[0-9]+)*">>,[restart_new_emulator]}, %% OTP-18.0.*
+ {<<"2\\.[0-4](\\.[0-9]+)*">>,[restart_new_emulator]}], %% 17.0-17.5
%% Down to - max one major revision back
- [{<<"2\\.[0-4](\\.[0-9]+)*">>,[restart_new_emulator]}] %% 17.0-17.5
+ [{<<"2\\.5(\\.[0-9]+)*">>,[restart_new_emulator]}, %% OTP-18.0.*
+ {<<"2\\.[0-4](\\.[0-9]+)*">>,[restart_new_emulator]}] %% 17.0-17.5
}.
diff --git a/bootstrap/lib/stdlib/ebin/supervisor.beam b/bootstrap/lib/stdlib/ebin/supervisor.beam
index 6dd01bf004..ed50c91bf7 100644
--- a/bootstrap/lib/stdlib/ebin/supervisor.beam
+++ b/bootstrap/lib/stdlib/ebin/supervisor.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/supervisor_bridge.beam b/bootstrap/lib/stdlib/ebin/supervisor_bridge.beam
index 1ebc561ee5..279fded868 100644
--- a/bootstrap/lib/stdlib/ebin/supervisor_bridge.beam
+++ b/bootstrap/lib/stdlib/ebin/supervisor_bridge.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/sys.beam b/bootstrap/lib/stdlib/ebin/sys.beam
index a569f8003f..d0162bdd07 100644
--- a/bootstrap/lib/stdlib/ebin/sys.beam
+++ b/bootstrap/lib/stdlib/ebin/sys.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/timer.beam b/bootstrap/lib/stdlib/ebin/timer.beam
index 9887f37c70..8d8fcf8937 100644
--- a/bootstrap/lib/stdlib/ebin/timer.beam
+++ b/bootstrap/lib/stdlib/ebin/timer.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/unicode.beam b/bootstrap/lib/stdlib/ebin/unicode.beam
index 16557d5631..e34f8a35cf 100644
--- a/bootstrap/lib/stdlib/ebin/unicode.beam
+++ b/bootstrap/lib/stdlib/ebin/unicode.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/win32reg.beam b/bootstrap/lib/stdlib/ebin/win32reg.beam
index b37ead63ba..2b4f9229ea 100644
--- a/bootstrap/lib/stdlib/ebin/win32reg.beam
+++ b/bootstrap/lib/stdlib/ebin/win32reg.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/ebin/zip.beam b/bootstrap/lib/stdlib/ebin/zip.beam
index e80b6ae0cd..943fce47e0 100644
--- a/bootstrap/lib/stdlib/ebin/zip.beam
+++ b/bootstrap/lib/stdlib/ebin/zip.beam
Binary files differ
diff --git a/bootstrap/lib/stdlib/include/assert.hrl b/bootstrap/lib/stdlib/include/assert.hrl
new file mode 100644
index 0000000000..f913760102
--- /dev/null
+++ b/bootstrap/lib/stdlib/include/assert.hrl
@@ -0,0 +1,261 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright (C) 2004-2014 Richard Carlsson, Mickaël Rémond
+%%
+%% Licensed under the Apache License, Version 2.0 (the "License");
+%% you may not use this file except in compliance with the License.
+%% You may obtain a copy of the License at
+%%
+%% http://www.apache.org/licenses/LICENSE-2.0
+%%
+%% Unless required by applicable law or agreed to in writing, software
+%% distributed under the License is distributed on an "AS IS" BASIS,
+%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+%% See the License for the specific language governing permissions and
+%% limitations under the License.
+%%
+%% %CopyrightEnd%
+%%
+
+-ifndef(ASSERT_HRL).
+-define(ASSERT_HRL, true).
+
+%% Asserts are enabled unless NOASSERT is defined, and ASSERT can be used to
+%% override it: if both ASSERT and NOASSERT are defined, then ASSERT takes
+%% precedence, and NOASSERT will become undefined.
+%%
+%% Furthermore, if NODEBUG is defined, it implies NOASSERT, unless DEBUG or
+%% ASSERT are defined.
+%%
+%% If asserts are disabled, all assert macros are defined to be the atom
+%% 'ok'. If asserts are enabled, all assert macros are defined to yield 'ok'
+%% as the result if the test succeeds, and raise an error exception if the
+%% test fails. The error term will then have the form {Name, Info} where
+%% Name is the name of the macro and Info is a list of tagged tuples.
+
+%% allow NODEBUG to imply NOASSERT, unless DEBUG
+-ifdef(NODEBUG).
+-ifndef(DEBUG).
+-ifndef(NOASSERT).
+-define(NOASSERT, true).
+-endif.
+-endif.
+-endif.
+
+%% allow ASSERT to override NOASSERT
+-ifdef(ASSERT).
+-undef(NOASSERT).
+-endif.
+
+%% Assert macros must not depend on any non-kernel or stdlib libraries.
+%%
+%% We must use fun-call wrappers ((fun () -> ... end)()) to avoid
+%% exporting local variables, and furthermore we only use variable names
+%% prefixed with "__", that hopefully will not be bound outside the fun.
+%% It is not possible to nest assert macros.
+
+-ifdef(NOASSERT).
+-define(assert(BoolExpr),ok).
+-else.
+%% The assert macro is written the way it is so as not to cause warnings
+%% for clauses that cannot match, even if the expression is a constant.
+-define(assert(BoolExpr),
+ begin
+ ((fun () ->
+ case (BoolExpr) of
+ true -> ok;
+ __V -> erlang:error({assert,
+ [{module, ?MODULE},
+ {line, ?LINE},
+ {expression, (??BoolExpr)},
+ {expected, true},
+ case __V of false -> {value, __V};
+ _ -> {not_boolean,__V}
+ end]})
+ end
+ end)())
+ end).
+-endif.
+
+%% This is the inverse case of assert, for convenience.
+-ifdef(NOASSERT).
+-define(assertNot(BoolExpr),ok).
+-else.
+-define(assertNot(BoolExpr),
+ begin
+ ((fun () ->
+ case (BoolExpr) of
+ false -> ok;
+ __V -> erlang:error({assert,
+ [{module, ?MODULE},
+ {line, ?LINE},
+ {expression, (??BoolExpr)},
+ {expected, false},
+ case __V of true -> {value, __V};
+ _ -> {not_boolean,__V}
+ end]})
+ end
+ end)())
+ end).
+-endif.
+
+%% This is mostly a convenience which gives more detailed reports.
+%% Note: Guard is a guarded pattern, and can not be used for value.
+-ifdef(NOASSERT).
+-define(assertMatch(Guard, Expr), ok).
+-else.
+-define(assertMatch(Guard, Expr),
+ begin
+ ((fun () ->
+ case (Expr) of
+ Guard -> ok;
+ __V -> erlang:error({assertMatch,
+ [{module, ?MODULE},
+ {line, ?LINE},
+ {expression, (??Expr)},
+ {pattern, (??Guard)},
+ {value, __V}]})
+ end
+ end)())
+ end).
+-endif.
+
+%% This is the inverse case of assertMatch, for convenience.
+-ifdef(NOASSERT).
+-define(assertNotMatch(Guard, Expr), ok).
+-else.
+-define(assertNotMatch(Guard, Expr),
+ begin
+ ((fun () ->
+ __V = (Expr),
+ case __V of
+ Guard -> erlang:error({assertNotMatch,
+ [{module, ?MODULE},
+ {line, ?LINE},
+ {expression, (??Expr)},
+ {pattern, (??Guard)},
+ {value, __V}]});
+ _ -> ok
+ end
+ end)())
+ end).
+-endif.
+
+%% This is a convenience macro which gives more detailed reports when
+%% the expected LHS value is not a pattern, but a computed value
+-ifdef(NOASSERT).
+-define(assertEqual(Expect, Expr), ok).
+-else.
+-define(assertEqual(Expect, Expr),
+ begin
+ ((fun (__X) ->
+ case (Expr) of
+ __X -> ok;
+ __V -> erlang:error({assertEqual,
+ [{module, ?MODULE},
+ {line, ?LINE},
+ {expression, (??Expr)},
+ {expected, __X},
+ {value, __V}]})
+ end
+ end)(Expect))
+ end).
+-endif.
+
+%% This is the inverse case of assertEqual, for convenience.
+-ifdef(NOASSERT).
+-define(assertNotEqual(Unexpected, Expr), ok).
+-else.
+-define(assertNotEqual(Unexpected, Expr),
+ begin
+ ((fun (__X) ->
+ case (Expr) of
+ __X -> erlang:error({assertNotEqual,
+ [{module, ?MODULE},
+ {line, ?LINE},
+ {expression, (??Expr)},
+ {value, __X}]});
+ _ -> ok
+ end
+ end)(Unexpected))
+ end).
+-endif.
+
+%% Note: Class and Term are patterns, and can not be used for value.
+%% Term can be a guarded pattern, but Class cannot.
+-ifdef(NOASSERT).
+-define(assertException(Class, Term, Expr), ok).
+-else.
+-define(assertException(Class, Term, Expr),
+ begin
+ ((fun () ->
+ try (Expr) of
+ __V -> erlang:error({assertException,
+ [{module, ?MODULE},
+ {line, ?LINE},
+ {expression, (??Expr)},
+ {pattern,
+ "{ "++(??Class)++" , "++(??Term)
+ ++" , [...] }"},
+ {unexpected_success, __V}]})
+ catch
+ Class:Term -> ok;
+ __C:__T ->
+ erlang:error({assertException,
+ [{module, ?MODULE},
+ {line, ?LINE},
+ {expression, (??Expr)},
+ {pattern,
+ "{ "++(??Class)++" , "++(??Term)
+ ++" , [...] }"},
+ {unexpected_exception,
+ {__C, __T,
+ erlang:get_stacktrace()}}]})
+ end
+ end)())
+ end).
+-endif.
+
+-define(assertError(Term, Expr), ?assertException(error, Term, Expr)).
+-define(assertExit(Term, Expr), ?assertException(exit, Term, Expr)).
+-define(assertThrow(Term, Expr), ?assertException(throw, Term, Expr)).
+
+%% This is the inverse case of assertException, for convenience.
+%% Note: Class and Term are patterns, and can not be used for value.
+%% Both Class and Term can be guarded patterns.
+-ifdef(NOASSERT).
+-define(assertNotException(Class, Term, Expr), ok).
+-else.
+-define(assertNotException(Class, Term, Expr),
+ begin
+ ((fun () ->
+ try (Expr) of
+ _ -> ok
+ catch
+ __C:__T ->
+ case __C of
+ Class ->
+ case __T of
+ Term ->
+ erlang:error({assertNotException,
+ [{module, ?MODULE},
+ {line, ?LINE},
+ {expression, (??Expr)},
+ {pattern,
+ "{ "++(??Class)++" , "
+ ++(??Term)++" , [...] }"},
+ {unexpected_exception,
+ {__C, __T,
+ erlang:get_stacktrace()
+ }}]});
+ _ -> ok
+ end;
+ _ -> ok
+ end
+ end
+ end)())
+ end).
+-endif.
+
+-endif. % ASSERT_HRL
diff --git a/bootstrap/lib/stdlib/include/erl_bits.hrl b/bootstrap/lib/stdlib/include/erl_bits.hrl
index 8405a55d55..2a54587a17 100644
--- a/bootstrap/lib/stdlib/include/erl_bits.hrl
+++ b/bootstrap/lib/stdlib/include/erl_bits.hrl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1999-2009. All Rights Reserved.
+%% Copyright Ericsson AB 1999-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -26,10 +26,10 @@
-type bt_unit() :: 1..256.
-record(bittype, {
- type :: bt_type(),
- unit :: bt_unit(), %% element unit
- sign :: bt_sign(),
- endian :: bt_endian()
+ type :: bt_type() | 'undefined',
+ unit :: bt_unit() | 'undefined', %% element unit
+ sign :: bt_sign() | 'undefined',
+ endian :: bt_endian() | 'undefined'
}).
-record(bitdefault, {
diff --git a/configure.in b/configure.in
index 64b0bdac6d..e8c8680e19 100644
--- a/configure.in
+++ b/configure.in
@@ -208,10 +208,6 @@ AS_HELP_STRING([--disable-threads], [disable async thread support]))
AC_ARG_ENABLE(dirty-schedulers,
AS_HELP_STRING([--enable-dirty-schedulers], [enable dirty scheduler support]))
-AC_ARG_ENABLE(halfword-emulator,
-AS_HELP_STRING([--enable-halfword-emulator],
- [enable halfword emulator (only for 64bit builds). Note: Halfword emulator is marked as deprecated and scheduled for removal in future major release.]))
-
AC_ARG_ENABLE(smp-support,
AS_HELP_STRING([--enable-smp-support], [enable smp support])
AS_HELP_STRING([--disable-smp-support], [disable smp support]))
diff --git a/erts/aclocal.m4 b/erts/aclocal.m4
index 11c311f2c0..eb7d0411a7 100644
--- a/erts/aclocal.m4
+++ b/erts/aclocal.m4
@@ -74,21 +74,6 @@ AC_ARG_VAR(erl_xcomp_clock_gettime_cpu_time, [clock_gettime() can be used for re
AC_ARG_VAR(erl_xcomp_after_morecore_hook, [__after_morecore_hook can track malloc()s core memory usage: yes|no (only used when cross compiling)])
AC_ARG_VAR(erl_xcomp_dlsym_brk_wrappers, [dlsym(RTLD_NEXT, _) brk wrappers can track malloc()s core memory usage: yes|no (only used when cross compiling)])
-dnl Cross compilation variables for OSE
-AC_ARG_VAR(erl_xcomp_ose_ldflags_pass1, [Linker flags for the OSE module (pass 1) (only used when cross compiling for OSE)])
-AC_ARG_VAR(erl_xcomp_ose_ldflags_pass2, [Linker flags for the OSE module (pass 2) (only used when cross compiling for OSE)])
-AC_ARG_VAR(erl_xcomp_ose_OSEROOT, [OSE installation root directory (only used when cross compiling for OSE)])
-AC_ARG_VAR(erl_xcomp_ose_STRIP, [Strip utility shipped with the OSE distribution(only used when cross compiling for OSE)])
-AC_ARG_VAR(erl_xcomp_ose_LM_POST_LINK, [OSE postlink tool (only used when cross compiling for OSE)])
-AC_ARG_VAR(erl_xcomp_ose_LM_SET_CONF, [Sets the configuration for an OSE load module (only used when cross compiling for OSE)])
-AC_ARG_VAR(erl_xcomp_ose_LM_ELF_SIZE, [Prints the section size information for an OSE load module (only used when cross compiling for OSE)])
-AC_ARG_VAR(erl_xcomp_ose_LM_LCF, [OSE load module linker configuration file (only used when cross compiling for OSE)])
-AC_ARG_VAR(erl_xcomp_ose_BEAM_LM_CONF, [BEAM OSE load module default configuration file (only used when cross compiling for OSE)])
-AC_ARG_VAR(erl_xcomp_ose_EPMD_LM_CONF, [EPMD OSE load module default configuration file (only used when cross compiling for OSE)])
-AC_ARG_VAR(erl_xcomp_ose_RUN_ERL_LM_CONF, [run_erl_lm OSE load module default configuration file (only used when cross compiling for OSE)])
-AC_ARG_VAR(erl_xcomp_ose_CONFD, [OSE confd source file])
-AC_ARG_VAR(erl_xcomp_ose_CRT0_LM, [OSE crt0 lm source file])
-
])
AC_DEFUN(ERL_XCOMP_SYSROOT_INIT,
@@ -503,8 +488,6 @@ AC_CACHE_VAL(ac_cv_sys_ipv6_support,
#ifdef __WIN32__
#include <winsock2.h>
#include <ws2tcpip.h>
-#elif __OSE__
-#error "no ipv6"
#else
#include <netinet/in.h>
#endif],
@@ -517,8 +500,6 @@ else
#ifdef __WIN32__
#include <winsock2.h>
#include <ws2tcpip.h>
-#elif __OSE__
-#error "no ipv6"
#else
#include <netinet/in.h>
#endif],
@@ -750,8 +731,8 @@ AC_DEFUN(ERL_MONOTONIC_CLOCK,
prefer_resolution_clock_gettime_monotonic="$2"
;;
*)
- check_msg=""
- prefer_resolution_clock_gettime_monotonic=
+ check_msg="custom "
+ prefer_resolution_clock_gettime_monotonic="$2"
;;
esac
@@ -940,16 +921,16 @@ AC_DEFUN(ERL_WALL_CLOCK,
erl_wall_clock_low_resolution=no
erl_wall_clock_id=
- case $erl_cv_clock_gettime_wall_$1-$erl_cv_mach_clock_get_time_wall-$ac_cv_func_gettimeofday-$host_os in
- *-*-*-win32)
+ case $1-$erl_cv_clock_gettime_wall_$1-$erl_cv_mach_clock_get_time_wall-$ac_cv_func_gettimeofday-$host_os in
+ *-*-*-*-win32)
erl_wall_clock_func=WindowsAPI
erl_wall_clock_low_resolution=yes
;;
- no-yes-*-*)
+ high_resolution-no-yes-*-*)
erl_wall_clock_func=mach_clock_get_time
erl_wall_clock_id=CALENDAR_CLOCK
;;
- CLOCK_*-*-*-*)
+ *-CLOCK_*-*-*-*)
erl_wall_clock_func=clock_gettime
erl_wall_clock_id=$erl_cv_clock_gettime_wall_$1
for low_res_id in $low_resolution_clock_gettime_wall; do
@@ -959,7 +940,7 @@ AC_DEFUN(ERL_WALL_CLOCK,
fi
done
;;
- no-no-yes-*)
+ *-no-*-yes-*)
erl_wall_clock_func=gettimeofday
;;
*)
@@ -991,12 +972,6 @@ if test "X$host_os" = "Xwin32"; then
THR_LIBS=
THR_LIB_NAME=win32_threads
THR_LIB_TYPE=win32_threads
-elif test "X$host_os" = "Xose"; then
- AC_MSG_RESULT(yes)
- THR_DEFS="-DOSE_THREADS"
- THR_LIBS=
- THR_LIB_NAME=ose_threads
- THR_LIB_TYPE=ose_threads
else
AC_MSG_RESULT(no)
THR_DEFS=
@@ -1472,7 +1447,7 @@ AC_ARG_WITH(with_sparc_memory_order,
LM_CHECK_THR_LIB
ERL_INTERNAL_LIBS
-ERL_MONOTONIC_CLOCK(high_resolution, undefined, no)
+ERL_MONOTONIC_CLOCK(try_find_pthread_compatible, CLOCK_HIGHRES CLOCK_MONOTONIC, no)
case $erl_monotonic_clock_func in
clock_gettime)
@@ -1583,22 +1558,9 @@ case "$THR_LIB_NAME" in
fi
;;
- pthread|ose_threads)
- case "$THR_LIB_NAME" in
- pthread)
- ETHR_THR_LIB_BASE_DIR=pthread
- AC_DEFINE(ETHR_PTHREADS, 1, [Define if you have pthreads])
- ;;
- ose_threads)
- AC_DEFINE(ETHR_OSE_THREADS, 1,
- [Define if you have OSE style threads])
- ETHR_THR_LIB_BASE_DIR=ose
- AC_CHECK_HEADER(ose_spi/ose_spi.h,
- AC_DEFINE(HAVE_OSE_SPI_H, 1,
- [Define if you have the "ose_spi/ose_spi.h" header file.]))
- ;;
- esac
- if test "x$THR_LIB_NAME" = "xpthread"; then
+ pthread)
+ ETHR_THR_LIB_BASE_DIR=pthread
+ AC_DEFINE(ETHR_PTHREADS, 1, [Define if you have pthreads])
case $host_os in
openbsd*)
# The default stack size is insufficient for our needs
@@ -1657,7 +1619,6 @@ case "$THR_LIB_NAME" in
*) ;;
esac
- fi
dnl We sometimes need ETHR_DEFS in order to find certain headers
dnl (at least for pthread.h on osf1).
saved_cppflags="$CPPFLAGS"
@@ -1702,7 +1663,6 @@ case "$THR_LIB_NAME" in
dnl
dnl Check for functions
dnl
- if test "x$THR_LIB_NAME" = "xpthread"; then
AC_CHECK_FUNC(pthread_spin_lock, \
[ethr_have_native_spinlock=yes \
AC_DEFINE(ETHR_HAVE_PTHREAD_SPIN_LOCK, 1, \
@@ -1922,8 +1882,6 @@ case "$THR_LIB_NAME" in
esac
CFLAGS=$old_CFLAGS
- fi ## test "x$THR_LIB_NAME" = "xpthread"
-
if test "X$disable_native_ethr_impls" = "Xyes"; then
ethr_have_native_atomics=no
else
@@ -2219,10 +2177,10 @@ AS_HELP_STRING([--with-clock-gettime-monotonic-id=CLOCKID],
[specify clock id to use with clock_gettime() for monotonic time)]))
AC_ARG_ENABLE(prefer-elapsed-monotonic-time-during-suspend,
- AS_HELP_STRING([--enable-prefer-elapsed-monotonic-time-during-suspend],
- [Prefer an OS monotonic time source with elapsed time during suspend])
- AS_HELP_STRING([--disable-prefer-elapsed-monotonic-time-during-suspend],
- [Do not prefer an OS monotonic time source with elapsed time during suspend]),
+AS_HELP_STRING([--enable-prefer-elapsed-monotonic-time-during-suspend],
+ [Prefer an OS monotonic time source with elapsed time during suspend])
+AS_HELP_STRING([--disable-prefer-elapsed-monotonic-time-during-suspend],
+ [Do not prefer an OS monotonic time source with elapsed time during suspend]),
[ case "$enableval" in
yes) prefer_elapsed_monotonic_time_during_suspend=yes ;;
*) prefer_elapsed_monotonic_time_during_suspend=no ;;
@@ -2296,6 +2254,9 @@ case "$erl_wall_clock_func-$erl_wall_clock_id-$with_clock_gettime_realtime_id" i
esac
case $erl_wall_clock_func in
+ none)
+ AC_MSG_ERROR([No wall clock source found])
+ ;;
mach_clock_get_time)
AC_DEFINE(OS_SYSTEM_TIME_USING_MACH_CLOCK_GET_TIME, [1], [Define if you want to implement erts_os_system_time() using mach clock_get_time()])
;;
diff --git a/erts/configure.in b/erts/configure.in
index 22ca7ec17d..96ad58f941 100644
--- a/erts/configure.in
+++ b/erts/configure.in
@@ -143,14 +143,6 @@ AS_HELP_STRING([--enable-dirty-schedulers], [enable dirty scheduler support]),
*) enable_dirty_schedulers=yes ;;
esac ], enable_dirty_schedulers=no)
-AC_ARG_ENABLE(halfword-emulator,
-AS_HELP_STRING([--enable-halfword-emulator],
- [enable halfword emulator (only for 64bit builds). Note: Halfword emulator is marked as deprecated and scheduled for removal in future major release.]),
-[ case "$enableval" in
- no) enable_halfword_emualtor=no ;;
- *) enable_halfword_emulator=yes ;;
- esac ], enable_halfword_emulator=unknown)
-
AC_ARG_ENABLE(smp-support,
AS_HELP_STRING([--enable-smp-support], [enable smp support])
AS_HELP_STRING([--disable-smp-support], [disable smp support]),
@@ -342,6 +334,15 @@ AS_HELP_STRING([--enable-systemd], [enable systemd support in epmd]),
[],
[enable_systemd=no])
+AC_ARG_ENABLE(saved-compile-time,
+AS_HELP_STRING([--disable-saved-compile-time], [disable saved compile time]),
+[ case "$enableval" in
+ no) save_compile_time=0 ;;
+ *) save_compile_time=1 ;;
+ esac ], save_compile_time=1)
+
+AC_DEFINE_UNQUOTED(ERTS_SAVED_COMPILE_TIME, $save_compile_time, [Save compile time?])
+
dnl Magic test for clearcase.
OTP_RELEASE=
if test "${ERLANG_COMMERCIAL_BUILD}" != ""; then
@@ -787,36 +788,6 @@ esac
AC_SUBST(LIBCARBON)
-dnl Check if we should/can build a halfword emulator
-
-AC_MSG_CHECKING(if we are building a halfword emulator (32bit heap on 64bit machine))
-if test "$enable_halfword_emulator" = "yes"; then
- if test "$ARCH" = "amd64"; then
- AC_DEFINE(HALFWORD_HEAP_EMULATOR, [1],
- [Define if building a halfword-heap 64bit emulator])
- ENABLE_ALLOC_TYPE_VARS="$ENABLE_ALLOC_TYPE_VARS halfword"
- AC_MSG_RESULT([yes])
-
- test -f "$ERL_TOP/erts/CONF_INFO" ||
- echo "" > "$ERL_TOP/erts/CONF_INFO"
- cat >> $ERL_TOP/erts/CONF_INFO <<EOF
-
- The HALFWORD emulator has been enabled.
- This is a DEPRECATED feature scheduled for removal
- in a future major release.
-
-EOF
- else
- AC_MSG_ERROR(no; halfword emulator not supported on this architecture)
- fi
-else
- AC_MSG_RESULT([no])
-fi
-
-
-
-
-
dnl some tests below will call this if we haven't already - and autoconf
dnl can't handle those tests being done conditionally at runtime
AC_PROG_CPP
@@ -935,10 +906,7 @@ dnl what the user say. This might not be the right way to do it, but
dnl for now that is the way we do it.
USER_LD=$LD
USER_LDFLAGS="$LDFLAGS"
-case $host in
- *ose) ;;
- *) LD='$(CC)' ;;
-esac
+LD='$(CC)'
AC_SUBST(LD)
LDFLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH"
@@ -953,8 +921,6 @@ dnl This is the os flavour, should be unix, ose, vxworks or win32
case $host in
win32)
ERLANG_OSTYPE=win32 ;;
- *ose)
- ERLANG_OSTYPE=ose ;;
*)
ERLANG_OSTYPE=unix ;;
esac
@@ -1263,7 +1229,7 @@ case "$enable_threads"-"$found_threads" in
AC_MSG_RESULT(yes; enabled by user) ;;
unknown-yes)
case $host_os in
- solaris*|linux*|darwin*|win32|ose)
+ solaris*|linux*|darwin*|win32)
emu_threads=yes
AC_MSG_RESULT(yes; default on this platform)
;;
@@ -1345,7 +1311,7 @@ else
enable_child_waiter_thread=no
fi
;;
- win32|ose)
+ win32)
# Child waiter thread cannot be enabled
disable_child_waiter_thread=yes
enable_child_waiter_thread=no
@@ -2109,7 +2075,7 @@ AC_CHECK_FUNCS([getipnodebyname getipnodebyaddr gethostbyname2])
AC_CHECK_FUNCS([ieee_handler fpsetmask finite isnan isinf res_gethostbyname dlopen \
pread pwrite memmove strerror strerror_r strncasecmp \
gethrtime localtime_r gmtime_r inet_pton \
- memcpy mallopt sbrk _sbrk __sbrk brk _brk __brk \
+ mmap mremap memcpy mallopt sbrk _sbrk __sbrk brk _brk __brk \
flockfile fstat strlcpy strlcat setsid posix2time time2posix \
setlocale nl_langinfo poll mlockall ppoll])
@@ -2161,17 +2127,6 @@ case $host_os in
AC_CHECK_FUNCS([writev]) ;;
esac
-case $host_os in
- *ose)
- AC_MSG_CHECKING([for mmap])
- AC_MSG_RESULT(not using for OSE)
- AC_MSG_CHECKING([for mremap])
- AC_MSG_RESULT(not using for OSE) ;;
- *)
- AC_CHECK_FUNCS([mmap mremap]) ;;
-esac
-
-
AC_CHECK_DECLS([posix2time, time2posix],,,[#include <time.h>])
disable_vfork=false
@@ -2825,12 +2780,6 @@ if test "$cross_compiling" != "yes" && test X${enable_hipe} != Xno; then
if test -z "$M4"; then
enable_hipe=no
AC_MSG_NOTICE([HiPE disabled as no valid m4 is found in PATH])
- elif test "$enable_halfword_emulator" = "yes"; then
- if test X${enable_hipe} = Xyes; then
- AC_MSG_ERROR([HiPE can not be combined with halfword emulator (yet)])
- else
- AC_MSG_NOTICE([HiPE auto-disabled on halfword emulator])
- fi
else
case "$ARCH-$OPSYS" in
x86-linux|amd64-linux|x86-darwin*|amd64-darwin*|ppc-linux|ppc64-linux|ppc-darwin|arm-linux|amd64-freebsd|x86-freebsd|x86-sol2|amd64-sol2|ultrasparc-linux)
@@ -4931,7 +4880,6 @@ AC_OUTPUT(
Makefile:Makefile.in
../make/$host/otp.mk:../make/otp.mk.in
../make/$host/otp_ded.mk:../make/otp_ded.mk.in
- ../make/$host/ose_lm.mk:../make/ose_lm.mk.in
dnl
dnl The ones below should be moved to their respective lib
dnl
diff --git a/erts/doc/src/absform.xml b/erts/doc/src/absform.xml
index 547d5e583d..49fe784d06 100644
--- a/erts/doc/src/absform.xml
+++ b/erts/doc/src/absform.xml
@@ -70,6 +70,10 @@
Rep(D) = <c><![CDATA[[Rep(F_1), ..., Rep(F_k)]]]></c>.</item>
<item>If F is an attribute <c><![CDATA[-module(Mod)]]></c>, then
Rep(F) = <c><![CDATA[{attribute,LINE,module,Mod}]]></c>.</item>
+ <item>If F is an attribute <c><![CDATA[-behavior(Behavior)]]></c>, then
+ Rep(F) = <c><![CDATA[{attribute,LINE,behavior,Behavior}]]></c>.</item>
+ <item>If F is an attribute <c><![CDATA[-behaviour(Behaviour)]]></c>, then
+ Rep(F) = <c><![CDATA[{attribute,LINE,behaviour,Behaviour}]]></c>.</item>
<item>If F is an attribute <c><![CDATA[-export([Fun_1/A_1, ..., Fun_k/A_k])]]></c>, then
Rep(F) = <c><![CDATA[{attribute,LINE,export,[{Fun_1,A_1}, ..., {Fun_k,A_k}]}]]></c>.</item>
<item>If F is an attribute <c><![CDATA[-import(Mod,[Fun_1/A_1, ..., Fun_k/A_k])]]></c>, then
@@ -243,12 +247,6 @@
<item>If V is <c><![CDATA[A = E]]></c>, then
Rep(V) = <c><![CDATA[{record_field,LINE,Rep(A),Rep(E)}]]></c>.</item>
<item>If V is <c><![CDATA[A :: T]]></c>, where <c><![CDATA[A]]></c> is
- an atom and <c><![CDATA[T]]></c> is a type and it does not contain
- <c><![CDATA[undefined]]></c> syntactically, then Rep(V) =
- <c><![CDATA[{typed_record_field,{record_field,LINE,Rep(A)},Rep(undefined | T)}]]></c>.
- Note that if <![CDATA[T]]> is an annotated type, it will be wrapped in
- parentheses.</item>
- <item>If V is <c><![CDATA[A :: T]]></c>, where <c><![CDATA[A]]></c> is
an atom and <c><![CDATA[T]]></c> is a type, then Rep(V) =
<c><![CDATA[{typed_record_field,{record_field,LINE,Rep(A)},Rep(T)}]]></c>.
</item>
diff --git a/erts/doc/src/driver_entry.xml b/erts/doc/src/driver_entry.xml
index 30772c68fe..c802693977 100644
--- a/erts/doc/src/driver_entry.xml
+++ b/erts/doc/src/driver_entry.xml
@@ -4,7 +4,7 @@
<cref>
<header>
<copyright>
- <year>2001</year><year>2013</year>
+ <year>2001</year><year>2015</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -126,7 +126,7 @@
<section>
<title>DATA TYPES</title>
<taglist>
- <tag><b>ErlDrvEntry</b></tag>
+ <tag><em>ErlDrvEntry</em></tag>
<item>
<p/>
<code type="none">
@@ -235,6 +235,7 @@ typedef struct erl_drv_entry {
</item>
<tag><marker id="ready_input"/>void (*ready_input)(ErlDrvData drv_data, ErlDrvEvent event)</tag>
+ <item/>
<tag><marker id="ready_output"/>void (*ready_output)(ErlDrvData drv_data, ErlDrvEvent event)</tag>
<item>
<p>This is called when a driver event (given in the
@@ -246,14 +247,10 @@ typedef struct erl_drv_entry {
something that the <c>WaitForMultipleObjects</c> API
function understands). (Some trickery in the emulator allows
more than the built-in limit of 64 <c>Events</c> to be used.)</p>
- <p>On Enea OSE the <c>event</c> is one or more signals that can
- be retrieved using <seealso marker="ose:ose_erl_driver#erl_drv_ose_get_signal">erl_drv_ose_get_signal</seealso>.</p>
<p>To use this with threads and asynchronous routines, create a
- pipe on unix, an Event on Windows or a unique signal number on
- Enea OSE. When the routine
+ pipe on unix and an Event on Windows. When the routine
completes, write to the pipe (use <c>SetEvent</c> on
- Windows or send a message to the emulator process on Enea OSE),
- this will make the emulator call
+ Windows), this will make the emulator call
<c>ready_input</c> or <c>ready_output</c>.</p>
<p>Spurious events may happen. That is, calls to <c>ready_input</c>
or <c>ready_output</c> even though no real events are signaled. In
diff --git a/erts/doc/src/erl.xml b/erts/doc/src/erl.xml
index b0322b7d43..63ab2532ab 100644
--- a/erts/doc/src/erl.xml
+++ b/erts/doc/src/erl.xml
@@ -4,7 +4,7 @@
<comref>
<header>
<copyright>
- <year>1996</year><year>2013</year>
+ <year>1996</year><year>2015</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -138,7 +138,7 @@
see <seealso marker="kernel:app">app(4)</seealso> and
<seealso marker="kernel:application">application(3)</seealso>.</p>
</item>
- <tag><marker id="args_file"><c><![CDATA[-args_file FileName]]></c></marker></tag>
+ <tag><marker id="args_file"/><c><![CDATA[-args_file FileName]]></c></tag>
<item>
<p>Command line arguments are read from the file <c><![CDATA[FileName]]></c>.
The arguments read from the file replace the
@@ -203,7 +203,7 @@
<seealso marker="kernel:app">app(4)</seealso> and
<seealso marker="kernel:application">application(3)</seealso>.</p>
</item>
- <tag><marker id="connect_all"><c><![CDATA[-connect_all false]]></c></marker></tag>
+ <tag><marker id="connect_all"/><c><![CDATA[-connect_all false]]></c></tag>
<item>
<p>If this flag is present, <c><![CDATA[global]]></c> will not maintain a
fully connected network of distributed Erlang nodes, and then
@@ -288,7 +288,7 @@
<p>Makes <c><![CDATA[init]]></c> write some debug information while
interpreting the boot script.</p>
</item>
- <tag><marker id="instr"><c><![CDATA[-instr]]></c>(emulator flag)</marker></tag>
+ <tag><marker id="instr"/><c><![CDATA[-instr]]></c>(emulator flag)</tag>
<item>
<p>Selects an instrumented Erlang runtime system (virtual
machine) to run, instead of the ordinary one. When running an
@@ -436,7 +436,7 @@
flag and those running with the <c><![CDATA[-name]]></c> flag, as node
names must be unique in distributed Erlang systems.</p>
</item>
- <tag><marker id="smp"><c><![CDATA[-smp [enable|auto|disable]]]></c></marker></tag>
+ <tag><marker id="smp"/><c><![CDATA[-smp [enable|auto|disable]]]></c></tag>
<item>
<p><c>-smp enable</c> and <c>-smp</c> starts the Erlang runtime
system with SMP support enabled. This may fail if no runtime
@@ -462,7 +462,7 @@
<p><c><![CDATA[erl]]></c> invokes the code for the Erlang emulator (virtual
machine), which supports the following flags:</p>
<taglist>
- <tag><marker id="async_thread_stack_size"><c><![CDATA[+a size]]></c></marker></tag>
+ <tag><marker id="async_thread_stack_size"/><c><![CDATA[+a size]]></c></tag>
<item>
<p>Suggested stack size, in kilowords, for threads in the
async-thread pool. Valid range is 16-8192 kilowords. The
@@ -477,7 +477,7 @@
suggestion, and it might even be ignored on some
platforms.</p>
</item>
- <tag><marker id="async_thread_pool_size"><c><![CDATA[+A size]]></c></marker></tag>
+ <tag><marker id="async_thread_pool_size"/><c><![CDATA[+A size]]></c></tag>
<item>
<p>Sets the number of threads in async thread pool, valid range
is 0-1024. If thread support is available, the default is 10.</p>
@@ -496,7 +496,7 @@
<c><![CDATA[werl]]></c>, not <c><![CDATA[erl]]></c> (<c><![CDATA[oldshell]]></c>). Note also that
<c><![CDATA[Ctrl-Break]]></c> is used instead of <c><![CDATA[Ctrl-C]]></c> on Windows.</p>
</item>
- <tag><marker id="+c"><c><![CDATA[+c true | false]]></c></marker></tag>
+ <tag><marker id="+c"/><c><![CDATA[+c true | false]]></c></tag>
<item>
<p>Enable or disable
<seealso marker="time_correction#Time_Correction">time correction</seealso>:</p>
@@ -512,7 +512,7 @@
This is interpreted as <c>+c false</c>.
</p>
</item>
- <tag><marker id="+C_"><c><![CDATA[+C no_time_warp | single_time_warp | multi_time_warp]]></c></marker></tag>
+ <tag><marker id="+C_"/><c><![CDATA[+C no_time_warp | single_time_warp | multi_time_warp]]></c></tag>
<item>
<p>Set
<seealso marker="time_correction#Time_Warp_Modes">time warp mode</seealso>:
@@ -540,7 +540,7 @@
produce a crash dump. On Unix systems, sending an emulator process
a SIGUSR1 signal will also force a crash dump.</p>
</item>
- <tag><marker id="+e"><c><![CDATA[+e Number]]></c></marker></tag>
+ <tag><marker id="+e"/><c><![CDATA[+e Number]]></c></tag>
<item>
<p>Set max number of ETS tables.</p>
</item>
@@ -625,7 +625,7 @@
information about the file names and line numbers.
</p>
</item>
- <tag><marker id="erts_alloc"><c><![CDATA[+MFlag Value]]></c></marker></tag>
+ <tag><marker id="erts_alloc"/><c><![CDATA[+MFlag Value]]></c></tag>
<item>
<p>Memory allocator specific flags, see
<seealso marker="erts_alloc">erts_alloc(3)</seealso> for
@@ -664,10 +664,10 @@
debugging.</item>
</taglist>
</item>
- <tag><marker id="+pc"/><marker id="printable_character_range"><c><![CDATA[+pc Range]]></c></marker></tag>
+ <tag><marker id="+pc"/><marker id="printable_character_range"/><c><![CDATA[+pc Range]]></c></tag>
<item>
<p>Sets the range of characters that the system will consider printable in heuristic detection of strings. This typically affects the shell, debugger and io:format functions (when ~tp is used in the format string).</p>
- <p>Currently two values for the <c>Range</c> are supported:
+ <p>Currently two values for the <c>Range</c> are supported:</p>
<taglist>
<tag><c>latin1</c></tag> <item>The default. Only characters
in the ISO-latin-1 range can be considered printable, which means
@@ -682,11 +682,10 @@
example your font does not cover all Unicode
characters.</item>
</taglist>
- </p>
<p>Se also <seealso marker="stdlib:io#printable_range/0">
io:printable_range/0</seealso>.</p>
</item>
- <tag><marker id="+P"/><marker id="max_processes"><c><![CDATA[+P Number|legacy]]></c></marker></tag>
+ <tag><marker id="+P"/><marker id="max_processes"/><c><![CDATA[+P Number|legacy]]></c></tag>
<item>
<p>Sets the maximum number of simultaneously existing processes for this
system if a <c>Number</c> is passed as value. Valid range for
@@ -706,7 +705,7 @@
circumstances be extremely expensive. The legacy algoritm is deprecated,
and the <c>legacy</c> option is scheduled for removal in OTP-R18.</p>
</item>
- <tag><marker id="+Q"/><marker id="max_ports"><c><![CDATA[+Q Number|legacy]]></c></marker></tag>
+ <tag><marker id="+Q"/><marker id="max_ports"/><c><![CDATA[+Q Number|legacy]]></c></tag>
<item>
<p>Sets the maximum number of simultaneously existing ports for this
system if a Number is passed as value. Valid range for <c>Number</c>
@@ -737,7 +736,7 @@
circumstances be extremely expensive. The legacy algoritm is deprecated,
and the <c>legacy</c> option is scheduled for removal in OTP-R18.</p>
</item>
- <tag><marker id="compat_rel"><c><![CDATA[+R ReleaseNumber]]></c></marker></tag>
+ <tag><marker id="compat_rel"/><c><![CDATA[+R ReleaseNumber]]></c></tag>
<item>
<p>Sets the compatibility mode.</p>
<p>The distribution mechanism is not backwards compatible by
@@ -757,7 +756,7 @@
<item>
<p>Force ets memory block to be moved on realloc.</p>
</item>
- <tag><marker id="+rg"><c><![CDATA[+rg ReaderGroupsLimit]]></c></marker></tag>
+ <tag><marker id="+rg"/><c><![CDATA[+rg ReaderGroupsLimit]]></c></tag>
<item>
<p>Limits the amount of reader groups used by read/write locks
optimized for read operations in the Erlang runtime system. By
@@ -775,7 +774,7 @@
schedulers to logical processors</seealso>, since the reader groups
are distributed better between schedulers.</p>
</item>
- <tag><marker id="+S"><c><![CDATA[+S Schedulers:SchedulerOnline]]></c></marker></tag>
+ <tag><marker id="+S"/><c><![CDATA[+S Schedulers:SchedulerOnline]]></c></tag>
<item>
<p>Sets the number of scheduler threads to create and scheduler
threads to set online when SMP support has been enabled. The maximum for
@@ -800,7 +799,7 @@
SMP support enabled (see the <seealso marker="#smp">-smp</seealso>
flag).</p>
</item>
- <tag><marker id="+SP"><c><![CDATA[+SP SchedulersPercentage:SchedulersOnlinePercentage]]></c></marker></tag>
+ <tag><marker id="+SP"/><c><![CDATA[+SP SchedulersPercentage:SchedulersOnlinePercentage]]></c></tag>
<item>
<p>Similar to <seealso marker="#+S">+S</seealso> but uses percentages to set the
number of scheduler threads to create, based on logical processors configured,
@@ -821,7 +820,7 @@
SMP support enabled (see the <seealso marker="#smp">-smp</seealso>
flag).</p>
</item>
- <tag><marker id="+SDcpu"><c><![CDATA[+SDcpu DirtyCPUSchedulers:DirtyCPUSchedulersOnline]]></c></marker></tag>
+ <tag><marker id="+SDcpu"/><c><![CDATA[+SDcpu DirtyCPUSchedulers:DirtyCPUSchedulersOnline]]></c></tag>
<item>
<p>Sets the number of dirty CPU scheduler threads to create and dirty
CPU scheduler threads to set online when threading support has been
@@ -845,7 +844,7 @@
enabled (it's disabled by default).
</p>
</item>
- <tag><marker id="+SDPcpu"><c><![CDATA[+SDPcpu DirtyCPUSchedulersPercentage:DirtyCPUSchedulersOnlinePercentage]]></c></marker></tag>
+ <tag><marker id="+SDPcpu"/><c><![CDATA[+SDPcpu DirtyCPUSchedulersPercentage:DirtyCPUSchedulersOnlinePercentage]]></c></tag>
<item>
<p>Similar to <seealso marker="#+SDcpu">+SDcpu</seealso> but uses percentages to set the
number of dirty CPU scheduler threads to create and number of dirty CPU scheduler threads
@@ -868,7 +867,7 @@
enabled (it's disabled by default).
</p>
</item>
- <tag><marker id="+SDio"><c><![CDATA[+SDio IOSchedulers]]></c></marker></tag>
+ <tag><marker id="+SDio"/><c><![CDATA[+SDio IOSchedulers]]></c></tag>
<item>
<p>Sets the number of dirty I/O scheduler threads to create when threading
support has been enabled. The valid range is 0-1024. By default, the number
@@ -886,7 +885,7 @@
<item>
<p>Scheduling specific flags.</p>
<taglist>
- <tag><marker id="+sbt"><c>+sbt BindType</c></marker></tag>
+ <tag><marker id="+sbt"/><c>+sbt BindType</c></tag>
<item>
<p>Set scheduler bind type.</p>
<p>Schedulers can also be bound using the
@@ -1010,7 +1009,7 @@
<seealso marker="erlang#system_info_scheduler_bindings">erlang:system_info(scheduler_bindings)</seealso>.
</p>
</item>
- <tag><marker id="+sbwt"><c>+sbwt none|very_short|short|medium|long|very_long</c></marker></tag>
+ <tag><marker id="+sbwt"/><c>+sbwt none|very_short|short|medium|long|very_long</c></tag>
<item>
<p>Set scheduler busy wait threshold. Default is <c>medium</c>.
The threshold determines how long schedulers should busy
@@ -1020,7 +1019,7 @@
without prior notice.
</p>
</item>
- <tag><marker id="+scl"><c>+scl true|false</c></marker></tag>
+ <tag><marker id="+scl"/><c>+scl true|false</c></tag>
<item>
<p>Enable or disable scheduler compaction of load. By default
scheduler compaction of load is enabled. When enabled, load
@@ -1037,7 +1036,7 @@
between schedulers.
</p>
</item>
- <tag><marker id="+sct"><c>+sct CpuTopology</c></marker></tag>
+ <tag><marker id="+sct"/><c>+sct CpuTopology</c></tag>
<item>
<list type="bulleted">
<item><c><![CDATA[<Id> = integer(); when 0 =< <Id> =< 65535]]></c></item>
@@ -1159,7 +1158,7 @@
<p>For more information, see
<seealso marker="erlang#system_info_cpu_topology">erlang:system_info(cpu_topology)</seealso>.</p>
</item>
- <tag><marker id="+secio"><c>+secio true|false</c></marker></tag>
+ <tag><marker id="+secio"/><c>+secio true|false</c></tag>
<item>
<p>Enable or disable eager check I/O scheduling. The default
is currently <c>true</c>. The default was changed from <c>false</c>
@@ -1176,7 +1175,7 @@
<p><seealso marker="erlang#system_info_eager_check_io"><c>erlang:system_info(eager_check_io)</c></seealso>
returns the value of this parameter used when starting the VM.</p>
</item>
- <tag><marker id="+sfwi"><c>+sfwi Interval</c></marker></tag>
+ <tag><marker id="+sfwi"/><c>+sfwi Interval</c></tag>
<item>
<p>Set scheduler forced wakeup interval. All run queues will
be scanned each <c>Interval</c> milliseconds. While there are
@@ -1190,7 +1189,7 @@
the <c>+sfwi</c> flag will be removed.
</p>
</item>
- <tag><marker id="+stbt"><c>+stbt BindType</c></marker></tag>
+ <tag><marker id="+stbt"/><c>+stbt BindType</c></tag>
<item>
<p>Try to set scheduler bind type. The same as the
<seealso marker="#+sbt">+sbt</seealso> flag with the exception of
@@ -1198,7 +1197,7 @@
documentation of the <seealso marker="#+sbt">+sbt</seealso> flag.
</p>
</item>
- <tag><marker id="+sub"><c>+sub true|false</c></marker></tag>
+ <tag><marker id="+sub"/><c>+sub true|false</c></tag>
<item>
<p>Enable or disable
<seealso marker="erts:erlang#statistics_scheduler_wall_time">scheduler
@@ -1221,7 +1220,7 @@
utilization.
</p>
</item>
- <tag><marker id="+swct"><c>+swct very_eager|eager|medium|lazy|very_lazy</c></marker></tag>
+ <tag><marker id="+swct"/><c>+swct very_eager|eager|medium|lazy|very_lazy</c></tag>
<item>
<p>
Set scheduler wake cleanup threshold. Default is <c>medium</c>.
@@ -1235,7 +1234,7 @@
<p><em>NOTE:</em> This flag may be removed or changed at any time without prior notice.
</p>
</item>
- <tag><marker id="+sws"><c>+sws default|legacy</c></marker></tag>
+ <tag><marker id="+sws"/><c>+sws default|legacy</c></tag>
<item>
<p>
Set scheduler wakeup strategy. Default strategy changed in erts-5.10/OTP-R16A. This strategy was previously known as <c>proposal</c> in OTP-R15. The <c>legacy</c> strategy was used as default from R13 up to and including R15.
@@ -1243,7 +1242,7 @@
<p><em>NOTE:</em> This flag may be removed or changed at any time without prior notice.
</p>
</item>
- <tag><marker id="+swt"><c>+swt very_low|low|medium|high|very_high</c></marker></tag>
+ <tag><marker id="+swt"/><c>+swt very_low|low|medium|high|very_high</c></tag>
<item>
<p>Set scheduler wakeup threshold. Default is <c>medium</c>.
The threshold determines when to wake up sleeping schedulers
@@ -1257,7 +1256,7 @@
without prior notice.
</p>
</item>
- <tag><marker id="+spp"><c>+spp Bool</c></marker></tag>
+ <tag><marker id="+spp"/><c>+spp Bool</c></tag>
<item>
<p>Set default scheduler hint for port parallelism. If set to
<c>true</c>, the VM will schedule port tasks when doing so will
@@ -1273,7 +1272,7 @@
option to <seealso
marker="erlang#open_port/2">open_port/2</seealso></p>.
</item>
- <tag><marker id="sched_thread_stack_size"><c><![CDATA[+sss size]]></c></marker></tag>
+ <tag><marker id="sched_thread_stack_size"/><c><![CDATA[+sss size]]></c></tag>
<item>
<p>Suggested stack size, in kilowords, for scheduler threads.
Valid range is 4-8192 kilowords. The default stack size
@@ -1281,11 +1280,11 @@
</item>
</taglist>
</item>
- <tag><marker id="+t"><c><![CDATA[+t size]]></c></marker></tag>
+ <tag><marker id="+t"/><c><![CDATA[+t size]]></c></tag>
<item>
<p>Set the maximum number of atoms the VM can handle. Default is 1048576.</p>
</item>
- <tag><marker id="+T"><c><![CDATA[+T Level]]></c></marker></tag>
+ <tag><marker id="+T"/><c><![CDATA[+T Level]]></c></tag>
<item>
<p>Enables modified timing and sets the modified timing level.
Currently valid range is 0-9. The timing of the runtime system
@@ -1339,7 +1338,7 @@
<item>
<p>Miscellaneous flags.</p>
<taglist>
- <tag><marker id="+zdbbl"><c>+zdbbl size</c></marker></tag>
+ <tag><marker id="+zdbbl"/><c>+zdbbl size</c></tag>
<item>
<p>Set the distribution buffer busy limit
(<seealso marker="erlang#system_info_dist_buf_busy_limit">dist_buf_busy_limit</seealso>)
@@ -1352,7 +1351,7 @@
give lower latency and higher throughput at the expense
of higher memory usage.</p>
</item>
- <tag><marker id="+zdntgc"><c>+zdntgc time</c></marker></tag>
+ <tag><marker id="+zdntgc"/><c>+zdntgc time</c></tag>
<item>
<p>Set the delayed node table garbage collection time
(<seealso marker="erlang#system_info_delayed_node_table_gc">delayed_node_table_gc</seealso>)
@@ -1426,7 +1425,7 @@
</item>
</taglist>
</item>
- <tag><marker id="ERL_AFLAGS"><c><![CDATA[ERL_AFLAGS]]></c></marker></tag>
+ <tag><marker id="ERL_AFLAGS"/><c><![CDATA[ERL_AFLAGS]]></c></tag>
<item>
<p>The content of this environment variable will be added to the
beginning of the command line for <c><![CDATA[erl]]></c>.</p>
@@ -1436,7 +1435,7 @@
the <c><![CDATA[-extra]]></c> section, i.e. the end of the command line
following after an <c><![CDATA[-extra]]></c> flag.</p>
</item>
- <tag><marker id="ERL_ZFLAGS"><c><![CDATA[ERL_ZFLAGS]]></c></marker> and <marker id="ERL_FLAGS"><c><![CDATA[ERL_FLAGS]]></c></marker></tag>
+ <tag><marker id="ERL_ZFLAGS"/><c><![CDATA[ERL_ZFLAGS]]></c> and <marker id="ERL_FLAGS"/><c><![CDATA[ERL_FLAGS]]></c></tag>
<item>
<p>The content of these environment variables will be added to the
end of the command line for <c><![CDATA[erl]]></c>.</p>
diff --git a/erts/doc/src/erl_dist_protocol.xml b/erts/doc/src/erl_dist_protocol.xml
index e1a58856f3..b435d5c9b4 100644
--- a/erts/doc/src/erl_dist_protocol.xml
+++ b/erts/doc/src/erl_dist_protocol.xml
@@ -5,7 +5,7 @@
<header>
<copyright>
<year>2007</year>
- <year>2013</year>
+ <year>2015</year>
<holder>Ericsson AB, All Rights Reserved</holder>
</copyright>
<legalnotice>
@@ -549,10 +549,10 @@ If Result > 0, the packet only consists of [119, Result].
-->
</section>
- <marker id="distribution_handshake"/>
<section>
<title>Distribution Handshake</title>
<p>
+ <marker id="distribution_handshake"/>
This section describes the distribution handshake protocol
introduced in the OTP-R6 release of Erlang/OTP. This
description was previously located in
diff --git a/erts/doc/src/erl_driver.xml b/erts/doc/src/erl_driver.xml
index 1f7fe0f961..f7b4187b80 100644
--- a/erts/doc/src/erl_driver.xml
+++ b/erts/doc/src/erl_driver.xml
@@ -4,7 +4,7 @@
<cref>
<header>
<copyright>
- <year>2001</year><year>2014</year>
+ <year>2001</year><year>2015</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -223,7 +223,7 @@
asynchronous function calls, using a thread pool provided by
Erlang. There is also a select call, that can be used for
asynchronous drivers.</item>
- <tag><marker id="multi_threading">Multi-threading</marker></tag>
+ <tag><marker id="multi_threading"/>Multi-threading</tag>
<item>
<p>A POSIX thread like API for multi-threading is provided. The
Erlang driver thread API only provide a subset of the functionality
@@ -297,7 +297,7 @@
<item><p>A driver can add and later remove drivers.</p></item>
<tag>Monitoring processes</tag>
<item><p>A driver can monitor a process that does not own a port.</p></item>
- <tag><marker id="version_management">Version management</marker></tag>
+ <tag><marker id="version_management"/>Version management</tag>
<item>
<p>Version management is enabled for drivers that have set the
<seealso marker="driver_entry#extended_marker">extended_marker</seealso>
@@ -384,12 +384,12 @@
<item>
<p>
Rewrite driver callback
- <c><seealso marker="driver_entry#control">control</seealso></c>
+ <seealso marker="driver_entry#control"><c>control</c></seealso>
to use return type <c>ErlDrvSSizeT</c> instead of <c>int</c>.
</p>
<p>
Rewrite driver callback
- <c><seealso marker="driver_entry#call">call</seealso></c>
+ <seealso marker="driver_entry#call"><c>call</c></seealso>
to use return type <c>ErlDrvSSizeT</c> instead of <c>int</c>.
</p>
<note>
@@ -407,19 +407,19 @@
<item>
<p>
Driver callback
- <c><seealso marker="driver_entry#output">output</seealso></c>
+ <seealso marker="driver_entry#output"><c>output</c></seealso>
now gets <c>ErlDrvSizeT</c> as 3rd argument instead
of previously <c>int</c>.
</p>
<p>
Driver callback
- <c><seealso marker="driver_entry#control">control</seealso></c>
+ <seealso marker="driver_entry#control"><c>control</c></seealso>
now gets <c>ErlDrvSizeT</c> as 4th and 6th arguments instead
of previously <c>int</c>.
</p>
<p>
Driver callback
- <c><seealso marker="driver_entry#call">call</seealso></c>
+ <seealso marker="driver_entry#call"><c>call</c></seealso>
now gets <c>ErlDrvSizeT</c> as 4th and 6th arguments instead
of previously <c>int</c>.
</p>
@@ -1044,9 +1044,7 @@ typedef struct ErlIOVec {
<c>select</c>/<c>poll</c> can use).
On windows, the Win32 API function <c>WaitForMultipleObjects</c>
is used. This places other restrictions on the event object.
- Refer to the Win32 SDK documentation.
- On Enea OSE, the receive function is used. See the <seealso
- marker="ose:ose_erl_driver"></seealso> for more details.</p>
+ Refer to the Win32 SDK documentation.</p>
<p>The <c>on</c> parameter should be <c>1</c> for setting events
and <c>0</c> for clearing them.</p>
<p>The <c>mode</c> argument is a bitwise-or combination of
@@ -1058,7 +1056,7 @@ typedef struct ErlIOVec {
<seealso marker="driver_entry#ready_output">ready_output</seealso>.
</p>
<note>
- <p>Some OS (Windows and Enea OSE) do not differentiate between read and write events.
+ <p>Some OS (Windows) do not differentiate between read and write events.
The call-back for a fired event then only depends on the value of <c>mode</c>.</p>
</note>
<p><c>ERL_DRV_USE</c> specifies if we are using the event object or if we want to close it.
diff --git a/erts/doc/src/erl_ext_dist.xml b/erts/doc/src/erl_ext_dist.xml
index caf1e812c4..2ac974f497 100644
--- a/erts/doc/src/erl_ext_dist.xml
+++ b/erts/doc/src/erl_ext_dist.xml
@@ -5,7 +5,7 @@
<header>
<copyright>
<year>2007</year>
- <year>2014</year>
+ <year>2015</year>
<holder>Ericsson AB, All Rights Reserved</holder>
</copyright>
<legalnotice>
@@ -150,10 +150,10 @@
</note>
</section>
- <marker id="distribution_header"/>
<section>
<title>Distribution header</title>
<p>
+ <marker id="distribution_header"/>
As of erts version 5.7.2 the old atom cache protocol was
dropped and a new one was introduced. This atom cache protocol
introduced the distribution header. Nodes with erts versions
diff --git a/erts/doc/src/erl_nif.xml b/erts/doc/src/erl_nif.xml
index 23c3d5fcee..dae14b8d08 100644
--- a/erts/doc/src/erl_nif.xml
+++ b/erts/doc/src/erl_nif.xml
@@ -4,7 +4,7 @@
<cref>
<header>
<copyright>
- <year>2001</year><year>2013</year>
+ <year>2001</year><year>2015</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -833,9 +833,10 @@ typedef enum {
<fsummary>Determine if a term is an empty list</fsummary>
<desc><p>Return true if <c>term</c> is an empty list.</p></desc>
</func>
- <marker id="enif_is_exception"/><func><name><ret>int</ret><nametext>enif_is_exception(ErlNifEnv* env, ERL_NIF_TERM term)</nametext></name>
+ <func><name><ret>int</ret><nametext>enif_is_exception(ErlNifEnv* env, ERL_NIF_TERM term)</nametext></name>
<fsummary>Determine if a term is an exception</fsummary>
- <desc><p>Return true if <c>term</c> is an exception.</p></desc>
+ <desc><marker id="enif_is_exception"/>
+ <p>Return true if <c>term</c> is an exception.</p></desc>
</func>
<func><name><ret>int</ret><nametext>enif_is_map(ErlNifEnv* env, ERL_NIF_TERM term)</nametext></name>
<fsummary>Determine if a term is a map</fsummary>
diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml
index 37f0aa289e..3927339b2b 100644
--- a/erts/doc/src/erlang.xml
+++ b/erts/doc/src/erlang.xml
@@ -4,7 +4,7 @@
<erlref>
<header>
<copyright>
- <year>1996</year><year>2013</year>
+ <year>1996</year><year>2015</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -30,42 +30,43 @@
<file>erlang.xml</file>
</header>
<module>erlang</module>
- <modulesummary>The Erlang BIFs</modulesummary>
+ <modulesummary>The Erlang BIFs.</modulesummary>
<description>
- <p>By convention, most built-in functions (BIFs) are seen as being
- in the module <c>erlang</c>. A number of the BIFs are viewed more
+ <p>By convention, most Built-In Functions (BIFs) are seen as being
+ in this module. Some of the BIFs are viewed more
or less as part of the Erlang programming language and are
- <em>auto-imported</em>. Thus, it is not necessary to specify
- the module name and both the calls <c>atom_to_list(Erlang)</c> and
- <c>erlang:atom_to_list(Erlang)</c> are identical.</p>
- <p>In the text, auto-imported BIFs are listed without module prefix.
+ <em>auto-imported</em>. Thus, it is not necessary to specify the
+ module name. For example, the calls <c>atom_to_list(Erlang)</c>
+ and <c>erlang:atom_to_list(Erlang)</c> are identical.</p>
+ <p>Auto-imported BIFs are listed without module prefix.
BIFs listed with module prefix are not auto-imported.</p>
- <p>BIFs may fail for a variety of reasons. All BIFs fail with
+ <p>BIFs can fail for various reasons. All BIFs fail with
reason <c>badarg</c> if they are called with arguments of an
- incorrect type. The other reasons that may make BIFs fail are
- described in connection with the description of each individual
- BIF.</p>
- <p>Some BIFs may be used in guard tests, these are marked with
+ incorrect type. The other reasons are described in the
+ description of each individual BIF.</p>
+ <p>Some BIFs can be used in guard tests and are marked with
"Allowed in guard tests".</p>
</description>
<datatypes>
<datatype>
- <name><marker id="type-ext_binary">ext_binary()</marker></name>
+ <name>ext_binary()</name>
<desc>
+ <marker id="type-ext_binary"></marker>
<p>A binary data object, structured according to
the Erlang external term format.</p>
</desc>
</datatype>
+
<datatype>
<name name="timestamp"></name>
<desc><p>See <seealso marker="#timestamp/0">erlang:timestamp/0</seealso>.</p>
</desc>
</datatype>
- <marker id="type_time_unit"/>
<datatype>
<name name="time_unit"></name>
- <desc><p>Currently supported time unit representations:</p>
+ <desc><p><marker id="type_time_unit"/>
+ Supported time unit representations:</p>
<taglist>
<tag><c>PartsPerSecond :: integer() >= 1</c></tag>
<item><p>Time unit expressed in parts per second. That is,
@@ -92,11 +93,11 @@
used by the Erlang runtime system.</p>
<p>The <c>native</c> time unit is determined at
- runtime system start, and will remain the same until
+ runtime system start, and remains the same until
the runtime system terminates. If a runtime system
is stopped and then started again (even on the same
machine), the <c>native</c> time unit of the new
- runtime system instance may differ from the
+ runtime system instance can differ from the
<c>native</c> time unit of the old runtime system
instance.</p>
@@ -105,8 +106,7 @@
seconds, native)</c>. The result equals the number
of whole <c>native</c> time units per second. In case
the number of <c>native</c> time units per second does
- not add up to a whole number, the result will be
- rounded downwards.</p>
+ not add up to a whole number, the result is rounded downwards.</p>
<note>
<p>The value of the <c>native</c> time unit gives
@@ -120,7 +120,7 @@
but it gives absolutely no information at all about the
<seealso marker="time_correction#Time_Accuracy">accuracy</seealso>
of time values. The resolution of the <c>native</c> time
- unit and the resolution of time values may differ
+ unit and the resolution of time values can differ
significantly.</p>
</note>
</item>
@@ -139,12 +139,15 @@
<func>
<name name="abs" arity="1" clause_i="1"/>
<name name="abs" arity="1" clause_i="2"/>
- <type variable="Float" name_i="1"/>
- <type variable="Int" name_i="2"/>
- <fsummary>Arithmetical absolute value</fsummary>
- <desc>
- <p>Returns an integer or float which is the arithmetical
- absolute value of <c><anno>Float</anno></c> or <c><anno>Int</anno></c>.</p>
+ <fsummary>Arithmetical absolute value.</fsummary>
+ <type>
+ <v>Float = float()</v>
+ <v>Int = integer()</v>
+ </type>
+ <desc>
+ <p>Returns an integer or float that is the arithmetical
+ absolute value of <c><anno>Float</anno></c> or
+ <c><anno>Int</anno></c>, for example:</p>
<pre>
> <input>abs(-3.33).</input>
3.33
@@ -153,206 +156,214 @@
<p>Allowed in guard tests.</p>
</desc>
</func>
+
<func>
<name name="adler32" arity="1"/>
- <fsummary>Compute adler32 checksum</fsummary>
+ <fsummary>Computes adler32 checksum.</fsummary>
<desc>
- <p>Computes and returns the adler32 checksum for <c><anno>Data</anno></c>.</p>
+ <p>Computes and returns the adler32 checksum for
+ <c><anno>Data</anno></c>.</p>
</desc>
</func>
+
<func>
<name name="adler32" arity="2"/>
- <fsummary>Compute adler32 checksum</fsummary>
+ <fsummary>Computes adler32 checksum.</fsummary>
<desc>
- <p>Continue computing the adler32 checksum by combining
- the previous checksum, <c><anno>OldAdler</anno></c>, with the checksum of
- <c><anno>Data</anno></c>.</p>
- <p>The following code:</p>
- <code>
- X = erlang:adler32(Data1),
- Y = erlang:adler32(X,Data2).
- </code>
- <p>- would assign the same value to <c>Y</c> as this would:</p>
- <code>
- Y = erlang:adler32([Data1,Data2]).
- </code>
+ <p>Continues computing the adler32 checksum by combining
+ the previous checksum, <c><anno>OldAdler</anno></c>, with
+ the checksum of <c><anno>Data</anno></c>.</p>
+ <p>The following code:</p>
+ <code>
+ X = erlang:adler32(Data1),
+ Y = erlang:adler32(X,Data2).</code>
+ <p>assigns the same value to <c>Y</c> as this:</p>
+ <code>
+ Y = erlang:adler32([Data1,Data2]).</code>
</desc>
</func>
+
<func>
<name name="adler32_combine" arity="3"/>
- <fsummary>Combine two adler32 checksums</fsummary>
- <desc>
- <p>Combines two previously computed adler32 checksums.
- This computation requires the size of the data object for
- the second checksum to be known.</p>
- <p>The following code:</p>
- <code>
- Y = erlang:adler32(Data1),
- Z = erlang:adler32(Y,Data2).
- </code>
- <p>- would assign the same value to <c>Z</c> as this would:</p>
- <code>
- X = erlang:adler32(Data1),
- Y = erlang:adler32(Data2),
- Z = erlang:adler32_combine(X,Y,iolist_size(Data2)).
- </code>
+ <fsummary>Combines two adler32 checksums.</fsummary>
+ <desc>
+ <p>Combines two previously computed adler32 checksums.
+ This computation requires the size of the data object for
+ the second checksum to be known.</p>
+ <p>The following code:</p>
+ <code>
+ Y = erlang:adler32(Data1),
+ Z = erlang:adler32(Y,Data2).</code>
+ <p>assigns the same value to <c>Z</c> as this:</p>
+ <code>
+ X = erlang:adler32(Data1),
+ Y = erlang:adler32(Data2),
+ Z = erlang:adler32_combine(X,Y,iolist_size(Data2)).</code>
</desc>
</func>
+
<func>
<name name="append_element" arity="2"/>
- <fsummary>Append an extra element to a tuple</fsummary>
- <desc>
- <p>Returns a new tuple which has one element more than
- <c><anno>Tuple1</anno></c>, and contains the elements in <c><anno>Tuple1</anno></c>
- followed by <c><anno>Term</anno></c> as the last element. Semantically
- equivalent to
- <c>list_to_tuple(tuple_to_list(<anno>Tuple1</anno>) ++ [<anno>Term</anno>])</c>, but much
- faster.</p>
+ <fsummary>Appends an extra element to a tuple.</fsummary>
+ <desc>
+ <p>Returns a new tuple that has one element more than
+ <c><anno>Tuple1</anno></c>, and contains the elements in
+ <c><anno>Tuple1</anno></c>
+ followed by <c><anno>Term</anno></c> as the last element.
+ Semantically equivalent to
+ <c>list_to_tuple(tuple_to_list(<anno>Tuple1</anno>) ++
+ [<anno>Term</anno>])</c>, but much faster.</p>
+ <p>Example:</p>
<pre>
> <input>erlang:append_element({one, two}, three).</input>
{one,two,three}</pre>
</desc>
</func>
+
<func>
<name name="apply" arity="2"/>
- <fsummary>Apply a function to an argument list</fsummary>
+ <fsummary>Applies a function to an argument list.</fsummary>
<desc>
- <p>Call a fun, passing the elements in <c><anno>Args</anno></c> as
- arguments.</p>
- <p>Note: If the number of elements in the arguments are known at
- compile-time, the call is better written as
+ <p>Calls a fun, passing the elements in <c><anno>Args</anno></c>
+ as arguments.</p>
+ <p>If the number of elements in the arguments are known at
+ compile time, the call is better written as
<c><anno>Fun</anno>(Arg1, Arg2, ... ArgN)</c>.</p>
<warning>
<p>Earlier, <c><anno>Fun</anno></c> could also be given as
<c>{Module, Function}</c>, equivalent to
- <c>apply(Module, Function, Args)</c>. This usage is
- deprecated and will stop working in a future release of
- Erlang/OTP.</p>
+ <c>apply(Module, Function, Args)</c>. This use is
+ deprecated and will stop working in a future release.</p>
</warning>
</desc>
</func>
+
<func>
<name name="apply" arity="3"/>
- <fsummary>Apply a function to an argument list</fsummary>
+ <fsummary>Applies a function to an argument list.</fsummary>
<desc>
<p>Returns the result of applying <c>Function</c> in
- <c><anno>Module</anno></c> to <c><anno>Args</anno></c>. The applied function must
+ <c><anno>Module</anno></c> to <c><anno>Args</anno></c>.
+ The applied function must
be exported from <c>Module</c>. The arity of the function is
the length of <c>Args</c>.</p>
+ <p>Example:</p>
<pre>
> <input>apply(lists, reverse, [[a, b, c]]).</input>
-[c,b,a]</pre>
- <p><c>apply</c> can be used to evaluate BIFs by using
- the module name <c>erlang</c>.</p>
- <pre>
+[c,b,a]
> <input>apply(erlang, atom_to_list, ['Erlang']).</input>
"Erlang"</pre>
- <p>Note: If the number of arguments are known at compile-time,
+ <p>If the number of arguments are known at compile time,
the call is better written as
<c><anno>Module</anno>:<anno>Function</anno>(Arg1, Arg2, ..., ArgN)</c>.</p>
<p>Failure: <c>error_handler:undefined_function/3</c> is called
if the applied function is not exported. The error handler
can be redefined (see
<seealso marker="#process_flag/2">process_flag/2</seealso>).
- If the <c>error_handler</c> is undefined, or if the user has
+ If <c>error_handler</c> is undefined, or if the user has
redefined the default <c>error_handler</c> so the replacement
module is undefined, an error with the reason <c>undef</c>
is generated.</p>
</desc>
</func>
+
<func>
<name name="atom_to_binary" arity="2"/>
- <fsummary>Return the binary representation of an atom</fsummary>
- <desc>
- <p>Returns a binary which corresponds to the text
- representation of <c><anno>Atom</anno></c>. If <c><anno>Encoding</anno></c>
- is <c>latin1</c>, there will be one byte for each character
- in the text representation. If <c><anno>Encoding</anno></c> is
- <c>utf8</c> or
- <c>unicode</c>, the characters will be encoded using UTF-8
- (meaning that characters from 16#80 up to 0xFF will be
- encoded in two bytes).</p>
-
- <note><p>Currently, <c>atom_to_binary(<anno>Atom</anno>, latin1)</c> can
- never fail because the text representation of an atom can only contain
- characters from 0 to 16#FF. In a future release, the text representation
- of atoms might be allowed to contain any Unicode character
- and <c>atom_to_binary(<anno>Atom</anno>, latin1)</c> will fail if the
- text representation for the <c><anno>Atom</anno></c> contains a Unicode
- character greater than 16#FF.</p></note>
-
+ <fsummary>Returns the binary representation of an atom.</fsummary>
+ <desc>
+ <p>Returns a binary corresponding to the text
+ representation of <c><anno>Atom</anno></c>.
+ If <c><anno>Encoding</anno></c>
+ is <c>latin1</c>, there is one byte for each character
+ in the text representation. If <c><anno>Encoding</anno></c> is
+ <c>utf8</c> or
+ <c>unicode</c>, the characters are encoded using UTF-8
+ (that is, characters from 128 through 255 are
+ encoded in two bytes).</p>
+ <note><p><c>atom_to_binary(<anno>Atom</anno>, latin1)</c> never
+ fails because the text representation of an atom can only
+ contain characters from 0 through 255. In a future release,
+ the text representation
+ of atoms can be allowed to contain any Unicode character and
+ <c>atom_to_binary(<anno>Atom</anno>, latin1)</c> will then fail if the
+ text representation for <c><anno>Atom</anno></c> contains a Unicode
+ character greater than 255.</p></note>
+ <p>Example:</p>
<pre>
> <input>atom_to_binary('Erlang', latin1).</input>
&lt;&lt;"Erlang"&gt;&gt;</pre>
</desc>
</func>
+
<func>
<name name="atom_to_list" arity="1"/>
- <fsummary>Text representation of an atom</fsummary>
+ <fsummary>Text representation of an atom.</fsummary>
<desc>
- <p>Returns a string which corresponds to the text
- representation of <c><anno>Atom</anno></c>.</p>
+ <p>Returns a string corresponding to the text
+ representation of <c><anno>Atom</anno></c>, for example:</p>
<pre>
> <input>atom_to_list('Erlang').</input>
"Erlang"</pre>
</desc>
</func>
+
<func>
<name name="binary_part" arity="2"/>
- <fsummary>Extracts a part of a binary</fsummary>
+ <fsummary>Extracts a part of a binary.</fsummary>
<desc>
- <p>Extracts the part of the binary described by <c><anno>PosLen</anno></c>.</p>
-
- <p>Negative length can be used to extract bytes at the end of a binary:</p>
-
+ <p>Extracts the part of the binary described by
+ <c><anno>PosLen</anno></c>.</p>
+ <p>Negative length can be used to extract bytes at the end
+ of a binary, for example:</p>
<code>
1> Bin = &lt;&lt;1,2,3,4,5,6,7,8,9,10&gt;&gt;.
2> binary_part(Bin,{byte_size(Bin), -5}).
-&lt;&lt;6,7,8,9,10&gt;&gt;
-</code>
-
- <p>If <c><anno>PosLen</anno></c> in any way references outside the binary, a <c>badarg</c> exception is raised.</p>
-
- <p><c><anno>Start</anno></c> is zero-based, i.e.:</p>
+&lt;&lt;6,7,8,9,10&gt;&gt;</code>
+ <p>Failure: <c>badarg</c> if <c><anno>PosLen</anno></c> in any way
+ references outside the binary.</p>
+ <p><c><anno>Start</anno></c> is zero-based, that is:</p>
<code>
1> Bin = &lt;&lt;1,2,3&gt;&gt;
2> binary_part(Bin,{0,2}).
-&lt;&lt;1,2&gt;&gt;
-</code>
-
- <p>See the STDLIB module <c>binary</c> for details about the <c><anno>PosLen</anno></c> semantics.</p>
-
+&lt;&lt;1,2&gt;&gt;</code>
+ <p>For details about the <c><anno>PosLen</anno></c> semantics, see the
+ <seealso marker="stdlib:binary">binary</seealso>
+ manual page in <c>STDLIB</c>.</p>
<p>Allowed in guard tests.</p>
</desc>
</func>
+
<func>
<name name="binary_part" arity="3"/>
- <fsummary>Extracts a part of a binary</fsummary>
+ <fsummary>Extracts a part of a binary.</fsummary>
<desc>
- <p>The same as <c>binary_part(<anno>Subject</anno>, {<anno>Start</anno>, <anno>Length</anno>})</c>.</p>
-
+ <p>The same as <c>binary_part(<anno>Subject</anno>,
+ {<anno>Start</anno>, <anno>Length</anno>})</c>.</p>
<p>Allowed in guard tests.</p>
</desc>
</func>
+
<func>
<name name="binary_to_atom" arity="2"/>
- <fsummary>Convert from text representation to an atom</fsummary>
+ <fsummary>Converts from text representation to an atom.</fsummary>
<desc>
<p>Returns the atom whose text representation is
- <c><anno>Binary</anno></c>. If <c><anno>Encoding</anno></c> is <c>latin1</c>, no
- translation of bytes in the binary is done. If <c><anno>Encoding</anno></c>
- is <c>utf8</c> or <c>unicode</c>, the binary must contain
- valid UTF-8 sequences; furthermore, only Unicode characters up
- to 0xFF are allowed.</p>
-
- <note><p><c>binary_to_atom(<anno>Binary</anno>, utf8)</c> will fail if
- the binary contains Unicode characters greater than 16#FF.
- In a future release, such Unicode characters might be allowed
- and <c>binary_to_atom(<anno>Binary</anno>, utf8)</c>
- will not fail in that case. For more information on Unicode support in atoms
- see <seealso marker="erl_ext_dist#utf8_atoms">note on UTF-8 encoded atoms</seealso>
- in the chapter about the external term format in the ERTS User's Guide.</p></note>
-
+ <c><anno>Binary</anno></c>.
+ If <c><anno>Encoding</anno></c> is <c>latin1</c>, no
+ translation of bytes in the binary is done.
+ If <c><anno>Encoding</anno></c>
+ is <c>utf8</c> or <c>unicode</c>, the binary must contain
+ valid UTF-8 sequences. Only Unicode characters up
+ to 255 are allowed.</p>
+ <note><p><c>binary_to_atom(<anno>Binary</anno>, utf8)</c> fails if
+ the binary contains Unicode characters greater than 255.
+ In a future release, such Unicode characters can be allowed
+ and <c>binary_to_atom(<anno>Binary</anno>, utf8)</c> does then not fail.
+ For more information on Unicode support in atoms, see the
+ <seealso marker="erl_ext_dist#utf8_atoms">note on UTF-8
+ encoded atoms</seealso>
+ in Section "External Term Format" in the User's Guide.</p></note>
+ <p>Examples:</p>
<pre>
> <input>binary_to_atom(&lt;&lt;"Erlang"&gt;&gt;, latin1).</input>
'Erlang'
@@ -362,20 +373,24 @@
called as binary_to_atom(&lt;&lt;208,128&gt;&gt;,utf8)</pre>
</desc>
</func>
+
<func>
<name name="binary_to_existing_atom" arity="2"/>
- <fsummary>Convert from text representation to an atom</fsummary>
+ <fsummary>Converts from text representation to an atom.</fsummary>
<desc>
- <p>Works like <seealso marker="#binary_to_atom/2">binary_to_atom/2</seealso>,
- but the atom must already exist.</p>
- <p>Failure: <c>badarg</c> if the atom does not already exist.</p>
+ <p>As
+ <seealso marker="#binary_to_atom/2">binary_to_atom/2</seealso>,
+ but the atom must exist.</p>
+ <p>Failure: <c>badarg</c> if the atom does not exist.</p>
</desc>
</func>
+
<func>
<name name="binary_to_float" arity="1"/>
- <fsummary>Convert from text representation to a float</fsummary>
+ <fsummary>Converts from text representation to a float.</fsummary>
<desc>
- <p>Returns the float whose text representation is <c><anno>Binary</anno></c>.</p>
+ <p>Returns the float whose text representation is
+ <c><anno>Binary</anno></c>, for example:</p>
<pre>
> <input>binary_to_float(&lt;&lt;"2.2017764e+0">>).</input>
2.2017764</pre>
@@ -383,12 +398,13 @@
representation of a float.</p>
</desc>
</func>
+
<func>
<name name="binary_to_integer" arity="1"/>
- <fsummary>Convert from text representation to an integer</fsummary>
+ <fsummary>Converts from text representation to an integer.</fsummary>
<desc>
<p>Returns an integer whose text representation is
- <c><anno>Binary</anno></c>.</p>
+ <c><anno>Binary</anno></c>, for example:</p>
<pre>
> <input>binary_to_integer(&lt;&lt;"123"&gt;&gt;).</input>
123</pre>
@@ -396,12 +412,13 @@
representation of an integer.</p>
</desc>
</func>
+
<func>
<name name="binary_to_integer" arity="2"/>
- <fsummary>Convert from text representation to an integer</fsummary>
+ <fsummary>Converts from text representation to an integer.</fsummary>
<desc>
<p>Returns an integer whose text representation in base
- <c><anno>Base</anno></c> is <c><anno>Binary</anno></c>.</p>
+ <c><anno>Base</anno></c> is <c><anno>Binary</anno></c>, for example:</p>
<pre>
> <input>binary_to_integer(&lt;&lt;"3FF"&gt;&gt;, 16).</input>
1023</pre>
@@ -409,93 +426,101 @@
representation of an integer.</p>
</desc>
</func>
+
<func>
<name name="binary_to_list" arity="1"/>
- <fsummary>Convert a binary to a list</fsummary>
+ <fsummary>Converts a binary to a list.</fsummary>
<desc>
- <p>Returns a list of integers which correspond to the bytes of
+ <p>Returns a list of integers corresponding to the bytes of
<c><anno>Binary</anno></c>.</p>
</desc>
</func>
+
<func>
<name name="binary_to_list" arity="3"/>
- <fsummary>Convert part of a binary to a list</fsummary>
- <type_desc variable="Start">1..byte_size(<anno>Binary</anno>)</type_desc>
+ <fsummary>Converts part of a binary to a list.</fsummary>
+ <type_desc variable="Start">1..byte_size(<c><anno>Binary</anno></c>)</type_desc>
<desc>
<p>As <c>binary_to_list/1</c>, but returns a list of integers
corresponding to the bytes from position <c><anno>Start</anno></c> to
- position <c><anno>Stop</anno></c> in <c><anno>Binary</anno></c>. Positions in the
+ position <c><anno>Stop</anno></c> in <c><anno>Binary</anno></c>.
+ The positions in the
binary are numbered starting from 1.</p>
-
- <note><p>This function's indexing style of using one-based indices for
- binaries is deprecated. New code should use the functions in
- the STDLIB module <c>binary</c> instead. They consequently
- use the same (zero-based) style of indexing.</p></note>
+ <note><p>The one-based indexing for binaries used by
+ this function is deprecated. New code is to use
+ <seealso marker="stdlib:binary#bin_to_list/3">binary:bin_to_list/3</seealso>
+ in <c>STDLIB</c> instead. All functions in module
+ <c>binary</c> consistently use zero-based indexing.</p></note>
</desc>
</func>
+
<func>
<name name="bitstring_to_list" arity="1"/>
- <fsummary>Convert a bitstring to a list</fsummary>
+ <fsummary>Converts a bitstring to a list.</fsummary>
<desc>
- <p>Returns a list of integers which correspond to the bytes of
- <c><anno>Bitstring</anno></c>. If the number of bits in the binary is not
- divisible by 8, the last element of the list will be a bitstring
- containing the remaining bits (1 up to 7 bits).</p>
+ <p>Returns a list of integers corresponding to the bytes of
+ <c><anno>Bitstring</anno></c>. If the number of bits in the binary
+ is not divisible by 8, the last element of the list is a bitstring
+ containing the remaining 1-7 bits.</p>
</desc>
</func>
+
<func>
<name name="binary_to_term" arity="1"/>
- <fsummary>Decode an Erlang external term format binary</fsummary>
+ <fsummary>Decodes an Erlang external term format binary.</fsummary>
<desc>
- <p>Returns an Erlang term which is the result of decoding
- the binary object <c><anno>Binary</anno></c>, which must be encoded
+ <p>Returns an Erlang term that is the result of decoding
+ binary object <c><anno>Binary</anno></c>, which must be encoded
according to the Erlang external term format.</p>
- <warning>
- <p>When decoding binaries from untrusted sources, consider using
- <c>binary_to_term/2</c> to prevent denial of service attacks.</p>
- </warning>
- <p>See also
- <seealso marker="#term_to_binary/1">term_to_binary/1</seealso>
- and
- <seealso marker="#binary_to_term/2">binary_to_term/2</seealso>.</p>
+ <warning><p>When decoding binaries from untrusted sources,
+ consider using <c>binary_to_term/2</c> to prevent Denial
+ of Service attacks.</p></warning>
+ <p>See also
+ <seealso marker="#term_to_binary/1">term_to_binary/1</seealso>
+ and
+ <seealso marker="#binary_to_term/2">binary_to_term/2</seealso>.</p>
</desc>
</func>
+
<func>
<name name="binary_to_term" arity="2"/>
- <fsummary>Decode an Erlang external term format binary</fsummary>
+ <fsummary>Decodes an Erlang external term format binary.</fsummary>
<desc>
<p>As <c>binary_to_term/1</c>, but takes options that affect decoding
of the binary.</p>
<taglist>
<tag><c>safe</c></tag>
<item>
- <p>Use this option when receiving binaries from an untrusted
+ <p>Use this option when receiving binaries from an untrusted
source.</p>
- <p>When enabled, it prevents decoding data that may be used to
- attack the Erlang system. In the event of receiving unsafe
- data, decoding fails with a badarg error.</p>
- <p>Currently, this prevents creation of new atoms directly,
- creation of new atoms indirectly (as they are embedded in
- certain structures like pids, refs, funs, etc.), and creation of
- new external function references. None of those resources are
- currently garbage collected, so unchecked creation of them can
- exhaust available memory.</p>
+ <p>When enabled, it prevents decoding data that can be used to
+ attack the Erlang system. In the event of receiving unsafe
+ data, decoding fails with a <c>badarg</c> error.</p>
+ <p>This prevents creation of new atoms directly,
+ creation of new atoms indirectly (as they are embedded in
+ certain structures, such as process identifiers,
+ refs, and funs), and
+ creation of new external function references.
+ None of those resources are garbage collected, so unchecked
+ creation of them can exhaust available memory.</p>
</item>
</taglist>
- <p>Failure: <c>badarg</c> if <c>safe</c> is specified and unsafe data
- is decoded.</p>
+ <p>Failure: <c>badarg</c> if <c>safe</c> is specified and unsafe
+ data is decoded.</p>
<p>See also
<seealso marker="#term_to_binary/1">term_to_binary/1</seealso>,
<seealso marker="#binary_to_term/1">binary_to_term/1</seealso>,
- and <seealso marker="#list_to_existing_atom/1">
- list_to_existing_atom/1</seealso>.</p>
+ and
+ <seealso marker="#list_to_existing_atom/1">list_to_existing_atom/1</seealso>.</p>
</desc>
</func>
+
<func>
<name name="bit_size" arity="1"/>
- <fsummary>Return the size of a bitstring</fsummary>
+ <fsummary>Returns the size of a bitstring.</fsummary>
<desc>
- <p>Returns an integer which is the size in bits of <c><anno>Bitstring</anno></c>.</p>
+ <p>Returns an integer that is the size in bits of
+ <c><anno>Bitstring</anno></c>, for example:</p>
<pre>
> <input>bit_size(&lt;&lt;433:16,3:3&gt;&gt;).</input>
19
@@ -504,30 +529,34 @@
<p>Allowed in guard tests.</p>
</desc>
</func>
+
<func>
<name name="bump_reductions" arity="1"/>
- <fsummary>Increment the reduction counter</fsummary>
+ <fsummary>Increments the reduction counter.</fsummary>
<desc>
<p>This implementation-dependent function increments
the reduction counter for the calling process. In the Beam
emulator, the reduction counter is normally incremented by
- one for each function and BIF call, and a context switch is
- forced when the counter reaches the maximum number of reductions
- for a process (2000 reductions in R12B).</p>
+ one for each function and BIF call. A context switch is
+ forced when the counter reaches the maximum number of
+ reductions for a process (2000 reductions in OTP R12B).</p>
<warning>
- <p>This BIF might be removed in a future version of the Beam
+ <p>This BIF can be removed in a future version of the Beam
machine without prior warning. It is unlikely to be
implemented in other Erlang implementations.</p>
</warning>
</desc>
</func>
+
<func>
<name name="byte_size" arity="1"/>
- <fsummary>Return the size of a bitstring (or binary)</fsummary>
+ <fsummary>Returns the size of a bitstring (or binary).</fsummary>
<desc>
- <p>Returns an integer which is the number of bytes needed to contain
- <c><anno>Bitstring</anno></c>. (That is, if the number of bits in <c><anno>Bitstring</anno></c> is not
- divisible by 8, the resulting number of bytes will be rounded <em>up</em>.)</p>
+ <p>Returns an integer that is the number of bytes needed to
+ contain <c><anno>Bitstring</anno></c>. That is, if the number of bits
+ in <c><anno>Bitstring</anno></c> is not divisible by 8, the resulting
+ number of bytes is rounded <em>up</em>.</p>
+ <p>Examples:</p>
<pre>
> <input>byte_size(&lt;&lt;433:16,3:3&gt;&gt;).</input>
3
@@ -536,18 +565,19 @@
<p>Allowed in guard tests.</p>
</desc>
</func>
+
<func>
<name name="cancel_timer" arity="2"/>
- <fsummary>Cancel a timer</fsummary>
+ <fsummary>Cancels a timer.</fsummary>
<desc>
<p>
- Cancels a timer that has been created by either
+ Cancels a timer that has been created by
<seealso marker="#start_timer/4"><c>erlang:start_timer()</c></seealso>,
or <seealso marker="#send_after/4"><c>erlang:send_after()</c></seealso>.
<c><anno>TimerRef</anno></c> identifies the timer, and
was returned by the BIF that created the timer.
</p>
- <p>Currently available <c><anno>Option</anno></c>s:</p>
+ <p>Available <c><anno>Option</anno></c>s:</p>
<taglist>
<tag><c>{async, Async}</c></tag>
<item>
@@ -556,7 +586,7 @@
defaults to <c>false</c> which will cause the
cancellation to be performed synchronously. When
<c>Async</c> is set to <c>true</c>, the cancel
- operation will be performed asynchronously. That is,
+ operation is performed asynchronously. That is,
<c>erlang:cancel_timer()</c> will send an asynchronous
request for cancellation to the timer service that
manages the timer, and then return <c>ok</c>.
@@ -567,17 +597,17 @@
<p>
Request information about the <c><anno>Result</anno></c>
of the cancellation. <c>Info</c> defaults to <c>true</c>
- which means that the <c><anno>Result</anno></c> will
- be given. When <c>Info</c> is set to <c>false</c>, no
+ which means the <c><anno>Result</anno></c> is
+ given. When <c>Info</c> is set to <c>false</c>, no
information about the result of the cancellation
- will be given. When the operation is performed</p>
+ is given. When the operation is performed</p>
<taglist>
<tag>synchronously</tag>
<item>
<p>
- If <c>Info</c> is <c>true</c>, the <c>Result</c> will
+ If <c>Info</c> is <c>true</c>, the <c>Result</c> is
returned by <c>erlang:cancel_timer()</c>; otherwise,
- <c>ok</c> will be returned.
+ <c>ok</c> is returned.
</p>
</item>
<tag>asynchronously</tag>
@@ -585,10 +615,10 @@
<p>
If <c>Info</c> is <c>true</c>, a message on the form
<c>{cancel_timer, <anno>TimerRef</anno>,
- <anno>Result</anno>}</c> will be sent to the
+ <anno>Result</anno>}</c> is sent to the
caller of <c>erlang:cancel_timer()</c> when the
cancellation operation has been performed; otherwise,
- no message will be sent.
+ no message is sent.
</p>
</item>
</taglist>
@@ -597,30 +627,30 @@
<p>
More <c><anno>Option</anno></c>s may be added in the future.
</p>
+ <p>If <c><anno>Result</anno></c> is an integer, it represents
+ the time in milli-seconds left until the canceled timer would
+ have expired.</p>
<p>
- When the <c><anno>Result</anno></c> equals <c>false</c>, a
+ If <c><anno>Result</anno></c> is <c>false</c>, a
timer corresponding to <c><anno>TimerRef</anno></c> could not
be found. This can be either because the timer had expired,
already had been canceled, or because <c><anno>TimerRef</anno></c>
- never has corresponded to a timer. If the timer has expired,
- the timeout message has been sent, but it does not tell you
- whether or not it has arrived at its destination yet. When the
- <c><anno>Result</anno></c> is an integer, it represents the
- time in milli-seconds left until the timer will expire.
+ never corresponded to a timer. Even if the timer had expired,
+ it does not tell you whether or not the timeout message has
+ arrived at its destination yet.
</p>
<note>
<p>
The timer service that manages the timer may be co-located
with another scheduler than the scheduler that the calling
process is executing on. If this is the case, communication
- with the timer service will take much longer time than if it
+ with the timer service takes much longer time than if it
is located locally. If the calling process is in critical
path, and can do other things while waiting for the result
of this operation, or is not interested in the result of
- the operation, you want to use the <c>{async, true}</c>
- option. If using the <c>{async, false}</c> option, the calling
- process will be blocked until the operation has been
- performed.
+ the operation, you want to use option <c>{async, true}</c>.
+ If using option <c>{async, false}</c>, the calling
+ process blocks until the operation has been performed.
</p>
</note>
<p>See also
@@ -632,7 +662,7 @@
</func>
<func>
<name name="cancel_timer" arity="1"/>
- <fsummary>Cancel a timer</fsummary>
+ <fsummary>Cancels a timer.</fsummary>
<desc>
<p>Cancels a timer. The same as calling
<seealso marker="#cancel_timer/2"><c>erlang:cancel_timer(TimerRef,
@@ -641,103 +671,102 @@
</func>
<func>
<name name="check_old_code" arity="1"/>
- <fsummary>Check if a module has old code</fsummary>
+ <fsummary>Checks if a module has old code.</fsummary>
<desc>
- <p>Returns <c>true</c> if the <c><anno>Module</anno></c> has old code,
- and <c>false</c> otherwise.</p>
+ <p>Returns <c>true</c> if <c><anno>Module</anno></c> has old code,
+ otherwise <c>false</c>.</p>
<p>See also <seealso marker="kernel:code">code(3)</seealso>.</p>
</desc>
</func>
+
<func>
<name name="check_process_code" arity="2"/>
- <fsummary>Check if a process is executing old code for a module</fsummary>
+ <fsummary>Checks if a process executes old code for a module.</fsummary>
<desc>
<p>The same as
- <seealso marker="#check_process_code/3"><c>erlang:check_process_code(<anno>Pid</anno>,
- <anno>Module</anno>, [])</c></seealso>.</p>
+ <seealso marker="#check_process_code/3"><c>erlang:check_process_code(<anno>Pid</anno>, <anno>Module</anno>, [])</c></seealso>.</p>
</desc>
</func>
+
<func>
<name name="check_process_code" arity="3"/>
- <fsummary>Check if a process is executing old code for a module</fsummary>
+ <fsummary>Checks if a process executes old code for a module.</fsummary>
<desc>
- <p>Check if the node local process identified by <c><anno>Pid</anno></c>
- is executing old code for <c><anno>Module</anno></c>.</p>
- <p>Currently available <c><anno>Option</anno>s</c>:</p>
+ <p>Checks if the node local process identified by <c><anno>Pid</anno></c>
+ executes old code for <c><anno>Module</anno></c>.</p>
+ <p>The available <c><anno>Option</anno></c>s are as follows:</p>
<taglist>
<tag><c>{allow_gc, boolean()}</c></tag>
<item>
- Determines if garbage collection is allowed when performing
- the operation. If <c>{allow_gc, false}</c> is passed, and
- a garbage collection is needed in order to determine the
- result of the operation, the operation will be aborted
- (see information on <c><anno>CheckResult</anno></c> below).
- The default is to allow garbage collection, i.e.,
- <c>{allow_gc, true}</c>.
+ <p>Determines if garbage collection is allowed when performing
+ the operation. If <c>{allow_gc, false}</c> is passed, and
+ a garbage collection is needed to determine the
+ result of the operation, the operation is aborted (see
+ information on <c><anno>CheckResult</anno></c> in the following).
+ The default is to allow garbage collection, that is,
+ <c>{allow_gc, true}</c>.</p>
</item>
<tag><c>{async, RequestId}</c></tag>
<item>
- The <c>check_process_code/3</c> function will return
- the value <c>async</c> immediately after the request
- has been sent. When the request has been processed, the
- process that called this function will be passed a
- message on the form:<br/>
- <c>{check_process_code, <anno>RequestId</anno>, <anno>CheckResult</anno>}</c>.
+ <p>The function <c>check_process_code/3</c> returns
+ the value <c>async</c> immediately after the request
+ has been sent. When the request has been processed, the
+ process that called this function is passed a
+ message on the form
+ <c>{check_process_code, <anno>RequestId</anno>, <anno>CheckResult</anno>}</c>.</p>
</item>
</taglist>
- <p>If <c><anno>Pid</anno></c> equals <c>self()</c>, and
- no <c>async</c> option has been passed, the operation will
- be performed at once. In all other cases a request for
- the operation will be sent to the process identified by
- <c><anno>Pid</anno></c>, and will be handled when
- appropriate. If no <c>async</c> option has been passed,
- the caller will block until <c><anno>CheckResult</anno></c>
- is available and can be returned.</p>
- <p><c><anno>CheckResult</anno></c> informs about the result of
- the request:</p>
+ <p>If <c><anno>Pid</anno></c> equals <c>self()</c>, and
+ no <c>async</c> option has been passed, the operation
+ is performed at once. Otherwise a request for
+ the operation is sent to the process identified by
+ <c><anno>Pid</anno></c>, and is handled when
+ appropriate. If no <c>async</c> option has been passed,
+ the caller blocks until <c><anno>CheckResult</anno></c>
+ is available and can be returned.</p>
+ <p><c><anno>CheckResult</anno></c> informs about the result of
+ the request as follows:</p>
<taglist>
<tag><c>true</c></tag>
<item>
- The process identified by <c><anno>Pid</anno></c> is
- executing old code for <c><anno>Module</anno></c>.
- That is, the current call of the process executes old
- code for this module, or the process has references
- to old code for this module, or the process contains
- funs that references old code for this module.
+ <p>The process identified by <c><anno>Pid</anno></c>
+ executes old code for <c><anno>Module</anno></c>.
+ That is, the current call of the process executes old
+ code for this module, or the process has references
+ to old code for this module, or the process contains
+ funs that references old code for this module.</p>
</item>
<tag><c>false</c></tag>
<item>
- The process identified by <c><anno>Pid</anno></c> is
- not executing old code for <c><anno>Module</anno></c>.
+ <p>The process identified by <c><anno>Pid</anno></c> does
+ not execute old code for <c><anno>Module</anno></c>.</p>
</item>
<tag><c>aborted</c></tag>
<item>
- The operation was aborted since the process needed to
- be garbage collected in order to determine the result
- of the operation, and the operation was requested
- by passing the <c>{allow_gc, false}</c> option.</item>
+ <p>The operation was aborted, as the process needed to
+ be garbage collected to determine the operation result,
+ and the operation was requested
+ by passing option <c>{allow_gc, false}</c>.</p></item>
</taglist>
<p>See also <seealso marker="kernel:code">code(3)</seealso>.</p>
<p>Failures:</p>
<taglist>
<tag><c>badarg</c></tag>
- <item>
- If <c><anno>Pid</anno></c> is not a node local process identifier.
+ <item>If <c><anno>Pid</anno></c> is not a node local process identifier.
</item>
<tag><c>badarg</c></tag>
- <item>
- If <c><anno>Module</anno></c> is not an atom.
+ <item>If <c><anno>Module</anno></c> is not an atom.
</item>
<tag><c>badarg</c></tag>
- <item>
- If <c><anno>OptionList</anno></c> is not a valid list of options.
+ <item>If <c><anno>OptionList</anno></c> is an invalid list of options.
</item>
</taglist>
</desc>
</func>
+
<func>
<name name="convert_time_unit" arity="3"/>
- <fsummary>Convert time unit of a time value</fsummary>
+ <fsummary>Converts time unit of a time value.</fsummary>
<desc>
<p>Converts the <c><anno>Time</anno></c> value of time unit
<c><anno>FromUnit</anno></c> to the corresponding
@@ -753,100 +782,102 @@
</func>
<func>
<name name="crc32" arity="1"/>
- <fsummary>Compute crc32 (IEEE 802.3) checksum</fsummary>
+ <fsummary>Computes crc32 (IEEE 802.3) checksum.</fsummary>
<desc>
- <p>Computes and returns the crc32 (IEEE 802.3 style) checksum for <c><anno>Data</anno></c>.</p>
+ <p>Computes and returns the crc32 (IEEE 802.3 style) checksum
+ for <c><anno>Data</anno></c>.</p>
</desc>
</func>
+
<func>
<name name="crc32" arity="2"/>
- <fsummary>Compute crc32 (IEEE 802.3) checksum</fsummary>
+ <fsummary>Computes crc32 (IEEE 802.3) checksum.</fsummary>
<desc>
- <p>Continue computing the crc32 checksum by combining
- the previous checksum, <c><anno>OldCrc</anno></c>, with the checksum of
- <c><anno>Data</anno></c>.</p>
- <p>The following code:</p>
- <code>
- X = erlang:crc32(Data1),
- Y = erlang:crc32(X,Data2).
- </code>
- <p>- would assign the same value to <c>Y</c> as this would:</p>
- <code>
- Y = erlang:crc32([Data1,Data2]).
- </code>
+ <p>Continues computing the crc32 checksum by combining
+ the previous checksum, <c><anno>OldCrc</anno></c>, with the checksum of
+ <c><anno>Data</anno></c>.</p>
+ <p>The following code:</p>
+ <code>
+ X = erlang:crc32(Data1),
+ Y = erlang:crc32(X,Data2).</code>
+ <p>assigns the same value to <c>Y</c> as this:</p>
+ <code>
+ Y = erlang:crc32([Data1,Data2]).</code>
</desc>
</func>
+
<func>
<name name="crc32_combine" arity="3"/>
- <fsummary>Combine two crc32 (IEEE 802.3) checksums</fsummary>
- <desc>
- <p>Combines two previously computed crc32 checksums.
- This computation requires the size of the data object for
- the second checksum to be known.</p>
- <p>The following code:</p>
+ <fsummary>Combines two crc32 (IEEE 802.3) checksums.</fsummary>
+ <desc>
+ <p>Combines two previously computed crc32 checksums.
+ This computation requires the size of the data object for
+ the second checksum to be known.</p>
+ <p>The following code:</p>
+ <code>
+ Y = erlang:crc32(Data1),
+ Z = erlang:crc32(Y,Data2).</code>
+ <p>assigns the same value to <c>Z</c> as this:</p>
<code>
- Y = erlang:crc32(Data1),
- Z = erlang:crc32(Y,Data2).
- </code>
- <p>- would assign the same value to <c>Z</c> as this would:</p>
- <code>
- X = erlang:crc32(Data1),
- Y = erlang:crc32(Data2),
- Z = erlang:crc32_combine(X,Y,iolist_size(Data2)).
- </code>
+ X = erlang:crc32(Data1),
+ Y = erlang:crc32(Data2),
+ Z = erlang:crc32_combine(X,Y,iolist_size(Data2)).</code>
</desc>
</func>
+
<func>
<name name="date" arity="0"/>
- <fsummary>Current date</fsummary>
+ <fsummary>Current date.</fsummary>
<desc>
<p>Returns the current date as <c>{Year, Month, Day}</c>.</p>
- <p>The time zone and daylight saving time correction depend on
+ <p>The time zone and Daylight Saving Time correction depend on
the underlying OS.</p>
+ <p>Example:</p>
<pre>
> <input>date().</input>
{1995,2,19}</pre>
</desc>
</func>
+
<func>
<name name="decode_packet" arity="3"/>
- <fsummary>Extracts a protocol packet from a binary</fsummary>
+ <fsummary>Extracts a protocol packet from a binary.</fsummary>
<desc>
-
<p>Decodes the binary <c><anno>Bin</anno></c> according to the packet
- protocol specified by <c><anno>Type</anno></c>. Very similar to the packet
- handling done by sockets with the option {packet,<anno>Type</anno>}.</p>
- <p>If an entire packet is contained in <c><anno>Bin</anno></c> it is
+ protocol specified by <c><anno>Type</anno></c>. Similar to the packet
+ handling done by sockets with option {packet,<anno>Type</anno>}.</p>
+ <p>If an entire packet is contained in <c><anno>Bin</anno></c>, it is
returned together with the remainder of the binary as
<c>{ok,<anno>Packet</anno>,<anno>Rest</anno>}</c>.</p>
<p>If <c><anno>Bin</anno></c> does not contain the entire packet,
- <c>{more,<anno>Length</anno>}</c> is returned. <c><anno>Length</anno></c> is either the
- expected <em>total size</em> of the packet or <c>undefined</c>
- if the expected packet size is not known. <c>decode_packet</c>
+ <c>{more,<anno>Length</anno>}</c> is returned.
+ <c><anno>Length</anno></c> is either the
+ expected <em>total size</em> of the packet, or <c>undefined</c>
+ if the expected packet size is unknown. <c>decode_packet</c>
can then be called again with more data added.</p>
- <p>If the packet does not conform to the protocol format
+ <p>If the packet does not conform to the protocol format,
<c>{error,<anno>Reason</anno>}</c> is returned.</p>
- <p>The following values of <c><anno>Type</anno></c> are valid:</p>
+ <p>The following <c>Type</c>s are valid:</p>
<taglist>
<tag><c>raw | 0</c></tag>
<item>
- <p>No packet handling is done. Entire binary is
+ <p>No packet handling is done. The entire binary is
returned unless it is empty.</p>
</item>
<tag><c>1 | 2 | 4</c></tag>
<item>
<p>Packets consist of a header specifying the number of
bytes in the packet, followed by that number of bytes.
- The length of header can be one, two, or four bytes;
+ The length of the header can be one, two, or four bytes;
the order of the bytes is big-endian. The header
- will be stripped off when the packet is returned.</p>
+ is stripped off when the packet is returned.</p>
</item>
<tag><c>line</c></tag>
<item>
- <p>A packet is a line terminated with newline. The
- newline character is included in the returned packet
- unless the line was truncated according to the option
- <c>line_length</c>.</p>
+ <p>A packet is a line terminated by a delimiter byte,
+ default is the latin1 newline character. The delimiter
+ byte is included in the returned packet unless the line
+ was truncated according to option <c>line_length</c>.</p>
</item>
<tag><c>asn1 | cdr | sunrm | fcgi | tpkt</c></tag>
<item>
@@ -864,41 +895,50 @@
<item>
<p>The Hypertext Transfer Protocol. The packets
are returned with the format according to
- <c><anno>HttpPacket</anno></c> described above. A packet is either a
- request, a response, a header or an end of header
- mark. Invalid lines are returned as <c><anno>HttpError</anno></c>.</p>
- <p>Recognized request methods and header fields are returned as atoms.
- Others are returned as strings. Strings of unrecognized header fields
- are formatted with only capital letters first and after hyphen characters
- (like <c>"Sec-Websocket-Key"</c>).</p>
- <p>The protocol type <c>http</c> should only be used for
- the first line when a <c><anno>HttpRequest</anno></c> or a
- <c><anno>HttpResponse</anno></c> is expected. The following calls
- should use <c>httph</c> to get <c><anno>HttpHeader</anno></c>'s until
- <c>http_eoh</c> is returned that marks the end of the
+ <c><anno>HttpPacket</anno></c> described earlier.
+ A packet is either a
+ request, a response, a header, or an end of header
+ mark. Invalid lines are returned as
+ <c><anno>HttpError</anno></c>.</p>
+ <p>Recognized request methods and header fields are returned
+ as atoms. Others are returned as strings. Strings of
+ unrecognized header fields are formatted with only
+ capital letters first and after hyphen characters, for
+ example, <c>"Sec-Websocket-Key"</c>.</p>
+ <p>The protocol type <c>http</c> is only to be used for
+ the first line when an <c><anno>HttpRequest</anno></c> or an
+ <c><anno>HttpResponse</anno></c> is expected.
+ The following calls are to use <c>httph</c> to get
+ <c><anno>HttpHeader</anno></c>s until
+ <c>http_eoh</c> is returned, which marks the end of the
headers and the beginning of any following message body.</p>
- <p>The variants <c>http_bin</c> and <c>httph_bin</c> will return
+ <p>The variants <c>http_bin</c> and <c>httph_bin</c> return
strings (<c>HttpString</c>) as binaries instead of lists.</p>
</item>
</taglist>
<p>The following options are available:</p>
<taglist>
<tag><c>{packet_size, integer() >= 0}</c></tag>
- <item><p>Sets the max allowed size of the packet body. If
- the packet header indicates that the length of the
- packet is longer than the max allowed length, the packet
- is considered invalid. Default is 0 which means no
- size limit.</p>
+ <item><p>Sets the maximum allowed size of the packet body.
+ If the packet header indicates that the length of the
+ packet is longer than the maximum allowed length, the
+ packet is considered invalid. Default is 0, which means
+ no size limit.</p>
</item>
<tag><c>{line_length, integer() >= 0}</c></tag>
- <item><p>For packet type <c>line</c>, truncate lines longer
- than the indicated length.</p>
- <p>Option <c>line_length</c> also applies to <c>http*</c>
- packet types as an alias for option <c>packet_size</c> in the
- case when <c>packet_size</c> itself is not set. This usage is
- only intended for backward compatibility.</p>
+ <item><p>For packet type <c>line</c>, lines longer than
+ the indicated length are truncated.</p>
+ <p>Option <c>line_length</c> also applies to <c>http*</c>
+ packet types as an alias for option <c>packet_size</c>
+ if <c>packet_size</c> itself is not set. This use is
+ only intended for backward compatibility.</p>
+ </item>
+ <tag><c>{line_delimiter, 0 =&lt; byte() =&lt; 255}</c></tag>
+ <item><p>For packet type <c>line</c>, sets the delimiting byte.
+ Default is the latin1 character <c>$\n</c>.</p>
</item>
</taglist>
+ <p>Examples:</p>
<pre>
> <input>erlang:decode_packet(1,&lt;&lt;3,"abcd"&gt;&gt;,[]).</input>
{ok,&lt;&lt;"abc"&gt;&gt;,&lt;&lt;"d"&gt;&gt;}
@@ -909,13 +949,11 @@
<func>
<name name="delete_element" arity="2"/>
- <fsummary>Delete element at index in a tuple</fsummary>
+ <fsummary>Deletes element at index in a tuple.</fsummary>
<type_desc variable="Index">1..tuple_size(<anno>Tuple1</anno>)</type_desc>
<desc>
- <p>
- Returns a new tuple with element at <c><anno>Index</anno></c> removed from
- tuple <c><anno>Tuple1</anno></c>.
- </p>
+ <p>Returns a new tuple with element at <c><anno>Index</anno></c>
+ removed from tuple <c><anno>Tuple1</anno></c>, for example:</p>
<pre>
> <input>erlang:delete_element(2, {one, two, three}).</input>
{one,three}</pre>
@@ -924,78 +962,82 @@
<func>
<name name="delete_module" arity="1"/>
- <fsummary>Make the current code for a module old</fsummary>
+ <fsummary>Makes the current code for a module old.</fsummary>
<desc>
- <p>Makes the current code for <c><anno>Module</anno></c> become old code, and
- deletes all references for this module from the export table.
+ <p>Makes the current code for <c><anno>Module</anno></c> become old code,
+ and deletes all references for this module from the export table.
Returns <c>undefined</c> if the module does not exist,
otherwise <c>true</c>.</p>
<warning>
<p>This BIF is intended for the code server (see
- <seealso marker="kernel:code">code(3)</seealso>) and should not be
- used elsewhere.</p>
+ <seealso marker="kernel:code">code(3)</seealso>) and is not
+ to be used elsewhere.</p>
</warning>
- <p>Failure: <c>badarg</c> if there is already an old version of
+ <p>Failure: <c>badarg</c> if there already is an old version of
<c>Module</c>.</p>
</desc>
</func>
+
<func>
<name name="demonitor" arity="1"/>
- <fsummary>Stop monitoring</fsummary>
+ <fsummary>Stops monitoring.</fsummary>
<desc>
- <p>If <c><anno>MonitorRef</anno></c> is a reference which the calling process
- obtained by calling
+ <p>If <c><anno>MonitorRef</anno></c> is a reference that the
+ calling process obtained by calling
<seealso marker="#monitor/2">monitor/2</seealso>,
this monitoring is turned off. If the monitoring is already
turned off, nothing happens.</p>
- <p>Once <c>demonitor(<anno>MonitorRef</anno>)</c> has returned it is
- guaranteed that no <c>{'DOWN', <anno>MonitorRef</anno>, _, _, _}</c> message
- due to the monitor will be placed in the caller's message queue
- in the future. A <c>{'DOWN', <anno>MonitorRef</anno>, _, _, _}</c> message
- might have been placed in the caller's message queue prior to
- the call, though. Therefore, in most cases, it is advisable
+ <p>Once <c>demonitor(<anno>MonitorRef</anno>)</c> has returned, it is
+ guaranteed that no <c>{'DOWN',
+ <anno>MonitorRef</anno>, _, _, _}</c> message,
+ because of the monitor, will be placed in the caller message queue
+ in the future. A <c>{'DOWN',
+ <anno>MonitorRef</anno>, _, _, _}</c> message
+ can have been placed in the caller message queue before
+ the call, though. It is therefore usually advisable
to remove such a <c>'DOWN'</c> message from the message queue
- after monitoring has been stopped.
- <seealso marker="#demonitor/2">demonitor(<anno>MonitorRef</anno>, [flush])</seealso> can be used instead of
+ after monitoring has been stopped.
+ <seealso marker="#demonitor/2"><c>demonitor(<anno>MonitorRef</anno>, [flush])</c></seealso>
+ can be used instead of
<c>demonitor(<anno>MonitorRef</anno>)</c> if this cleanup is wanted.</p>
<note>
- <p>Prior to OTP release R11B (erts version 5.5) <c>demonitor/1</c>
- behaved completely asynchronous, i.e., the monitor was active
- until the "demonitor signal" reached the monitored entity. This
- had one undesirable effect, though. You could never know when
- you were guaranteed <em>not</em> to receive a <c>DOWN</c> message
- due to the monitor.</p>
- <p>Current behavior can be viewed as two combined operations:
- asynchronously send a "demonitor signal" to the monitored entity
- and ignore any future results of the monitor. </p>
+ <p>Before OTP R11B (<c>ERTS</c> 5.5), <c>demonitor/1</c>
+ behaved asynchronous, that is, the monitor was active
+ until the "demonitor signal" reached the monitored entity.
+ This had an undesirable effect, as you could never know when
+ you were guaranteed <em>not</em> to receive a <c>DOWN</c>
+ message because of the monitor.</p>
+ <p>The current behavior can be viewed as two combined operations:
+ asynchronously send a "demonitor signal" to the monitored
+ entity and ignore any future results of the monitor.</p>
</note>
<p>Failure: It is an error if <c><anno>MonitorRef</anno></c> refers to a
monitoring started by another process. Not all such cases are
- cheap to check; if checking is cheap, the call fails with
- <c>badarg</c> (for example if <c><anno>MonitorRef</anno></c> is a remote
- reference).</p>
+ cheap to check. If checking is cheap, the call fails with
+ <c>badarg</c> for example, if <c><anno>MonitorRef</anno></c> is a
+ remote reference.</p>
</desc>
</func>
+
<func>
<name name="demonitor" arity="2"/>
- <fsummary>Stop monitoring</fsummary>
+ <fsummary>Stops monitoring.</fsummary>
<desc>
<p>The returned value is <c>true</c> unless <c>info</c> is part
- of <c><anno>OptionList</anno></c>.
- </p>
+ of <c><anno>OptionList</anno></c>.</p>
<p><c>demonitor(<anno>MonitorRef</anno>, [])</c> is equivalent to
- <seealso marker="#demonitor/1">demonitor(<anno>MonitorRef</anno>)</seealso>.</p>
- <p>Currently the following <c><anno>Option</anno></c>s are valid:</p>
+ <seealso marker="#demonitor/1"><c>demonitor(<anno>MonitorRef</anno>)</c></seealso>.</p>
+ <p>The available <c><anno>Option</anno></c>s are as follows:</p>
<taglist>
<tag><c>flush</c></tag>
<item>
- <p>Remove (one) <c>{_, <anno>MonitorRef</anno>, _, _, _}</c> message,
- if there is one, from the caller's message queue after
+ <p>Removes (one) <c>{_,
+ <anno>MonitorRef</anno>, _, _, _}</c> message,
+ if there is one, from the caller message queue after
monitoring has been stopped.</p>
<p>Calling <c>demonitor(<anno>MonitorRef</anno>, [flush])</c>
is equivalent to the following, but more efficient:</p>
<code type="none">
-
demonitor(MonitorRef),
receive
{_, MonitorRef, _, _, _} ->
@@ -1006,78 +1048,90 @@
</item>
<tag><c>info</c></tag>
<item>
- <p>The returned value is one of the following:</p>
- <taglist>
- <tag><c>true</c></tag>
- <item><p>The monitor was found and removed. In this case
- no <c>'DOWN'</c> message due to this monitor have
- been nor will be placed in the message queue
- of the caller.
- </p>
- </item>
- <tag><c>false</c></tag>
- <item><p>The monitor was not found and could not be removed.
- This probably because someone already has placed a
- <c>'DOWN'</c> message corresponding to this monitor
- in the caller's message queue.
- </p>
- </item>
- </taglist>
- <p>If the <c>info</c> option is combined with the <c>flush</c>
- option, <c>false</c> will be returned if a flush was needed;
- otherwise, <c>true</c>.
- </p>
+ <p>The returned value is one of the following:</p>
+ <taglist>
+ <tag><c>true</c></tag>
+ <item>The monitor was found and removed. In this case,
+ no <c>'DOWN'</c> message corresponding to this
+ monitor has been delivered and will not be delivered.
+ </item>
+ <tag><c>false</c></tag>
+ <item>The monitor was not found and could not be removed.
+ This probably because someone already has placed a
+ <c>'DOWN'</c> message corresponding to this monitor
+ in the caller message queue.
+ </item>
+ </taglist>
+ <p>If option <c>info</c> is combined with option <c>flush</c>,
+ <c>false</c> is returned if a flush was needed,
+ otherwise <c>true</c>.</p>
</item>
</taglist>
<note>
- <p>More options may be added in the future.</p>
+ <p>More options can be added in a future release.</p>
</note>
- <p>Failure: <c>badarg</c> if <c><anno>OptionList</anno></c> is not a list, or
- if <c><anno>Option</anno></c> is not a valid option, or the same failure as for
- <seealso marker="#demonitor/1">demonitor/1</seealso></p>
+ <p>Failures:</p>
+ <taglist>
+ <tag><c>badarg</c></tag>
+ <item>If <c><anno>OptionList</anno></c> is not a list.
+ </item>
+ <tag><c>badarg</c></tag>
+ <item>If <c><anno>Option</anno></c> is an invalid option.
+ </item>
+ <tag><c>badarg</c></tag>
+ <item>The same failure as for
+ <seealso marker="#demonitor/1">demonitor/1</seealso>.
+ </item>
+ </taglist>
</desc>
</func>
+
<func>
<name name="disconnect_node" arity="1"/>
- <fsummary>Force the disconnection of a node</fsummary>
+ <fsummary>Forces the disconnection of a node.</fsummary>
<desc>
- <p>Forces the disconnection of a node. This will appear to
- the node <c><anno>Node</anno></c> as if the local node has crashed. This
- BIF is mainly used in the Erlang network authentication
- protocols. Returns <c>true</c> if disconnection succeeds,
+ <p>Forces the disconnection of a node. This appears to
+ the node <c><anno>Node</anno></c> as if the local node has crashed.
+ This BIF is mainly used in the Erlang network authentication
+ protocols.</p>
+ <p>Returns <c>true</c> if disconnection succeeds,
otherwise <c>false</c>. If the local node is not alive,
- the function returns <c>ignored</c>.</p>
+ <c>ignored</c> is returned.</p>
</desc>
</func>
+
<func>
<name name="display" arity="1"/>
- <fsummary>Print a term on standard output</fsummary>
+ <fsummary>Prints a term on standard output.</fsummary>
<desc>
- <p>Prints a text representation of <c><anno>Term</anno></c> on the standard
- output. On OSE the term is printed to the ramlog.</p>
+ <p>Prints a text representation of <c><anno>Term</anno></c> on the
+ standard output.</p>
<warning>
<p>This BIF is intended for debugging only.</p>
</warning>
</desc>
</func>
+
<func>
<name name="element" arity="2"/>
+ <fsummary>Returns the Nth element of a tuple.</fsummary>
<type_desc variable="N">1..tuple_size(<anno>Tuple</anno>)</type_desc>
- <fsummary>Get Nth element of a tuple</fsummary>
<desc>
<p>Returns the <c><anno>N</anno></c>th element (numbering from 1) of
- <c><anno>Tuple</anno></c>.</p>
+ <c><anno>Tuple</anno></c>, for example:</p>
<pre>
> <input>element(2, {a, b, c}).</input>
b</pre>
<p>Allowed in guard tests.</p>
</desc>
</func>
+
<func>
<name name="erase" arity="0"/>
- <fsummary>Return and delete the process dictionary</fsummary>
+ <fsummary>Returns and deletes the process dictionary.</fsummary>
<desc>
- <p>Returns the process dictionary and deletes it.</p>
+ <p>Returns the process dictionary and deletes it, for
+ example:</p>
<pre>
> <input>put(key1, {1, 2, 3}),</input>
<input>put(key2, [a, b, c]),</input>
@@ -1085,13 +1139,16 @@ b</pre>
[{key1,{1,2,3}},{key2,[a,b,c]}]</pre>
</desc>
</func>
+
<func>
<name name="erase" arity="1"/>
- <fsummary>Return and delete a value from the process dictionary</fsummary>
+ <fsummary>Returns and deletes a value from the process dictionary.</fsummary>
<desc>
- <p>Returns the value <c><anno>Val</anno></c> associated with <c><anno>Key</anno></c> and
- deletes it from the process dictionary. Returns
- <c>undefined</c> if no value is associated with <c><anno>Key</anno></c>.</p>
+ <p>Returns the value <c><anno>Val</anno></c> associated with
+ <c><anno>Key</anno></c> and deletes it from the process dictionary.
+ Returns <c>undefined</c> if no value is associated with
+ <c><anno>Key</anno></c>.</p>
+ <p>Example:</p>
<pre>
> <input>put(key1, {merry, lambs, are, playing}),</input>
<input>X = erase(key1),</input>
@@ -1099,16 +1156,19 @@ b</pre>
{{merry,lambs,are,playing},undefined}</pre>
</desc>
</func>
+
<func>
<name name="error" arity="1"/>
- <fsummary>Stop execution with a given reason</fsummary>
+ <fsummary>Stops execution with a given reason.</fsummary>
<desc>
<p>Stops the execution of the calling process with the reason
- <c><anno>Reason</anno></c>, where <c><anno>Reason</anno></c> is any term. The actual
- exit reason will be <c>{<anno>Reason</anno>, Where}</c>, where <c>Where</c>
+ <c><anno>Reason</anno></c>, where <c><anno>Reason</anno></c>
+ is any term. The exit reason is
+ <c>{<anno>Reason</anno>, Where}</c>, where <c>Where</c>
is a list of the functions most recently called (the current
function first). Since evaluating this function causes
the process to terminate, it has no return value.</p>
+ <p>Example:</p>
<pre>
> <input>catch error(foobar).</input>
{'EXIT',{foobar,[{erl_eval,do_apply,5},
@@ -1118,29 +1178,34 @@ b</pre>
{shell,eval_loop,3}]}}</pre>
</desc>
</func>
+
<func>
<name name="error" arity="2"/>
- <fsummary>Stop execution with a given reason</fsummary>
+ <fsummary>Stops execution with a given reason.</fsummary>
<desc>
<p>Stops the execution of the calling process with the reason
- <c><anno>Reason</anno></c>, where <c><anno>Reason</anno></c> is any term. The actual
- exit reason will be <c>{<anno>Reason</anno>, Where}</c>, where <c>Where</c>
+ <c><anno>Reason</anno></c>, where <c><anno>Reason</anno></c>
+ is any term. The exit reason is
+ <c>{<anno>Reason</anno>, Where}</c>, where <c>Where</c>
is a list of the functions most recently called (the current
- function first). <c><anno>Args</anno></c> is expected to be the list of
- arguments for the current function; in Beam it will be used
- to provide the actual arguments for the current function in
- the <c>Where</c> term. Since evaluating this function causes
+ function first). <c><anno>Args</anno></c> is expected to be the
+ list of arguments for the current function; in Beam it is used
+ to provide the arguments for the current function in
+ the term <c>Where</c>. Since evaluating this function causes
the process to terminate, it has no return value.</p>
</desc>
</func>
+
<func>
<name name="exit" arity="1"/>
- <fsummary>Stop execution with a given reason</fsummary>
+ <fsummary>Stops execution with a given reason.</fsummary>
<desc>
- <p>Stops the execution of the calling process with the exit
- reason <c><anno>Reason</anno></c>, where <c><anno>Reason</anno></c> is any term. Since
+ <p>Stops the execution of the calling process with exit reason
+ <c><anno>Reason</anno></c>, where <c><anno>Reason</anno></c>
+ is any term. Since
evaluating this function causes the process to terminate, it
has no return value.</p>
+ <p>Example:</p>
<pre>
> <input>exit(foobar).</input>
** exception exit: foobar
@@ -1148,110 +1213,117 @@ b</pre>
{'EXIT',foobar}</pre>
</desc>
</func>
+
<func>
<name name="exit" arity="2"/>
- <fsummary>Send an exit signal to a process or a port</fsummary>
+ <fsummary>Sends an exit signal to a process or a port.</fsummary>
<desc>
<p>Sends an exit signal with exit reason <c><anno>Reason</anno></c> to
the process or port identified by <c><anno>Pid</anno></c>.</p>
- <p>The following behavior apply if <c><anno>Reason</anno></c> is any term
- except <c>normal</c> or <c>kill</c>:</p>
- <p>If <c><anno>Pid</anno></c> is not trapping exits, <c><anno>Pid</anno></c> itself will
- exit with exit reason <c><anno>Reason</anno></c>. If <c><anno>Pid</anno></c> is trapping
- exits, the exit signal is transformed into a message
- <c>{'EXIT', From, <anno>Reason</anno>}</c> and delivered to the message
- queue of <c><anno>Pid</anno></c>. <c>From</c> is the pid of the process
- which sent the exit signal. See also
- <seealso marker="#process_flag/2">process_flag/2</seealso>.</p>
- <p>If <c><anno>Reason</anno></c> is the atom <c>normal</c>, <c><anno>Pid</anno></c> will
- not exit. If it is trapping exits, the exit signal is
- transformed into a message <c>{'EXIT', From, normal}</c>
- and delivered to its message queue.</p>
- <p>If <c><anno>Reason</anno></c> is the atom <c>kill</c>, that is if
- <c>exit(<anno>Pid</anno>, kill)</c> is called, an untrappable exit signal
- is sent to <c><anno>Pid</anno></c> which will unconditionally exit with
- exit reason <c>killed</c>.</p>
+ <p>The following behavior applies if <c><anno>Reason</anno></c>
+ is any term, except <c>normal</c> or <c>kill</c>:</p>
+ <list type="bulleted">
+ <item>If <c><anno>Pid</anno></c> is not trapping exits,
+ <c><anno>Pid</anno></c>
+ itself exits with exit reason <c><anno>Reason</anno></c>.
+ </item>
+ <item>If <c><anno>Pid</anno></c> is trapping exits, the exit
+ signal is transformed into a message
+ <c>{'EXIT', From, <anno>Reason</anno>}</c>
+ and delivered to the message queue of <c><anno>Pid</anno></c>.
+ </item>
+ <item><c>From</c> is the process identifier of the process
+ that sent the exit signal. See also
+ <seealso marker="#process_flag/2">process_flag/2</seealso>.
+ </item>
+ </list>
+ <p>If <c><anno>Reason</anno></c> is the atom <c>normal</c>,
+ <c><anno>Pid</anno></c>
+ does not exit. If it is trapping exits, the exit signal is
+ transformed into a message <c>{'EXIT', From, normal}</c>
+ and delivered to its message queue.</p>
+ <p>If <c><anno>Reason</anno></c> is the atom <c>kill</c>,
+ that is, if <c>exit(<anno>Pid</anno>, kill)</c> is called,
+ an untrappable exit signal is sent to <c><anno>Pid</anno></c>,
+ which unconditionally exits with exit reason <c>killed</c>.
+ </p>
</desc>
</func>
+
<func>
<name name="external_size" arity="1"/>
- <fsummary>Calculate the maximum size for a term encoded in the Erlang
- external term format</fsummary>
+ <fsummary>Calculates the maximum size for a term encoded in the Erlang external term format.</fsummary>
<desc>
<p>Calculates, without doing the encoding, the maximum byte size for
a term encoded in the Erlang external term format. The following
condition applies always:</p>
- <p>
<pre>
> <input>Size1 = byte_size(term_to_binary(<anno>Term</anno>)),</input>
> <input>Size2 = erlang:external_size(<anno>Term</anno>),</input>
> <input>true = Size1 =&lt; Size2.</input>
-true
- </pre>
- </p>
- <p>This is equivalent to a call to: <code>erlang:external_size(<anno>Term</anno>, [])
- </code></p>
+true</pre>
+ <p>This is equivalent to a call to:</p>
+<code>erlang:external_size(<anno>Term</anno>, [])</code>
</desc>
</func>
+
<func>
<name name="external_size" arity="2"/>
- <fsummary>Calculate the maximum size for a term encoded in the Erlang
- external term format</fsummary>
+ <fsummary>Calculates the maximum size for a term encoded in the Erlang external term format.</fsummary>
<desc>
<p>Calculates, without doing the encoding, the maximum byte size for
a term encoded in the Erlang external term format. The following
condition applies always:</p>
- <p>
<pre>
> <input>Size1 = byte_size(term_to_binary(<anno>Term</anno>, <anno>Options</anno>)),</input>
> <input>Size2 = erlang:external_size(<anno>Term</anno>, <anno>Options</anno>),</input>
> <input>true = Size1 =&lt; Size2.</input>
-true
- </pre>
- </p>
- <p>The option <c>{minor_version, <anno>Version</anno>}</c> specifies how floats
- are encoded. See
- <seealso marker="#term_to_binary/2">term_to_binary/2</seealso> for
- a more detailed description.
- </p>
+true</pre>
+ <p>Option <c>{minor_version, <anno>Version</anno>}</c> specifies how
+ floats are encoded. For a detailed description, see
+ <seealso marker="#term_to_binary/2">term_to_binary/2</seealso>.</p>
</desc>
</func>
+
<func>
<name name="float" arity="1"/>
- <fsummary>Convert a number to a float</fsummary>
+ <fsummary>Converts a number to a float.</fsummary>
<desc>
- <p>Returns a float by converting <c><anno>Number</anno></c> to a float.</p>
+ <p>Returns a float by converting <c><anno>Number</anno></c> to a float,
+ for example:</p>
<pre>
> <input>float(55).</input>
55.0</pre>
<p>Allowed in guard tests.</p>
<note>
- <p>Note that if used on the top-level in a guard, it will
- test whether the argument is a floating point number; for
- clarity, use
+ <p>If used on the top level in a guard, it tests whether the
+ argument is a floating point number; for clarity, use
<seealso marker="#is_float/1">is_float/1</seealso> instead.</p>
<p>When <c>float/1</c> is used in an expression in a guard,
such as '<c>float(A) == 4.0</c>', it converts a number as
- described above.</p>
+ described earlier.</p>
</note>
</desc>
</func>
+
<func>
<name name="float_to_binary" arity="1"/>
- <fsummary>Text representation of a float</fsummary>
+ <fsummary>Text representation of a float.</fsummary>
<desc>
- <p>The same as <c>float_to_binary(<anno>Float</anno>,[{scientific,20}])</c>.</p>
+ <p>The same as
+ <c>float_to_binary(<anno>Float</anno>,[{scientific,20}])</c>.</p>
</desc>
</func>
+
<func>
<name name="float_to_binary" arity="2"/>
- <fsummary>Text representation of a float formatted using given options</fsummary>
+ <fsummary>Text representation of a float formatted using given options.</fsummary>
<desc>
- <p>Returns a binary which corresponds to the text
+ <p>Returns a binary corresponding to the text
representation of <c><anno>Float</anno></c> using fixed decimal
- point formatting. The <c><anno>Options</anno></c> behave in the same
- way as <seealso marker="#float_to_list/2">float_to_list/2</seealso>.
- </p>
+ point formatting. <c><anno>Options</anno></c> behaves in the same
+ way as <seealso marker="#float_to_list/2">float_to_list/2</seealso>.</p>
+ <p>Examples:</p>
<pre>
> <input>float_to_binary(7.12, [{decimals, 4}]).</input>
&lt;&lt;"7.1200">>
@@ -1259,31 +1331,42 @@ true
&lt;&lt;"7.12">></pre>
</desc>
</func>
+
<func>
<name name="float_to_list" arity="1"/>
- <fsummary>Text representation of a float</fsummary>
+ <fsummary>Text representation of a float.</fsummary>
<desc>
- <p>The same as <c>float_to_list(<anno>Float</anno>,[{scientific,20}])</c>.</p>
+ <p>The same as
+ <c>float_to_list(<anno>Float</anno>,[{scientific,20}])</c>.</p>
</desc>
</func>
+
<func>
<name name="float_to_list" arity="2"/>
- <fsummary>Text representation of a float formatted using given options</fsummary>
- <desc>
- <p>Returns a string which corresponds to the text
- representation of <c>Float</c> using fixed decimal point formatting.
- When <c>decimals</c> option is specified
- the returned value will contain at most <c>Decimals</c> number of
- digits past the decimal point. If the number doesn't fit in the
- internal static buffer of 256 bytes, the function throws <c>badarg</c>.
- When <c>compact</c> option is provided
- the trailing zeros at the end of the list are truncated (this option is
- only meaningful together with the <c>decimals</c> option). When
- <c>scientific</c> option is provided, the float will be formatted using
- scientific notation with <c>Decimals</c> digits of precision. If
- <c>Options</c> is <c>[]</c> the function behaves like
- <c><seealso marker="#float_to_list/1">float_to_list/1</seealso></c>.
- </p>
+ <fsummary>Text representation of a float formatted using given options.</fsummary>
+ <desc>
+ <p>Returns a string corresponding to the text representation
+ of <c>Float</c> using fixed decimal point formatting. The
+ options are as follows:</p>
+ <list type="bulleted">
+ <item>If option <c>decimals</c> is specified, the returned value
+ contains at most <c>Decimals</c> number of digits past the
+ decimal point. If the number does not fit in the internal
+ static buffer of 256 bytes, the function throws <c>badarg</c>.
+ </item>
+ <item>If option <c>compact</c> is provided, the trailing zeros
+ at the end of the list are truncated. This option is only
+ meaningful together with option <c>decimals</c>.
+ </item>
+ <item>If option <c>scientific</c> is provided, the float is
+ formatted using scientific notation with <c>Decimals</c>
+ digits of precision.
+ </item>
+ <item>If <c>Options</c> is <c>[]</c>, the function behaves as
+ <seealso marker="#float_to_list/1">float_to_list/1</seealso>.
+ </item>
+ </list>
+ <p>Examples:</p>
<pre>
> <input>float_to_list(7.12, [{decimals, 4}]).</input>
"7.1200"
@@ -1291,36 +1374,40 @@ true
"7.12"</pre>
</desc>
</func>
+
<func>
<name name="fun_info" arity="1"/>
- <fsummary>Information about a fun</fsummary>
+ <fsummary>Information about a fun.</fsummary>
<desc>
- <p>Returns a list containing information about the fun
- <c><anno>Fun</anno></c>. Each element of the list is a tuple. The order of
- the tuples is not defined, and more tuples may be added in a
+ <p>Returns a list with information about the fun
+ <c><anno>Fun</anno></c>. Each list element is a tuple. The order
+ of the tuples is undefined, and more tuples can be added in a
future release.</p>
<warning>
<p>This BIF is mainly intended for debugging, but it can
- occasionally be useful in library functions that might need
- to verify, for instance, the arity of a fun.</p>
+ sometimes be useful in library functions that need
+ to verify, for example, the arity of a fun.</p>
</warning>
- <p>There are two types of funs with slightly different
- semantics:</p>
- <p>A fun created by <c>fun M:F/A</c> is called an
- <em>external</em> fun. Calling it will always call the
- function <c>F</c> with arity <c>A</c> in the latest code for
- module <c>M</c>. Note that module <c>M</c> does not even need
- to be loaded when the fun <c>fun M:F/A</c> is created.</p>
- <p>All other funs are called <em>local</em>. When a local fun
- is called, the same version of the code that created the fun
- will be called (even if newer version of the module has been
- loaded).</p>
- <p>The following elements will always be present in the list
+ <p>Two types of funs have slightly different semantics:</p>
+ <list type="bulleted">
+ <item>A fun created by <c>fun M:F/A</c> is called an
+ <em>external</em> fun. Calling it will always call the
+ function <c>F</c> with arity <c>A</c> in the latest code for
+ module <c>M</c>. Notice that module <c>M</c> does not even
+ need to be loaded when the fun <c>fun M:F/A</c> is created.
+ </item>
+ <item>All other funs are called <em>local</em>. When a local fun
+ is called, the same version of the code that created the fun
+ is called (even if a newer version of the module has been
+ loaded).
+ </item>
+ </list>
+ <p>The following elements are always present in the list
for both local and external funs:</p>
<taglist>
<tag><c>{type, Type}</c></tag>
<item>
- <p><c>Type</c> is either <c>local</c> or <c>external</c>.</p>
+ <p><c>Type</c> is <c>local</c> or <c>external</c>.</p>
</item>
<tag><c>{module, Module}</c></tag>
<item>
@@ -1335,148 +1422,154 @@ true
<p><c>Name</c> (an atom) is a function name.</p>
<p>If <c>Fun</c> is a local fun, <c>Name</c> is the name
of the local function that implements the fun.
- (This name was generated by the compiler, and is generally
+ (This name was generated by the compiler, and is
only of informational use. As it is a local function, it
- is not possible to call it directly.)
+ cannot be called directly.)
If no code is currently loaded for the fun, <c>[]</c>
- will be returned instead of an atom.</p>
+ is returned instead of an atom.</p>
<p>If <c>Fun</c> is an external fun, <c>Name</c> is the name
of the exported function that the fun refers to.</p>
</item>
<tag><c>{arity, Arity}</c></tag>
<item>
<p><c>Arity</c> is the number of arguments that the fun
- should be called with.</p>
+ is to be called with.</p>
</item>
<tag><c>{env, Env}</c></tag>
<item>
<p><c>Env</c> (a list) is the environment or free variables
- for the fun. (For external funs, the returned list is
- always empty.)</p>
+ for the fun. For external funs, the returned list is
+ always empty.</p>
</item>
</taglist>
- <p>The following elements will only be present in the list if
+ <p>The following elements are only present in the list if
<c>Fun</c> is local:</p>
<taglist>
<tag><c>{pid, Pid}</c></tag>
<item>
- <p><c>Pid</c> is the pid of the process that originally
- created the fun.</p>
+ <p><c>Pid</c> is the process identifier of the process
+ that originally created the fun.</p>
</item>
<tag><c>{index, Index}</c></tag>
<item>
- <p><c>Index</c> (an integer) is an index into the module's
+ <p><c>Index</c> (an integer) is an index into the module
fun table.</p>
</item>
<tag><c>{new_index, Index}</c></tag>
<item>
- <p><c>Index</c> (an integer) is an index into the module's
+ <p><c>Index</c> (an integer) is an index into the module
fun table.</p>
</item>
<tag><c>{new_uniq, Uniq}</c></tag>
<item>
- <p><c>Uniq</c> (a binary) is a unique value for this fun.
- It is calculated from the compiled code for the entire module.</p>
+ <p><c>Uniq</c> (a binary) is a unique value for this fun. It
+ is calculated from the compiled code for the entire module.</p>
</item>
<tag><c>{uniq, Uniq}</c></tag>
<item>
<p><c>Uniq</c> (an integer) is a unique value for this fun.
- Starting in the R15 release, this integer is calculated from
- the compiled code for the entire module. Before R15, this
- integer was based on only the body of the fun.
- </p>
+ As from OTP R15, this integer is calculated from the
+ compiled code for the entire module. Before OTP R15, this
+ integer was based on only the body of the fun.</p>
</item>
</taglist>
</desc>
</func>
+
<func>
<name name="fun_info" arity="2"/>
+ <fsummary>Information about a fun.</fsummary>
<type name="fun_info_item"/>
- <fsummary>Information about a fun</fsummary>
<desc>
<p>Returns information about <c><anno>Fun</anno></c> as specified by
- <c><anno>Item</anno></c>, in the form <c>{<anno>Item</anno>,<anno>Info</anno>}</c>.</p>
+ <c><anno>Item</anno></c>, in the form
+ <c>{<anno>Item</anno>,<anno>Info</anno>}</c>.</p>
<p>For any fun, <c><anno>Item</anno></c> can be any of the atoms
- <c>module</c>, <c>name</c>, <c>arity</c>, <c>env</c>, or <c>type</c>.</p>
- <p>For a local fun, <c><anno>Item</anno></c> can also be any of the atoms
- <c>index</c>, <c>new_index</c>, <c>new_uniq</c>,
+ <c>module</c>, <c>name</c>, <c>arity</c>, <c>env</c>, or
+ <c>type</c>.</p>
+ <p>For a local fun, <c><anno>Item</anno></c> can also be any of the
+ atoms <c>index</c>, <c>new_index</c>, <c>new_uniq</c>,
<c>uniq</c>, and <c>pid</c>. For an external fun, the value
of any of these items is always the atom <c>undefined</c>.</p>
<p>See
<seealso marker="#fun_info/1">erlang:fun_info/1</seealso>.</p>
</desc>
</func>
+
<func>
<name name="fun_to_list" arity="1"/>
- <fsummary>Text representation of a fun</fsummary>
+ <fsummary>Text representation of a fun.</fsummary>
<desc>
- <p>Returns a string which corresponds to the text
+ <p>Returns a string corresponding to the text
representation of <c><anno>Fun</anno></c>.</p>
</desc>
</func>
+
<func>
<name name="function_exported" arity="3"/>
- <fsummary>Check if a function is exported and loaded</fsummary>
+ <fsummary>Checks if a function is exported and loaded.</fsummary>
<desc>
<p>Returns <c>true</c> if the module <c><anno>Module</anno></c> is loaded
and contains an exported function <c><anno>Function</anno>/<anno>Arity</anno></c>,
or if there is a BIF (a built-in function implemented in C)
- with the given name; otherwise returns <c>false</c>.</p>
+ with the given name, otherwise returns <c>false</c>.</p>
<note><p>This function used to return false for built-in
functions before the 18.0 release.</p></note>
</desc>
</func>
+
<func>
<name name="garbage_collect" arity="0"/>
- <fsummary>Force an immediate garbage collection of the calling process</fsummary>
+ <fsummary>Forces an immediate garbage collection of the calling process.</fsummary>
<desc>
- <p>Forces an immediate garbage collection of the currently
- executing process. The function should not be used, unless
- it has been noticed -- or there are good reasons to suspect --
+ <p>Forces an immediate garbage collection of the
+ executing process. The function is not to be used unless
+ it has been noticed (or there are good reasons to suspect)
that the spontaneous garbage collection will occur too late
- or not at all. Improper use may seriously degrade system
- performance.</p>
+ or not at all.</p>
+ <warning>
+ <p>Improper use can seriously degrade system performance.</p>
+ </warning>
</desc>
</func>
+
<func>
<name name="garbage_collect" arity="1"/>
- <fsummary>Garbage collect a process</fsummary>
+ <fsummary>Garbage collects a process.</fsummary>
<desc>
<p>The same as
<seealso marker="#garbage_collect/2"><c>garbage_collect(<anno>Pid</anno>, [])</c></seealso>.</p>
</desc>
</func>
+
<func>
<name name="garbage_collect" arity="2"/>
- <fsummary>Garbage collect a process</fsummary>
+ <fsummary>Garbage collects a process.</fsummary>
<desc>
- <p>Garbage collect the node local process identified by
- <c><anno>Pid</anno></c>.</p>
- <p>Currently available <c><anno>Option</anno></c>s:</p>
+ <p>Garbage collects the node local process identified by
+ <c><anno>Pid</anno></c>.</p>
+ <p>The available <c><anno>Option</anno></c>s are as follows:</p>
<taglist>
<tag><c>{async, RequestId}</c></tag>
- <item>
- The <c>garbage_collect/2</c> function will return
+ <item>The function <c>garbage_collect/2</c> returns
the value <c>async</c> immediately after the request
has been sent. When the request has been processed, the
- process that called this function will be passed a
- message on the form:<br/>
- <c>{garbage_collect, <anno>RequestId</anno>, <anno>GCResult</anno>}</c>.
- </item>
+ process that called this function is passed a message on
+ the form <c>{garbage_collect,
+ <anno>RequestId</anno>, <anno>GCResult</anno>}</c>.
+ </item>
</taglist>
<p>If <c><anno>Pid</anno></c> equals <c>self()</c>, and
no <c>async</c> option has been passed, the garbage
- collection will be performed at once, i.e. the same as
- calling
+ collection is performed at once, that is, the same as calling
<seealso marker="#garbage_collect/0">garbage_collect/0</seealso>.
- In all other cases a request for garbage collection will
- be sent to the process identified by <c><anno>Pid</anno></c>,
+ Otherwise a request for garbage collection
+ is sent to the process identified by <c><anno>Pid</anno></c>,
and will be handled when appropriate. If no <c>async</c>
- option has been passed, the caller will block until
- <c><anno>GCResult</anno></c> is available and can be
- returned.</p>
+ option has been passed, the caller blocks until
+ <c><anno>GCResult</anno></c> is available and can be returned.</p>
<p><c><anno>GCResult</anno></c> informs about the result of
- the garbage collection request:</p>
+ the garbage collection request as follows:</p>
<taglist>
<tag><c>true</c></tag>
<item>
@@ -1485,14 +1578,13 @@ true
</item>
<tag><c>false</c></tag>
<item>
- No garbage collection was performed. This since the
+ No garbage collection was performed, as
the process identified by <c><anno>Pid</anno></c>
terminated before the request could be satisfied.
</item>
</taglist>
- <p>Note that the same caveats as for
- <seealso marker="#garbage_collect/0">garbage_collect/0</seealso>
- apply.</p>
+ <p>Notice that the same caveats apply as for
+ <seealso marker="#garbage_collect/0">garbage_collect/0</seealso>.</p>
<p>Failures:</p>
<taglist>
<tag><c>badarg</c></tag>
@@ -1501,17 +1593,18 @@ true
</item>
<tag><c>badarg</c></tag>
<item>
- If <c><anno>OptionList</anno></c> is not a valid list of options.
+ If <c><anno>OptionList</anno></c> is an invalid list of options.
</item>
</taglist>
</desc>
</func>
+
<func>
<name name="get" arity="0"/>
- <fsummary>Return the process dictionary</fsummary>
+ <fsummary>Returns the process dictionary.</fsummary>
<desc>
<p>Returns the process dictionary as a list of
- <c>{<anno>Key</anno>, <anno>Val</anno>}</c> tuples.</p>
+ <c>{<anno>Key</anno>, <anno>Val</anno>}</c> tuples, for example:</p>
<pre>
> <input>put(key1, merry),</input>
<input>put(key2, lambs),</input>
@@ -1520,13 +1613,15 @@ true
[{key1,merry},{key2,lambs},{key3,{are,playing}}]</pre>
</desc>
</func>
+
<func>
<name name="get" arity="1"/>
- <fsummary>Return a value from the process dictionary</fsummary>
+ <fsummary>Returns a value from the process dictionary.</fsummary>
<desc>
<p>Returns the value <c><anno>Val</anno></c> associated with <c><anno>Key</anno></c> in
the process dictionary, or <c>undefined</c> if <c><anno>Key</anno></c>
does not exist.</p>
+ <p>Example:</p>
<pre>
> <input>put(key1, merry),</input>
<input>put(key2, lambs),</input>
@@ -1535,14 +1630,16 @@ true
{are,playing}</pre>
</desc>
</func>
+
<func>
<name name="get_cookie" arity="0"/>
- <fsummary>Get the magic cookie of the local node</fsummary>
+ <fsummary>Gets the magic cookie of the local node.</fsummary>
<desc>
- <p>Returns the magic cookie of the local node, if the node is
- alive; otherwise the atom <c>nocookie</c>.</p>
+ <p>Returns the magic cookie of the local node if the node is
+ alive, otherwise the atom <c>nocookie</c>.</p>
</desc>
</func>
+
<func>
<name name="get_keys" arity="0"/>
<fsummary>Return a list of all keys from the process dictionary</fsummary>
@@ -1558,10 +1655,10 @@ true
</func>
<func>
<name name="get_keys" arity="1"/>
- <fsummary>Return a list of keys from the process dictionary</fsummary>
+ <fsummary>Returns a list of keys from the process dictionary.</fsummary>
<desc>
- <p>Returns a list of keys which are associated with the value
- <c><anno>Val</anno></c> in the process dictionary.</p>
+ <p>Returns a list of keys that are associated with the value
+ <c><anno>Val</anno></c> in the process dictionary, for example:</p>
<pre>
> <input>put(mary, {1, 2}),</input>
<input>put(had, {1, 2}),</input>
@@ -1573,40 +1670,40 @@ true
[mary,had,a,little,lamb]</pre>
</desc>
</func>
+
<func>
<name name="get_stacktrace" arity="0"/>
- <fsummary>Get the call stack back-trace of the last exception</fsummary>
+ <fsummary>Gets the call stack back-trace of the last exception.</fsummary>
<type name="stack_item"/>
<desc>
- <p>Get the call stack back-trace (<em>stacktrace</em>) of the last
- exception in the calling process as a list of
+ <p>Gets the call stack back-trace (<em>stacktrace</em>) of the
+ last exception in the calling process as a list of
<c>{<anno>Module</anno>,<anno>Function</anno>,<anno>Arity</anno>,<anno>Location</anno>}</c> tuples.
- The <c><anno>Arity</anno></c> field in the first tuple may be the argument
- list of that function call instead of an arity integer,
+ Field <c><anno>Arity</anno></c> in the first tuple can be the
+ argument list of that function call instead of an arity integer,
depending on the exception.</p>
<p>If there has not been any exceptions in a process, the
stacktrace is <c>[]</c>. After a code change for the process,
- the stacktrace may also be reset to [].</p>
+ the stacktrace can also be reset to <c>[]</c>.</p>
<p>The stacktrace is the same data as the <c>catch</c> operator
returns, for example:</p>
<p><c>{'EXIT',{badarg,Stacktrace}} = catch abs(x)</c></p>
- <p><c><anno>Location</anno></c> is a (possibly empty) list of two-tuples that
- may indicate the location in the source code of the function.
- The first element is an atom that describes the type of
- information in the second element. Currently the following
- items may occur:</p>
+ <p><c><anno>Location</anno></c> is a (possibly empty) list
+ of two-tuples that
+ can indicate the location in the source code of the function.
+ The first element is an atom describing the type of
+ information in the second element. The following
+ items can occur:</p>
<taglist>
<tag><c>file</c></tag>
- <item>
- <p>The second element of the tuple is a string (list of
- characters) representing the filename of the source file
- of the function.</p>
+ <item>The second element of the tuple is a string (list of
+ characters) representing the file name of the source file
+ of the function.
</item>
<tag><c>line</c></tag>
- <item>
- <p>The second element of the tuple is the line number
+ <item>The second element of the tuple is the line number
(an integer greater than zero) in the source file
- where the exception occurred or the function was called.</p>
+ where the exception occurred or the function was called.
</item>
</taglist>
<p>See also
@@ -1614,49 +1711,56 @@ true
<seealso marker="#error/2">erlang:error/2</seealso>.</p>
</desc>
</func>
+
<func>
<name name="group_leader" arity="0"/>
- <fsummary>Get the group leader for the calling process</fsummary>
+ <fsummary>Gets the group leader for the calling process.</fsummary>
<desc>
- <p>Returns the pid of the group leader for the process which
- evaluates the function.</p>
+ <p>Returns the process identifier of the group leader for the
+ process evaluating the function.</p>
<p>Every process is a member of some process group and all
- groups have a <em>group leader</em>. All IO from the group
+ groups have a <em>group leader</em>. All I/O from the group
is channeled to the group leader. When a new process is
spawned, it gets the same group leader as the spawning
process. Initially, at system start-up, <c>init</c> is both
its own group leader and the group leader of all processes.</p>
</desc>
</func>
+
<func>
<name name="group_leader" arity="2"/>
- <fsummary>Set the group leader for a process</fsummary>
+ <fsummary>Sets the group leader for a process.</fsummary>
<desc>
- <p>Sets the group leader of <c><anno>Pid</anno></c> to <c><anno>GroupLeader</anno></c>.
- Typically, this is used when a processes started from a
- certain shell should have another group leader than
+ <p>Sets the group leader of <c><anno>Pid</anno></c>
+ to <c><anno>GroupLeader</anno></c>.
+ Typically, this is used when a process started from a
+ certain shell is to have another group leader than
<c>init</c>.</p>
<p>See also
<seealso marker="#group_leader/0">group_leader/0</seealso>.</p>
</desc>
</func>
+
<func>
<name name="halt" arity="0"/>
- <fsummary>Halt the Erlang runtime system and indicate normal exit to the calling environment</fsummary>
+ <fsummary>Halts the Erlang runtime system and indicates normal exit to the calling environment.</fsummary>
<desc>
<p>The same as
<seealso marker="#halt/2"><c>halt(0, [])</c></seealso>.</p>
+ <p>Example:</p>
<pre>
> <input>halt().</input>
os_prompt% </pre>
</desc>
</func>
+
<func>
<name name="halt" arity="1"/>
- <fsummary>Halt the Erlang runtime system</fsummary>
+ <fsummary>Halts the Erlang runtime system.</fsummary>
<desc>
<p>The same as
<seealso marker="#halt/2"><c>halt(<anno>Status</anno>, [])</c></seealso>.</p>
+ <p>Example:</p>
<pre>
> <input>halt(17).</input>
os_prompt% <input>echo $?</input>
@@ -1664,178 +1768,188 @@ os_prompt% <input>echo $?</input>
os_prompt% </pre>
</desc>
</func>
+
<func>
<name name="halt" arity="2"/>
- <fsummary>Halt the Erlang runtime system</fsummary>
+ <fsummary>Halts the Erlang runtime system.</fsummary>
<desc>
<p><c><anno>Status</anno></c> must be a non-negative integer, a string,
or the atom <c>abort</c>.
Halts the Erlang runtime system. Has no return value.
- Depending on <c><anno>Status</anno></c>:
- </p>
+ Depending on <c><anno>Status</anno></c>, the following occurs:</p>
<taglist>
<tag>integer()</tag>
- <item>The runtime system exits with the integer value <c><anno>Status</anno></c>
- as status code to the calling environment (operating system).
+ <item>The runtime system exits with integer value
+ <c><anno>Status</anno></c>
+ as status code to the calling environment (OS).
</item>
<tag>string()</tag>
- <item>An erlang crash dump is produced with <c><anno>Status</anno></c> as slogan,
- and then the runtime system exits with status code <c>1</c>.
+ <item>An Erlang crash dump is produced with <c><anno>Status</anno></c>
+ as slogan. Then the runtime system exits with status code <c>1</c>.
</item>
<tag><c>abort</c></tag>
<item>
The runtime system aborts producing a core dump, if that is
- enabled in the operating system.
+ enabled in the OS.
</item>
</taglist>
- <p>Note that on many platforms, only the status codes 0-255 are
- supported by the operating system.
- </p>
- <p>For integer <c><anno>Status</anno></c> the Erlang runtime system closes all ports
- and allows async threads to finish their operations before exiting.
- To exit without such flushing use
- <c><anno>Option</anno></c> as <c>{flush,false}</c>.
- </p>
- <p>For statuses <c>string()</c> and <c>abort</c> the <c>flush</c>
- option is ignored and flushing is <em>not</em> done.
- </p>
+ <note><p>On many platforms, the OS supports only status
+ codes 0-255.</p></note>
+ <p>For integer <c><anno>Status</anno></c>, the Erlang runtime system
+ closes all ports and allows async threads to finish their
+ operations before exiting. To exit without such flushing, use
+ <c><anno>Option</anno></c> as <c>{flush,false}</c>.</p>
+ <p>For statuses <c>string()</c> and <c>abort</c>, option
+ <c>flush</c> is ignored and flushing is <em>not</em> done.</p>
</desc>
</func>
+
<func>
<name name="hash" arity="2"/>
- <fsummary>Hash function (deprecated)</fsummary>
+ <fsummary>Hash function (deprecated).</fsummary>
<desc>
<p>Returns a hash value for <c><anno>Term</anno></c> within the range
- <c>1..<anno>Range</anno></c>. The allowed range is 1..2^27-1.</p>
+ <c>1..<anno>Range</anno></c>. The maximum range is 1..2^27-1.</p>
<warning>
- <p>This BIF is deprecated as the hash value may differ on
- different architectures. Also the hash values for integer
- terms larger than 2^27 as well as large binaries are very
+ <p>This BIF is deprecated, as the hash value can differ on
+ different architectures. The hash values for integer
+ terms higher than 2^27 and large binaries are
poor. The BIF is retained for backward compatibility
- reasons (it may have been used to hash records into a file),
- but all new code should use one of the BIFs
+ reasons (it can have been used to hash records into a file),
+ but all new code is to use one of the BIFs
<c>erlang:phash/2</c> or <c>erlang:phash2/1,2</c> instead.</p>
</warning>
</desc>
</func>
+
<func>
<name name="hd" arity="1"/>
- <fsummary>Head of a list</fsummary>
+ <fsummary>Head of a list.</fsummary>
<desc>
- <p>Returns the head of <c><anno>List</anno></c>, that is, the first element.</p>
+ <p>Returns the head of <c><anno>List</anno></c>, that is,
+ the first element, for example:</p>
<pre>
> <input>hd([1,2,3,4,5]).</input>
1</pre>
<p>Allowed in guard tests.</p>
- <p>Failure: <c>badarg</c> if <c><anno>List</anno></c> is the empty list [].</p>
+ <p>Failure: <c>badarg</c> if <c><anno>List</anno></c> is the empty
+ list <c>[]</c>.</p>
</desc>
</func>
+
<func>
<name name="hibernate" arity="3"/>
- <fsummary>Hibernate a process until a message is sent to it</fsummary>
+ <fsummary>Hibernates a process until a message is sent to it.</fsummary>
<desc>
<p>Puts the calling process into a wait state where its memory
- allocation has been reduced as much as possible, which is
+ allocation has been reduced as much as possible. This is
useful if the process does not expect to receive any messages
- in the near future.</p>
- <p>The process will be awaken when a message is sent to it, and
- control will resume in <c><anno>Module</anno>:<anno>Function</anno></c> with
- the arguments given by <c><anno>Args</anno></c> with the call stack
- emptied, meaning that the process will terminate when that
- function returns. Thus <c>erlang:hibernate/3</c> will never
- return to its caller.</p>
+ soon.</p>
+ <p>The process is awaken when a message is sent to it, and control
+ resumes in <c><anno>Module</anno>:<anno>Function</anno></c> with
+ the arguments given by <c><anno>Args</anno></c> with the call
+ stack emptied, meaning that the process terminates when that
+ function returns. Thus <c>erlang:hibernate/3</c> never
+ returns to its caller.</p>
<p>If the process has any message in its message queue,
- the process will be awaken immediately in the same way as
- described above.</p>
+ the process is awakened immediately in the same way as
+ described earlier.</p>
<p>In more technical terms, what <c>erlang:hibernate/3</c> does
- is the following. It discards the call stack for the process.
- Then it garbage collects the process. After the garbage
- collection, all live data is in one continuous heap. The heap
+ is the following. It discards the call stack for the process,
+ and then garbage collects the process. After this,
+ all live data is in one continuous heap. The heap
is then shrunken to the exact same size as the live data
- which it holds (even if that size is less than the minimum
+ that it holds (even if that size is less than the minimum
heap size for the process).</p>
<p>If the size of the live data in the process is less than
the minimum heap size, the first garbage collection occurring
- after the process has been awaken will ensure that the heap
+ after the process is awakened ensures that the heap
size is changed to a size not smaller than the minimum heap
size.</p>
- <p>Note that emptying the call stack means that any surrounding
- <c>catch</c> is removed and has to be re-inserted after
+ <p>Notice that emptying the call stack means that any surrounding
+ <c>catch</c> is removed and must be reinserted after
hibernation. One effect of this is that processes started
using <c>proc_lib</c> (also indirectly, such as
- <c>gen_server</c> processes), should use
+ <c>gen_server</c> processes), are to use
<seealso marker="stdlib:proc_lib#hibernate/3">proc_lib:hibernate/3</seealso>
- instead to ensure that the exception handler continues to work
+ instead, to ensure that the exception handler continues to work
when the process wakes up.</p>
</desc>
</func>
<func>
<name name="insert_element" arity="3"/>
- <fsummary>Insert an element at index in a tuple</fsummary>
+ <fsummary>Inserts an element at index in a tuple.</fsummary>
<type_desc variable="Index">1..tuple_size(<anno>Tuple1</anno>) + 1</type_desc>
<desc>
- <p>
- Returns a new tuple with element <c><anno>Term</anno></c> insert at position
- <c><anno>Index</anno></c> in tuple <c><anno>Tuple1</anno></c>.
- All elements from position <c><anno>Index</anno></c> and upwards are subsequently
- pushed one step higher in the new tuple <c><anno>Tuple2</anno></c>.
- </p>
+ <p>Returns a new tuple with element <c><anno>Term</anno></c>
+ inserted at position
+ <c><anno>Index</anno></c> in tuple <c><anno>Tuple1</anno></c>.
+ All elements from position <c><anno>Index</anno></c> and upwards are
+ pushed one step higher in the new tuple <c><anno>Tuple2</anno></c>.</p>
+ <p>Example:</p>
<pre>
> <input>erlang:insert_element(2, {one, two, three}, new).</input>
{one,new,two,three}</pre>
</desc>
</func>
+
<func>
<name name="integer_to_binary" arity="1"/>
- <fsummary>Text representation of an integer</fsummary>
+ <fsummary>Text representation of an integer.</fsummary>
<desc>
- <p>Returns a binary which corresponds to the text
- representation of <c><anno>Integer</anno></c>.</p>
+ <p>Returns a binary corresponding to the text
+ representation of <c><anno>Integer</anno></c>, for example:</p>
<pre>
> <input>integer_to_binary(77).</input>
&lt;&lt;"77">></pre>
</desc>
</func>
+
<func>
<name name="integer_to_binary" arity="2"/>
- <fsummary>Text representation of an integer</fsummary>
+ <fsummary>Text representation of an integer.</fsummary>
<desc>
- <p>Returns a binary which corresponds to the text
- representation of <c><anno>Integer</anno></c> in base <c><anno>Base</anno></c>.</p>
+ <p>Returns a binary corresponding to the text
+ representation of <c><anno>Integer</anno></c> in base
+ <c><anno>Base</anno></c>, for example:</p>
<pre>
> <input>integer_to_binary(1023, 16).</input>
&lt;&lt;"3FF">></pre>
</desc>
</func>
+
<func>
<name name="integer_to_list" arity="1"/>
- <fsummary>Text representation of an integer</fsummary>
+ <fsummary>Text representation of an integer.</fsummary>
<desc>
- <p>Returns a string which corresponds to the text
- representation of <c><anno>Integer</anno></c>.</p>
+ <p>Returns a string corresponding to the text
+ representation of <c><anno>Integer</anno></c>, for example:</p>
<pre>
> <input>integer_to_list(77).</input>
"77"</pre>
</desc>
</func>
+
<func>
<name name="integer_to_list" arity="2"/>
- <fsummary>Text representation of an integer</fsummary>
+ <fsummary>Text representation of an integer.</fsummary>
<desc>
- <p>Returns a string which corresponds to the text
- representation of <c><anno>Integer</anno></c> in base <c><anno>Base</anno></c>.</p>
+ <p>Returns a string corresponding to the text
+ representation of <c><anno>Integer</anno></c> in base
+ <c><anno>Base</anno></c>, for example:</p>
<pre>
> <input>integer_to_list(1023, 16).</input>
"3FF"</pre>
</desc>
</func>
+
<func>
<name name="iolist_to_binary" arity="1"/>
- <fsummary>Convert an iolist to a binary</fsummary>
+ <fsummary>Converts an iolist to a binary.</fsummary>
<desc>
- <p>Returns a binary which is made from the integers and
- binaries in <c><anno>IoListOrBinary</anno></c>.</p>
+ <p>Returns a binary that is made from the integers and
+ binaries in <c><anno>IoListOrBinary</anno></c>, for example:</p>
<pre>
> <input>Bin1 = &lt;&lt;1,2,3&gt;&gt;.</input>
&lt;&lt;1,2,3&gt;&gt;
@@ -1847,278 +1961,311 @@ os_prompt% </pre>
&lt;&lt;1,2,3,1,2,3,4,5,4,6&gt;&gt;</pre>
</desc>
</func>
+
<func>
<name name="iolist_size" arity="1"/>
- <fsummary>Size of an iolist</fsummary>
+ <fsummary>Size of an iolist.</fsummary>
<desc>
- <p>Returns an integer which is the size in bytes
- of the binary that would be the result of
- <c>iolist_to_binary(<anno>Item</anno>)</c>.</p>
+ <p>Returns an integer that is the size in bytes
+ of the binary that would be the result of
+ <c>iolist_to_binary(<anno>Item</anno>)</c>, for example:</p>
<pre>
> <input>iolist_size([1,2|&lt;&lt;3,4>>]).</input>
4</pre>
</desc>
</func>
+
<func>
<name name="is_alive" arity="0"/>
- <fsummary>Check whether the local node is alive</fsummary>
+ <fsummary>Checks whether the local node is alive.</fsummary>
<desc>
- <p>Returns <c>true</c> if the local node is alive; that is, if
- the node can be part of a distributed system. Otherwise, it
- returns <c>false</c>.</p>
+ <p>Returns <c>true</c> if the local node is alive (that is, if
+ the node can be part of a distributed system), otherwise
+ <c>false</c>.</p>
</desc>
</func>
+
<func>
<name name="is_atom" arity="1"/>
- <fsummary>Check whether a term is an atom</fsummary>
+ <fsummary>Checks whether a term is an atom.</fsummary>
<desc>
- <p>Returns <c>true</c> if <c><anno>Term</anno></c> is an atom;
- otherwise returns <c>false</c>.</p>
+ <p>Returns <c>true</c> if <c><anno>Term</anno></c> is an atom,
+ otherwise <c>false</c>.</p>
<p>Allowed in guard tests.</p>
</desc>
</func>
+
<func>
<name name="is_binary" arity="1"/>
- <fsummary>Check whether a term is a binary</fsummary>
+ <fsummary>Checks whether a term is a binary.</fsummary>
<desc>
- <p>Returns <c>true</c> if <c><anno>Term</anno></c> is a binary;
- otherwise returns <c>false</c>.</p>
-
+ <p>Returns <c>true</c> if <c><anno>Term</anno></c> is a binary,
+ otherwise <c>false</c>.</p>
<p>A binary always contains a complete number of bytes.</p>
-
<p>Allowed in guard tests.</p>
</desc>
</func>
+
<func>
<name name="is_bitstring" arity="1"/>
- <fsummary>Check whether a term is a bitstring</fsummary>
+ <fsummary>Checks whether a term is a bitstring.</fsummary>
<desc>
- <p>Returns <c>true</c> if <c><anno>Term</anno></c> is a bitstring (including a binary);
- otherwise returns <c>false</c>.</p>
-
+ <p>Returns <c>true</c> if <c><anno>Term</anno></c> is a
+ bitstring (including a binary), otherwise <c>false</c>.</p>
<p>Allowed in guard tests.</p>
</desc>
</func>
+
<func>
<name name="is_boolean" arity="1"/>
- <fsummary>Check whether a term is a boolean</fsummary>
+ <fsummary>Checks whether a term is a boolean.</fsummary>
<desc>
- <p>Returns <c>true</c> if <c><anno>Term</anno></c> is
- either the atom <c>true</c> or the atom <c>false</c>
- (i.e. a boolean); otherwise returns <c>false</c>.</p>
+ <p>Returns <c>true</c> if <c><anno>Term</anno></c> is the
+ atom <c>true</c> or the atom <c>false</c> (that is, a boolean).
+ Otherwise returns <c>false</c>.</p>
<p>Allowed in guard tests.</p>
</desc>
</func>
+
<func>
<name name="is_builtin" arity="3"/>
- <fsummary>Check if a function is a BIF implemented in C</fsummary>
+ <fsummary>Checks if a function is a BIF implemented in C.</fsummary>
<desc>
- <p>Returns <c>true</c> if <c><anno>Module</anno>:<anno>Function</anno>/<anno>Arity</anno></c> is
- a BIF implemented in C; otherwise returns <c>false</c>.
- This BIF is useful for builders of cross reference tools.</p>
+ <p>This BIF is useful for builders of cross-reference tools.</p>
+ <p>Returns <c>true</c> if
+ <c><anno>Module</anno>:<anno>Function</anno>/<anno>Arity</anno></c>
+ is a BIF implemented in C, otherwise <c>false</c>.</p>
</desc>
</func>
+
<func>
<name name="is_float" arity="1"/>
- <fsummary>Check whether a term is a float</fsummary>
+ <fsummary>Checks whether a term is a float.</fsummary>
<desc>
<p>Returns <c>true</c> if <c><anno>Term</anno></c> is a floating point
- number; otherwise returns <c>false</c>.</p>
+ number, otherwise <c>false</c>.</p>
<p>Allowed in guard tests.</p>
</desc>
</func>
+
<func>
<name name="is_function" arity="1"/>
- <fsummary>Check whether a term is a fun</fsummary>
+ <fsummary>Checks whether a term is a fun.</fsummary>
<desc>
- <p>Returns <c>true</c> if <c><anno>Term</anno></c> is a fun; otherwise
- returns <c>false</c>.</p>
+ <p>Returns <c>true</c> if <c><anno>Term</anno></c> is a fun, otherwise
+ <c>false</c>.</p>
<p>Allowed in guard tests.</p>
</desc>
</func>
+
<func>
<name name="is_function" arity="2"/>
- <fsummary>Check whether a term is a fun with a given arity</fsummary>
+ <fsummary>Checks whether a term is a fun with a given arity.</fsummary>
<desc>
<p>Returns <c>true</c> if <c><anno>Term</anno></c> is a fun that can be
- applied with <c><anno>Arity</anno></c> number of arguments; otherwise
- returns <c>false</c>.</p>
+ applied with <c><anno>Arity</anno></c> number of arguments, otherwise
+ <c>false</c>.</p>
<p>Allowed in guard tests.</p>
</desc>
</func>
+
<func>
<name name="is_integer" arity="1"/>
- <fsummary>Check whether a term is an integer</fsummary>
+ <fsummary>Checks whether a term is an integer.</fsummary>
<desc>
- <p>Returns <c>true</c> if <c><anno>Term</anno></c> is an integer;
- otherwise returns <c>false</c>.</p>
+ <p>Returns <c>true</c> if <c><anno>Term</anno></c> is an integer,
+ otherwise <c>false</c>.</p>
<p>Allowed in guard tests.</p>
</desc>
</func>
+
<func>
<name name="is_list" arity="1"/>
- <fsummary>Check whether a term is a list</fsummary>
+ <fsummary>Checks whether a term is a list.</fsummary>
<desc>
<p>Returns <c>true</c> if <c><anno>Term</anno></c> is a list with
- zero or more elements; otherwise returns <c>false</c>.</p>
+ zero or more elements, otherwise <c>false</c>.</p>
<p>Allowed in guard tests.</p>
</desc>
</func>
+
<func>
<name name="is_map" arity="1"/>
- <fsummary>Check whether a term is a map</fsummary>
+ <fsummary>Checks whether a term is a map.</fsummary>
<desc>
- <p>Returns <c>true</c> if <c><anno>Term</anno></c> is a map;
- otherwise returns <c>false</c>.</p>
+ <p>Returns <c>true</c> if <c><anno>Term</anno></c> is a map,
+ otherwise <c>false</c>.</p>
<p>Allowed in guard tests.</p>
</desc>
</func>
+
<func>
<name name="is_number" arity="1"/>
- <fsummary>Check whether a term is a number</fsummary>
+ <fsummary>Checks whether a term is a number.</fsummary>
<desc>
- <p>Returns <c>true</c> if <c><anno>Term</anno></c> is either an integer or a
- floating point number; otherwise returns <c>false</c>.</p>
+ <p>Returns <c>true</c> if <c><anno>Term</anno></c> is an integer or a
+ floating point number. Otherwise returns <c>false</c>.</p>
<p>Allowed in guard tests.</p>
</desc>
</func>
+
<func>
<name name="is_pid" arity="1"/>
- <fsummary>Check whether a term is a pid</fsummary>
+ <fsummary>Checks whether a term is a process identifier.</fsummary>
<desc>
- <p>Returns <c>true</c> if <c><anno>Term</anno></c> is a pid (process
- identifier); otherwise returns <c>false</c>.</p>
+ <p>Returns <c>true</c> if <c><anno>Term</anno></c> is a process
+ identifier, otherwise <c>false</c>.</p>
<p>Allowed in guard tests.</p>
</desc>
</func>
+
<func>
<name name="is_port" arity="1"/>
- <fsummary>Check whether a term is a port</fsummary>
+ <fsummary>Checks whether a term is a port.</fsummary>
<desc>
- <p>Returns <c>true</c> if <c><anno>Term</anno></c> is a port identifier;
- otherwise returns <c>false</c>.</p>
+ <p>Returns <c>true</c> if <c><anno>Term</anno></c> is a port identifier,
+ otherwise <c>false</c>.</p>
<p>Allowed in guard tests.</p>
</desc>
</func>
+
<func>
<name name="is_process_alive" arity="1"/>
- <fsummary>Check whether a process is alive</fsummary>
+ <fsummary>Checks whether a process is alive.</fsummary>
<desc>
- <p>
- <c><anno>Pid</anno></c> must refer to a process at the local node.
- Returns <c>true</c> if the process exists and is alive, that
- is, is not exiting and has not exited. Otherwise, returns
+ <p><c><anno>Pid</anno></c> must refer to a process at the local node.</p>
+ <p>Returns <c>true</c> if the process exists and is alive, that
+ is, is not exiting and has not exited. Otherwise returns
<c>false</c>.
</p>
</desc>
</func>
+
<func>
<name name="is_record" arity="2"/>
- <fsummary>Check whether a term appears to be a record</fsummary>
+ <fsummary>Checks whether a term appears to be a record.</fsummary>
<desc>
- <p>Returns <c>true</c> if <c><anno>Term</anno></c> is a tuple and its first
- element is <c><anno>RecordTag</anno></c>. Otherwise, returns <c>false</c>.</p>
+ <p>Returns <c>true</c> if <c><anno>Term</anno></c> is a tuple and its
+ first element is <c><anno>RecordTag</anno></c>.
+ Otherwise returns <c>false</c>.</p>
<note>
<p>Normally the compiler treats calls to <c>is_record/2</c>
- specially. It emits code to verify that <c><anno>Term</anno></c> is a
- tuple, that its first element is <c><anno>RecordTag</anno></c>, and that
- the size is correct. However, if the <c><anno>RecordTag</anno></c> is
- not a literal atom, the <c>is_record/2</c> BIF will be
- called instead and the size of the tuple will not be
- verified.</p>
+ specially. It emits code to verify that <c><anno>Term</anno></c>
+ is a tuple, that its first element is
+ <c><anno>RecordTag</anno></c>, and that the
+ size is correct. However, if <c><anno>RecordTag</anno></c> is
+ not a literal atom, the BIF <c>is_record/2</c> is called
+ instead and the size of the tuple is not verified.</p>
</note>
- <p>Allowed in guard tests, if <c><anno>RecordTag</anno></c> is a literal
- atom.</p>
+ <p>Allowed in guard tests, if <c><anno>RecordTag</anno></c> is
+ a literal atom.</p>
</desc>
</func>
+
<func>
<name name="is_record" arity="3"/>
- <fsummary>Check whether a term appears to be a record</fsummary>
- <desc>
- <p><c><anno>RecordTag</anno></c> must be an atom. Returns <c>true</c> if
- <c><anno>Term</anno></c> is a tuple, its first element is <c><anno>RecordTag</anno></c>,
- and its size is <c><anno>Size</anno></c>. Otherwise, returns <c>false</c>.</p>
- <p>Allowed in guard tests, provided that <c><anno>RecordTag</anno></c> is
+ <fsummary>Checks whether a term appears to be a record.</fsummary>
+ <desc>
+ <p><c><anno>RecordTag</anno></c> must be an atom.</p>
+ <p>Returns <c>true</c> if
+ <c><anno>Term</anno></c> is a tuple,
+ its first element is <c><anno>RecordTag</anno></c>,
+ and its size is <c><anno>Size</anno></c>.
+ Otherwise returns <c>false</c>.</p>
+ <p>Allowed in guard tests if <c><anno>RecordTag</anno></c> is
a literal atom and <c>Size</c> is a literal integer.</p>
<note>
- <p>This BIF is documented for completeness. In most cases
- <c>is_record/2</c> should be used.</p>
+ <p>This BIF is documented for completeness. Usually
+ <c>is_record/2</c> is to be used.</p>
</note>
</desc>
</func>
+
<func>
<name name="is_reference" arity="1"/>
- <fsummary>Check whether a term is a reference</fsummary>
+ <fsummary>Checks whether a term is a reference.</fsummary>
<desc>
- <p>Returns <c>true</c> if <c><anno>Term</anno></c> is a reference;
- otherwise returns <c>false</c>.</p>
+ <p>Returns <c>true</c> if <c><anno>Term</anno></c> is a reference,
+ otherwise <c>false</c>.</p>
<p>Allowed in guard tests.</p>
</desc>
</func>
+
<func>
<name name="is_tuple" arity="1"/>
- <fsummary>Check whether a term is a tuple</fsummary>
+ <fsummary>Checks whether a term is a tuple.</fsummary>
<desc>
- <p>Returns <c>true</c> if <c><anno>Term</anno></c> is a tuple;
- otherwise returns <c>false</c>.</p>
+ <p>Returns <c>true</c> if <c><anno>Term</anno></c> is a tuple,
+ otherwise <c>false</c>.</p>
<p>Allowed in guard tests.</p>
</desc>
</func>
+
<func>
<name name="length" arity="1"/>
- <fsummary>Length of a list</fsummary>
+ <fsummary>Length of a list.</fsummary>
<desc>
- <p>Returns the length of <c><anno>List</anno></c>.</p>
+ <p>Returns the length of <c><anno>List</anno></c>, for example:</p>
<pre>
> <input>length([1,2,3,4,5,6,7,8,9]).</input>
9</pre>
<p>Allowed in guard tests.</p>
</desc>
</func>
+
<func>
<name name="link" arity="1"/>
- <fsummary>Create a link to another process (or port)</fsummary>
+ <fsummary>Creates a link to another process (or port).</fsummary>
<desc>
<p>Creates a link between the calling process and another
- process (or port) <c><anno>PidOrPort</anno></c>, if there is not such a link
+ process (or port) <c><anno>PidOrPort</anno></c>, if there is
+ not such a link
already. If a process attempts to create a link to itself,
nothing is done. Returns <c>true</c>.</p>
- <p>If <c><anno>PidOrPort</anno></c> does not exist, the behavior of the BIF depends
- on if the calling process is trapping exits or not (see
+ <p>If <c><anno>PidOrPort</anno></c> does not exist, the behavior
+ of the BIF
+ depends on if the calling process is trapping exits or not (see
<seealso marker="#process_flag/2">process_flag/2</seealso>):</p>
<list type="bulleted">
<item>If the calling process is not trapping exits, and
- checking <c><anno>PidOrPort</anno></c> is cheap -- that is, if <c><anno>PidOrPort</anno></c> is
- local -- <c>link/1</c> fails with reason <c>noproc</c>.</item>
+ checking <c><anno>PidOrPort</anno></c> is cheap
+ (that is, if <c><anno>PidOrPort</anno></c>
+ is local), <c>link/1</c> fails with reason <c>noproc</c>.</item>
<item>Otherwise, if the calling process is trapping exits,
- and/or <c><anno>PidOrPort</anno></c> is remote, <c>link/1</c> returns
- <c>true</c>, but an exit signal with reason <c>noproc</c>
+ and/or <c><anno>PidOrPort</anno></c> is remote, <c>link/1</c>
+ returns <c>true</c>, but an exit signal with reason <c>noproc</c>
is sent to the calling process.</item>
</list>
</desc>
</func>
+
<func>
<name name="list_to_atom" arity="1"/>
- <fsummary>Convert from text representation to an atom</fsummary>
- <desc>
- <p>Returns the atom whose text representation is <c><anno>String</anno></c>.</p>
- <p><c><anno>String</anno></c> may only contain ISO-latin-1
- characters (i.e. numbers below 256) as the current
- implementation does not allow unicode characters >= 256 in
- atoms. For more information on Unicode support in atoms
- see <seealso marker="erl_ext_dist#utf8_atoms">note on UTF-8 encoded atoms</seealso>
- in the chapter about the external term format in the ERTS User's Guide.</p>
+ <fsummary>Converts from text representation to an atom.</fsummary>
+ <desc>
+ <p>Returns the atom whose text representation is
+ <c><anno>String</anno></c>.</p>
+ <p><c><anno>String</anno></c> can only contain ISO-latin-1
+ characters (that is,
+ numbers less than 256) as the implementation does not
+ allow unicode characters equal to or above 256 in atoms.
+ For more information on Unicode support in atoms, see
+ <seealso marker="erl_ext_dist#utf8_atoms">note on UTF-8
+ encoded atoms</seealso>
+ in Section "External Term Format" in the User's Guide.</p>
+ <p>Example:</p>
<pre>
> <input>list_to_atom("Erlang").</input>
'Erlang'</pre>
</desc>
</func>
+
<func>
<name name="list_to_binary" arity="1"/>
- <fsummary>Convert a list to a binary</fsummary>
+ <fsummary>Converts a list to a binary.</fsummary>
<desc>
- <p>Returns a binary which is made from the integers and
- binaries in <c><anno>IoList</anno></c>.</p>
+ <p>Returns a binary that is made from the integers and
+ binaries in <c><anno>IoList</anno></c>, for example:</p>
<pre>
> <input>Bin1 = &lt;&lt;1,2,3&gt;&gt;.</input>
&lt;&lt;1,2,3&gt;&gt;
@@ -2130,40 +2277,46 @@ os_prompt% </pre>
&lt;&lt;1,2,3,1,2,3,4,5,4,6&gt;&gt;</pre>
</desc>
</func>
+
<func>
<name name="list_to_bitstring" arity="1"/>
+ <fsummary>Converts a list to a bitstring.</fsummary>
<type name="bitstring_list"/>
- <fsummary>Convert a list to a bitstring</fsummary>
<desc>
- <p>Returns a bitstring which is made from the integers and
- bitstrings in <c><anno>BitstringList</anno></c>. (The last tail in <c><anno>BitstringList</anno></c>
- is allowed to be a bitstring.)</p>
+ <p>Returns a bitstring that is made from the integers and
+ bitstrings in <c><anno>BitstringList</anno></c>. (The last tail in
+ <c><anno>BitstringList</anno></c> is allowed to be a bitstring.)</p>
+ <p>Example:</p>
<pre>
> <input>Bin1 = &lt;&lt;1,2,3&gt;&gt;.</input>
&lt;&lt;1,2,3&gt;&gt;
> <input>Bin2 = &lt;&lt;4,5&gt;&gt;.</input>
&lt;&lt;4,5&gt;&gt;
-> <input>Bin3 = &lt;&lt;6,7:4,&gt;&gt;.</input>
-&lt;&lt;6&gt;&gt;
+> <input>Bin3 = &lt;&lt;6,7:4&gt;&gt;.</input>
+&lt;&lt;6,7:4&gt;&gt;
> <input>list_to_bitstring([Bin1,1,[2,3,Bin2],4|Bin3]).</input>
-&lt;&lt;1,2,3,1,2,3,4,5,4,6,7:46&gt;&gt;</pre>
+&lt;&lt;1,2,3,1,2,3,4,5,4,6,7:4&gt;&gt;</pre>
</desc>
</func>
+
<func>
<name name="list_to_existing_atom" arity="1"/>
- <fsummary>Convert from text representation to an atom</fsummary>
+ <fsummary>Converts from text representation to an atom.</fsummary>
<desc>
- <p>Returns the atom whose text representation is <c><anno>String</anno></c>,
+ <p>Returns the atom whose text representation is
+ <c><anno>String</anno></c>,
but only if there already exists such atom.</p>
<p>Failure: <c>badarg</c> if there does not already exist an atom
whose text representation is <c><anno>String</anno></c>.</p>
</desc>
</func>
+
<func>
<name name="list_to_float" arity="1"/>
- <fsummary>Convert from text representation to a float</fsummary>
+ <fsummary>Converts from text representation to a float.</fsummary>
<desc>
- <p>Returns the float whose text representation is <c><anno>String</anno></c>.</p>
+ <p>Returns the float whose text representation is
+ <c><anno>String</anno></c>, for example:</p>
<pre>
> <input>list_to_float("2.2017764e+0").</input>
2.2017764</pre>
@@ -2171,12 +2324,13 @@ os_prompt% </pre>
representation of a float.</p>
</desc>
</func>
+
<func>
<name name="list_to_integer" arity="1"/>
- <fsummary>Convert from text representation to an integer</fsummary>
+ <fsummary>Converts from text representation to an integer.</fsummary>
<desc>
<p>Returns an integer whose text representation is
- <c><anno>String</anno></c>.</p>
+ <c><anno>String</anno></c>, for example:</p>
<pre>
> <input>list_to_integer("123").</input>
123</pre>
@@ -2184,12 +2338,14 @@ os_prompt% </pre>
representation of an integer.</p>
</desc>
</func>
+
<func>
<name name="list_to_integer" arity="2"/>
- <fsummary>Convert from text representation to an integer</fsummary>
+ <fsummary>Converts from text representation to an integer.</fsummary>
<desc>
<p>Returns an integer whose text representation in base
- <c><anno>Base</anno></c> is <c><anno>String</anno></c>.</p>
+ <c><anno>Base</anno></c> is <c><anno>String</anno></c>,
+ for example:</p>
<pre>
> <input>list_to_integer("3FF", 16).</input>
1023</pre>
@@ -2197,47 +2353,52 @@ os_prompt% </pre>
representation of an integer.</p>
</desc>
</func>
+
<func>
<name name="list_to_pid" arity="1"/>
- <fsummary>Convert from text representation to a pid</fsummary>
+ <fsummary>Converts from text representation to a pid.</fsummary>
<desc>
- <p>Returns a pid whose text representation is <c><anno>String</anno></c>.</p>
- <warning>
- <p>This BIF is intended for debugging and for use in
- the Erlang operating system. It should not be used in
- application programs.</p>
- </warning>
+ <p>Returns a process identifier whose text representation is a
+ <c><anno>String</anno></c>, for example:</p>
<pre>
> <input>list_to_pid("&lt;0.4.1>").</input>
&lt;0.4.1></pre>
<p>Failure: <c>badarg</c> if <c><anno>String</anno></c> contains a bad
- representation of a pid.</p>
+ representation of a process identifier.</p>
+ <warning>
+ <p>This BIF is intended for debugging and is not to be used
+ in application programs.</p>
+ </warning>
</desc>
</func>
+
<func>
<name name="list_to_tuple" arity="1"/>
- <fsummary>Convert a list to a tuple</fsummary>
+ <fsummary>Converts a list to a tuple.</fsummary>
<desc>
- <p>Returns a tuple which corresponds to <c><anno>List</anno></c>. <c><anno>List</anno></c>
- can contain any Erlang terms.</p>
+ <p>Returns a tuple corresponding to <c><anno>List</anno></c>,
+ for example</p>
<pre>
> <input>list_to_tuple([share, ['Ericsson_B', 163]]).</input>
{share, ['Ericsson_B', 163]}</pre>
+ <p><c><anno>List</anno></c> can contain any Erlang terms.</p>
</desc>
</func>
+
<func>
<name name="load_module" arity="2"/>
- <fsummary>Load object code for a module</fsummary>
+ <fsummary>Loads object code for a module.</fsummary>
<desc>
- <p>If <c><anno>Binary</anno></c> contains the object code for the module
- <c><anno>Module</anno></c>, this BIF loads that object code. Also, if
- the code for the module <c><anno>Module</anno></c> already exists, all
+ <p>If <c><anno>Binary</anno></c> contains the object code for module
+ <c><anno>Module</anno></c>, this BIF loads that object code. If
+ the code for module <c><anno>Module</anno></c> already exists, all
export references are replaced so they point to the newly
loaded code. The previously loaded code is kept in the system
- as old code, as there may still be processes which are
- executing that code. It returns either
- <c>{module, <anno>Module</anno>}</c>, or <c>{error, <anno>Reason</anno>}</c> if loading
- fails. <c><anno>Reason</anno></c> is one of the following:</p>
+ as old code, as there can still be processes executing
+ that code.</p>
+ <p>Returns either <c>{module, <anno>Module</anno>}</c>, or
+ <c>{error, <anno>Reason</anno>}</c> if loading fails.
+ <c><anno>Reason</anno></c> is any of the following:</p>
<taglist>
<tag><c>badfile</c></tag>
<item>
@@ -2247,118 +2408,122 @@ os_prompt% </pre>
</item>
<tag><c>not_purged</c></tag>
<item>
- <p><c><anno>Binary</anno></c> contains a module which cannot be loaded
- because old code for this module already exists.</p>
+ <p><c><anno>Binary</anno></c> contains a module that cannot be
+ loaded because old code for this module already exists.</p>
</item>
</taglist>
<warning>
<p>This BIF is intended for the code server (see
- <seealso marker="kernel:code">code(3)</seealso>) and should not be
- used elsewhere.</p>
+ <seealso marker="kernel:code">code(3)</seealso>)
+ and is not to be used elsewhere.</p>
</warning>
</desc>
</func>
+
<func>
<name name="load_nif" arity="2"/>
- <fsummary>Load NIF library</fsummary>
+ <fsummary>Loads NIF library.</fsummary>
<desc>
<note>
- <p>In releases older than OTP R14B, NIFs were an
- experimental feature. Versions of OTP older than R14B might
+ <p>Before OTP R14B, NIFs were an
+ experimental feature. Versions before OTP R14B can
have different and possibly incompatible NIF semantics and
- interfaces. For example, in R13B03 the return value on
- failure was
- <c>{error,Reason,Text}</c>.</p>
+ interfaces. For example, in OTP R13B03 the return value on
+ failure was <c>{error,Reason,Text}</c>.</p>
</note>
<p>Loads and links a dynamic library containing native
- implemented functions (NIFs) for a module. <c><anno>Path</anno></c> is a
- file path to the sharable object/dynamic library file minus
- the OS-dependent file extension (.so for Unix and .dll for
- Windows). See <seealso marker="erl_nif">erl_nif</seealso>
- on how to implement a NIF library.</p>
- <p><c><anno>LoadInfo</anno></c> can be any term. It will be passed on to
+ implemented functions (NIFs) for a module. <c><anno>Path</anno></c>
+ is a file path to the shareable object/dynamic library file minus
+ the OS-dependent file extension (<c>.so</c> for Unix and
+ <c>.dll</c> for Windows. For information on how to
+ implement a NIF library, see
+ <seealso marker="erl_nif">erl_nif</seealso>.</p>
+ <p><c><anno>LoadInfo</anno></c> can be any term. It is passed on to
the library as part of the initialization. A good practice is
to include a module version number to support future code
upgrade scenarios.</p>
<p>The call to <c>load_nif/2</c> must be made
<em>directly</em> from the Erlang code of the module that the
- NIF library belongs to.</p>
- <p>It returns either <c>ok</c>, or <c>{error,{<anno>Reason</anno>,Text}}</c>
- if loading fails. <c><anno>Reason</anno></c> is one of the atoms below,
- while <c><anno>Text</anno></c> is a human readable string that may give
- some more information about the failure.</p>
+ NIF library belongs to. It returns either <c>ok</c>, or
+ <c>{error,{<anno>Reason</anno>,Text}}</c> if loading fails.
+ <c><anno>Reason</anno></c> is one of the following atoms
+ while <c><anno>Text</anno></c> is a human readable string that
+ can give more information about the failure:</p>
<taglist>
<tag><c>load_failed</c></tag>
- <item>
- <p>The OS failed to load the NIF library.</p>
+ <item>The OS failed to load the NIF library.
</item>
<tag><c>bad_lib</c></tag>
- <item>
- <p>The library did not fulfil the requirements as a NIF
- library of the calling module.</p>
+ <item>The library did not fulfill the requirements as a NIF
+ library of the calling module.
</item>
<tag><c>load | reload | upgrade</c></tag>
- <item>
- <p>The corresponding library callback was not successful.</p>
+ <item>The corresponding library callback was unsuccessful.
</item>
<tag><c>old_code</c></tag>
- <item>
- <p>The call to <c>load_nif/2</c> was made from the old
- code of a module that has been upgraded. This is not
- allowed.</p>
+ <item>The call to <c>load_nif/2</c> was made from the old
+ code of a module that has been upgraded; this is not
+ allowed.
</item>
</taglist>
</desc>
</func>
+
<func>
<name name="loaded" arity="0"/>
- <fsummary>List of all loaded modules</fsummary>
+ <fsummary>Lists all loaded modules.</fsummary>
<desc>
- <p>Returns a list of all loaded Erlang modules (current and/or
+ <p>Returns a list of all loaded Erlang modules (current and
old code), including preloaded modules.</p>
<p>See also <seealso marker="kernel:code">code(3)</seealso>.</p>
</desc>
</func>
+
<func>
<name name="localtime" arity="0"/>
- <fsummary>Current local date and time</fsummary>
+ <fsummary>Current local date and time.</fsummary>
<desc>
- <p>Returns the current local date and time
- <c>{{Year, Month, Day}, {Hour, Minute, Second}}</c>.</p>
- <p>The time zone and daylight saving time correction depend
- on the underlying OS.</p>
+ <p>Returns the current local date and time,
+ <c>{{Year, Month, Day}, {Hour, Minute, Second}}</c>,
+ for example:</p>
<pre>
> <input>erlang:localtime().</input>
{{1996,11,6},{14,45,17}}</pre>
+ <p>The time zone and Daylight Saving Time correction depend
+ on the underlying OS.</p>
</desc>
</func>
+
<func>
<name name="localtime_to_universaltime" arity="1"/>
- <fsummary>Convert from local to Universal Time Coordinated (UTC) date and time</fsummary>
+ <fsummary>Converts from local to Universal Time Coordinated (UTC) date and time.</fsummary>
<desc>
<p>Converts local date and time to Universal Time Coordinated
- (UTC), if this is supported by the underlying OS. Otherwise,
- no conversion is done and <c><anno>Localtime</anno></c> is returned.</p>
+ (UTC), if supported by the underlying OS. Otherwise
+ no conversion is done and <c><anno>Localtime</anno></c>
+ is returned.</p>
+ <p>Example:</p>
<pre>
> <input>erlang:localtime_to_universaltime({{1996,11,6},{14,45,17}}).</input>
{{1996,11,6},{13,45,17}}</pre>
- <p>Failure: <c>badarg</c> if <c><anno>Localtime</anno></c> does not denote
- a valid date and time.</p>
+ <p>Failure: <c>badarg</c> if <c><anno>Localtime</anno></c> denotes an
+ invalid date and time.</p>
</desc>
</func>
+
<func>
<name name="localtime_to_universaltime" arity="2"/>
- <fsummary>Convert from local to Universal Time Coordinated (UTC) date and time</fsummary>
+ <fsummary>Converts from local to Universal Time Coordinated (UTC) date and time.</fsummary>
<desc>
<p>Converts local date and time to Universal Time Coordinated
- (UTC) just like <c>erlang:localtime_to_universaltime/1</c>,
- but the caller decides if daylight saving time is active or
- not.</p>
- <p>If <c><anno>IsDst</anno> == true</c> the <c><anno>Localtime</anno></c> is during
- daylight saving time, if <c><anno>IsDst</anno> == false</c> it is not,
- and if <c><anno>IsDst</anno> == undefined</c> the underlying OS may
+ (UTC) as <c>erlang:localtime_to_universaltime/1</c>,
+ but the caller decides if Daylight Saving Time is active.</p>
+ <p>If <c><anno>IsDst</anno> == true</c>, <c><anno>Localtime</anno></c> is
+ during Daylight Saving Time, if <c><anno>IsDst</anno> == false</c> it is
+ not. If <c><anno>IsDst</anno> == undefined</c>, the underlying OS can
guess, which is the same as calling
<c>erlang:localtime_to_universaltime(<anno>Localtime</anno>)</c>.</p>
+ <p>Examples:</p>
<pre>
> <input>erlang:localtime_to_universaltime({{1996,11,6},{14,45,17}}, true).</input>
{{1996,11,6},{12,45,17}}
@@ -2366,15 +2531,16 @@ os_prompt% </pre>
{{1996,11,6},{13,45,17}}
> <input>erlang:localtime_to_universaltime({{1996,11,6},{14,45,17}}, undefined).</input>
{{1996,11,6},{13,45,17}}</pre>
- <p>Failure: <c>badarg</c> if <c><anno>Localtime</anno></c> does not denote
- a valid date and time.</p>
+ <p>Failure: <c>badarg</c> if <c><anno>Localtime</anno></c> denotes an
+ invalid date and time.</p>
</desc>
</func>
+
<func>
<name name="make_ref" arity="0"/>
- <fsummary>Return a unique reference</fsummary>
+ <fsummary>Returns a unique reference.</fsummary>
<desc>
- <p>Return a <seealso marker="doc/efficiency_guide:advanced#unique_references">unique
+ <p>Returns a <seealso marker="doc/efficiency_guide:advanced#unique_references">unique
reference</seealso>. The reference is unique among
connected nodes.</p>
<warning><p>Known issue: When a node is restarted multiple
@@ -2383,200 +2549,209 @@ os_prompt% </pre>
created on an older node with the same node name.</p></warning>
</desc>
</func>
+
<func>
<name name="make_tuple" arity="2"/>
- <fsummary>Create a new tuple of a given arity</fsummary>
+ <fsummary>Creates a new tuple of a given arity.</fsummary>
<desc>
- <p>Returns a new tuple of the given <c><anno>Arity</anno></c>, where all
- elements are <c><anno>InitialValue</anno></c>.</p>
+ <p>Creates a new tuple of the given <c><anno>Arity</anno></c>, where all
+ elements are <c><anno>InitialValue</anno></c>, for example:</p>
<pre>
> <input>erlang:make_tuple(4, []).</input>
{[],[],[],[]}</pre>
</desc>
</func>
+
<func>
<name name="make_tuple" arity="3"/>
- <fsummary>Create a new tuple with given arity and contents</fsummary>
- <desc>
- <p><c>erlang:make_tuple</c> first creates a tuple of size <c><anno>Arity</anno></c>
- where each element has the value <c><anno>DefaultValue</anno></c>. It then fills
- in values from <c><anno>InitList</anno></c>. Each list element in <c><anno>InitList</anno></c>
- must be a two-tuple where the first element is a position in the
- newly created tuple and the second element is any term. If a position
- occurs more than once in the list, the term corresponding to
- last occurrence will be used.</p>
+ <fsummary>Creates a new tuple with given arity and contents.</fsummary>
+ <desc>
+ <p>Creates a tuple of size <c><anno>Arity</anno></c>, where each element
+ has value <c><anno>DefaultValue</anno></c>, and then fills in
+ values from <c><anno>InitList</anno></c>.
+ Each list element in <c><anno>InitList</anno></c>
+ must be a two-tuple, where the first element is a position in the
+ newly created tuple and the second element is any term. If a
+ position occurs more than once in the list, the term corresponding
+ to the last occurrence is used.</p>
+ <p>Example:</p>
<pre>
> <input>erlang:make_tuple(5, [], [{2,ignored},{5,zz},{2,aa}]).</input>
{{[],aa,[],[],zz}</pre>
</desc>
</func>
+
<func>
<name name="map_size" arity="1"/>
- <fsummary>Return the size of a map</fsummary>
+ <fsummary>Returns the size of a map.</fsummary>
<desc>
- <p>Returns an integer which is the number of key-value pairs in <c><anno>Map</anno></c>.</p>
+ <p>Returns an integer, which is the number of key-value pairs
+ in <c><anno>Map</anno></c>, for example:</p>
<pre>
> <input>map_size(#{a=>1, b=>2, c=>3}).</input>
3</pre>
<p>Allowed in guard tests.</p>
</desc>
</func>
+
<func>
<name name="max" arity="2"/>
- <fsummary>Return the largest of two term</fsummary>
+ <fsummary>Returns the largest of two terms.</fsummary>
<desc>
- <p>Return the largest of <c><anno>Term1</anno></c> and <c><anno>Term2</anno></c>;
- if the terms compare equal, <c><anno>Term1</anno></c> will be returned.</p>
+ <p>Returns the largest of <c><anno>Term1</anno></c> and
+ <c><anno>Term2</anno></c>.
+ If the terms are equal, <c><anno>Term1</anno></c> is returned.</p>
</desc>
</func>
+
<func>
<name name="md5" arity="1"/>
- <fsummary>Compute an MD5 message digest</fsummary>
+ <fsummary>Computes an MD5 message digest.</fsummary>
<desc>
- <p>Computes an <c>MD5</c> message digest from <c><anno>Data</anno></c>, where
- the length of the digest is 128 bits (16 bytes). <c><anno>Data</anno></c>
+ <p>Computes an MD5 message digest from <c><anno>Data</anno></c>, where
+ the length of the digest is 128 bits (16 bytes).
+ <c><anno>Data</anno></c>
is a binary or a list of small integers and binaries.</p>
- <p>See The MD5 Message Digest Algorithm (RFC 1321) for more
- information about MD5.</p>
- <warning><p>The MD5 Message Digest Algorithm is <em>not</em> considered
- safe for code-signing or software integrity purposes.</p></warning>
+ <p>For more information about MD5, see RFC 1321 - The
+ MD5 Message-Digest Algorithm.</p>
+ <warning><p>The MD5 Message-Digest Algorithm is <em>not</em> considered
+ safe for code-signing or software-integrity purposes.</p></warning>
</desc>
</func>
+
<func>
<name name="md5_final" arity="1"/>
- <fsummary>Finish the update of an MD5 context and return the computed MD5 message digest</fsummary>
+ <fsummary>Finishes the update of an MD5 context and returns the computed MD5 message digest.</fsummary>
<desc>
<p>Finishes the update of an MD5 <c><anno>Context</anno></c> and returns
the computed <c>MD5</c> message digest.</p>
</desc>
</func>
+
<func>
<name name="md5_init" arity="0"/>
- <fsummary>Create an MD5 context</fsummary>
+ <fsummary>Creates an MD5 context.</fsummary>
<desc>
<p>Creates an MD5 context, to be used in subsequent calls to
<c>md5_update/2</c>.</p>
</desc>
</func>
+
<func>
<name name="md5_update" arity="2"/>
- <fsummary>Update an MD5 context with data, and return a new context</fsummary>
+ <fsummary>Updates an MD5 context with data and returns a new context.</fsummary>
<desc>
- <p>Updates an MD5 <c><anno>Context</anno></c> with <c><anno>Data</anno></c>, and returns
- a <c><anno>NewContext</anno></c>.</p>
+ <p>Updates an MD5 <c><anno>Context</anno></c> with
+ <c><anno>Data</anno></c> and returns a
+ <c><anno>NewContext</anno></c>.</p>
</desc>
</func>
+
<func>
<name name="memory" arity="0"/>
+ <fsummary>Information about dynamically allocated memory.</fsummary>
<type name="memory_type"/>
- <fsummary>Information about dynamically allocated memory</fsummary>
- <desc>
- <p>Returns a list containing information about memory
- dynamically allocated by the Erlang emulator. Each element of
- the list is a tuple <c>{Type, Size}</c>. The first element
- <c><anno>Type</anno></c>is an atom describing memory type. The second
- element <c><anno>Size</anno></c>is memory size in bytes. A description of
- each memory type follows:</p>
+ <desc>
+ <p>Returns a list with information about memory
+ dynamically allocated by the Erlang emulator. Each list
+ element is a tuple <c>{Type, Size}</c>. The first element
+ <c><anno>Type</anno></c> is an atom describing memory type. The second
+ element <c><anno>Size</anno></c> is the memory size in bytes.</p>
+ <p>The memory types are as follows:</p>
<taglist>
<tag><c>total</c></tag>
<item>
- <p>The total amount of memory currently allocated, which is
- the same as the sum of memory size for <c>processes</c>
+ <p>The total amount of memory currently allocated. This is
+ the same as the sum of the memory size for <c>processes</c>
and <c>system</c>.</p>
</item>
<tag><c>processes</c></tag>
<item>
- <p>The total amount of memory currently allocated by
+ <p>The total amount of memory currently allocated for
the Erlang processes.</p>
</item>
<tag><c>processes_used</c></tag>
<item>
<p>The total amount of memory currently used by the Erlang
- processes.</p>
- <p>This memory is part of the memory presented as
+ processes. This is part of the memory presented as
<c>processes</c> memory.</p>
</item>
<tag><c>system</c></tag>
<item>
- <p>The total amount of memory currently allocated by
+ <p>The total amount of memory currently allocated for
the emulator that is not directly related to any Erlang
- process.</p>
- <p>Memory presented as <c>processes</c> is not included in
- this memory.</p>
+ process. Memory presented as <c>processes</c> is not
+ included in this memory.</p>
</item>
<tag><c>atom</c></tag>
<item>
- <p>The total amount of memory currently allocated for atoms.</p>
- <p>This memory is part of the memory presented as
+ <p>The total amount of memory currently allocated for atoms.
+ This memory is part of the memory presented as
<c>system</c> memory.</p>
</item>
<tag><c>atom_used</c></tag>
<item>
- <p>The total amount of memory currently used for atoms.</p>
- <p>This memory is part of the memory presented as
+ <p>The total amount of memory currently used for atoms.
+ This memory is part of the memory presented as
<c>atom</c> memory.</p>
</item>
<tag><c>binary</c></tag>
<item>
<p>The total amount of memory currently allocated for
- binaries.</p>
- <p>This memory is part of the memory presented as
- <c>system</c> memory.</p>
+ binaries. This memory is part of the memory presented
+ as <c>system</c> memory.</p>
</item>
<tag><c>code</c></tag>
<item>
<p>The total amount of memory currently allocated for
- Erlang code.</p>
- <p>This memory is part of the memory presented as
- <c>system</c> memory.</p>
+ Erlang code. This memory is part of the memory presented
+ as <c>system</c> memory.</p>
</item>
<tag><c>ets</c></tag>
<item>
<p>The total amount of memory currently allocated for ets
- tables.</p>
- <p>This memory is part of the memory presented as
+ tables. This memory is part of the memory presented as
<c>system</c> memory.</p>
</item>
<tag><c>low</c></tag>
<item>
- <p>Only on 64-bit halfword emulator.</p>
- <p>The total amount of memory allocated in low memory areas
- that are restricted to less than 4 Gb even though
- the system may have more physical memory.</p>
- <p>May be removed in future releases of halfword emulator.</p>
+ <p>Only on 64-bit halfword emulator.
+ The total amount of memory allocated in low memory areas
+ that are restricted to less than 4 GB, although
+ the system can have more memory.</p>
+ <p>Can be removed in a future release of the halfword
+ emulator.</p>
</item>
<tag><c>maximum</c></tag>
<item>
<p>The maximum total amount of memory allocated since
- the emulator was started.</p>
- <p>This tuple is only present when the emulator is run with
- instrumentation.</p>
+ the emulator was started. This tuple is only present
+ when the emulator is run with instrumentation.</p>
<p>For information on how to run the emulator with
- instrumentation see
+ instrumentation, see
<seealso marker="tools:instrument">instrument(3)</seealso>
and/or <seealso marker="erts:erl">erl(1)</seealso>.</p>
</item>
</taglist>
<note>
<p>The <c>system</c> value is not complete. Some allocated
- memory that should be part of the <c>system</c> value are
- not.</p>
+ memory that is to be part of this value is not.</p>
<p>When the emulator is run with instrumentation,
the <c>system</c> value is more accurate, but memory
- directly allocated by <c>malloc</c> (and friends) are still
+ directly allocated for <c>malloc</c> (and friends) is still
not part of the <c>system</c> value. Direct calls to
- <c>malloc</c> are only done from OS specific runtime
- libraries and perhaps from user implemented Erlang drivers
+ <c>malloc</c> are only done from OS-specific runtime
+ libraries and perhaps from user-implemented Erlang drivers
that do not use the memory allocation functions in
the driver interface.</p>
- <p>Since the <c>total</c> value is the sum of <c>processes</c>
- and <c>system</c> the error in <c>system</c> will propagate
+ <p>As the <c>total</c> value is the sum of <c>processes</c>
+ and <c>system</c>, the error in <c>system</c> propagates
to the <c>total</c> value.</p>
<p>The different amounts of memory that are summed are
- <em>not</em> gathered atomically which also introduce
+ <em>not</em> gathered atomically, which introduces
an error in the result.</p>
</note>
- <p>The different values has the following relation to each
+ <p>The different values have the following relation to each
other. Values beginning with an uppercase letter is not part
of the result.</p>
<code type="none">
@@ -2584,69 +2759,62 @@ os_prompt% </pre>
processes = processes_used + ProcessesNotUsed
system = atom + binary + code + ets + OtherSystem
atom = atom_used + AtomNotUsed
-
RealTotal = processes + RealSystem
RealSystem = system + MissedSystem</code>
- <p>More tuples in the returned list may be added in the future.</p>
+ <p>More tuples in the returned list can be added in a
+ future release.</p>
<note>
<p>The <c>total</c> value is supposed to be the total amount
of memory dynamically allocated by the emulator. Shared
libraries, the code of the emulator itself, and
- the emulator stack(s) are not supposed to be included. That
+ the emulator stacks are not supposed to be included. That
is, the <c>total</c> value is <em>not</em> supposed to be
- equal to the total size of all pages mapped to the emulator.
- Furthermore, due to fragmentation and pre-reservation of
- memory areas, the size of the memory segments which contain
- the dynamically allocated memory blocks can be substantially
+ equal to the total size of all pages mapped to the emulator.</p>
+ <p>Furthermore, because of fragmentation and prereservation of
+ memory areas, the size of the memory segments containing
+ the dynamically allocated memory blocks can be much
larger than the total size of the dynamically allocated
memory blocks.</p>
</note>
<note>
- <p>
- Since erts version 5.6.4 <c>erlang:memory/0</c> requires that
+ <p>As from <c>ERTS</c> 5.6.4, <c>erlang:memory/0</c> requires that
all <seealso marker="erts:erts_alloc">erts_alloc(3)</seealso>
- allocators are enabled (default behaviour).
- </p>
+ allocators are enabled (default behavior).</p>
</note>
- <p>Failure:</p>
- <taglist>
- <tag><c>notsup</c></tag>
- <item>
- If an <seealso marker="erts:erts_alloc">erts_alloc(3)</seealso>
- allocator has been disabled.
- </item>
- </taglist>
+ <p>Failure: <c>notsup</c> if an
+ <seealso marker="erts:erts_alloc">erts_alloc(3)</seealso>
+ allocator has been disabled.</p>
</desc>
</func>
+
<func>
<name name="memory" arity="1" clause_i="1"/>
<name name="memory" arity="1" clause_i="2"/>
+ <fsummary>Information about dynamically allocated memory.</fsummary>
<type name="memory_type"/>
- <fsummary>Information about dynamically allocated memory</fsummary>
<desc>
<p>Returns the memory size in bytes allocated for memory of
type <c><anno>Type</anno></c>. The argument can also be given as a list
of <c>memory_type()</c> atoms, in which case a corresponding list of
<c>{memory_type(), Size :: integer >= 0}</c> tuples is returned.</p>
<note>
- <p>
- Since erts version 5.6.4 <c>erlang:memory/1</c> requires that
+ <p>As from <c>ERTS</c> version 5.6.4,
+ <c>erlang:memory/1</c> requires that
all <seealso marker="erts:erts_alloc">erts_alloc(3)</seealso>
- allocators are enabled (default behaviour).
- </p>
+ allocators are enabled (default behavior).</p>
</note>
<p>Failures:</p>
<taglist>
<tag><c>badarg</c></tag>
<item>
- If <c><anno>Type</anno></c> is not one of the memory types listed in the
- documentation of
+ If <c><anno>Type</anno></c> is not one of the memory types
+ listed in the description of
<seealso marker="#memory/0">erlang:memory/0</seealso>.
</item>
<tag><c>badarg</c></tag>
<item>
- If <c>maximum</c> is passed as <c><anno>Type</anno></c> and the emulator
- is not run in instrumented mode.
+ If <c>maximum</c> is passed as <c><anno>Type</anno></c> and
+ the emulator is not run in instrumented mode.
</item>
<tag><c>notsup</c></tag>
<item>
@@ -2658,35 +2826,39 @@ os_prompt% </pre>
<seealso marker="#memory/0">erlang:memory/0</seealso>.</p>
</desc>
</func>
+
<func>
<name name="min" arity="2"/>
- <fsummary>Return the smallest of two term</fsummary>
+ <fsummary>Returns the smallest of two terms.</fsummary>
<desc>
- <p>Return the smallest of <c><anno>Term1</anno></c> and <c><anno>Term2</anno></c>;
- if the terms compare equal, <c><anno>Term1</anno></c> will be returned.</p>
+ <p>Returns the smallest of <c><anno>Term1</anno></c> and
+ <c><anno>Term2</anno></c>.
+ If the terms are equal, <c><anno>Term1</anno></c> is returned.</p>
</desc>
</func>
+
<func>
<name name="module_loaded" arity="1"/>
- <fsummary>Check if a module is loaded</fsummary>
+ <fsummary>Checks if a module is loaded.</fsummary>
<desc>
- <p>Returns <c>true</c> if the module <c><anno>Module</anno></c> is loaded,
- otherwise returns <c>false</c>. It does not attempt to load
+ <p>Returns <c>true</c> if the module <c><anno>Module</anno></c>
+ is loaded, otherwise <c>false</c>. It does not attempt to load
the module.</p>
<warning>
<p>This BIF is intended for the code server (see
- <seealso marker="kernel:code">code(3)</seealso>) and should not be
+ <seealso marker="kernel:code">code(3)</seealso>) and is not to be
used elsewhere.</p>
</warning>
</desc>
</func>
+
<func>
<name name="monitor" arity="2" clause_i="1"/>
<name name="monitor" arity="2" clause_i="2"/>
+ <fsummary>Starts monitoring.</fsummary>
<type name="registered_name"/>
<type name="registered_process_identifier"/>
<type name="monitor_process_identifier"/>
- <fsummary>Start monitoring</fsummary>
<desc>
<p>Send a monitor request of type <c><anno>Type</anno></c> to the
entity identified by <c><anno>Item</anno></c>. The caller of
@@ -2694,15 +2866,15 @@ os_prompt% </pre>
following format if the monitored state is changed:</p>
<code type="none">{Tag, <anno>MonitorRef</anno>, <anno>Type</anno>, Object, Info}</code>
<note><p>The monitor request is an asynchronous signal. That is, it
- takes time before the signal reach its destination.</p></note>
- <p>Currently valid <c><anno>Type</anno></c>s:</p>
+ takes time before the signal reaches its destination.</p></note>
+ <p>Valid <c><anno>Type</anno></c>s:</p>
<taglist>
<tag><marker id="monitor_process"/><c>process</c></tag>
<item>
<p>Monitor the existence of the process identified by
- <c><anno>Item</anno></c>. Currently valid
+ <c><anno>Item</anno></c>. Valid
<c><anno>Item</anno></c>s in combination with the
- <c>process <anno>Type</anno></c>:</p>
+ <c>process <anno>Type</anno></c> can be any of the following:</p>
<taglist>
<tag><c>pid()</c></tag>
<item>
@@ -2721,10 +2893,10 @@ os_prompt% </pre>
will become monitored.</p>
</item>
</taglist>
- <note><p>When a process is monitored by registered name, the
- process that has the registered name at the time when the
+ <note><p>When a registered name is used, the
+ process that has the registered name when the
monitor request reach its destination will be monitored.
- The monitor will not be effected, if the registered name is
+ The monitor is not effected if the registered name is
unregistered, or unregistered and later registered on another
process.</p></note>
<p>The monitor is triggered either when the monitored process
@@ -2732,22 +2904,22 @@ os_prompt% </pre>
lost. In the case the connection to it is lost, we do not know
if it still exist or not. After this type of monitor has been
triggered, the monitor is automatically removed.</p>
- <p>When the monitor is triggered a <c>'DOWN'</c> message will
- be sent to the monitoring process. A <c>'DOWN'</c> message has
+ <p>When the monitor is triggered a <c>'DOWN'</c> message is
+ sent to the monitoring process. A <c>'DOWN'</c> message has
the following pattern:</p>
<code type="none">{'DOWN', MonitorRef, Type, Object, Info}</code>
- <p>where <c>MonitorRef</c> and <c>Type</c> are the same as
- described above, and:</p>
+ <p>Here <c>MonitorRef</c> and <c>Type</c> are the same as
+ described earlier, and:</p>
<taglist>
<tag><c>Object</c></tag>
<item>
<p>equals:</p>
<taglist>
<tag><c><anno>Item</anno></c></tag>
- <item>If <c><anno>Item</anno></c> was specified by a
- pid.</item>
+ <item>If <c><anno>Item</anno></c> is specified by a
+ process identifier.</item>
<tag><c>{RegisteredName, Node}</c></tag>
- <item>If <c><anno>Item</anno></c> was specified as
+ <item>If <c><anno>Item</anno></c> is specified as
<c>RegisteredName</c>, or <c>{RegisteredName, Node}</c>
where <c>Node</c> corresponds to the node that the
monitored process resides on.</item>
@@ -2760,26 +2932,26 @@ os_prompt% </pre>
connection to the node where the monitored process
resides).</p></item>
</taglist>
- <p>The monitoring is turned off either when the <c>'DOWN'</c>
- message is sent, or when
+ <p>The monitoring is turned off when the <c>'DOWN'</c>
+ message is sent or when
<seealso marker="#demonitor/1">demonitor/1</seealso>
is called.</p>
<p>If an attempt is made to monitor a process on an older node
- (where remote process monitoring is not implemented or one
+ (where remote process monitoring is not implemented or
where remote process monitoring by registered name is not
implemented), the call fails with <c>badarg</c>.</p>
<note>
- <p>The format of the <c>'DOWN'</c> message changed in the 5.2
- version of the emulator (OTP release R9B) for monitor
- <em>by registered name</em>. The <c>Object</c> element of
+ <p>The format of the <c>'DOWN'</c> message changed in ERTS
+ version 5.2 (OTP R9B) for monitoring
+ <em>by registered name</em>. Element <c>Object</c> of
the <c>'DOWN'</c> message could in earlier versions
- sometimes be the pid of the monitored process and sometimes
- be the registered name. Now the <c>Object</c> element is
+ sometimes be the process identifier of the monitored process and sometimes
+ be the registered name. Now element <c>Object</c> is
always a tuple consisting of the registered name and
- the node name. Processes on new nodes (emulator version 5.2
- or greater) will always get <c>'DOWN'</c> messages on
+ the node name. Processes on new nodes (ERTS version 5.2
+ or higher) always get <c>'DOWN'</c> messages on
the new format even if they are monitoring processes on old
- nodes. Processes on old nodes will always get <c>'DOWN'</c>
+ nodes. Processes on old nodes always get <c>'DOWN'</c>
messages on the old format.</p>
</note>
</item>
@@ -2807,8 +2979,8 @@ os_prompt% </pre>
<seealso marker="time_correction#Single_Time_Warp_Mode">single
time warp mode</seealso> is used. When a change from preliminary
to final time offset is made, the monitor will be triggered once
- regardless of whether the time offset value was changed due to
- the finalization or not.</p>
+ regardless of whether the time offset value was actually changed
+ or not.</p>
<p>If the runtime system is in
<seealso marker="time_correction#Multi_Time_Warp_Mode">multi
@@ -2836,7 +3008,7 @@ os_prompt% </pre>
<p>When the <c>'CHANGE'</c> message has been received you are
guaranteed not to retrieve the old time offset when calling
<seealso marker="#time_offset/0"><c>erlang:time_offset()</c></seealso>.
- Note that you may observe the change of the time offset
+ Note that you can observe the change of the time offset
when calling <c>erlang:time_offset()</c> before you
get the <c>'CHANGE'</c> message.</p>
@@ -2844,67 +3016,71 @@ os_prompt% </pre>
</taglist>
<p>Making several calls to <c>monitor/2</c> for the same
<c><anno>Item</anno></c> and/or <c><anno>Type</anno></c> is not
- an error; it results in many, completely independent,
- monitorings.</p>
+ an error; it results in as many independent monitoring instances.</p>
<p>The monitor functionality is expected to be extended. That is,
other <c><anno>Type</anno></c>s and <c><anno>Item</anno></c>s
- are expected to be supported in the future.</p>
+ are expected to be supported in a future release.</p>
<note>
- <p>If/when <c>monitor/2</c> is extended, other
- possible values for <c>Tag</c>, <c>Object</c>, and
+ <p>If or when <c>monitor/2</c> is extended, other
+ possible values for <c>Tag</c>, <c>Object</c> and
<c>Info</c> in the monitor message will be introduced.</p>
</note>
</desc>
</func>
+
<func>
<name name="monitor_node" arity="2"/>
- <fsummary>Monitor the status of a node</fsummary>
+ <fsummary>Monitors the status of a node.</fsummary>
<desc>
- <p>Monitors the status of the node <c><anno>Node</anno></c>. If <c><anno>Flag</anno></c>
- is <c>true</c>, monitoring is turned on; if <c><anno>Flag</anno></c> is
- <c>false</c>, monitoring is turned off.</p>
+ <p>Monitors the status of the node <c><anno>Node</anno></c>.
+ If <c><anno>Flag</anno></c>
+ is <c>true</c>, monitoring is turned on. If <c><anno>Flag</anno></c>
+ is <c>false</c>, monitoring is turned off.</p>
<p>Making several calls to <c>monitor_node(Node, true)</c> for
- the same <c><anno>Node</anno></c> is not an error; it results in as many,
- completely independent, monitorings.</p>
+ the same <c><anno>Node</anno></c> is not an error; it results
+ in as many independent monitoring instances.</p>
<p>If <c><anno>Node</anno></c> fails or does not exist, the message
<c>{nodedown, Node}</c> is delivered to the process. If a
process has made two calls to <c>monitor_node(Node, true)</c>
- and <c><anno>Node</anno></c> terminates, two <c>nodedown</c> messages are
- delivered to the process. If there is no connection to
- <c><anno>Node</anno></c>, there will be an attempt to create one. If this
- fails, a <c>nodedown</c> message is delivered.</p>
+ and <c><anno>Node</anno></c> terminates, two <c>nodedown</c> messages
+ are delivered to the process. If there is no connection to
+ <c><anno>Node</anno></c>, an attempt is made to create one.
+ If this fails, a <c>nodedown</c> message is delivered.</p>
<p>Nodes connected through hidden connections can be monitored
- as any other node.</p>
+ as any other nodes.</p>
<p>Failure: <c>badarg</c> if the local node is not alive.</p>
</desc>
</func>
+
<func>
<name name="monitor_node" arity="3"/>
- <fsummary>Monitor the status of a node</fsummary>
+ <fsummary>Monitors the status of a node.</fsummary>
<desc>
- <p>Behaves as <c>monitor_node/2</c> except that it allows an
+ <p>Behaves as
+ <seealso marker="#monitor_node/2">monitor_node/2</seealso>
+ except that it allows an
extra option to be given, namely <c>allow_passive_connect</c>.
- The option allows the BIF to wait the normal net connection
- timeout for the <em>monitored node</em> to connect itself,
+ This option allows the BIF to wait the normal network connection
+ time-out for the <em>monitored node</em> to connect itself,
even if it cannot be actively connected from this node
- (i.e. it is blocked). The state where this might be useful can
- only be achieved by using the kernel option
- <c>dist_auto_connect once</c>. If that kernel option is not
- used, the <c>allow_passive_connect</c> option has no
- effect.</p>
+ (that is, it is blocked). The state where this can be useful
+ can only be achieved by using the <c>Kernel</c> option
+ <c>dist_auto_connect once</c>. If that option is not
+ used, option <c>allow_passive_connect</c> has no effect.</p>
<note>
- <p>The <c>allow_passive_connect</c> option is used
+ <p>Option <c>allow_passive_connect</c> is used
internally and is seldom needed in applications where the
- network topology and the kernel options in effect is known in
- advance.</p>
+ network topology and the <c>Kernel</c> options in effect
+ are known in advance.</p>
</note>
<p>Failure: <c>badarg</c> if the local node is not alive or the
option list is malformed.</p>
</desc>
</func>
+
<func>
<name name="monotonic_time" arity="0"/>
- <fsummary>Current Erlang monotonic time</fsummary>
+ <fsummary>Current Erlang monotonic time.</fsummary>
<desc>
<p>Returns the current
<seealso marker="time_correction#Erlang_Monotonic_Time">Erlang
@@ -2917,7 +3093,7 @@ os_prompt% </pre>
<seealso marker="time_correction#Monotonically_Increasing">monotonically increasing</seealso> time, but <em>not</em> a
<seealso marker="time_correction#Strictly_Monotonically_Increasing">strictly monotonically increasing</seealso>
time. That is, consecutive calls to
- <c>erlang:monotonic_time/0</c> may produce the same result.</p>
+ <c>erlang:monotonic_time/0</c> can produce the same result.</p>
<p>Different runtime system instances will use different
unspecified points in time as base for their Erlang monotonic clocks.
@@ -2925,9 +3101,9 @@ os_prompt% </pre>
different runtime system instances. Different runtime system instances
may also place this unspecified point in time different relative
runtime system start. It may be placed in the future (time at start
- will be a negative value), the past (time at start will be a
- positive value), or the runtime system start (time at start will
- be zero). The monotonic time as of runtime system start can be
+ is a negative value), the past (time at start is a
+ positive value), or the runtime system start (time at start is
+ zero). The monotonic time at runtime system start can be
retrieved by calling
<seealso marker="#system_info_start_time"><c>erlang:system_info(start_time)</c></seealso>.</p></note>
</desc>
@@ -2949,61 +3125,68 @@ os_prompt% </pre>
</func>
<func>
<name name="nif_error" arity="1"/>
- <fsummary>Stop execution with a given reason</fsummary>
+ <fsummary>Stops execution with a given reason.</fsummary>
<desc>
<p>Works exactly like
- <seealso marker="#error/1">erlang:error/1</seealso>,
- but Dialyzer thinks that this BIF will return an arbitrary term.
- When used in a stub function for a NIF to generate an
- exception when the NIF library is not loaded, Dialyzer
- will not generate false warnings.</p>
+ <seealso marker="#error/1">erlang:error/1</seealso>, but
+ <c>Dialyzer</c> thinks that this BIF will return an arbitrary
+ term. When used in a stub function for a NIF to generate an
+ exception when the NIF library is not loaded, <c>Dialyzer</c>
+ does not generate false warnings.</p>
</desc>
</func>
+
<func>
<name name="nif_error" arity="2"/>
- <fsummary>Stop execution with a given reason</fsummary>
+ <fsummary>Stops execution with a given reason.</fsummary>
<desc>
<p>Works exactly like
- <seealso marker="#error/2">erlang:error/2</seealso>,
- but Dialyzer thinks that this BIF will return an arbitrary term.
- When used in a stub function for a NIF to generate an
- exception when the NIF library is not loaded, Dialyzer
- will not generate false warnings.</p>
+ <seealso marker="#error/2">erlang:error/2</seealso>, but
+ <c>Dialyzer</c> thinks that this BIF will return an arbitrary
+ term. When used in a stub function for a NIF to generate an
+ exception when the NIF library is not loaded, <c>Dialyzer</c>
+ does not generate false warnings.</p>
</desc>
</func>
+
<func>
<name name="node" arity="0"/>
- <fsummary>Name of the local node</fsummary>
+ <fsummary>Name of the local node.</fsummary>
<desc>
<p>Returns the name of the local node. If the node is not alive,
<c>nonode@nohost</c> is returned instead.</p>
<p>Allowed in guard tests.</p>
</desc>
</func>
+
<func>
<name name="node" arity="1"/>
- <fsummary>At which node is a pid, port or reference located</fsummary>
+ <fsummary>At which node a pid, port, or reference originates.</fsummary>
<desc>
- <p>Returns the node where <c><anno>Arg</anno></c> is located. <c><anno>Arg</anno></c> can
- be a pid, a reference, or a port. If the local node is not
+ <p>Returns the node where <c><anno>Arg</anno></c> originates.
+ <c><anno>Arg</anno></c> can
+ be a process identifier, a reference, or a port.
+ If the local node is not
alive, <c>nonode@nohost</c> is returned.</p>
<p>Allowed in guard tests.</p>
</desc>
</func>
+
<func>
<name name="nodes" arity="0"/>
- <fsummary>All visible nodes in the system</fsummary>
+ <fsummary>All visible nodes in the system.</fsummary>
<desc>
- <p>Returns a list of all visible nodes in the system, excluding
+ <p>Returns a list of all visible nodes in the system, except
the local node. Same as <c>nodes(visible)</c>.</p>
</desc>
</func>
+
<func>
<name name="nodes" arity="1"/>
- <fsummary>All nodes of a certain type in the system</fsummary>
+ <fsummary>All nodes of a certain type in the system.</fsummary>
<desc>
- <p>Returns a list of nodes according to argument given.
- The result returned when the argument is a list, is the list
+ <p>Returns a list of nodes according to the argument given.
+ The returned result when the argument is a list, is the list
of nodes satisfying the disjunction(s) of the list elements.</p>
<p><c><anno>NodeType</anno></c> can be any of the following:</p>
<taglist>
@@ -3025,22 +3208,26 @@ os_prompt% </pre>
</item>
<tag><c>known</c></tag>
<item>
- <p>Nodes which are known to this node, i.e., connected,
- previously connected, etc.</p>
+ <p>Nodes that are known to this node. That is, connected
+ nodes and nodes referred to by process identifiers, port
+ identifiers and references located on this node.
+ The set of known nodes is garbage collected. Notice that
+ this garbage collection can be delayed. For more
+ information, see
+ <seealso marker="erlang#system_info_delayed_node_table_gc">delayed_node_table_gc</seealso>.
+ </p>
</item>
</taglist>
<p>Some equalities: <c>[node()] = nodes(this)</c>,
<c>nodes(connected) = nodes([visible, hidden])</c>, and
<c>nodes() = nodes(visible)</c>.</p>
- <p>If the local node is not alive,
- <c>nodes(this) == nodes(known) == [nonode@nohost]</c>, for
- any other <c><anno>Arg</anno></c> the empty list [] is returned.</p>
</desc>
</func>
+
<func>
<name name="now" arity="0"/>
+ <fsummary>Elapsed time since 00:00 GMT.</fsummary>
<type name="timestamp"/>
- <fsummary>Elapsed time since 00:00 GMT</fsummary>
<desc>
<warning><p><em>This function is deprecated! Do not use it!</em>
See the users guide chapter
@@ -3050,107 +3237,101 @@ os_prompt% </pre>
section for information on what to use instead of <c>erlang:now/0</c>.
</p></warning>
<p>Returns the tuple <c>{MegaSecs, Secs, MicroSecs}</c> which is
- the elapsed time since 00:00 GMT, January 1, 1970 (zero hour)
+ the elapsed time since 00:00 GMT, January 1, 1970 (zero hour),
on the assumption that the underlying OS supports this.
- Otherwise, some other point in time is chosen. It is also
- guaranteed that subsequent calls to this BIF returns
+ Otherwise some other point in time is chosen. It is also
+ guaranteed that subsequent calls to this BIF return
continuously increasing values. Hence, the return value from
- <c>now()</c> can be used to generate unique time-stamps,
- and if it is called in a tight loop on a fast machine
+ <c>now()</c> can be used to generate unique time-stamps.
+ If it is called in a tight loop on a fast machine,
the time of the node can become skewed.</p>
- <p>It can only be used to check the local time of day if
- the time-zone info of the underlying operating system is
+ <p>Can only be used to check the local time of day if
+ the time-zone information of the underlying OS is
properly configured.</p>
</desc>
</func>
+
<func>
<name name="open_port" arity="2"/>
- <fsummary>Open a port</fsummary>
+ <fsummary>Opens a port.</fsummary>
<desc>
<p>Returns a port identifier as the result of opening a
new Erlang port. A port can be seen as an external Erlang
- process.
- </p>
+ process.</p>
<p>The name of the executable as well as the arguments
- given in <c>cd</c>, <c>env</c>, <c>args</c> and <c>arg0</c> is subject to
- Unicode file name translation if the system is running
+ given in <c>cd</c>, <c>env</c>, <c>args</c>, and <c>arg0</c> are
+ subject to Unicode file name translation if the system is running
in Unicode file name mode. To avoid
- translation or force i.e. UTF-8, supply the executable
+ translation or to force, for example UTF-8, supply the executable
and/or arguments as a binary in the correct
- encoding. See the <seealso
- marker="kernel:file">file</seealso> module, the
- <seealso marker="kernel:file#native_name_encoding/0">
- file:native_name_encoding/0</seealso> function and the
- <seealso marker="stdlib:unicode_usage">stdlib users guide
- </seealso> for details.</p>
-
- <note><p>The characters in the name (if given as a list)
- can only be &gt; 255 if the Erlang VM is started in
- Unicode file name translation mode, otherwise the name
+ encoding. For details, see the module
+ <seealso marker="kernel:file">file</seealso>, the function
+ <seealso marker="kernel:file#native_name_encoding/0">file:native_name_encoding/0</seealso>, and the
+ <seealso marker="stdlib:unicode_usage">STDLIB </seealso>
+ User's Guide.</p>
+ <note><p>The characters in the name (if given as a list) can
+ only be higher than 255 if the Erlang Virtual Machine is started
+ in Unicode file name translation mode. Otherwise the name
of the executable is limited to the ISO-latin-1
character set.</p></note>
-
- <p><c><anno>PortName</anno></c> is one of the following:</p>
+ <p><c><anno>PortName</anno></c> can be any of the following:</p>
<taglist>
<tag><c>{spawn, <anno>Command</anno>}</c></tag>
<item>
- <p>Starts an external program. <c><anno>Command</anno></c> is the name
- of the external program which will be run. <c><anno>Command</anno></c>
+ <p>Starts an external program. <c><anno>Command</anno></c>
+ is the name of the external program to be run.
+ <c><anno>Command</anno></c>
runs outside the Erlang work space unless an Erlang
- driver with the name <c><anno>Command</anno></c> is found. If found,
- that driver will be started. A driver runs in the Erlang
- workspace, which means that it is linked with the Erlang
+ driver with the name <c><anno>Command</anno></c> is found.
+ If found, that driver is started. A driver runs in the Erlang
+ work space, which means that it is linked with the Erlang
runtime system.</p>
<p>When starting external programs on Solaris, the system
call <c>vfork</c> is used in preference to <c>fork</c>
for performance reasons, although it has a history of
- being less robust. If there are problems with using
- <c>vfork</c>, setting the environment variable
- <c>ERL_NO_VFORK</c> to any value will cause <c>fork</c>
+ being less robust. If there are problems using
+ <c>vfork</c>, setting environment variable
+ <c>ERL_NO_VFORK</c> to any value causes <c>fork</c>
to be used instead.</p>
-
- <p>For external programs, the <c>PATH</c> is searched
+ <p>For external programs, <c>PATH</c> is searched
(or an equivalent method is used to find programs,
- depending on operating system). This is done by invoking
- the shell on certain platforms. The first space
- separated token of the command will be considered as the
+ depending on OS). This is done by invoking
+ the shell on certain platforms. The first space-separated
+ token of the command is considered as the
name of the executable (or driver). This (among other
things) makes this option unsuitable for running
- programs having spaces in file or directory names. Use
- {spawn_executable, <anno>Command</anno>} instead if spaces in executable
- file names is desired.</p>
+ programs having spaces in file names or directory names.
+ If spaces in executable file names are desired, use
+ <c>{spawn_executable, <anno>Command</anno>}</c> instead.</p>
</item>
<tag><c>{spawn_driver, <anno>Command</anno>}</c></tag>
<item>
<p>Works like <c>{spawn, <anno>Command</anno>}</c>, but demands the
- first (space separated) token of the command to be the name of a
+ first (space-separated) token of the command to be the name of a
loaded driver. If no driver with that name is loaded, a
<c>badarg</c> error is raised.</p>
</item>
<tag><c>{spawn_executable, <anno>FileName</anno>}</c></tag>
<item>
-
<p>Works like <c>{spawn, <anno>FileName</anno>}</c>, but only runs
- external executables. The <c><anno>FileName</anno></c> in its whole
- is used as the name of the executable, including any
- spaces. If arguments are to be passed, the
- <c>args</c> and <c>arg0</c> <c><anno>PortSettings</anno></c> can be used.</p>
-
- <p>The shell is not usually invoked to start the
- program, it's executed directly. Neither is the
- <c>PATH</c> (or equivalent) searched. To find a program
- in the PATH to execute, use <seealso
- marker="kernel:os#find_executable/1">os:find_executable/1</seealso>.</p>
+ external executables. <c><anno>FileName</anno></c> in its whole
+ is used as the name of the executable, including any spaces.
+ If arguments are to be passed, the <c><anno>PortSettings</anno></c>
+ <c>args</c> and <c>arg0</c> can be used.</p>
+ <p>The shell is usually not invoked to start the
+ program, it is executed directly. <c>PATH</c> (or
+ equivalent) is not searched. To find a program
+ in <c>PATH</c> to execute, use
+ <seealso marker="kernel:os#find_executable/1">os:find_executable/1</seealso>.</p>
<p>Only if a shell script or <c>.bat</c> file is
- executed, the appropriate command interpreter will
- implicitly be invoked, but there will still be no
- command argument expansion or implicit PATH search.</p>
-
- <p>If the <c><anno>FileName</anno></c> cannot be run, an error
- exception, with the posix error code as the reason, is
- raised. The error reason may differ between operating
- systems. Typically the error <c>enoent</c> is raised
- when one tries to run a program that is not found and
+ executed, the appropriate command interpreter is
+ invoked implicitly, but there is still no
+ command argument expansion or implicit <c>PATH</c> search.</p>
+ <p>If <c><anno>FileName</anno></c> cannot be run, an error
+ exception is raised, with the POSIX error code as the reason.
+ The error reason can differ between OSs.
+ Typically the error <c>enoent</c> is raised when an
+ attempt is made to run a program that is not found and
<c>eacces</c> is raised when the given file is not
executable.</p>
</item>
@@ -3160,19 +3341,18 @@ os_prompt% </pre>
file descriptors used by Erlang. The file descriptor
<c><anno>In</anno></c> can be used for standard input, and the file
descriptor <c><anno>Out</anno></c> for standard output. It is only
- used for various servers in the Erlang operating system
- (<c>shell</c> and <c>user</c>). Hence, its use is very
- limited.</p>
+ used for various servers in the Erlang OS (<c>shell</c>
+ and <c>user</c>). Hence, its use is limited.</p>
</item>
</taglist>
<p><c><anno>PortSettings</anno></c> is a list of settings for the port.
- Valid settings are:</p>
+ The valid settings are as follows:</p>
<taglist>
<tag><c>{packet, <anno>N</anno>}</c></tag>
<item>
<p>Messages are preceded by their length, sent in <c><anno>N</anno></c>
- bytes, with the most significant byte first. Valid values
- for <c>N</c> are 1, 2, or 4.</p>
+ bytes, with the most significant byte first. The valid values
+ for <c>N</c> are 1, 2, and 4.</p>
</item>
<tag><c>stream</c></tag>
<item>
@@ -3183,116 +3363,108 @@ os_prompt% </pre>
<tag><c>{line, <anno>L</anno>}</c></tag>
<item>
<p>Messages are delivered on a per line basis. Each line
- (delimited by the OS-dependent newline sequence) is
- delivered in one single message. The message data format
- is <c>{Flag, Line}</c>, where <c>Flag</c> is either
- <c>eol</c> or <c>noeol</c> and <c>Line</c> is the actual
- data delivered (without the newline sequence).</p>
+ (delimited by the OS-dependent new line sequence) is
+ delivered in a single message. The message data format
+ is <c>{Flag, Line}</c>, where <c>Flag</c> is
+ <c>eol</c> or <c>noeol</c>, and <c>Line</c> is the
+ data delivered (without the new line sequence).</p>
<p><c><anno>L</anno></c> specifies the maximum line length in bytes.
- Lines longer than this will be delivered in more than one
- message, with the <c>Flag</c> set to <c>noeol</c> for all
+ Lines longer than this are delivered in more than one
+ message, with <c>Flag</c> set to <c>noeol</c> for all
but the last message. If end of file is encountered
- anywhere else than immediately following a newline
- sequence, the last line will also be delivered with
- the <c>Flag</c> set to <c>noeol</c>. In all other cases,
+ anywhere else than immediately following a new line
+ sequence, the last line is also delivered with
+ <c>Flag</c> set to <c>noeol</c>. Otherwise
lines are delivered with <c>Flag</c> set to <c>eol</c>.</p>
- <p>The <c>{packet, <anno>N</anno>}</c> and <c>{line, <anno>L</anno>}</c> settings are
- mutually exclusive.</p>
+ <p>The <c>{packet, <anno>N</anno>}</c> and <c>{line,
+ <anno>L</anno>}</c> settings are mutually exclusive.</p>
</item>
<tag><c>{cd, <anno>Dir</anno>}</c></tag>
<item>
- <p>This is only valid for <c>{spawn, <anno>Command</anno>}</c> and
- <c>{spawn_executable, <anno>FileName</anno>}</c>.
+ <p>Only valid for <c>{spawn, <anno>Command</anno>}</c> and
+ <c>{spawn_executable, <anno>FileName</anno>}</c>.
The external program starts using <c><anno>Dir</anno></c> as its
- working directory. <c><anno>Dir</anno></c> must be a string.
- </p>
+ working directory. <c><anno>Dir</anno></c> must be a string.</p>
</item>
<tag><c>{env, <anno>Env</anno>}</c></tag>
<item>
- <p>This is only valid for <c>{spawn, <anno>Command</anno>}</c> and
+ <p>Only valid for <c>{spawn, <anno>Command</anno>}</c> and
<c>{spawn_executable, <anno>FileName</anno>}</c>.
The environment of the started process is extended using
the environment specifications in <c><anno>Env</anno></c>.</p>
- <p><c><anno>Env</anno></c> should be a list of tuples <c>{<anno>Name</anno>, <anno>Val</anno>}</c>,
- where <c><anno>Name</anno></c> is the name of an environment variable,
- and <c><anno>Val</anno></c> is the value it is to have in the spawned
- port process. Both <c><anno>Name</anno></c> and <c><anno>Val</anno></c> must be
- strings. The one exception is <c><anno>Val</anno></c> being the atom
+ <p><c><anno>Env</anno></c> is to be a list of tuples
+ <c>{<anno>Name</anno>, <anno>Val</anno>}</c>,
+ where <c><anno>Name</anno></c> is the name of an
+ environment variable, and <c><anno>Val</anno></c> is the
+ value it is to have in the spawned
+ port process. Both <c><anno>Name</anno></c> and
+ <c><anno>Val</anno></c> must be strings. The one
+ exception is <c><anno>Val</anno></c> being the atom
<c>false</c> (in analogy with <c>os:getenv/1</c>), which
- removes the environment variable.
- </p>
+ removes the environment variable.</p>
</item>
<tag><c>{args, [ string() | binary() ]}</c></tag>
<item>
-
- <p>This option is only valid for <c>{spawn_executable, <anno>FileName</anno>}</c>
+ <p>Only valid for <c>{spawn_executable, <anno>FileName</anno>}</c>
and specifies arguments to the executable. Each argument
is given as a separate string and (on Unix) eventually
ends up as one element each in the argument vector. On
- other platforms, similar behavior is mimicked.</p>
-
- <p>The arguments are not expanded by the shell prior to
- being supplied to the executable, most notably this
- means that file wildcard expansion will not happen. Use
- <seealso
- marker="stdlib:filelib#wildcard/1">filelib:wildcard/1</seealso>
- to expand wildcards for the arguments. Note that even if
+ other platforms, a similar behavior is mimicked.</p>
+ <p>The arguments are not expanded by the shell before
+ being supplied to the executable. Most notably this
+ means that file wild card expansion does not happen.
+ To expand wild cards for the arguments, use
+ <seealso marker="stdlib:filelib#wildcard/1">filelib:wildcard/1</seealso>.
+ Notice that even if
the program is a Unix shell script, meaning that the
- shell will ultimately be invoked, wildcard expansion
- will not happen and the script will be provided with the
- untouched arguments. On Windows&reg;, wildcard expansion
- is always up to the program itself, why this isn't an
- issue.</p>
-
- <p>Note also that the actual executable name (a.k.a. <c>argv[0]</c>)
- should not be given in this list. The proper executable name will
- automatically be used as argv[0] where applicable.</p>
-
- <p>If one, for any reason, wants to explicitly set the
- program name in the argument vector, the <c>arg0</c>
- option can be used.</p>
-
+ shell ultimately is invoked, wild card expansion
+ does not happen, and the script is provided with the
+ untouched arguments. On Windows, wild card expansion
+ is always up to the program itself, therefore this is
+ not an issue issue.</p>
+ <p>The executable name (also known as <c>argv[0]</c>)
+ is not to be given in this list. The proper executable name
+ is automatically used as argv[0], where applicable.</p>
+ <p>If you explicitly want to set the
+ program name in the argument vector, option <c>arg0</c>
+ can be used.</p>
</item>
<tag><c>{arg0, string() | binary()}</c></tag>
<item>
-
- <p>This option is only valid for <c>{spawn_executable, <anno>FileName</anno>}</c>
+ <p>Only valid for <c>{spawn_executable, <anno>FileName</anno>}</c>
and explicitly specifies the program name argument when
- running an executable. This might in some circumstances,
- on some operating systems, be desirable. How the program
- responds to this is highly system dependent and no specific
+ running an executable. This can in some circumstances,
+ on some OSs, be desirable. How the program
+ responds to this is highly system-dependent and no specific
effect is guaranteed.</p>
-
</item>
-
<tag><c>exit_status</c></tag>
<item>
- <p>This is only valid for <c>{spawn, <anno>Command</anno>}</c> where
- <c><anno>Command</anno></c> refers to an external program, and for
- <c>{spawn_executable, <anno>FileName</anno>}</c>.</p>
+ <p>Only valid for <c>{spawn, <anno>Command</anno>}</c>, where
+ <c><anno>Command</anno></c> refers to an external program, and
+ for <c>{spawn_executable, <anno>FileName</anno>}</c>.</p>
<p>When the external process connected to the port exits, a
message of the form <c>{Port,{exit_status,Status}}</c> is
sent to the connected process, where <c>Status</c> is the
exit status of the external process. If the program
- aborts, on Unix the same convention is used as the shells
- do (i.e., 128+signal).</p>
- <p>If the <c>eof</c> option has been given as well,
- the <c>eof</c> message and the <c>exit_status</c> message
- appear in an unspecified order.</p>
- <p>If the port program closes its stdout without exiting,
- the <c>exit_status</c> option will not work.</p>
+ aborts on Unix, the same convention is used as the shells
+ do (that is, 128+signal).</p>
+ <p>If option <c>eof</c> is also given, the messages <c>eof</c>
+ and <c>exit_status</c> appear in an unspecified order.</p>
+ <p>If the port program closes its <c>stdout</c> without exiting,
+ option <c>exit_status</c> does not work.</p>
</item>
<tag><c>use_stdio</c></tag>
<item>
- <p>This is only valid for <c>{spawn, <anno>Command</anno>}</c> and
+ <p>Only valid for <c>{spawn, <anno>Command</anno>}</c> and
<c>{spawn_executable, <anno>FileName</anno>}</c>. It
allows the standard input and output (file descriptors 0
- and 1) of the spawned (UNIX) process for communication
+ and 1) of the spawned (Unix) process for communication
with Erlang.</p>
</item>
<tag><c>nouse_stdio</c></tag>
<item>
- <p>The opposite of <c>use_stdio</c>. Uses file descriptors
+ <p>The opposite of <c>use_stdio</c>. It uses file descriptors
3 and 4 for communication with Erlang.</p>
</item>
<tag><c>stderr_to_stdout</c></tag>
@@ -3304,14 +3476,15 @@ os_prompt% </pre>
</item>
<tag><c>overlapped_io</c></tag>
<item>
- <p>Affects ports to external programs on Windows&reg; only.
- The standard input and standard output handles of the port program
- will, if this option is supplied, be opened with the flag
- FILE_FLAG_OVERLAPPED, so that the port program can (and has to) do
+ <p>Affects ports to external programs on Windows only. The
+ standard input and standard output handles of the port program
+ are, if this option is supplied, opened with flag
+ <c>FILE_FLAG_OVERLAPPED</c>, so that the port program can
+ (and must) do
overlapped I/O on its standard handles. This is not normally
the case for simple port programs, but an option of value for the
- experienced Windows programmer. <em>On all other platforms, this
- option is silently discarded</em>.</p>
+ experienced Windows programmer. <em>On all other platforms, this
+ option is silently discarded.</em></p>
</item>
<tag><c>in</c></tag>
<item>
@@ -3323,345 +3496,354 @@ os_prompt% </pre>
</item>
<tag><c>binary</c></tag>
<item>
- <p>All IO from the port are binary data objects as opposed
+ <p>All I/O from the port is binary data objects as opposed
to lists of bytes.</p>
</item>
<tag><c>eof</c></tag>
<item>
- <p>The port will not be closed at the end of the file and
- produce an exit signal. Instead, it will remain open and
- a <c>{Port, eof}</c> message will be sent to the process
+ <p>The port is not closed at the end of the file and does not
+ produce an exit signal. Instead, it remains open and
+ a <c>{Port, eof}</c> message is sent to the process
holding the port.</p>
</item>
<tag><c>hide</c></tag>
<item>
- <p>When running on Windows, suppress creation of a new
+ <p>When running on Windows, suppresses creation of a new
console window when spawning the port program.
(This option has no effect on other platforms.)</p>
</item>
- <tag><marker id="open_port_parallelism"><c>{parallelism, Boolean}</c></marker></tag>
+ <tag><c>{parallelism, Boolean}</c></tag>
<item>
- <p>Set scheduler hint for port parallelism. If set to <c>true</c>,
- the VM will schedule port tasks when doing so will improve
- parallelism in the system. If set to <c>false</c>, the VM will
- try to perform port tasks immediately, improving latency at the
- expense of parallelism. The default can be set on system startup
- by passing the
- <seealso marker="erl#+spp">+spp</seealso> command line argument
- to <seealso marker="erl">erl(1)</seealso>.
- </p>
+ <marker id="open_port_parallelism"></marker>
+ <p>Sets scheduler hint for port parallelism. If set to
+ <c>true</c>, the Virtual Machine schedules port tasks;
+ when doing so, it improves parallelism in the system. If set
+ to <c>false</c>, the Virtual Machine tries to
+ perform port tasks immediately, improving latency at the
+ expense of parallelism. The default can be set at system startup
+ by passing command-line argument
+ <seealso marker="erl#+spp">+spp</seealso> to <c>erl(1)</c>.</p>
</item>
</taglist>
- <p>The default is <c>stream</c> for all types of port and
+ <p>Default is <c>stream</c> for all port types and
<c>use_stdio</c> for spawned ports.</p>
<p>Failure: If the port cannot be opened, the exit reason is
- <c>badarg</c>, <c>system_limit</c>, or the Posix error code which
- most closely describes the error, or <c>einval</c> if no Posix code
- is appropriate:</p>
+ <c>badarg</c>, <c>system_limit</c>, or the POSIX error code that
+ most closely describes the error, or <c>einval</c> if no POSIX
+ code is appropriate:</p>
<taglist>
<tag><c>badarg</c></tag>
- <item>
- <p>Bad input arguments to <c>open_port</c>.</p>
+ <item>Bad input arguments to <c>open_port</c>.
</item>
<tag><c>system_limit</c></tag>
- <item>
- <p>All available ports in the Erlang emulator are in use.</p>
+ <item>All available ports in the Erlang emulator are in use.
</item>
<tag><c>enomem</c></tag>
- <item>
- <p>There was not enough memory to create the port.</p>
+ <item>Not enough memory to create the port.
</item>
<tag><c>eagain</c></tag>
- <item>
- <p>There are no more available operating system processes.</p>
+ <item>No more available OS processes.
</item>
<tag><c>enametoolong</c></tag>
- <item>
- <p>The external command given was too long.</p>
+ <item>Too long external command.
</item>
<tag><c>emfile</c></tag>
- <item>
- <p>There are no more available file descriptors (for the operating system process
- that the Erlang emulator runs in).</p>
+ <item>No more available file descriptors (for the
+ OS process that the Erlang emulator runs in).
</item>
<tag><c>enfile</c></tag>
- <item>
- <p>The file table is full (for the entire operating system).</p>
+ <item>Full file table (for the entire OS).
</item>
<tag><c>eacces</c></tag>
- <item>
- <p>The <c>Command</c> given in <c>{spawn_executable, Command}</c> does not point out an executable file.</p>
+ <item><c>Command</c> given in <c>{spawn_executable, Command}</c>
+ does not point out an executable file.
</item>
<tag><c>enoent</c></tag>
- <item>
- <p>The <c><anno>FileName</anno></c> given in <c>{spawn_executable, <anno>FileName</anno>}</c> does not point out an existing file.</p>
+ <item><c><anno>FileName</anno></c> given in
+ <c>{spawn_executable, <anno>FileName</anno>}</c>
+ does not point out an existing file.
</item>
</taglist>
<p>During use of a port opened using <c>{spawn, Name}</c>,
- <c>{spawn_driver, Name}</c> or <c>{spawn_executable, Name}</c>,
+ <c>{spawn_driver, Name}</c>, or <c>{spawn_executable, Name}</c>,
errors arising when sending messages to it are reported to
the owning process using signals of the form
- <c>{'EXIT', Port, PosixCode}</c>. See <c>file(3)</c> for
- possible values of <c>PosixCode</c>.</p>
+ <c>{'EXIT', Port, PosixCode}</c>. For the possible values of
+ <c>PosixCode</c>, see the
+ <seealso marker="kernel:file">file(3)</seealso>
+ manual page in <c>Kernel</c>.</p>
<p>The maximum number of ports that can be open at the same
- time can be configured by passing the
- <seealso marker="erl#max_ports"><c>+Q</c></seealso>
- command line flag to
- <seealso marker="erl"><c>erl(1)</c></seealso>.</p>
+ time can be configured by passing command-line flag
+ <seealso marker="erl#max_ports"><c>+Q</c></seealso> to
+ <c>erl(1)</c>.</p>
</desc>
</func>
+
<func>
<name name="phash" arity="2"/>
+ <fsummary>Portable hash function.</fsummary>
<type_desc variable="Range">Range = 1..2^32, Hash = 1..Range</type_desc>
- <fsummary>Portable hash function</fsummary>
<desc>
- <p>Portable hash function that will give the same hash for
+ <p>Portable hash function that gives the same hash for
the same Erlang term regardless of machine architecture and
- ERTS version (the BIF was introduced in ERTS 4.9.1.1). Range
- can be between 1 and 2^32, the function returns a hash value
- for <c><anno>Term</anno></c> within the range <c>1..<anno>Range</anno></c>.</p>
- <p>This BIF could be used instead of the old deprecated
- <c>erlang:hash/2</c> BIF, as it calculates better hashes for
- all data-types, but consider using <c>phash2/1,2</c> instead.</p>
+ <c>ERTS</c> version (the BIF was introduced in <c>ERTS</c> 4.9.1.1).
+ The function returns a hash value for
+ <c><anno>Term</anno></c> within the range
+ <c>1..<anno>Range</anno></c>. The maximum value for
+ <c><anno>Range</anno></c> is 2^32.</p>
+ <p>This BIF can be used instead of the old deprecated BIF
+ <c>erlang:hash/2</c>, as it calculates better hashes for
+ all data types, but consider using <c>phash2/1,2</c> instead.</p>
</desc>
</func>
+
<func>
<name name="phash2" arity="1"/>
<name name="phash2" arity="2"/>
+ <fsummary>Portable hash function.</fsummary>
<type_desc variable="Range">1..2^32</type_desc>
<type_desc variable="Hash">0..Range-1</type_desc>
- <fsummary>Portable hash function</fsummary>
<desc>
- <p>Portable hash function that will give the same hash for
+ <p>Portable hash function that gives the same hash for
the same Erlang term regardless of machine architecture and
- ERTS version (the BIF was introduced in ERTS 5.2). Range can
- be between 1 and 2^32, the function returns a hash value for
- <c><anno>Term</anno></c> within the range <c>0..<anno>Range</anno>-1</c>. When called
- without the <c><anno>Range</anno></c> argument, a value in the range
- <c>0..2^27-1</c> is returned.</p>
- <p>This BIF should always be used for hashing terms. It
+ <c>ERTS</c> version (the BIF was introduced in <c>ERTS</c> 5.2).
+ The function returns a hash value for
+ <c><anno>Term</anno></c> within the range
+ <c>0..<anno>Range</anno>-1</c>. The maximum value for
+ <c><anno>Range</anno></c> is 2^32. When without argument
+ <c><anno>Range</anno></c>, a value in the range
+ 0..2^27-1 is returned.</p>
+ <p>This BIF is always to be used for hashing terms. It
distributes small integers better than <c>phash/2</c>, and
it is faster for bignums and binaries.</p>
- <p>Note that the range <c>0..<anno>Range</anno>-1</c> is different from
- the range of <c>phash/2</c> (<c>1..<anno>Range</anno></c>).</p>
+ <p>Notice that the range <c>0..<anno>Range</anno>-1</c> is
+ different from the range of <c>phash/2</c>, which is
+ <c>1..<anno>Range</anno></c>.</p>
</desc>
</func>
+
<func>
<name name="pid_to_list" arity="1"/>
- <fsummary>Text representation of a pid</fsummary>
+ <fsummary>Text representation of a pid.</fsummary>
<desc>
- <p>Returns a string which corresponds to the text
+ <p>Returns a string corresponding to the text
representation of <c><anno>Pid</anno></c>.</p>
<warning>
- <p>This BIF is intended for debugging and for use in
- the Erlang operating system. It should not be used in
- application programs.</p>
+ <p>This BIF is intended for debugging and is not to be used
+ in application programs.</p>
</warning>
</desc>
</func>
+
<func>
<name name="port_close" arity="1"/>
- <fsummary>Close an open port</fsummary>
+ <fsummary>Closes an open port.</fsummary>
<desc>
<p>Closes an open port. Roughly the same as
- <c><anno>Port</anno> ! {self(), close}</c> except for the error behaviour
- (see below), being synchronous, and that the port does
- <em>not</em> reply with <c>{Port, closed}</c>. Any process may
+ <c><anno>Port</anno> ! {self(), close}</c> except for the error behavior
+ (see the following), being synchronous, and that the port does
+ <em>not</em> reply with <c>{Port, closed}</c>. Any process can
close a port with <c>port_close/1</c>, not only the port owner
(the connected process). If the calling process is linked to
- port identified by <c><anno>Port</anno></c>, an exit signal due
- to that link will be received by the process prior to the return
- from <c>port_close/1</c>.</p>
- <p>For comparison: <c><anno>Port</anno> ! {self(), close}</c> fails with
- <c>badarg</c> if <c><anno>Port</anno></c> cannot be sent to (i.e.,
- <c><anno>Port</anno></c> refers neither to a port nor to a process). If
- <c><anno>Port</anno></c> is a closed port nothing happens. If <c><anno>Port</anno></c>
+ the port identified by <c><anno>Port</anno></c>, the exit
+ signal from the port is guaranteed to be delivered before
+ <c>port_close/1</c> returns.</p>
+ <p>For comparison: <c><anno>Port</anno> ! {self(), close}</c>
+ only fails with <c>badarg</c> if <c><anno>Port</anno></c> does
+ not refer to a port or a process. If <c><anno>Port</anno></c>
+ is a closed port, nothing happens. If <c><anno>Port</anno></c>
is an open port and the calling process is the port owner,
- the port replies with <c>{Port, closed}</c> when all buffers
- have been flushed and the port really closes, but if
- the calling process is not the port owner the <em>port owner</em> fails with <c>badsig</c>.</p>
-
- <p>Note that any process can close a port using
- <c><anno>Port</anno> ! {PortOwner, close}</c> just as if it itself was
+ the port replies with <c>{Port, closed}</c> when all buffers
+ have been flushed and the port really closes. If the calling
+ process is not the port owner, the <em>port owner</em> fails
+ with <c>badsig</c>.</p>
+ <p>Notice that any process can close a port using
+ <c><anno>Port</anno> ! {PortOwner, close}</c> as if it itself was
the port owner, but the reply always goes to the port owner.</p>
- <p>As of OTP-R16 <c><anno>Port</anno> ! {PortOwner, close}</c> is truly
- asynchronous. Note that this operation has always been
+ <p>As from OTP R16, <c><anno>Port</anno> ! {PortOwner, close}</c> is truly
+ asynchronous. Notice that this operation has always been
documented as an asynchronous operation, while the underlying
implementation has been synchronous. <c>port_close/1</c> is
- however still fully synchronous. This due to its error
+ however still fully synchronous. This because of its error
behavior.</p>
- <p>Failure:</p>
- <taglist>
- <tag><c>badarg</c></tag>
- <item>
- If <c><anno>Port</anno></c> is not an identifier of an open
- port, or the registered name of an open port. If the calling
- process was linked to the previously open port identified by
- <c><anno>Port</anno></c>, an exit signal due to this link
- was received by the process prior to this exception.
- </item>
- </taglist>
+ <p>Failure: <c>badarg</c> if <c><anno>Port</anno></c> is not an identifier
+ of an open port, or the registered name of an open port.
+ If the calling process was previously linked to the closed
+ port, identified by <c><anno>Port</anno></c>, the exit
+ signal from the port is guaranteed to be delivered before
+ this <c>badarg</c> exception occurs.</p>
</desc>
</func>
+
<func>
<name name="port_command" arity="2"/>
- <fsummary>Send data to a port</fsummary>
+ <fsummary>Sends data to a port.</fsummary>
<desc>
<p>Sends data to a port. Same as
- <c><anno>Port</anno> ! {PortOwner, {command, Data}}</c> except for the error
- behaviour and being synchronous (see below). Any process may
- send data to a port with <c>port_command/2</c>, not only the
+ <c><anno>Port</anno> ! {PortOwner, {command, Data}}</c> except
+ for the error
+ behavior and being synchronous (see the following). Any process
+ can send data to a port with <c>port_command/2</c>, not only the
port owner (the connected process).</p>
<p>For comparison: <c><anno>Port</anno> ! {PortOwner, {command, Data}}</c>
- fails with <c>badarg</c> if <c><anno>Port</anno></c> cannot be sent to
- (i.e., <c><anno>Port</anno></c> refers neither to a port nor to a process).
- If <c><anno>Port</anno></c> is a closed port the data message disappears
+ only fails with <c>badarg</c> if <c><anno>Port</anno></c>
+ does not refer to a port or a process. If
+ <c><anno>Port</anno></c> is a closed port, the data message
+ disappears
without a sound. If <c><anno>Port</anno></c> is open and the calling
process is not the port owner, the <em>port owner</em> fails
with <c>badsig</c>. The port owner fails with <c>badsig</c>
- also if <c><anno>Data</anno></c> is not a valid IO list.</p>
- <p>Note that any process can send to a port using
- <c><anno>Port</anno> ! {PortOwner, {command, <anno>Data</anno>}}</c> just as if it
- itself was the port owner.</p>
- <p>If the port is busy, the calling process will be suspended
- until the port is not busy anymore.</p>
- <p>As of OTP-R16 <c><anno>Port</anno> ! {PortOwner, {command, Data}}</c> is
- truly asynchronous. Note that this operation has always been
+ also if <c><anno>Data</anno></c> is an invalid I/O list.</p>
+ <p>Notice that any process can send to a port using
+ <c><anno>Port</anno> ! {PortOwner, {command, <anno>Data</anno>}}</c>
+ as if it itself was the port owner.</p>
+ <p>If the port is busy, the calling process is suspended
+ until the port is not busy any more.</p>
+ <p>As from OTP-R16, <c><anno>Port</anno> ! {PortOwner, {command, Data}}</c>
+ is truly asynchronous. Notice that this operation has always been
documented as an asynchronous operation, while the underlying
implementation has been synchronous. <c>port_command/2</c> is
- however still fully synchronous. This due to its error
+ however still fully synchronous. This because of its error
behavior.</p>
<p>Failures:</p>
<taglist>
<tag><c>badarg</c></tag>
<item>
If <c><anno>Port</anno></c> is not an identifier of an open
- port, or the registered name of an open port. If the calling
- process was linked to the previously open port identified by
- <c><anno>Port</anno></c>, an exit signal due to this link
- was received by the process prior to this exception.
+ port, or the registered name of an open port. If the
+ calling process was previously linked to the closed port,
+ identified by <c><anno>Port</anno></c>, the exit signal
+ from the port is guaranteed to be delivered before this
+ <c>badarg</c> exception occurs.
</item>
<tag><c>badarg</c></tag>
<item>
- If <c><anno>Data</anno></c> is not a valid io list.
+ If <c><anno>Data</anno></c> is an invalid I/O list.
</item>
</taglist>
</desc>
</func>
+
<func>
<name name="port_command" arity="3"/>
- <fsummary>Send data to a port</fsummary>
+ <fsummary>Sends data to a port.</fsummary>
<desc>
<p>Sends data to a port. <c>port_command(Port, Data, [])</c>
equals <c>port_command(Port, Data)</c>.</p>
- <p>If the port command is aborted <c>false</c> is returned;
- otherwise, <c>true</c> is returned.</p>
- <p>If the port is busy, the calling process will be suspended
- until the port is not busy anymore.</p>
- <p>Currently the following <c><anno>Option</anno></c>s are valid:</p>
+ <p>If the port command is aborted, <c>false</c> is returned,
+ otherwise <c>true</c>.</p>
+ <p>If the port is busy, the calling process is suspended
+ until the port is not busy any more.</p>
+ <p>The following <c><anno>Option</anno></c>s are valid:</p>
<taglist>
<tag><c>force</c></tag>
- <item>The calling process will not be suspended if the port is
- busy; instead, the port command is forced through. The
- call will fail with a <c>notsup</c> exception if the
+ <item>The calling process is not suspended if the port is
+ busy, instead the port command is forced through. The
+ call fails with a <c>notsup</c> exception if the
driver of the port does not support this. For more
- information see the
- <seealso marker="driver_entry#driver_flags"><![CDATA[ERL_DRV_FLAG_SOFT_BUSY]]></seealso>
- driver flag.
+ information, see driver flag
+ <seealso marker="driver_entry#driver_flags"><![CDATA[ERL_DRV_FLAG_SOFT_BUSY]]></seealso>.
</item>
<tag><c>nosuspend</c></tag>
- <item>The calling process will not be suspended if the port is
- busy; instead, the port command is aborted and
+ <item>The calling process is not suspended if the port is
+ busy, instead the port command is aborted and
<c>false</c> is returned.
</item>
</taglist>
<note>
- <p>More options may be added in the future.</p>
+ <p>More options can be added in a future release.</p>
</note>
<p>Failures:</p>
<taglist>
<tag><c>badarg</c></tag>
<item>
If <c><anno>Port</anno></c> is not an identifier of an open
- port, or the registered name of an open port. If the calling
- process was linked to the previously open port identified by
- <c><anno>Port</anno></c>, an exit signal due to this link
- was received by the process prior to this exception.
+ port, or the registered name of an open port. If the
+ calling process was previously linked to the closed port,
+ identified by <c><anno>Port</anno></c>, the exit signal
+ from the port is guaranteed to be delivered before this
+ <c>badarg</c> exception occurs.
</item>
<tag><c>badarg</c></tag>
<item>
- If <c><anno>Data</anno></c> is not a valid io list.
+ If <c><anno>Data</anno></c> is an invalid I/O list.
</item>
<tag><c>badarg</c></tag>
<item>
- If <c><anno>OptionList</anno></c> is not a valid option list.
+ If <c><anno>OptionList</anno></c> is an invalid option list.
</item>
<tag><c>notsup</c></tag>
<item>
- If the <c>force</c> option has been passed, but the
+ If option <c>force</c> has been passed, but the
driver of the port does not allow forcing through
a busy port.
</item>
</taglist>
</desc>
</func>
+
<func>
<name name="port_connect" arity="2"/>
- <fsummary>Set the owner of a port</fsummary>
+ <fsummary>Sets the owner of a port.</fsummary>
<desc>
<p>Sets the port owner (the connected port) to <c><anno>Pid</anno></c>.
- Roughly the same as <c><anno>Port</anno> ! {Owner, {connect, <anno>Pid</anno>}}</c>
+ Roughly the same as
+ <c><anno>Port</anno> ! {Owner, {connect, <anno>Pid</anno>}}</c>
except for the following:</p>
<list type="bulleted">
<item>
- <p>The error behavior differs, see below.</p>
+ <p>The error behavior differs, see the following.</p>
</item>
<item>
<p>The port does <em>not</em> reply with
<c>{Port,connected}</c>.</p>
</item>
<item>
- <p><c>port_connect/1</c> is synchronous, see below.</p>
+ <p><c>port_connect/1</c> is synchronous, see the following.</p>
</item>
<item>
<p>The new port owner gets linked to the port.</p>
</item>
</list>
- <p>The old port owner stays linked to the port and have to call
- <c>unlink(Port)</c> if this is not desired. Any process may
+ <p>The old port owner stays linked to the port and must call
+ <c>unlink(Port)</c> if this is not desired. Any process can
set the port owner to be any process with
<c>port_connect/2</c>.</p>
- <p>For comparison: <c><anno>Port</anno> ! {self(), {connect, <anno>Pid</anno>}}</c> fails
- with <c>badarg</c> if <c><anno>Port</anno></c> cannot be sent to (i.e.,
- <c><anno>Port</anno></c> refers neither to a port nor to a process). If
- <c><anno>Port</anno></c> is a closed port nothing happens. If <c><anno>Port</anno></c>
+ <p>For comparison:
+ <c><anno>Port</anno> ! {self(), {connect, <anno>Pid</anno>}}</c>
+ only fails with <c>badarg</c> if <c><anno>Port</anno></c>
+ does not refer to a port or a process. If
+ <c><anno>Port</anno></c> is a closed port, nothing happens.
+ If <c><anno>Port</anno></c>
is an open port and the calling process is the port owner,
the port replies with <c>{Port, connected}</c> to the old
- port owner. Note that the old port owner is still linked to
- the port, and that the new is not. If <c><anno>Port</anno></c> is an open
+ port owner. Notice that the old port owner is still linked to
+ the port, while the new is not. If <c><anno>Port</anno></c> is an open
port and the calling process is not the port owner,
the <em>port owner</em> fails with <c>badsig</c>. The port
owner fails with <c>badsig</c> also if <c><anno>Pid</anno></c> is not an
- existing local pid.</p>
- <p>Note that any process can set the port owner using
- <c><anno>Port</anno> ! {PortOwner, {connect, <anno>Pid</anno>}}</c> just as if it
- itself was the port owner, but the reply always goes to
+ existing local process identifier.</p>
+ <p>Notice that any process can set the port owner using
+ <c><anno>Port</anno> ! {PortOwner, {connect, <anno>Pid</anno>}}</c>
+ as if it itself was the port owner, but the reply always goes to
the port owner.</p>
- <p>As of OTP-R16 <c><anno>Port</anno> ! {PortOwner, {connect, <anno>Pid</anno>}}</c> is
- truly asynchronous. Note that this operation has always been
+ <p>As from OTP-R16,
+ <c><anno>Port</anno> ! {PortOwner, {connect, <anno>Pid</anno>}}</c> is
+ truly asynchronous. Notice that this operation has always been
documented as an asynchronous operation, while the underlying
implementation has been synchronous. <c>port_connect/2</c> is
- however still fully synchronous. This due to its error
+ however still fully synchronous. This because of its error
behavior.</p>
<p>Failures:</p>
<taglist>
<tag><c>badarg</c></tag>
<item>
- If <c><anno>Port</anno></c> is not an identifier of an open
- port, or the registered name of an open port. If the calling
- process was linked to the previously open port identified by
- <c><anno>Port</anno></c>, an exit signal due to this link
- was received by the process prior to this exception.
+ If <c><anno>Port</anno></c> is not an identifier of an open port, or
+ the registered name of an open port. If the calling
+ process was previously linked to the closed port,
+ identified by <c><anno>Port</anno></c>, the exit signal
+ from the port is guaranteed to be delivered before this
+ <c>badarg</c> exception occurs.
</item>
<tag><c>badarg</c></tag>
<item>If process identified by <c>Pid</c> is not an existing
@@ -3669,53 +3851,75 @@ os_prompt% </pre>
</taglist>
</desc>
</func>
+
<func>
<name name="port_control" arity="3"/>
- <fsummary>Perform a synchronous control operation on a port</fsummary>
+ <fsummary>Performs a synchronous control operation on a port.</fsummary>
<desc>
<p>Performs a synchronous control operation on a port.
- The meaning of <c><anno>Operation</anno></c> and <c><anno>Data</anno></c> depends on
- the port, i.e., on the port driver. Not all port drivers
+ The meaning of <c><anno>Operation</anno></c> and
+ <c><anno>Data</anno></c> depends on
+ the port, that is, on the port driver. Not all port drivers
support this control feature.</p>
- <p>Returns: a list of integers in the range 0 through 255, or a
+ <p>Returns a list of integers in the range 0..255, or a
binary, depending on the port driver. The meaning of
the returned data also depends on the port driver.</p>
- <p>Failure: <c>badarg</c> if <c><anno>Port</anno></c> is not an open port or
- the registered name of an open port, if <c><anno>Operation</anno></c>
- cannot fit in a 32-bit integer, if the port driver does not
- support synchronous control operations, or if the port driver
- so decides for any reason (probably something wrong with
- <c><anno>Operation</anno></c> or <c><anno>Data</anno></c>).</p>
+ <p>Failures:</p>
+ <taglist>
+ <tag><c>badarg</c></tag>
+ <item>
+ If <c><anno>Port</anno></c> is not an open port or the registered
+ name of an open port.
+ </item>
+ <tag><c>badarg</c></tag>
+ <item>
+ If <c><anno>Operation</anno></c> cannot fit in a 32-bit integer.
+ </item>
+ <tag><c>badarg</c></tag>
+ <item>
+ If the port driver does not support synchronous control
+ operations.
+ </item>
+ <tag><c>badarg</c></tag>
+ <item>
+ If the port driver so decides for any reason (probably
+ something wrong with <c><anno>Operation</anno></c> or
+ <c><anno>Data</anno></c>).
+ </item>
+ </taglist>
</desc>
</func>
+
<func>
<name name="port_call" arity="3"/>
- <fsummary>Synchronous call to a port with term data</fsummary>
+ <fsummary>Performs a synchronous call to a port with term data.</fsummary>
<desc>
<p>Performs a synchronous call to a port. The meaning of
- <c><anno>Operation</anno></c> and <c><anno>Data</anno></c> depends on the port, i.e.,
+ <c><anno>Operation</anno></c> and <c><anno>Data</anno></c>
+ depends on the port, that is,
on the port driver. Not all port drivers support this feature.</p>
- <p><c><anno>Port</anno></c> is a port identifier, referring to a driver.</p>
+ <p><c><anno>Port</anno></c> is a port identifier,
+ referring to a driver.</p>
<p><c><anno>Operation</anno></c> is an integer, which is passed on to
the driver.</p>
- <p><c><anno>Data</anno></c> is any Erlang term. This data is converted to
- binary term format and sent to the port.</p>
- <p>Returns: a term from the driver. The meaning of the returned
+ <p><c><anno>Data</anno></c> is any Erlang term. This data is converted
+ to binary term format and sent to the port.</p>
+ <p>Returns a term from the driver. The meaning of the returned
data also depends on the port driver.</p>
<p>Failures:</p>
<taglist>
<tag><c>badarg</c></tag>
<item>
- If <c><anno>Port</anno></c> is not an identifier of an open
- port, or the registered name of an open port. If the calling
- process was linked to the previously open port identified by
- <c><anno>Port</anno></c>, an exit signal due to this link
- was received by the process prior to this exception.
+ If <c><anno>Port</anno></c> is not an identifier of an open port,
+ or the registered name of an open port. If the calling
+ process was previously linked to the closed port,
+ identified by <c><anno>Port</anno></c>, the exit signal
+ from the port is guaranteed to be delivered before this
+ <c>badarg</c> exception occurs.
</item>
<tag><c>badarg</c></tag>
<item>
- If <c><anno>Operation</anno></c> does not fit in a
- 32-bit integer.
+ If <c><anno>Operation</anno></c> does not fit in a 32-bit integer.
</item>
<tag><c>badarg</c></tag>
<item>
@@ -3725,171 +3929,183 @@ os_prompt% </pre>
<tag><c>badarg</c></tag>
<item>
If the port driver so decides for any reason (probably
- something wrong with <c><anno>Operation</anno></c>, or
- <c><anno>Data</anno></c>).
+ something wrong with <c><anno>Operation</anno></c>
+ or <c><anno>Data</anno></c>).
</item>
</taglist>
</desc>
</func>
+
<func>
<name name="port_info" arity="1"/>
- <fsummary>Information about a port</fsummary>
+ <fsummary>Information about a port.</fsummary>
<desc>
<p>Returns a list containing tuples with information about
- the <c><anno>Port</anno></c>, or <c>undefined</c> if the port is not open.
- The order of the tuples is not defined, nor are all the
- tuples mandatory.
- If <c>undefined</c> is returned and the calling process
- was linked to a previously open port identified by
- <c><anno>Port</anno></c>, an exit signal due to this link
- was received by the process prior to the return from
- <c>port_info/1</c>.</p>
- <p>Currently the result will containt information about the
- following <c>Item</c>s: <c>registered_name</c> (if the port has
- a registered name), <c>id</c>, <c>connected</c>, <c>links</c>,
- <c>name</c>, <c>input</c>, and <c>output</c>. For more information
- about the different <c>Item</c>s, see
+ <c><anno>Port</anno></c>, or <c>undefined</c> if the port is not open.
+ The order of the tuples is undefined, and all the
+ tuples are not mandatory.
+ If the port is closed and the calling process
+ was previously linked to the port, the exit signal from the
+ port is guaranteed to be delivered before <c>port_info/1</c>
+ returns <c>undefined</c>.</p>
+ <p>The result contains information about the following
+ <c>Item</c>s:</p>
+ <list type="bulleted">
+ <item><c>registered_name</c> (if the port has a registered
+ name)</item>
+ <item><c>id</c></item>
+ <item><c>connected</c></item>
+ <item><c>links</c></item>
+ <item><c>name</c></item>
+ <item><c>input</c></item>
+ <item><c>output</c></item>
+ </list>
+ <p>For more information about the different <c>Item</c>s, see
<seealso marker="#port_info/2">port_info/2</seealso>.</p>
<p>Failure: <c>badarg</c> if <c>Port</c> is not a local port
identifier, or an atom.</p>
</desc>
</func>
+
<func>
<name name="port_info" arity="2" clause_i="1"/>
- <fsummary>Information about the connected process of a port</fsummary>
+ <fsummary>Information about the connected process of a port.</fsummary>
<desc>
<p><c><anno>Pid</anno></c> is the process identifier of the process
connected to the port.</p>
<p>If the port identified by <c><anno>Port</anno></c> is not open,
- <c>undefined</c> is returned. If <c>undefined</c> is returned and
- the calling process was linked to a previously open port identified
- by <c><anno>Port</anno></c>, an exit signal due to this link
- was received by the process prior to the return from
- <c>port_info/2</c>.</p>
+ <c>undefined</c> is returned. If the port is closed and the
+ calling process was previously linked to the port, the exit
+ signal from the port is guaranteed to be delivered before
+ <c>port_info/2</c> returns <c>undefined</c>.</p>
<p>Failure: <c>badarg</c> if <c><anno>Port</anno></c> is not a local
port identifier, or an atom.</p>
</desc>
</func>
+
<func>
<name name="port_info" arity="2" clause_i="2"/>
- <fsummary>Information about the internal index of a port</fsummary>
+ <fsummary>Information about the internal index of a port.</fsummary>
<desc>
<p><c><anno>Index</anno></c> is the internal index of the port. This
- index may be used to separate ports.</p>
+ index can be used to separate ports.</p>
<p>If the port identified by <c><anno>Port</anno></c> is not open,
- <c>undefined</c> is returned. If <c>undefined</c> is returned and
- the calling process was linked to a previously open port identified
- by <c><anno>Port</anno></c>, an exit signal due to this link
- was received by the process prior to the return from
- <c>port_info/2</c>.</p>
+ <c>undefined</c> is returned. If the port is closed and the
+ calling process was previously linked to the port, the exit
+ signal from the port is guaranteed to be delivered before
+ <c>port_info/2</c> returns <c>undefined</c>.</p>
<p>Failure: <c>badarg</c> if <c><anno>Port</anno></c> is not a local
port identifier, or an atom.</p>
</desc>
</func>
+
<func>
<name name="port_info" arity="2" clause_i="3"/>
- <fsummary>Information about the input of a port</fsummary>
+ <fsummary>Information about the input of a port.</fsummary>
<desc>
<p><c><anno>Bytes</anno></c> is the total number of bytes
read from the port.</p>
<p>If the port identified by <c><anno>Port</anno></c> is not open,
- <c>undefined</c> is returned. If <c>undefined</c> is returned and
- the calling process was linked to a previously open port identified
- by <c><anno>Port</anno></c>, an exit signal due to this link
- was received by the process prior to the return from
- <c>port_info/2</c>.</p>
+ <c>undefined</c> is returned. If the port is closed and the
+ calling process was previously linked to the port, the exit
+ signal from the port is guaranteed to be delivered before
+ <c>port_info/2</c> returns <c>undefined</c>.</p>
<p>Failure: <c>badarg</c> if <c><anno>Port</anno></c> is not a local
port identifier, or an atom.</p>
</desc>
</func>
+
<func>
<name name="port_info" arity="2" clause_i="4"/>
- <fsummary>Information about the links of a port</fsummary>
+ <fsummary>Information about the links of a port.</fsummary>
<desc>
<p><c><anno>Pids</anno></c> is a list of the process identifiers
of the processes that the port is linked to.</p>
<p>If the port identified by <c><anno>Port</anno></c> is not open,
- <c>undefined</c> is returned. If <c>undefined</c> is returned and
- the calling process was linked to a previously open port identified
- by <c><anno>Port</anno></c>, an exit signal due to this link
- was received by the process prior to the return from
- <c>port_info/2</c>.</p>
+ <c>undefined</c> is returned. If the port is closed and the
+ calling process was previously linked to the port, the exit
+ signal from the port is guaranteed to be delivered before
+ <c>port_info/2</c> returns <c>undefined</c>.</p>
<p>Failure: <c>badarg</c> if <c><anno>Port</anno></c> is not a local
port identifier, or an atom.</p>
</desc>
</func>
+
<func>
<name name="port_info" arity="2" clause_i="5"/>
- <fsummary>Information about the locking of a port</fsummary>
+ <fsummary>Information about the locking of a port.</fsummary>
<desc>
- <p><c><anno>Locking</anno></c> is currently either <c>false</c>
- (emulator without SMP support), <c>port_level</c> (port specific
- locking), or <c>driver_level</c> (driver specific locking). Note
- that these results are highly implementation specific and might
- change in the future.</p>
+ <p><c><anno>Locking</anno></c> is one of the following:</p>
+ <list type="bulleted">
+ <item><c>false</c> (emulator without SMP support)</item>
+ <item><c>port_level</c> (port-specific locking)</item>
+ <item><c>driver_level</c> (driver-specific locking)</item>
+ </list>
+ <p>Notice that these results are highly implementation-specific
+ and can change in a future release.</p>
<p>If the port identified by <c><anno>Port</anno></c> is not open,
- <c>undefined</c> is returned. If <c>undefined</c> is returned and
- the calling process was linked to a previously open port identified
- by <c><anno>Port</anno></c>, an exit signal due to this link
- was received by the process prior to the return from
- <c>port_info/2</c>.</p>
+ <c>undefined</c> is returned. If the port is closed and the
+ calling process was previously linked to the port, the exit
+ signal from the port is guaranteed to be delivered before
+ <c>port_info/2</c> returns <c>undefined</c>.</p>
<p>Failure: <c>badarg</c> if <c><anno>Port</anno></c> is not a local
port identifier, or an atom.</p>
</desc>
</func>
+
<func>
<name name="port_info" arity="2" clause_i="6"/>
- <fsummary>Information about the memory size of a port</fsummary>
+ <fsummary>Information about the memory size of a port.</fsummary>
<desc>
- <p><c><anno>Bytes</anno></c> is the total amount of memory,
- in bytes, allocated for this port by the runtime system. Note
- that the port itself might have allocated memory which is not
+ <p><c><anno>Bytes</anno></c> is the total number of
+ bytes allocated for this port by the runtime system. The
+ port itself can have allocated memory that is not
included in <c><anno>Bytes</anno></c>.</p>
<p>If the port identified by <c><anno>Port</anno></c> is not open,
- <c>undefined</c> is returned. If <c>undefined</c> is returned and
- the calling process was linked to a previously open port identified
- by <c><anno>Port</anno></c>, an exit signal due to this link
- was received by the process prior to the return from
- <c>port_info/2</c>.</p>
+ <c>undefined</c> is returned. If the port is closed and the
+ calling process was previously linked to the port, the exit
+ signal from the port is guaranteed to be delivered before
+ <c>port_info/2</c> returns <c>undefined</c>.</p>
<p>Failure: <c>badarg</c> if <c><anno>Port</anno></c> is not a local
port identifier, or an atom.</p>
</desc>
</func>
+
<func>
<name name="port_info" arity="2" clause_i="7"/>
- <fsummary>Information about the monitors of a port</fsummary>
+ <fsummary>Information about the monitors of a port.</fsummary>
<desc>
<p><c><anno>Monitors</anno></c> represent processes that this port
- is monitoring.</p>
+ monitors.</p>
<p>If the port identified by <c><anno>Port</anno></c> is not open,
- <c>undefined</c> is returned. If <c>undefined</c> is returned and
- the calling process was linked to a previously open port identified
- by <c><anno>Port</anno></c>, an exit signal due to this link
- was received by the process prior to the return from
- <c>port_info/2</c>.</p>
+ <c>undefined</c> is returned. If the port is closed and the
+ calling process was previously linked to the port, the exit
+ signal from the port is guaranteed to be delivered before
+ <c>port_info/2</c> returns <c>undefined</c>.</p>
<p>Failure: <c>badarg</c> if <c><anno>Port</anno></c> is not a local
port identifier, or an atom.</p>
</desc>
</func>
+
<func>
<name name="port_info" arity="2" clause_i="8"/>
- <fsummary>Information about the name of a port</fsummary>
+ <fsummary>Information about the name of a port.</fsummary>
<desc>
<p><c><anno>Name</anno></c> is the command name set by
<seealso marker="#open_port/2">open_port/2</seealso>.</p>
<p>If the port identified by <c><anno>Port</anno></c> is not open,
- <c>undefined</c> is returned. If <c>undefined</c> is returned and
- the calling process was linked to a previously open port identified
- by <c><anno>Port</anno></c>, an exit signal due to this link
- was received by the process prior to the return from
- <c>port_info/2</c>.</p>
+ <c>undefined</c> is returned. If the port is closed and the
+ calling process was previously linked to the port, the exit
+ signal from the port is guaranteed to be delivered before
+ <c>port_info/2</c> returns <c>undefined</c>.</p>
<p>Failure: <c>badarg</c> if <c><anno>Port</anno></c> is not a local
port identifier, or an atom.</p>
</desc>
</func>
+
<func>
<name name="port_info" arity="2" clause_i="9"/>
- <fsummary>Information about the OS pid of a port</fsummary>
+ <fsummary>Information about the OS pid of a port.</fsummary>
<desc>
<p><c><anno>OsPid</anno></c> is the process identifier (or equivalent)
of an OS process created with
@@ -3897,432 +4113,464 @@ os_prompt% </pre>
Command}, Options)</seealso>. If the port is not the result of spawning
an OS process, the value is <c>undefined</c>.</p>
<p>If the port identified by <c><anno>Port</anno></c> is not open,
- <c>undefined</c> is returned. If <c>undefined</c> is returned and
- the calling process was linked to a previously open port identified
- by <c><anno>Port</anno></c>, an exit signal due to this link
- was received by the process prior to the return from
- <c>port_info/2</c>.</p>
+ <c>undefined</c> is returned. If the port is closed and the
+ calling process was previously linked to the port, the exit
+ signal from the port is guaranteed to be delivered before
+ <c>port_info/2</c> returns <c>undefined</c>.</p>
<p>Failure: <c>badarg</c> if <c><anno>Port</anno></c> is not a local
port identifier, or an atom.</p>
</desc>
</func>
+
<func>
<name name="port_info" arity="2" clause_i="10"/>
- <fsummary>Information about the output of a port</fsummary>
+ <fsummary>Information about the output of a port.</fsummary>
<desc>
<p><c><anno>Bytes</anno></c> is the total number of bytes written
- to the port from Erlang processes using either
+ to the port from Erlang processes using
<seealso marker="#port_command/2">port_command/2</seealso>,
<seealso marker="#port_command/3">port_command/3</seealso>,
- or <c><anno>Port</anno> ! {Owner, {command, Data}</c>.
- </p>
+ or <c><anno>Port</anno> ! {Owner, {command, Data}</c>.</p>
<p>If the port identified by <c><anno>Port</anno></c> is not open,
- <c>undefined</c> is returned. If <c>undefined</c> is returned and
- the calling process was linked to a previously open port identified
- by <c><anno>Port</anno></c>, an exit signal due to this link
- was received by the process prior to the return from
- <c>port_info/2</c>.</p>
+ <c>undefined</c> is returned. If the port is closed and the
+ calling process was previously linked to the port, the exit
+ signal from the port is guaranteed to be delivered before
+ <c>port_info/2</c> returns <c>undefined</c>.</p>
<p>Failure: <c>badarg</c> if <c><anno>Port</anno></c> is not a local
port identifier, or an atom.</p>
</desc>
</func>
+
<func>
<name name="port_info" arity="2" clause_i="11"/>
- <fsummary>Information about the parallelism hint of a port</fsummary>
+ <fsummary>Information about the parallelism hint of a port.</fsummary>
<desc>
<p><c><anno>Boolean</anno></c> corresponds to the port parallelism
- hint being used by this port. For more information see
- the <seealso marker="#open_port_parallelism">parallelism</seealso>
- option of <seealso marker="#open_port/2">open_port/2</seealso>.</p>
+ hint being used by this port. For more information, see option
+ <seealso marker="#open_port_parallelism">parallelism</seealso>
+ of <seealso marker="#open_port/2">open_port/2</seealso>.</p>
</desc>
</func>
+
<func>
<name name="port_info" arity="2" clause_i="12"/>
- <fsummary>Information about the queue size of a port</fsummary>
+ <fsummary>Information about the queue size of a port.</fsummary>
<desc>
- <p><c><anno>Bytes</anno></c> is the total amount of data,
- in bytes, queued by the port using the ERTS driver queue
+ <p><c><anno>Bytes</anno></c> is the total number
+ of bytes queued by the port using the <c>ERTS</c> driver queue
implementation.</p>
<p>If the port identified by <c><anno>Port</anno></c> is not open,
- <c>undefined</c> is returned. If <c>undefined</c> is returned and
- the calling process was linked to a previously open port identified
- by <c><anno>Port</anno></c>, an exit signal due to this link
- was received by the process prior to the return from
- <c>port_info/2</c>.</p>
+ <c>undefined</c> is returned. If the port is closed and the
+ calling process was previously linked to the port, the exit
+ signal from the port is guaranteed to be delivered before
+ <c>port_info/2</c> returns <c>undefined</c>.</p>
<p>Failure: <c>badarg</c> if <c><anno>Port</anno></c> is not a local
port identifier, or an atom.</p>
</desc>
</func>
+
<func>
<name name="port_info" arity="2" clause_i="13"/>
- <fsummary>Information about the registered name of a port</fsummary>
+ <fsummary>Information about the registered name of a port.</fsummary>
<desc>
<p><c><anno>RegisteredName</anno></c> is the registered name of
the port. If the port has no registered name, <c>[]</c> is returned.</p>
<p>If the port identified by <c><anno>Port</anno></c> is not open,
- <c>undefined</c> is returned. If <c>undefined</c> is returned and
- the calling process was linked to a previously open port identified
- by <c><anno>Port</anno></c>, an exit signal due to this link
- was received by the process prior to the return from
- <c>port_info/2</c>.</p>
+ <c>undefined</c> is returned. If the port is closed and the
+ calling process was previously linked to the port, the exit
+ signal from the port is guaranteed to be delivered before
+ <c>port_info/2</c> returns <c>undefined</c>.</p>
<p>Failure: <c>badarg</c> if <c><anno>Port</anno></c> is not a local
port identifier, or an atom.</p>
</desc>
</func>
+
<func>
<name name="port_to_list" arity="1"/>
- <fsummary>Text representation of a port identifier</fsummary>
+ <fsummary>Text representation of a port identifier.</fsummary>
<desc>
- <p>Returns a string which corresponds to the text
+ <p>Returns a string corresponding to the text
representation of the port identifier <c><anno>Port</anno></c>.</p>
<warning>
- <p>This BIF is intended for debugging and for use in
- the Erlang operating system. It should not be used in
- application programs.</p>
+ <p>This BIF is intended for debugging. It is not to be used
+ in application programs.</p>
</warning>
</desc>
</func>
+
<func>
<name name="ports" arity="0"/>
- <fsummary>All open ports</fsummary>
+ <fsummary>Lists all existing ports.</fsummary>
<desc>
<p>Returns a list of port identifiers corresponding to all the
- ports currently existing on the local node.</p>
-
- <p>Note that a port that is exiting, exists but is not open.</p>
+ ports existing on the local node.</p>
+ <p>Notice that an exiting port exists, but is not open.</p>
</desc>
</func>
+
<func>
<name name="pre_loaded" arity="0"/>
- <fsummary>List of all pre-loaded modules</fsummary>
+ <fsummary>Lists all pre-loaded modules.</fsummary>
<desc>
- <p>Returns a list of Erlang modules which are pre-loaded in
+ <p>Returns a list of Erlang modules that are preloaded in
the system. As all loading of code is done through the file
system, the file system must have been loaded previously.
- Hence, at least the module <c>init</c> must be pre-loaded.</p>
+ Hence, at least the module <c>init</c> must be preloaded.</p>
</desc>
</func>
+
<func>
<name name="process_display" arity="2"/>
- <fsummary>Write information about a local process on standard error</fsummary>
+ <fsummary>Writes information about a local process on standard error.</fsummary>
<desc>
<p>Writes information about the local process <c><anno>Pid</anno></c> on
- standard error. The currently allowed value for the atom
+ standard error. The only allowed value for the atom
<c><anno>Type</anno></c> is <c>backtrace</c>, which shows the contents of
the call stack, including information about the call chain, with
the current function printed first. The format of the output
is not further defined.</p>
</desc>
</func>
+
<func>
<name name="process_flag" arity="2" clause_i="1"/>
- <fsummary>Set process flag trap_exit for the calling process</fsummary>
+ <fsummary>Sets process flag <c>trap_exit</c> for the calling process.</fsummary>
<desc>
<p>When <c>trap_exit</c> is set to <c>true</c>, exit signals
- arriving to a process are converted to <c>{'EXIT', From, Reason}</c> messages, which can be received as ordinary
+ arriving to a process are converted to <c>{'EXIT', From, Reason}</c>
+ messages, which can be received as ordinary
messages. If <c>trap_exit</c> is set to <c>false</c>, the
process exits if it receives an exit signal other than
<c>normal</c> and the exit signal is propagated to its
- linked processes. Application processes should normally
- not trap exits.</p>
+ linked processes. Application processes are normally
+ not to trap exits.</p>
<p>Returns the old value of the flag.</p>
<p>See also <seealso marker="#exit/2">exit/2</seealso>.</p>
</desc>
</func>
+
<func>
<name name="process_flag" arity="2" clause_i="2"/>
- <fsummary>Set process flag error_handler for the calling process</fsummary>
+ <fsummary>Sets process flag <c>error_handler</c> for the calling process.</fsummary>
<desc>
- <p>This is used by a process to redefine the error handler
+ <p>Used by a process to redefine the error handler
for undefined function calls and undefined registered
- processes. Inexperienced users should not use this flag
- since code auto-loading is dependent on the correct
+ processes. Inexperienced users are not to use this flag,
+ as code auto-loading depends on the correct
operation of the error handling module.</p>
<p>Returns the old value of the flag.</p>
</desc>
</func>
+
<func>
<name name="process_flag" arity="2" clause_i="3"/>
- <fsummary>Set process flag min_heap_size for the calling process</fsummary>
+ <fsummary>Sets process flag <c>min_heap_size</c> for the calling process.</fsummary>
<desc>
- <p>This changes the minimum heap size for the calling
- process.</p>
+ <p>Changes the minimum heap size for the calling process.</p>
<p>Returns the old value of the flag.</p>
</desc>
</func>
+
<func>
<name name="process_flag" arity="2" clause_i="4"/>
- <fsummary>Set process flag min_bin_vheap_size for the calling process</fsummary>
+ <fsummary>Sets process flag <c>min_bin_vheap_size</c> for the calling process.</fsummary>
<desc>
- <p>This changes the minimum binary virtual heap size for the calling
+ <p>Changes the minimum binary virtual heap size for the calling
process.</p>
- <p>Returns the old value of the flag.</p> </desc>
+ <p>Returns the old value of the flag.</p>
+ </desc>
</func>
+
<func>
<name name="process_flag" arity="2" clause_i="5"/>
+ <fsummary>Sets process flag <c>priority</c> for the calling process.</fsummary>
<type name="priority_level"/>
- <fsummary>Set process flag priority for the calling process</fsummary>
<desc>
<p><marker id="process_flag_priority"></marker>
- This sets the process priority. <c><anno>Level</anno></c> is an atom.
- There are currently four priority levels: <c>low</c>,
- <c>normal</c>, <c>high</c>, and <c>max</c>. The default
- priority level is <c>normal</c>. <em>NOTE</em>: The
- <c>max</c> priority level is reserved for internal use in
- the Erlang runtime system, and should <em>not</em> be used
- by others.
- </p>
- <p>Internally in each priority level processes are scheduled
- in a round robin fashion.
- </p>
+ Sets the process priority. <c><anno>Level</anno></c> is an atom.
+ There are four priority levels: <c>low</c>,
+ <c>normal</c>, <c>high</c>, and <c>max</c>. Default
+ is <c>normal</c>.</p>
+ <note>
+ <p>Priority level <c>max</c> is reserved for internal use in
+ the Erlang runtime system, and is <em>not</em> to be used
+ by others.</p>
+ </note>
+ <p>Internally in each priority level, processes are scheduled
+ in a round robin fashion.</p>
<p>Execution of processes on priority <c>normal</c> and
- priority <c>low</c> will be interleaved. Processes on
- priority <c>low</c> will be selected for execution less
- frequently than processes on priority <c>normal</c>.
- </p>
- <p>When there are runnable processes on priority <c>high</c>
- no processes on priority <c>low</c>, or <c>normal</c> will
- be selected for execution. Note, however, that this does
- <em>not</em> mean that no processes on priority <c>low</c>,
- or <c>normal</c> will be able to run when there are
- processes on priority <c>high</c> running. On the runtime
- system with SMP support there might be more processes running
- in parallel than processes on priority <c>high</c>, i.e.,
- a <c>low</c>, and a <c>high</c> priority process might
- execute at the same time.
- </p>
- <p>When there are runnable processes on priority <c>max</c>
+ <c>low</c> are interleaved. Processes on priority
+ <c>low</c> are selected for execution less
+ frequently than processes on priority <c>normal</c>.</p>
+ <p>When there are runnable processes on priority <c>high</c>,
+ no processes on priority <c>low</c> or <c>normal</c> are
+ selected for execution. Notice however, that this does
+ <em>not</em> mean that no processes on priority <c>low</c>
+ or <c>normal</c> can run when there are processes
+ running on priority <c>high</c>. On the runtime
+ system with SMP support, more processes can be running
+ in parallel than processes on priority <c>high</c>, that is,
+ a <c>low</c> and a <c>high</c> priority process can
+ execute at the same time.</p>
+ <p>When there are runnable processes on priority <c>max</c>,
no processes on priority <c>low</c>, <c>normal</c>, or
- <c>high</c> will be selected for execution. As with the
- <c>high</c> priority, processes on lower priorities might
- execute in parallel with processes on priority <c>max</c>.
- </p>
+ <c>high</c> are selected for execution. As with priority
+ <c>high</c>, processes on lower priorities can
+ execute in parallel with processes on priority <c>max</c>.</p>
<p>Scheduling is preemptive. Regardless of priority, a process
- is preempted when it has consumed more than a certain amount
+ is preempted when it has consumed more than a certain number
of reductions since the last time it was selected for
- execution.
- </p>
- <p><em>NOTE</em>: You should not depend on the scheduling
+ execution.</p>
+ <note>
+ <p>Do not depend on the scheduling
to remain exactly as it is today. Scheduling, at least on
- the runtime system with SMP support, is very likely to be
- modified in the future in order to better utilize available
- processor cores.
- </p>
- <p>There is currently <em>no</em> automatic mechanism for
- avoiding priority inversion, such as priority inheritance,
- or priority ceilings. When using priorities you have
- to take this into account and handle such scenarios by
- yourself.
- </p>
+ the runtime system with SMP support, is likely to be
+ changed in a future release to use available
+ processor cores better.</p>
+ </note>
+ <p>There is <em>no</em> automatic mechanism for
+ avoiding priority inversion, such as priority inheritance
+ or priority ceilings. When using priorities,
+ take this into account and handle such scenarios by
+ yourself.</p>
<p>Making calls from a <c>high</c> priority process into code
- that you don't have control over may cause the <c>high</c>
- priority process to wait for a processes with lower
- priority, i.e., effectively decreasing the priority of the
+ that you have no control over can cause the <c>high</c>
+ priority process to wait for a process with lower
+ priority. That is, effectively decreasing the priority of the
<c>high</c> priority process during the call. Even if this
- isn't the case with one version of the code that you don't
- have under your control, it might be the case in a future
- version of it. This might, for example, happen if a
- <c>high</c> priority process triggers code loading, since
- the code server runs on priority <c>normal</c>.
- </p>
+ is not the case with one version of the code that you have no
+ control over, it can be the case in a future
+ version of it. This can, for example, occur if a
+ <c>high</c> priority process triggers code loading, as
+ the code server runs on priority <c>normal</c>.</p>
<p>Other priorities than <c>normal</c> are normally not needed.
- When other priorities are used, they need to be used
- with care, especially the <c>high</c> priority <em>must</em>
- be used with care. A process on <c>high</c> priority should
- only perform work for short periods of time. Busy looping for
- long periods of time in a <c>high</c> priority process will
- most likely cause problems, since there are important servers
- in OTP running on priority <c>normal</c>.
- </p>
+ When other priorities are used, use them with care,
+ <em>especially</em> priority <c>high</c>. A
+ process on priority <c>high</c> is only
+ to perform work for short periods. Busy looping for
+ long periods in a <c>high</c> priority process does
+ most likely cause problems, as important OTP servers
+ run on priority <c>normal</c>.</p>
<p>Returns the old value of the flag.</p>
</desc>
</func>
+
<func>
<name name="process_flag" arity="2" clause_i="6"/>
- <fsummary>Set process flag save_calls for the calling process</fsummary>
+ <fsummary>Sets process flag <c>save_calls</c> for the calling process.</fsummary>
<desc>
<p><c><anno>N</anno></c> must be an integer in the interval 0..10000.
- If <c><anno>N</anno></c> &gt; 0, call saving is made active for the
- process, which means that information about the <c><anno>N</anno></c>
- most recent global function calls, BIF calls, sends and
+ If <c><anno>N</anno></c> is greater than 0, call saving is made
+ active for the
+ process. This means that information about the <c><anno>N</anno></c>
+ most recent global function calls, BIF calls, sends, and
receives made by the process are saved in a list, which
can be retrieved with
<c>process_info(Pid, last_calls)</c>. A global function
call is one in which the module of the function is
explicitly mentioned. Only a fixed amount of information
- is saved: a tuple <c>{Module, Function, Arity}</c> for
- function calls, and the mere atoms <c>send</c>,
- <c>'receive'</c> and <c>timeout</c> for sends and receives
- (<c>'receive'</c> when a message is received and
- <c>timeout</c> when a receive times out). If <c>N</c> = 0,
+ is saved, as follows:</p>
+ <list type="bulleted">
+ <item>A tuple <c>{Module, Function, Arity}</c> for
+ function calls</item>
+ <item> The atoms <c>send</c>, <c>'receive'</c>, and
+ <c>timeout</c> for sends and receives (<c>'receive'</c>
+ when a message is received and <c>timeout</c> when a
+ receive times out)</item>
+ </list>
+ <p>If <c>N</c> = 0,
call saving is disabled for the process, which is the
default. Whenever the size of the call saving list is set,
its contents are reset.</p>
<p>Returns the old value of the flag.</p>
</desc>
</func>
+
<func>
<name name="process_flag" arity="2" clause_i="7"/>
- <fsummary>Set process flag sensitive for the calling process</fsummary>
+ <fsummary>Sets process flag <c>sensitive</c> for the calling process.</fsummary>
<desc>
- <p>Set or clear the <c>sensitive</c> flag for the current process.
+ <p>Sets or clears flag <c>sensitive</c> for the current process.
When a process has been marked as sensitive by calling
- <c>process_flag(sensitive, true)</c>, features in the run-time
- system that can be used for examining the data and/or inner working
+ <c>process_flag(sensitive, true)</c>, features in the runtime
+ system that can be used for examining the data or inner working
of the process are silently disabled.</p>
<p>Features that are disabled include (but are not limited to)
the following:</p>
- <p>Tracing: Trace flags can still be set for the process, but no
- trace messages of any kind will be generated.
- (If the <c>sensitive</c> flag is turned off, trace messages will
- again be generated if there are any trace flags set.)</p>
- <p>Sequential tracing: The sequential trace token will be propagated
- as usual, but no sequential trace messages will be generated.</p>
- <p><c>process_info/1,2</c> cannot be used to read out the message
- queue or the process dictionary (both will be returned as empty lists).</p>
+ <list type="bulleted">
+ <item>Tracing: Trace flags can still be set for the process,
+ but no trace messages of any kind are generated. (If flag
+ <c>sensitive</c> is turned off, trace messages are again
+ generated if any trace flags are set.)</item>
+ <item>Sequential tracing: The sequential trace token is
+ propagated as usual, but no sequential trace messages are
+ generated.</item>
+ </list>
+ <p><c>process_info/1,2</c> cannot be used to read out the
+ message queue or the process dictionary (both are returned
+ as empty lists).</p>
<p>Stack back-traces cannot be displayed for the process.</p>
<p>In crash dumps, the stack, messages, and the process dictionary
- will be omitted.</p>
+ are omitted.</p>
<p>If <c>{save_calls,N}</c> has been set for the process, no
- function calls will be saved to the call saving list.
- (The call saving list will not be cleared; furthermore, send, receive,
- and timeout events will still be added to the list.)</p>
+ function calls are saved to the call saving list.
+ (The call saving list is not cleared. Furthermore, send, receive,
+ and timeout events are still added to the list.)</p>
<p>Returns the old value of the flag.</p>
</desc>
</func>
+
<func>
<name name="process_flag" arity="3"/>
- <fsummary>Set process flags for a process</fsummary>
+ <fsummary>Sets process flags for a process.</fsummary>
<desc>
- <p>Sets certain flags for the process <c><anno>Pid</anno></c>, in the same
- manner as
+ <p>Sets certain flags for the process <c><anno>Pid</anno></c>,
+ in the same manner as
<seealso marker="#process_flag/2">process_flag/2</seealso>.
- Returns the old value of the flag. The allowed values for
+ Returns the old value of the flag. The valid values for
<c><anno>Flag</anno></c> are only a subset of those allowed in
- <c>process_flag/2</c>, namely: <c>save_calls</c>.</p>
- <p>Failure: <c>badarg</c> if <c><anno>Pid</anno></c> is not a local process.</p>
+ <c>process_flag/2</c>, namely <c>save_calls</c>.</p>
+ <p>Failure: <c>badarg</c> if <c><anno>Pid</anno></c>
+ is not a local process.</p>
</desc>
</func>
+
<func>
<name name="process_info" arity="1"/>
+ <fsummary>Information about a process.</fsummary>
<type name="process_info_result_item"/>
<type name="priority_level"/>
<type name="stack_item"/>
- <fsummary>Information about a process</fsummary>
<desc>
<p>Returns a list containing <c><anno>InfoTuple</anno></c>s with
miscellaneous information about the process identified by
- <c>Pid</c>, or <c>undefined</c> if the process is not alive.
- </p>
- <p>
- The order of the <c><anno>InfoTuple</anno></c>s is not defined, nor
- are all the <c><anno>InfoTuple</anno></c>s mandatory. The <c><anno>InfoTuple</anno></c>s
- part of the result may be changed without prior notice.
- Currently <c><anno>InfoTuple</anno></c>s with the following items
- are part of the result:
- <c>current_function</c>, <c>initial_call</c>, <c>status</c>,
- <c>message_queue_len</c>, <c>messages</c>, <c>links</c>,
- <c>dictionary</c>, <c>trap_exit</c>, <c>error_handler</c>,
- <c>priority</c>, <c>group_leader</c>, <c>total_heap_size</c>,
- <c>heap_size</c>, <c>stack_size</c>, <c>reductions</c>, and
- <c>garbage_collection</c>.
- If the process identified by <c><anno>Pid</anno></c> has a registered name
- also an <c><anno>InfoTuple</anno></c> with the item <c>registered_name</c>
- will appear.
- </p>
- <p>See <seealso marker="#process_info/2">process_info/2</seealso>
- for information about specific <c><anno>InfoTuple</anno></c>s.</p>
+ <c>Pid</c>, or <c>undefined</c> if the process is not alive.</p>
+ <p>The order of the <c><anno>InfoTuple</anno></c>s is undefined and
+ all <c><anno>InfoTuple</anno></c>s are not mandatory.
+ The <c><anno>InfoTuple</anno></c>s
+ part of the result can be changed without prior notice.</p>
+ <p>The <c><anno>InfoTuple</anno></c>s with the following items
+ are part of the result:</p>
+ <list type="bulleted">
+ <item><c>current_function</c></item>
+ <item><c>initial_call</c></item>
+ <item><c>status</c></item>
+ <item><c>message_queue_len</c></item>
+ <item><c>messages</c></item>
+ <item><c>links</c></item>
+ <item><c>dictionary</c></item>
+ <item><c>trap_exit</c></item>
+ <item><c>error_handler</c></item>
+ <item><c>priority</c></item>
+ <item><c>group_leader</c></item>
+ <item><c>total_heap_size</c></item>
+ <item><c>heap_size</c></item>
+ <item><c>stack_size</c></item>
+ <item><c>reductions</c></item>
+ <item><c>garbage_collection</c></item>
+ </list>
+ <p>If the process identified by <c><anno>Pid</anno></c> has a
+ registered name,
+ also an <c><anno>InfoTuple</anno></c> with item <c>registered_name</c>
+ appears.</p>
+ <p>For information about specific <c><anno>InfoTuple</anno></c>s, see
+ <seealso marker="#process_info/2">process_info/2</seealso>.</p>
<warning>
- <p>This BIF is intended for <em>debugging only</em>, use
- <seealso marker="#process_info/2">process_info/2</seealso>
- for all other purposes.
- </p>
+ <p>This BIF is intended for <em>debugging only</em>. For
+ all other purposes, use
+ <seealso marker="#process_info/2">process_info/2</seealso>.</p>
</warning>
- <p>Failure: <c>badarg</c> if <c>Pid</c> is not a local process.</p>
+ <p>Failure: <c>badarg</c> if <c><anno>Pid</anno></c> is not a
+ local process.</p>
</desc>
</func>
+
<func>
<name name="process_info" arity="2" clause_i="1"/>
<name name="process_info" arity="2" clause_i="2"/>
+ <fsummary>Information about a process.</fsummary>
<type name="process_info_item"/>
<type name="process_info_result_item"/>
<type name="stack_item"/>
<type name="priority_level"/>
- <fsummary>Information about a process</fsummary>
<desc>
- <p>Returns information about the process identified by <c><anno>Pid</anno></c>
- as specified by the <c><anno>Item</anno></c> or the <c><anno>ItemList</anno></c>, or <c>undefined</c> if the
- process is not alive.
- </p>
- <p>If the process is alive and a single <c><anno>Item</anno></c> is given,
- the returned value is the corresponding
- <c><anno>InfoTuple</anno></c> unless <c>Item =:= registered_name</c>
- and the process has no registered name. In this case
- <c>[]</c> is returned. This strange behavior is due to
- historical reasons, and is kept for backward compatibility.
- </p>
- <p>If an <c>ItemList</c> is given, the result is an
- <c><anno>InfoTupleList</anno></c>. The <c><anno>InfoTuple</anno></c>s in the
- <c><anno>InfoTupleList</anno></c> will appear with the corresponding
- <c><anno>Item</anno></c>s in the same order as the <c><anno>Item</anno></c>s appeared
- in the <c><anno>ItemList</anno></c>. Valid <c><anno>Item</anno></c>s may appear multiple
- times in the <c><anno>ItemList</anno></c>.
- </p>
- <note><p>If <c>registered_name</c> is part of an <c><anno>ItemList</anno></c>
+ <p>Returns information about the process identified by
+ <c><anno>Pid</anno></c>, as specified by
+ <c><anno>Item</anno></c> or <c><anno>ItemList</anno></c>.
+ Returns <c>undefined</c> if the process is not alive.</p>
+ <p>If the process is alive and a single <c><anno>Item</anno></c>
+ is given, the returned value is the corresponding
+ <c><anno>InfoTuple</anno></c>, unless <c>Item =:= registered_name</c>
+ and the process has no registered name. In this case,
+ <c>[]</c> is returned. This strange behavior is because of
+ historical reasons, and is kept for backward compatibility.</p>
+ <p>If <c><anno>ItemList</anno></c> is given, the result is
+ <c><anno>InfoTupleList</anno></c>.
+ The <c><anno>InfoTuple</anno></c>s in
+ <c><anno>InfoTupleList</anno></c> appear with the corresponding
+ <c><anno>Item</anno></c>s in the same order as the
+ <c><anno>Item</anno></c>s appeared
+ in <c><anno>ItemList</anno></c>. Valid <c><anno>Item</anno></c>s can
+ appear multiple times in <c><anno>ItemList</anno></c>.</p>
+ <note><p>If <c>registered_name</c> is part of <c><anno>ItemList</anno></c>
and the process has no name registered a
- <c>{registered_name, []}</c> <c><anno>InfoTuple</anno></c> <em>will</em>
- appear in the resulting <c><anno>InfoTupleList</anno></c>. This
- behavior is different than when a single
- <c>Item =:= registered_name</c> is given, and than when
- <c>process_info/1</c> is used.
- </p></note>
- <p>Currently the following <c><anno>InfoTuple</anno></c>s with corresponding
+ <c>{registered_name, []}</c>, <c><anno>InfoTuple</anno></c>
+ <em>will</em> appear in the resulting
+ <c><anno>InfoTupleList</anno></c>. This
+ behavior is different when a single
+ <c>Item =:= registered_name</c> is given, and when
+ <c>process_info/1</c> is used.</p>
+ </note>
+ <p>The following <c><anno>InfoTuple</anno></c>s with corresponding
<c><anno>Item</anno></c>s are valid:</p>
<taglist>
<tag><c>{backtrace, <anno>Bin</anno>}</c></tag>
<item>
- <p>The binary <c><anno>Bin</anno></c> contains the same information as
- the output from
+ <p>Binary <c><anno>Bin</anno></c> contains the same information
+ as the output from
<c>erlang:process_display(<anno>Pid</anno>, backtrace)</c>. Use
<c>binary_to_list/1</c> to obtain the string of characters
from the binary.</p>
</item>
<tag><c>{binary, <anno>BinInfo</anno>}</c></tag>
<item>
- <p><c><anno>BinInfo</anno></c> is a list containing miscellaneous information
- about binaries currently being referred to by this process.
- This <c><anno>InfoTuple</anno></c> may be changed or removed without prior
- notice.</p>
+ <p><c><anno>BinInfo</anno></c> is a list containing miscellaneous
+ information about binaries currently being referred to by this
+ process. This <c><anno>InfoTuple</anno></c> can be changed or
+ removed without prior notice.</p>
</item>
<tag><c>{catchlevel, <anno>CatchLevel</anno>}</c></tag>
<item>
<p><c><anno>CatchLevel</anno></c> is the number of currently active
- catches in this process. This <c><anno>InfoTuple</anno></c> may be
+ catches in this process. This <c><anno>InfoTuple</anno></c> can be
changed or removed without prior notice.</p>
</item>
- <tag><c>{current_function, {<anno>Module</anno>, <anno>Function</anno>, <anno>Arity</anno>}}</c></tag>
+ <tag><c>{current_function, {<anno>Module</anno>,
+ <anno>Function</anno>, Arity}}</c></tag>
<item>
- <p><c><anno>Module</anno></c>, <c><anno>Function</anno></c>, <c><anno>Arity</anno></c> is
+ <p><c><anno>Module</anno></c>, <c><anno>Function</anno></c>,
+ <c><anno>Arity</anno></c> is
the current function call of the process.</p>
</item>
- <tag><c>{current_location, {<anno>Module</anno>, <anno>Function</anno>, <anno>Arity</anno>, <anno>Location</anno>}}</c></tag>
+ <tag><c>{current_location, {<anno>Module</anno>,
+ <anno>Function</anno>, <anno>Arity</anno>,
+ <anno>Location</anno>}}</c></tag>
<item>
- <p><c><anno>Module</anno></c>, <c><anno>Function</anno></c>, <c><anno>Arity</anno></c> is
+ <p><c><anno>Module</anno></c>, <c><anno>Function</anno></c>,
+ <c><anno>Arity</anno></c> is
the current function call of the process.
- <c><anno>Location</anno></c> is a list of two-tuples that describes the
- location in the source code.
- </p>
+ <c><anno>Location</anno></c> is a list of two-tuples describing the
+ location in the source code.</p>
</item>
<tag><c>{current_stacktrace, <anno>Stack</anno>}</c></tag>
<item>
- <p>Return the current call stack back-trace (<em>stacktrace</em>)
+ <p>Returns the current call stack back-trace (<em>stacktrace</em>)
of the process. The stack has the same format as returned by
- <seealso marker="#get_stacktrace/0">erlang:get_stacktrace/0</seealso>.
- </p>
+ <seealso marker="#get_stacktrace/0">erlang:get_stacktrace/0</seealso>.</p>
</item>
<tag><c>{dictionary, <anno>Dictionary</anno>}</c></tag>
<item>
- <p><c><anno>Dictionary</anno></c> is the dictionary of the process.</p>
+ <p><c><anno>Dictionary</anno></c> is the process dictionary.</p>
</item>
<tag><c>{error_handler, <anno>Module</anno>}</c></tag>
<item>
@@ -4331,34 +4579,36 @@ os_prompt% </pre>
</item>
<tag><c>{garbage_collection, <anno>GCInfo</anno>}</c></tag>
<item>
- <p><c><anno>GCInfo</anno></c> is a list which contains miscellaneous
+ <p><c><anno>GCInfo</anno></c> is a list containing miscellaneous
information about garbage collection for this process.
- The content of <c><anno>GCInfo</anno></c> may be changed without
+ The content of <c><anno>GCInfo</anno></c> can be changed without
prior notice.</p>
</item>
<tag><c>{group_leader, <anno>GroupLeader</anno>}</c></tag>
<item>
- <p><c><anno>GroupLeader</anno></c> is group leader for the IO of
+ <p><c><anno>GroupLeader</anno></c> is group leader for the I/O of
the process.</p>
</item>
<tag><c>{heap_size, <anno>Size</anno>}</c></tag>
<item>
- <p><c><anno>Size</anno></c> is the size in words of youngest heap generation
- of the process. This generation currently include the stack
- of the process. This information is highly implementation
- dependent, and may change if the implementation change.
- </p>
+ <p><c><anno>Size</anno></c> is the size in words of the youngest heap
+ generation of the process. This generation includes
+ the process stack. This information is highly
+ implementation-dependent, and can change if the
+ implementation changes.</p>
</item>
- <tag><c>{initial_call, {Module, Function, Arity}}</c></tag>
+ <tag><c>{initial_call, {<anno>Module</anno>, <anno>Function</anno>,
+ <anno>Arity</anno>}}</c></tag>
<item>
- <p><c>Module</c>, <c>Function</c>, <c>Arity</c> is
+ <p><c><anno>Module</anno></c>, <c><anno>Function</anno></c>,
+ <c><anno>Arity</anno></c> is
the initial function call with which the process was
spawned.</p>
</item>
<tag><c>{links, <anno>PidsAndPorts</anno>}</c></tag>
<item>
- <p><c><anno>PidsAndPorts</anno></c> is a list of pids and
- port identifiers, with processes or ports to which the process
+ <p><c><anno>PidsAndPorts</anno></c> is a list of process identifiers
+ and port identifiers, with processes or ports to which the process
has a link.</p>
</item>
<tag><c>{last_calls, false|Calls}</c></tag>
@@ -4372,14 +4622,14 @@ os_prompt% </pre>
<tag><c>{memory, <anno>Size</anno>}</c></tag>
<item>
<p><c><anno>Size</anno></c> is the size in bytes of the process. This
- includes call stack, heap and internal structures.</p>
+ includes call stack, heap, and internal structures.</p>
</item>
<tag><c>{message_queue_len, <anno>MessageQueueLen</anno>}</c></tag>
<item>
<p><c><anno>MessageQueueLen</anno></c> is the number of messages
currently in the message queue of the process. This is
the length of the list <c><anno>MessageQueue</anno></c> returned as
- the info item <c>messages</c> (see below).</p>
+ the information item <c>messages</c> (see the following).</p>
</item>
<tag><c>{messages, <anno>MessageQueue</anno>}</c></tag>
<item>
@@ -4388,31 +4638,35 @@ os_prompt% </pre>
</item>
<tag><c>{min_heap_size, <anno>MinHeapSize</anno>}</c></tag>
<item>
- <p><c><anno>MinHeapSize</anno></c> is the minimum heap size for the process.</p>
+ <p><c><anno>MinHeapSize</anno></c> is the minimum heap size
+ for the process.</p>
</item>
<tag><c>{min_bin_vheap_size, <anno>MinBinVHeapSize</anno>}</c></tag>
<item>
- <p><c><anno>MinBinVHeapSize</anno></c> is the minimum binary virtual heap size for the process.</p>
+ <p><c><anno>MinBinVHeapSize</anno></c> is the minimum binary virtual
+ heap size for the process.</p>
</item>
<tag><c>{monitored_by, <anno>Pids</anno>}</c></tag>
<item>
- <p>A list of pids that are monitoring the process (with
+ <p>A list of process identifiers monitoring the process (with
<c>monitor/2</c>).</p>
</item>
<tag><c>{monitors, <anno>Monitors</anno>}</c></tag>
<item>
<p>A list of monitors (started by <c>monitor/2</c>)
that are active for the process. For a local process
- monitor or a remote process monitor by pid, the list item
- is <c>{process, <anno>Pid</anno>}</c>, and for a remote process
+ monitor or a remote process monitor by a process
+ identifier, the list item is <c>{process, <anno>Pid</anno>}</c>.
+ For a remote process
monitor by name, the list item is
<c>{process, {<anno>RegName</anno>, <anno>Node</anno>}}</c>.</p>
</item>
- <tag><c>{priority, Level}</c></tag>
+ <tag><c>{priority, <anno>Level</anno>}</c></tag>
<item>
<p><c><anno>Level</anno></c> is the current priority level for
- the process. For more information on priorities see
- <seealso marker="#process_flag_priority">process_flag(priority, Level)</seealso>.</p>
+ the process. For more information on priorities, see
+ <seealso marker="#process_flag_priority">process_flag(priority,
+ Level)</seealso>.</p>
</item>
<tag><c>{reductions, <anno>Number</anno>}</c></tag>
<item>
@@ -4427,166 +4681,201 @@ os_prompt% </pre>
</item>
<tag><c>{sequential_trace_token, [] | <anno>SequentialTraceToken</anno>}</c></tag>
<item>
- <p><c><anno>SequentialTraceToken</anno></c> the sequential trace token for
- the process. This <c><anno>InfoTuple</anno></c> may be changed or removed
- without prior notice.</p>
+ <p><c><anno>SequentialTraceToken</anno></c> is the sequential trace
+ token for the process. This <c><anno>InfoTuple</anno></c> can be
+ changed or removed without prior notice.</p>
</item>
<tag><c>{stack_size, <anno>Size</anno>}</c></tag>
<item>
- <p><c><anno>Size</anno></c> is the stack size of the process in words.</p>
+ <p><c><anno>Size</anno></c> is the stack size, in words,
+ of the process.</p>
</item>
<tag><c>{status, <anno>Status</anno>}</c></tag>
<item>
- <p><c><anno>Status</anno></c> is the status of the process. <c><anno>Status</anno></c>
- is <c>exiting</c>, <c>garbage_collecting</c>,
- <c>waiting</c> (for a message), <c>running</c>,
- <c>runnable</c> (ready to run, but another process is
- running), or <c>suspended</c> (suspended on a "busy" port
- or by the <c>erlang:suspend_process/[1,2]</c> BIF).</p>
+ <p><c><anno>Status</anno></c> is the status of the process and is one
+ of the following:</p>
+ <list type="bulleted">
+ <item><c>exiting</c></item>
+ <item><c>garbage_collecting</c></item>
+ <item><c>waiting</c> (for a message)</item>
+ <item><c>running</c></item>
+ <item><c>runnable</c> (ready to run, but another process is
+ running)</item>
+ <item><c>suspended</c> (suspended on a "busy" port
+ or by the BIF <c>erlang:suspend_process/[1,2]</c>)</item>
+ </list>
</item>
<tag><c>{suspending, <anno>SuspendeeList</anno>}</c></tag>
<item>
- <p><c><anno>SuspendeeList</anno></c> is a list of <c>{<anno>Suspendee</anno>,
- <anno>ActiveSuspendCount</anno>, <anno>OutstandingSuspendCount</anno>}</c> tuples.
- <c><anno>Suspendee</anno></c> is the pid of a process that have been or is to
- be suspended by the process identified by <c><anno>Pid</anno></c> via the
- <seealso marker="#suspend_process/2">erlang:suspend_process/2</seealso>
- BIF, or the
- <seealso marker="#suspend_process/1">erlang:suspend_process/1</seealso>
- BIF. <c><anno>ActiveSuspendCount</anno></c> is the number of times the
- <c><anno>Suspendee</anno></c> has been suspended by <c><anno>Pid</anno></c>.
+ <p><c><anno>SuspendeeList</anno></c> is a list of
+ <c>{<anno>Suspendee</anno>, <anno>ActiveSuspendCount</anno>,
+ <anno>OutstandingSuspendCount</anno>}</c> tuples.
+ <c><anno>Suspendee</anno></c> is the process identifier of a
+ process that has been, or is to be,
+ suspended by the process identified by <c><anno>Pid</anno></c>
+ through one of the following BIFs:</p>
+ <list type="bulleted">
+ <item>
+ <seealso marker="#suspend_process/2">erlang:suspend_process/2</seealso>
+ </item>
+ <item>
+ <seealso marker="#suspend_process/1">erlang:suspend_process/1</seealso>
+ </item>
+ </list>
+ <p><c><anno>ActiveSuspendCount</anno></c> is the number of
+ times <c><anno>Suspendee</anno></c> has been suspended by
+ <c><anno>Pid</anno></c>.
<c><anno>OutstandingSuspendCount</anno></c> is the number of not yet
- completed suspend requests sent by <c><anno>Pid</anno></c>. That is,
- if <c><anno>ActiveSuspendCount</anno> =/= 0</c>, <c><anno>Suspendee</anno></c> is
- currently in the suspended state, and if
- <c><anno>OutstandingSuspendCount</anno> =/= 0</c> the <c>asynchronous</c>
- option of <c>erlang:suspend_process/2</c> has been used and
- the suspendee has not yet been suspended by <c><anno>Pid</anno></c>.
- Note that the <c><anno>ActiveSuspendCount</anno></c> and
- <c><anno>OutstandingSuspendCount</anno></c> are not the total suspend count
- on <c><anno>Suspendee</anno></c>, only the parts contributed by <c>Pid</c>.
- </p>
+ completed suspend requests sent by <c><anno>Pid</anno></c>, that is:</p>
+ <list type="bulleted">
+ <item>If <c><anno>ActiveSuspendCount</anno> =/= 0</c>,
+ <c><anno>Suspendee</anno></c> is
+ currently in the suspended state.
+ </item>
+ <item>If <c><anno>OutstandingSuspendCount</anno> =/= 0</c>, option
+ <c>asynchronous</c> of <c>erlang:suspend_process/2</c>
+ has been used and the suspendee has not yet been
+ suspended by <c><anno>Pid</anno></c>.
+ </item>
+ </list>
+ <p>Notice that <c><anno>ActiveSuspendCount</anno></c> and
+ <c><anno>OutstandingSuspendCount</anno></c> are not the
+ total suspend count on <c><anno>Suspendee</anno></c>,
+ only the parts contributed by <c><anno>Pid</anno></c>.</p>
</item>
<tag><c>{total_heap_size, <anno>Size</anno>}</c></tag>
<item>
- <p><c><anno>Size</anno></c> is the total size in words of all heap
- fragments of the process. This currently include the stack
- of the process.
- </p>
+ <p><c><anno>Size</anno></c> is the total size, in words, of all heap
+ fragments of the process. This includes the process stack.</p>
</item>
<tag><c>{trace, <anno>InternalTraceFlags</anno>}</c></tag>
<item>
- <p><c><anno>InternalTraceFlags</anno></c> is an integer representing
- internal trace flag for this process. This <c><anno>InfoTuple</anno></c>
- may be changed or removed without prior notice.</p>
+ <p><c><anno>InternalTraceFlags</anno></c> is an integer
+ representing the internal trace flag for this process.
+ This <c><anno>InfoTuple</anno></c>
+ can be changed or removed without prior notice.</p>
</item>
<tag><c>{trap_exit, <anno>Boolean</anno>}</c></tag>
<item>
- <p><c><anno>Boolean</anno></c> is <c>true</c> if the process is trapping
- exits, otherwise it is <c>false</c>.</p>
+ <p><c><anno>Boolean</anno></c> is <c>true</c> if the process
+ is trapping exits, otherwise <c>false</c>.</p>
</item>
</taglist>
- <p>Note however, that not all implementations support every one
- of the above <c><anno>Item</anno></c>s.</p>
- <p>Failure: <c>badarg</c> if <c><anno>Pid</anno></c> is not a local process,
- or if <c><anno>Item</anno></c> is not a valid <c><anno>Item</anno></c>.</p>
+ <p>Notice that not all implementations support all
+ these <c><anno>Item</anno></c>s.</p>
+ <p>Failures:</p>
+ <taglist>
+ <tag><c>badarg</c></tag>
+ <item>If <c><anno>Pid</anno></c> is not a local process.</item>
+ <tag><c>badarg</c></tag>
+ <item>If <c><anno>Item</anno></c> is an invalid item.</item>
+ </taglist>
</desc>
</func>
+
<func>
<name name="processes" arity="0"/>
- <fsummary>All processes</fsummary>
+ <fsummary>All processes.</fsummary>
<desc>
<p>Returns a list of process identifiers corresponding to
- all the processes currently existing on the local node.
- </p>
- <p>Note that a process that is exiting, exists but is not alive, i.e.,
- <c>is_process_alive/1</c> will return <c>false</c> for a process
- that is exiting, but its process identifier will be part
- of the result returned from <c>processes/0</c>.
- </p>
+ all the processes currently existing on the local node.</p>
+ <p>Notice that an exiting process exists, but is not alive.
+ That is, <c>is_process_alive/1</c> returns <c>false</c>
+ for an exiting process, but its process identifier is part
+ of the result returned from <c>processes/0</c>.</p>
+ <p>Example:</p>
<pre>
> <input>processes().</input>
[&lt;0.0.0&gt;,&lt;0.2.0&gt;,&lt;0.4.0&gt;,&lt;0.5.0&gt;,&lt;0.7.0&gt;,&lt;0.8.0&gt;]</pre>
</desc>
</func>
+
<func>
<name name="purge_module" arity="1"/>
- <fsummary>Remove old code for a module</fsummary>
+ <fsummary>Removes old code for a module.</fsummary>
<desc>
- <p>Removes old code for <c><anno>Module</anno></c>. Before this BIF is used,
- <c>erlang:check_process_code/2</c> should be called to check
- that no processes are executing old code in the module.</p>
+ <p>Removes old code for <c><anno>Module</anno></c>.
+ Before this BIF is used,
+ <c>erlang:check_process_code/2</c> is to be called to check
+ that no processes execute old code in the module.</p>
<warning>
<p>This BIF is intended for the code server (see
- <seealso marker="kernel:code">code(3)</seealso>) and should not be
- used elsewhere.</p>
+ <seealso marker="kernel:code">code(3)</seealso>)
+ and is not to be used elsewhere.</p>
</warning>
<p>Failure: <c>badarg</c> if there is no old code for
<c><anno>Module</anno></c>.</p>
</desc>
</func>
+
<func>
<name name="put" arity="2"/>
- <fsummary>Add a new value to the process dictionary</fsummary>
- <desc>
- <p>Adds a new <c><anno>Key</anno></c> to the process dictionary, associated
- with the value <c><anno>Val</anno></c>, and returns <c>undefined</c>. If
- <c><anno>Key</anno></c> already exists, the old value is deleted and
- replaced by <c><anno>Val</anno></c> and the function returns the old value.</p>
- <note>
- <p>The values stored when <c>put</c> is evaluated within
- the scope of a <c>catch</c> will not be retracted if a
- <c>throw</c> is evaluated, or if an error occurs.</p>
- </note>
+ <fsummary>Adds a new value to the process dictionary.</fsummary>
+ <desc>
+ <p>Adds a new <c><anno>Key</anno></c> to the process dictionary,
+ associated with the value <c><anno>Val</anno></c>, and returns
+ <c>undefined</c>. If <c><anno>Key</anno></c> exists, the old
+ value is deleted and replaced by <c><anno>Val</anno></c>, and
+ the function returns the old value.</p>
+ <p>Example:</p>
<pre>
> <input>X = put(name, walrus), Y = put(name, carpenter),</input>
<input>Z = get(name),</input>
<input>{X, Y, Z}.</input>
{undefined,walrus,carpenter}</pre>
+ <note>
+ <p>The values stored when <c>put</c> is evaluated within
+ the scope of a <c>catch</c> are not retracted if a
+ <c>throw</c> is evaluated, or if an error occurs.</p>
+ </note>
</desc>
</func>
+
<func>
<name name="raise" arity="3"/>
+ <fsummary>Stops execution with an exception of given class, reason, and call stack backtrace.</fsummary>
<type name="raise_stacktrace"/>
- <fsummary>Stop execution with an exception of given class, reason and call stack backtrace</fsummary>
<desc>
<p>Stops the execution of the calling process with an
- exception of given class, reason and call stack backtrace
+ exception of given class, reason, and call stack backtrace
(<em>stacktrace</em>).</p>
<warning>
- <p>This BIF is intended for debugging and for use in
- the Erlang operating system. In general, it should
- be avoided in applications, unless you know
- very well what you are doing.</p>
+ <p>This BIF is intended for debugging. Avoid to use it in applications,
+ unless you really know what you are doing.</p>
</warning>
- <p><c><anno>Class</anno></c> is one of <c>error</c>, <c>exit</c> or
- <c>throw</c>, so if it were not for the stacktrace
- <c>erlang:raise(<anno>Class</anno>, <anno>Reason</anno>, <anno>Stacktrace</anno>)</c> is
- equivalent to <c>erlang:<anno>Class</anno>(<anno>Reason</anno>)</c>.
- <c><anno>Reason</anno></c> is any term and <c><anno>Stacktrace</anno></c> is a list as
- returned from <c>get_stacktrace()</c>, that is a list of
- 4-tuples <c>{Module, Function, Arity | Args,
- Location}</c> where <c>Module</c> and <c>Function</c>
- are atoms and the third element is an integer arity or an
- argument list. The stacktrace may also contain <c>{Fun,
- Args, Location}</c> tuples where
- <c>Fun</c> is a local fun and <c>Args</c> is an argument list.</p>
- <p>The <c>Location</c> element at the end is optional.
+ <p><c><anno>Class</anno></c> is <c>error</c>, <c>exit</c>, or
+ <c>throw</c>. So, if it were not for the stacktrace,
+ <c>erlang:raise(<anno>Class</anno>, <anno>Reason</anno>,
+ <anno>Stacktrace</anno>)</c> is
+ equivalent to <c>erlang:<anno>Class</anno>(<anno>Reason</anno>)</c>.</p>
+ <p><c><anno>Reason</anno></c> is any term.
+ <c><anno>Stacktrace</anno></c> is a list as
+ returned from <c>get_stacktrace()</c>, that is, a list of
+ four-tuples <c>{Module, Function, Arity | Args,
+ Location}</c>, where <c>Module</c> and <c>Function</c>
+ are atoms, and the third element is an integer arity or an
+ argument list. The stacktrace can also contain <c>{Fun,
+ Args, Location}</c> tuples, where <c>Fun</c> is a local
+ fun and <c>Args</c> is an argument list.</p>
+ <p>Element <c>Location</c> at the end is optional.
Omitting it is equivalent to specifying an empty list.</p>
<p>The stacktrace is used as the exception stacktrace for the
- calling process; it will be truncated to the current
+ calling process; it is truncated to the current
maximum stacktrace depth.</p>
- <p>Because evaluating this function causes the process to
- terminate, it has no return value - unless the arguments are
- invalid, in which case the function <em>returns the error reason</em>, that is <c>badarg</c>. If you want to be
- really sure not to return you can call
- <c>error(erlang:raise(<anno>Class</anno>, <anno>Reason</anno>, <anno>Stacktrace</anno>))</c>
+ <p>Since evaluating this function causes the process to
+ terminate, it has no return value unless the arguments are
+ invalid, in which case the function <em>returns the error
+ reason</em> <c>badarg</c>. If you want to be
+ sure not to return, you can call
+ <c>error(erlang:raise(<anno>Class</anno>, <anno>Reason</anno>,
+ <anno>Stacktrace</anno>))</c>
and hope to distinguish exceptions later.</p>
</desc>
</func>
+
<func>
<name name="read_timer" arity="2"/>
- <fsummary>Read the state of a timer</fsummary>
+ <fsummary>Reads the state of a timer.</fsummary>
<desc>
<p>
Read the state of a timer that has been created by either
@@ -4595,7 +4884,7 @@ os_prompt% </pre>
<c><anno>TimerRef</anno></c> identifies the timer, and
was returned by the BIF that created the timer.
</p>
- <p>Currently available <c><anno>Option</anno>s</c>:</p>
+ <p>Available <c><anno>Option</anno>s</c>:</p>
<taglist>
<tag><c>{async, Async}</c></tag>
<item>
@@ -4603,12 +4892,12 @@ os_prompt% </pre>
Asynchronous request for state information. <c>Async</c>
defaults to <c>false</c> which will cause the operation
to be performed synchronously. In this case, the <c>Result</c>
- will be returned by <c>erlang:read_timer()</c>. When
- <c>Async</c> is set to <c>true</c>, <c>erlang:read_timer()</c>
- will send an asynchronous request for the state information
- to the timer service that manages the timer, and then return
+ is returned by <c>erlang:read_timer()</c>. When
+ <c>Async</c> is <c>true</c>, <c>erlang:read_timer()</c>
+ sends an asynchronous request for the state information
+ to the timer service that manages the timer, and then returns
<c>ok</c>. A message on the format <c>{read_timer,
- <anno>TimerRef</anno>, <anno>Result</anno>}</c> will be
+ <anno>TimerRef</anno>, <anno>Result</anno>}</c> is
sent to the caller of <c>erlang:read_timer()</c> when the
operation has been processed.
</p>
@@ -4618,26 +4907,27 @@ os_prompt% </pre>
More <c><anno>Option</anno></c>s may be added in the future.
</p>
<p>
- When the <c><anno>Result</anno></c> equals <c>false</c>, a
+ If <c><anno>Result</anno></c> is an integer, it represents the
+ time in milli-seconds left until the timer expires.</p>
+ <p>
+ If <c><anno>Result</anno></c> is <c>false</c>, a
timer corresponding to <c><anno>TimerRef</anno></c> could not
- be found. This can be either because the timer had expired,
- had been canceled, or because <c><anno>TimerRef</anno></c>
- never has corresponded to a timer. If the timer has expired,
- the timeout message has been sent, but it does not tell you
- whether or not it has arrived at its destination yet. When the
- <c><anno>Result</anno></c> is an integer, it represents the
- time in milli-seconds left until the timer will expire.
+ be found. This can be because the timer had expired,
+ it had been canceled, or because <c><anno>TimerRef</anno></c>
+ never has corresponded to a timer. Even if the timer has expired,
+ it does not tell you whether or not the timeout message has
+ arrived at its destination yet.
</p>
<note>
<p>
The timer service that manages the timer may be co-located
with another scheduler than the scheduler that the calling
process is executing on. If this is the case, communication
- with the timer service will take much longer time than if it
+ with the timer service takes much longer time than if it
is located locally. If the calling process is in critical
path, and can do other things while waiting for the result
- of this operation you want to use the <c>{async, true}</c>
- option. If using the <c>{async, false}</c> option, the calling
+ of this operation, you want to use option <c>{async, true}</c>.
+ If using option <c>{async, false}</c>, the calling
process will be blocked until the operation has been
performed.
</p>
@@ -4651,70 +4941,86 @@ os_prompt% </pre>
</func>
<func>
<name name="read_timer" arity="1"/>
- <fsummary>Read the state of a timer</fsummary>
+ <fsummary>Reads the state of a timer.</fsummary>
<desc>
<p>Read the state of a timer. The same as calling
<seealso marker="#read_timer/2"><c>erlang:read_timer(TimerRef,
[])</c></seealso>.</p>
</desc>
</func>
+
<func>
<name name="ref_to_list" arity="1"/>
- <fsummary>Text representation of a reference</fsummary>
+ <fsummary>Text representation of a reference.</fsummary>
<desc>
- <p>Returns a string which corresponds to the text
+ <p>Returns a string corresponding to the text
representation of <c><anno>Ref</anno></c>.</p>
<warning>
- <p>This BIF is intended for debugging and for use in
- the Erlang operating system. It should not be used in
- application programs.</p>
+ <p>This BIF is intended for debugging and is not to be used
+ in application programs.</p>
</warning>
</desc>
</func>
+
<func>
<name name="register" arity="2"/>
- <fsummary>Register a name for a pid (or port)</fsummary>
+ <fsummary>Registers a name for a pid (or port).</fsummary>
<desc>
- <p>Associates the name <c><anno>RegName</anno></c> with a pid or a port
- identifier. <c><anno>RegName</anno></c>, which must be an atom, can be used
- instead of the pid / port identifier in the send operator
+ <p>Associates the name <c><anno>RegName</anno></c> with a process
+ identifier (pid) or a port identifier.
+ <c><anno>RegName</anno></c>, which must be an atom, can be used
+ instead of the pid or port identifier in send operator
(<c><anno>RegName</anno> ! Message</c>).</p>
+ <p>Example:</p>
<pre>
> <input>register(db, Pid).</input>
true</pre>
- <p>Failure: <c>badarg</c> if <c><anno>PidOrPort</anno></c> is not an existing,
- local process or port, if <c><anno>RegName</anno></c> is already in use,
- if the process or port is already registered (already has a
- name), or if <c><anno>RegName</anno></c> is the atom <c>undefined</c>.</p>
+ <p>Failures:</p>
+ <taglist>
+ <tag><c>badarg</c></tag>
+ <item>If <c><anno>PidOrPort</anno></c> is not an existing local
+ process or port.</item>
+ <tag><c>badarg</c></tag>
+ <item>If <c><anno>RegName</anno></c> is already in use.</item>
+ <tag><c>badarg</c></tag>
+ <item>If the process or port is already registered
+ (already has a name).</item>
+ <tag><c>badarg</c></tag>
+ <item>If <c><anno>RegName</anno></c> is the atom
+ <c>undefined</c>.</item>
+ </taglist>
</desc>
</func>
+
<func>
<name name="registered" arity="0"/>
- <fsummary>All registered names</fsummary>
+ <fsummary>All registered names.</fsummary>
<desc>
- <p>Returns a list of names which have been registered using
- <seealso marker="#register/2">register/2</seealso>.</p>
+ <p>Returns a list of names that have been registered using
+ <seealso marker="#register/2">register/2</seealso>, for
+ example:</p>
<pre>
> <input>registered().</input>
[code_server, file_server, init, user, my_db]</pre>
</desc>
</func>
+
<func>
<name name="resume_process" arity="1"/>
- <fsummary>Resume a suspended process</fsummary>
+ <fsummary>Resumes a suspended process.</fsummary>
<desc>
<p>Decreases the suspend count on the process identified by
- <c><anno>Suspendee</anno></c>. <c><anno>Suspendee</anno></c> should previously have been
- suspended via
- <seealso marker="#suspend_process/2">erlang:suspend_process/2</seealso>,
+ <c><anno>Suspendee</anno></c>. <c><anno>Suspendee</anno></c>
+ is previously to have been suspended through
+ <seealso marker="#suspend_process/2">erlang:suspend_process/2</seealso>
or
<seealso marker="#suspend_process/1">erlang:suspend_process/1</seealso>
- by the process calling <c>erlang:resume_process(<anno>Suspendee</anno>)</c>. When
- the suspend count on <c><anno>Suspendee</anno></c> reach zero, <c><anno>Suspendee</anno></c>
- will be resumed, i.e., the state of the <c>Suspendee</c> is changed
- from suspended into the state <c><anno>Suspendee</anno></c> was in before it was
- suspended.
- </p>
+ by the process calling
+ <c>erlang:resume_process(<anno>Suspendee</anno>)</c>. When the
+ suspend count on <c><anno>Suspendee</anno></c> reaches zero,
+ <c><anno>Suspendee</anno></c> is resumed, that is, its state
+ is changed from suspended into the state it had before it was
+ suspended.</p>
<warning>
<p>This BIF is intended for debugging only.</p>
</warning>
@@ -4722,7 +5028,7 @@ true</pre>
<taglist>
<tag><c>badarg</c></tag>
<item>
- If <c><anno>Suspendee</anno></c> isn't a process identifier.
+ If <c><anno>Suspendee</anno></c> is not a process identifier.
</item>
<tag><c>badarg</c></tag>
<item>
@@ -4732,58 +5038,65 @@ true</pre>
</item>
<tag><c>badarg</c></tag>
<item>
- If the process identified by <c><anno>Suspendee</anno></c> is not alive.
+ If the process identified by <c><anno>Suspendee</anno></c>
+ is not alive.
</item>
</taglist>
</desc>
</func>
+
<func>
<name name="round" arity="1"/>
- <fsummary>Return an integer by rounding a number</fsummary>
+ <fsummary>Returns an integer by rounding a number.</fsummary>
<desc>
- <p>Returns an integer by rounding <c><anno>Number</anno></c>.</p>
+ <p>Returns an integer by rounding <c><anno>Number</anno></c>,
+ for example:</p>
<pre>
-> <input>round(5.5).</input>
+<input>round(5.5).</input>
6</pre>
<p>Allowed in guard tests.</p>
</desc>
</func>
+
<func>
<name name="self" arity="0"/>
- <fsummary>Pid of the calling process</fsummary>
+ <fsummary>Returns pid of the calling process.</fsummary>
<desc>
- <p>Returns the pid (process identifier) of the calling process.</p>
+ <p>Returns the process identifier of the calling process, for
+ example:</p>
<pre>
> <input>self().</input>
&lt;0.26.0></pre>
<p>Allowed in guard tests.</p>
</desc>
</func>
+
<func>
<name name="send" arity="2"/>
- <fsummary>Send a message</fsummary>
+ <fsummary>Sends a message.</fsummary>
<type name="dst"/>
<desc>
- <p>Sends a message and returns <c><anno>Msg</anno></c>. This is the same as
- <c><anno>Dest</anno> ! <anno>Msg</anno></c>.</p>
- <p><c><anno>Dest</anno></c> may be a remote or local pid, a (local) port, a
- locally registered name, or a tuple <c>{<anno>RegName</anno>, <anno>Node</anno>}</c>
+ <p>Sends a message and returns <c><anno>Msg</anno></c>. This
+ is the same as <c><anno>Dest</anno> ! <anno>Msg</anno></c>.</p>
+ <p><c><anno>Dest</anno></c> can be a remote or local process identifier,
+ a (local) port, a locally registered name, or a tuple
+ <c>{<anno>RegName</anno>, <anno>Node</anno>}</c>
for a registered name at another node.</p>
</desc>
</func>
+
<func>
<name name="send" arity="3"/>
+ <fsummary>Sends a message conditionally.</fsummary>
<type name="dst"/>
- <fsummary>Send a message conditionally</fsummary>
- <desc>
- <p>Sends a message and returns <c>ok</c>, or does not send
- the message but returns something else (see below). Otherwise
- the same as
- <seealso marker="#send/2">erlang:send/2</seealso>. See
- also
- <seealso marker="#send_nosuspend/2">erlang:send_nosuspend/2,3</seealso>.
- for more detailed explanation and warnings.</p>
- <p>The possible options are:</p>
+ <desc>
+ <p>Either sends a message and returns <c>ok</c>, or does not send
+ the message but returns something else (see the following).
+ Otherwise the same as
+ <seealso marker="#send/2">erlang:send/2</seealso>.
+ For more detailed explanation and warnings, see
+ <seealso marker="#send_nosuspend/2">erlang:send_nosuspend/2,3</seealso>.</p>
+ <p>The options are as follows:</p>
<taglist>
<tag><c>nosuspend</c></tag>
<item>
@@ -4793,314 +5106,366 @@ true</pre>
<tag><c>noconnect</c></tag>
<item>
<p>If the destination node would have to be auto-connected
- before doing the send, <c>noconnect</c> is returned
+ to do the send, <c>noconnect</c> is returned
instead.</p>
</item>
</taglist>
<warning>
- <p>As with <c>erlang:send_nosuspend/2,3</c>: Use with extreme
- care!</p>
+ <p>As with <c>erlang:send_nosuspend/2,3</c>: use with extreme
+ care.</p>
</warning>
</desc>
</func>
+
<func>
<name name="send_after" arity="4"/>
<fsummary>Start a timer</fsummary>
<desc>
<p>
Starts a timer. When the timer expires, the message
- <c><anno>Msg</anno></c> will be sent to the process
- identified by <c><anno>Dest</anno></c>. Appart from
- the format of the message sent to
- <c><anno>Dest</anno></c> when the timer expires
+ <c><anno>Msg</anno></c> is sent to the process
+ identified by <c><anno>Dest</anno></c>. Apart from
+ the format of the timeout message,
<c>erlang:send_after/4</c> works exactly as
<seealso marker="#start_timer/4"><c>erlang:start_timer/4</c></seealso>.</p>
</desc>
</func>
<func>
<name name="send_after" arity="3"/>
- <fsummary>Start a timer</fsummary>
+ <fsummary>Starts a timer.</fsummary>
<desc>
<p>Starts a timer. The same as calling
<seealso marker="#send_after/4"><c>erlang:send_after(<anno>Time</anno>,
<anno>Dest</anno>, <anno>Msg</anno>, [])</c></seealso>.</p>
</desc>
</func>
+
<func>
<name name="send_nosuspend" arity="2"/>
- <fsummary>Try to send a message without ever blocking</fsummary>
+ <fsummary>Tries to send a message without ever blocking.</fsummary>
<type name="dst"/>
<desc>
<p>The same as
- <seealso marker="#send/3">erlang:send(<anno>Dest</anno>, <anno>Msg</anno>, [nosuspend])</seealso>, but returns <c>true</c> if
+ <seealso marker="#send/3">erlang:send(<anno>Dest</anno>,
+ <anno>Msg</anno>, [nosuspend])</seealso>,
+ but returns <c>true</c> if
the message was sent and <c>false</c> if the message was not
sent because the sender would have had to be suspended.</p>
- <p>This function is intended for send operations towards an
+ <p>This function is intended for send operations to an
unreliable remote node without ever blocking the sending
(Erlang) process. If the connection to the remote node
(usually not a real Erlang node, but a node written in C or
- Java) is overloaded, this function <em>will not send the message</em> but return <c>false</c> instead.</p>
- <p>The same happens, if <c><anno>Dest</anno></c> refers to a local port that
- is busy. For all other destinations (allowed for the ordinary
- send operator <c>'!'</c>) this function sends the message and
+ Java) is overloaded, this function <em>does not send the message</em>
+ and returns <c>false</c>.</p>
+ <p>The same occurs if <c><anno>Dest</anno></c> refers to a local port
+ that is busy. For all other destinations (allowed for the ordinary
+ send operator <c>'!'</c>), this function sends the message and
returns <c>true</c>.</p>
- <p>This function is only to be used in very rare circumstances
+ <p>This function is only to be used in rare circumstances
where a process communicates with Erlang nodes that can
- disappear without any trace causing the TCP buffers and
- the drivers queue to be over-full before the node will actually
- be shut down (due to tick timeouts) by <c>net_kernel</c>. The
- normal reaction to take when this happens is some kind of
+ disappear without any trace, causing the TCP buffers and
+ the drivers queue to be over-full before the node is
+ shut down (because of tick time-outs) by <c>net_kernel</c>.
+ The normal reaction to take when this occurs is some kind of
premature shutdown of the other node.</p>
- <p>Note that ignoring the return value from this function would
- result in <em>unreliable</em> message passing, which is
+ <p>Notice that ignoring the return value from this function would
+ result in an <em>unreliable</em> message passing, which is
contradictory to the Erlang programming model. The message is
<em>not</em> sent if this function returns <c>false</c>.</p>
- <p>Note also that in many systems, transient states of
+ <p>In many systems, transient states of
overloaded queues are normal. The fact that this function
- returns <c>false</c> does not in any way mean that the other
+ returns <c>false</c> does not mean that the other
node is guaranteed to be non-responsive, it could be a
- temporary overload. Also a return value of <c>true</c> does
- only mean that the message could be sent on the (TCP) channel
- without blocking, the message is not guaranteed to have
- arrived at the remote node. Also in the case of a disconnected
+ temporary overload. Also, a return value of <c>true</c> does
+ only mean that the message can be sent on the (TCP) channel
+ without blocking, the message is not guaranteed to
+ arrive at the remote node. For a disconnected
non-responsive node, the return value is <c>true</c> (mimics
- the behaviour of the <c>!</c> operator). The expected
- behaviour as well as the actions to take when the function
- returns <c>false</c> are application and hardware specific.</p>
+ the behavior of operator <c>!</c>). The expected
+ behavior and the actions to take when the function
+ returns <c>false</c> are application- and hardware-specific.</p>
<warning>
- <p>Use with extreme care!</p>
+ <p>Use with extreme care.</p>
</warning>
</desc>
</func>
+
<func>
<name name="send_nosuspend" arity="3"/>
- <fsummary>Try to send a message without ever blocking</fsummary>
+ <fsummary>Tries to send a message without ever blocking.</fsummary>
<type name="dst"/>
<desc>
<p>The same as
- <seealso marker="#send/3">erlang:send(<anno>Dest</anno>, <anno>Msg</anno>, [nosuspend | <anno>Options</anno>])</seealso>,
- but with boolean return value.</p>
+ <seealso marker="#send/3">erlang:send(<anno>Dest</anno>,
+ <anno>Msg</anno>, [nosuspend | <anno>Options</anno>])</seealso>,
+ but with a Boolean return value.</p>
<p>This function behaves like
- <seealso marker="#send_nosuspend/2">erlang:send_nosuspend/2)</seealso>,
- but takes a third parameter, a list of options. The only
- currently implemented option is <c>noconnect</c>. The option
- <c>noconnect</c> makes the function return <c>false</c> if
+ <seealso marker="#send_nosuspend/2">erlang:send_nosuspend/2</seealso>,
+ but takes a third parameter, a list of options.
+ The only option is <c>noconnect</c>, which
+ makes the function return <c>false</c> if
the remote node is not currently reachable by the local
- node. The normal behaviour is to try to connect to the node,
- which may stall the process for a shorter period. The use of
- the <c>noconnect</c> option makes it possible to be
- absolutely sure not to get even the slightest delay when
+ node. The normal behavior is to try to connect to the node,
+ which can stall the process during a short period. The use of
+ option <c>noconnect</c> makes it possible to be
+ sure not to get the slightest delay when
sending to a remote process. This is especially useful when
- communicating with nodes who expect to always be
- the connecting part (i.e. nodes written in C or Java).</p>
+ communicating with nodes that expect to always be
+ the connecting part (that is, nodes written in C or Java).</p>
<p>Whenever the function returns <c>false</c> (either when a
suspend would occur or when <c>noconnect</c> was specified and
the node was not already connected), the message is guaranteed
<em>not</em> to have been sent.</p>
<warning>
- <p>Use with extreme care!</p>
+ <p>Use with extreme care.</p>
</warning>
</desc>
</func>
+
<func>
<name name="set_cookie" arity="2"/>
- <fsummary>Set the magic cookie of a node</fsummary>
+ <fsummary>Sets the magic cookie of a node.</fsummary>
<desc>
<p>Sets the magic cookie of <c><anno>Node</anno></c> to the atom
- <c><anno>Cookie</anno></c>. If <c><anno>Node</anno></c> is the local node, the function
+ <c><anno>Cookie</anno></c>. If <c><anno>Node</anno></c> is the
+ local node, the function
also sets the cookie of all other unknown nodes to
- <c><anno>Cookie</anno></c> (see
- <seealso marker="doc/reference_manual:distributed">Distributed Erlang</seealso> in the Erlang Reference Manual).</p>
+ <c><anno>Cookie</anno></c> (see Section
+ <seealso marker="doc/reference_manual:distributed">Distributed Erlang</seealso>
+ in the Erlang Reference Manual in System Documentation).</p>
<p>Failure: <c>function_clause</c> if the local node is not
alive.</p>
</desc>
</func>
+
<func>
<name name="setelement" arity="3"/>
- <type_desc variable="Index">1..tuple_size(<anno>Tuple1</anno>)</type_desc>
- <fsummary>Set Nth element of a tuple</fsummary>
+ <fsummary>Sets the Nth element of a tuple.</fsummary>
+ <type_desc variable="Index">1..tuple_size(<anno>Tuple1</anno></type_desc>
<desc>
- <p>Returns a tuple which is a copy of the argument <c><anno>Tuple1</anno></c>
- with the element given by the integer argument <c><anno>Index</anno></c>
+ <p>Returns a tuple that is a copy of argument
+ <c><anno>Tuple1</anno></c>
+ with the element given by integer argument
+ <c><anno>Index</anno></c>
(the first element is the element with index 1) replaced by
- the argument <c><anno>Value</anno></c>.</p>
+ argument <c><anno>Value</anno></c>, for example:</p>
<pre>
> <input>setelement(2, {10, green, bottles}, red).</input>
{10,red,bottles}</pre>
</desc>
</func>
+
<func>
<name name="size" arity="1"/>
- <fsummary>Size of a tuple or binary</fsummary>
+ <fsummary>Size of a tuple or binary.</fsummary>
<desc>
- <p>Returns an integer which is the size of the argument
- <c><anno>Item</anno></c>, which must be either a tuple or a binary.</p>
+ <p>Returns the number of elements in a tuple or the number of
+ bytes in a binary or bitstring, for example:</p>
<pre>
> <input>size({morni, mulle, bwange}).</input>
-3</pre>
+3
+> <input>size(&lt;&lt;11, 22, 33&gt;&gt;).</input>
+3
+</pre>
+ <p>For bitstrings the number of whole bytes is returned. That is, if the number of bits
+ in the bitstring is not divisible by 8, the resulting
+ number of bytes is rounded <em>down</em>.</p>
<p>Allowed in guard tests.</p>
+ <p>See also
+ <seealso marker="#tuple_size/1"><c>tuple_size/1</c></seealso>,
+ <seealso marker="#byte_size/1"><c>byte_size/1</c></seealso>
+ and
+ <seealso marker="#bit_size/1"><c>bit_size/1</c></seealso>.</p>
</desc>
</func>
+
<func>
<name name="spawn" arity="1"/>
- <fsummary>Create a new process with a fun as entry point</fsummary>
+ <fsummary>Creates a new process with a fun as entry point.</fsummary>
<desc>
- <p>Returns the pid of a new process started by the application
- of <c><anno>Fun</anno></c> to the empty list <c>[]</c>. Otherwise works
- like <seealso marker="#spawn/3">spawn/3</seealso>.</p>
+ <p>Returns the process identifier of a new process started by the
+ application of <c><anno>Fun</anno></c> to the empty list
+ <c>[]</c>. Otherwise
+ works like <seealso marker="#spawn/3">spawn/3</seealso>.</p>
</desc>
</func>
+
<func>
<name name="spawn" arity="2"/>
- <fsummary>Create a new process with a fun as entry point on a given node</fsummary>
+ <fsummary>Creates a new process with a fun as entry point on a given node.</fsummary>
<desc>
- <p>Returns the pid of a new process started by the application
- of <c><anno>Fun</anno></c> to the empty list <c>[]</c> on <c><anno>Node</anno></c>. If
- <c><anno>Node</anno></c> does not exist, a useless pid is returned.
- Otherwise works like
+ <p>Returns the process identifier of a new process started
+ by the application of <c><anno>Fun</anno></c> to the
+ empty list <c>[]</c> on <c><anno>Node</anno></c>. If
+ <c><anno>Node</anno></c> does not exist, a useless pid is
+ returned. Otherwise works like
<seealso marker="#spawn/3">spawn/3</seealso>.</p>
</desc>
</func>
+
<func>
<name name="spawn" arity="3"/>
- <fsummary>Create a new process with a function as entry point</fsummary>
- <desc>
- <p>Returns the pid of a new process started by the application
- of <c><anno>Module</anno>:<anno>Function</anno></c> to <c><anno>Args</anno></c>. The new process
- created will be placed in the system scheduler queue and be
- run some time later.</p>
- <p><c>error_handler:undefined_function(<anno>Module</anno>, <anno>Function</anno>, <anno>Args</anno>)</c> is evaluated by the new process if
- <c><anno>Module</anno>:<anno>Function</anno>/Arity</c> does not exist (where
- <c>Arity</c> is the length of <c><anno>Args</anno></c>). The error handler
+ <fsummary>Creates a new process with a function as entry point.</fsummary>
+ <desc>
+ <p>Returns the process identifier of a new process started by
+ the application of <c><anno>Module</anno>:<anno>Function</anno></c>
+ to <c><anno>Args</anno></c>.</p>
+ <p><c>error_handler:undefined_function(<anno>Module</anno>,
+ <anno>Function</anno>, <anno>Args</anno>)</c>
+ is evaluated by the new process if
+ <c><anno>Module</anno>:<anno>Function</anno>/Arity</c>
+ does not exist (where <c>Arity</c> is the length of
+ <c><anno>Args</anno></c>). The error handler
can be redefined (see
<seealso marker="#process_flag/2">process_flag/2</seealso>).
If <c>error_handler</c> is undefined, or the user has
- redefined the default <c>error_handler</c> its replacement is
- undefined, a failure with the reason <c>undef</c> will occur.</p>
+ redefined the default <c>error_handler</c> and its replacement is
+ undefined, a failure with reason <c>undef</c> occurs.</p>
+ <p>Example:</p>
<pre>
> <input>spawn(speed, regulator, [high_speed, thin_cut]).</input>
&lt;0.13.1></pre>
</desc>
</func>
+
<func>
<name name="spawn" arity="4"/>
- <fsummary>Create a new process with a function as entry point on a given node</fsummary>
+ <fsummary>Creates a new process with a function as entry point on a given node.</fsummary>
<desc>
- <p>Returns the pid of a new process started by the application
- of <c><anno>Module</anno>:<anno>Function</anno></c> to <c><anno>Args</anno></c> on <c>Node</c>. If
- <c><anno>Node</anno></c> does not exists, a useless pid is returned.
+ <p>Returns the process identifier (pid) of a new process started
+ by the application
+ of <c><anno>Module</anno>:<anno>Function</anno></c>
+ to <c><anno>Args</anno></c> on <c><anno>Node</anno></c>. If
+ <c><anno>Node</anno></c> does not exist, a useless pid is returned.
Otherwise works like
<seealso marker="#spawn/3">spawn/3</seealso>.</p>
</desc>
</func>
+
<func>
<name name="spawn_link" arity="1"/>
- <fsummary>Create and link to a new process with a fun as entry point</fsummary>
+ <fsummary>Creates and links to a new process with a fun as entry point.</fsummary>
<desc>
- <p>Returns the pid of a new process started by the application
- of <c><anno>Fun</anno></c> to the empty list []. A link is created between
+ <p>Returns the process identifier of a new process started by
+ the application of <c><anno>Fun</anno></c> to the empty list
+ <c>[]</c>. A link is created between
the calling process and the new process, atomically.
Otherwise works like
<seealso marker="#spawn/3">spawn/3</seealso>.</p>
</desc>
</func>
+
<func>
<name name="spawn_link" arity="2"/>
- <fsummary>Create and link to a new process with a fun as entry point on a specified node</fsummary>
+ <fsummary>Creates and links to a new process with a fun as entry point on a specified node.</fsummary>
<desc>
- <p>Returns the pid of a new process started by the application
- of <c><anno>Fun</anno></c> to the empty list [] on <c><anno>Node</anno></c>. A link is
+ <p>Returns the process identifier (pid) of a new process started
+ by the application of <c><anno>Fun</anno></c> to the empty
+ list <c>[]</c> on <c><anno>Node</anno></c>. A link is
created between the calling process and the new process,
- atomically. If <c><anno>Node</anno></c> does not exist, a useless pid is
- returned (and due to the link, an exit signal with exit
- reason <c>noconnection</c> will be received). Otherwise works
- like <seealso marker="#spawn/3">spawn/3</seealso>.</p>
+ atomically. If <c><anno>Node</anno></c> does not exist,
+ a useless pid is returned and an exit signal with
+ reason <c>noconnection</c> is sent to the calling
+ process. Otherwise works like <seealso marker="#spawn/3">spawn/3</seealso>.</p>
</desc>
</func>
+
<func>
<name name="spawn_link" arity="3"/>
- <fsummary>Create and link to a new process with a function as entry point</fsummary>
+ <fsummary>Creates and links to a new process with a function as entry point.</fsummary>
<desc>
- <p>Returns the pid of a new process started by the application
- of <c><anno>Module</anno>:<anno>Function</anno></c> to <c><anno>Args</anno></c>. A link is created
+ <p>Returns the process identifier of a new process started by
+ the application of <c><anno>Module</anno>:<anno>Function</anno></c>
+ to <c><anno>Args</anno></c>. A link is created
between the calling process and the new process, atomically.
Otherwise works like
<seealso marker="#spawn/3">spawn/3</seealso>.</p>
</desc>
</func>
+
<func>
<name name="spawn_link" arity="4"/>
- <fsummary>Create and link to a new process with a function as entry point on a given node</fsummary>
+ <fsummary>Creates and links to a new process with a function as entry point on a given node.</fsummary>
<desc>
- <p>Returns the pid of a new process started by the application
- of <c><anno>Module</anno>:<anno>Function</anno></c> to <c><anno>Args</anno></c> on <c>Node</c>. A
+ <p>Returns the process identifier (pid) of a new process
+ started by the application
+ of <c><anno>Module</anno>:<anno>Function</anno></c>
+ to <c><anno>Args</anno></c> on <c><anno>Node</anno></c>. A
link is created between the calling process and the new
- process, atomically. If <c><anno>Node</anno></c> does not exist, a useless
- pid is returned (and due to the link, an exit signal with exit
- reason <c>noconnection</c> will be received). Otherwise works
- like <seealso marker="#spawn/3">spawn/3</seealso>.</p>
+ process, atomically. If <c><anno>Node</anno></c> does
+ not exist, a useless pid is returned and an exit signal with
+ reason <c>noconnection</c> is sent to the calling
+ process. Otherwise works like <seealso marker="#spawn/3">spawn/3</seealso>.</p>
</desc>
</func>
+
<func>
<name name="spawn_monitor" arity="1"/>
- <fsummary>Create and monitor a new process with a fun as entry point</fsummary>
+ <fsummary>Creates and monitors a new process with a fun as entry point.</fsummary>
<desc>
- <p>Returns the pid of a new process started by the application
- of <c><anno>Fun</anno></c> to the empty list [] and reference for a monitor
- created to the new process.
+ <p>Returns the process identifier of a new process, started by
+ the application of <c><anno>Fun</anno></c> to the empty list
+ <c>[]</c>,
+ and a reference for a monitor created to the new process.
Otherwise works like
<seealso marker="#spawn/3">spawn/3</seealso>.</p>
</desc>
</func>
+
<func>
<name name="spawn_monitor" arity="3"/>
- <fsummary>Create and monitor a new process with a function as entry point</fsummary>
+ <fsummary>Creates and monitors a new process with a function as entry point.</fsummary>
<desc>
<p>A new process is started by the application
- of <c><anno>Module</anno>:<anno>Function</anno></c> to <c><anno>Args</anno></c>, and the process is
- monitored at the same time. Returns the pid and a reference
- for the monitor.
- Otherwise works like
+ of <c><anno>Module</anno>:<anno>Function</anno></c>
+ to <c><anno>Args</anno></c>. The process is
+ monitored at the same time. Returns the process identifier
+ and a reference for the monitor. Otherwise works like
<seealso marker="#spawn/3">spawn/3</seealso>.</p>
</desc>
</func>
+
<func>
<name name="spawn_opt" arity="2"/>
- <type name="priority_level" />
- <fsummary>Create a new process with a fun as entry point</fsummary>
+ <fsummary>Creates a new process with a fun as entry point.</fsummary>
+ <type name="priority_level"/>
<desc>
- <p>Returns the pid of a new process started by the application
- of <c><anno>Fun</anno></c> to the empty list <c>[]</c>. Otherwise
- works like
+ <p>Returns the process identifier (pid) of a new process
+ started by the application of <c><anno>Fun</anno></c>
+ to the empty list <c>[]</c>. Otherwise works like
<seealso marker="#spawn_opt/4">spawn_opt/4</seealso>.</p>
- <p>If the option <c>monitor</c> is given, the newly created
- process will be monitored and both the pid and reference for
- the monitor will be returned.</p>
+ <p>If option <c>monitor</c> is given, the newly created
+ process is monitored, and both the pid and reference for
+ the monitor is returned.</p>
</desc>
</func>
+
<func>
<name name="spawn_opt" arity="3"/>
- <type name="priority_level" />
- <fsummary>Create a new process with a fun as entry point on a given node</fsummary>
+ <fsummary>Creates a new process with a fun as entry point on a given node.</fsummary>
+ <type name="priority_level"/>
<desc>
- <p>Returns the pid of a new process started by the application
- of <c><anno>Fun</anno></c> to the empty list <c>[]</c> on <c><anno>Node</anno></c>. If
- <c><anno>Node</anno></c> does not exist, a useless pid is returned.
- Otherwise works like
+ <p>Returns the process identifier (pid) of a new process started
+ by the application of <c><anno>Fun</anno></c> to the
+ empty list <c>[]</c> on <c><anno>Node</anno></c>. If
+ <c><anno>Node</anno></c> does not exist, a useless pid is
+ returned. Otherwise works like
<seealso marker="#spawn_opt/4">spawn_opt/4</seealso>.</p>
</desc>
</func>
+
<func>
<name name="spawn_opt" arity="4"/>
- <type name="priority_level" />
- <fsummary>Create a new process with a function as entry point</fsummary>
+ <fsummary>Creates a new process with a function as entry point.</fsummary>
+ <type name="priority_level"/>
<desc>
- <p>Works exactly like
+ <p>Works as
<seealso marker="#spawn/3">spawn/3</seealso>, except that an
extra option list is given when creating the process.</p>
- <p>If the option <c>monitor</c> is given, the newly created
- process will be monitored and both the pid and reference for
- the monitor will be returned.</p>
+ <p>If option <c>monitor</c> is given, the newly created
+ process is monitored, and both the pid and reference for
+ the monitor is returned.</p>
+ <p>The options are as follows:</p>
<taglist>
<tag><c>link</c></tag>
<item>
@@ -5109,112 +5474,123 @@ true</pre>
</item>
<tag><c>monitor</c></tag>
<item>
- <p>Monitor the new process (just like
+ <p>Monitors the new process (like
<seealso marker="#monitor/2">monitor/2</seealso> does).</p>
</item>
- <tag><c>{priority, <anno>Level</anno>}</c></tag>
+ <tag><c>{priority, <anno>Level</anno></c></tag>
<item>
<p>Sets the priority of the new process. Equivalent to
executing
- <seealso marker="#process_flag_priority">process_flag(priority, <anno>Level</anno>)</seealso> in the start function of the new process,
- except that the priority will be set before the process is
- selected for execution for the first time. For more information
- on priorities see
- <seealso marker="#process_flag_priority">process_flag(priority, Level)</seealso>.</p>
+ <seealso marker="#process_flag_priority">process_flag(priority,
+ <anno>Level</anno>)</seealso>
+ in the start function of the new process,
+ except that the priority is set before the process is
+ selected for execution for the first time. For more
+ information on priorities, see
+ <seealso marker="#process_flag_priority">process_flag(priority,
+ <anno>Level</anno>)</seealso>.</p>
</item>
<tag><c>{fullsweep_after, <anno>Number</anno>}</c></tag>
<item>
- <p>This option is only useful for performance tuning.
- In general, you should not use this option unless you
- know that there is problem with execution times and/or
- memory consumption, and you should measure to make sure
- that the option improved matters.
- </p>
+ <p>Useful only for performance tuning. Do not use this
+ option unless you
+ know that there is problem with execution times or
+ memory consumption, and ensure
+ that the option improves matters.</p>
<p>The Erlang runtime system uses a generational garbage
collection scheme, using an "old heap" for data that has
survived at least one garbage collection. When there is
no more room on the old heap, a fullsweep garbage
- collection will be done.</p>
- <p>The <c>fullsweep_after</c> option makes it possible to
+ collection is done.</p>
+ <p>Option <c>fullsweep_after</c> makes it possible to
specify the maximum number of generational collections
- before forcing a fullsweep even if there is still room on
- the old heap. Setting the number to zero effectively
- disables the general collection algorithm, meaning that
+ before forcing a fullsweep, even if there is room on
+ the old heap. Setting the number to zero
+ disables the general collection algorithm, that is,
all live data is copied at every garbage collection.</p>
- <p>Here are a few cases when it could be useful to change
- <c>fullsweep_after</c>. Firstly, if binaries that are no
- longer used should be thrown away as soon as possible.
- (Set <c><anno>Number</anno></c> to zero.) Secondly, a process that
- mostly have short-lived data will be fullsweeped seldom
- or never, meaning that the old heap will contain mostly
- garbage. To ensure a fullsweep once in a while, set
- <c><anno>Number</anno></c> to a suitable value such as 10 or 20.
- Thirdly, in embedded systems with limited amount of RAM
- and no virtual memory, one might want to preserve memory
- by setting <c><anno>Number</anno></c> to zero. (The value may be set
- globally, see
- <seealso marker="#system_flag/2">erlang:system_flag/2</seealso>.)</p>
+ <p>A few cases when it can be useful to change
+ <c>fullsweep_after</c>:</p>
+ <list type="bulleted">
+ <item>If binaries that are no longer used are to be
+ thrown away as soon as possible. (Set
+ <c><anno>Number</anno></c> to zero.)
+ </item>
+ <item>A process that mostly have short-lived data is
+ fullsweeped seldom or never, that is, the old heap
+ contains mostly garbage. To ensure a fullsweep
+ occasionally, set <c><anno>Number</anno></c> to a
+ suitable value, such as 10 or 20.
+ </item>
+ <item>In embedded systems with a limited amount of RAM
+ and no virtual memory, you might want to preserve memory
+ by setting <c><anno>Number</anno></c> to zero.
+ (The value can be set globally, see
+ <seealso marker="#system_flag/2">erlang:system_flag/2</seealso>.)
+ </item>
+ </list>
</item>
<tag><c>{min_heap_size, <anno>Size</anno>}</c></tag>
<item>
- <p>This option is only useful for performance tuning.
- In general, you should not use this option unless you
- know that there is problem with execution times and/or
- memory consumption, and you should measure to make sure
- that the option improved matters.
- </p>
- <p>Gives a minimum heap size in words. Setting this value
- higher than the system default might speed up some
+ <p>Useful only for performance tuning. Do not use this
+ option unless you know that there is problem with
+ execution times or memory consumption, and
+ ensure that the option improves matters.</p>
+ <p>Gives a minimum heap size, in words. Setting this value
+ higher than the system default can speed up some
processes because less garbage collection is done.
- Setting too high value, however, might waste memory and
- slow down the system due to worse data locality.
- Therefore, it is recommended to use this option only for
+ However, setting a too high value can waste memory and
+ slow down the system because of worse data locality.
+ Therefore, use this option only for
fine-tuning an application and to measure the execution
time with various <c><anno>Size</anno></c> values.</p>
</item>
<tag><c>{min_bin_vheap_size, <anno>VSize</anno>}</c></tag>
<item>
- <p>This option is only useful for performance tuning.
- In general, you should not use this option unless you
- know that there is problem with execution times and/or
- memory consumption, and you should measure to make sure
- that the option improved matters.
- </p>
- <p>Gives a minimum binary virtual heap size in words. Setting this value
- higher than the system default might speed up some
+ <p>Useful only for performance tuning. Do not use this
+ option unless you know that there is problem with
+ execution times or memory consumption, and
+ ensure that the option improves matters.</p>
+ <p>Gives a minimum binary virtual heap size, in words.
+ Setting this value
+ higher than the system default can speed up some
processes because less garbage collection is done.
- Setting too high value, however, might waste memory.
- Therefore, it is recommended to use this option only for
+ However, setting a too high value can waste memory.
+ Therefore, use this option only for
fine-tuning an application and to measure the execution
time with various <c><anno>VSize</anno></c> values.</p>
</item>
-
</taglist>
</desc>
</func>
+
<func>
<name name="spawn_opt" arity="5"/>
- <type name="priority_level" />
- <fsummary>Create a new process with a function as entry point on a given node</fsummary>
+ <fsummary>Creates a new process with a function as entry point on a given node.</fsummary>
+ <type name="priority_level"/>
<desc>
- <p>Returns the pid of a new process started by the application
- of <c><anno>Module</anno>:<anno>Function</anno></c> to <c><anno>Args</anno></c> on <c>Node</c>. If
+ <p>Returns the process identifier (pid) of a new process started
+ by the application
+ of <c><anno>Module</anno>:<anno>Function</anno></c> to
+ <c><anno>Args</anno></c> on <c><anno>Node</anno></c>. If
<c><anno>Node</anno></c> does not exist, a useless pid is returned.
Otherwise works like
<seealso marker="#spawn_opt/4">spawn_opt/4</seealso>.</p>
- <note><p>The <c>monitor</c> option is currently not supported by
+ <note><p>Option <c>monitor</c> is not supported by
<c>spawn_opt/5</c>.</p></note>
</desc>
</func>
+
<func>
<name name="split_binary" arity="2"/>
+ <fsummary>Splits a binary into two.</fsummary>
<type_desc variable="Pos">0..byte_size(Bin)</type_desc>
- <fsummary>Split a binary into two</fsummary>
<desc>
- <p>Returns a tuple containing the binaries which are the result
- of splitting <c><anno>Bin</anno></c> into two parts at position <c><anno>Pos</anno></c>.
+ <p>Returns a tuple containing the binaries that are the result
+ of splitting <c><anno>Bin</anno></c> into two parts at
+ position <c><anno>Pos</anno></c>.
This is not a destructive operation. After the operation,
- there will be three binaries altogether.</p>
+ there are three binaries altogether.</p>
+ <p>Example:</p>
<pre>
> <input>B = list_to_binary("0123456789").</input>
&lt;&lt;"0123456789">>
@@ -5228,31 +5604,35 @@ true</pre>
7</pre>
</desc>
</func>
+
<func>
<name name="start_timer" arity="4"/>
- <fsummary>Start a timer</fsummary>
+ <fsummary>Starts a timer.</fsummary>
<desc>
<p>
Starts a timer. When the timer expires, the message
<c>{timeout, <anno>TimerRef</anno>, <anno>Msg</anno>}</c>
- will be sent to the process identified by
+ is sent to the process identified by
<c><anno>Dest</anno></c>.
</p>
- <p>Currently available <c><anno>Option</anno></c>s:</p>
+ <p>Available <c><anno>Option</anno></c>s:</p>
<taglist>
- <tag><c>{abs, Abs}</c></tag>
+ <tag><c>{abs, false}</c></tag>
<item>
<p>
- Absolute <c><anno>Time</anno></c> value. <c>Abs</c>
- defaults to <c>false</c> which means that the
- <c><anno>Time</anno></c> value will be interpreted
- as a time in milli-seconds relative current
+ This is the default. It means the
+ <c><anno>Time</anno></c> value is interpreted
+ as a time in milli-seconds <em>relative</em> current
<seealso marker="time_correction#Erlang_Monotonic_Time">Erlang
- monotonic time</seealso>. When <c>Abs</c> is set to
- <c>true</c>, the <c><anno>Time</anno></c> value will
- be interpreted as an absolute Erlang monotonic time of
- milli-seconds
- <seealso marker="#type_time_unit">time unit</seealso>.
+ monotonic time</seealso>.
+ </p>
+ </item>
+ <tag><c>{abs, true}</c></tag>
+ <item>
+ <p>
+ Absolute <c><anno>Time</anno></c> value. The
+ <c><anno>Time</anno></c> value is interpreted as an
+ absolute Erlang monotonic time in milli-seconds.
</p>
</item>
</taglist>
@@ -5260,7 +5640,7 @@ true</pre>
More <c><anno>Option</anno></c>s may be added in the future.
</p>
<p>
- The absolute point in time that the timer is set to expire on
+ The absolute point in time, the timer is set to expire on,
has to be in the interval
<c>[</c><seealso marker="#system_info_start_time"><c>erlang:system_info(start_time)</c></seealso><c>,
</c><seealso marker="#system_info_end_time"><c>erlang:system_info(end_time)</c></seealso><c>]</c>.
@@ -5268,21 +5648,21 @@ true</pre>
is not allowed to be negative.
</p>
<p>
- If <c><anno>Dest</anno></c> is a <c>pid()</c>, it has to
+ If <c><anno>Dest</anno></c> is a <c>pid()</c>, it must
be a <c>pid()</c> of a process created on the current
runtime system instance. This process may or may not
have terminated. If <c><anno>Dest</anno></c> is an
- <c>atom()</c>, it will be interpreted as the name of a
+ <c>atom()</c>, it is interpreted as the name of a
locally registered process. The process referred to by the
name is looked up at the time of timer expiration. No error
is given if the name does not refer to a process.
</p>
<p>
- If <c><anno>Dest</anno></c> is a <c>pid()</c>, the timer will
- be automatically canceled if the process referred to by the
- <c>pid()</c> is not alive, or when the process exits. This
- feature was introduced in erts version 5.4.11. Note that
- timers will not be automatically canceled when
+ If <c><anno>Dest</anno></c> is a <c>pid()</c>, the timer is
+ automatically canceled if the process referred to by the
+ <c>pid()</c> is not alive, or if the process exits. This
+ feature was introduced in ERTS version 5.4.11. Notice that
+ timers are not automatically canceled when
<c><anno>Dest</anno></c> is an <c>atom()</c>.
</p>
<p>See also
@@ -5290,13 +5670,14 @@ true</pre>
<seealso marker="#cancel_timer/2"><c>erlang:cancel_timer/2</c></seealso>,
and
<seealso marker="#read_timer/2"><c>erlang:read_timer/2</c></seealso>.</p>
- <p>Failure: <c>badarg</c> if the arguments does not satisfy
- the requirements specified above.</p>
+ <p>Failure: <c>badarg</c> if the arguments do not satisfy
+ the requirements specified here.</p>
</desc>
</func>
+
<func>
<name name="start_timer" arity="3"/>
- <fsummary>Start a timer</fsummary>
+ <fsummary>Starts a timer.</fsummary>
<desc>
<p>Starts a timer. The same as calling
<seealso marker="#start_timer/4"><c>erlang:start_timer(<anno>Time</anno>,
@@ -5305,126 +5686,137 @@ true</pre>
</func>
<func>
<name name="statistics" arity="1" clause_i="1"/>
- <fsummary>Information about context switches</fsummary>
+ <fsummary>Information about context switches.</fsummary>
<desc>
- <p><c><anno>ContextSwitches</anno></c> is the total number of context
- switches since the system started.</p>
+ <p>Returns the total number of context switches since the
+ system started.</p>
</desc>
</func>
+
<func>
<name name="statistics" arity="1" clause_i="2"/>
- <fsummary>Information about exact reductions</fsummary>
+ <fsummary>Information about exact reductions.</fsummary>
<desc>
<marker id="statistics_exact_reductions"></marker>
- <note><p><c>statistics(exact_reductions)</c> is
- a more expensive operation than
- <seealso marker="#statistics_reductions">statistics(reductions)</seealso>
- especially on an Erlang machine with SMP support.</p>
- </note>
+ <p>Returns the number of exact reductions.</p>
+ <note><p><c>statistics(exact_reductions)</c> is
+ a more expensive operation than
+ <seealso marker="#statistics_reductions">statistics(reductions)</seealso>,
+ especially on an Erlang machine with SMP support.</p>
+ </note>
</desc>
</func>
+
<func>
<name name="statistics" arity="1" clause_i="3"/>
- <fsummary>Information about garbage collection</fsummary>
+ <fsummary>Information about garbage collection.</fsummary>
<desc>
- <p>This information may not be valid for all implementations.</p>
+ <p>Returns information about garbage collection, for example:</p>
<pre>
> <input>statistics(garbage_collection).</input>
-{85,23961,0}
-</pre>
+{85,23961,0}</pre>
+ <p>This information can be invalid for some implementations.</p>
</desc>
</func>
+
<func>
<name name="statistics" arity="1" clause_i="4"/>
- <fsummary>Information about io</fsummary>
+ <fsummary>Information about I/O.</fsummary>
<desc>
- <p><c><anno>Input</anno></c> is the total number of bytes received
- through ports, and <c><anno>Output</anno></c> is the total number of
- bytes output to ports.</p>
+ <p>Returns <c><anno>Input</anno></c>,
+ which is the total number of bytes
+ received through ports, and <c><anno>Output</anno></c>,
+ which is the total number of bytes output to ports.</p>
</desc>
</func>
+
<func>
<name name="statistics" arity="1" clause_i="5"/>
- <fsummary>Information about reductions</fsummary>
+ <fsummary>Information about reductions.</fsummary>
<desc>
<marker id="statistics_reductions"></marker>
- <note>
- <p>Since erts-5.5 (OTP release R11B)
- this value does not include reductions performed in current
- time slices of currently scheduled processes. If an
- exact value is wanted, use
- <seealso marker="#statistics_exact_reductions">statistics(exact_reductions)</seealso>.</p>
- </note>
+ <p>Returns information about reductions, for example:</p>
<pre>
> <input>statistics(reductions).</input>
-{2046,11}
-</pre>
+{2046,11}</pre>
+ <note><p>As from <c>ERTS</c> 5.5 (OTP R11B),
+ this value does not include reductions performed in current
+ time slices of currently scheduled processes. If an
+ exact value is wanted, use
+ <seealso marker="#statistics_exact_reductions">statistics(exact_reductions)</seealso>.</p>
+ </note>
</desc>
</func>
+
<func>
<name name="statistics" arity="1" clause_i="6"/>
- <fsummary>Information about the run-queue</fsummary>
+ <fsummary>Information about the run-queue.</fsummary>
<desc>
- <p>Returns the total length of the run queues, that is, the number
- of processes that are ready to run on all available run queues.</p>
+ <p>Returns the total length of run-queues, that is, the number
+ of processes that are ready to run on all available run-queues.</p>
</desc>
</func>
+
<func>
<name name="statistics" arity="1" clause_i="7"/>
- <fsummary>Information about run-time</fsummary>
+ <fsummary>Information about runtime.</fsummary>
<desc>
- <p>Note that the run-time is the sum of the run-time for all
- threads in the Erlang run-time system and may therefore be greater
- than the wall-clock time. The time is returned in milliseconds.</p>
+ <p>Returns information about runtime, in milliseconds.</p>
+ <p>This is the sum of the runtime for all threads
+ in the Erlang runtime system and can therefore be greater
+ than the wall clock time.</p>
+ <p>Example:</p>
<pre>
> <input>statistics(runtime).</input>
-{1690,1620}
-</pre>
+{1690,1620}</pre>
</desc>
</func>
+
<func>
<name name="statistics" arity="1" clause_i="8"/>
- <fsummary>Information about each schedulers work time</fsummary>
- <desc>
- <marker id="statistics_scheduler_wall_time"></marker>
- <p>
- Returns a list of tuples with <c>{<anno>SchedulerId</anno>,
- <anno>ActiveTime</anno>, <anno>TotalTime</anno>}</c>, where
- <c>SchedulerId</c> is an integer id of the scheduler, <c>ActiveTime</c> is
- the duration the scheduler has been busy, <c>TotalTime</c> is the total time duration since
- <seealso marker="#system_flag_scheduler_wall_time">scheduler_wall_time</seealso>
- activation. The time unit is not defined and may be subject to change
- between releases, operating systems and system restarts.
- <c>scheduler_wall_time</c> should only be used to calculate relative
- values for scheduler-utilization. <c>ActiveTime</c> can never exceed <c>TotalTime</c>.
- </p>
-
- <p>The definition of a busy scheduler is when it is not idle or not
- scheduling (selecting) a process or port, meaning; executing process
- code, executing linked-in-driver or NIF code, executing
- built-in-functions or any other runtime handling, garbage collecting
- or handling any other memory management. Note, a scheduler may also be
- busy even if the operating system has scheduled out the scheduler
- thread.
- </p>
-
- <p>
- Returns <c>undefined</c> if the system flag
- <seealso marker="#system_flag_scheduler_wall_time">scheduler_wall_time</seealso>
- is turned off.
- </p>
-
- <p>The list of scheduler information is unsorted and may appear in different order
- between calls.
- </p>
- <p>Using <c>scheduler_wall_time</c> to calculate scheduler utilization.</p>
+ <fsummary>Information about each schedulers work time.</fsummary>
+ <desc>
+ <marker id="statistics_scheduler_wall_time"></marker>
+ <p>Returns a list of tuples with
+ <c>{<anno>SchedulerId</anno>, <anno>ActiveTime</anno>,
+ <anno>TotalTime</anno>}</c>, where
+ <c><anno>SchedulerId</anno></c> is an integer ID of the scheduler,
+ <c><anno>ActiveTime</anno></c> is
+ the duration the scheduler has been busy, and
+ <c><anno>TotalTime</anno></c> is the total time duration since
+ <seealso marker="#system_flag_scheduler_wall_time">scheduler_wall_time</seealso>
+ activation. The time unit is undefined and can be subject
+ to change between releases, OSs, and system restarts.
+ <c>scheduler_wall_time</c> is only to be used to
+ calculate relative values for scheduler-utilization.
+ <c><anno>ActiveTime</anno></c> can never exceed
+ <c><anno>TotalTime</anno></c>.</p>
+ <p>The definition of a busy scheduler is when it is not idle
+ and is not scheduling (selecting) a process or port,
+ that is:</p>
+ <list type="bulleted">
+ <item>Executing process code</item>
+ <item>Executing linked-in-driver or NIF code</item>
+ <item>Executing built-in-functions, or any other runtime
+ handling</item>
+ <item>Garbage collecting</item>
+ <item>Handling any other memory management</item>
+ </list>
+ <p>Notice that a scheduler can also be busy even if the
+ OS has scheduled out the scheduler thread.</p>
+ <p>Returns <c>undefined</c> if system flag
+ <seealso marker="#system_flag_scheduler_wall_time">scheduler_wall_time</seealso>
+ is turned off.</p>
+ <p>The list of scheduler information is unsorted and can
+ appear in different order between calls.</p>
+ <p>Using <c>scheduler_wall_time</c> to calculate scheduler-utilization:</p>
<pre>
> <input>erlang:system_flag(scheduler_wall_time, true).</input>
false
> <input>Ts0 = lists:sort(erlang:statistics(scheduler_wall_time)), ok.</input>
-ok
-</pre>
- <p>Some time later we will take another snapshot and calculate scheduler-utilization per scheduler.</p>
+ok</pre>
+ <p>Some time later the user takes another snapshot and calculates
+ scheduler-utilization per scheduler, for example:</p>
<pre>
> <input>Ts1 = lists:sort(erlang:statistics(scheduler_wall_time)), ok.</input>
ok
@@ -5437,86 +5829,90 @@ ok
{5,0.9717956667018103},
{6,0.9739235846420741},
{7,0.973237033077876},
- {8,0.9741297293248656}]
-</pre>
- <p>Using the same snapshots to calculate a total scheduler-utilization.</p>
+ {8,0.9741297293248656}]</pre>
+ <p>Using the same snapshots to calculate a total scheduler-utilization:</p>
<pre>
> <input>{A, T} = lists:foldl(fun({{_, A0, T0}, {_, A1, T1}}, {Ai,Ti}) ->
{Ai + (A1 - A0), Ti + (T1 - T0)} end, {0, 0}, lists:zip(Ts0,Ts1)), A/T.</input>
-0.9769136803764825
-</pre>
+0.9769136803764825</pre>
<note>
- <p><c>scheduler_wall_time</c> is by default disabled. Use <c>erlang:system_flag(scheduler_wall_time, true)</c> to enable it. </p>
+ <p><c>scheduler_wall_time</c> is by default disabled. To
+ enable it, use
+ <c>erlang:system_flag(scheduler_wall_time, true)</c>.</p>
</note>
</desc>
</func>
+
<func>
<name name="statistics" arity="1" clause_i="9"/>
- <fsummary>Information about wall-clock</fsummary>
+ <fsummary>Information about wall clock.</fsummary>
<desc>
- <p><c>wall_clock</c> can be used in the same manner as
+ <p>Returns information about wall clock. <c>wall_clock</c> can
+ be used in the same manner as
<c>runtime</c>, except that real time is measured as
opposed to runtime or CPU time.</p>
</desc>
</func>
+
<func>
<name name="suspend_process" arity="2"/>
- <fsummary>Suspend a process</fsummary>
+ <fsummary>Suspends a process.</fsummary>
<desc>
<p>Increases the suspend count on the process identified by
- <c><anno>Suspendee</anno></c> and puts it in the suspended state if it isn't
- already in the suspended state. A suspended process will not be
- scheduled for execution until the process has been resumed.
- </p>
-
+ <c><anno>Suspendee</anno></c> and puts it in the suspended
+ state if it is not
+ already in that state. A suspended process will not be
+ scheduled for execution until the process has been resumed.</p>
<p>A process can be suspended by multiple processes and can
be suspended multiple times by a single process. A suspended
- process will not leave the suspended state until its suspend
- count reach zero. The suspend count of <c><anno>Suspendee</anno></c>
- is decreased when
+ process does not leave the suspended state until its suspend
+ count reaches zero. The suspend count of
+ <c><anno>Suspendee</anno></c> is decreased when
<seealso marker="#resume_process/1">erlang:resume_process(<anno>Suspendee</anno>)</seealso>
is called by the same process that called
- <c>erlang:suspend_process(<anno>Suspendee</anno>)</c>. All increased suspend
- counts on other processes acquired by a process will automatically be
+ <c>erlang:suspend_process(<anno>Suspendee</anno>)</c>.
+ All increased suspend
+ counts on other processes acquired by a process are automatically
decreased when the process terminates.</p>
-
- <p>Currently the following options (<c><anno>Opt</anno></c>s) are available:</p>
+ <p>The options (<c><anno>Opt</anno></c>s) are as follows:</p>
<taglist>
<tag><c>asynchronous</c></tag>
<item>
A suspend request is sent to the process identified by
- <c><anno>Suspendee</anno></c>. <c><anno>Suspendee</anno></c> will eventually suspend
- unless it is resumed before it was able to suspend. The caller
- of <c>erlang:suspend_process/2</c> will return immediately,
- regardless of whether the <c><anno>Suspendee</anno></c> has suspended yet
- or not. Note that the point in time when the <c><anno>Suspendee</anno></c>
- will actually suspend cannot be deduced from other events
- in the system. The only guarantee given is that the
- <c><anno>Suspendee</anno></c> will <em>eventually</em> suspend (unless it
- is resumed). If the <c>asynchronous</c> option has <em>not</em>
- been passed, the caller of <c>erlang:suspend_process/2</c> will
- be blocked until the <c><anno>Suspendee</anno></c> has actually suspended.
+ <c><anno>Suspendee</anno></c>. <c><anno>Suspendee</anno></c>
+ eventually suspends
+ unless it is resumed before it could suspend. The caller
+ of <c>erlang:suspend_process/2</c> returns immediately,
+ regardless of whether <c><anno>Suspendee</anno></c> has
+ suspended yet or not. The point in time when
+ <c><anno>Suspendee</anno></c> suspends cannot be deduced
+ from other events in the system. It is only guaranteed that
+ <c><anno>Suspendee</anno></c> <em>eventually</em> suspends
+ (unless it
+ is resumed). If option <c>asynchronous</c> has <em>not</em>
+ been passed, the caller of <c>erlang:suspend_process/2</c> is
+ blocked until <c><anno>Suspendee</anno></c> has suspended.
</item>
<tag><c>unless_suspending</c></tag>
<item>
- The process identified by <c><anno>Suspendee</anno></c> will be suspended
- unless the calling process already is suspending the
- <c><anno>Suspendee</anno></c>. If <c>unless_suspending</c> is combined
- with the <c>asynchronous</c> option, a suspend request will be
- sent unless the calling process already is suspending the
- <c><anno>Suspendee</anno></c> or if a suspend request already has been sent
- and is in transit. If the calling process already is suspending
- the <c><anno>Suspendee</anno></c>, or if combined with the <c>asynchronous</c>
- option and a send request already is in transit,
- <c>false</c> is returned and the suspend count on <c><anno>Suspendee</anno></c>
- will remain unchanged.
+ The process identified by <c><anno>Suspendee</anno></c> is
+ suspended unless the calling process already is suspending
+ <c><anno>Suspendee</anno></c>.
+ If <c>unless_suspending</c> is combined
+ with option <c>asynchronous</c>, a suspend request is
+ sent unless the calling process already is suspending
+ <c><anno>Suspendee</anno></c> or if a suspend request
+ already has been sent and is in transit. If the calling
+ process already is suspending <c><anno>Suspendee</anno></c>,
+ or if combined with option <c>asynchronous</c>
+ and a send request already is in transit,
+ <c>false</c> is returned and the suspend count on
+ <c><anno>Suspendee</anno></c> remains unchanged.
</item>
</taglist>
-
<p>If the suspend count on the process identified by
- <c><anno>Suspendee</anno></c> was increased, <c>true</c> is returned; otherwise,
- <c>false</c> is returned.</p>
-
+ <c><anno>Suspendee</anno></c> is increased, <c>true</c>
+ is returned, otherwise <c>false</c>.</p>
<warning>
<p>This BIF is intended for debugging only.</p>
</warning>
@@ -5524,310 +5920,322 @@ ok
<taglist>
<tag><c>badarg</c></tag>
<item>
- If <c><anno>Suspendee</anno></c> isn't a process identifier.
+ If <c><anno>Suspendee</anno></c> is not a process identifier.
</item>
<tag><c>badarg</c></tag>
<item>
- If the process identified by <c><anno>Suspendee</anno></c> is same the process as
- the process calling <c>erlang:suspend_process/2</c>.
+ If the process identified by <c><anno>Suspendee</anno></c>
+ is the same process
+ as the process calling <c>erlang:suspend_process/2</c>.
</item>
<tag><c>badarg</c></tag>
<item>
- If the process identified by <c><anno>Suspendee</anno></c> is not alive.
+ If the process identified by <c><anno>Suspendee</anno></c>
+ is not alive.
</item>
<tag><c>badarg</c></tag>
<item>
- If the process identified by <c><anno>Suspendee</anno></c> resides on another node.
+ If the process identified by <c><anno>Suspendee</anno></c>
+ resides on another node.
</item>
<tag><c>badarg</c></tag>
<item>
- If <c><anno>OptList</anno></c> isn't a proper list of valid <c><anno>Opt</anno></c>s.
+ If <c><anno>OptList</anno></c> is not a proper list of valid
+ <c><anno>Opt</anno></c>s.
</item>
<tag><c>system_limit</c></tag>
<item>
- If the process identified by <c><anno>Suspendee</anno></c> has been suspended more
- times by the calling process than can be represented by the
- currently used internal data structures. The current system limit
- is larger than 2 000 000 000 suspends, and it will never be less
- than that.
+ If the process identified by <c><anno>Suspendee</anno></c>
+ has been suspended
+ more times by the calling process than can be represented by the
+ currently used internal data structures. The system limit is
+ higher than 2,000,000,000 suspends and will never be lower.
</item>
</taglist>
</desc>
</func>
+
<func>
<name name="suspend_process" arity="1"/>
- <fsummary>Suspend a process</fsummary>
+ <fsummary>Suspends a process.</fsummary>
<desc>
- <p>Suspends the process identified by <c><anno>Suspendee</anno></c>. The
- same as calling
- <seealso marker="#suspend_process/2">erlang:suspend_process(<anno>Suspendee</anno>, [])</seealso>. For more information see the documentation of <seealso marker="#suspend_process/2">erlang:suspend_process/2</seealso>.
- </p>
+ <p>Suspends the process identified by
+ <c><anno>Suspendee</anno></c>. The same as calling
+ <seealso marker="#suspend_process/2">erlang:suspend_process(<anno>Suspendee</anno>,
+ [])</seealso>.</p>
<warning>
<p>This BIF is intended for debugging only.</p>
</warning>
</desc>
</func>
+
<func>
<name name="system_flag" arity="2" clause_i="1"/>
- <fsummary>Set system flag backtrace_depth</fsummary>
+ <fsummary>Sets system flag <c>backtrace_depth</c>.</fsummary>
<desc>
<p>Sets the maximum depth of call stack back-traces in the
exit reason element of <c>'EXIT'</c> tuples.</p>
<p>Returns the old value of the flag.</p>
</desc>
</func>
+
<func>
<name name="system_flag" arity="2" clause_i="2"/>
+ <fsummary>Sets system flag <c>cpu_topology</c>.</fsummary>
<type name="cpu_topology"/>
<type name="level_entry"/>
<type name="level_tag"/>
<type name="sub_level"/>
<type name="info_list"/>
- <fsummary>Set system flag cpu_topology</fsummary>
<desc>
<warning>
<p><marker id="system_flag_cpu_topology"></marker>
- This argument is <em>deprecated</em> and
- scheduled for removal in erts-5.10/OTP-R16. Instead of using
- this argument you are advised to use the <c>erl</c> command
- line argument <seealso marker="erts:erl#+sct">+sct</seealso>.
- When this argument has been removed a final CPU topology to use
- will be determined at emulator boot time.</p>
+ This argument is <em>deprecated</em> and scheduled for
+ removal in <c>ERTS</c> 5.10/OTP R16. Instead of using this
+ argument, use command-line argument
+ <seealso marker="erts:erl#+sct">+sct</seealso> in
+ <c>erl(1)</c>.</p>
+ <p>When this argument is removed, a final CPU topology
+ to use is determined at emulator boot time.</p>
</warning>
- <p>Sets the user defined <c><anno>CpuTopology</anno></c>. The user defined
- CPU topology will override any automatically detected
- CPU topology. By passing <c>undefined</c> as <c><anno>CpuTopology</anno></c>
- the system will revert back to the CPU topology automatically
+ <p>Sets the user-defined <c><anno>CpuTopology</anno></c>.
+ The user-defined
+ CPU topology overrides any automatically detected
+ CPU topology. By passing <c>undefined</c> as
+ <c><anno>CpuTopology</anno></c>,
+ the system reverts to the CPU topology automatically
detected. The returned value equals the value returned
from <c>erlang:system_info(cpu_topology)</c> before the
- change was made.
- </p>
+ change was made.</p>
<p>Returns the old value of the flag.</p>
<p>The CPU topology is used when binding schedulers to logical
processors. If schedulers are already bound when the CPU
- topology is changed, the schedulers will be sent a request
- to rebind according to the new CPU topology.
- </p>
- <p>The user defined CPU topology can also be set by passing
- the <seealso marker="erts:erl#+sct">+sct</seealso> command
- line argument to <c>erl</c>.
- </p>
- <p>For information on the <c><anno>CpuTopology</anno></c> type
- and more, see the documentation of
- <seealso marker="#system_info_cpu_topology">erlang:system_info(cpu_topology)</seealso>,
- and the <c>erl</c> <seealso marker="erts:erl#+sct">+sct</seealso>
- and <seealso marker="erts:erl#+sbt">+sbt</seealso>
- command line flags.
- </p>
+ topology is changed, the schedulers are sent a request
+ to rebind according to the new CPU topology.</p>
+ <p>The user-defined CPU topology can also be set by passing
+ command-line argument
+ <seealso marker="erts:erl#+sct">+sct</seealso> to
+ <c>erl(1)</c>.</p>
+ <p>For information on type <c><anno>CpuTopology</anno></c>
+ and more, see
+ <seealso marker="#system_info_cpu_topology">erlang:system_info(cpu_topology)</seealso>
+ as well as the command-line flags
+ <seealso marker="erts:erl#+sct">+sct</seealso> and
+ <seealso marker="erts:erl#+sbt">+sbt</seealso> in
+ <c>erl(1)</c>.</p>
</desc>
</func>
+
<func>
<name name="system_flag" arity="2" clause_i="3"/>
- <fsummary>Set system flag dirty CPU schedulers online</fsummary>
+ <fsummary>Sets <c>system_flag_dirty_cpu_schedulers_online</c>.</fsummary>
<desc>
<p><marker id="system_flag_dirty_cpu_schedulers_online"></marker>
- Sets the amount of dirty CPU schedulers online. Valid range is
- <![CDATA[1 <= DirtyCPUSchedulersOnline <= N]]> where <c>N</c> is the
- lesser of the return values of <c>erlang:system_info(dirty_cpu_schedulers)</c> and
- <c>erlang:system_info(schedulers_online)</c>.
- </p>
+ Sets the number of dirty CPU schedulers online. Range is
+ <![CDATA[1 <= DirtyCPUSchedulersOnline <= N]]>, where <c>N</c>
+ is the smallest of the return values of
+ <c>erlang:system_info(dirty_cpu_schedulers)</c> and
+ <c>erlang:system_info(schedulers_online)</c>.</p>
<p>Returns the old value of the flag.</p>
- <p>Note that the number of dirty CPU schedulers online may change if the number of
- schedulers online changes. For example, if there are 12 schedulers and all are
- online, and 6 dirty CPU schedulers, all online as well, and <c>system_flag/2</c>
- is used to set the number of schedulers online to 6, then the number of dirty
- CPU schedulers online is automatically decreased by half as well, down to 3.
- Similarly, the number of dirty CPU schedulers online increases proportionally
- to increases in the number of schedulers online.</p>
- <p><em>Note that the dirty schedulers functionality is experimental</em>, and
- that you have to enable support for dirty schedulers when building OTP in order
- to try out the functionality.</p>
- <p>For more information see
+ <p>The number of dirty CPU schedulers online can change if the
+ number of schedulers online changes. For example, if 12
+ schedulers and 6 dirty CPU schedulers are online, and
+ <c>system_flag/2</c> is used to set the number of
+ schedulers online to 6, then the number of dirty CPU
+ schedulers online is automatically decreased by half as well,
+ down to 3. Similarly, the number of dirty CPU schedulers
+ online increases proportionally to increases in the number of
+ schedulers online.</p>
+ <note><p>The dirty schedulers functionality is experimental.
+ Enable support for dirty schedulers when building OTP to
+ try out the functionality.</p>
+ </note>
+ <p>For more information, see
<seealso marker="#system_info_dirty_cpu_schedulers">erlang:system_info(dirty_cpu_schedulers)</seealso>
and
- <seealso marker="#system_info_dirty_cpu_schedulers_online">erlang:system_info(dirty_cpu_schedulers_online)</seealso>.
- </p>
+ <seealso marker="#system_info_dirty_cpu_schedulers_online">erlang:system_info(dirty_cpu_schedulers_online)</seealso>.</p>
</desc>
</func>
+
<func>
<name name="system_flag" arity="2" clause_i="4"/>
- <fsummary>Set system flag fullsweep_after</fsummary>
+ <fsummary>Sets system flag <c>fullsweep_after</c>.</fsummary>
<desc>
- <p><c><anno>Number</anno></c> is a non-negative integer which indicates
+ <p>Sets system flag <c>fullsweep_after</c>.
+ <c><anno>Number</anno></c> is a non-negative integer indicating
how many times generational garbage collections can be
done without forcing a fullsweep collection. The value
- applies to new processes; processes already running are
+ applies to new processes, while processes already running are
not affected.</p>
<p>Returns the old value of the flag.</p>
<p>In low-memory systems (especially without virtual
- memory), setting the value to 0 can help to conserve
+ memory), setting the value to <c>0</c> can help to conserve
memory.</p>
- <p>An alternative way to set this value is through the
- (operating system) environment variable
- <c>ERL_FULLSWEEP_AFTER</c>.</p>
+ <p>This value can also be set through (OS)
+ environment variable <c>ERL_FULLSWEEP_AFTER</c>.</p>
</desc>
</func>
+
<func>
<name name="system_flag" arity="2" clause_i="5"/>
- <fsummary>Set system flag min_heap_size</fsummary>
- <desc>
- <p>Sets the default minimum heap size for processes. The
- size is given in words. The new <c>min_heap_size</c> only
- effects processes spawned after the change of
- <c>min_heap_size</c> has been made.
- The <c>min_heap_size</c> can be set for individual
- processes by use of
+ <fsummary>Sets system flag <c>min_heap_size</c>.</fsummary>
+ <desc>
+ <p>Sets the default minimum heap size for processes. The size
+ is given in words. The new <c>min_heap_size</c> effects
+ only processes spawned after the change of
+ <c>min_heap_size</c> has been made. <c>min_heap_size</c>
+ can be set for individual processes by using
<seealso marker="#spawn_opt/4">spawn_opt/N</seealso> or
- <seealso marker="#process_flag/2">process_flag/2</seealso>. </p>
+ <seealso marker="#process_flag/2">process_flag/2</seealso>.</p>
<p>Returns the old value of the flag.</p>
</desc>
</func>
+
<func>
<name name="system_flag" arity="2" clause_i="6"/>
- <fsummary>Set system flag min_bin_vheap_size</fsummary>
+ <fsummary>Sets system flag <c>min_bin_vheap_size</c>.</fsummary>
<desc>
- <p>Sets the default minimum binary virtual heap size for processes. The
- size is given in words. The new <c>min_bin_vhheap_size</c> only
- effects processes spawned after the change of
+ <p>Sets the default minimum binary virtual heap size for
+ processes. The size is given in words.
+ The new <c>min_bin_vhheap_size</c> effects only
+ processes spawned after the change of
<c>min_bin_vhheap_size</c> has been made.
- The <c>min_bin_vheap_size</c> can be set for individual
- processes by use of
+ <c>min_bin_vheap_size</c> can be set for individual
+ processes by using
<seealso marker="#spawn_opt/4">spawn_opt/N</seealso> or
- <seealso marker="#process_flag/2">process_flag/2</seealso>. </p>
+ <seealso marker="#process_flag/2">process_flag/2</seealso>.</p>
<p>Returns the old value of the flag.</p>
</desc>
</func>
+
<func>
<name name="system_flag" arity="2" clause_i="7"/>
- <fsummary>Set system flag multi_scheduling</fsummary>
+ <fsummary>Sets system flag <c>multi_scheduling</c>.</fsummary>
<desc>
<p><marker id="system_flag_multi_scheduling"></marker>
If multi-scheduling is enabled, more than one scheduler
thread is used by the emulator. Multi-scheduling can be
- blocked. When multi-scheduling has been blocked, only
- one scheduler thread will schedule Erlang processes.</p>
- <p>If <c><anno>BlockState</anno> =:= block</c>, multi-scheduling will
- be blocked. If <c><anno>BlockState</anno> =:= unblock</c> and no-one
- else is blocking multi-scheduling and this process has
- only blocked one time, multi-scheduling will be unblocked.
- One process can block multi-scheduling multiple times.
- If a process has blocked multiple times, it has to
+ blocked. When multi-scheduling is blocked, only
+ one scheduler thread schedules Erlang processes.</p>
+ <p>If <c><anno>BlockState</anno> =:= block</c>, multi-scheduling is
+ blocked. If <c><anno>BlockState</anno> =:= unblock</c> and no one
+ else blocks multi-scheduling, and this process has
+ blocked only once, multi-scheduling is unblocked.</p>
+ <p>One process can block multi-scheduling multiple times.
+ If a process has blocked multiple times, it must
unblock exactly as many times as it has blocked before it
has released its multi-scheduling block. If a process that
- has blocked multi-scheduling exits, it will release its
+ has blocked multi-scheduling exits, it releases its
blocking of multi-scheduling.</p>
<p>The return values are <c>disabled</c>, <c>blocked</c>,
or <c>enabled</c>. The returned value describes the
state just after the call to
<c>erlang:system_flag(multi_scheduling, <anno>BlockState</anno>)</c>
- has been made. The return values are described in the
- documentation of <seealso marker="#system_info_multi_scheduling">erlang:system_info(multi_scheduling)</seealso>.</p>
- <p><em>NOTE</em>: Blocking of multi-scheduling should normally
- not be needed. If you feel that you need to
- block multi-scheduling, think through the
- problem at least a couple of times again.
- Blocking multi-scheduling should only be used
- as a last resort since it will most likely be
- a <em>very inefficient</em> way to solve the
- problem.</p>
- <p>See also <seealso marker="#system_info_multi_scheduling">erlang:system_info(multi_scheduling)</seealso>,
+ has been made. For information about the return values, see
+ <seealso marker="#system_info_multi_scheduling">erlang:system_info(multi_scheduling)</seealso>.</p>
+ <note><p>Blocking of multi-scheduling is normally not needed.
+ If you feel that you need to block multi-scheduling,
+ consider it a few more times again. Blocking multi-scheduling
+ is only to be used as a last resort, as it is most likely
+ a <em>very inefficient</em> way to solve the problem.</p>
+ </note>
+ <p>See also
+ <seealso marker="#system_info_multi_scheduling">erlang:system_info(multi_scheduling)</seealso>,
<seealso marker="#system_info_multi_scheduling_blockers">erlang:system_info(multi_scheduling_blockers)</seealso>, and
<seealso marker="#system_info_schedulers">erlang:system_info(schedulers)</seealso>.</p>
</desc>
</func>
+
<func>
<name name="system_flag" arity="2" clause_i="8"/>
+ <fsummary>Sets system flag <c>scheduler_bind_type</c>.</fsummary>
<type name="scheduler_bind_type"/>
- <fsummary>Set system flag scheduler_bind_type</fsummary>
<desc>
<warning>
<p><marker id="system_flag_scheduler_bind_type"></marker>
- This argument is <em>deprecated</em> and
- scheduled for removal in erts-5.10/OTP-R16. Instead of using
- this argument you are advised to use the <c>erl</c> command
- line argument <seealso marker="erts:erl#+sbt">+sbt</seealso>.
- When this argument has been removed a final scheduler bind type
- to use will be determined at emulator boot time.</p>
+ This argument is <em>deprecated</em> and scheduled for
+ removal in <c>ERTS</c> 5.10/OTP R16. Instead of using this
+ argument, use command-line argument
+ <seealso marker="erts:erl#+sbt">+sbt</seealso> in <c>erl(1)</c>.
+ When this argument is removed, a final scheduler bind
+ type to use is determined at emulator boot time.</p>
</warning>
<p>Controls if and how schedulers are bound to logical
processors.</p>
- <p>When <c>erlang:system_flag(scheduler_bind_type, <anno>How</anno>)</c> is
- called, an asynchronous signal is sent to all schedulers
- online which causes them to try to bind or unbind as requested.
- <em>NOTE:</em> If a scheduler fails to bind, this
- will often be silently ignored. This since it isn't always
- possible to verify valid logical processor identifiers. If
- an error is reported, it will be reported to the
- <c>error_logger</c>. If you want to verify that the
- schedulers actually have bound as requested, call
- <seealso marker="#system_info_scheduler_bindings">erlang:system_info(scheduler_bindings)</seealso>.
- </p>
- <p>Schedulers can currently only be bound on newer Linux,
+ <p>When <c>erlang:system_flag(scheduler_bind_type, <anno>How</anno>)</c>
+ is called, an asynchronous signal is sent to all schedulers
+ online, causing them to try to bind or unbind as requested.</p>
+ <note><p>If a scheduler fails to bind, this is often silently
+ ignored, as it is not always possible to verify valid
+ logical processor identifiers. If an error is reported,
+ it is reported to <c>error_logger</c>. To verify that the
+ schedulers have bound as requested, call
+ <seealso marker="#system_info_scheduler_bindings">erlang:system_info(scheduler_bindings)</seealso>.</p>
+ </note>
+ <p>Schedulers can be bound on newer Linux,
Solaris, FreeBSD, and Windows systems, but more systems will be
- supported in the future.
- </p>
+ supported in future releases.</p>
<p>In order for the runtime system to be able to bind schedulers,
- the CPU topology needs to be known. If the runtime system fails
- to automatically detect the CPU topology, it can be defined.
+ the CPU topology must be known. If the runtime system fails
+ to detect the CPU topology automatically, it can be defined.
For more information on how to define the CPU topology, see
- the <c>erl</c> <seealso marker="erts:erl#+sct">+sct</seealso> command
- line flag.
- </p>
- <p>The runtime system will by default <em>not</em> bind schedulers
- to logical processors.
- </p>
- <p><em>NOTE:</em> If the Erlang runtime system is the only
- operating system process that binds threads to logical processors,
- this improves the performance of the runtime system. However,
- if other operating system processes (as for example another Erlang
- runtime system) also bind threads to logical processors, there
- might be a performance penalty instead. In some cases this
- performance penalty might be severe. If this is the case, you
- are advised to not bind the schedulers.</p>
- <p>Schedulers can be bound in different ways. The <c><anno>How</anno></c>
- argument determines how schedulers are bound. <c><anno>How</anno></c> can
- currently be one of:</p>
+ command-line flag <seealso marker="erts:erl#+sct">+sct</seealso>
+ in <c>erl(1)</c>.</p>
+ <p>The runtime system does by default <em>not</em> bind schedulers
+ to logical processors.</p>
+ <note><p>If the Erlang runtime system is the only OS
+ process binding threads to logical processors, this
+ improves the performance of the runtime system. However,
+ if other OS processes (for example, another Erlang
+ runtime system) also bind threads to logical processors,
+ there can be a performance penalty instead. Sometimes this
+ performance penalty can be severe. If so, it is recommended
+ to not bind the schedulers.</p>
+ </note>
+ <p>Schedulers can be bound in different ways. Argument
+ <c><anno>How</anno></c> determines how schedulers are
+ bound and can be any of the following:</p>
<taglist>
<tag><c>unbound</c></tag>
- <item><p>Same as the <c>erl</c> command line argument
- <seealso marker="erts:erl#+sbt">+sbt u</seealso>.
+ <item><p>Same as command-line argument
+ <seealso marker="erts:erl#+sbt">+sbt u</seealso> in <c>erl(1)</c>.
</p></item>
<tag><c>no_spread</c></tag>
- <item><p>Same as the <c>erl</c> command line argument
- <seealso marker="erts:erl#+sbt">+sbt ns</seealso>.
+ <item><p>Same as command-line argument
+ <seealso marker="erts:erl#+sbt">+sbt ns</seealso> in <c>erl(1)</c>.
</p></item>
<tag><c>thread_spread</c></tag>
- <item><p>Same as the <c>erl</c> command line argument
- <seealso marker="erts:erl#+sbt">+sbt ts</seealso>.
+ <item><p>Same as command-line argument
+ <seealso marker="erts:erl#+sbt">+sbt ts</seealso> in <c>erl(1)</c>.
</p></item>
<tag><c>processor_spread</c></tag>
- <item><p>Same as the <c>erl</c> command line argument
- <seealso marker="erts:erl#+sbt">+sbt ps</seealso>.
+ <item><p>Same as command-line argument
+ <seealso marker="erts:erl#+sbt">+sbt ps</seealso> in <c>erl(1)</c>.
</p></item>
<tag><c>spread</c></tag>
- <item><p>Same as the <c>erl</c> command line argument
- <seealso marker="erts:erl#+sbt">+sbt s</seealso>.
+ <item><p>Same as command-line argument
+ <seealso marker="erts:erl#+sbt">+sbt s</seealso> in <c>erl(1)</c>.
</p></item>
<tag><c>no_node_thread_spread</c></tag>
- <item><p>Same as the <c>erl</c> command line argument
- <seealso marker="erts:erl#+sbt">+sbt nnts</seealso>.
+ <item><p>Same as command-line argument
+ <seealso marker="erts:erl#+sbt">+sbt nnts</seealso> in <c>erl(1)</c>.
</p></item>
<tag><c>no_node_processor_spread</c></tag>
- <item><p>Same as the <c>erl</c> command line argument
- <seealso marker="erts:erl#+sbt">+sbt nnps</seealso>.
+ <item><p>Same as command-line argument
+ <seealso marker="erts:erl#+sbt">+sbt nnps</seealso> in <c>erl(1)</c>.
</p></item>
<tag><c>thread_no_node_processor_spread</c></tag>
- <item><p>Same as the <c>erl</c> command line argument
- <seealso marker="erts:erl#+sbt">+sbt tnnps</seealso>.
+ <item><p>Same as command-line argument
+ <seealso marker="erts:erl#+sbt">+sbt tnnps</seealso> in <c>erl(1)</c>.
</p></item>
<tag><c>default_bind</c></tag>
- <item><p>Same as the <c>erl</c> command line argument
- <seealso marker="erts:erl#+sbt">+sbt db</seealso>.
+ <item><p>Same as command-line argument
+ <seealso marker="erts:erl#+sbt">+sbt db</seealso> in <c>erl(1)</c>.
</p></item>
</taglist>
- <p>The value returned equals <c><anno>How</anno></c> before the
- <c>scheduler_bind_type</c> flag was changed.</p>
- <p>Failure:</p>
+ <p>The returned value equals <c><anno>How</anno></c> before flag
+ <c>scheduler_bind_type</c> was changed.</p>
+ <p>Failures:</p>
<taglist>
<tag><c>notsup</c></tag>
<item>
@@ -5835,168 +6243,171 @@ ok
</item>
<tag><c>badarg</c></tag>
<item>
- <p>If <c>How</c> isn't one of the documented alternatives.</p>
+ <p>If <c><anno>How</anno></c> is not one of the documented
+ alternatives.</p>
</item>
<tag><c>badarg</c></tag>
<item>
- <p>If no CPU topology information is available.</p>
+ <p>If CPU topology information is unavailable.</p>
</item>
</taglist>
<p>The scheduler bind type can also be set by passing
- the <seealso marker="erts:erl#+sbt">+sbt</seealso> command
- line argument to <c>erl</c>.
- </p>
+ command-line argument
+ <seealso marker="erts:erl#+sbt">+sbt</seealso> to <c>erl(1)</c>.</p>
<p>For more information, see
<seealso marker="#system_info_scheduler_bind_type">erlang:system_info(scheduler_bind_type)</seealso>,
<seealso marker="#system_info_scheduler_bindings">erlang:system_info(scheduler_bindings)</seealso>,
- the <c>erl</c> <seealso marker="erts:erl#+sbt">+sbt</seealso>
- and <seealso marker="erts:erl#+sct">+sct</seealso> command line
- flags.
- </p>
+ as well as command-line flags
+ <seealso marker="erts:erl#+sbt">+sbt</seealso>
+ and <seealso marker="erts:erl#+sct">+sct</seealso>
+ in <c>erl(1)</c>.</p>
</desc>
</func>
+
<func>
<name name="system_flag" arity="2" clause_i="9"/>
- <fsummary>Set system flag scheduler_wall_time</fsummary>
+ <fsummary>Sets system flag <c>scheduler_wall_time</c>.</fsummary>
<desc><p><marker id="system_flag_scheduler_wall_time"></marker>
- Turns on/off scheduler wall time measurements. </p>
- <p>For more information see,
- <seealso marker="#statistics_scheduler_wall_time">erlang:statistics(scheduler_wall_time)</seealso>.
- </p>
+ Turns on or off scheduler wall time measurements.</p>
+ <p>For more information, see
+ <seealso marker="#statistics_scheduler_wall_time">erlang:statistics(scheduler_wall_time)</seealso>.</p>
</desc>
</func>
+
<func>
<name name="system_flag" arity="2" clause_i="10"/>
- <fsummary>Set system flag schedulers_online</fsummary>
+ <fsummary>Sets system flag <c>schedulers_online</c>.</fsummary>
<desc>
<p><marker id="system_flag_schedulers_online"></marker>
- Sets the amount of schedulers online. Valid range is
- <![CDATA[1 <= SchedulersOnline <= erlang:system_info(schedulers)]]>.
- </p>
+ Sets the number of schedulers online. Range is
+ <![CDATA[1 <= SchedulersOnline <= erlang:system_info(schedulers)]]>.</p>
<p>Returns the old value of the flag.</p>
- <p>Note that if the emulator was built with support for <seealso
- marker="#system_flag_dirty_cpu_schedulers_online">dirty schedulers</seealso>,
- changing the number of schedulers online can also change the number of dirty
- CPU schedulers online. For example, if there are 12 schedulers and all are
- online, and 6 dirty CPU schedulers, all online as well, and <c>system_flag/2</c>
- is used to set the number of schedulers online to 6, then the number of dirty
- CPU schedulers online is automatically decreased by half as well, down to 3.
- Similarly, the number of dirty CPU schedulers online increases proportionally
- to increases in the number of schedulers online.</p>
- <p>For more information see,
- <seealso marker="#system_info_schedulers">erlang:system_info(schedulers)</seealso>,
+ <p>If the emulator was built with support for
+ <seealso marker="#system_flag_dirty_cpu_schedulers_online">dirty schedulers</seealso>,
+ changing the number of schedulers online can also change the
+ number of dirty CPU schedulers online. For example, if 12
+ schedulers and 6 dirty CPU schedulers are online, and
+ <c>system_flag/2</c> is used to set the number of schedulers
+ online to 6, then the number of dirty CPU schedulers online
+ is automatically decreased by half as well, down to 3.
+ Similarly, the number of dirty CPU schedulers online increases
+ proportionally to increases in the number of schedulers online.</p>
+ <p>For more information, see
+ <seealso marker="#system_info_schedulers">erlang:system_info(schedulers)</seealso>
and
- <seealso marker="#system_info_schedulers_online">erlang:system_info(schedulers_online)</seealso>.
- </p>
+ <seealso marker="#system_info_schedulers_online">erlang:system_info(schedulers_online)</seealso>.</p>
</desc>
</func>
+
<func>
<name name="system_flag" arity="2" clause_i="11"/>
- <fsummary>Set system flag trace_control_word</fsummary>
+ <fsummary>Sets system flag <c>trace_control_word</c>.</fsummary>
<desc>
- <p>Sets the value of the node's trace control word to
- <c><anno>TCW</anno></c>. <c><anno>TCW</anno></c> should be an unsigned integer. For
- more information see documentation of the
+ <p>Sets the value of the node trace control word to
+ <c><anno>TCW</anno></c>, which is to be an unsigned integer.
+ For more information, see the function
<seealso marker="erts:match_spec#set_tcw">set_tcw</seealso>
- function in the match specification documentation in the
- ERTS User's Guide.</p>
+ in Section "Match Specifications in Erlang" in the
+ User's Guide.</p>
<p>Returns the old value of the flag.</p>
</desc>
</func>
- <marker id="system_flag_time_offset"/>
+
<func>
<name name="system_flag" arity="2" clause_i="12"/>
<fsummary>Finalize the Time Offset</fsummary>
<desc>
- <p>Finalizes the <seealso marker="#time_offset/0">time offset</seealso>
- when the <seealso marker="time_correction#Single_Time_Warp_Mode">single
- time warp mode</seealso> is being used. If another time warp mode than
- the "single time warp mode" is used, the time offset state will be left
- unchanged.</p>
- <p>Returns the old state identifier. That is, if:</p>
+ <p><marker id="system_flag_time_offset"></marker>
+ Finalizes the <seealso marker="#time_offset/0">time offset</seealso>
+ when <seealso marker="time_correction#Single_Time_Warp_Mode">single
+ time warp mode</seealso> is used. If another time warp mode
+ is used, the time offset state is left unchanged.</p>
+ <p>Returns the old state identifier. That is:</p>
<list>
- <item><p><c>preliminary</c> is returned, finalization was
+ <item><p>If <c>preliminary</c> is returned, finalization was
performed and the time offset is now final.</p></item>
- <item><p><c>final</c> is returned, the time offset was
- already in the final state. This either due to another
+ <item><p>If <c>final</c> is returned, the time offset was
+ already in the final state. This either because another
<c>erlang:system_flag(time_offset, finalize)</c> call, or
- due to the
- <seealso marker="time_correction#No_Time_Warp_Mode">no
- time warp mode</seealso> being used.</p></item>
+ because <seealso marker="time_correction#No_Time_Warp_Mode">no
+ time warp mode</seealso> is used.</p></item>
- <item><p><c>volatile</c> is returned, the time offset
- cannot be finalized due to the
+ <item><p>If <c>volatile</c> is returned, the time offset
+ cannot be finalized because
<seealso marker="time_correction#Multi_Time_Warp_Mode">multi
- time warp mode</seealso> being used.</p></item>
+ time warp mode</seealso> is used.</p></item>
</list>
</desc>
</func>
+
<func>
<name name="system_info" arity="1" clause_i="1"/>
<name name="system_info" arity="1" clause_i="2"/>
<name name="system_info" arity="1" clause_i="3"/>
<name name="system_info" arity="1" clause_i="4"/>
<name name="system_info" arity="1" clause_i="5"/>
+ <fsummary>Information about the system allocators.</fsummary>
<type variable="Allocator" name_i="2"/>
<type variable="Version" name_i="2"/>
<type variable="Features" name_i="2"/>
<type variable="Settings" name_i="2"/>
<type variable="Alloc" name_i="3"/>
- <fsummary>Information about the allocators of the system</fsummary>
<desc>
- <p>
- Returns various information about the
- <marker id="system_info_allocator_tags">allocators</marker> of the
+ <marker id="system_info_allocator_tags"></marker>
+ <p>Returns various information about the allocators of the
current system (emulator) as specified by
<c><anno>Item</anno></c>:</p>
+ <marker id="system_info_allocated_areas"></marker>
<taglist>
- <tag><marker id="system_info_allocated_areas"><c>allocated_areas</c></marker></tag>
+ <tag><c>allocated_areas</c></tag>
<item>
<p>Returns a list of tuples with information about
miscellaneous allocated memory areas.</p>
- <p>Each tuple contains an atom describing type of memory as
- first element and amount of allocated memory in bytes as
- second element. In those cases when there is information
- present about allocated and used memory, a third element
- is present. This third element contains the amount of
+ <p>Each tuple contains an atom describing the type of
+ memory as first element and the amount of allocated
+ memory in bytes as second element. When information
+ about allocated and used memory is present, also a
+ third element is present, containing the amount of
used memory in bytes.</p>
<p><c>erlang:system_info(allocated_areas)</c> is intended
- for debugging, and the content is highly implementation
- dependent. The content of the results will therefore
- change when needed without prior notice.</p>
- <p><em>Note:</em> The sum of these values is <em>not</em>
+ for debugging, and the content is highly
+ implementation-dependent. The content of the results
+ therefore changes when needed without prior notice.</p>
+ <p>Notice that the sum of these values is <em>not</em>
the total amount of memory allocated by the emulator.
Some values are part of other values, and some memory
- areas are not part of the result. If you are interested
- in the total amount of memory allocated by the emulator
- see <seealso marker="#memory/0">erlang:memory/0,1</seealso>.</p>
+ areas are not part of the result. For information about
+ the total amount of memory allocated by the emulator, see
+ <seealso marker="#memory/0">erlang:memory/0,1</seealso>.</p>
</item>
- <tag><marker id="system_info_allocator"><c>allocator</c></marker></tag>
+ <tag><c>allocator</c></tag>
<item>
- <p>Returns <c>{<anno>Allocator</anno>, <anno>Version</anno>, <anno>Features</anno>, <anno>Settings</anno>}.</c></p>
- <p>Explanation:</p>
+ <marker id="system_info_allocator"></marker>
+ <p>Returns <c>{<anno>Allocator</anno>, <anno>Version</anno>,
+ <anno>Features</anno>, <anno>Settings</anno></c>, where:</p>
<list type="bulleted">
<item>
- <p><c><anno>Allocator</anno></c> corresponds to the <c>malloc()</c>
- implementation used. If <c><anno>Allocator</anno></c> equals
+ <p><c><anno>Allocator</anno></c> corresponds to the
+ <c>malloc()</c> implementation used. If
+ <c><anno>Allocator</anno></c> equals
<c>undefined</c>, the <c>malloc()</c> implementation
- used could not be identified. Currently
- <c>glibc</c> can be identified.</p>
+ used cannot be identified. <c>glibc</c> can be
+ identified.</p>
</item>
<item>
- <p><c><anno>Version</anno></c> is a list of integers (but not a
- string) representing the version of
+ <p><c><anno>Version</anno></c> is a list of integers
+ (but not a string) representing the version of
the <c>malloc()</c> implementation used.</p>
</item>
<item>
- <p><c><anno>Features</anno></c> is a list of atoms representing
- allocation features used.</p>
+ <p><c><anno>Features</anno></c> is a list of atoms
+ representing the allocation features used.</p>
</item>
<item>
- <p><c><anno>Settings</anno></c> is a list of subsystems, their
- configurable parameters, and used values. Settings
- may differ between different combinations of
+ <p><c><anno>Settings</anno></c> is a list of subsystems,
+ their configurable parameters, and used values. Settings
+ can differ between different combinations of
platforms, allocators, and allocation features.
Memory sizes are given in bytes.</p>
</item>
@@ -6004,165 +6415,169 @@ ok
<p>See also "System Flags Effecting erts_alloc" in
<seealso marker="erts:erts_alloc#flags">erts_alloc(3)</seealso>.</p>
</item>
- <tag><marker id="system_info_alloc_util_allocators"><c>alloc_util_allocators</c></marker></tag>
+ <tag><c>alloc_util_allocators</c></tag>
<item>
- <p>Returns a list of the names of all allocators
- using the ERTS internal <c>alloc_util</c> framework
- as atoms. For more information see the
- <seealso marker="erts:erts_alloc#alloc_util">"the
- alloc_util framework" section in the
- erts_alloc(3)</seealso> documentation.
- </p>
+ <marker id="system_info_alloc_util_allocators"></marker>
+ <p>Returns a list of the names of all allocators using
+ the <c>ERTS</c> internal <c>alloc_util</c> framework
+ as atoms. For more information, see Section
+ <seealso marker="erts:erts_alloc#alloc_util">"The
+ alloc_util framework" in erts_alloc(3)</seealso>.</p>
</item>
- <tag><marker id="system_info_allocator_tuple"><c>{allocator, <anno>Alloc</anno>}</c></marker></tag>
+ <tag><c>{allocator, <anno>Alloc</anno>}</c></tag>
<item>
+ <marker id="system_info_allocator_tuple"></marker>
<p>Returns information about the specified allocator.
- As of erts version 5.6.1 the return value is a list
- of <c>{instance, InstanceNo, InstanceInfo}</c> tuples
+ As from <c>ERTS</c> 5.6.1, the return value is a list
+ of <c>{instance, InstanceNo, InstanceInfo}</c> tuples,
where <c>InstanceInfo</c> contains information about
- a specific instance of the allocator. As of erts version
- 5.10.4 the returned list when calling
+ a specific instance of the allocator. As from
+ <c>ERTS</c> 5.10.4, the returned list when calling
<c>erlang:system_info({allocator, mseg_alloc})</c> also
- include an <c>{erts_mmap, _}</c> tuple as one element
- in the list.
- If <c><anno>Alloc</anno></c> is not a recognized allocator,
- <c>undefined</c> is returned. If <c><anno>Alloc</anno></c> is disabled,
+ includes an <c>{erts_mmap, _}</c> tuple as one element
+ in the list. If <c><anno>Alloc</anno></c> is not a
+ recognized allocator, <c>undefined</c> is returned.
+ If <c><anno>Alloc</anno></c> is disabled,
<c>false</c> is returned.</p>
- <p><em>Note:</em> The information returned is highly
- implementation dependent and may be changed, or removed
+ <p>Notice that the information returned is highly
+ implementation-dependent and can be changed or removed
at any time without prior notice. It was initially
intended as a tool when developing new allocators, but
- since it might be of interest for others it has been
+ as it can be of interest for others it has been
briefly documented.</p>
<p>The recognized allocators are listed in
<seealso marker="erts:erts_alloc">erts_alloc(3)</seealso>.
After reading the <c>erts_alloc(3)</c> documentation,
the returned information
- should more or less speak for itself. But it can be worth
+ more or less speaks for itself, but it can be worth
explaining some things. Call counts are presented by two
- values. The first value is giga calls, and the second
- value is calls. <c>mbcs</c>, and <c>sbcs</c> are
- abbreviations for, respectively, multi-block carriers, and
- single-block carriers. Sizes are presented in bytes. When
- it is not a size that is presented, it is the amount of
- something. Sizes and amounts are often presented by three
- values, the first is current value, the second is maximum
- value since the last call to
- <c>erlang:system_info({allocator, Alloc})</c>, and
- the third is maximum value since the emulator was started.
- If only one value is present, it is the current value.
+ values, the first value is giga calls, and the second
+ value is calls. <c>mbcs</c> and <c>sbcs</c> denote
+ multi-block carriers, and single-block carriers,
+ respectively. Sizes are presented in bytes. When a
+ size is not presented, it is the amount of something.
+ Sizes and amounts are often presented by three values:</p>
+ <list type="bulleted">
+ <item>The first is the current value.</item>
+ <item>The second is the maximum value since the last call
+ to <c>erlang:system_info({allocator, Alloc})</c>.</item>
+ <item>The third is the maximum value since the emulator
+ was started.</item>
+ </list>
+ <p>If only one value is present, it is the current value.
<c>fix_alloc</c> memory block types are presented by two
- values. The first value is memory pool size and
- the second value used memory size.</p>
+ values. The first value is the memory pool size and
+ the second value is the used memory size.</p>
</item>
- <tag><marker id="system_info_allocator_sizes"><c>{allocator_sizes, <anno>Alloc</anno>}</c></marker></tag>
+ <tag><c>{allocator_sizes, <anno>Alloc</anno>}</c></tag>
<item>
+ <marker id="system_info_allocator_sizes"></marker>
<p>Returns various size information for the specified
allocator. The information returned is a subset of the
information returned by
- <seealso marker="#system_info_allocator_tuple">erlang:system_info({allocator, <anno>Alloc</anno>})</seealso>.
+ <seealso marker="#system_info_allocator_tuple"><c>erlang:system_info({allocator, <anno>Alloc</anno>})</c></seealso>.
</p>
</item>
</taglist>
</desc>
</func>
+
<func>
<name name="system_info" arity="1" clause_i="10"/>
<name name="system_info" arity="1" clause_i="11"/>
+ <fsummary>Information about the CPU topology of the system.</fsummary>
<type name="cpu_topology"/>
<type name="level_entry"/>
<type_desc name="cpu_topology">
- <marker id="system_info_cpu_topology"></marker>
All <c><anno>LevelEntry</anno></c>s of a list
must contain the same <c><anno>LevelTag</anno></c>, except
on the top level where both <c>node</c> and
- <c>processor</c> <c><anno>LevelTag</anno></c>s may co-exist.
+ <c>processor</c> <c><anno>LevelTag</anno></c>s can coexist.
</type_desc>
<type_desc name="level_entry">
- <c>{<anno>LevelTag</anno>, <anno>SubLevel</anno>} == {<anno>LevelTag</anno>, [], <anno>SubLevel</anno>}</c>
+ <c>{<anno>LevelTag</anno>,
+ <anno>SubLevel</anno>} == {<anno>LevelTag</anno>, [],
+ <anno>SubLevel</anno>}</c>
</type_desc>
<type name="level_tag"/>
<type_desc name="level_tag">
- More <c><anno>LevelTag</anno></c>s may be introduced in the future.
+ More <c><anno>LevelTag</anno></c>s can be introduced in a
+ future release.
</type_desc>
<type name="sub_level"/>
<type name="info_list"/>
<type_desc name="info_list">
- The <c>info_list()</c> may be extended in the future.
+ The <c>info_list()</c> can be extended in a future release.
</type_desc>
- <fsummary>Information about the CPU topology of the system</fsummary>
<desc>
- <p>Returns various information about the
- <marker id="system_info_cpu_topology_tags">CPU topology</marker>
- of the current system
- (emulator) as specified by <c><anno>Item</anno></c>:</p>
+ <marker id="system_info_cpu_topology_tags"></marker>
+ <marker id="system_info_cpu_topology"></marker>
+ <p>Returns various information about the CPU topology of
+ the current system (emulator) as specified by
+ <c><anno>Item</anno></c>:</p>
<taglist>
<tag><c>cpu_topology</c></tag>
<item>
- <p>Returns the <c><anno>CpuTopology</anno></c> which currently is used by the
- emulator. The CPU topology is used when binding schedulers
+ <p>Returns the <c><anno>CpuTopology</anno></c> currently used by
+ the emulator. The CPU topology is used when binding schedulers
to logical processors. The CPU topology used is the
- <seealso marker="erlang#system_info_cpu_topology_defined">user
- defined CPU topology</seealso> if such exists; otherwise, the
- <seealso marker="erlang#system_info_cpu_topology_detected">automatically
- detected CPU topology</seealso> if such exists. If no CPU topology
+ <seealso marker="erlang#system_info_cpu_topology_defined">user-defined CPU topology</seealso>,
+ if such exists, otherwise the
+ <seealso marker="erlang#system_info_cpu_topology_detected">automatically detected CPU topology</seealso>,
+ if such exists. If no CPU topology
exists, <c>undefined</c> is returned.</p>
- <p><c>node</c> refers to NUMA (non-uniform memory access)
- nodes, and <c>thread</c> refers to hardware threads
- (e.g. Intels hyper-threads).</p>
- <p>A level in the <c><anno>CpuTopology</anno></c> term can be omitted if
- only one entry exists and the <c><anno>InfoList</anno></c> is empty.
- </p>
+ <p><c>node</c> refers to Non-Uniform Memory Access (NUMA)
+ nodes. <c>thread</c> refers to hardware threads
+ (for example, Intel hyper-threads).</p>
+ <p>A level in term <c><anno>CpuTopology</anno></c> can be
+ omitted if only one entry exists and
+ <c><anno>InfoList</anno></c> is empty.</p>
<p><c>thread</c> can only be a sub level to <c>core</c>.
- <c>core</c> can be a sub level to either <c>processor</c>
- or <c>node</c>. <c>processor</c> can either be on the
+ <c>core</c> can be a sub level to <c>processor</c>
+ or <c>node</c>. <c>processor</c> can be on the
top level or a sub level to <c>node</c>. <c>node</c>
- can either be on the top level or a sub level to
+ can be on the top level or a sub level to
<c>processor</c>. That is, NUMA nodes can be processor
internal or processor external. A CPU topology can
consist of a mix of processor internal and external
- NUMA nodes, as long as each logical CPU belongs to one
- and only one NUMA node. Cache hierarchy is not part of
- the <c><anno>CpuTopology</anno></c> type yet, but will be in the
- future. Other things may also make it into the CPU
- topology in the future. In other words, expect the
- <c><anno>CpuTopology</anno></c> type to change.
- </p>
- </item>
- <tag><marker id="system_info_cpu_topology_defined"><c>{cpu_topology, defined}</c></marker></tag>
- <item>
- <p>Returns the user defined <c><anno>CpuTopology</anno></c>. For more
- information see the documentation of
- the <c>erl</c> <seealso marker="erts:erl#+sct">+sct</seealso> command
- line flag, and the documentation of the
- <seealso marker="#system_info_cpu_topology">cpu_topology</seealso>
- argument.
- </p>
- </item>
- <tag><marker id="system_info_cpu_topology_detected"><c>{cpu_topology, detected}</c></marker></tag>
- <item>
- <p>Returns the automatically detected <c><anno>CpuTopology</anno></c>. The
- emulator currently only detects the CPU topology on some newer
- Linux, Solaris, FreeBSD, and Windows systems. On Windows system with
- more than 32 logical processors the CPU topology is not detected.
- </p>
- <p>For more information see the documentation of the
- <seealso marker="#system_info_cpu_topology">cpu_topology</seealso>
- argument.
- </p>
+ NUMA nodes, as long as each logical CPU belongs to
+ <em>one</em> NUMA node. Cache hierarchy is not part of
+ the <c><anno>CpuTopology</anno></c> type, but will be in a
+ future release. Other things can also make it into the CPU
+ topology in a future release. In other words, expect the
+ <c><anno>CpuTopology</anno></c> type to change.</p>
+ </item>
+ <tag><c>{cpu_topology, defined}</c></tag>
+ <item>
+ <marker id="system_info_cpu_topology_defined"></marker>
+ <p>Returns the user-defined <c><anno>CpuTopology</anno></c>.
+ For more information, see command-line flag
+ <seealso marker="erts:erl#+sct">+sct</seealso> in
+ <c>erl(1)</c> and argument
+ <seealso marker="#system_info_cpu_topology">cpu_topology</seealso>.</p>
+ </item>
+ <tag><c>{cpu_topology, detected}</c></tag>
+ <item>
+ <marker id="system_info_cpu_topology_detected"></marker>
+ <p>Returns the automatically detected
+ <c><anno>CpuTopology</anno>y</c>. The
+ emulator detects the CPU topology on some newer
+ Linux, Solaris, FreeBSD, and Windows systems.
+ On Windows system with more than 32 logical processors,
+ the CPU topology is not detected.</p>
+ <p>For more information, see argument
+ <seealso marker="#system_info_cpu_topology">cpu_topology</seealso>.</p>
</item>
<tag><c>{cpu_topology, used}</c></tag>
<item>
- <p>Returns the <c><anno>CpuTopology</anno></c> which is used by the
- emulator. For more information see the
- documentation of the
- <seealso marker="#system_info_cpu_topology">cpu_topology</seealso>
- argument.
- </p>
+ <p>Returns <c><anno>CpuTopology</anno></c> used by the emulator.
+ For more information, see argument
+ <seealso marker="#system_info_cpu_topology">cpu_topology</seealso>.</p>
</item>
</taglist>
</desc>
</func>
+
<func>
<name name="system_info" arity="1" clause_i="6"/>
<name name="system_info" arity="1" clause_i="7"/>
@@ -6224,7 +6639,7 @@ ok
<name name="system_info" arity="1" clause_i="65"/>
<name name="system_info" arity="1" clause_i="66"/>
<name name="system_info" arity="1" clause_i="67"/>
- <fsummary>Information about the system</fsummary>
+ <fsummary>Information about the system.</fsummary>
<desc>
<p>Returns various information about the current system
(emulator) as specified by <c><anno>Item</anno></c>:</p>
@@ -6241,8 +6656,7 @@ ok
Other possible return values are <c>debug</c>, <c>purify</c>,
<c>quantify</c>, <c>purecov</c>, <c>gcov</c>, <c>valgrind</c>,
<c>gprof</c>, and <c>lcnt</c>. Possible return values
- may be added and/or removed at any time without prior notice.
- </p>
+ can be added or removed at any time without prior notice.</p>
</item>
<tag><c>c_compiler_used</c></tag>
<item>
@@ -6250,26 +6664,25 @@ ok
compiling the runtime system. The first element is an
atom describing the name of the compiler, or <c>undefined</c>
if unknown. The second element is a term describing the
- version of the compiler, or <c>undefined</c> if unknown.
- </p>
+ version of the compiler, or <c>undefined</c> if unknown.</p>
</item>
<tag><c>check_io</c></tag>
<item>
<p>Returns a list containing miscellaneous information
- regarding the emulators internal I/O checking. Note,
- the content of the returned list may vary between
- platforms and over time. The only thing guaranteed is
+ about the emulators internal I/O checking. Notice that
+ the content of the returned list can vary between
+ platforms and over time. It is only guaranteed
that a list is returned.</p>
</item>
<tag><c>compat_rel</c></tag>
<item>
<p>Returns the compatibility mode of the local node as
an integer. The integer returned represents the
- Erlang/OTP release which the current emulator has been
+ Erlang/OTP release that the current emulator has been
set to be backward compatible with. The compatibility
- mode can be configured at startup by using the command
- line flag <c>+R</c>, see
- <seealso marker="erts:erl#compat_rel">erl(1)</seealso>.</p>
+ mode can be configured at startup by using command-line flag
+ <seealso marker="erts:erl#compat_rel">+R</seealso> in
+ <c>erl(1)</c>.</p>
</item>
<tag><c>cpu_topology</c></tag>
<item>
@@ -6282,144 +6695,150 @@ ok
creation of a node is stored in process identifiers, port
identifiers, and references. This makes it (to some
extent) possible to distinguish between identifiers from
- different incarnations of a node. Currently valid
- creations are integers in the range 1..3, but this may
- (probably will) change in the future. If the node is not
- alive, 0 is returned.</p>
+ different incarnations of a node. The valid
+ creations are integers in the range 1..3, but this will
+ probably change in a future release. If the node is not
+ alive, <c>0</c> is returned.</p>
</item>
<tag><c>debug_compiled</c></tag>
<item>
<p>Returns <c>true</c> if the emulator has been debug
- compiled; otherwise, <c>false</c>.
- </p>
+ compiled, otherwise <c>false</c>.</p>
</item>
- <tag><marker id="system_info_delayed_node_table_gc"><c>delayed_node_table_gc</c></marker></tag>
+ <tag><c>delayed_node_table_gc</c></tag>
<item>
- <p>Returns the amount of time in seconds that garbage collection
- of an entry in a node table will be delayed. This limit can be set
- on startup by passing the
- <seealso marker="erts:erl#+zdntgc">+zdntgc</seealso> command line
- flag to <c>erl</c>. For more information see the documentation of the
+ <marker id="system_info_delayed_node_table_gc"></marker>
+ <p>Returns the amount of time in seconds garbage collection
+ of an entry in a node table is delayed. This limit can be set
+ on startup by passing the command line flag
+ <seealso marker="erts:erl#+zdntgc">+zdntgc</seealso>
+ to <c>erl</c>. For more information see the documentation of the
command line flag.</p>
</item>
- <tag><marker id="system_info_dirty_cpu_schedulers"><c>dirty_cpu_schedulers</c></marker></tag>
+ <tag><c>dirty_cpu_schedulers</c></tag>
<item>
+ <marker id="system_info_dirty_cpu_schedulers"></marker>
<p>Returns the number of dirty CPU scheduler threads used by
the emulator. Dirty CPU schedulers execute CPU-bound
- native functions such as NIFs, linked-in driver code, and BIFs
- that cannot be managed cleanly by the emulator's normal schedulers.
- </p>
- <p>The number of dirty CPU scheduler threads is determined at emulator
- boot time and cannot be changed after that. The number of dirty CPU
- scheduler threads online can however be changed at any time. The number of
- dirty CPU schedulers can be set on startup by passing
- the <seealso marker="erts:erl#+SDcpu">+SDcpu</seealso> or
- <seealso marker="erts:erl#+SDPcpu">+SDPcpu</seealso> command line flags,
- see <seealso marker="erts:erl#+SDcpu">erl(1)</seealso>.
- </p>
- <p><em>Note that the dirty schedulers functionality is experimental</em>, and
- that you have to enable support for dirty schedulers when building OTP in
- order to try out the functionality.</p>
- <p>See also <seealso marker="#system_flag_dirty_cpu_schedulers_online">erlang:system_flag(dirty_cpu_schedulers_online, DirtyCPUSchedulersOnline)</seealso>,
+ native functions, such as NIFs, linked-in driver code,
+ and BIFs that cannot be managed cleanly by the normal
+ emulator schedulers.</p>
+ <p>The number of dirty CPU scheduler threads is determined
+ at emulator boot time and cannot be changed after that.
+ However, the number of dirty CPU scheduler threads online
+ can be changed at any time. The number of dirty CPU
+ schedulers can be set at startup by passing
+ command-line flag
+ <seealso marker="erts:erl#+SDcpu">+SDcpu</seealso> or
+ <seealso marker="erts:erl#+SDPcpu">+SDPcpu</seealso> in
+ <c>erl(1)</c>.</p>
+ <p>Notice that the dirty schedulers functionality is
+ experimental. Enable support for dirty schedulers when
+ building OTP to try out the functionality.</p>
+ <p>See also
+ <seealso marker="#system_flag_dirty_cpu_schedulers_online">erlang:system_flag(dirty_cpu_schedulers_online, DirtyCPUSchedulersOnline)</seealso>,
<seealso marker="#system_info_dirty_cpu_schedulers_online">erlang:system_info(dirty_cpu_schedulers_online)</seealso>,
<seealso marker="#system_info_dirty_io_schedulers">erlang:system_info(dirty_io_schedulers)</seealso>,
<seealso marker="#system_info_schedulers">erlang:system_info(schedulers)</seealso>,
<seealso marker="#system_info_schedulers_online">erlang:system_info(schedulers_online)</seealso>, and
<seealso marker="#system_flag_schedulers_online">erlang:system_flag(schedulers_online, SchedulersOnline)</seealso>.</p>
</item>
- <tag><marker id="system_info_dirty_cpu_schedulers_online"><c>dirty_cpu_schedulers_online</c></marker></tag>
- <item>
- <p>Returns the number of dirty CPU schedulers online. The return value
- satisfies the following relationship:
- <c><![CDATA[1 <= DirtyCPUSchedulersOnline <= N]]></c>, where <c>N</c> is
- the lesser of the return values of <c>erlang:system_info(dirty_cpu_schedulers)</c> and
- <c>erlang:system_info(schedulers_online)</c>.
- </p>
- <p>The number of dirty CPU schedulers online can be set on startup by passing
- the <seealso marker="erts:erl#+SDcpu">+SDcpu</seealso> command line flag, see
- <seealso marker="erts:erl#+SDcpu">erl(1)</seealso>.
- </p>
- <p><em>Note that the dirty schedulers functionality is experimental</em>, and
- that you have to enable support for dirty schedulers when building OTP in
- order to try out the functionality.</p>
+ <tag><c>dirty_cpu_schedulers_online</c></tag>
+ <item>
+ <marker id="system_info_dirty_cpu_schedulers_online"></marker>
+ <p>Returns the number of dirty CPU schedulers online.
+ The return value satisfies
+ <c><![CDATA[1 <= DirtyCPUSchedulersOnline <= N]]></c>,
+ where <c>N</c> is the smallest of the return values of
+ <c>erlang:system_info(dirty_cpu_schedulers)</c> and
+ <c>erlang:system_info(schedulers_online)</c>.</p>
+ <p>The number of dirty CPU schedulers online can be set at
+ startup by passing command-line flag
+ <seealso marker="erts:erl#+SDcpu">+SDcpu</seealso> in
+ <c>erl(1)</c>.</p>
+ <p>Notice that the dirty schedulers functionality is
+ experimental. Enable support for dirty schedulers when
+ building OTP to try out the functionality.</p>
<p>For more information, see
<seealso marker="#system_info_dirty_cpu_schedulers">erlang:system_info(dirty_cpu_schedulers)</seealso>,
<seealso marker="#system_info_dirty_io_schedulers">erlang:system_info(dirty_io_schedulers)</seealso>,
<seealso marker="#system_info_schedulers_online">erlang:system_info(schedulers_online)</seealso>, and
- <seealso marker="#system_flag_dirty_cpu_schedulers_online">erlang:system_flag(dirty_cpu_schedulers_online, DirtyCPUSchedulersOnline)</seealso>.
- </p>
- </item>
- <tag><marker id="system_info_dirty_io_schedulers"><c>dirty_io_schedulers</c></marker></tag>
- <item>
- <p>Returns the number of dirty I/O schedulers as an integer. Dirty I/O schedulers
- execute I/O-bound native functions such as NIFs and linked-in driver code that
- cannot be managed cleanly by the emulator's normal schedulers.
- </p>
- <p>This value can be set on startup by passing
- the <seealso marker="erts:erl#+SDio">+SDio</seealso> command line flag, see
- <seealso marker="erts:erl#+SDio">erl(1)</seealso>.
- </p>
- <p><em>Note that the dirty schedulers functionality is experimental</em>, and
- that you have to enable support for dirty schedulers when building OTP in
- order to try out the functionality.</p>
+ <seealso marker="#system_flag_dirty_cpu_schedulers_online">erlang:system_flag(dirty_cpu_schedulers_online, DirtyCPUSchedulersOnline)</seealso>.</p>
+ </item>
+ <tag><c>dirty_io_schedulers</c></tag>
+ <item>
+ <marker id="system_info_dirty_io_schedulers"></marker>
+ <p>Returns the number of dirty I/O schedulers as an integer.
+ Dirty I/O schedulers execute I/O-bound native functions,
+ such as NIFs and linked-in driver code, which cannot be
+ managed cleanly by the normal emulator schedulers.</p>
+ <p>This value can be set at startup by passing command-line
+ argument <seealso marker="erts:erl#+SDio">+SDio</seealso>
+ in <c>erl(1)</c>.</p>
+ <p>Notice that the dirty schedulers functionality is
+ experimental. Enable support for dirty schedulers when
+ building OTP to try out the functionality.</p>
<p>For more information, see
<seealso marker="#system_info_dirty_cpu_schedulers">erlang:system_info(dirty_cpu_schedulers)</seealso>,
<seealso marker="#system_info_dirty_cpu_schedulers_online">erlang:system_info(dirty_cpu_schedulers_online)</seealso>, and
- <seealso marker="#system_flag_dirty_cpu_schedulers_online">erlang:system_flag(dirty_cpu_schedulers_online, DirtyCPUSchedulersOnline)</seealso>.
- </p>
+ <seealso marker="#system_flag_dirty_cpu_schedulers_online">erlang:system_flag(dirty_cpu_schedulers_online, DirtyCPUSchedulersOnline)</seealso>.</p>
</item>
<tag><c>dist</c></tag>
<item>
<p>Returns a binary containing a string of distribution
information formatted as in Erlang crash dumps. For more
- information see the <seealso marker="erts:crash_dump">"How to interpret the Erlang crash dumps"</seealso>
- chapter in the ERTS User's Guide.</p>
+ information, see Section
+ <seealso marker="erts:crash_dump">"How to interpret the Erlang crash dumps"</seealso>
+ in the User's Guide.</p>
</item>
- <tag><marker id="system_info_dist_buf_busy_limit"><c>dist_buf_busy_limit</c></marker></tag>
+ <tag><c>dist_buf_busy_limit</c></tag>
<item>
+ <marker id="system_info_dist_buf_busy_limit"></marker>
<p>Returns the value of the distribution buffer busy limit
- in bytes. This limit can be set on startup by passing the
- <seealso marker="erts:erl#+zdbbl">+zdbbl</seealso> command line
- flag to <c>erl</c>.</p>
+ in bytes. This limit can be set at startup by passing
+ command-line flag
+ <seealso marker="erts:erl#+zdbbl">+zdbbl</seealso>
+ to <c>erl</c>.</p>
</item>
<tag><c>dist_ctrl</c></tag>
<item>
<p>Returns a list of tuples
- <c>{Node, ControllingEntity}</c>, one entry for each
- connected remote node. The <c><anno>Node</anno></c> is the name of the
- node and the <c><anno>ControllingEntity</anno></c> is the port or pid
- responsible for the communication to that node. More
- specifically, the <c><anno>ControllingEntity</anno></c> for nodes
- connected via TCP/IP (the normal case) is the socket
- actually used in communication with the specific node.</p>
+ <c>{<anno>Node</anno>, <anno>ControllingEntity</anno>}</c>,
+ one entry for each connected remote node.
+ <c><anno>Node</anno></c> is the node name
+ and <c><anno>ControllingEntity</anno></c> is the port or process
+ identifier responsible for the communication to that node.
+ More specifically, <c><anno>ControllingEntity</anno></c> for
+ nodes connected through TCP/IP (the normal case) is the socket
+ used in communication with the specific node.</p>
</item>
<tag><c>driver_version</c></tag>
<item>
- <p>Returns a string containing the erlang driver version
- used by the runtime system. It will be on the form
+ <p>Returns a string containing the Erlang driver version
+ used by the runtime system. It has the form
<seealso marker="erts:erl_driver#version_management">"&lt;major ver&gt;.&lt;minor ver&gt;"</seealso>.</p>
</item>
<tag><c>dynamic_trace</c></tag>
<item>
<p>Returns an atom describing the dynamic trace framework
- compiled into the virtual machine. It can currently be either
- <c>dtrace</c>, <c>systemtap</c> or <c>none</c>. For a
- commercial or standard build, this is always <c>none</c>,
- the other return values indicate a custom configuration
- (e.g. <c>./configure --with-dynamic-trace=dtrace</c>). See
- the <seealso marker="runtime_tools:dyntrace">dyntrace
- </seealso> manual page and the
+ compiled into the virtual machine. It can be
+ <c>dtrace</c>, <c>systemtap</c>, or <c>none</c>. For a
+ commercial or standard build, it is always <c>none</c>.
+ The other return values indicate a custom configuration
+ (for example, <c>./configure --with-dynamic-trace=dtrace</c>).
+ For more information about dynamic tracing, see the
+ <seealso marker="runtime_tools:dyntrace">dyntrace</seealso>
+ manual page and the
<c>README.dtrace</c>/<c>README.systemtap</c> files in the
- Erlang source code top directory for more information
- about dynamic tracing.</p>
+ Erlang source code top directory.</p>
</item>
<tag><c>dynamic_trace_probes</c></tag>
<item>
- <p>Returns a <c>boolean()</c> indicating if dynamic trace probes
- (either dtrace or systemtap) are built into the
- emulator. This can only be <c>true</c> if the virtual
- machine was built for dynamic tracing
- (i.e. <c>system_info(dynamic_trace)</c> returns
+ <p>Returns a <c>boolean()</c> indicating if dynamic trace
+ probes (<c>dtrace</c> or <c>systemtap</c>) are built into
+ the emulator. This can only be <c>true</c> if the Virtual
+ Machine was built for dynamic tracing (that is,
+ <c>system_info(dynamic_trace)</c> returns
<c>dtrace</c> or <c>systemtap</c>).</p>
</item>
<tag><marker id="system_info_end_time"/><c>end_time</c></tag>
@@ -6433,42 +6852,43 @@ ok
<tag><c>elib_malloc</c></tag>
<item>
<p>This option will be removed in a future release.
- The return value will always be <c>false</c> since
- the elib_malloc allocator has been removed.</p>
+ The return value will always be <c>false</c>, as the
+ <c>elib_malloc</c> allocator has been removed.</p>
</item>
- <tag><marker id="system_info_eager_check_io"><c>eager_check_io</c></marker></tag>
+ <tag><marker id="system_info_eager_check_io"/><c>eager_check_io</c></tag>
<item>
<p>
- Returns the value of the <c>erl</c>
- <seealso marker="erl#+secio">+secio</seealso> command line
- flag which is either <c>true</c> or <c>false</c>. See the
+ Returns the value of the <c>erl</c> command line flag
+ <seealso marker="erl#+secio">+secio</seealso>
+ which is either <c>true</c> or <c>false</c>. See the
documentation of the command line flag for information about
the different values.
</p>
</item>
<tag><c>ets_limit</c></tag>
<item>
- <p>Returns the maximum number of ETS tables allowed. This limit
- can be increased on startup by passing the <seealso
- marker="erts:erl#+e">+e</seealso> command line flag to
- <c>erl</c> or by setting the environment variable
- <c>ERL_MAX_ETS_TABLES</c> before starting the Erlang runtime
- system.</p>
+ <p>Returns the maximum number of ETS tables allowed. This
+ limit can be increased at startup by passing
+ command-line flag
+ <seealso marker="erts:erl#+e">+e</seealso> to
+ <c>erl(1)</c> or by setting environment variable
+ <c>ERL_MAX_ETS_TABLES</c> before starting the Erlang
+ runtime system.</p>
</item>
<tag><c>fullsweep_after</c></tag>
<item>
- <p>Returns <c>{fullsweep_after, integer() >= 0}</c> which is the
- <c>fullsweep_after</c> garbage collection setting used
- by default. For more information see
- <c>garbage_collection</c> described below.</p>
+ <p>Returns <c>{fullsweep_after, integer() >= 0}</c>, which is
+ the <c>fullsweep_after</c> garbage collection setting used
+ by default. For more information, see
+ <c>garbage_collection</c> described in the following.</p>
</item>
<tag><c>garbage_collection</c></tag>
<item>
<p>Returns a list describing the default garbage collection
settings. A process spawned on the local node by a
- <c>spawn</c> or <c>spawn_link</c> will use these
+ <c>spawn</c> or <c>spawn_link</c> uses these
garbage collection settings. The default settings can be
- changed by use of
+ changed by using
<seealso marker="#system_flag/2">system_flag/2</seealso>.
<seealso marker="#spawn_opt/4">spawn_opt/4</seealso>
can spawn a process that does not use the default
@@ -6482,8 +6902,8 @@ ok
</item>
<tag><c>heap_type</c></tag>
<item>
- <p>Returns the heap type used by the current emulator.
- Currently only the following heap type exists:</p>
+ <p>Returns the heap type used by the current emulator. One
+ heap type exists:</p>
<taglist>
<tag><c>private</c></tag>
<item>
@@ -6498,51 +6918,51 @@ ok
<item>
<p>Returns a binary containing a string of miscellaneous
system information formatted as in Erlang crash dumps.
- For more information see the
- <seealso marker="erts:crash_dump">"How to interpret the Erlang crash dumps"</seealso> chapter in the ERTS
- User's Guide.</p>
+ For more information, see Section
+ <seealso marker="erts:crash_dump">"How to interpret the Erlang crash dumps"</seealso>
+ in the User's Guide.</p>
</item>
<tag><c>kernel_poll</c></tag>
<item>
<p>Returns <c>true</c> if the emulator uses some kind of
- kernel-poll implementation; otherwise, <c>false</c>.</p>
+ kernel-poll implementation, otherwise <c>false</c>.</p>
</item>
<tag><c>loaded</c></tag>
<item>
<p>Returns a binary containing a string of loaded module
information formatted as in Erlang crash dumps. For more
- information see the <seealso marker="erts:crash_dump">"How to interpret the Erlang crash dumps"</seealso> chapter
- in the ERTS User's Guide.</p>
+ information, see Section
+ <seealso marker="erts:crash_dump">"How to interpret the Erlang crash dumps"</seealso>
+ in the User's Guide.</p>
</item>
- <tag><marker id="logical_processors"><c>logical_processors</c></marker></tag>
+ <tag><c>logical_processors</c></tag>
<item>
+ <marker id="logical_processors"></marker>
<p>Returns the detected number of logical processors configured
- on the system. The return value is either an integer, or
- the atom <c>unknown</c> if the emulator wasn't able to
- detect logical processors configured.
- </p>
+ in the system. The return value is either an integer, or
+ the atom <c>unknown</c> if the emulator cannot
+ detect the configured logical processors.</p>
</item>
- <tag><marker id="logical_processors_available"><c>logical_processors_available</c></marker></tag>
+ <tag><c>logical_processors_available</c></tag>
<item>
- <p>Returns the detected number of logical processors available to
- the Erlang runtime system. The return value is either an
- integer, or the atom <c>unknown</c> if the emulator wasn't
- able to detect logical processors available. The number
- of logical processors available is less than or equal to
- the number of <seealso marker="#logical_processors_online">logical
- processors online</seealso>.
- </p>
+ <marker id="logical_processors_available"></marker>
+ <p>Returns the detected number of logical processors available
+ to the Erlang runtime system. The return value is either an
+ integer, or the atom <c>unknown</c> if the emulator
+ cannot detect the available logical processors. The number
+ of available logical processors is less than or equal to
+ the number of
+ <seealso marker="#logical_processors_online">logical processors online</seealso>.</p>
</item>
- <tag><marker id="logical_processors_online"><c>logical_processors_online</c></marker></tag>
+ <tag><c>logical_processors_online</c></tag>
<item>
+ <marker id="logical_processors_online"></marker>
<p>Returns the detected number of logical processors online on
the system. The return value is either an integer,
- or the atom <c>unknown</c> if the emulator wasn't able to
+ or the atom <c>unknown</c> if the emulator cannot
detect logical processors online. The number of logical
processors online is less than or equal to the number of
- <seealso marker="#logical_processors">logical processors
- configured</seealso>.
- </p>
+ <seealso marker="#logical_processors">logical processors configured</seealso>.</p>
</item>
<tag><c>machine</c></tag>
<item>
@@ -6550,27 +6970,30 @@ ok
</item>
<tag><c>min_heap_size</c></tag>
<item>
- <p>Returns <c>{min_heap_size, <anno>MinHeapSize</anno>}</c> where <c><anno>MinHeapSize</anno></c> is the current system wide
- minimum heap size for spawned processes.</p>
+ <p>Returns <c>{min_heap_size, <anno>MinHeapSize</anno>}</c>,
+ where <c><anno>MinHeapSize</anno></c> is the current
+ system-wide minimum heap size for spawned processes.</p>
</item>
<tag><c>min_bin_vheap_size</c></tag>
<item>
- <p>Returns <c>{min_bin_vheap_size, <anno>MinBinVHeapSize</anno>}</c> where <c><anno>MinBinVHeapSize</anno></c> is the current system wide
+ <p>Returns <c>{min_bin_vheap_size,
+ <anno>MinBinVHeapSize</anno>}</c>, where
+ <c><anno>MinBinVHeapSize</anno></c> is the current system-wide
minimum binary virtual heap size for spawned processes.</p>
</item>
<tag><c>modified_timing_level</c></tag>
<item>
- <p>Returns the modified timing level (an integer) if
- modified timing has been enabled; otherwise,
- <c>undefined</c>. See the <c>+T</c> command line flag
- in the documentation of the
- <seealso marker="erts:erl#+T">erl(1)</seealso>
- command for more information on modified timing.</p>
+ <p>Returns the modified timing-level (an integer) if
+ modified timing is enabled, otherwise, <c>undefined</c>.
+ For more information about modified timing, see
+ command-line flag
+ <seealso marker="erts:erl#+T">+T</seealso>
+ in <c>erl(1)</c></p>
</item>
- <tag><marker id="system_info_multi_scheduling"><c>multi_scheduling</c></marker></tag>
+ <tag><c>multi_scheduling</c></tag>
<item>
- <p>Returns <c>disabled</c>, <c>blocked</c>, or <c>enabled</c>.
- A description of the return values:</p>
+ <marker id="system_info_multi_scheduling"></marker>
+ <p>Returns <c>disabled</c>, <c>blocked</c>, or <c>enabled</c>:</p>
<taglist>
<tag><c>disabled</c></tag>
<item>
@@ -6581,93 +7004,99 @@ ok
<tag><c>blocked</c></tag>
<item>
<p>The emulator has more than one scheduler thread,
- but all scheduler threads but one have been blocked,
- i.e., only one scheduler thread will schedule
- Erlang processes and execute Erlang code.</p>
+ but all scheduler threads except one are blocked,
+ that is, only one scheduler thread schedules
+ Erlang processes and executes Erlang code.</p>
</item>
<tag><c>enabled</c></tag>
<item>
<p>The emulator has more than one scheduler thread,
- and no scheduler threads have been blocked, i.e.,
- all available scheduler threads will schedule
+ and no scheduler threads are blocked, that is,
+ all available scheduler threads schedule
Erlang processes and execute Erlang code.</p>
</item>
</taglist>
- <p>See also <seealso marker="#system_flag_multi_scheduling">erlang:system_flag(multi_scheduling, BlockState)</seealso>,
- <seealso marker="#system_info_multi_scheduling_blockers">erlang:system_info(multi_scheduling_blockers)</seealso>, and
+ <p>See also
+ <seealso marker="#system_flag_multi_scheduling">erlang:system_flag(multi_scheduling, BlockState)</seealso>,
+ <seealso marker="#system_info_multi_scheduling_blockers">erlang:system_info(multi_scheduling_blockers)</seealso>,
+ and
<seealso marker="#system_info_schedulers">erlang:system_info(schedulers)</seealso>.</p>
</item>
- <tag><marker id="system_info_multi_scheduling_blockers"><c>multi_scheduling_blockers</c></marker></tag>
+ <tag><c>multi_scheduling_blockers</c></tag>
<item>
- <p>Returns a list of <c><anno>PID</anno></c>s when multi-scheduling
- is blocked; otherwise, the empty list. The <c><anno>PID</anno></c>s
- in the list is <c><anno>PID</anno></c>s of the processes currently
- blocking multi-scheduling. A <c><anno>PID</anno></c> will only be
- present once in the list, even if the corresponding
+ <marker id="system_info_multi_scheduling_blockers"></marker>
+ <p>Returns a list of <c><anno>Pid</anno></c>s when
+ multi-scheduling is blocked, otherwise the empty list is
+ returned. The <c><anno>Pid</anno></c>s in the list
+ represent all the processes currently
+ blocking multi-scheduling. A <c><anno>Pid</anno></c> occurs
+ only once in the list, even if the corresponding
process has blocked multiple times.</p>
- <p>See also <seealso marker="#system_flag_multi_scheduling">erlang:system_flag(multi_scheduling, BlockState)</seealso>,
- <seealso marker="#system_info_multi_scheduling">erlang:system_info(multi_scheduling)</seealso>, and
+ <p>See also
+ <seealso marker="#system_flag_multi_scheduling">erlang:system_flag(multi_scheduling, BlockState)</seealso>,
+ <seealso marker="#system_info_multi_scheduling">erlang:system_info(multi_scheduling)</seealso>,
+ and
<seealso marker="#system_info_schedulers">erlang:system_info(schedulers)</seealso>.</p>
</item>
<tag><c>nif_version</c></tag>
<item>
- <p>Returns a string containing the erlang NIF version
- used by the runtime system. It will be on the form "&lt;major ver&gt;.&lt;minor ver&gt;".</p>
+ <p>Returns a string containing the version of the Erlang NIF interface
+ used by the runtime system. It is on the form
+ "&lt;major ver&gt;.&lt;minor ver&gt;".</p>
</item>
- <tag><marker id="system_info_otp_release"><c>otp_release</c></marker></tag>
+ <tag><c>otp_release</c></tag>
<item>
+ <marker id="system_info_otp_release"></marker>
<p>Returns a string containing the OTP release number of the
- OTP release that the currently executing ERTS application is
+ OTP release that the currently executing <c>ERTS</c> application is
part of.</p>
- <p>As of OTP release 17, the OTP release number corresponds to
- the major OTP version number. There is no
- <c>erlang:system_info()</c> argument giving the exact OTP
- version. This since the exact OTP version in the general case
- is hard to determine. For more information see
- <seealso marker="doc/system_principles:versions">the
- documentation of versions in the system principles
- guide</seealso>.</p>
+ <p>As from OTP 17, the OTP release number corresponds to
+ the major OTP version number. No
+ <c>erlang:system_info()</c> argument gives the exact OTP
+ version. This is because the exact OTP version in the general case
+ is difficult to determine. For more information, see the description
+ of versions in <seealso marker="doc/system_principles:versions">
+ System principles</seealso> in System Documentation.</p>
</item>
- <tag><marker id="system_info_os_monotonic_time_source"><c>os_monotonic_time_source</c></marker></tag>
+ <tag><marker id="system_info_os_monotonic_time_source"/><c>os_monotonic_time_source</c></tag>
<item>
<p>Returns a list containing information about the source of
<seealso marker="erts:time_correction#OS_Monotonic_Time">OS
monotonic time</seealso> that is used by the runtime system.</p>
- <p>In case <c>[]</c> is returned, no OS monotonic time is
+ <p>If <c>[]</c> is returned, no OS monotonic time is
available. The list contains two-tuples with <c>Key</c>s
as first element, and <c>Value</c>s as second element. The
- order if these tuples is undefined. Currently the following
- tuples may be part of the list, but more tuples may be
+ order of these tuples is undefined. The following
+ tuples can be part of the list, but more tuples can be
introduced in the future:</p>
<taglist>
<tag><c>{function, Function}</c></tag>
- <item><p><c>Function</c> is the name of the funcion
+ <item><p><c>Function</c> is the name of the function
used. This tuple always exist if OS monotonic time is
available to the runtime system.</p></item>
<tag><c>{clock_id, ClockId}</c></tag>
<item><p>This tuple only exist if <c>Function</c>
can be used with different clocks. <c>ClockId</c>
- corresponds to the clock identifer used when calling
+ corresponds to the clock identifier used when calling
<c>Function</c>.</p></item>
<tag><c>{resolution, OsMonotonicTimeResolution}</c></tag>
<item><p>Highest possible
<seealso marker="time_correction#Time_Resolution">resolution</seealso>
of current OS monotonic time source as parts per
- second. If no resolution information can be retreived
- from the OS, <c>OsMonotonicTimeResolution</c> will be
+ second. If no resolution information can be retrieved
+ from the OS, <c>OsMonotonicTimeResolution</c> is
set to the resolution of the time unit of
<c>Function</c>s return value. That is, the actual
- resolution may be lower than
+ resolution can be lower than
<c>OsMonotonicTimeResolution</c>. Also note that
the resolution does not say anything about the
<seealso marker="time_correction#Time_Accuracy">accuracy</seealso>,
- and that the
+ and whether the
<seealso marker="time_correction#Time_Precision">precision</seealso>
- might not align with the resolution. You do,
- however, know that the precision won't be
- better than
+ do align with the resolution. You do,
+ however, know that the precision is not better than
<c>OsMonotonicTimeResolution</c>.</p></item>
<tag><c>{extended, Extended}</c></tag>
@@ -6692,15 +7121,15 @@ ok
<seealso marker="#type_time_unit">time unit</seealso>.</p></item>
</taglist>
</item>
- <tag><marker id="system_info_os_system_time_source"><c>os_system_time_source</c></marker></tag>
+ <tag><marker id="system_info_os_system_time_source"/><c>os_system_time_source</c></tag>
<item>
<p>Returns a list containing information about the source of
<seealso marker="erts:time_correction#OS_System_Time">OS
system time</seealso> that is used by the runtime system.</p>
<p>The list contains two-tuples with <c>Key</c>s
as first element, and <c>Value</c>s as second element. The
- order if these tuples is undefined. Currently the following
- tuples may be part of the list, but more tuples may be
+ order if these tuples is undefined. The following
+ tuples can be part of the list, but more tuples can be
introduced in the future:</p>
<taglist>
<tag><c>{function, Function}</c></tag>
@@ -6710,26 +7139,25 @@ ok
<tag><c>{clock_id, ClockId}</c></tag>
<item><p>This tuple only exist if <c>Function</c>
can be used with different clocks. <c>ClockId</c>
- corresponds to the clock identifer used when calling
+ corresponds to the clock identifier used when calling
<c>Function</c>.</p></item>
<tag><c>{resolution, OsSystemTimeResolution}</c></tag>
<item><p>Highest possible
<seealso marker="time_correction#Time_Resolution">resolution</seealso>
of current OS system time source as parts per
- second. If no resolution information can be retreived
- from the OS, <c>OsSystemTimeResolution</c> will be
+ second. If no resolution information can be retrieved
+ from the OS, <c>OsSystemTimeResolution</c> is
set to the resolution of the time unit of
<c>Function</c>s return value. That is, the actual
resolution may be lower than
<c>OsSystemTimeResolution</c>. Also note that
the resolution does not say anything about the
<seealso marker="time_correction#Time_Accuracy">accuracy</seealso>,
- and that the
+ and whether the
<seealso marker="time_correction#Time_Precision">precision</seealso>
- might not align with the resolution. You do,
- however, know that the precision won't be
- better than
+ do align with the resolution. You do,
+ however, know that the precision is not better than
<c>OsSystemTimeResolution</c>.</p></item>
<tag><c>{parallel, Parallel}</c></tag>
@@ -6745,130 +7173,136 @@ ok
<seealso marker="#type_time_unit">time unit</seealso>.</p></item>
</taglist>
</item>
- <tag><marker id="system_info_port_parallelism"><c>port_parallelism</c></marker></tag>
- <item><p>Returns the default port parallelism scheduling hint used.
- For more information see the
- <seealso marker="erl#+spp">+spp</seealso> command line argument
- of <seealso marker="erl">erl(1)</seealso>.</p></item>
+ <tag><c>port_parallelism</c></tag>
+ <item>
+ <marker id="system_info_port_parallelism"></marker>
+ <p>Returns the default port parallelism scheduling hint used.
+ For more information, see command-line argument
+ <seealso marker="erl#+spp">+spp</seealso> in <c>erl(1)</c>.</p></item>
<tag><marker id="system_info_port_count"/><c>port_count</c></tag>
<item>
- <p>Returns the number of ports currently existing at
- the local node as an integer. The same value as
- <c>length(erlang:ports())</c> returns, but more efficient.</p>
+ <p>Returns the number of ports currently existing at the
+ local node. The value is given as an integer. This is
+ the same value as returned by
+ <c>length(erlang:ports())</c>, but more efficient.</p>
</item>
- <tag><marker id="system_info_port_limit"><c>port_limit</c></marker></tag>
+ <tag><c>port_limit</c></tag>
<item>
+ <marker id="system_info_port_limit"></marker>
<p>Returns the maximum number of simultaneously existing
- ports at the local node as an integer. This limit
- can be configured at startup by using the
- <seealso marker="erl#+Q">+Q</seealso>
- command line flag of
- <seealso marker="erl">erl(1)</seealso>.</p>
+ ports at the local node as an integer. This limit can be
+ configured at startup by using command-line flag
+ <seealso marker="erl#+Q">+Q</seealso> in <c>erl(1)</c>.</p>
</item>
<tag><marker id="system_info_process_count"/><c>process_count</c></tag>
<item>
- <p>Returns the number of processes currently existing at
- the local node as an integer. The same value as
- <c>length(processes())</c> returns, but more efficient.</p>
+ <p>Returns the number of processes currently existing at the
+ local node. The value is given as an integer. This is
+ the same value as returned by
+ <c>length(processes())</c>, but more efficient.</p>
</item>
- <tag><marker id="system_info_process_limit"><c>process_limit</c></marker></tag>
+ <tag><c>process_limit</c></tag>
<item>
+ <marker id="system_info_process_limit"></marker>
<p>Returns the maximum number of simultaneously existing
- processes at the local node as an integer. This limit
- can be configured at startup by using the
- <seealso marker="erl#+P">+P</seealso>
- command line flag of
- <seealso marker="erl">erl(1)</seealso>.</p>
+ processes at the local node. The value is given as an
+ integer. This limit can be configured at startup by using
+ command-line flag <seealso marker="erl#+P">+P</seealso>
+ in <c>erl(1)</c>.</p>
</item>
<tag><c>procs</c></tag>
<item>
<p>Returns a binary containing a string of process and port
information formatted as in Erlang crash dumps. For more
- information see the <seealso marker="erts:crash_dump">"How to interpret the Erlang crash dumps"</seealso> chapter
- in the ERTS User's Guide.</p>
+ information, see Section
+ <seealso marker="erts:crash_dump">"How to interpret the Erlang crash dumps"</seealso>
+ in the User's Guide.</p>
</item>
- <tag><marker id="system_info_scheduler_bind_type"><c>scheduler_bind_type</c></marker></tag>
+ <tag><c>scheduler_bind_type</c></tag>
<item>
- <p>Returns information on how user has requested
+ <marker id="system_info_scheduler_bind_type"></marker>
+ <p>Returns information about how the user has requested
schedulers to be bound or not bound.</p>
- <p><em>NOTE:</em> Even though user has requested
- schedulers to be bound, they might have silently failed
- to bind. In order to inspect actual scheduler bindings call
- <seealso marker="#system_info_scheduler_bindings">erlang:system_info(scheduler_bindings)</seealso>.
- </p>
- <p>For more information, see
- the <c>erl</c> <seealso marker="erts:erl#+sbt">+sbt</seealso>
- command line argument, and
- <seealso marker="#system_info_scheduler_bindings">erlang:system_info(scheduler_bindings)</seealso>.
- </p>
- </item>
- <tag><marker id="system_info_scheduler_bindings"><c>scheduler_bindings</c></marker></tag>
- <item>
- <p>Returns information on currently used scheduler
+ <p>Notice that even though a user has requested
+ schedulers to be bound, they can silently have failed
+ to bind. To inspect the scheduler bindings, call
+ <seealso marker="#system_info_scheduler_bindings">erlang:system_info(scheduler_bindings)</seealso>.</p>
+ <p>For more information, see command-line argument
+ <seealso marker="erts:erl#+sbt">+sbt</seealso>
+ in <c>erl(1)</c> and
+ <seealso marker="#system_info_scheduler_bindings">erlang:system_info(scheduler_bindings)</seealso>.</p>
+ </item>
+ <tag><c>scheduler_bindings</c></tag>
+ <item>
+ <marker id="system_info_scheduler_bindings"></marker>
+ <p>Returns information about the currently used scheduler
bindings.</p>
<p>A tuple of a size equal to
- <seealso marker="#system_info_schedulers">erlang:system_info(schedulers)</seealso> is returned. The elements of the tuple are integers
+ <seealso marker="#system_info_schedulers">erlang:system_info(schedulers)</seealso>
+ is returned. The tuple elements are integers
or the atom <c>unbound</c>. Logical processor identifiers
are represented as integers. The <c>N</c>th
element of the tuple equals the current binding for
the scheduler with the scheduler identifier equal to
- <c>N</c>. E.g., if the schedulers have been bound,
+ <c>N</c>. For example, if the schedulers are bound,
<c>element(erlang:system_info(scheduler_id),
- erlang:system_info(scheduler_bindings))</c> will return
+ erlang:system_info(scheduler_bindings))</c> returns
the identifier of the logical processor that the calling
- process is executing on.
- </p>
- <p>Note that only schedulers online can be bound to logical
+ process is executing on.</p>
+ <p>Notice that only schedulers online can be bound to logical
processors.</p>
- <p>For more information, see
- the <c>erl</c> <seealso marker="erts:erl#+sbt">+sbt</seealso>
- command line argument,
+ <p>For more information, see command-line argument
+ <seealso marker="erts:erl#+sbt">+sbt</seealso>
+ in <c>erl(1)</c> and
<seealso marker="#system_info_schedulers_online">erlang:system_info(schedulers_online)</seealso>.
</p>
</item>
- <tag><marker id="system_info_scheduler_id"><c>scheduler_id</c></marker></tag>
+ <tag><c>scheduler_id</c></tag>
<item>
- <p>Returns the scheduler id (<c>SchedulerId</c>) of the
+ <marker id="system_info_scheduler_id"></marker>
+ <p>Returns the scheduler ID (<c>SchedulerId</c>) of the
scheduler thread that the calling process is executing
- on. <c><anno>SchedulerId</anno></c> is a positive integer; where
- <c><![CDATA[1 <= SchedulerId <= erlang:system_info(schedulers)]]></c>. See also
+ on. <c><anno>SchedulerId</anno></c> is a positive integer,
+ where
+ <c><![CDATA[1 <= SchedulerId <= erlang:system_info(schedulers)]]></c>.
+ See also
<seealso marker="#system_info_schedulers">erlang:system_info(schedulers)</seealso>.</p>
</item>
- <tag><marker id="system_info_schedulers"><c>schedulers</c></marker></tag>
+ <tag><c>schedulers</c></tag>
<item>
+ <marker id="system_info_schedulers"></marker>
<p>Returns the number of scheduler threads used by
the emulator. Scheduler threads online schedules Erlang
processes and Erlang ports, and execute Erlang code
- and Erlang linked in driver code.</p>
+ and Erlang linked-in driver code.</p>
<p>The number of scheduler threads is determined at
- emulator boot time and cannot be changed after
- that. The amount of schedulers online can
- however be changed at any time.</p>
- <p>See also <seealso marker="#system_flag_schedulers_online">erlang:system_flag(schedulers_online, SchedulersOnline)</seealso>,
+ emulator boot time and cannot be changed later.
+ However, the number of schedulers online can
+ be changed at any time.</p>
+ <p>See also
+ <seealso marker="#system_flag_schedulers_online">erlang:system_flag(schedulers_online, SchedulersOnline)</seealso>,
<seealso marker="#system_info_schedulers_online">erlang:system_info(schedulers_online)</seealso>,
<seealso marker="#system_info_scheduler_id">erlang:system_info(scheduler_id)</seealso>,
<seealso marker="#system_flag_multi_scheduling">erlang:system_flag(multi_scheduling, BlockState)</seealso>,
- <seealso marker="#system_info_multi_scheduling">erlang:system_info(multi_scheduling)</seealso>, and
- and <seealso marker="#system_info_multi_scheduling_blockers">erlang:system_info(multi_scheduling_blockers)</seealso>.</p>
+ <seealso marker="#system_info_multi_scheduling">erlang:system_info(multi_scheduling)</seealso>,
+ and
+ <seealso marker="#system_info_multi_scheduling_blockers">erlang:system_info(multi_scheduling_blockers)</seealso>.</p>
</item>
- <tag><marker id="system_info_schedulers_online"><c>schedulers_online</c></marker></tag>
+ <tag><c>schedulers_online</c></tag>
<item>
- <p>Returns the amount of schedulers online. The scheduler
- identifiers of schedulers online satisfy the following
- relationship:
- <c><![CDATA[1 <= SchedulerId <= erlang:system_info(schedulers_online)]]></c>.
- </p>
+ <marker id="system_info_schedulers_online"></marker>
+ <p>Returns the number of schedulers online. The scheduler
+ identifiers of schedulers online satisfy the relationship
+ <c><![CDATA[1 <= SchedulerId <= erlang:system_info(schedulers_online)]]></c>.</p>
<p>For more information, see
- <seealso marker="#system_info_schedulers">erlang:system_info(schedulers)</seealso>,
+ <seealso marker="#system_info_schedulers">erlang:system_info(schedulers)</seealso>
and
- <seealso marker="#system_flag_schedulers_online">erlang:system_flag(schedulers_online, SchedulersOnline)</seealso>.
- </p> <name name="system_info" arity="1" clause_i="49"/>
-
+ <seealso marker="#system_flag_schedulers_online">erlang:system_flag(schedulers_online, SchedulersOnline)</seealso>.</p>
</item>
<tag><c>smp_support</c></tag>
<item>
<p>Returns <c>true</c> if the emulator has been compiled
- with smp support; otherwise, <c>false</c>.</p>
+ with SMP support, otherwise <c>false</c> is returned.</p>
</item>
<tag><marker id="system_info_start_time"/><c>start_time</c></tag>
<item><p>The <seealso marker="#monotonic_time/0">Erlang monotonic
@@ -6880,7 +7314,7 @@ ok
<tag><c>system_version</c></tag>
<item>
<p>Returns a string containing version number and
- some important properties such as the number of schedulers.</p>
+ some important properties, such as the number of schedulers.</p>
</item>
<tag><c>system_architecture</c></tag>
<item>
@@ -6890,23 +7324,28 @@ ok
<tag><c>threads</c></tag>
<item>
<p>Returns <c>true</c> if the emulator has been compiled
- with thread support; otherwise, <c>false</c> is
- returned.</p>
+ with thread support, otherwise <c>false</c> is returned.</p>
</item>
- <tag><marker id="system_info_thread_pool_size"><c>thread_pool_size</c></marker></tag>
+ <tag><c>thread_pool_size</c></tag>
<item>
+ <marker id="system_info_thread_pool_size"></marker>
<p>Returns the number of async threads in the async thread
pool used for asynchronous driver calls
- (<seealso marker="erts:erl_driver#driver_async">driver_async()</seealso>)
- as an integer.</p>
+ (<seealso marker="erts:erl_driver#driver_async">driver_async()</seealso>).
+ The value is given as an integer.</p>
</item>
- <tag><marker id="system_info_time_correction"/><c>time_correction</c></tag>
- <item><p>Returns a boolean value indicating whether
+
+ <tag><c>time_correction</c></tag>
+ <item>
+ <marker id="system_info_time_correction"></marker>
+ <p>Returns a boolean value indicating whether
<seealso marker="time_correction#Time_Correction">time correction</seealso>
is enabled or not.
</p></item>
- <tag><marker id="system_info_time_offset"/><c>time_offset</c></tag>
- <item><p>Returns the state of the time offset:</p>
+ <tag><c>time_offset</c></tag>
+ <item>
+ <marker id="system_info_time_offset"></marker>
+ <p>Returns the state of the time offset:</p>
<taglist>
<tag><c>preliminary</c></tag>
<item><p>The time offset is preliminary, and will be changed
@@ -6916,19 +7355,18 @@ ok
time warp mode</seealso>.</p></item>
<tag><c>final</c></tag>
- <item><p>The time offset is final. This
- either due to the use of the
+ <item><p>The time offset is final. This either because
<seealso marker="time_correction#No_Time_Warp_Mode">no
- time warp mode</seealso>, or due to the time offset having
- been finalized when using the
+ time warp mode</seealso> is used, or because the time
+ offset have been finalized when
<seealso marker="time_correction#Single_Time_Warp_Mode">single
- time warp mode</seealso>.</p></item>
+ time warp mode</seealso> is used.</p></item>
<tag><c>volatile</c></tag>
- <item><p>The time offset is volatile. That is, it may
- change at any time. This due to the
+ <item><p>The time offset is volatile. That is, it can
+ change at any time. This is because
<seealso marker="time_correction#Multi_Time_Warp_Mode">multi
- time warp mode</seealso> being used.</p></item>
+ time warp mode</seealso> is used.</p></item>
</taglist>
</item>
<tag><marker id="system_info_time_warp_mode"/><c>time_warp_mode</c></tag>
@@ -6938,19 +7376,20 @@ ok
<taglist>
<tag><c>no_time_warp</c></tag>
<item><p>The <seealso marker="time_correction#No_Time_Warp_Mode">no
- time warp mode</seealso> is being used.</p></item>
+ time warp mode</seealso> is used.</p></item>
<tag><c>single_time_warp</c></tag>
<item><p>The <seealso marker="time_correction#Single_Time_Warp_Mode">single
- time warp mode</seealso> is being used.</p></item>
+ time warp mode</seealso> is used.</p></item>
<tag><c>multi_time_warp</c></tag>
<item><p>The <seealso marker="time_correction#Multi_Time_Warp_Mode">multi
- time warp mode</seealso> is being used.</p></item>
+ time warp mode</seealso> is used.</p></item>
</taglist>
</item>
- <tag><marker id="system_info_tolerant_timeofday"><c>tolerant_timeofday</c></marker></tag>
+ <tag><c>tolerant_timeofday</c></tag>
<item>
+ <marker id="system_info_tolerant_timeofday"></marker>
<p>Returns whether a pre erts-7.0 backwards compatible compensation
for sudden changes of system time is <c>enabled</c> or <c>disabled</c>.
Such compensation is <c>enabled</c> when the
@@ -6961,90 +7400,92 @@ ok
</item>
<tag><c>trace_control_word</c></tag>
<item>
- <p>Returns the value of the node's trace control word.
- For more information see documentation of the function
- <c>get_tcw</c> in "Match Specifications in Erlang",
- <seealso marker="erts:match_spec#get_tcw">ERTS User's Guide</seealso>.</p>
+ <p>Returns the value of the node trace control word. For
+ more information, see function <c>get_tcw</c> in Section
+ <seealso marker="erts:match_spec#get_tcw">Match Specifications in Erlang</seealso> in the User's Guide.</p>
</item>
- <tag><marker id="update_cpu_info"><c>update_cpu_info</c></marker></tag>
+ <tag><c>update_cpu_info</c></tag>
<item>
- <p>The runtime system rereads the CPU information available and
- updates its internally stored information about the
- <seealso marker="#system_info_cpu_topology_detected">detected CPU
- topology</seealso> and the amount of logical processors
+ <marker id="update_cpu_info"></marker>
+ <p>The runtime system rereads the CPU information available
+ and updates its internally stored information about the
+ <seealso marker="#system_info_cpu_topology_detected">detected
+ CPU topology</seealso> and the number of logical processors
<seealso marker="#logical_processors">configured</seealso>,
<seealso marker="#logical_processors_online">online</seealso>, and
- <seealso marker="#logical_processors_available">available</seealso>.
- If the CPU information has changed since the last time it was read,
- the atom <c>changed</c> is returned; otherwise, the atom
- <c>unchanged</c> is returned. If the CPU information has changed
+ <seealso marker="#logical_processors_available">available</seealso>.</p>
+ <p>If the CPU information has changed since the last time
+ it was read, the atom <c>changed</c> is returned, otherwise
+ the atom <c>unchanged</c>. If the CPU information has changed,
you probably want to
- <seealso marker="#system_flag_schedulers_online">adjust the amount
- of schedulers online</seealso>. You typically want to have as
- many schedulers online as
- <seealso marker="#logical_processors_available">logical processors
- available</seealso>.
- </p>
+ <seealso marker="#system_flag_schedulers_online">adjust the
+ number of schedulers online</seealso>. You typically want
+ to have as many schedulers online as
+ <seealso marker="#logical_processors_available">logical
+ processors available</seealso>.</p>
</item>
- <tag><marker id="system_info_version"><c>version</c></marker></tag>
+ <tag><c>version</c></tag>
<item>
+ <marker id="system_info_version"></marker>
<p>Returns a string containing the version number of the
emulator.</p>
</item>
<tag><c>wordsize</c></tag>
<item>
- <p>Same as <c>{wordsize, internal}.</c></p>
+ <p>Same as <c>{wordsize, internal}</c>.</p>
</item>
<tag><c>{wordsize, internal}</c></tag>
<item>
<p>Returns the size of Erlang term words in bytes as an
- integer, i.e. on a 32-bit architecture 4 is returned,
- and on a pure 64-bit architecture 8 is returned. On a
+ integer, that is, 4 is returned on a 32-bit architecture,
+ and 8 is returned on a pure 64-bit architecture. On a
halfword 64-bit emulator, 4 is returned, as the Erlang
- terms are stored using a virtual wordsize of half the
- system's wordsize.</p>
+ terms are stored using a virtual word size of half the
+ system word size.</p>
</item>
<tag><c>{wordsize, external}</c></tag>
<item>
- <p>Returns the true wordsize of the emulator, i.e. the size
- of a pointer, in bytes as an integer. On a pure 32-bit
- architecture 4 is returned, on both a halfword and pure
+ <p>Returns the true word size of the emulator, that is,
+ the size of a pointer. The value is given in bytes
+ as an integer. On a pure 32-bit architecture, 4 is
+ returned. On both a half word and on a pure
64-bit architecture, 8 is returned.</p>
</item>
</taglist>
<note>
- <p>The <c>scheduler</c> argument has changed name to
- <c>scheduler_id</c>. This in order to avoid mixup with
- the <c>schedulers</c> argument. The <c>scheduler</c>
- argument was introduced in ERTS version 5.5 and renamed
- in ERTS version 5.5.1.</p>
+ <p>Argument <c>scheduler</c> has changed name to
+ <c>scheduler_id</c> to avoid mix up with argument
+ <c>schedulers</c>. Argument <c>scheduler</c> was
+ introduced in <c>ERTS</c> 5.5 and renamed in
+ <c>ERTS</c> 5.5.1.</p>
</note>
</desc>
</func>
<func>
<name name="system_monitor" arity="0"/>
+ <fsummary>Current system performance monitoring settings.</fsummary>
<type name="system_monitor_option"/>
- <fsummary>Current system performance monitoring settings</fsummary>
<desc>
<p>Returns the current system monitoring settings set by
<seealso marker="#system_monitor/2">erlang:system_monitor/2</seealso>
- as <c>{<anno>MonitorPid</anno>, <anno>Options</anno>}</c>, or <c>undefined</c> if there
- are no settings. The order of the options may be different
+ as <c>{<anno>MonitorPid</anno>, <anno>Options</anno>}</c>,
+ or <c>undefined</c> if there
+ are no settings. The order of the options can be different
from the one that was set.</p>
</desc>
</func>
<func>
<name name="system_monitor" arity="1"/>
+ <fsummary>Sets or clears system performance monitoring options.</fsummary>
<type name="system_monitor_option"/>
- <fsummary>Set or clear system performance monitoring options</fsummary>
<desc>
- <p>When called with the argument <c>undefined</c>, all
+ <p>When called with argument <c>undefined</c>, all
system performance monitoring settings are cleared.</p>
- <p>Calling the function with <c>{<anno>MonitorPid</anno>, <anno>Options</anno>}</c> as
- argument, is the same as calling
- <seealso marker="#system_monitor/2">erlang:system_monitor(<anno>MonitorPid</anno>, <anno>Options</anno>)</seealso>.</p>
+ <p>Calling the function with <c>{<anno>MonitorPid</anno>,
+ <anno>Options</anno>}</c> as argument is the same as calling
+ <seealso marker="#system_monitor/2"><c>erlang:system_monitor(<anno>MonitorPid</anno>, <anno>Options</anno>)</c></seealso>.</p>
<p>Returns the previous system monitor settings just like
<seealso marker="#system_monitor/0">erlang:system_monitor/0</seealso>.</p>
</desc>
@@ -7052,102 +7493,101 @@ ok
<func>
<name name="system_monitor" arity="2"/>
+ <fsummary>Sets system performance monitoring options.</fsummary>
<type name="system_monitor_option"/>
- <fsummary>Set system performance monitoring options</fsummary>
<desc>
- <p>Sets system performance monitoring options. <c><anno>MonitorPid</anno></c>
- is a local pid that will receive system monitor messages, and
- the second argument is a list of monitoring options:</p>
+ <p>Sets the system performance monitoring options.
+ <c><anno>MonitorPid</anno></c> is a local process identifier (pid)
+ receiving system monitor messages. The
+ second argument is a list of monitoring options:</p>
<taglist>
<tag><c>{long_gc, Time}</c></tag>
<item>
<p>If a garbage collection in the system takes at least
- <c>Time</c> wallclock milliseconds, a message
+ <c>Time</c> wall clock milliseconds, a message
<c>{monitor, GcPid, long_gc, Info}</c> is sent to
- <c><anno>MonitorPid</anno></c>. <c>GcPid</c> is the pid that was
- garbage collected and <c>Info</c> is a list of two-element
- tuples describing the result of the garbage collection.
- One of the tuples is <c>{timeout, GcTime}</c> where
- <c>GcTime</c> is the actual time for the garbage
+ <c><anno>MonitorPid</anno></c>. <c>GcPid</c> is the pid that
+ was garbage collected. <c>Info</c> is a list of two-element
+ tuples describing the result of the garbage collection.</p>
+ <p>One of the tuples is <c>{timeout, GcTime}</c>, where
+ <c>GcTime</c> is the time for the garbage
collection in milliseconds. The other tuples are
- tagged with <c>heap_size</c>, <c>heap_block_size</c>,
- <c>stack_size</c>, <c>mbuf_size</c>, <c>old_heap_size</c>,
- and <c>old_heap_block_size</c>. These tuples are
- explained in the documentation of the
- <seealso marker="#gc_start">gc_start</seealso>
- trace message (see
- <seealso marker="#trace/3">erlang:trace/3</seealso>).
- New tuples may be added, and the order of the tuples in
- the <c>Info</c> list may be changed at any time without prior
- notice.
- </p>
+ tagged with <c>heap_size</c>, <c>heap_block_size</c>
+ <c>stack_size</c>, <c>mbuf_size</c>, <c>old_heap_size</c>,
+ and <c>old_heap_block_size</c>. These tuples are
+ explained in the description of trace message
+ <seealso marker="#gc_start">gc_start</seealso> (see
+ <seealso marker="#trace/3">erlang:trace/3</seealso>).
+ New tuples can be added, and the order of the tuples in
+ the <c>Info</c> list can be changed at any time without
+ prior notice.</p>
</item>
<tag><c>{long_schedule, Time}</c></tag>
<item>
- <p>If a process or port in the system runs uninterrupted
+ <p>If a process or port in the system runs uninterrupted
for at least <c>Time</c> wall clock milliseconds, a
message <c>{monitor, PidOrPort, long_schedule, Info}</c>
is sent to <c>MonitorPid</c>. <c>PidOrPort</c> is the
- process or port that was running and <c>Info</c> is a
- list of two-element tuples describing the event. In case
- of a <c>pid()</c>, the tuples <c>{timeout, Millis}</c>,
- <c>{in, Location}</c> and <c>{out, Location}</c> will be
+ process or port that was running. <c>Info</c> is a
+ list of two-element tuples describing the event.</p>
+ <p>If a <c>pid()</c>, the tuples <c>{timeout, Millis}</c>,
+ <c>{in, Location}</c>, and <c>{out, Location}</c> are
present, where <c>Location</c> is either an MFA
(<c>{Module, Function, Arity}</c>) describing the
function where the process was scheduled in/out, or the
- atom <c>undefined</c>. In case of a <c>port()</c>, the
+ atom <c>undefined</c>.</p>
+ <p>If a <c>port()</c>, the
tuples <c>{timeout, Millis}</c> and <c>{port_op,Op}</c>
- will be present. <c>Op</c> will be one of <c>proc_sig</c>,
+ are present. <c>Op</c> is one of <c>proc_sig</c>,
<c>timeout</c>, <c>input</c>, <c>output</c>,
- <c>event</c> or <c>dist_cmd</c>, depending on which
- driver callback was executing. <c>proc_sig</c> is an
- internal operation and should never appear, while the
+ <c>event</c>, or <c>dist_cmd</c>, depending on which
+ driver callback was executing.</p>
+ <p><c>proc_sig</c> is an
+ internal operation and is never to appear, while the
others represent the corresponding driver callbacks
<c>timeout</c>, <c>ready_input</c>, <c>ready_output</c>,
- <c>event</c> and finally <c>outputv</c> (when the port
- is used by distribution). The <c>Millis</c> value in
- the <c>timeout</c> tuple will tell you the actual
- uninterrupted execution time of the process or port,
- which will always be <c>&gt;=</c> the <c>Time</c> value
- supplied when starting the trace. New tuples may be
- added to the <c>Info</c> list in the future, and the
- order of the tuples in the list may be changed at any
- time without prior notice.
- </p>
- <p>This can be used to detect problems with NIF's or
- drivers that take too long to execute. Generally, 1 ms
- is considered a good maximum time for a driver callback
- or a NIF. However, a time sharing system should usually
- consider everything below 100 ms as "possible" and
- fairly "normal". Schedule times above that might however
- indicate swapping or a NIF/driver that is
- misbehaving. Misbehaving NIF's and drivers could cause
- bad resource utilization and bad overall performance of
- the system.</p>
+ <c>event</c>, and <c>outputv</c> (when the port
+ is used by distribution). Value <c>Millis</c> in
+ the <c>timeout</c> tuple informs about the
+ uninterrupted execution time of the process or port, which
+ always is equal to or higher than the <c>Time</c> value
+ supplied when starting the trace. New tuples can be
+ added to the <c>Info</c> list in a future release. The
+ order of the tuples in the list can be changed at any
+ time without prior notice.</p>
+ <p>This can be used to detect problems with NIFs or
+ drivers that take too long to execute. 1 ms is
+ considered a good maximum time for a driver callback
+ or a NIF. However, a time-sharing system is usually to
+ consider everything below 100 ms as "possible" and
+ fairly "normal". However, longer schedule times can
+ indicate swapping or a misbehaving NIF/driver.
+ Misbehaving NIFs and drivers can cause bad resource
+ utilization and bad overall system performance.</p>
</item>
<tag><c>{large_heap, Size}</c></tag>
<item>
<p>If a garbage collection in the system results in
the allocated size of a heap being at least <c>Size</c>
words, a message <c>{monitor, GcPid, large_heap, Info}</c>
- is sent to <c><anno>MonitorPid</anno></c>. <c>GcPid</c> and <c>Info</c>
- are the same as for <c>long_gc</c> above, except that
- the tuple tagged with <c>timeout</c> is not present.
- <em>Note</em>: As of erts version 5.6 the monitor message
- is sent if the sum of the sizes of all memory blocks allocated
- for all heap generations is equal to or larger than <c>Size</c>.
- Previously the monitor message was sent if the memory block
- allocated for the youngest generation was equal to or larger
- than <c>Size</c>.
- </p>
+ is sent to <c><anno>MonitorPid</anno></c>.
+ <c>GcPid</c> and <c>Info</c>
+ are the same as for <c>long_gc</c> earlier, except that
+ the tuple tagged with <c>timeout</c> is not present.</p>
+ <p>As of <c>ERTS</c> 5.6, the monitor message is sent
+ if the sum of the sizes of all memory blocks allocated
+ for all heap generations is equal to or higher than <c>Size</c>.
+ Previously the monitor message was sent if the memory block
+ allocated for the youngest generation was equal to or higher
+ than <c>Size</c>.</p>
</item>
<tag><c>busy_port</c></tag>
<item>
<p>If a process in the system gets suspended because it
sends to a busy port, a message
<c>{monitor, SusPid, busy_port, Port}</c> is sent to
- <c><anno>MonitorPid</anno></c>. <c>SusPid</c> is the pid that got
- suspended when sending to <c>Port</c>.</p>
+ <c><anno>MonitorPid</anno></c>. <c>SusPid</c> is the pid
+ that got suspended when sending to <c>Port</c>.</p>
</item>
<tag><c>busy_dist_port</c></tag>
<item>
@@ -7155,8 +7595,8 @@ ok
sends to a process on a remote node whose inter-node
communication was handled by a busy port, a message
<c>{monitor, SusPid, busy_dist_port, Port}</c> is sent to
- <c><anno>MonitorPid</anno></c>. <c>SusPid</c> is the pid that got
- suspended when sending through the inter-node
+ <c><anno>MonitorPid</anno></c>. <c>SusPid</c> is the pid
+ that got suspended when sending through the inter-node
communication port <c>Port</c>.</p>
</item>
</taglist>
@@ -7165,74 +7605,76 @@ ok
<note>
<p>If a monitoring process gets so large that it itself
starts to cause system monitor messages when garbage
- collecting, the messages will enlarge the process's
+ collecting, the messages enlarge the process
message queue and probably make the problem worse.</p>
<p>Keep the monitoring process neat and do not set the system
monitor limits too tight.</p>
</note>
- <p>Failure: <c>badarg</c> if <c><anno>MonitorPid</anno></c> does not exist or is not a local process.</p>
+ <p>Failures:</p>
+ <taglist>
+ <tag><c>badarg</c></tag>
+ <item>If <c><anno>MonitorPid</anno></c> does not exist.</item>
+ <tag><c>badarg</c></tag>
+ <item>If <c><anno>MonitorPid</anno></c> is not a local process.</item>
+ </taglist>
</desc>
</func>
<func>
<name name="system_profile" arity="0"/>
+ <fsummary>Current system profiling settings.</fsummary>
<type name="system_profile_option"/>
- <fsummary>Current system profiling settings</fsummary>
<desc>
<p>Returns the current system profiling settings set by
<seealso marker="#system_profile/2">erlang:system_profile/2</seealso>
- as <c>{<anno>ProfilerPid</anno>, <anno>Options</anno>}</c>, or <c>undefined</c> if there
- are no settings. The order of the options may be different
+ as <c>{<anno>ProfilerPid</anno>, <anno>Options</anno>}</c>,
+ or <c>undefined</c> if there
+ are no settings. The order of the options can be different
from the one that was set.</p>
</desc>
</func>
<func>
<name name="system_profile" arity="2"/>
+ <fsummary>Current system profiling settings.</fsummary>
<type name="system_profile_option"/>
- <fsummary>Current system profiling settings</fsummary>
<desc>
<p>Sets system profiler options. <c><anno>ProfilerPid</anno></c>
- is a local pid or port that will receive profiling messages. The
- receiver is excluded from all profiling.
+ is a local process identifier (pid) or port receiving profiling
+ messages. The receiver is excluded from all profiling.
The second argument is a list of profiling options:</p>
<taglist>
<tag><c>exclusive</c></tag>
<item>
- <p>
- If a synchronous call to a port from a process is done, the
+ <p>If a synchronous call to a port from a process is done, the
calling process is considered not runnable during the call
runtime to the port. The calling process is notified as
- <c>inactive</c> and subsequently <c>active</c> when the port
- callback returns.
- </p>
+ <c>inactive</c>, and later <c>active</c> when the port
+ callback returns.</p>
</item>
<tag><c>runnable_procs</c></tag>
<item>
- <p>If a process is put into or removed from the run queue a message,
- <c>{profile, Pid, State, Mfa, Ts}</c>, is sent to
- <c><anno>ProfilerPid</anno></c>. Running processes that is reinserted into the
- run queue after having been preemptively scheduled out will not trigger this
- message.
- </p>
+ <p>If a process is put into or removed from the run queue, a
+ message, <c>{profile, Pid, State, Mfa, Ts}</c>, is sent to
+ <c><anno>ProfilerPid</anno></c>. Running processes that
+ are reinserted into the run queue after having been
+ preempted do not trigger this message.</p>
</item>
<tag><c>runnable_ports</c></tag>
<item>
- <p>If a port is put into or removed from the run queue a message,
- <c>{profile, Port, State, 0, Ts}</c>, is sent to
- <c><anno>ProfilerPid</anno></c>.
- </p>
+ <p>If a port is put into or removed from the run queue, a
+ message, <c>{profile, Port, State, 0, Ts}</c>, is sent to
+ <c><anno>ProfilerPid</anno></c>.</p>
</item>
<tag><c>scheduler</c></tag>
<item>
- <p>If a scheduler is put to sleep or awoken a message,
- <c>{profile, scheduler, Id, State, NoScheds, Ts}</c>, is sent
- to <c><anno>ProfilerPid</anno></c>.
- </p>
+ <p>If a scheduler is put to sleep or awoken, a message,
+ <c>{profile, scheduler, Id, State, NoScheds, Ts}</c>, is
+ sent to <c><anno>ProfilerPid</anno></c>.</p>
</item>
</taglist>
- <note><p><c>erlang:system_profile</c> is considered experimental and
- its behaviour may change in the future.</p>
+ <note><p><c>erlang:system_profile</c> is considered experimental
+ and its behavior can change in a future release.</p>
</note>
</desc>
</func>
@@ -7276,11 +7718,12 @@ ok
</func>
<func>
<name name="term_to_binary" arity="1"/>
- <fsummary>Encode a term to an Erlang external term format binary</fsummary>
+ <fsummary>Encodes a term to an Erlang external term format binary.</fsummary>
<desc>
- <p>Returns a binary data object which is the result of encoding
- <c><anno>Term</anno></c> according to the Erlang external term format.</p>
- <p>This can be used for a variety of purposes, for example
+ <p>Returns a binary data object that is the result of encoding
+ <c><anno>Term</anno></c> according to the Erlang external
+ term format.</p>
+ <p>This can be used for various purposes, for example,
writing a term to a file in an efficient way, or sending an
Erlang term to some type of communications channel not
supported by distributed Erlang.</p>
@@ -7288,67 +7731,81 @@ ok
<seealso marker="#binary_to_term/1">binary_to_term/1</seealso>.</p>
</desc>
</func>
+
<func>
<name name="term_to_binary" arity="2"/>
- <fsummary>Encode a term to en Erlang external term format binary</fsummary>
- <desc>
- <p>Returns a binary data object which is the result of encoding
- <c><anno>Term</anno></c> according to the Erlang external term format.</p>
- <p>If the option <c>compressed</c> is provided, the external
- term format will be compressed. The compressed format is
- automatically recognized by <c>binary_to_term/1</c> in R7B and later.</p>
- <p>It is also possible to specify a compression level by giving
- the option <c>{compressed, <anno>Level</anno>}</c>, where <c><anno>Level</anno></c> is an
- integer from 0 through 9. <c>0</c> means that no compression
- will be done (it is the same as not giving any <c>compressed</c> option);
- <c>1</c> will take the least time but may not compress as well as
- the higher levels; <c>9</c> will take the most time and may produce
- a smaller result. Note the "mays" in the preceding sentence; depending
- on the input term, level 9 compression may or may not produce a smaller
- result than level 1 compression.</p>
- <p>Currently, <c>compressed</c> gives the same result as
- <c>{compressed, 6}</c>.</p>
- <p>The option <c>{minor_version, <anno>Version</anno>}</c> can be use to control
- some details of the encoding. This option was
- introduced in R11B-4. Currently, the allowed values for <c><anno>Version</anno></c>
- are <c>0</c> and <c>1</c>.</p>
- <p><c>{minor_version, 1}</c> is since 17.0 the default, it forces any floats in
- the term to be encoded
- in a more space-efficient and exact way (namely in the 64-bit IEEE format,
- rather than converted to a textual representation). <c>binary_to_term/1</c>
- in R11B-4 and later is able decode this representation.</p>
- <p><c>{minor_version, 0}</c> meaning that floats
- will be encoded using a textual representation; this option is useful if
- you want to ensure that releases prior to R11B-4 can decode resulting
+ <fsummary>Encodes a term to en Erlang external term format binary.</fsummary>
+ <desc>
+ <p>Returns a binary data object that is the result of encoding
+ <c><anno>Term</anno></c> according to the Erlang external
+ term format.</p>
+ <p>If option <c>compressed</c> is provided, the external term
+ format is compressed. The compressed format is automatically
+ recognized by <c>binary_to_term/1</c> as from Erlang R7B.</p>
+ <p>A compression level can be specified by giving option
+ <c>{compressed, <anno>Level</anno>}</c>.
+ <c><anno>Level</anno></c> is an integer
+ with range 0..9, where:</p>
+ <list type="bulleted">
+ <item><c>0</c> - No compression is done (it is the same as
+ giving no <c>compressed</c> option).</item>
+ <item><c>1</c> - Takes least time but may not compress
+ as well as the higher levels.</item>
+ <item><c>6</c> - Default level when option <c>compressed</c>
+ is provided.</item>
+ <item><c>9</c> - Takes most time and tries to produce a smaller
+ result. Notice "tries" in the preceding sentence; depending
+ on the input term, level 9 compression either does or does
+ not produce a smaller result than level 1 compression.</item>
+ </list>
+ <p>Option <c>{minor_version, <anno>Version</anno>}</c>
+ can be used to control
+ some encoding details. This option was introduced in OTP R11B-4.
+ The valid values for <c><anno>Version</anno></c> are
+ <c>0</c> and <c>1</c>.</p>
+ <p>As from OTP 17.0, <c>{minor_version, 1}</c> is the default. It
+ forces any floats in the term to be encoded in a more
+ space-efficient and exact way (namely in the 64-bit IEEE format,
+ rather than converted to a textual representation).</p>
+ <p>As from OTP R11B-4, <c>binary_to_term/1</c> can decode this
+ representation.</p>
+ <p><c>{minor_version, 0}</c> means that floats are encoded
+ using a textual representation. This option is useful to
+ ensure that releases before OTP R11B-4 can decode resulting
binary.</p>
<p>See also
<seealso marker="#binary_to_term/1">binary_to_term/1</seealso>.</p>
</desc>
</func>
+
<func>
<name name="throw" arity="1"/>
- <fsummary>Throw an exception</fsummary>
+ <fsummary>Throws an exception.</fsummary>
<desc>
<p>A non-local return from a function. If evaluated within a
- <c>catch</c>, <c>catch</c> will return the value <c><anno>Any</anno></c>.</p>
+ <c>catch</c>, <c>catch</c> returns value <c><anno>Any</anno></c>.</p>
+ <p>Example:</p>
<pre>
> <input>catch throw({hello, there}).</input>
{hello,there}</pre>
<p>Failure: <c>nocatch</c> if not evaluated within a catch.</p>
</desc>
</func>
+
<func>
<name name="time" arity="0"/>
- <fsummary>Current time</fsummary>
+ <fsummary>Current time.</fsummary>
<desc>
<p>Returns the current time as <c>{Hour, Minute, Second}</c>.</p>
- <p>The time zone and daylight saving time correction depend on
+ <p>The time zone and Daylight Saving Time correction depend on
the underlying OS.</p>
+ <p>Example:</p>
<pre>
> <input>time().</input>
{9,42,44}</pre>
</desc>
</func>
+
<func>
<name name="time_offset" arity="0"/>
<fsummary>Current time offset</fsummary>
@@ -7399,14 +7856,14 @@ ok
</func>
<func>
<name name="timestamp" arity="0"/>
- <type name="timestamp"/>
<fsummary>Current Erlang System time</fsummary>
+ <type name="timestamp"/>
<desc>
<p>Returns current
<seealso marker="time_correction#Erlang_System_Time">Erlang system time</seealso>
on the format <c>{MegaSecs, Secs, MicroSecs}</c>. This format is
- the same that <seealso marker="kernel:os#timestamp/0"><c>os:timestamp/0</c></seealso>
- and the now deprecated <seealso marker="#now/0"><c>erlang:now/0</c></seealso>
+ the same as <seealso marker="kernel:os#timestamp/0"><c>os:timestamp/0</c></seealso>
+ and the deprecated <seealso marker="#now/0"><c>erlang:now/0</c></seealso>
uses. The reason for the existence of <c>erlang:timestamp()</c> is
purely to simplify usage for existing code that assumes this timestamp
format. Current Erlang system time can more efficiently be retrieved in
@@ -7420,7 +7877,7 @@ timestamp() ->
Secs = ErlangSystemTime div 1000000 - MegaSecs*1000000,
MicroSecs = ErlangSystemTime rem 1000000,
{MegaSecs, Secs, MicroSecs}.</code>
- <p>It however use a native implementation which does
+ <p>The BIF uses a native implementation which does
not build garbage on the heap and with slightly better
performance.</p>
@@ -7433,186 +7890,190 @@ timestamp() ->
</func>
<func>
<name name="tl" arity="1"/>
- <fsummary>Tail of a list</fsummary>
+ <fsummary>Tail of a list.</fsummary>
<desc>
- <p>Returns the tail of <c><anno>List</anno></c>, that is, the list minus
- the first element.</p>
+ <p>Returns the tail of <c><anno>List</anno></c>, that is,
+ the list minus the first element, for example:</p>
<pre>
> <input>tl([geesties, guilies, beasties]).</input>
[guilies, beasties]</pre>
<p>Allowed in guard tests.</p>
- <p>Failure: <c>badarg</c> if <c><anno>List</anno></c> is the empty list [].</p>
+ <p>Failure: <c>badarg</c> if <c><anno>List</anno></c>
+ is the empty list <c>[]</c>.</p>
</desc>
</func>
+
<func>
<name name="trace" arity="3"/>
+ <fsummary>Sets trace flags for a process or processes.</fsummary>
<type name="trace_flag"/>
- <fsummary>Set trace flags for a process or processes</fsummary>
<desc>
<p>Turns on (if <c><anno>How</anno> == true</c>) or off (if
- <c><anno>How</anno> == false</c>) the trace flags in <c><anno>FlagList</anno></c> for
- the process or processes represented by <c><anno>PidSpec</anno></c>.</p>
- <p><c><anno>PidSpec</anno></c> is either a pid for a local process, or one of
- the following atoms:</p>
+ <c><anno>How</anno> == false</c>) the trace flags in
+ <c><anno>FlagList</anno></c> for
+ the process or processes represented by
+ <c><anno>PidSpec</anno></c>.</p>
+ <p><c><anno>PidSpec</anno></c> is either a process identifier
+ (pid) for a local process, or one of the following atoms:</p>
<taglist>
<tag><c>existing</c></tag>
<item>
- <p>All processes currently existing.</p>
+ <p>All currently existing processes.</p>
</item>
<tag><c>new</c></tag>
<item>
- <p>All processes that will be created in the future.</p>
+ <p>All processes that are created in the future.</p>
</item>
<tag><c>all</c></tag>
<item>
<p>All currently existing processes and all processes that
- will be created in the future.</p>
+ are created in the future.</p>
</item>
</taglist>
- <p><c><anno>FlagList</anno></c> can contain any number of the following
- flags (the "message tags" refers to the list of messages
- following below):</p>
+ <p><c><anno>FlagList</anno></c> can contain any number of the
+ following flags (the "message tags" refers to the list of
+ <seealso marker="#trace_3_trace_messages">trace messages</seealso>):</p>
<taglist>
<tag><c>all</c></tag>
<item>
- <p>Set all trace flags except <c>{tracer, Tracer}</c> and
- <c>cpu_timestamp</c> that are in their nature different
+ <p>Sets all trace flags except <c>{tracer, Tracer}</c> and
+ <c>cpu_timestamp</c>, which are in their nature different
than the others.</p>
</item>
<tag><c>send</c></tag>
<item>
- <p>Trace sending of messages.</p>
- <p>Message tags: <c>send</c>,
+ <p>Traces sending of messages.</p>
+ <p>Message tags: <c>send</c> and
<c>send_to_non_existing_process</c>.</p>
</item>
<tag><c>'receive'</c></tag>
<item>
- <p>Trace receiving of messages.</p>
+ <p>Traces receiving of messages.</p>
<p>Message tags: <c>'receive'</c>.</p>
</item>
<tag><c>procs</c></tag>
<item>
- <p>Trace process related events.</p>
+ <p>Traces process-related events.</p>
<p>Message tags: <c>spawn</c>, <c>exit</c>,
<c>register</c>, <c>unregister</c>, <c>link</c>,
- <c>unlink</c>, <c>getting_linked</c>,
+ <c>unlink</c>, <c>getting_linked</c>, and
<c>getting_unlinked</c>.</p>
</item>
<tag><c>call</c></tag>
<item>
- <p>Trace certain function calls. Specify which function
+ <p>Traces certain function calls. Specify which function
calls to trace by calling
<seealso marker="#trace_pattern/3">erlang:trace_pattern/3</seealso>.</p>
- <p>Message tags: <c>call</c>, <c>return_from</c>.</p>
+ <p>Message tags: <c>call</c> and <c>return_from</c>.</p>
</item>
<tag><c>silent</c></tag>
<item>
- <p>Used in conjunction with the <c>call</c> trace flag.
- The <c>call</c>, <c>return_from</c> and <c>return_to</c>
- trace messages are inhibited if this flag is set,
- but if there are match specs they are executed as normal.</p>
+ <p>Used with the <c>call</c> trace flag.
+ The <c>call</c>, <c>return_from</c>, and <c>return_to</c>
+ trace messages are inhibited if this flag is set, but they
+ are executed as normal if there are match specifications.</p>
<p>Silent mode is inhibited by executing
<c>erlang:trace(_, false, [silent|_])</c>,
- or by a match spec executing the <c>{silent, false}</c>
- function.</p>
+ or by a match specification executing the function
+ <c>{silent, false}</c>.</p>
<p>The <c>silent</c> trace flag facilitates setting up
a trace on many or even all processes in the system.
- Then the interesting trace can be activated and
- deactivated using the <c>{silent,Bool}</c>
- match spec function, giving a high degree
- of control of which functions with which
- arguments that triggers the trace.</p>
- <p>Message tags: <c>call</c>, <c>return_from</c>,
+ The trace can then be activated and deactivated using the match
+ specification function <c>{silent,Bool}</c>, giving
+ a high degree of control of which functions with which
+ arguments that trigger the trace.</p>
+ <p>Message tags: <c>call</c>, <c>return_from</c>, and
<c>return_to</c>. Or rather, the absence of.</p>
</item>
<tag><c>return_to</c></tag>
<item>
- <p>Used in conjunction with the <c>call</c> trace flag.
- Trace the actual return from a traced function back to
+ <p>Used with the <c>call</c> trace flag.
+ Traces the return from a traced function back to
its caller. Only works for functions traced with
- the <c>local</c> option to
+ option <c>local</c> to
<seealso marker="#trace_pattern/3">erlang:trace_pattern/3</seealso>.</p>
<p>The semantics is that a trace message is sent when a
- call traced function actually returns, that is, when a
- chain of tail recursive calls is ended. There will be
- only one trace message sent per chain of tail recursive
- calls, why the properties of tail recursiveness for
+ call traced function returns, that is, when a
+ chain of tail recursive calls ends. Only one trace
+ message is sent per chain of tail recursive calls,
+ so the properties of tail recursiveness for
function calls are kept while tracing with this flag.
Using <c>call</c> and <c>return_to</c> trace together
makes it possible to know exactly in which function a
process executes at any time.</p>
<p>To get trace messages containing return values from
- functions, use the <c>{return_trace}</c> match_spec
- action instead.</p>
+ functions, use the <c>{return_trace}</c> match
+ specification action instead.</p>
<p>Message tags: <c>return_to</c>.</p>
</item>
<tag><c>running</c></tag>
<item>
- <p>Trace scheduling of processes.</p>
- <p>Message tags: <c>in</c>, and <c>out</c>.</p>
+ <p>Traces scheduling of processes.</p>
+ <p>Message tags: <c>in</c> and <c>out</c>.</p>
</item>
<tag><c>exiting</c></tag>
<item>
- <p>Trace scheduling of an exiting processes.</p>
+ <p>Traces scheduling of exiting processes.</p>
<p>Message tags: <c>in_exiting</c>, <c>out_exiting</c>, and
<c>out_exited</c>.</p>
</item>
<tag><c>garbage_collection</c></tag>
<item>
- <p>Trace garbage collections of processes.</p>
- <p>Message tags: <c>gc_start</c>, <c>gc_end</c>.</p>
+ <p>Traces garbage collections of processes.</p>
+ <p>Message tags: <c>gc_start</c> and <c>gc_end</c>.</p>
</item>
<tag><c>timestamp</c></tag>
<item>
- <p>Include a time stamp in all trace messages. The time
- stamp (Ts) is of the same form as returned by
+ <p>Includes a time-stamp in all trace messages. The
+ time-stamp (Ts) has the same form as returned by
<c>erlang:now()</c>.</p>
</item>
<tag><c>cpu_timestamp</c></tag>
<item>
<p>A global trace flag for the Erlang node that makes all
- trace timestamps be in CPU time, not wallclock. It is
- only allowed with <c>PidSpec==all</c>. If the host
- machine operating system does not support high resolution
+ trace time-stamps to be in CPU time, not wall clock time.
+ Only allowed with <c>PidSpec==all</c>. If the host
+ machine OS does not support high-resolution
CPU time measurements, <c>trace/3</c> exits with
- <c>badarg</c>. Note that most operating systems do
+ <c>badarg</c>. Notice that most OS do
not synchronize this value across cores, so be prepared
that time might seem to go backwards when using this option.</p>
</item>
<tag><c>arity</c></tag>
<item>
- <p>Used in conjunction with the <c>call</c> trace flag.
- <c>{M, F, Arity}</c> will be specified instead of
+ <p>Used with the <c>call</c> trace flag.
+ <c>{M, F, Arity}</c> is specified instead of
<c>{M, F, Args}</c> in call trace messages.</p>
</item>
<tag><c>set_on_spawn</c></tag>
<item>
<p>Makes any process created by a traced process inherit
- its trace flags, including the <c>set_on_spawn</c> flag.</p>
+ its trace flags, including flag <c>set_on_spawn</c>.</p>
</item>
<tag><c>set_on_first_spawn</c></tag>
<item>
<p>Makes the first process created by a traced process
- inherit its trace flags, excluding
- the <c>set_on_first_spawn</c> flag.</p>
+ inherit its trace flags, excluding flag
+ <c>set_on_first_spawn</c>.</p>
</item>
<tag><c>set_on_link</c></tag>
<item>
<p>Makes any process linked by a traced process inherit its
- trace flags, including the <c>set_on_link</c> flag.</p>
+ trace flags, including flag <c>set_on_link</c>.</p>
</item>
<tag><c>set_on_first_link</c></tag>
<item>
<p>Makes the first process linked to by a traced process
- inherit its trace flags, excluding
- the <c>set_on_first_link</c> flag.</p>
+ inherit its trace flags, excluding flag
+ <c>set_on_first_link</c>.</p>
</item>
<tag><c>{tracer, Tracer}</c></tag>
<item>
- <p>Specify where to send the trace messages. <c>Tracer</c>
- must be the pid of a local process or the port identifier
+ <p>Specifies where to send the trace messages. <c>Tracer</c>
+ must be the process identifier of a local process
+ or the port identifier
of a local port. If this flag is not given, trace
- messages will be sent to the process that called
+ messages are sent to the process that called
<c>erlang:trace/3</c>.</p>
</item>
</taglist>
@@ -7620,27 +8081,27 @@ timestamp() ->
<c>set_on_link</c> is the same as having
<c>set_on_first_link</c> alone. Likewise for
<c>set_on_spawn</c> and <c>set_on_first_spawn</c>.</p>
- <p>If the <c>timestamp</c> flag is not given, the tracing
- process will receive the trace messages described below.
- <c>Pid</c> is the pid of the traced process in which
- the traced event has occurred. The third element of the tuple
- is the message tag.</p>
- <p>If the <c>timestamp</c> flag is given, the first element of
- the tuple will be <c>trace_ts</c> instead and the timestamp
- is added last in the tuple.</p>
+ <p>The tracing process receives the <em>trace messages</em> described
+ in the following list. <c>Pid</c> is the process identifier of the
+ traced process in which the traced event has occurred. The
+ third tuple element is the message tag.</p>
+ <p>If flag <c>timestamp</c> is given, the first tuple
+ element is <c>trace_ts</c> instead, and the time-stamp
+ is added last in the message tuple.</p>
+ <marker id="trace_3_trace_messages"></marker>
<taglist>
<tag><c>{trace, Pid, 'receive', Msg}</c></tag>
<item>
- <p>When <c>Pid</c> receives the message <c>Msg</c>.</p>
+ <p>When <c>Pid</c> receives message <c>Msg</c>.</p>
</item>
<tag><c>{trace, Pid, send, Msg, To}</c></tag>
<item>
- <p>When <c>Pid</c> sends the message <c>Msg</c> to
- the process <c>To</c>.</p>
+ <p>When <c>Pid</c> sends message <c>Msg</c> to
+ process <c>To</c>.</p>
</item>
<tag><c>{trace, Pid, send_to_non_existing_process, Msg, To}</c></tag>
<item>
- <p>When <c>Pid</c> sends the message <c>Msg</c> to
+ <p>When <c>Pid</c> sends message <c>Msg</c> to
the non-existing process <c>To</c>.</p>
</item>
<tag><c>{trace, Pid, call, {M, F, Args}}</c></tag>
@@ -7648,7 +8109,7 @@ timestamp() ->
<p>When <c>Pid</c> calls a traced function. The return
values of calls are never supplied, only the call and its
arguments.</p>
- <p>Note that the trace flag <c>arity</c> can be used to
+ <p>Trace flag <c>arity</c> can be used to
change the contents of this message, so that <c>Arity</c>
is specified instead of <c>Args</c>.</p>
</item>
@@ -7656,35 +8117,34 @@ timestamp() ->
<item>
<p>When <c>Pid</c> returns <em>to</em> the specified
function. This trace message is sent if both
- the <c>call</c> and the <c>return_to</c> flags are set,
+ the flags <c>call</c> and <c>return_to</c> are set,
and the function is set to be traced on <em>local</em>
function calls. The message is only sent when returning
- from a chain of tail recursive function calls where at
+ from a chain of tail recursive function calls, where at
least one call generated a <c>call</c> trace message
- (that is, the functions match specification matched and
+ (that is, the functions match specification matched, and
<c>{message, false}</c> was not an action).</p>
</item>
<tag><c>{trace, Pid, return_from, {M, F, Arity}, ReturnValue}</c></tag>
<item>
<p>When <c>Pid</c> returns <em>from</em> the specified
- function. This trace message is sent if the <c>call</c>
- flag is set, and the function has a match specification
+ function. This trace message is sent if flag <c>call</c>
+ is set, and the function has a match specification
with a <c>return_trace</c> or <c>exception_trace</c> action.</p>
</item>
<tag><c>{trace, Pid, exception_from, {M, F, Arity}, {Class, Value}}</c></tag>
<item>
<p>When <c>Pid</c> exits <em>from</em> the specified
- function due to an exception. This trace message is sent
- if the <c>call</c> flag is set, and the function has
+ function because of an exception. This trace message is
+ sent if flag <c>call</c> is set, and the function has
a match specification with an <c>exception_trace</c> action.</p>
</item>
<tag><c>{trace, Pid, spawn, Pid2, {M, F, Args}}</c></tag>
<item>
<p>When <c>Pid</c> spawns a new process <c>Pid2</c> with
the specified function call as entry point.</p>
- <p>Note that <c>Args</c> is supposed to be the argument
- list, but may be any term in the case of an erroneous
- spawn.</p>
+ <p><c>Args</c> is supposed to be the argument list,
+ but can be any term if the spawn is erroneous.</p>
</item>
<tag><c>{trace, Pid, exit, Reason}</c></tag>
<item>
@@ -7714,148 +8174,158 @@ timestamp() ->
<tag><c>{trace, Pid, unregister, RegName}</c></tag>
<item>
<p>When <c>Pid</c> gets the name <c>RegName</c> unregistered.
- Note that this is done automatically when a registered
+ This is done automatically when a registered
process exits.</p>
</item>
<tag><c>{trace, Pid, in, {M, F, Arity} | 0}</c></tag>
<item>
- <p>When <c>Pid</c> is scheduled to run. The process will
- run in function <c>{M, F, Arity}</c>. On some rare
- occasions the current function cannot be determined, then
- the last element <c>Arity</c> is 0.</p>
+ <p>When <c>Pid</c> is scheduled to run. The process
+ runs in function <c>{M, F, Arity}</c>. On some rare
+ occasions, the current function cannot be determined,
+ then the last element <c>Arity</c> is <c>0</c>.</p>
</item>
<tag><c>{trace, Pid, out, {M, F, Arity} | 0}</c></tag>
<item>
<p>When <c>Pid</c> is scheduled out. The process was
- running in function {M, F, Arity}. On some rare occasions
+ running in function {M, F, Arity}. On some rare occasions,
the current function cannot be determined, then the last
- element <c>Arity</c> is 0.</p>
+ element <c>Arity</c> is <c>0</c>.</p>
</item>
- <tag><marker id="gc_start"><c>{trace, Pid, gc_start, Info}</c></marker></tag>
+ <tag><c>{trace, Pid, gc_start, Info}</c></tag>
<item>
+ <marker id="gc_start"></marker>
<p>Sent when garbage collection is about to be started.
<c>Info</c> is a list of two-element tuples, where
the first element is a key, and the second is the value.
- You should not depend on the tuples have any defined
- order. Currently, the following keys are defined:</p>
+ Do not depend on any order of the tuples.
+ The following keys are defined:</p>
<taglist>
<tag><c>heap_size</c></tag>
<item>The size of the used part of the heap.</item>
<tag><c>heap_block_size</c></tag>
<item>The size of the memory block used for storing
- the heap and the stack.</item>
+ the heap and the stack.</item>
<tag><c>old_heap_size</c></tag>
<item>The size of the used part of the old heap.</item>
<tag><c>old_heap_block_size</c></tag>
<item>The size of the memory block used for storing
- the old heap.</item>
+ the old heap.</item>
<tag><c>stack_size</c></tag>
- <item>The actual size of the stack.</item>
+ <item>The size of the stack.</item>
<tag><c>recent_size</c></tag>
<item>The size of the data that survived the previous garbage
- collection.</item>
+ collection.</item>
<tag><c>mbuf_size</c></tag>
<item>The combined size of message buffers associated with
- the process.</item>
-
+ the process.</item>
<tag><c>bin_vheap_size</c></tag>
- <item>The total size of unique off-heap binaries referenced from the process heap.</item>
+ <item>The total size of unique off-heap binaries referenced
+ from the process heap.</item>
<tag><c>bin_vheap_block_size</c></tag>
- <item>The total size of binaries, in words, allowed in the virtual
- heap in the process before doing a garbage collection. </item>
+ <item>The total size of binaries allowed in the virtual
+ heap in the process before doing a garbage collection.</item>
<tag><c>bin_old_vheap_size</c></tag>
- <item>The total size of unique off-heap binaries referenced from the process old heap.</item>
+ <item>The total size of unique off-heap binaries referenced
+ from the process old heap.</item>
<tag><c>bin_vheap_block_size</c></tag>
- <item>The total size of binaries, in words, allowed in the virtual
- old heap in the process before doing a garbage collection. </item>
-
-
+ <item>The total size of binaries allowed in the virtual
+ old heap in the process before doing a garbage collection.</item>
</taglist>
<p>All sizes are in words.</p>
</item>
<tag><c>{trace, Pid, gc_end, Info}</c></tag>
<item>
<p>Sent when garbage collection is finished. <c>Info</c>
- contains the same kind of list as in the <c>gc_start</c>
- message, but the sizes reflect the new sizes after
+ contains the same kind of list as in message <c>gc_start</c>,
+ but the sizes reflect the new sizes after
garbage collection.</p>
</item>
</taglist>
- <p>If the tracing process dies, the flags will be silently
+ <p>If the tracing process dies, the flags are silently
removed.</p>
- <p>Only one process can trace a particular process. For this
- reason, attempts to trace an already traced process will fail.</p>
+ <p>Only one process can trace a particular process. Therefore,
+ attempts to trace an already traced process fail.</p>
<p>Returns: A number indicating the number of processes that
- matched <c><anno>PidSpec</anno></c>. If <c><anno>PidSpec</anno></c> is a pid,
- the return value will be <c>1</c>. If <c><anno>PidSpec</anno></c> is
- <c>all</c> or <c>existing</c> the return value will be
+ matched <c><anno>PidSpec</anno></c>.
+ If <c><anno>PidSpec</anno></c> is a process
+ identifier, the return value is <c>1</c>.
+ If <c><anno>PidSpec</anno></c>
+ is <c>all</c> or <c>existing</c>, the return value is
the number of processes running, excluding tracer processes.
- If <c><anno>PidSpec</anno></c> is <c>new</c>, the return value will be
+ If <c><anno>PidSpec</anno></c> is <c>new</c>, the return value is
<c>0</c>.</p>
- <p>Failure: If specified arguments are not supported. For
- example <c>cpu_timestamp</c> is not supported on all
- platforms.</p>
+ <p>Failure: <c>badarg</c> if the specified arguments are
+ not supported. For example, <c>cpu_timestamp</c> is not
+ supported on all platforms.</p>
</desc>
</func>
+
<func>
<name name="trace_delivered" arity="1"/>
- <fsummary>Notification when trace has been delivered</fsummary>
+ <fsummary>Notification when trace has been delivered.</fsummary>
<desc>
<p>The delivery of trace messages is dislocated on the time-line
- compared to other events in the system. If you know that the
- <c><anno>Tracee</anno></c> has passed some specific point in its execution,
+ compared to other events in the system. If you know that
+ <c><anno>Tracee</anno></c> has passed some specific point
+ in its execution,
and you want to know when at least all trace messages
- corresponding to events up to this point have reached the tracer
- you can use <c>erlang:trace_delivered(<anno>Tracee</anno>)</c>. A
+ corresponding to events up to this point have reached the
+ tracer, use <c>erlang:trace_delivered(<anno>Tracee</anno>)</c>. A
<c>{trace_delivered, <anno>Tracee</anno>, <anno>Ref</anno>}</c> message is sent to
the caller of <c>erlang:trace_delivered(<anno>Tracee</anno>)</c> when it
- is guaranteed that all trace messages have been delivered to
- the tracer up to the point that the <c><anno>Tracee</anno></c> had reached
+ is guaranteed that all trace messages are delivered to
+ the tracer up to the point that <c><anno>Tracee</anno></c> reached
at the time of the call to
<c>erlang:trace_delivered(<anno>Tracee</anno>)</c>.</p>
- <p>Note that the <c>trace_delivered</c> message does <em>not</em>
- imply that trace messages have been delivered; instead, it implies
- that all trace messages that <em>should</em> be delivered have
- been delivered. It is not an error if <c><anno>Tracee</anno></c> isn't, and
- hasn't been traced by someone, but if this is the case,
- <em>no</em> trace messages will have been delivered when the
+ <p>Notice that message <c>trace_delivered</c> does <em>not</em>
+ imply that trace messages have been delivered.
+ Instead it implies that all trace messages that
+ <em>are to be delivered</em> have been delivered.
+ It is not an error if <c><anno>Tracee</anno></c> is not, and
+ has not been traced by someone, but if this is the case,
+ <em>no</em> trace messages have been delivered when the
<c>trace_delivered</c> message arrives.</p>
- <p>Note that <c><anno>Tracee</anno></c> has to refer to a process currently,
+ <p>Notice that that <c><anno>Tracee</anno></c> must refer
+ to a process currently,
or previously existing on the same node as the caller of
<c>erlang:trace_delivered(<anno>Tracee</anno>)</c> resides on.
- The special <c><anno>Tracee</anno></c> atom <c>all</c> denotes all processes
+ The special <c><anno>Tracee</anno></c> atom <c>all</c>
+ denotes all processes
that currently are traced in the node.</p>
- <p>An example: Process <c>A</c> is <c><anno>Tracee</anno></c>, port <c>B</c> is
- tracer, and process <c>C</c> is the port owner of <c>B</c>.
- <c>C</c> wants to close <c>B</c> when <c>A</c> exits. <c>C</c>
- can ensure that the trace isn't truncated by calling
- <c>erlang:trace_delivered(A)</c> when <c>A</c> exits and wait
- for the <c>{trace_delivered, A, <anno>Ref</anno>}</c> message before closing
- <c>B</c>.</p>
- <p>Failure: <c>badarg</c> if <c><anno>Tracee</anno></c> does not refer to a
+ <p>Example: Process <c>A</c> is <c><anno>Tracee</anno></c>,
+ port <c>B</c> is tracer, and process <c>C</c> is the port
+ owner of <c>B</c>. <c>C</c> wants to close <c>B</c> when
+ <c>A</c> exits. To ensure that the trace is not truncated,
+ <c>C</c> can call <c>erlang:trace_delivered(A)</c>, when
+ <c>A</c> exits, and wait for message <c>{trace_delivered, A,
+ <anno>Ref</anno>}</c> before closing <c>B</c>.</p>
+ <p>Failure: <c>badarg</c> if <c><anno>Tracee</anno></c>
+ does not refer to a
process (dead or alive) on the same node as the caller of
<c>erlang:trace_delivered(<anno>Tracee</anno>)</c> resides on.</p>
</desc>
</func>
+
<func>
<name name="trace_info" arity="2"/>
+ <fsummary>Trace information about a process or function.</fsummary>
<type name="trace_info_return"/>
<type name="trace_info_item_result"/>
<type name="trace_info_flag"/>
<type name="trace_match_spec"/>
- <fsummary>Trace information about a process or function</fsummary>
<desc>
<p>Returns trace information about a process or function.</p>
- <p>To get information about a process, <c><anno>PidOrFunc</anno></c> should
- be a pid or the atom <c>new</c>. The atom <c>new</c> means
- that the default trace state for processes to be created will
- be returned. <c><anno>Item</anno></c> must have one of the following
- values:</p>
+ <p>To get information about a process,
+ <c><anno>PidOrFunc</anno></c> is to
+ be a process identifier (pid) or the atom <c>new</c>.
+ The atom <c>new</c> means that the default trace state for
+ processes to be created is returned.</p>
+ <p>The following <c>Item</c>s are valid:</p>
<taglist>
<tag><c>flags</c></tag>
<item>
- <p>Return a list of atoms indicating what kind of traces is
- enabled for the process. The list will be empty if no
+ <p>Returns a list of atoms indicating what kind of traces is
+ enabled for the process. The list is empty if no
traces are enabled, and one or more of the followings
atoms if traces are enabled: <c>send</c>,
<c>'receive'</c>, <c>set_on_spawn</c>, <c>call</c>,
@@ -7866,337 +8336,354 @@ timestamp() ->
</item>
<tag><c>tracer</c></tag>
<item>
- <p>Return the identifier for process or port tracing this
+ <p>Returns the identifier for process or port tracing this
process. If this process is not being traced, the return
- value will be <c>[]</c>.</p>
+ value is <c>[]</c>.</p>
</item>
</taglist>
- <p>To get information about a function, <c>PidOrFunc</c> should
- be a three-element tuple: <c>{Module, Function, Arity}</c> or
- the atom <c>on_load</c>. No wildcards are allowed. Returns
- <c>undefined</c> if the function does not exist or
- <c>false</c> if the function is not traced at all. <c>Item</c>
- must have one of the following values:</p>
+ <p>To get information about a function, <c>PidOrFunc</c> is to
+ be the three-element tuple <c>{Module, Function, Arity}</c> or
+ the atom <c>on_load</c>. No wild cards are allowed. Returns
+ <c>undefined</c> if the function does not exist, or
+ <c>false</c> if the function is not traced.</p>
+ <p>The following <c>Item</c>s are valid::</p>
<taglist>
<tag><c>traced</c></tag>
<item>
- <p>Return <c>global</c> if this function is traced on
+ <p>Returns <c>global</c> if this function is traced on
global function calls, <c>local</c> if this function is
- traced on local function calls (i.e local and global
- function calls), and <c>false</c> if neither local nor
- global function calls are traced.</p>
+ traced on local function calls (that is, local and global
+ function calls), and <c>false</c> if local or
+ global function calls are not traced.</p>
</item>
<tag><c>match_spec</c></tag>
<item>
- <p>Return the match specification for this function, if it
+ <p>Returns the match specification for this function, if it
has one. If the function is locally or globally traced but
has no match specification defined, the returned value
is <c>[]</c>.</p>
</item>
<tag><c>meta</c></tag>
<item>
- <p>Return the meta trace tracer process or port for this
- function, if it has one. If the function is not meta
- traced the returned value is <c>false</c>, and if
- the function is meta traced but has once detected that
- the tracer proc is invalid, the returned value is [].</p>
+ <p>Returns the meta-trace tracer process or port for this
+ function, if it has one. If the function is not
+ meta-traced, the returned value is <c>false</c>. If
+ the function is meta-traced but has once detected that
+ the tracer process is invalid, the returned value is [].</p>
</item>
<tag><c>meta_match_spec</c></tag>
<item>
- <p>Return the meta trace match specification for this
- function, if it has one. If the function is meta traced
+ <p>Returns the meta-trace match specification for this
+ function, if it has one. If the function is meta-traced
but has no match specification defined, the returned
value is <c>[]</c>.</p>
</item>
<tag><c>call_count</c></tag>
<item>
- <p>Return the call count value for this function or
+ <p>Returns the call count value for this function or
<c>true</c> for the pseudo function <c>on_load</c> if call
- count tracing is active. Return <c>false</c> otherwise.
+ count tracing is active. Otherwise <c>false</c> is returned.
See also
<seealso marker="#trace_pattern/3">erlang:trace_pattern/3</seealso>.</p>
</item>
<tag><c>call_time</c></tag>
<item>
- <p>Return the call time values for this function or
+ <p>Returns the call time values for this function or
<c>true</c> for the pseudo function <c>on_load</c> if call
- time tracing is active. Returns <c>false</c> otherwise.
+ time tracing is active. Otherwise <c>false</c> is returned.
The call time values returned, <c>[{Pid, Count, S, Us}]</c>,
- is a list of each process that has executed the function and its specific counters.
- See also
+ is a list of each process that executed the function
+ and its specific counters. See also
<seealso marker="#trace_pattern/3">erlang:trace_pattern/3</seealso>.</p>
</item>
<tag><c>all</c></tag>
<item>
- <p>Return a list containing the <c>{<anno>Item</anno>, Value}</c> tuples
- for all other items, or return <c>false</c> if no tracing
+ <p>Returns a list containing the
+ <c>{<anno>Item</anno>, Value}</c> tuples
+ for all other items, or returns <c>false</c> if no tracing
is active for this function.</p>
</item>
</taglist>
- <p>The actual return value will be <c>{<anno>Item</anno>, Value}</c>, where
- <c>Value</c> is the requested information as described above.
+ <p>The return value is <c>{<anno>Item</anno>, Value}</c>, where
+ <c>Value</c> is the requested information as described earlier.
If a pid for a dead process was given, or the name of a
- non-existing function, <c>Value</c> will be <c>undefined</c>.</p>
- <p>If <c><anno>PidOrFunc</anno></c> is the <c>on_load</c>, the information
+ non-existing function, <c>Value</c> is <c>undefined</c>.</p>
+ <p>If <c><anno>PidOrFunc</anno></c> is <c>on_load</c>, the information
returned refers to the default value for code that will be
loaded.</p>
</desc>
</func>
+
<func>
<name name="trace_pattern" arity="2" clause_i="1"/>
+ <fsummary>Sets trace patterns for global call tracing.</fsummary>
<type name="trace_pattern_mfa"/>
<type name="trace_match_spec"/>
- <fsummary>Set trace patterns for global call tracing</fsummary>
<desc>
<p>The same as
<seealso marker="#trace_pattern/3">erlang:trace_pattern(MFA, MatchSpec, [])</seealso>,
retained for backward compatibility.</p>
</desc>
</func>
+
<func>
<name name="trace_pattern" arity="3"/>
+ <fsummary>Sets trace patterns for tracing of function calls.</fsummary>
<type name="trace_pattern_mfa"/>
<type name="trace_match_spec"/>
<type name="trace_pattern_flag"/>
- <fsummary>Set trace patterns for tracing of function calls</fsummary>
<desc>
- <p>This BIF is used to enable or disable call tracing for
- exported functions. It must be combined with
+ <p>Enables or disables call tracing for
+ one or more functions. Must be combined with
<seealso marker="#trace/3">erlang:trace/3</seealso>
to set the <c>call</c> trace flag for one or more processes.</p>
- <p>Conceptually, call tracing works like this: Inside
- the Erlang virtual machine there is a set of processes to be
- traced and a set of functions to be traced. Tracing will be
- enabled on the intersection of the set. That is, if a process
- included in the traced process set calls a function included
- in the traced function set, the trace action will be taken.
- Otherwise, nothing will happen.</p>
- <p>Use
- <seealso marker="#trace/3">erlang:trace/3</seealso> to
- add or remove one or more processes to the set of traced
- processes. Use <c>erlang:trace_pattern/2</c> to add or remove
- exported functions to the set of traced functions.</p>
- <p>The <c>erlang:trace_pattern/3</c> BIF can also add match
- specifications to an exported function. A match specification
- comprises a pattern that the arguments to the function must
- match, a guard expression which must evaluate to <c>true</c>
+ <p>Conceptually, call tracing works as follows. Inside
+ the Erlang Virtual Machine, a set of processes and
+ a set of functions are to be traced. If a traced process
+ calls a traced function, the trace action is taken.
+ Otherwise, nothing happens.</p>
+ <p>To add or remove one or more processes to the set of traced
+ processes, use
+ <seealso marker="#trace/3">erlang:trace/3</seealso>.</p>
+ <p>To add or remove functions to the set of traced
+ functions, use <c>erlang:trace_pattern/3</c>.</p>
+ <p>The BIF <c>erlang:trace_pattern/3</c> can also add match
+ specifications to a function. A match specification
+ comprises a pattern that the function arguments must
+ match, a guard expression that must evaluate to <c>true</c>,
and an action to be performed. The default action is to send a
trace message. If the pattern does not match or the guard
- fails, the action will not be executed.</p>
- <p>The <c><anno>MFA</anno></c> argument should be a tuple like
- <c>{Module, Function, Arity}</c> or the atom <c>on_load</c>
- (described below). It can be the module, function, and arity
- for an exported function (or a BIF in any module).
- The <c>'_'</c> atom can be used to mean any of that kind.
- Wildcards can be used in any of the following ways:</p>
+ fails, the action is not executed.</p>
+ <p>Argument <c><anno>MFA</anno></c> is to be a tuple, such as
+ <c>{Module, Function, Arity}</c>, or the atom <c>on_load</c>
+ (described in the following). It can be the module, function,
+ and arity for a function (or a BIF in any module).
+ The atom <c>'_'</c> can be used as a wild card in any of the
+ following ways:</p>
<taglist>
<tag><c>{Module,Function,'_'}</c></tag>
<item>
- <p>All exported functions of any arity named <c>Function</c>
+ <p>All functions of any arity named <c>Function</c>
in module <c>Module</c>.</p>
</item>
<tag><c>{Module,'_','_'}</c></tag>
<item>
- <p>All exported functions in module <c>Module</c>.</p>
+ <p>All functions in module <c>Module</c>.</p>
</item>
<tag><c>{'_','_','_'}</c></tag>
<item>
- <p>All exported functions in all loaded modules.</p>
+ <p>All functions in all loaded modules.</p>
</item>
</taglist>
<p>Other combinations, such as <c>{Module,'_',Arity}</c>, are
- not allowed. Local functions will match wildcards only if
- the <c>local</c> option is in the <c><anno>FlagList</anno></c>.</p>
- <p>If the <c><anno>MFA</anno></c> argument is the atom <c>on_load</c>,
- the match specification and flag list will be used on all
+ not allowed. Local functions match wild cards only if
+ option <c>local</c> is in <c><anno>FlagList</anno></c>.</p>
+ <p>If argument <c><anno>MFA</anno></c> is the atom <c>on_load</c>,
+ the match specification and flag list are used on all
modules that are newly loaded.</p>
- <p>The <c><anno>MatchSpec</anno></c> argument can take any of the following
- forms:</p>
+ <p>Argument <c><anno>MatchSpec</anno></c> can take the
+ following forms:</p>
<taglist>
<tag><c>false</c></tag>
<item>
- <p>Disable tracing for the matching function(s). Any match
- specification will be removed.</p>
+ <p>Disables tracing for the matching functions.
+ Any match specification is removed.</p>
</item>
<tag><c>true</c></tag>
<item>
- <p>Enable tracing for the matching function(s).</p>
+ <p>Enables tracing for the matching functions.</p>
</item>
<tag><c><anno>MatchSpecList</anno></c></tag>
<item>
<p>A list of match specifications. An empty list is
- equivalent to <c>true</c>. See the ERTS User's Guide
- for a description of match specifications.</p>
+ equivalent to <c>true</c>. For a description of match
+ specifications, see the User's Guide.</p>
</item>
<tag><c>restart</c></tag>
<item>
- <p>For the <c><anno>FlagList</anno></c> option <c>call_count</c> and <c>call_time</c>:
- restart the existing counters. The behaviour is undefined
+ <p>For the <c><anno>FlagList</anno></c> options <c>call_count</c>
+ and <c>call_time</c>: restarts
+ the existing counters. The behavior is undefined
for other <c><anno>FlagList</anno></c> options.</p>
</item>
<tag><c>pause</c></tag>
<item>
- <p>For the <c><anno>FlagList</anno></c> option <c>call_count</c> and <c>call_time</c>: pause
- the existing counters. The behaviour is undefined for
- other <c>FlagList</c> options.</p>
+ <p>For the <c><anno>FlagList</anno></c> options
+ <c>call_count</c> and <c>call_time</c>: pauses
+ the existing counters. The behavior is undefined for
+ other <c><anno>FlagList</anno></c> options.</p>
</item>
</taglist>
- <p>The <c><anno>FlagList</anno></c> parameter is a list of options.
- The following options are allowed:</p>
+ <p>Parameter <c><anno>FlagList</anno></c> is a list of options.
+ The following are the valid options:</p>
<taglist>
<tag><c>global</c></tag>
<item>
- <p>Turn on or off call tracing for global function calls
+ <p>Turns on or off call tracing for global function calls
(that is, calls specifying the module explicitly). Only
- exported functions will match and only global calls will
- generate trace messages. This is the default.</p>
+ exported functions match and only global calls
+ generate trace messages. <em>This is the default</em>.</p>
</item>
<tag><c>local</c></tag>
<item>
- <p>Turn on or off call tracing for all types of function
- calls. Trace messages will be sent whenever any of
+ <p>Turns on or off call tracing for all types of function
+ calls. Trace messages are sent whenever any of
the specified functions are called, regardless of how they
- are called. If the <c>return_to</c> flag is set for
- the process, a <c>return_to</c> message will also be sent
+ are called. If flag <c>return_to</c> is set for
+ the process, a <c>return_to</c> message is also sent
when this function returns to its caller.</p>
</item>
<tag><c>meta | {meta, <anno>Pid</anno>}</c></tag>
<item>
- <p>Turn on or off meta tracing for all types of function
- calls. Trace messages will be sent to the tracer process
+ <p>Turns on or off meta-tracing for all types of function
+ calls. Trace messages are sent to the tracer process
or port <c><anno>Pid</anno></c> whenever any of the specified
functions are called, regardless of how they are called.
- If no <c><anno>Pid</anno></c> is specified, <c>self()</c> is used as a
- default tracer process.</p>
- <p>Meta tracing traces all processes and does not care
+ If no <c><anno>Pid</anno></c> is specified,
+ <c>self()</c> is used as a default tracer process.</p>
+ <p>Meta-tracing traces all processes and does not care
about the process trace flags set by <c>trace/3</c>,
the trace flags are instead fixed to
<c>[call, timestamp]</c>.</p>
- <p>The match spec function <c>{return_trace}</c> works with
- meta trace and send its trace message to the same tracer
- process.</p>
+ <p>The match specification function <c>{return_trace}</c>
+ works with meta-trace and sends its trace message to the
+ same tracer process.</p>
</item>
<tag><c>call_count</c></tag>
<item>
<p>Starts (<c><anno>MatchSpec</anno> == true</c>) or stops
- (<c><anno>MatchSpec</anno> == false</c>) call count tracing for all
- types of function calls. For every function a counter is
+ (<c><anno>MatchSpec</anno> == false</c>)
+ call count tracing for all
+ types of function calls. For every function, a counter is
incremented when the function is called, in any process.
No process trace flags need to be activated.</p>
<p>If call count tracing is started while already running,
- the count is restarted from zero. Running counters can be
- paused with <c><anno>MatchSpec</anno> == pause</c>. Paused and running
- counters can be restarted from zero with
+ the count is restarted from zero. To pause running
+ counters, use <c><anno>MatchSpec</anno> == pause</c>.
+ Paused and running counters can be restarted from zero with
<c><anno>MatchSpec</anno> == restart</c>.</p>
- <p>The counter value can be read with
+ <p>To read the counter value, use
<seealso marker="#trace_info/2">erlang:trace_info/2</seealso>.</p>
</item>
<tag><c>call_time</c></tag>
<item>
<p>Starts (<c><anno>MatchSpec</anno> == true</c>) or stops
- (<c><anno>MatchSpec</anno> == false</c>) call time tracing for all
- types of function calls. For every function a counter is
- incremented when the function is called. Time spent in the function
- is accumulated in two other counters, seconds and micro-seconds.
+ (<c><anno>MatchSpec</anno> == false</c>) call time
+ tracing for all
+ types of function calls. For every function, a counter is
+ incremented when the function is called.
+ Time spent in the function is accumulated in
+ two other counters, seconds and microseconds.
The counters are stored for each call traced process.</p>
<p>If call time tracing is started while already running,
- the count and time is restarted from zero. Running counters can be
- paused with <c><anno>MatchSpec</anno> == pause</c>. Paused and running
- counters can be restarted from zero with
+ the count and time is restarted from zero. To pause
+ running counters, use <c><anno>MatchSpec</anno> == pause</c>.
+ Paused and running counters can be restarted from zero with
<c><anno>MatchSpec</anno> == restart</c>.</p>
- <p>The counter value can be read with
+ <p>To read the counter value, use
<seealso marker="#trace_info/2">erlang:trace_info/2</seealso>.</p>
</item>
-
</taglist>
- <p>The <c>global</c> and <c>local</c> options are mutually
- exclusive and <c>global</c> is the default (if no options are
- specified). The <c>call_count</c> and <c>meta</c> options
- perform a kind of local tracing, and can also not be combined
- with <c>global</c>. A function can be either globally or
+ <p>The options <c>global</c> and <c>local</c> are mutually
+ exclusive, and <c>global</c> is the default (if no options are
+ specified). The options <c>call_count</c> and <c>meta</c>
+ perform a kind of local tracing, and cannot be combined
+ with <c>global</c>. A function can be globally or
locally traced. If global tracing is specified for a
- specified set of functions; local, meta, call time and call count
- tracing for the matching set of local functions will be
- disabled, and vice versa.</p>
+ set of functions, then local, meta, call time, and call count
+ tracing for the matching set of local functions is
+ disabled, and conversely.</p>
<p>When disabling trace, the option must match the type of trace
- that is set on the function, so that local tracing must be
- disabled with the <c>local</c> option and global tracing with
- the <c>global</c> option (or no option at all), and so forth.</p>
- <p>There is no way to directly change part of a match
- specification list. If a function has a match specification,
- you can replace it with a completely new one. If you need to
- change an existing match specification, use the
+ set on the function. That is, local tracing must be
+ disabled with option <c>local</c> and global tracing with
+ option <c>global</c> (or no option), and so forth.</p>
+ <p>Part of a match specification list cannot be changed directly.
+ If a function has a match specification, it can be replaced
+ with a new one. To change an existing match specification,
+ use the BIF
<seealso marker="#trace_info/2">erlang:trace_info/2</seealso>
- BIF to retrieve the existing match specification.</p>
- <p>Returns the number of exported functions that matched
- the <c><anno>MFA</anno></c> argument. This will be zero if none matched at
- all.</p>
+ to retrieve the existing match specification.</p>
+ <p>Returns the number of functions matching
+ argument <c><anno>MFA</anno></c>. This is zero if none matched.</p>
</desc>
</func>
+
<func>
<name name="trunc" arity="1"/>
- <fsummary>Return an integer by the truncating a number</fsummary>
+ <fsummary>Returns an integer by truncating a number</fsummary>
<desc>
- <p>Returns an integer by the truncating <c><anno>Number</anno></c>.</p>
+ <p>Returns an integer by truncating <c><anno>Number</anno></c>,
+ for example:</p>
<pre>
> <input>trunc(5.5).</input>
5</pre>
<p>Allowed in guard tests.</p>
</desc>
</func>
+
<func>
<name name="tuple_size" arity="1"/>
- <fsummary>Return the size of a tuple</fsummary>
+ <fsummary>Returns the size of a tuple.</fsummary>
<desc>
- <p>Returns an integer which is the number of elements in <c><anno>Tuple</anno></c>.</p>
+ <p>Returns an integer that is the number of elements in
+ <c><anno>Tuple</anno></c>, for example:</p>
<pre>
> <input>tuple_size({morni, mulle, bwange}).</input>
3</pre>
<p>Allowed in guard tests.</p>
</desc>
</func>
+
<func>
<name name="tuple_to_list" arity="1"/>
- <fsummary>Convert a tuple to a list</fsummary>
+ <fsummary>Converts a tuple to a list.</fsummary>
<desc>
- <p>Returns a list which corresponds to <c><anno>Tuple</anno></c>.
- <c><anno>Tuple</anno></c> may contain any Erlang terms.</p>
+ <p>Returns a list corresponding to <c><anno>Tuple</anno></c>.
+ <c><anno>Tuple</anno></c> can contain any Erlang terms.</p>
+ <p>Example:</p>
<pre>
> <input>tuple_to_list({share, {'Ericsson_B', 163}}).</input>
[share,{'Ericsson_B',163}]</pre>
</desc>
</func>
+
<func>
<name name="universaltime" arity="0"/>
- <fsummary>Current date and time according to Universal Time Coordinated (UTC)</fsummary>
+ <fsummary>Current date and time according to Universal Time Coordinated (UTC).</fsummary>
<desc>
<p>Returns the current date and time according to Universal
- Time Coordinated (UTC), also called GMT, in the form
+ Time Coordinated (UTC) in the form
<c>{{Year, Month, Day}, {Hour, Minute, Second}}</c> if
- supported by the underlying operating system. If not,
- <c>erlang:universaltime()</c> is equivalent to
+ supported by the underlying OS.
+ Otherwise <c>erlang:universaltime()</c> is equivalent to
<c>erlang:localtime()</c>.</p>
+ <p>Example:</p>
<pre>
> <input>erlang:universaltime().</input>
{{1996,11,6},{14,18,43}}</pre>
</desc>
</func>
+
<func>
<name name="universaltime_to_localtime" arity="1"/>
- <fsummary>Convert from Universal Time Coordinated (UTC) to local date and time</fsummary>
+ <fsummary>Converts from Universal Time Coordinated (UTC) to local date and time.</fsummary>
<desc>
<p>Converts Universal Time Coordinated (UTC) date and time to
- local date and time, if this is supported by the underlying
- OS. Otherwise, no conversion is done, and
+ local date and time in the form
+ <c>{{Year, Month, Day}, {Hour, Minute, Second}}</c> if
+ supported by the underlying OS.
+ Otherwise no conversion is done, and
<c><anno>Universaltime</anno></c> is returned.</p>
+ <p>Example:</p>
<pre>
> <input>erlang:universaltime_to_localtime({{1996,11,6},{14,18,43}}).</input>
{{1996,11,7},{15,18,43}}</pre>
- <p>Failure: <c>badarg</c> if <c>Universaltime</c> does not denote
- a valid date and time.</p>
+ <p>Failure: <c>badarg</c> if <c>Universaltime</c> denotes
+ an invalid date and time.</p>
</desc>
</func>
+
<func>
<name name="unique_integer" arity="0"/>
<fsummary>Get a unique integer value</fsummary>
@@ -8221,23 +8708,23 @@ timestamp() ->
Each integer value can of course be constructed
by other means.</p>
- <p>By default, i.e. when <c>[]</c> is passed as
+ <p>By default, when <c>[]</c> is passed as
<c><anno>ModifierList</anno></c>, both negative and
- positive integers will be returned. This is order
- to be able to utilize the range of integers that do
- not need to be heap allocated as much as possible.
+ positive integers can be returned. This in order
+ to utilize the range of integers that do
+ not need heap memory allocation as much as possible.
By default the returned integers are also only
- guaranteed to be unique, i.e., any integer returned
- may be either smaller, or larger than previously
+ guaranteed to be unique, that is, any returned integer
+ can be smaller or larger than previously
returned integers.</p>
- <p>Currently valid <c><anno>Modifier</anno></c>s:</p>
+ <p>Valid <c><anno>Modifier</anno></c>s:</p>
<taglist>
<tag>positive</tag>
<item><p>Return only positive integers.</p>
<p>Note that by passing the <c>positive</c> modifier
- you will get heap allocated integers (big-nums)
+ you will get heap allocated integers (bignums)
quicker.</p>
</item>
@@ -8249,7 +8736,7 @@ timestamp() ->
returned will always be larger than previously
returned integers on the current runtime system
instance.</p>
- <p>These values can be used when ordering events
+ <p>These values can be used to determine order between events
on the runtime system instance. That is, if both
<c>X = erlang:unique_integer([monotonic])</c> and
<c>Y = erlang:unique_integer([monotonic])</c> are
@@ -8259,21 +8746,21 @@ timestamp() ->
before <c>Y</c>.</p>
<warning><p>Strictly monotonically increasing values
are inherently quite expensive to generate and scales
- poorly. This since the values needs to be
- synchronized. That is, do not pass the <c>monotonic</c>
+ poorly. This is because the values need to be
+ synchronized between cpu cores. That is, do not pass the <c>monotonic</c>
modifier unless you really need strictly monotonically
increasing values.</p></warning>
</item>
</taglist>
- <p>All currently valid <c><anno>Modifier</anno></c>s
+ <p>All valid <c><anno>Modifier</anno></c>s
can be combined. Repeated (valid)
<c><anno>Modifier</anno></c>s in the <c>ModifierList</c>
are ignored.</p>
<note><p>Note that the set of integers returned by
- <c>unique_integer/1</c> using diffrent sets of
+ <c>unique_integer/1</c> using different sets of
<c><anno>Modifier</anno></c>s <em>will overlap</em>.
For example, by calling <c>unique_integer([monotonic])</c>,
and <c>unique_integer([positive, monotonic])</c>
@@ -8293,25 +8780,30 @@ timestamp() ->
</func>
<func>
<name name="unlink" arity="1"/>
- <fsummary>Remove a link, if there is one, to another process or port</fsummary>
+ <fsummary>Removes a link to another process or port.</fsummary>
<desc>
<p>Removes the link, if there is one, between the calling
- process and the process or port referred to by <c><anno>Id</anno></c>.</p>
+ process and the process or port referred to by
+ <c><anno>Id</anno></c>.</p>
<p>Returns <c>true</c> and does not fail, even if there is no
- link to <c><anno>Id</anno></c>, or if <c><anno>Id</anno></c> does not exist.</p>
- <p>Once <c>unlink(<anno>Id</anno>)</c> has returned it is guaranteed that
+ link to <c><anno>Id</anno></c>, or if <c><anno>Id</anno></c>
+ does not exist.</p>
+ <p>Once <c>unlink(<anno>Id</anno>)</c> has returned,
+ it is guaranteed that
the link between the caller and the entity referred to by
- <c><anno>Id</anno></c> has no effect on the caller in the future (unless
- the link is setup again). If caller is trapping exits, an
- <c>{'EXIT', <anno>Id</anno>, _}</c> message due to the link might have
- been placed in the caller's message queue prior to the call,
- though. Note, the <c>{'EXIT', <anno>Id</anno>, _}</c> message can be the
- result of the link, but can also be the result of <c><anno>Id</anno></c>
- calling <c>exit/2</c>. Therefore, it <em>may</em> be
- appropriate to cleanup the message queue when trapping exits
- after the call to <c>unlink(<anno>Id</anno>)</c>, as follow:</p>
+ <c><anno>Id</anno></c> has no effect on the caller
+ in the future (unless
+ the link is setup again). If the caller is trapping exits, an
+ <c>{'EXIT', <anno>Id</anno>, _}</c> message from the link
+ can have been placed in the caller's message queue before
+ the call.</p>
+ <p>Notice that the <c>{'EXIT', <anno>Id</anno>, _}</c>
+ message can be the
+ result of the link, but can also be the result of <c>Id</c>
+ calling <c>exit/2</c>. Therefore, it <em>can</em> be
+ appropriate to clean up the message queue when trapping exits
+ after the call to <c>unlink(<anno>Id</anno>)</c>, as follows:</p>
<code type="none">
-
unlink(Id),
receive
{'EXIT', Id, _} ->
@@ -8320,23 +8812,25 @@ timestamp() ->
true
end</code>
<note>
- <p>Prior to OTP release R11B (erts version 5.5) <c>unlink/1</c>
- behaved completely asynchronous, i.e., the link was active
+ <p>Before OTP R11B (<c>ERTS</c> 5.5) <c>unlink/1</c>
+ behaved asynchronous, that is, the link was active
until the "unlink signal" reached the linked entity. This
- had one undesirable effect, though. You could never know when
+ had an undesirable effect, as you could never know when
you were guaranteed <em>not</em> to be effected by the link.</p>
- <p>Current behavior can be viewed as two combined operations:
+ <p>The current behavior can be viewed as two combined operations:
asynchronously send an "unlink signal" to the linked entity
and ignore any future results of the link.</p>
</note>
</desc>
</func>
+
<func>
<name name="unregister" arity="1"/>
- <fsummary>Remove the registered name for a process (or port)</fsummary>
+ <fsummary>Removes the registered name for a process (or port).</fsummary>
<desc>
- <p>Removes the registered name <c><anno>RegName</anno></c>, associated with a
- pid or a port identifier.</p>
+ <p>Removes the registered name <c><anno>RegName</anno></c>
+ associated with a
+ process identifier or a port identifier, for example:</p>
<pre>
> <input>unregister(db).</input>
true</pre>
@@ -8345,31 +8839,34 @@ true</pre>
name.</p>
</desc>
</func>
+
<func>
<name name="whereis" arity="1"/>
- <fsummary>Get the pid (or port) with a given registered name</fsummary>
+ <fsummary>Gets the pid (or port) with a given registered name.</fsummary>
<desc>
- <p>Returns the pid or port identifier with the registered name
- <c>RegName</c>. Returns <c>undefined</c> if the name is not
- registered.</p>
+ <p>Returns the process identifier or port identifier with
+ the registered name <c>RegName</c>. Returns <c>undefined</c>
+ if the name is not registered.</p>
+ <p>Example:</p>
<pre>
> <input>whereis(db).</input>
&lt;0.43.0></pre>
</desc>
</func>
+
<func>
<name name="yield" arity="0"/>
- <fsummary>Let other processes get a chance to execute</fsummary>
+ <fsummary>Lets other processes get a chance to execute.</fsummary>
<desc>
- <p>Voluntarily let other processes (if any) get a chance to
+ <p>Voluntarily lets other processes (if any) get a chance to
execute. Using <c>erlang:yield()</c> is similar to
<c>receive after 1 -> ok end</c>, except that <c>yield()</c>
is faster.</p>
<warning><p>There is seldom or never any need to use this BIF,
- especially in the SMP-emulator as other processes will have a
- chance to run in another scheduler thread anyway.
- Using this BIF without a thorough grasp of how the scheduler
- works may cause performance degradation.</p></warning>
+ especially in the SMP emulator, as other processes have a
+ chance to run in another scheduler thread anyway.
+ Using this BIF without a thorough grasp of how the scheduler
+ works can cause performance degradation.</p></warning>
</desc>
</func>
</funcs>
diff --git a/erts/doc/src/erts_alloc.xml b/erts/doc/src/erts_alloc.xml
index 376cae4a95..15b78ffa10 100644
--- a/erts/doc/src/erts_alloc.xml
+++ b/erts/doc/src/erts_alloc.xml
@@ -4,7 +4,7 @@
<cref>
<header>
<copyright>
- <year>2002</year><year>2014</year>
+ <year>2002</year><year>2015</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -260,19 +260,19 @@
<p>The following flags are available for configuration of
<c>mseg_alloc</c>:</p>
<taglist>
- <tag><marker id="MMamcbf"><c><![CDATA[+MMamcbf <size>]]></c></marker></tag>
+ <tag><marker id="MMamcbf"/><c><![CDATA[+MMamcbf <size>]]></c></tag>
<item>
Absolute max cache bad fit (in kilobytes). A segment in the
memory segment cache is not reused if its size exceeds the
requested size with more than the value of this
parameter. Default value is 4096. </item>
- <tag><marker id="MMrmcbf"><c><![CDATA[+MMrmcbf <ratio>]]></c></marker></tag>
+ <tag><marker id="MMrmcbf"/><c><![CDATA[+MMrmcbf <ratio>]]></c></tag>
<item>
Relative max cache bad fit (in percent). A segment in the
memory segment cache is not reused if its size exceeds the
requested size with more than relative max cache bad fit
percent of the requested size. Default value is 20.</item>
- <tag><marker id="MMsco"><c><![CDATA[+MMsco true|false]]></c></marker></tag>
+ <tag><marker id="MMsco"/><c><![CDATA[+MMsco true|false]]></c></tag>
<item>
Set <seealso marker="#MMscs">super carrier</seealso> only flag. This
flag defaults to <c>true</c>. When a super carrier is used and this
@@ -292,7 +292,7 @@
disabled on halfword heap systems. This flag will be
ignored on halfword heap systems.
</item>
- <tag><marker id="MMscrfsd"><c><![CDATA[+MMscrfsd <amount>]]></c></marker></tag>
+ <tag><marker id="MMscrfsd"/><c><![CDATA[+MMscrfsd <amount>]]></c></tag>
<item>
Set <seealso marker="#MMscs">super carrier</seealso> reserved
free segment descriptors. This parameter defaults to <c>65536</c>.
@@ -305,7 +305,7 @@
<c>erts_mmap</c> tuple part of the result from calling
<seealso marker="erts:erlang#system_info_allocator_tuple">erlang:system_info({allocator, mseg_alloc})</seealso>.
</item>
- <tag><marker id="MMscrpm"><c><![CDATA[+MMscrpm true|false]]></c></marker></tag>
+ <tag><marker id="MMscrpm"/><c><![CDATA[+MMscrpm true|false]]></c></tag>
<item>
Set <seealso marker="#MMscs">super carrier</seealso> reserve physical
memory flag. This flag defaults to <c>true</c>. When this flag is
@@ -328,7 +328,7 @@
disabled on halfword heap systems. This flag will be
ignored on halfword heap systems.
</item>
- <tag><marker id="MMscs"><c><![CDATA[+MMscs <size in MB>]]></c></marker></tag>
+ <tag><marker id="MMscs"/><c><![CDATA[+MMscs <size in MB>]]></c></tag>
<item>
Set super carrier size (in MB). The super carrier size defaults to
zero; i.e, the super carrier is by default disabled. The super
@@ -343,7 +343,7 @@
disabled on halfword heap systems. This flag will be
ignored on halfword heap systems.
</item>
- <tag><marker id="MMmcs"><c><![CDATA[+MMmcs <amount>]]></c></marker></tag>
+ <tag><marker id="MMmcs"/><c><![CDATA[+MMmcs <amount>]]></c></tag>
<item>
Max cached segments. The maximum number of memory segments
stored in the memory segment cache. Valid range is
@@ -352,15 +352,15 @@
<p>The following flags are available for configuration of
<c>sys_alloc</c>:</p>
<taglist>
- <tag><marker id="MYe"><c>+MYe true</c></marker></tag>
+ <tag><marker id="MYe"/><c>+MYe true</c></tag>
<item>
Enable <c>sys_alloc</c>. Note: <c>sys_alloc</c> cannot be disabled.</item>
- <tag><marker id="MYm"><c>+MYm libc</c></marker></tag>
+ <tag><marker id="MYm"/><c>+MYm libc</c></tag>
<item>
<c>malloc</c> library to use. Currently only
<c>libc</c> is available. <c>libc</c> enables the standard
<c>libc</c> malloc implementation. By default <c>libc</c> is used.</item>
- <tag><marker id="MYtt"><c><![CDATA[+MYtt <size>]]></c></marker></tag>
+ <tag><marker id="MYtt"/><c><![CDATA[+MYtt <size>]]></c></tag>
<item>
Trim threshold size (in kilobytes). This is the maximum amount
of free memory at the top of the heap (allocated by
@@ -372,7 +372,7 @@
trim threshold is 128. <em>Note:</em> This flag will
only have any effect when the emulator has been linked with
the GNU C library, and uses its <c>malloc</c> implementation.</item>
- <tag><marker id="MYtp"><c><![CDATA[+MYtp <size>]]></c></marker></tag>
+ <tag><marker id="MYtp"/><c><![CDATA[+MYtp <size>]]></c></tag>
<item>
Top pad size (in kilobytes). This is the amount of extra
memory that will be allocated by <c>malloc</c> when
@@ -390,7 +390,7 @@
subsystem identifier, only the specific allocator identified will be
effected:</p>
<taglist>
- <tag><marker id="M_acul"><c><![CDATA[+M<S>acul <utilization>|de]]></c></marker></tag>
+ <tag><marker id="M_acul"/><c><![CDATA[+M<S>acul <utilization>|de]]></c></tag>
<item>
Abandon carrier utilization limit. A valid
<c><![CDATA[<utilization>]]></c> is an integer in the range
@@ -422,7 +422,7 @@
allocators based on the <c>alloc_util</c> framework with the
exception of <c>temp_alloc</c> (which would be pointless).
</item>
- <tag><marker id="M_as"><c><![CDATA[+M<S>as bf|aobf|aoff|aoffcbf|aoffcaobf|gf|af]]></c></marker></tag>
+ <tag><marker id="M_as"/><c><![CDATA[+M<S>as bf|aobf|aoff|aoffcbf|aoffcaobf|gf|af]]></c></tag>
<item>
Allocation strategy. Valid strategies are <c>bf</c> (best fit),
<c>aobf</c> (address order best fit), <c>aoff</c> (address order first fit),
@@ -430,7 +430,7 @@
<c>aoffcaobf</c> (address order first fit carrier address order best fit),
<c>gf</c> (good fit), and <c>af</c> (a fit). See
<seealso marker="#strategy">the description of allocation strategies</seealso> in "the <c>alloc_util</c> framework" section.</item>
- <tag><marker id="M_asbcst"><c><![CDATA[+M<S>asbcst <size>]]></c></marker></tag>
+ <tag><marker id="M_asbcst"/><c><![CDATA[+M<S>asbcst <size>]]></c></tag>
<item>
Absolute singleblock carrier shrink threshold (in
kilobytes). When a block located in an
@@ -438,23 +438,23 @@
will be left unchanged if the amount of unused memory is less
than this threshold; otherwise, the carrier will be shrunk.
See also <seealso marker="#M_rsbcst">rsbcst</seealso>.</item>
- <tag><marker id="M_e"><c><![CDATA[+M<S>e true|false]]></c></marker></tag>
+ <tag><marker id="M_e"/><c><![CDATA[+M<S>e true|false]]></c></tag>
<item>
Enable allocator <c><![CDATA[<S>]]></c>.</item>
- <tag><marker id="M_lmbcs"><c><![CDATA[+M<S>lmbcs <size>]]></c></marker></tag>
+ <tag><marker id="M_lmbcs"/><c><![CDATA[+M<S>lmbcs <size>]]></c></tag>
<item>
Largest (<c>mseg_alloc</c>) multiblock carrier size (in
kilobytes). See <seealso marker="#mseg_mbc_sizes">the description
on how sizes for mseg_alloc multiblock carriers are decided</seealso>
in "the <c>alloc_util</c> framework" section. On 32-bit Unix style OS
this limit can not be set higher than 128 megabyte.</item>
- <tag><marker id="M_mbcgs"><c><![CDATA[+M<S>mbcgs <ratio>]]></c></marker></tag>
+ <tag><marker id="M_mbcgs"/><c><![CDATA[+M<S>mbcgs <ratio>]]></c></tag>
<item>
(<c>mseg_alloc</c>) multiblock carrier growth stages. See
<seealso marker="#mseg_mbc_sizes">the description on how sizes for
mseg_alloc multiblock carriers are decided</seealso>
in "the <c>alloc_util</c> framework" section.</item>
- <tag><marker id="M_mbsd"><c><![CDATA[+M<S>mbsd <depth>]]></c></marker></tag>
+ <tag><marker id="M_mbsd"/><c><![CDATA[+M<S>mbsd <depth>]]></c></tag>
<item>
Max block search depth. This flag has effect only if the
good fit strategy has been selected for allocator
@@ -464,40 +464,40 @@
search depth sets a limit on the maximum number of blocks to
inspect in a free list during a search for suitable block
satisfying the request.</item>
- <tag><marker id="M_mmbcs"><c><![CDATA[+M<S>mmbcs <size>]]></c></marker></tag>
+ <tag><marker id="M_mmbcs"/><c><![CDATA[+M<S>mmbcs <size>]]></c></tag>
<item>
Main multiblock carrier size. Sets the size of the main
multiblock carrier for allocator <c><![CDATA[<S>]]></c>. The main
multiblock carrier is allocated via <c><![CDATA[sys_alloc]]></c> and is
never deallocated.</item>
- <tag><marker id="M_mmmbc"><c><![CDATA[+M<S>mmmbc <amount>]]></c></marker></tag>
+ <tag><marker id="M_mmmbc"/><c><![CDATA[+M<S>mmmbc <amount>]]></c></tag>
<item>
Max <c>mseg_alloc</c> multiblock carriers. Maximum number of
multiblock carriers allocated via <c>mseg_alloc</c> by
allocator <c><![CDATA[<S>]]></c>. When this limit has been reached,
new multiblock carriers will be allocated via
<c>sys_alloc</c>.</item>
- <tag><marker id="M_mmsbc"><c><![CDATA[+M<S>mmsbc <amount>]]></c></marker></tag>
+ <tag><marker id="M_mmsbc"/><c><![CDATA[+M<S>mmsbc <amount>]]></c></tag>
<item>
Max <c>mseg_alloc</c> singleblock carriers. Maximum number of
singleblock carriers allocated via <c>mseg_alloc</c> by
allocator <c><![CDATA[<S>]]></c>. When this limit has been reached,
new singleblock carriers will be allocated via
<c>sys_alloc</c>.</item>
- <tag><marker id="M_ramv"><c><![CDATA[+M<S>ramv <bool>]]></c></marker></tag>
+ <tag><marker id="M_ramv"/><c><![CDATA[+M<S>ramv <bool>]]></c></tag>
<item>
Realloc always moves. When enabled, reallocate operations will
more or less be translated into an allocate, copy, free sequence.
This often reduce memory fragmentation, but costs performance.
</item>
- <tag><marker id="M_rmbcmt"><c><![CDATA[+M<S>rmbcmt <ratio>]]></c></marker></tag>
+ <tag><marker id="M_rmbcmt"/><c><![CDATA[+M<S>rmbcmt <ratio>]]></c></tag>
<item>
Relative multiblock carrier move threshold (in percent). When
a block located in a multiblock carrier is shrunk,
the block will be moved if the ratio of the size of the returned
memory compared to the previous size is more than this threshold;
otherwise, the block will be shrunk at current location.</item>
- <tag><marker id="M_rsbcmt"><c><![CDATA[+M<S>rsbcmt <ratio>]]></c></marker></tag>
+ <tag><marker id="M_rsbcmt"/><c><![CDATA[+M<S>rsbcmt <ratio>]]></c></tag>
<item>
Relative singleblock carrier move threshold (in percent). When
a block located in a singleblock carrier is shrunk to
@@ -506,7 +506,7 @@
the block will be left unchanged in the singleblock carrier if
the ratio of unused memory is less than this threshold;
otherwise, it will be moved into a multiblock carrier. </item>
- <tag><marker id="M_rsbcst"><c><![CDATA[+M<S>rsbcst <ratio>]]></c></marker></tag>
+ <tag><marker id="M_rsbcst"/><c><![CDATA[+M<S>rsbcst <ratio>]]></c></tag>
<item>
Relative singleblock carrier shrink threshold (in
percent). When a block located in an <c>mseg_alloc</c>
@@ -514,20 +514,20 @@
unchanged if the ratio of unused memory is less than this
threshold; otherwise, the carrier will be shrunk.
See also <seealso marker="#M_asbcst">asbcst</seealso>.</item>
- <tag><marker id="M_sbct"><c><![CDATA[+M<S>sbct <size>]]></c></marker></tag>
+ <tag><marker id="M_sbct"/><c><![CDATA[+M<S>sbct <size>]]></c></tag>
<item>
Singleblock carrier threshold. Blocks larger than this
threshold will be placed in singleblock carriers. Blocks
smaller than this threshold will be placed in multiblock
carriers. On 32-bit Unix style OS this threshold can not be set higher
than 8 megabytes.</item>
- <tag><marker id="M_smbcs"><c><![CDATA[+M<S>smbcs <size>]]></c></marker></tag>
+ <tag><marker id="M_smbcs"/><c><![CDATA[+M<S>smbcs <size>]]></c></tag>
<item>
Smallest (<c>mseg_alloc</c>) multiblock carrier size (in
kilobytes). See <seealso marker="#mseg_mbc_sizes">the description
on how sizes for mseg_alloc multiblock carriers are decided</seealso>
in "the <c>alloc_util</c> framework" section.</item>
- <tag><marker id="M_t"><c><![CDATA[+M<S>t true|false]]></c></marker></tag>
+ <tag><marker id="M_t"/><c><![CDATA[+M<S>t true|false]]></c></tag>
<item>
<p>Multiple, thread specific instances of the allocator.
This option will only have any effect on the runtime system
@@ -544,20 +544,20 @@
<c>alloc_util</c>, i.e. all allocators based on <c>alloc_util</c>
will be effected:</p>
<taglist>
- <tag><marker id="Muycs"><c><![CDATA[+Muycs <size>]]></c></marker></tag>
+ <tag><marker id="Muycs"/><c><![CDATA[+Muycs <size>]]></c></tag>
<item>
<c>sys_alloc</c> carrier size. Carriers allocated via
<c>sys_alloc</c> will be allocated in sizes which are
multiples of the <c>sys_alloc</c> carrier size. This is not
true for main multiblock carriers and carriers allocated
during a memory shortage, though.</item>
- <tag><marker id="Mummc"><c><![CDATA[+Mummc <amount>]]></c></marker></tag>
+ <tag><marker id="Mummc"/><c><![CDATA[+Mummc <amount>]]></c></tag>
<item>
Max <c>mseg_alloc</c> carriers. Maximum number of carriers
placed in separate memory segments. When this limit has been
reached, new carriers will be placed in memory retrieved from
<c>sys_alloc</c>.</item>
- <tag><marker id="Musac"><c><![CDATA[+Musac <bool>]]></c></marker></tag>
+ <tag><marker id="Musac"/><c><![CDATA[+Musac <bool>]]></c></tag>
<item>
Allow <c>sys_alloc</c> carriers. By default <c>true</c>. If
set to <c>false</c>, <c>sys_alloc</c> carriers will never be
@@ -565,19 +565,19 @@
</taglist>
<p>Instrumentation flags:</p>
<taglist>
- <tag><marker id="Mim"><c>+Mim true|false</c></marker></tag>
+ <tag><marker id="Mim"/><c>+Mim true|false</c></tag>
<item>
A map over current allocations is kept by the emulator. The
allocation map can be retrieved via the <c>instrument</c>
module. <c>+Mim true</c> implies <c>+Mis true</c>.
<c>+Mim true</c> is the same as
<seealso marker="erl#instr">-instr</seealso>.</item>
- <tag><marker id="Mis"><c>+Mis true|false</c></marker></tag>
+ <tag><marker id="Mis"/><c>+Mis true|false</c></tag>
<item>
Status over allocated memory is kept by the emulator. The
allocation status can be retrieved via the <c>instrument</c>
module.</item>
- <tag><marker id="Mit"><c>+Mit X</c></marker></tag>
+ <tag><marker id="Mit"/><c>+Mit X</c></tag>
<item>
Reserved for future use. Do <em>not</em> use this flag.</item>
</taglist>
@@ -587,7 +587,7 @@
</note>
<p>Other flags:</p>
<taglist>
- <tag><marker id="Mea"><c>+Mea min|max|r9c|r10b|r11b|config</c></marker></tag>
+ <tag><marker id="Mea"/><c>+Mea min|max|r9c|r10b|r11b|config</c></tag>
<item>
<taglist>
<tag><c>min</c></tag>
@@ -617,7 +617,7 @@
</item>
</taglist>
</item>
- <tag><marker id="Mlpm"><c>+Mlpm all|no</c></marker></tag>
+ <tag><marker id="Mlpm"/><c>+Mlpm all|no</c></tag>
<item>Lock physical memory. The default value is <c>no</c>, i.e.,
no physical memory will be locked. If set to <c>all</c>, all
memory mappings made by the runtime system, will be locked into
diff --git a/erts/doc/src/escript.xml b/erts/doc/src/escript.xml
index 46110333f9..f12f76890c 100644
--- a/erts/doc/src/escript.xml
+++ b/erts/doc/src/escript.xml
@@ -4,7 +4,7 @@
<comref>
<header>
<copyright>
- <year>2007</year><year>2014</year>
+ <year>2007</year><year>2015</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -96,8 +96,8 @@ $ <input>escript factorial 5</input> </pre>
<note><p>
The encoding specified by the above mentioned comment
applies to the script itself. The encoding of the
- I/O-server, however, has to be set explicitly like this:
-<code>io:setopts([{encoding, unicode}])</code></p>
+ I/O-server, however, has to be set explicitly like this:</p>
+<code>io:setopts([{encoding, unicode}])</code>
<p>The default encoding of the I/O-server for <c>standard_io</c>
is <c>latin1</c>
since the script runs in a non-interactive terminal
diff --git a/erts/doc/src/notes.xml b/erts/doc/src/notes.xml
index bed1ac463d..f27e73b9d3 100644
--- a/erts/doc/src/notes.xml
+++ b/erts/doc/src/notes.xml
@@ -4,7 +4,7 @@
<chapter>
<header>
<copyright>
- <year>2004</year><year>2013</year>
+ <year>2004</year><year>2015</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -31,6 +31,129 @@
</header>
<p>This document describes the changes made to the ERTS application.</p>
+<section><title>Erts 7.1</title>
+
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p>
+ Fix bug in ETS that could cause stray objects marked for
+ deletion to occasionally be missed by the cleanup done by
+ <c>safe_fixtable(_,false)</c>.</p>
+ <p>
+ Own Id: OTP-12870</p>
+ </item>
+ <item>
+ <p>
+ Fixed VM crash that could occur if a trace port was
+ linked to a process, and the trace port terminated
+ abnormally while handling a trace message. This bug has
+ always existed in the runtime system with SMP support.</p>
+ <p>
+ Own Id: OTP-12901</p>
+ </item>
+ <item>
+ <p>
+ Instead of aborting, the vm now creates a crash dump when
+ a system process is terminated.</p>
+ <p>
+ Own Id: OTP-12934</p>
+ </item>
+ <item>
+ <p>
+ Fixed a rare emulator dead lock that occurred when
+ erlang:process_flag(priority,...) was called by a process
+ that was also scheduled for an internal system activity.</p>
+ <p>
+ Own Id: OTP-12943</p>
+ </item>
+ <item>
+ <p>
+ The runtime system on various posix platforms (except for
+ Linux and Solaris) could crash when large amounts of
+ file-descriptors were in use.</p>
+ <p>
+ Own Id: OTP-12954</p>
+ </item>
+ <item>
+ <p>
+ A beam file compiled by hipe for an incompatible runtime
+ system was sometimes not rejected by the loader, which
+ could lead to vm crash. This fix will also allow the same
+ hipe compiler to be used by both normal and debug-built
+ vm.</p>
+ <p>
+ Own Id: OTP-12962</p>
+ </item>
+ <item>
+ <p>
+ Fix bug in <c>maps:merge/2</c> when called by hipe
+ compiled code that could cause vm crash. Bug exists since
+ erts-7.0 (OTP 18.0).</p>
+ <p>
+ Own Id: OTP-12965</p>
+ </item>
+ <item>
+ <p>
+ When tracing with <c>process_dump</c> option, the VM
+ could abort if there was an ongoing binary match
+ somewhere in the call stack of the traced process.</p>
+ <p>
+ Own Id: OTP-12968</p>
+ </item>
+ <item>
+ <p>
+ Fixed possible output deadlock in tty driver when hitting
+ "CTRL-C" in a non-smp emulator shell on unix.</p>
+ <p>
+ Own Id: OTP-12987 Aux Id: Seq12947 </p>
+ </item>
+ <item>
+ <p>
+ Fix <c>binary_to_integer</c> to throw badarg for "+" and
+ "-" similar to <c>list_to_integer</c>.</p>
+ <p>
+ Own Id: OTP-12988</p>
+ </item>
+ <item>
+ <p>
+ Suppress warning of unused argument when using macro
+ enif_make_pid.</p>
+ <p>
+ Own Id: OTP-12989</p>
+ </item>
+ </list>
+ </section>
+
+
+ <section><title>Improvements and New Features</title>
+ <list>
+ <item>
+ <p>
+ Changed default clock source used for OS system time on
+ MacOS X to <c>gettimeofday()</c> in order to improve
+ performance. The system can be configured during build to
+ use the previously used higher resolution clock source by
+ passing the switch <seealso
+ marker="doc/installation_guide:INSTALL#Advanced-configuration-and-build-of-ErlangOTP_Configuring"><c>--with-clock-resolution=high</c></seealso>
+ when configuring the build.</p>
+ <p>
+ Own Id: OTP-12945 Aux Id: OTP-12892 </p>
+ </item>
+ <item>
+ <p>
+ Added the <c>configure</c> option <seealso
+ marker="doc/installation_guide:INSTALL#Advanced-configuration-and-build-of-ErlangOTP_Configuring"><c>--disable-saved-compile-time</c></seealso>
+ which disables saving of compile date and time in the
+ emulator binary.</p>
+ <p>
+ Own Id: OTP-12971</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
<section><title>Erts 7.0.3</title>
<section><title>Fixed Bugs and Malfunctions</title>
@@ -49,6 +172,14 @@
<p>
Own Id: OTP-12942</p>
</item>
+ <item>
+ <p>
+ When tracing with <c>process_dump</c> option, the VM
+ could abort if there was an ongoing binary match
+ somewhere in the call stack of the traced process./</p>
+ <p>
+ Own Id: OTP-12968</p>
+ </item>
</list>
</section>
@@ -577,19 +708,20 @@
</item>
<item>
<p>
- Use persistent hashmaps for large Maps <p>Maps will use a
+ Use persistent hashmaps for large Maps</p>
+ <p>Maps will use a
persistent hashmap implementation when the number of
pairs in a Map becomes sufficiently large. The change
will occur when a Map reaches 33 pairs in size but this
- limit might change in the future.</p></p>
- <p>The most significant impact for the user by this
+ limit might change in the future.</p>
+ <p>The most significant impact for the user by this
change is speed, and to a lesser degree memory
consumption and introspection of Maps. Memory consumption
size is probalistic but lesser than <c>gb_trees</c> or
<c>dict</c> for instance. Any other impacts will be
transparent for the user except for the following
changes.</p>
- <p>Semantics of Maps have changed in two incompatible
+ <p>Semantics of Maps have changed in two incompatible
ways compared to the experimental implementation in OTP
17:</p> <list> <item>Hashing of maps is done different by
<c>erlang:phash2/1,2</c>, <c>erlang:phash/1</c> and
@@ -1237,7 +1369,7 @@
<p>
Improved support for atomic memory operations provided by
the <url
- href="https://github.com/ivmai/libatomic_ops/"><c>libatomic_ops</c></url>
+ href="https://github.com/ivmai/libatomic_ops/">libatomic_ops</url>
library. Most importantly support for use of native
double word atomics when implemented by
<c>libatomic_ops</c> (for example, implemented for ARM).</p>
@@ -2204,22 +2336,28 @@
<p>
EEP43: New data type - Maps</p>
<p>
- With Maps you may for instance: <taglist> <item><c>M0 =
- #{ a =&gt; 1, b =&gt; 2}, % create
- associations</c></item> <item><c>M1 = M0#{ a := 10 }, %
- update values</c></item> <item><c>M2 = M1#{ "hi" =&gt;
- "hello"}, % add new associations</c></item> <item><c>#{
- "hi" := V1, a := V2, b := V3} = M2. % match keys with
- values</c></item> </taglist></p>
+ With Maps you may for instance:</p>
+ <taglist>
+ <tag/> <item><c>M0 = #{ a =&gt; 1, b =&gt; 2}, % create
+ associations</c></item>
+ <tag/><item><c>M1 = M0#{ a := 10 }, % update values</c></item>
+ <tag/><item><c>M2 = M1#{ "hi" =&gt;
+ "hello"}, % add new associations</c></item>
+ <tag/><item><c>#{ "hi" := V1, a := V2, b := V3} = M2.
+ % match keys with values</c></item>
+ </taglist>
<p>
For information on how to use Maps please see Map Expressions in the
<seealso marker="doc/reference_manual:expressions#map_expressions">
Reference Manual</seealso>.</p>
<p>
The current implementation is without the following
- features: <taglist> <item>No variable keys</item>
- <item>No single value access</item> <item>No map
- comprehensions</item> </taglist></p>
+ features:</p>
+ <taglist>
+ <tag/><item>No variable keys</item>
+ <tag/><item>No single value access</item>
+ <tag/><item>No map comprehensions</item>
+ </taglist>
<p>
Note that Maps is <em>experimental</em> during OTP 17.0.</p>
<p>
@@ -4379,8 +4517,7 @@
<p>
Fix erl_prim_loader errors in handling of primary
archive. The following errors have been corrected:</p>
- <p>
- <list> <item> If primary archive was named "xxx", then a
+ <list> <item> If primary archive was named "xxx", then a
file in the same directory named "xxxyyy" would be
interpreted as a file named "yyy" inside the archive.
</item> <item> erl_prim_loader did not correctly create
@@ -4395,7 +4532,8 @@
erl_prim_loader:list_dir/1 would sometimes return an
empty string inside the file list. This was a virtual
element representing the top directory of the archive.
- This has been removed. </item> </list></p>
+ This has been removed. </item>
+ </list>
<p>
Thanks to Tuncer Ayaz and Shunichi Shinohara for
reporting and co-authoring corrections.</p>
@@ -6838,12 +6976,12 @@
Own Id: OTP-8726 Aux Id: seq11617 </p>
</item>
<item>
- <p>Fix libm linking with --as-needed flag
+ <p>Fix libm linking with --as-needed flag</p>
<p>
When building with "--as-needed" linker flags on Linux
the build will fail. This has now been fixed.</p>
<p>
- (Thanks to Christian Faulhammer)</p></p>
+ (Thanks to Christian Faulhammer)</p>
<p>
Own Id: OTP-8728</p>
</item>
diff --git a/erts/doc/src/run_erl.xml b/erts/doc/src/run_erl.xml
index 0a5b2c6136..faec3c68c1 100644
--- a/erts/doc/src/run_erl.xml
+++ b/erts/doc/src/run_erl.xml
@@ -59,7 +59,7 @@
first argument to run_erl on the command line.</item>
<tag>pipe_dir</tag>
<item>This is where to put the named pipe, usually
- <c><![CDATA[/tmp/]]></c> on Unix or <c><![CDATA[/pipe/]]></c> on OSE. It shall be suffixed by a <c><![CDATA[/]]></c> (slash),
+ <c><![CDATA[/tmp/]]></c>. It shall be suffixed by a <c><![CDATA[/]]></c> (slash),
i.e. not <c><![CDATA[/tmp/epipies]]></c>, but <c><![CDATA[/tmp/epipes/]]></c>. </item>
<tag>log_dir</tag>
<item>This is where the log files are written. There will be one
diff --git a/erts/doc/src/time_correction.xml b/erts/doc/src/time_correction.xml
index aed38fbb92..236fe679cb 100644
--- a/erts/doc/src/time_correction.xml
+++ b/erts/doc/src/time_correction.xml
@@ -4,7 +4,7 @@
<chapter>
<header>
<copyright>
- <year>1999</year><year>2014</year>
+ <year>1999</year><year>2015</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -35,31 +35,35 @@
<section>
<title>New Extended Time Functionality</title>
- <note><p>As of OTP 18 (ERTS version 7.0) the time functionality of
- Erlang has been extended. This both includes a
+ <note><p>As of OTP 18 (<c>ERTS</c> version 7.0) the time functionality of
+ Erlang has been extended. This includes a
<seealso marker="#The_New_Time_API">new API</seealso>
- for time, as well as
+ for time and
<seealso marker="#Time_Warp_Modes">time warp
- modes</seealso> which alters the behavior of the system when
+ modes</seealso> that alter the system behavior when
system time changes.</p>
+
<p>The <seealso marker="#No_Time_Warp_Mode">default
time warp mode</seealso> has the same behavior as before, and the
- old API will still work, so you are not required to change
+ old API still works. Thus, you are not required to change
anything unless you want to. However, <em>you are strongly
encouraged to use the new API</em> instead of the old API based
on <seealso marker="erlang#now/0"><c>erlang:now/0</c></seealso>.
- <c>erlang:now/0</c> has been deprecated since it is and forever
- will be a scalability bottleneck. By using the new API you will
+ <c>erlang:now/0</c> is deprecated, as it is and
+ will be a scalability bottleneck.</p>
+
+ <p>By using the new API, you
automatically get scalability and performance improvements. This
- will also enable you to use the
- <seealso marker="#Multi_Time_Warp_Mode">multi time warp mode</seealso>
- which improves accuracy, and precision of time measurements.</p></note>
+ also enables you to use the
+ <seealso marker="#Multi_Time_Warp_Mode">multi-time warp mode</seealso>
+ that improves accuracy and precision of time measurements.</p>
+ </note>
</section>
<section>
- <title>Some Terminology</title>
- <p>In order to make it easier to understand this document we first
- define some terminology. This is a mixture of our own terminology
+ <title>Terminology</title>
+ <p>To make it easier to understand this section, some terms
+ are defined. This is a mix of our own terminology
(Erlang/OS system time, Erlang/OS monotonic time, time warp)
and globally accepted terminology.</p>
@@ -67,7 +71,7 @@
<section>
<title>Monotonically Increasing</title>
<p>In a monotonically increasing sequence of values, all values
- that have a predecessor are either larger than, or equal to its
+ that have a predecessor are either larger than or equal to its
predecessor.</p>
</section>
@@ -82,19 +86,19 @@
<marker id="UT1"/>
<section>
<title>UT1</title>
- <p>Universal Time. Based on the rotation of the earth. Conceptually
- mean solar time at 0° longitude.</p>
+ <p>Universal Time. UT1 is based on the rotation of the earth
+ and conceptually means solar time at 0° longitude.</p>
</section>
<marker id="UTC"/>
<section>
<title>UTC</title>
- <p>Coordinated Universal Time. UTC almost align with
- <seealso marker="#UT1">UT1</seealso>, however, UTC uses the
- SI definition of a second which is not exactly of the same length
+ <p>Coordinated Universal Time. UTC almost aligns with
+ <seealso marker="#UT1">UT1</seealso>. However, UTC uses the
+ SI definition of a second, which has not exactly the same length
as the second used by UT1. This means that UTC slowly drifts from
- UT1. In order to keep UTC relatively in sync with UT1, leap seconds
- are inserted, and potentially also deleted. That is, an UTC day may
+ UT1. To keep UTC relatively in sync with UT1, leap seconds
+ are inserted, and potentially also deleted. That is, an UTC day can
be 86400, 86401, or 86399 seconds long.</p>
</section>
@@ -104,14 +108,15 @@
<p>Time since
<url href="http://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap03.html#tag_21_03_00_17">Epoch</url>.
Epoch is defined to be 00:00:00 <seealso marker="#UTC">UTC</seealso>,
- January 1, 1970.
+ 1970-01-01.
<url href="http://pubs.opengroup.org/onlinepubs/009604499/basedefs/xbd_chap04.html#tag_04_14">A day in POSIX time</url>
is defined to be exactly 86400 seconds long. Strangely enough
- Epoch is defined to be a time in UTC, and UTC have another
+ Epoch is defined to be a time in UTC, and UTC has another
definition of how long a day is. Quoting the Open Group
- <url href="http://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_15">"POSIX time is therefore not necessarily UTC, despite its appearance"</url>. The effect of this is that when an UTC leap second is
+ <url href="http://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_15">"POSIX time is therefore not necessarily UTC, despite its appearance"</url>.
+ The effect of this is that when an UTC leap second is
inserted, POSIX time either stops for a second, or repeats the
- last second. If an UTC leap second would be deleted (has never
+ last second. If an UTC leap second would be deleted (which has not
happened yet), POSIX time would make a one second leap forward.</p>
</section>
@@ -125,11 +130,11 @@
<marker id="Time_Precision"/>
<section>
<title>Time Precision</title>
- <p>The shortest time interval that can be be distinguished
+ <p>The shortest time interval that can be distinguished
repeatedly and reliably when reading time values. Precision
is limited by the
<seealso marker="#Time_Resolution">resolution</seealso>, but
- resolution and precision might differ significantly.</p>
+ resolution and precision can differ significantly.</p>
</section>
<marker id="Time_Accuracy"/>
@@ -143,21 +148,23 @@
<title>Time Warp</title>
<p>A time warp is a leap forwards or backwards in time. That
is, the difference of time values taken before and after the
- time warp will not correspond to the actual elapsed time.</p>
+ time warp does not correspond to the actual elapsed time.</p>
</section>
<marker id="OS_System_Time"/>
<section>
<title>OS System Time</title>
<p>The operating systems view of
- <seealso marker="#POSIX_Time">POSIX time</seealso>. It can be
- retrieved by calling
+ <seealso marker="#POSIX_Time">POSIX time</seealso>. To
+ retrieve it, call
<seealso marker="kernel:os#system_time/0"><c>os:system_time()</c></seealso>.
This may or may not be an accurate view of POSIX time. This time
may typically be adjusted both backwards and forwards without
limitation. That is, <seealso marker="#Time_Warp">time warps</seealso>
- may be observed. You can get information about the Erlang runtime
- system's source of OS system time by calling
+ may be observed.</p>
+
+ <p>To get information about the Erlang runtime
+ system's source of OS system time, call
<seealso marker="erlang#system_info_os_system_time_source"><c>erlang:system_info(os_system_time_source)</c></seealso>.</p>
</section>
@@ -165,15 +172,17 @@
<section>
<title>OS Monotonic Time</title>
<p>A monotonically increasing time provided by the operating
- system. This time does not leap and have a relatively steady
+ system. This time does not leap and has a relatively steady
frequency although not completely correct. However, it is not
- uncommon that the OS monotonic time stops if the system is
- suspended. This time typically increase since some
+ uncommon that OS monotonic time stops if the system is
+ suspended. This time typically increases since some
unspecified point in time that is not connected to
- <seealso marker="#OS_System_Time">OS system time</seealso>. Note
- that this type of time is not necessarily provided by all
- operating systems. You can get information about the Erlang
- runtime system's source of OS monotonic time by calling
+ <seealso marker="#OS_System_Time">OS system time</seealso>.
+ This type of time is not necessarily provided by all
+ operating systems.</p>
+
+ <p>To get information about the Erlang
+ runtime system's source of OS monotonic time, call
<seealso marker="erlang#system_info_os_monotonic_time_source"><c>erlang:system_info(os_monotonic_time_source)</c></seealso>.</p>
</section>
@@ -181,14 +190,17 @@
<section>
<title>Erlang System Time</title>
<p>The Erlang runtime systems view of
- <seealso marker="#POSIX_Time">POSIX time</seealso>. It can be
- retrieved by calling
- <seealso marker="erlang#system_time/0"><c>erlang:system_time()</c></seealso>.
- This time may or may not be an accurate view of POSIX time, and may
+ <seealso marker="#POSIX_Time">POSIX time</seealso>. To
+ retrieve it, call
+ <seealso marker="erlang#system_time/0"><c>erlang:system_time()</c></seealso>.</p>
+
+ <p>This time may or may not be an accurate view of POSIX time,
+ and may
or may not align with <seealso marker="#OS_System_Time">OS system
time</seealso>. The runtime system works towards aligning the two
- system times. Depending on <seealso marker="#Time_Warp_Modes">time
- warp mode</seealso> used, this may be achieved by letting the Erlang
+ system times. Depending on the
+ <seealso marker="#Time_Warp_Modes">time warp mode</seealso> used,
+ this can be achieved by letting Erlang
system time perform a <seealso marker="#Time_Warp">time
warp</seealso>.</p>
</section>
@@ -197,35 +209,43 @@
<section>
<title>Erlang Monotonic Time</title>
<p>A monotonically increasing time provided by the
- Erlang runtime system. The Erlang monotonic time increase since
- some unspecified point in time. It can be retrieved by calling
+ Erlang runtime system. Erlang monotonic time increases since
+ some unspecified point in time. To retrieve it, call
<seealso marker="erlang#monotonic_time/0"><c>erlang:monotonic_time()</c></seealso>.
- The
- <seealso marker="#Time_Accuracy">accuracy</seealso>, and
+ </p>
+
+ <p>The <seealso marker="#Time_Accuracy">accuracy</seealso> and
<seealso marker="#Time_Precision">precision</seealso> of Erlang
- monotonic time heavily depends on the accuracy and precision of
- <seealso marker="#OS_Monotonic_Time">OS monotonic time</seealso>,
- the accuracy and precision of
- <seealso marker="#OS_System_Time">OS system time</seealso> as well
- as on the
- <seealso marker="#Time_Warp_Modes">time warp mode</seealso>
- used. On a system that is lacking OS monotonic time, the Erlang
- monotonic time can only guarantee monotonicity and can more or less
- not give any other guarantees. The frequency adjustments made to
- the Erlang monotonic time depends on the time warp mode
- used.</p>
-
- <p>Internally in the runtime system the Erlang monotonic
+ monotonic time heavily depends on the following:</p>
+
+ <list type="bulleted">
+ <item>Accuracy and precision of
+ <seealso marker="#OS_Monotonic_Time">OS monotonic time</seealso>
+ </item>
+ <item>Accuracy and precision of
+ <seealso marker="#OS_System_Time">OS system time</seealso>
+ </item>
+ <item><seealso marker="#Time_Warp_Modes">time warp mode</seealso> used
+ </item>
+ </list>
+
+ <p>On a system without OS monotonic time, Erlang monotonic
+ time guarantees monotonicity, but cannot give
+ other guarantees. The frequency adjustments made to
+ Erlang monotonic time depend on the time warp mode used.</p>
+
+ <p>Internally in the runtime system, Erlang monotonic
time is the "time engine" that is used for more or less
- everything that has anything to do with time. All timers
+ everything that has anything to do with time. All timers,
regardless of it is a <c>receive ... after</c> timer, BIF timer,
- or a timer in the <c>timer</c> module are triggered
+ or a timer in the <c>timer</c> module, are triggered
relative Erlang monotonic time. Even
<seealso marker="#Erlang_System_Time">Erlang system
time</seealso> is based on Erlang monotonic time.
By adding current Erlang monotonic time with current time
- offset you get current Erlang system time. Current time
- offset can be retrieved by calling
+ offset, you get current Erlang system time.</p>
+
+ <p>To retrieve current time offset, call
<seealso marker="erlang#time_offset/0"><c>erlang:time_offset/0</c></seealso>.
</p>
</section>
@@ -234,176 +254,169 @@
<section>
<title>Introduction</title>
-
<p>Time is vital to an Erlang program and, more importantly, <em>correct</em>
time is vital to an Erlang program. As Erlang is a language with
- soft real time properties and we have the possibility to express
- time in our programs, the Virtual Machine and the language has to be
- very careful about what is considered a correct point in time and in
+ soft real-time properties and we can express
+ time in our programs, the Virtual Machine and the language must be
+ careful about what is considered a correct time and in
how time functions behave.</p>
- <p>In the beginning, Erlang was constructed assuming that the wall
+ <p>When Erlang was designed, it was assumed that the wall
clock time in the system showed a monotonic time moving forward at
- exactly the same pace as the definition of time. That more or less
- meant that an atomic clock (or better) was expected to be attached
+ exactly the same pace as the definition of time. This more or less meant
+ that an atomic clock (or better time source) was expected to be attached
to your hardware and that the hardware was then expected to be
- locked away from any human (or unearthly) tinkering for all
- eternity. While this might be a compelling thought, it's simply
- never the case.</p>
-
- <p>A "normal" modern computer can not keep time. Not on itself and
- not unless you actually have a chip level atomic clock wired to
- it. Time, as perceived by your computer, will normally need to be
- corrected. Hence the NTP protocol that together with the ntpd
- process will do it's best to keep your computers time in sync with
- the "real" time in the universe. Between NTP corrections, usually a
+ locked away from any human tinkering forever. While this can be a
+ compelling thought, it is simply never the case.</p>
+
+ <p>A "normal" modern computer cannot keep time, not on itself and
+ not unless you have a chip-level atomic clock wired to it. Time,
+ as perceived by your computer, must normally be corrected. Hence
+ the Network Time Protocol (NTP) protocol, together with the <c>ntpd</c>
+ process, does its best to keep your computer time in sync with
+ the correct time. Between NTP corrections, usually a
less potent time-keeper than an atomic clock is used.</p>
- <p>But NTP is not fail safe. The NTP server can be unavailable, the
- ntp.conf can be wrongly configured or your computer may from time to
- time be disconnected from the internet. Furthermore you can have a
- user (or even system administrator) on your system that thinks the
- right way to handle daylight saving time is to adjust the clock one
- hour two times a year (a tip, that is not the right way to do
- it...). To further complicate things, this user fetched your
- software from the internet and has never ever thought about what's
- the correct time as perceived by a computer. The user simply does
- not care about keeping the wall clock in sync with the rest of the
- universe. The user expects your program to have omnipotent knowledge
+ <p>However, NTP is not fail-safe. The NTP server can be unavailable,
+ <c>ntp.conf</c> can be wrongly configured, or your computer may
+ sometimes be disconnected from Internet. Furthermore, you can have a
+ user (or even system administrator) who thinks the correct
+ way to handle Daylight Saving Time is to adjust the clock one
+ hour two times a year (which is the incorrect way to do it).
+ To complicate things further, this user fetched your
+ software from Internet and has not considered what
+ the correct time is as perceived by a computer. The user does
+ not care about keeping the wall clock in sync with the correct
+ time. The user expects your program to have unlimited knowledge
about the time.</p>
<p>Most programmers also expect time to be reliable, at least until
- they realize that the wall clock time on their workstation is of by
- a minute. Then they simply set it to the correct time, maybe or
- maybe not in a smooth way. Most probably not in a smooth way.</p>
+ they realize that the wall clock time on their workstation is off by
+ a minute. Then they set it to the correct time, but most probably
+ not in a smooth way.</p>
- <p>The amount of problems that arise when you expect the wall clock
- time on the system to always be correct may be immense. Therefore Erlang
+ <p>The number of problems that arise when you always expect the wall clock
+ time on the system to be correct can be immense. Erlang therefore
introduced the "corrected estimate of time", or the "time
- correction" many years ago. The time correction relies on the fact
+ correction", many years ago. The time correction relies on the fact
that most operating systems have some kind of monotonic clock,
- either a real time extension or some built in "tick counter" that is
- independent of the wall clock settings. This counter may have
- microsecond resolution or much less, but generally it has a drift
- that is not to be ignored.</p>
-
+ either a real-time extension or some built-in "tick counter" that is
+ independent of the wall clock settings. This counter can have
+ microsecond resolution or much less, but it has a drift that cannot
+ be ignored.</p>
</section>
- <marker id="Time_Correction"/>
<section>
+ <marker id="Time_Correction"/>
<title>Time Correction</title>
<p>If time correction is enabled, the Erlang runtime system
- will make use of both
+ makes use of both
<seealso marker="#OS_System_Time">OS system time</seealso>
and <seealso marker="#OS_Monotonic_Time">OS monotonic time</seealso>,
- in order to make adjustments of the frequency of the Erlang
- monotonic clock. Time correction will ensure that
+ to adjust the frequency of the Erlang
+ monotonic clock. Time correction ensures that
<seealso marker="#Erlang_Monotonic_Time">Erlang monotonic time</seealso>
- will not warp, and that the frequency is relatively accurate.
- The type of adjustments made to the frequency depends on the
- time warp mode used. This will be discussed in more details in
- the <seealso marker="#Time_Warp_Modes">time warp modes</seealso>
- section below.</p>
-
- <p>By default time correction will be enabled if support for
- it on the specific platform exist. Support for it includes
- both an OS monotonic time provided by the OS, and an
- implementation in the Erlang runtime system utilizing the
- OS monotonic time. You can check if your system has support
- for OS monotonic time by calling
- <seealso marker="erlang#system_info_os_monotonic_time_source"><c>erlang:system_info(os_monotonic_time_source)</c></seealso>,
- and you can check if time correction is enabled on your
- system by calling
+ does not warp and that the frequency is relatively accurate.
+ The type of frequency adjustments depends on the time warp mode used.
+ Section <seealso marker="#Time_Warp_Modes">Time Warp Modes</seealso>
+ provides more details.</p>
+
+ <p>By default time correction is enabled if support for
+ it exists on the specific platform. Support for it includes
+ both OS monotonic time, provided by the OS, and an
+ implementation in the Erlang runtime system using
+ OS monotonic time. To check if your system has support
+ for OS monotonic time, call
+ <seealso marker="erlang#system_info_os_monotonic_time_source"><c>erlang:system_info(os_monotonic_time_source)</c></seealso>.
+ To check if time correction is enabled on your system, call
<seealso marker="erlang#system_info_time_correction"><c>erlang:system_info(time_correction)</c></seealso>.</p>
- <p>Time correction is enabled or disabled by passing the
+ <p>To enable or disable time correction, pass command-line argument
<seealso marker="erl#+c"><c>+c [true|false]</c></seealso>
- command line argument to <c>erl</c>.</p>
+ to <c>erl</c>.</p>
<p>If time correction is disabled, Erlang monotonic time
- may warp forwards, it may stop and even freeze for extended
- periods of time, and there are no guarantees that the frequency
+ may warp forwards or stop, or even freeze for extended
+ periods of time. There are then no guarantees that the frequency
of the Erlang monotonic clock is accurate or stable.</p>
<p><em>You typically never want to disable time correction</em>.
- Previously there was a performance penalty associated with time
- correction, but nowadays it is most often the other way around.
- By disabling time correction you are likely to get bad scalability,
+ Previously a performance penalty was associated with time
+ correction, but nowadays it is usually the other way around.
+ If time correction is disabled, you probably get bad scalability,
bad performance, and bad time measurements.</p>
</section>
-
- <marker id="Time_Warp_Safe_Code"/>
<section>
+ <marker id="Time_Warp_Safe_Code"/>
<title>Time Warp Safe Code</title>
- <p>Time warp safe code is code that is able to handle
+ <p>Time warp safe code can handle
a <seealso marker="#Time_Warp">time warp</seealso> of
- <seealso marker="#Erlang_System_Time">Erlang system time</seealso>.
- </p>
+ <seealso marker="#Erlang_System_Time">Erlang system time</seealso>.</p>
<p><seealso marker="erlang#now/0"><c>erlang:now/0</c></seealso>
- behaves very bad when Erlang system time warps. When Erlang
- system time do a time warp backwards, the values returned
- from <c>erlang:now/0</c> will freeze (if you disregard the
- micro second increments made due to the actual call) until
- OS system time reach the point of the last value returned by
- <c>erlang:now/0</c>. This freeze might continue for very
- long periods of time. It might take years, decades,
- and even longer than this until the freeze stops.</p>
+ behaves bad when Erlang system time warps. When Erlang
+ system time does a time warp backwards, the values returned
+ from <c>erlang:now/0</c> freeze (if you disregard the
+ microsecond increments made because of the actual call) until
+ OS system time reaches the point of the last value returned by
+ <c>erlang:now/0</c>. This freeze can continue for a long time. It
+ can take years, decades, and even longer until the freeze stops.</p>
<p>All uses of <c>erlang:now/0</c> are not necessarily
time warp unsafe. If you do not use it to get time, it
- will be time warp safe. However <em>all uses of
+ is time warp safe. However, <em>all uses of
<c>erlang:now/0</c> are suboptimal</em> from a performance
and scalability perspective. So you really want to replace
- the usage of it with other functionality. For examples
- of how to replace the usage of <c>erlang:now/0</c>,
- see the <seealso marker="#Dos_and_Donts">Dos and Donts</seealso>
- section.</p>
+ the use of it with other functionality. For examples
+ of how to replace the use of <c>erlang:now/0</c>, see Section
+ <seealso marker="#Dos_and_Donts">How to Work with the New
+ API</seealso>.</p>
</section>
- <marker id="Time_Warp_Modes"/>
<section>
<title>Time Warp Modes</title>
-
+ <marker id="Time_Warp_Modes"/>
<p>Current <seealso marker="#Erlang_System_Time">Erlang system
time</seealso> is determined by adding current
<seealso marker="erlang#monotonic_time/0">Erlang monotonic time</seealso>
with current
<seealso marker="erlang#time_offset/0">time offset</seealso>. The
time offset is managed differently depending on which time
- warp mode you use. The time warp mode is set by passing the
+ warp mode you use.</p>
+
+ <p>To set the time warp mode, pass command-line argument
<seealso marker="erl#+C_"><c>+C
[no_time_warp|single_time_warp|multi_time_warp]</c></seealso>
- command line argument to <c>erl</c>.</p>
+ to <c>erl</c>.</p>
<marker id="No_Time_Warp_Mode"/>
<section>
<title>No Time Warp Mode</title>
<p>The time offset is determined at runtime system start
- and will after this not change. This is the default behavior.
- Not because it is the best mode (which it isn't). It is
+ and does not change later. This is the default behavior, but
+ not because it is the best mode (which it is not). It is
default <em>only</em> because this is how the runtime system
- always has behaved up until ERTS version 7.0, and you have to
- ensure that your Erlang code that may execute during a time
+ behaved until <c>ERTS</c> 7.0.
+ Ensure that your Erlang code that may execute during a time
warp is <seealso marker="#Time_Warp_Safe_Code">time warp
- safe</seealso> before you can enable other modes.</p>
+ safe</seealso> before enabling other modes.</p>
- <p>Since the time offset is not allowed to change, time
- correction needs to adjust the frequency of the Erlang
- monotonic clock in order to smoothly align Erlang system
- time with OS system time. A big downside of this approach
+ <p>As the time offset is not allowed to change, time
+ correction must adjust the frequency of the Erlang
+ monotonic clock to align Erlang system time with OS
+ system time smoothly. A significant downside of this approach
is that we on purpose will use a faulty frequency on the
Erlang monotonic clock if adjustments are needed. This
- error may be as big as 1%. This error will show up in all
+ error can be as large as 1%. This error will show up in all
time measurements in the runtime system.</p>
- <p>If time correction is not enabled, the Erlang monotonic
- time will freeze when the OS system time leap backwards.
- The freeze of the monotonic time will continue until
- OS system time catch up. The freeze may continue for
- a very long time. When OS system time leaps forwards,
- Erlang monotonic time will also leap forward.</p>
+ <p>If time correction is not enabled, Erlang monotonic
+ time freezes when OS system time leaps backwards.
+ The freeze of monotonic time continues until
+ OS system time catches up. The freeze can continue for
+ a long time. When OS system time leaps forwards,
+ Erlang monotonic time also leaps forward.</p>
</section>
<marker id="Single_Time_Warp_Mode"/>
@@ -411,26 +424,27 @@
<title>Single Time Warp Mode</title>
<p>This mode is more or less a backwards compatibility mode
as of its introduction.</p>
+
<p>On an embedded system it is not uncommon that the system
- has no power supply at all, not even a battery, when it is
- shut off. The system clock on such a system will typically
- be way off when the system boots. If the
+ has no power supply, not even a battery, when it is
+ shut off. The system clock on such a system is typically
+ way off when the system boots. If
<seealso marker="#No_Time_Warp_Mode">no time warp mode</seealso>
is used, and the Erlang runtime system is started before
- the OS system time has been corrected, the Erlang system
- time may be wrong for a very long time, even centuries or
- more.</p>
- <p>If you for some reason need to use Erlang code that
- is not
+ OS system time has been corrected, Erlang system time
+ can be wrong for a long time, centuries or even longer.</p>
+
+ <p>If you need to use Erlang code that is not
<seealso marker="#Time_Warp_Safe_Code">time warp safe</seealso>,
- and you need to start the Erlang runtime system before the OS
+ and you need to start the Erlang runtime system before OS
system time has been corrected, you may want to use the single
- time warp mode. Note that there are limitations to when you can
+ time warp mode.</p>
+
+ <note><p>There are limitations to when you can
execute time warp unsafe code using this mode. If it is possible
- to only utilize time warp safe code, it is <em>much</em> better
- to use the <seealso marker="#Multi_Time_Warp_Mode">multi time
- warp mode</seealso> instead.
- </p>
+ to use time warp safe code only, it is <em>much</em> better
+ to use the <seealso marker="#Multi_Time_Warp_Mode">multi-time
+ warp mode</seealso> instead.</p></note>
<p>Using the single time warp mode, the time offset is
handled in two phases:</p>
@@ -438,158 +452,150 @@
<taglist>
<tag>Preliminary Phase</tag>
<item>
- <p>The preliminary phase starts when the runtime
+ <p>This phase starts when the runtime
system starts. A preliminary time offset based on
- current OS system time is determined. This offset will
- from now on be fixed during the whole preliminary phase.</p>
+ current OS system time is determined. This offset is from
+ now on to be fixed during the whole preliminary phase.</p>
<p>If time correction is enabled, adjustments to the
- Erlang monotonic clock will be made to keep its
- frequency as correct as possible, but <em>no</em>
- adjustments will be made trying to align Erlang system
- time and OS system time. That is, during the preliminary
- Erlang system time and OS system time might diverge
- from each other, and no attempt to prevent this will
- be made.</p>
+ Erlang monotonic clock are made to keep its
+ frequency as correct as possible. However, <em>no</em>
+ adjustments are made trying to align Erlang system
+ time and OS system time. That is, during the preliminary phase
+ Erlang system time and OS system time can diverge
+ from each other, and no attempt is made to prevent this.</p>
<p>If time correction is disabled, changes in OS system
- time will effect the monotonic clock the same way as
+ time affects the monotonic clock the same way as
when the <seealso marker="#No_Time_Warp_Mode">no time warp
mode</seealso> is used.</p>
</item>
<tag>Final Phase</tag>
<item>
-
- <p>The final phase begin when the user finalize the time
+ <p>This phase begins when the user finalizes the time
offset by calling
<seealso marker="erlang#system_flag_time_offset"><c>erlang:system_flag(time_offset, finalize)</c></seealso>.
- The finalization can only be performed once.
- </p>
+ The finalization can only be performed once.</p>
<p>During finalization, the time offset is adjusted and
- fixated so that current Erlang system time align with
- current OS system time. Since the time offset may
- change during the finalization, the Erlang system time
- may do a time warp at this point. The time offset will
- from now on be fixed until the runtime system terminates.
+ fixated so that current Erlang system time aligns with
+ current OS system time. As the time offset can
+ change during the finalization, Erlang system time
+ can do a time warp at this point. The time offset is
+ from now on fixed until the runtime system terminates.
If time correction has been enabled, the time
- correction will from now on also make adjustments
- in order to align Erlang system time with OS system
- time. When the system is in the final phase it behaves
+ correction from now on also makes adjustments
+ to align Erlang system time with OS system
+ time. When the system is in the final phase, it behaves
exactly as in the <seealso marker="#No_Time_Warp_Mode">no
time warp mode</seealso>.</p>
-
</item>
</taglist>
- <p>In order for this to work properly there are two
- requirements that the user needs to ensure are
- satisfied:</p>
+ <p>In order for this to work properly, the user must ensure
+ that the following two requirements are satisfied:</p>
<taglist>
<tag>Forward Time Warp</tag>
<item><p>The time warp made when finalizing the time offset
can only be done forwards without encountering problems.
- This implies that the user has to ensure that the OS
+ This implies that the user must ensure that OS
system time is set to a time earlier or equal to actual
- POSIX time before starting the Erlang runtime system. If
- you are not completely sure the OS system time is correct,
+ POSIX time before starting the Erlang runtime system.</p>
+
+ <p>If you are not sure that OS system time is correct,
set it to a time that is guaranteed to be earlier than
actual POSIX time before starting the Erlang runtime
- system just to be safe.</p></item>
+ system, just to be safe.</p>
+ </item>
<tag>Finalize Correct OS System Time</tag>
- <item><p>The OS system time needs to be correct when the
- the user finalizes the time offset.</p></item>
+ <item><p>OS system time must be correct when
+ the user finalizes the time offset.</p>
+ </item>
</taglist>
<p>If these requirements are not fulfilled, the system
- may behave very bad.
- </p>
-
- <p>Assuming that the requirements above are fulfilled,
- time correction is enabled, and that the OS system time
- is adjusted using some time adjustment protocol like NTP
- or similar, only small adjustments of the Erlang monotonic
- time should be needed in order to keep system times
- aligned after finilization. As long as the system is not
- suspended, the largest adjustments needed should be for
+ may behave very bad.</p>
+
+ <p>Assuming that these requirements are fulfilled,
+ time correction is enabled, and that OS system time
+ is adjusted using a time adjustment protocol such as NTP,
+ only small adjustments of Erlang monotonic
+ time are needed to keep system times
+ aligned after finalization. As long as the system is not
+ suspended, the largest adjustments needed are for
inserted (or deleted) leap seconds.</p>
- <warning><p>In order to be able to use this mode you have
- to ensure that all Erlang code that will execute in
- both phases are
+ <warning><p>To use this mode, ensure that
+ all Erlang code that will execute in both phases are
<seealso marker="#Time_Warp_Safe_Code">time warp
safe</seealso>.</p>
- <p>Code that only execute in the final phase does not have
+ <p>Code executing only in the final phase does not have
to be able to cope with the time warp.</p></warning>
-
</section>
<marker id="Multi_Time_Warp_Mode"/>
<section>
- <title>Multi Time Warp Mode</title>
-
- <p><em>Multi time warp mode in combination with time
- correction is the preferred configuration</em>. This since,
- on almost all platforms, the Erlang runtime system will have
- better performance, will scale better, will behave better,
- and since the accuracy, and precision of time measurements
- will be better. Only Erlang runtime systems executing on
- ancient platforms will benefit from another configuration.</p>
+ <title>Multi-Time Warp Mode</title>
+ <p><em>Multi-time warp mode in combination with time
+ correction is the preferred configuration</em>. This as
+ the Erlang runtime system have better performance, scale
+ better, and behave better on almost all platforms. In
+ addition, the accuracy and precision of time measurements
+ are better. Only Erlang runtime systems executing on
+ ancient platforms benefit from another configuration.</p>
<p>The time offset may change at any time without limitations.
That is, Erlang system time may perform time warps both
- forwards and backwards at <em>any</em> time. Since we align
- the Erlang system time with the OS system time by changing
+ forwards and backwards at <em>any</em> time. As we align
+ Erlang system time with OS system time by changing
the time offset, we can enable a time correction that tries
to adjust the frequency of the Erlang monotonic clock to be as
- correct as possible. This will make time measurements using
- the Erlang monotonic time more accurate and precise.</p>
+ correct as possible. This makes time measurements using
+ Erlang monotonic time more accurate and precise.</p>
<p>If time correction is disabled, Erlang monotonic time
- will leap forward if OS system time leaps forward. If the
- OS system time leaps backwards, Erlang monotonic time will
- stop briefly but it does not freeze for extended periods
- of time. This since the time offset is changed in order to
+ leaps forward if OS system time leaps forward. If
+ OS system time leaps backwards, Erlang monotonic time
+ stops briefly, but it does not freeze for extended periods
+ of time. This as the time offset is changed to
align Erlang system time with OS system time.</p>
- <warning><p>In order to be able to use this mode you have
- to ensure that all Erlang code that will execute on the
- runtime system is
+ <warning><p>To use this mode, ensure that all
+ Erlang code that will execute on the runtime system is
<seealso marker="#Time_Warp_Safe_Code">time warp
safe</seealso>.</p></warning>
</section>
</section>
- <marker id="The_New_Time_API"/>
<section>
- <title>The New Time API</title>
-
+ <title>New Time API</title>
+ <marker id="The_New_Time_API"/>
<p>The old time API is based on
<seealso marker="erlang#now/0"><c>erlang:now/0</c></seealso>.
- The major issue with <c>erlang:now/0</c> is that it was
- intended to be used for so many unrelated things. This
- tied these unrelated operations together and unnecessarily
- caused performance, scalability as well as accuracy, and
- precision issues for operations that do not need to have
- such issues. The new API spreads different functionality
- over multiple functions in order to improve on this.</p>
-
- <p>In order to be backwards compatible <c>erlang:now/0</c> will
- remain as is, but <em>you are strongly discouraged from using
- it</em>. A lot of uses of <c>erlang:now/0</c> will also
- prevent you from using the new
- <seealso marker="#Multi_Time_Warp_Mode">multi time warp
- mode</seealso> which is an important part of this
+ <c>erlang:now/0</c> was intended to be used for many unrelated
+ things. This tied these unrelated operations together and
+ caused issues with performance, scalability, accuracy, and
+ precision for operations that did not need to have
+ such issues. To improve this, the new API spreads different
+ functionality over multiple functions.</p>
+
+ <p>To be backwards compatible, <c>erlang:now/0</c>
+ remains as is, but <em>you are strongly discouraged from using
+ it</em>. Many use cases of <c>erlang:now/0</c>
+ prevents you from using the new
+ <seealso marker="#Multi_Time_Warp_Mode">multi-time warp
+ mode</seealso>, which is an important part of this
new time functionality improvement.</p>
<p>Some of the new BIFs on some systems, perhaps surprisingly,
- return negative integer values on a newly started run time
- system. This is not a bug, but a memory usage optimization.</p>
+ return negative integer values on a newly started runtime
+ system. This is not a bug, but a memory use optimization.</p>
+
+ <p>The new API consists of the following new BIFs:</p>
- <p>The new API consists of a number of new BIFs:</p>
<list>
<item><p><seealso marker="erlang#convert_time_unit/3"><c>erlang:convert_time_unit/3</c></seealso></p></item>
<item><p><seealso marker="erlang#monotonic_time/0"><c>erlang:monotonic_time/0</c></seealso></p></item>
@@ -604,7 +610,9 @@
<item><p><seealso marker="kernel:os#system_time/0"><c>os:system_time/0</c></seealso></p></item>
<item><p><seealso marker="kernel:os#system_time/1"><c>os:system_time/1</c></seealso></p></item>
</list>
- <p>and a number of extensions of existing BIFs:</p>
+
+ <p>The new API also consists of extensions of the following existing BIFs:</p>
+
<list>
<item><p><seealso marker="erlang#monitor/2"><c>erlang:monitor(time_offset, clock_service)</c></seealso></p></item>
<item><p><seealso marker="erlang#system_flag_time_offset"><c>erlang:system_flag(time_offset, finalize)</c></seealso></p></item>
@@ -619,102 +627,99 @@
<marker id="The_New_Erlang_Monotonic_Time"/>
<section>
- <title>The New Erlang Monotonic Time</title>
- <p>The Erlang monotonic time as such is new as of ERTS
- version 7.0. It has been introduced in order to be able
- to detach time measurements such as elapsed time from
- calender time. It is very common that one is interested
- in measuring elapsed time or specifying a time relative
- to another point in time without having any need to know
- what the involved times are in UTC or any other
- globally defined time scale. By introducing a time scale
- that has a local definition of where it starts, it is
- possible to manage time that do not concern calender
- time on that time scale. Erlang monotonic time use
- such a time scale with a locally defined start.</p>
-
- <p>The introduction of Erlang monotonic time gives us
- the possibility to adjust the two Erlang times (Erlang
+ <title>New Erlang Monotonic Time</title>
+ <p>Erlang monotonic time as such is new as of <c>ERTS</c> 7.0.
+ It is introduced to detach time measurements, such as elapsed
+ time from calendar time. In many use cases there is a need to
+ measure elapsed time or specify a time relative to another point
+ in time without the need to know the involved times in UTC or
+ any other globally defined time scale. By introducing a time
+ scale with a local definition of where it starts, time that do
+ not concern calendar time can be managed on that time
+ scale. Erlang monotonic time uses such a time scale with a
+ locally defined start.</p>
+
+ <p>The introduction of Erlang monotonic time allows
+ us to adjust the two Erlang times (Erlang
monotonic time and Erlang system time) separately. By
- doing this, accuracy of elapsed time does not have to
+ doing this, the accuracy of elapsed time does not have to
suffer just because the system time happened to be
wrong at some point in time. Separate adjustments
of the two times are only performed in the time warp
modes, and only fully separated in the
- <seealso marker="#Multi_Time_Warp_Mode">multi
- time warp mode</seealso>. All other modes than the
- multi time warp mode are there for backwards
- compatibility reasons, and when using these the
- accuracy of Erlang monotonic time suffer since
+ <seealso marker="#Multi_Time_Warp_Mode">multi-time
+ warp mode</seealso>. All other modes than the
+ multi-time warp mode are for backwards
+ compatibility reasons. When using these modes, the
+ accuracy of Erlang monotonic time suffer, as
the adjustments of Erlang monotonic time in these
- modes are more or less tied to the Erlang system
- time.</p>
+ modes are more or less tied to Erlang system time.</p>
<p>The adjustment of system time could have been made
smother than using a time warp approach, but we think
- that would be a bad choice. Since we are able to
- express and measure time that aren't connected to
- calender time by the use of Erlang monotonic time, it
+ that would be a bad choice. As we can
+ express and measure time that is not connected to
+ calendar time by the use of Erlang monotonic time, it
is better to expose the change in Erlang system time
- immediately. This since it makes it possible for the
- Erlang applications executing on the system to react
- on the change in system time as soon as possible. This
- is also more or less exactly how most OSes handle this
+ immediately. This as the Erlang applications
+ executing on the system can react on the change in
+ system time as soon as possible. This is also more or
+ less exactly how most operating systems handle this
(OS monotonic time and OS system time). By adjusting
- system time smoothly we would just hide the fact that
+ system time smoothly, we would just hide the fact that
system time changed and make it harder for the Erlang
applications to react to the change in a sensible way.</p>
- <p>In order to be able to react to a change in Erlang
- system time you have to be able to detect that it
+ <p>To be able to react to a change in Erlang
+ system time, you must be able to detect that it
happened. The change in Erlang system time occurs when
current time offset is changed. We have therefore
- introduced the possibility to monitor the time offset
- using
- <seealso marker="erlang#monitor/2"><c>erlang:monitor(time_offset, clock_service)</c></seealso>. A process monitoring the time
- offset will be sent a message on the following format
+ introduced the possibility to monitor the time offset using
+ <seealso marker="erlang#monitor/2"><c>erlang:monitor(time_offset, clock_service)</c></seealso>.
+ A process monitoring the time
+ offset is sent a message on the following format
when the time offset is changed:</p>
+
<code type="none">{'CHANGE', MonitorReference, time_offset, clock_service, NewTimeOffset}</code>
</section>
<marker id="Unique_Values"/>
<section>
<title>Unique Values</title>
- <p>Besides reporting time <c>erlang:now/0</c> also
- produce unique and strictly monotonically increasing
- values. In order to detach this functionality from
- time measurements we have introduced
+ <p>Besides reporting time, <c>erlang:now/0</c> also
+ produces unique and strictly monotonically increasing
+ values. To detach this functionality from
+ time measurements, we have introduced
<seealso marker="erlang#unique_integer/1"><c>erlang:unique_integer()</c></seealso>.
</p>
</section>
<marker id="Dos_and_Donts"/>
<section>
- <title>Dos and Don'ts</title>
+ <title>How to Work with the New API</title>
<p>Previously <c>erlang:now/0</c> was the only option for doing
- quite a lot of things. We will look at a few different things
- <c>erlang:now/0</c> could be used for, and how you want to do
- this using the new API:</p>
+ many things. This section deals with some things that
+ <c>erlang:now/0</c> can be used for, and how you are to
+ these using the new API.</p>
<marker id="Dos_and_Donts_Retrieve_Erlang_System_Time"/>
<section>
<title>Retrieve Erlang System Time</title>
<dont>
<p>
- use <c>erlang:now/0</c> in order to retrieve current Erlang
- system time.
+ Use <c>erlang:now/0</c> to retrieve current Erlang system time.
</p>
</dont>
<do>
<p>
- use
+ Use
<seealso marker="erlang#system_time/1"><c>erlang:system_time/1</c></seealso>
- in order to retrieve current Erlang system time on the
+ to retrieve current Erlang system time on the
<seealso marker="erlang#type_time_unit">time unit</seealso>
of your choice.</p>
<p>If you want the same format as returned by <c>erlang:now/0</c>, use
<seealso marker="erlang#timestamp/0"><c>erlang:timestamp/0</c></seealso>.
- </p>
+ </p>
</do>
</section>
@@ -723,26 +728,27 @@
<title>Measure Elapsed Time</title>
<dont>
<p>
- take timestamps with <c>erlang:now/0</c> and calculate
+ Take timestamps with <c>erlang:now/0</c> and calculate
the difference in time with
<seealso marker="stdlib:timer#now_diff/2"><c>timer:now_diff/2</c></seealso>.
</p>
</dont>
<do>
<p>
- take timestamps with
+ Take timestamps with
<seealso marker="erlang#monotonic_time/0"><c>erlang:monotonic_time/0</c></seealso>
and calculate the time difference using ordinary subtraction.
The result will be in <c>native</c>
<seealso marker="erlang#type_time_unit">time unit</seealso>.
If you want to convert the
- result to another time unit you can do this using
+ result to another time unit, you can use
<seealso marker="erlang#convert_time_unit/3"><c>erlang:convert_time_unit/3</c></seealso>.
</p>
- <p>Another easier way of doing this is to use
+
+ <p>An easier way to do this is to use
<seealso marker="erlang#monotonic_time/1"><c>erlang:monotonic_time/1</c></seealso>
- with desired time unit. However, you may lose accuracy,
- and precision this way.
+ with the desired time unit. However, you can then lose accuracy
+ and precision.
</p>
</do>
</section>
@@ -752,16 +758,16 @@
<title>Determine Order of Events</title>
<dont>
<p>
- determine the order of events by saving a timestamp
- with <c>erlang:now/0</c> when the event happens.
+ Determine the order of events by saving a timestamp
+ with <c>erlang:now/0</c> when the event occurs.
</p>
</dont>
<do>
<p>
- determine the order of events by saving the integer
+ Determine the order of events by saving the integer
returned by
<seealso marker="erlang#unique_integer/1"><c>erlang:unique_integer([monotonic])</c></seealso>
- when the event happens. These integers will be strictly
+ when the event occurs. These integers will be strictly
monotonically ordered on current runtime system instance
corresponding to creation time.
</p>
@@ -770,40 +776,43 @@
<marker id="Dos_and_Donts_Determine_Order_of_Events_With_Time_of_the_Event"/>
<section>
- <title>Determine Order of Events With Time of the Event</title>
+ <title>Determine Order of Events with Time of the Event</title>
<dont>
<p>
- determine the order of events by saving a timestamp
- with <c>erlang:now/0</c> when the event happens.
+ Determine the order of events by saving a timestamp
+ with <c>erlang:now/0</c> when the event occurs.
</p>
</dont>
<do>
<p>
- determine the order of events by saving a tuple
- containing
+ Determine the order of events by saving a tuple containing
<seealso marker="erlang#monotonic_time/0">monotonic time</seealso>
and a <seealso marker="erlang#unique_integer/1">strictly
- monotonically increasing integer</seealso> like this:</p>
+ monotonically increasing integer</seealso> as follows:</p>
+
<code type="none">
Time = erlang:monotonic_time(),
UMI = erlang:unique_integer([monotonic]),
EventTag = {Time, UMI}</code>
+
<p>These tuples will be strictly monotonically ordered
- on the current runtime system instance according to
- creation time. Note that it is important that the
+ on current runtime system instance according to
+ creation time. It is important that the
monotonic time is in the first element (the most
significant element when comparing 2-tuples). Using
the monotonic time in the tuples, you can calculate time
between events.</p>
- <p>If you are interested in the Erlang system time at the
- time when the event occurred you can also save the time
+
+ <p>If you are interested in Erlang system time at the
+ time when the event occurred, you can also save the time
offset before or after saving the events using
<seealso marker="erlang#time_offset/0"><c>erlang:time_offset/0</c></seealso>.
Erlang monotonic time added with the time
offset corresponds to Erlang system time.</p>
+
<p>If you are executing in a mode where time offset
- may change and you want to be able to get the actual
- Erlang system time when the event occurred you can
+ can change, and you want to get the actual
+ Erlang system time when the event occurred, you can
save the time offset as a third element in the tuple
(the least significant element when comparing 3-tuples).</p>
</do>
@@ -814,16 +823,15 @@ EventTag = {Time, UMI}</code>
<title>Create a Unique Name</title>
<dont>
<p>
- use the values returned from <c>erlang:now/0</c>
- in order to create a name unique on the current
- runtime system instance.
+ Use the values returned from <c>erlang:now/0</c>
+ to create a name unique on the current runtime system instance.
</p>
</dont>
<do>
<p>
- use the value returned from
+ Use the value returned from
<seealso marker="erlang#unique_integer/0"><c>erlang:unique_integer/0</c></seealso>
- in order to create a name unique on the current runtime system
+ to create a name unique on the current runtime system
instance. If you only want positive integers, you can use
<seealso marker="erlang#unique_integer/1"><c>erlang:unique_integer([positive])</c></seealso>.
</p>
@@ -832,49 +840,63 @@ EventTag = {Time, UMI}</code>
<marker id="Dos_and_Donts_Seed_Random_Number_Generation_With_a_Unique_Value"/>
<section>
- <title>Seed Random Number Generation With a Unique Value</title>
+ <title>Seed Random Number Generation with a Unique Value</title>
<dont>
<p>
- seed random number generation using <c>erlang:now()</c>.
+ Seed random number generation using <c>erlang:now()</c>.
</p>
</dont>
<do>
<p>
- seed random number generation using a combination of
+ Seed random number generation using a combination of
<seealso marker="erlang#monotonic_time/0"><c>erlang:monotonic_time()</c></seealso>,
<seealso marker="erlang#time_offset/0"><c>erlang:time_offset()</c></seealso>,
- <seealso marker="erlang#unique_integer/0"><c>erlang:unique_integer()</c></seealso>, and other functionality.
+ <seealso marker="erlang#unique_integer/0"><c>erlang:unique_integer()</c></seealso>,
+ and other functionality.
</p>
</do>
</section>
- <p>To sum this section up: <em>Don't use <c>erlang:now/0</c>!</em></p>
+ <p>To sum up this section: <em>Do not use <c>erlang:now/0</c>.</em></p>
</section>
</section>
- <marker id="Supporting_Both_New_and_Old_OTP_Releases"/>
<section>
- <title>Supporting Both New and Old OTP Releases</title>
- <p>Your code may be required to be able to run on a variety
+ <marker id="Supporting_Both_New_and_Old_OTP_Releases"/>
+ <title>Support of Both New and Old OTP Releases</title>
+ <p>It can be required that your code must run on a variety
of OTP installations of different OTP releases. If so, you
- can not just use the new API out of the box, since it will
+ cannot use the new API out of the box, as it will
not be available on old pre OTP 18 releases. The solution
- is <em>not</em> to avoid using the new API, since your
- code then won't be able to benefit from the scalability
- and accuracy improvements made. Instead you want to use the
+ is <em>not</em> to avoid using the new API, as your
+ code then would not benefit from the scalability
+ and accuracy improvements made. Instead, use the
new API when available, and fall back on <c>erlang:now/0</c>
- when it is not available. Fortunately almost all of the new
- API can easily be implemented using existing primitives
- (except for
- <seealso marker="erlang#system_info_start_time"><c>erlang:system_info(start_time)</c></seealso>,
- <seealso marker="erlang#system_info_end_time"><c>erlang:system_info(end_time)</c></seealso>,
- <seealso marker="erlang#system_info_os_monotonic_time_source"><c>erlang:system_info(os_monotonic_time_source)</c></seealso>, and
- <seealso marker="erlang#system_info_os_system_time_source"><c>erlang:system_info(os_system_time_source)</c></seealso>).
- By wrapping the API with functions that fall back on
- <c>erlang:now/0</c> when the new API is not available,
- and using these wrappers instead of using the API directly
- the problem is solved. These wrappers can for example
+ when the new API is unavailable.</p>
+
+ <p>Fortunately most of the new API can easily be
+ implemented using existing primitives, except for:</p>
+
+ <list type="bulleted">
+ <item>
+ <seealso marker="erlang#system_info_start_time"><c>erlang:system_info(start_time)</c></seealso>
+ </item>
+ <item>
+ <seealso marker="erlang#system_info_end_time"><c>erlang:system_info(end_time)</c></seealso>
+ </item>
+ <item>
+ <seealso marker="erlang#system_info_os_monotonic_time_source"><c>erlang:system_info(os_monotonic_time_source)</c></seealso>
+ </item>
+ <item>
+ <seealso marker="erlang#system_info_os_system_time_source"><c>erlang:system_info(os_system_time_source)</c></seealso>)
+ </item>
+ </list>
+
+ <p>By wrapping the API with functions that fall back on
+ <c>erlang:now/0</c> when the new API is unavailable,
+ and using these wrappers instead of using the API directly,
+ the problem is solved. These wrappers can, for example,
be implemented as in
- <url href="time_compat.erl"><c>$ERL_TOP/erts/example/time_compat.erl</c></url>.</p>
+ <url href="time_compat.erl">$ERL_TOP/erts/example/time_compat.erl</url>.</p>
</section>
</chapter>
diff --git a/erts/emulator/Makefile.in b/erts/emulator/Makefile.in
index a919f0e3ac..c5080d5b5d 100644
--- a/erts/emulator/Makefile.in
+++ b/erts/emulator/Makefile.in
@@ -23,10 +23,6 @@ include ../vsn.mk
include $(ERL_TOP)/make/$(TARGET)/otp.mk
-include $(TARGET)/gen_git_version.mk
-ifeq ($(findstring ose,$(TARGET)),ose)
-include $(ERL_TOP)/make/$(TARGET)/ose_lm.mk
-endif
-
ENABLE_ALLOC_TYPE_VARS = @ENABLE_ALLOC_TYPE_VARS@
HIPE_ENABLED=@HIPE_ENABLED@
DTRACE_ENABLED=@DTRACE_ENABLED@
@@ -245,9 +241,7 @@ HCC = @HCC@
LD = @LD@
DEXPORT = @DEXPORT@
RANLIB = @RANLIB@
-ifneq ($(findstring ose,$(TARGET)),ose)
STRIP = strip
-endif
PERL = @PERL@
RM = @RM@
MKDIR = @MKDIR@
@@ -684,14 +678,6 @@ $(OBJDIR)/%.o: $(TTF_DIR)/%.c
$(OBJDIR)/%.o: sys/$(ERLANG_OSTYPE)/%.c
$(V_CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
-ifeq ($(findstring ose,$(TARGET)),ose)
-$(OBJDIR)/ose_confd.o: $(OSE_CONFD)
- $(V_CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
-
-$(OBJDIR)/crt0_lm.o: $(CRT0_LM)
- $(V_CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
-endif
-
$(OBJDIR)/%.o: sys/common/%.c
$(V_CC) $(subst -O2, $(GEN_OPT_FLGS), $(CFLAGS)) $(INCLUDES) -c $< -o $@
@@ -810,29 +796,6 @@ OS_OBJS = \
$(OBJDIR)/dosmap.o
else
-ifeq ($(findstring ose,$(TARGET)),ose)
-OS_OBJS = \
- $(OBJDIR)/sys.o \
- $(OBJDIR)/driver_tab.o \
- $(OBJDIR)/ose_efile.o \
- $(OBJDIR)/gzio.o \
- $(OBJDIR)/elib_memmove.o
-
-OS_OBJS += $(OBJDIR)/ose_confd.o \
- $(OBJDIR)/crt0_lm.o
-
-OS_OBJS += $(OBJDIR)/sys_float.o \
- $(OBJDIR)/sys_time.o
-
-DRV_OBJS = \
- $(OBJDIR)/efile_drv.o \
- $(OBJDIR)/ose_signal_drv.o \
- $(OBJDIR)/inet_drv.o \
- $(OBJDIR)/zlib_drv.o \
- $(OBJDIR)/ram_file_drv.o \
- $(OBJDIR)/ttsl_drv.o
-
-else
OS_OBJS = \
$(OBJDIR)/sys.o \
$(OBJDIR)/driver_tab.o \
@@ -849,7 +812,6 @@ DRV_OBJS = \
$(OBJDIR)/ram_file_drv.o \
$(OBJDIR)/ttsl_drv.o
endif
-endif
ifneq ($(STATIC_NIFS),no)
STATIC_NIF_LIBS = $(STATIC_NIFS)
@@ -1022,19 +984,12 @@ $(BINDIR)/$(EMULATOR_EXECUTABLE): $(INIT_OBJS) $(OBJS) $(DEPLIBS)
$(STATIC_DRIVER_LIBS) $(LIBS)
else
-ifeq ($(findstring ose,$(TARGET)),ose)
-$(BINDIR)/$(EMULATOR_EXECUTABLE): $(INIT_OBJS) $(OBJS) $(DEPLIBS) $(LCF)
- $(call build-ose-load-module, $@, $(INIT_OBJS) $(OBJS), $(STATIC_NIF_LIBS) \
- $(STATIC_DRIVER_LIBS) $(LIBS), $(BEAM_LMCONF))
-
-else
$(BINDIR)/$(EMULATOR_EXECUTABLE): $(INIT_OBJS) $(OBJS) $(DEPLIBS)
$(ld_verbose)$(PURIFY) $(LD) -o $(BINDIR)/$(EMULATOR_EXECUTABLE) \
$(HIPEBEAMLDFLAGS) $(LDFLAGS) $(DEXPORT) $(INIT_OBJS) $(OBJS) \
$(STATIC_NIF_LIBS) $(STATIC_DRIVER_LIBS) $(LIBS)
endif
-endif
# ----------------------------------------------------------------------
# Dependencies
diff --git a/erts/emulator/beam/atom.names b/erts/emulator/beam/atom.names
index 7a50b24818..967cf013f0 100644
--- a/erts/emulator/beam/atom.names
+++ b/erts/emulator/beam/atom.names
@@ -320,6 +320,7 @@ atom ldflags
atom Le='=<'
atom lf
atom line
+atom line_delimiter
atom line_length
atom linked_in_driver
atom links
@@ -436,13 +437,6 @@ atom orelse
atom os_pid
atom os_type
atom os_version
-atom ose_bg_proc
-atom ose_int_proc
-atom ose_phantom
-atom ose_pri_proc
-atom ose_process_prio
-atom ose_process_type
-atom ose_ti_proc
atom out
atom out_exited
atom out_exiting
diff --git a/erts/emulator/beam/beam_bif_load.c b/erts/emulator/beam/beam_bif_load.c
index 0e192b1ebd..11508a1b39 100644
--- a/erts/emulator/beam/beam_bif_load.c
+++ b/erts/emulator/beam/beam_bif_load.c
@@ -913,7 +913,7 @@ any_heap_ref_ptrs(Eterm* start, Eterm* end, char* mod_start, Uint mod_size)
switch (primary_tag(val)) {
case TAG_PRIMARY_BOXED:
case TAG_PRIMARY_LIST:
- if (in_area(EXPAND_POINTER(val), mod_start, mod_size)) {
+ if (in_area(val, mod_start, mod_size)) {
return 1;
}
break;
@@ -933,7 +933,7 @@ any_heap_refs(Eterm* start, Eterm* end, char* mod_start, Uint mod_size)
switch (primary_tag(val)) {
case TAG_PRIMARY_BOXED:
case TAG_PRIMARY_LIST:
- if (in_area(EXPAND_POINTER(val), mod_start, mod_size)) {
+ if (in_area(val, mod_start, mod_size)) {
return 1;
}
break;
@@ -943,7 +943,7 @@ any_heap_refs(Eterm* start, Eterm* end, char* mod_start, Uint mod_size)
if (header_is_bin_matchstate(val)) {
ErlBinMatchState *ms = (ErlBinMatchState*) p;
ErlBinMatchBuffer *mb = &(ms->mb);
- if (in_area(EXPAND_POINTER(mb->orig), mod_start, mod_size)) {
+ if (in_area(mb->orig, mod_start, mod_size)) {
return 1;
}
}
diff --git a/erts/emulator/beam/beam_debug.c b/erts/emulator/beam/beam_debug.c
index c774a70d4c..0e921d761c 100644
--- a/erts/emulator/beam/beam_debug.c
+++ b/erts/emulator/beam/beam_debug.c
@@ -79,7 +79,7 @@ erts_debug_breakpoint_2(BIF_ALIST_2)
{
Process* p = BIF_P;
Eterm MFA = BIF_ARG_1;
- Eterm bool = BIF_ARG_2;
+ Eterm boolean = BIF_ARG_2;
Eterm* tp;
Eterm mfa[3];
int i;
@@ -87,7 +87,7 @@ erts_debug_breakpoint_2(BIF_ALIST_2)
Eterm res;
BpFunctions f;
- if (bool != am_true && bool != am_false)
+ if (boolean != am_true && boolean != am_false)
goto error;
if (is_not_tuple(MFA)) {
@@ -124,7 +124,7 @@ erts_debug_breakpoint_2(BIF_ALIST_2)
erts_smp_thr_progress_block();
erts_bp_match_functions(&f, mfa, specified);
- if (bool == am_true) {
+ if (boolean == am_true) {
erts_set_debug_break(&f);
erts_install_breakpoints(&f);
erts_commit_staged_bp();
@@ -432,39 +432,33 @@ print_op(int to, void *to_arg, int op, int size, BeamInstr* addr)
while (*sign) {
switch (*sign) {
case 'r': /* x(0) */
- erts_print(to, to_arg, "x(0)");
+ erts_print(to, to_arg, "r(0)");
break;
case 'x': /* x(N) */
- if (reg_index(ap[0]) == 0) {
- erts_print(to, to_arg, "x[0]");
- } else {
- erts_print(to, to_arg, "x(%d)", reg_index(ap[0]));
+ {
+ Uint n = ap[0] / sizeof(Eterm);
+ erts_print(to, to_arg, "x(%d)", n);
+ ap++;
}
- ap++;
break;
case 'y': /* y(N) */
- erts_print(to, to_arg, "y(%d)", reg_index(ap[0]) - CP_SIZE);
- ap++;
+ {
+ Uint n = ap[0] / sizeof(Eterm) - CP_SIZE;
+ erts_print(to, to_arg, "y(%d)", n);
+ ap++;
+ }
break;
case 'n': /* Nil */
erts_print(to, to_arg, "[]");
break;
case 's': /* Any source (tagged constant or register) */
- tag = beam_reg_tag(*ap);
- if (tag == X_REG_DEF) {
- if (reg_index(*ap) == 0) {
- erts_print(to, to_arg, "x[0]");
- } else {
- erts_print(to, to_arg, "x(%d)", reg_index(*ap));
- }
+ tag = loader_tag(*ap);
+ if (tag == LOADER_X_REG) {
+ erts_print(to, to_arg, "x(%d)", loader_x_reg_index(*ap));
ap++;
break;
- } else if (tag == Y_REG_DEF) {
- erts_print(to, to_arg, "y(%d)", reg_index(*ap) - CP_SIZE);
- ap++;
- break;
- } else if (tag == R_REG_DEF) {
- erts_print(to, to_arg, "x(0)");
+ } else if (tag == LOADER_Y_REG) {
+ erts_print(to, to_arg, "y(%d)", loader_y_reg_index(*ap) - CP_SIZE);
ap++;
break;
}
@@ -481,20 +475,12 @@ print_op(int to, void *to_arg, int op, int size, BeamInstr* addr)
ap++;
break;
case 'd': /* Destination (x(0), x(N), y(N)) */
- switch (beam_reg_tag(*ap)) {
- case X_REG_DEF:
- if (reg_index(*ap) == 0) {
- erts_print(to, to_arg, "x[0]");
- } else {
- erts_print(to, to_arg, "x(%d)", reg_index(*ap));
- }
- break;
- case Y_REG_DEF:
- erts_print(to, to_arg, "y(%d)", reg_index(*ap) - CP_SIZE);
- break;
- case R_REG_DEF:
- erts_print(to, to_arg, "x(0)");
- break;
+ if (*ap & 1) {
+ erts_print(to, to_arg, "y(%d)",
+ *ap / sizeof(Eterm) - CP_SIZE);
+ } else {
+ erts_print(to, to_arg, "x(%d)",
+ *ap / sizeof(Eterm));
}
ap++;
break;
@@ -561,7 +547,7 @@ print_op(int to, void *to_arg, int op, int size, BeamInstr* addr)
ap++;
break;
case 'l': /* fr(N) */
- erts_print(to, to_arg, "fr(%d)", reg_index(ap[0]));
+ erts_print(to, to_arg, "fr(%d)", loader_reg_index(ap[0]));
ap++;
break;
default:
@@ -580,7 +566,6 @@ print_op(int to, void *to_arg, int op, int size, BeamInstr* addr)
unpacked = ap;
ap = addr + size;
switch (op) {
- case op_i_select_val_lins_rfI:
case op_i_select_val_lins_xfI:
case op_i_select_val_lins_yfI:
{
@@ -600,7 +585,6 @@ print_op(int to, void *to_arg, int op, int size, BeamInstr* addr)
}
}
break;
- case op_i_select_val_bins_rfI:
case op_i_select_val_bins_xfI:
case op_i_select_val_bins_yfI:
{
@@ -614,7 +598,6 @@ print_op(int to, void *to_arg, int op, int size, BeamInstr* addr)
}
}
break;
- case op_i_select_tuple_arity_rfI:
case op_i_select_tuple_arity_xfI:
case op_i_select_tuple_arity_yfI:
{
@@ -639,7 +622,6 @@ print_op(int to, void *to_arg, int op, int size, BeamInstr* addr)
}
}
break;
- case op_i_jump_on_val_rfII:
case op_i_jump_on_val_xfII:
case op_i_jump_on_val_yfII:
{
@@ -651,7 +633,6 @@ print_op(int to, void *to_arg, int op, int size, BeamInstr* addr)
}
}
break;
- case op_i_jump_on_val_zero_rfI:
case op_i_jump_on_val_zero_xfI:
case op_i_jump_on_val_zero_yfI:
{
@@ -663,7 +644,6 @@ print_op(int to, void *to_arg, int op, int size, BeamInstr* addr)
}
}
break;
- case op_i_put_tuple_rI:
case op_i_put_tuple_xI:
case op_i_put_tuple_yI:
case op_new_map_dII:
@@ -673,20 +653,16 @@ print_op(int to, void *to_arg, int op, int size, BeamInstr* addr)
int n = unpacked[-1];
while (n > 0) {
- if (!is_header(ap[0])) {
+ switch (loader_tag(ap[0])) {
+ case LOADER_X_REG:
+ erts_print(to, to_arg, " x(%d)", loader_x_reg_index(ap[0]));
+ break;
+ case LOADER_Y_REG:
+ erts_print(to, to_arg, " x(%d)", loader_y_reg_index(ap[0]));
+ break;
+ default:
erts_print(to, to_arg, " %T", (Eterm) ap[0]);
- } else {
- switch ((ap[0] >> 2) & 0x03) {
- case R_REG_DEF:
- erts_print(to, to_arg, " x(0)");
- break;
- case X_REG_DEF:
- erts_print(to, to_arg, " x(%d)", ap[0] >> 4);
- break;
- case Y_REG_DEF:
- erts_print(to, to_arg, " y(%d)", ap[0] >> 4);
- break;
- }
+ break;
}
ap++, size++, n--;
}
@@ -699,18 +675,16 @@ print_op(int to, void *to_arg, int op, int size, BeamInstr* addr)
while (n > 0) {
if (n % 3 == 1) {
erts_print(to, to_arg, " %X", ap[0]);
- } else if (!is_header(ap[0])) {
- erts_print(to, to_arg, " %T", (Eterm) ap[0]);
} else {
- switch ((ap[0] >> 2) & 0x03) {
- case R_REG_DEF:
- erts_print(to, to_arg, " x(0)");
+ switch (loader_tag(ap[0])) {
+ case LOADER_X_REG:
+ erts_print(to, to_arg, " x(%d)", loader_x_reg_index(ap[0]));
break;
- case X_REG_DEF:
- erts_print(to, to_arg, " x(%d)", ap[0] >> 4);
+ case LOADER_Y_REG:
+ erts_print(to, to_arg, " y(%d)", loader_y_reg_index(ap[0]));
break;
- case Y_REG_DEF:
- erts_print(to, to_arg, " y(%d)", ap[0] >> 4);
+ default:
+ erts_print(to, to_arg, " %T", (Eterm) ap[0]);
break;
}
}
diff --git a/erts/emulator/beam/beam_emu.c b/erts/emulator/beam/beam_emu.c
index 38def5d89f..faf496a030 100644
--- a/erts/emulator/beam/beam_emu.c
+++ b/erts/emulator/beam/beam_emu.c
@@ -99,10 +99,7 @@ do { \
do { \
int i_; \
int Arity_ = PC[-1]; \
- if (Arity_ > 0) { \
- CHECK_TERM(r(0)); \
- } \
- for (i_ = 1; i_ < Arity_; i_++) { \
+ for (i_ = 0; i_ < Arity_; i_++) { \
CHECK_TERM(x(i_)); \
} \
} while (0)
@@ -151,25 +148,21 @@ do { \
ASSERT(VALID_INSTR(* (Eterm *)(ip))); \
I = (ip)
-#define FetchArgs(S1, S2) tmp_arg1 = (S1); tmp_arg2 = (S2)
+/*
+ * Register target (X or Y register).
+ */
+#define REG_TARGET(Target) (*(((Target) & 1) ? &yb(Target-1) : &xb(Target)))
/*
* Store a result into a register given a destination descriptor.
*/
-#define StoreResult(Result, DestDesc) \
- do { \
- Eterm stb_reg; \
- stb_reg = (DestDesc); \
- CHECK_TERM(Result); \
- switch (beam_reg_tag(stb_reg)) { \
- case R_REG_DEF: \
- r(0) = (Result); break; \
- case X_REG_DEF: \
- xb(x_reg_offset(stb_reg)) = (Result); break; \
- default: \
- yb(y_reg_offset(stb_reg)) = (Result); break; \
- } \
+#define StoreResult(Result, DestDesc) \
+ do { \
+ Eterm stb_reg; \
+ stb_reg = (DestDesc); \
+ CHECK_TERM(Result); \
+ REG_TARGET(stb_reg) = (Result); \
} while (0)
#define StoreSimpleDest(Src, Dest) Dest = (Src)
@@ -180,22 +173,16 @@ do { \
* be just before the next instruction.
*/
-#define StoreBifResult(Dst, Result) \
- do { \
- BeamInstr* stb_next; \
- Eterm stb_reg; \
- stb_reg = Arg(Dst); \
- I += (Dst) + 2; \
- stb_next = (BeamInstr *) *I; \
- CHECK_TERM(Result); \
- switch (beam_reg_tag(stb_reg)) { \
- case R_REG_DEF: \
- r(0) = (Result); Goto(stb_next); \
- case X_REG_DEF: \
- xb(x_reg_offset(stb_reg)) = (Result); Goto(stb_next); \
- default: \
- yb(y_reg_offset(stb_reg)) = (Result); Goto(stb_next); \
- } \
+#define StoreBifResult(Dst, Result) \
+ do { \
+ BeamInstr* stb_next; \
+ Eterm stb_reg; \
+ stb_reg = Arg(Dst); \
+ I += (Dst) + 2; \
+ stb_next = (BeamInstr *) *I; \
+ CHECK_TERM(Result); \
+ REG_TARGET(stb_reg) = (Result); \
+ Goto(stb_next); \
} while (0)
#define ClauseFail() goto jump_f
@@ -293,7 +280,7 @@ void** beam_ops;
#define Ib(N) (N)
#define x(N) reg[N]
#define y(N) E[N]
-#define r(N) x##N
+#define r(N) x(N)
/*
* Makes sure that there are StackNeed + HeapNeed + 1 words available
@@ -309,12 +296,10 @@ void** beam_ops;
needed = (StackNeed) + 1; \
if (E - HTOP < (needed + (HeapNeed))) { \
SWAPOUT; \
- reg[0] = r(0); \
PROCESS_MAIN_CHK_LOCKS(c_p); \
FCALLS -= erts_garbage_collect(c_p, needed + (HeapNeed), reg, (M)); \
ERTS_VERIFY_UNUSED_TEMP_ALLOC(c_p); \
PROCESS_MAIN_CHK_LOCKS(c_p); \
- r(0) = reg[0]; \
SWAPIN; \
} \
E -= needed; \
@@ -363,12 +348,10 @@ void** beam_ops;
unsigned need = (Nh); \
if ((E - HTOP < need) || (MSO(c_p).overhead + (VNh) >= BIN_VHEAP_SZ(c_p))) {\
SWAPOUT; \
- reg[0] = r(0); \
PROCESS_MAIN_CHK_LOCKS(c_p); \
FCALLS -= erts_garbage_collect(c_p, need, reg, (Live)); \
ERTS_VERIFY_UNUSED_TEMP_ALLOC(c_p); \
PROCESS_MAIN_CHK_LOCKS(c_p); \
- r(0) = reg[0]; \
SWAPIN; \
} \
HEAP_SPACE_VERIFIED(need); \
@@ -386,12 +369,10 @@ void** beam_ops;
unsigned need = (Nh); \
if (E - HTOP < need) { \
SWAPOUT; \
- reg[0] = r(0); \
PROCESS_MAIN_CHK_LOCKS(c_p); \
FCALLS -= erts_garbage_collect(c_p, need, reg, (Live)); \
ERTS_VERIFY_UNUSED_TEMP_ALLOC(c_p); \
PROCESS_MAIN_CHK_LOCKS(c_p); \
- r(0) = reg[0]; \
SWAPIN; \
} \
HEAP_SPACE_VERIFIED(need); \
@@ -408,15 +389,11 @@ void** beam_ops;
unsigned need = (Nh); \
if (E - HTOP < need) { \
SWAPOUT; \
- reg[0] = r(0); \
reg[Live] = Extra; \
PROCESS_MAIN_CHK_LOCKS(c_p); \
FCALLS -= erts_garbage_collect(c_p, need, reg, (Live)+1); \
ERTS_VERIFY_UNUSED_TEMP_ALLOC(c_p); \
PROCESS_MAIN_CHK_LOCKS(c_p); \
- if (Live > 0) { \
- r(0) = reg[0]; \
- } \
Extra = reg[Live]; \
SWAPIN; \
} \
@@ -439,7 +416,6 @@ void** beam_ops;
#define MakeFun(FunP, NumFree) \
do { \
SWAPOUT; \
- reg[0] = r(0); \
r(0) = new_fun(c_p, reg, (ErlFunEntry *) FunP, NumFree); \
SWAPIN; \
} while (0)
@@ -531,15 +507,19 @@ void** beam_ops;
ASSERT(VALID_INSTR(Dst)); \
Goto(Dst)
-#define GetR(pos, tr) \
- do { \
- tr = Arg(pos); \
- switch (beam_reg_tag(tr)) { \
- case R_REG_DEF: tr = r(0); break; \
- case X_REG_DEF: tr = xb(x_reg_offset(tr)); break; \
- case Y_REG_DEF: ASSERT(y_reg_offset(tr) >= 1); tr = yb(y_reg_offset(tr)); break; \
- } \
- CHECK_TERM(tr); \
+#define GetR(pos, tr) \
+ do { \
+ tr = Arg(pos); \
+ switch (loader_tag(tr)) { \
+ case LOADER_X_REG: \
+ tr = x(loader_x_reg_index(tr)); \
+ break; \
+ case LOADER_Y_REG: \
+ ASSERT(loader_y_reg_index(tr) >= 1); \
+ tr = y(loader_y_reg_index(tr)); \
+ break; \
+ } \
+ CHECK_TERM(tr); \
} while (0)
#define GetArg1(N, Dst) GetR((N), Dst)
@@ -557,24 +537,93 @@ void** beam_ops;
HTOP += 2; \
} while (0)
+#define Swap(R1, R2) \
+ do { \
+ Eterm V = R1; \
+ R1 = R2; \
+ R2 = V; \
+ } while (0)
+
+#define SwapTemp(R1, R2, Tmp) \
+ do { \
+ Eterm V = R1; \
+ R1 = R2; \
+ R2 = Tmp = V; \
+ } while (0)
+
#define Move(Src, Dst, Store) \
do { \
Eterm term = (Src); \
Store(term, Dst); \
} while (0)
-#define Move2(S1, D1, S2, D2) D1 = (S1); D2 = (S2)
+#define Move2Par(S1, D1, S2, D2) \
+ do { \
+ Eterm V1, V2; \
+ V1 = (S1); V2 = (S2); D1 = V1; D2 = V2; \
+ } while (0)
+
+#define MoveShift(Src, SD, D) \
+ do { \
+ Eterm V; \
+ V = Src; D = SD; SD = V; \
+ } while (0)
+
+#define MoveDup(Src, D1, D2) \
+ do { \
+ D1 = D2 = (Src); \
+ } while (0)
+
#define Move3(S1, D1, S2, D2, S3, D3) D1 = (S1); D2 = (S2); D3 = (S3)
-#define MoveGenDest(src, dstp) \
- if ((dstp) == NULL) { r(0) = (src); } else { *(dstp) = src; }
+#define MoveWindow3(S1, S2, S3, D) \
+ do { \
+ Eterm xt0, xt1, xt2; \
+ Eterm *y = &D; \
+ xt0 = S1; \
+ xt1 = S2; \
+ xt2 = S3; \
+ y[0] = xt0; \
+ y[1] = xt1; \
+ y[2] = xt2; \
+ } while (0)
+
+#define MoveWindow4(S1, S2, S3, S4, D) \
+ do { \
+ Eterm xt0, xt1, xt2, xt3; \
+ Eterm *y = &D; \
+ xt0 = S1; \
+ xt1 = S2; \
+ xt2 = S3; \
+ xt3 = S4; \
+ y[0] = xt0; \
+ y[1] = xt1; \
+ y[2] = xt2; \
+ y[3] = xt3; \
+ } while (0)
-#define MoveReturn(Src, Dest) \
- (Dest) = (Src); \
- I = c_p->cp; \
- ASSERT(VALID_INSTR(*c_p->cp)); \
- c_p->cp = 0; \
- CHECK_TERM(r(0)); \
+#define MoveWindow5(S1, S2, S3, S4, S5, D) \
+ do { \
+ Eterm xt0, xt1, xt2, xt3, xt4; \
+ Eterm *y = &D; \
+ xt0 = S1; \
+ xt1 = S2; \
+ xt2 = S3; \
+ xt3 = S4; \
+ xt4 = S5; \
+ y[0] = xt0; \
+ y[1] = xt1; \
+ y[2] = xt2; \
+ y[3] = xt3; \
+ y[4] = xt4; \
+ } while (0)
+
+#define MoveReturn(Src) \
+ x(0) = (Src); \
+ I = c_p->cp; \
+ ASSERT(VALID_INSTR(*c_p->cp)); \
+ c_p->cp = 0; \
+ CHECK_TERM(r(0)); \
Goto(*I)
#define DeallocateReturn(Deallocate) \
@@ -586,26 +635,26 @@ void** beam_ops;
Goto(*I); \
} while (0)
-#define MoveDeallocateReturn(Src, Dest, Deallocate) \
- (Dest) = (Src); \
+#define MoveDeallocateReturn(Src, Deallocate) \
+ x(0) = (Src); \
DeallocateReturn(Deallocate)
-#define MoveCall(Src, Dest, CallDest, Size) \
- (Dest) = (Src); \
+#define MoveCall(Src, CallDest, Size) \
+ x(0) = (Src); \
SET_CP(c_p, I+Size+1); \
- SET_I((BeamInstr *) CallDest); \
+ SET_I((BeamInstr *) CallDest); \
Dispatch();
-#define MoveCallLast(Src, Dest, CallDest, Deallocate) \
- (Dest) = (Src); \
- RESTORE_CP(E); \
- E = ADD_BYTE_OFFSET(E, (Deallocate)); \
- SET_I((BeamInstr *) CallDest); \
+#define MoveCallLast(Src, CallDest, Deallocate) \
+ x(0) = (Src); \
+ RESTORE_CP(E); \
+ E = ADD_BYTE_OFFSET(E, (Deallocate)); \
+ SET_I((BeamInstr *) CallDest); \
Dispatch();
-#define MoveCallOnly(Src, Dest, CallDest) \
- (Dest) = (Src); \
- SET_I((BeamInstr *) CallDest); \
+#define MoveCallOnly(Src, CallDest) \
+ x(0) = (Src); \
+ SET_I((BeamInstr *) CallDest); \
Dispatch();
#define MoveJump(Src) \
@@ -613,58 +662,56 @@ void** beam_ops;
SET_I((BeamInstr *) Arg(0)); \
Goto(*I);
-#define GetList(Src, H, T) do { \
- Eterm* tmp_ptr = list_val(Src); \
- H = CAR(tmp_ptr); \
- T = CDR(tmp_ptr); } while (0)
-
-#define GetTupleElement(Src, Element, Dest) \
- do { \
- tmp_arg1 = (Eterm) COMPRESS_POINTER(((unsigned char *) tuple_val(Src)) + \
- (Element)); \
- (Dest) = (*(Eterm *) EXPAND_POINTER(tmp_arg1)); \
- } while (0)
-
-#define ExtractNextElement(Dest) \
- tmp_arg1 += sizeof(Eterm); \
- (Dest) = (* (Eterm *) (((unsigned char *) EXPAND_POINTER(tmp_arg1))))
-
-#define ExtractNextElement2(Dest) \
- do { \
- Eterm* ene_dstp = &(Dest); \
- ene_dstp[0] = ((Eterm *) EXPAND_POINTER(tmp_arg1))[1]; \
- ene_dstp[1] = ((Eterm *) EXPAND_POINTER(tmp_arg1))[2]; \
- tmp_arg1 += sizeof(Eterm) + sizeof(Eterm); \
+#define GetList(Src, H, T) \
+ do { \
+ Eterm* tmp_ptr = list_val(Src); \
+ Eterm hd, tl; \
+ hd = CAR(tmp_ptr); \
+ tl = CDR(tmp_ptr); \
+ H = hd; T = tl; \
} while (0)
-#define ExtractNextElement3(Dest) \
- do { \
- Eterm* ene_dstp = &(Dest); \
- ene_dstp[0] = ((Eterm *) EXPAND_POINTER(tmp_arg1))[1]; \
- ene_dstp[1] = ((Eterm *) EXPAND_POINTER(tmp_arg1))[2]; \
- ene_dstp[2] = ((Eterm *) EXPAND_POINTER(tmp_arg1))[3]; \
- tmp_arg1 += 3*sizeof(Eterm); \
+#define GetTupleElement(Src, Element, Dest) \
+ do { \
+ Eterm* src; \
+ src = ADD_BYTE_OFFSET(tuple_val(Src), (Element)); \
+ (Dest) = *src; \
} while (0)
-#define ExtractNextElement4(Dest) \
- do { \
- Eterm* ene_dstp = &(Dest); \
- ene_dstp[0] = ((Eterm *) EXPAND_POINTER(tmp_arg1))[1]; \
- ene_dstp[1] = ((Eterm *) EXPAND_POINTER(tmp_arg1))[2]; \
- ene_dstp[2] = ((Eterm *) EXPAND_POINTER(tmp_arg1))[3]; \
- ene_dstp[3] = ((Eterm *) EXPAND_POINTER(tmp_arg1))[4]; \
- tmp_arg1 += 4*sizeof(Eterm); \
+#define GetTupleElement2(Src, Element, Dest) \
+ do { \
+ Eterm* src; \
+ Eterm* dst; \
+ Eterm E1, E2; \
+ src = ADD_BYTE_OFFSET(tuple_val(Src), (Element)); \
+ dst = &(Dest); \
+ E1 = src[0]; \
+ E2 = src[1]; \
+ dst[0] = E1; \
+ dst[1] = E2; \
} while (0)
-#define ExtractElement(Element, Dest) \
- do { \
- tmp_arg1 += (Element); \
- (Dest) = (* (Eterm *) EXPAND_POINTER(tmp_arg1)); \
+#define GetTupleElement3(Src, Element, Dest) \
+ do { \
+ Eterm* src; \
+ Eterm* dst; \
+ Eterm E1, E2, E3; \
+ src = ADD_BYTE_OFFSET(tuple_val(Src), (Element)); \
+ dst = &(Dest); \
+ E1 = src[0]; \
+ E2 = src[1]; \
+ E3 = src[2]; \
+ dst[0] = E1; \
+ dst[1] = E2; \
+ dst[2] = E3; \
} while (0)
#define EqualImmed(X, Y, Action) if (X != Y) { Action; }
#define NotEqualImmed(X, Y, Action) if (X == Y) { Action; }
#define EqualExact(X, Y, Action) if (!EQ(X,Y)) { Action; }
+#define NotEqualExact(X, Y, Action) if (EQ(X,Y)) { Action; }
+#define Equal(X, Y, Action) if (!CMP_EQ(X,Y)) { Action; }
+#define NotEqual(X, Y, Action) if (!CMP_NE(X,Y)) { Action; }
#define IsLessThan(X, Y, Action) if (CMP_GE(X, Y)) { Action; }
#define IsGreaterEqual(X, Y, Action) if (CMP_LT(X, Y)) { Action; }
@@ -690,18 +737,26 @@ void** beam_ops;
if (is_not_list(Src)) { Fail; } \
A(Need, Alive)
-#define IsNonemptyListTestHeap(Src, Need, Alive, Fail) \
- if (is_not_list(Src)) { Fail; } \
+#define IsNonemptyListTestHeap(Need, Alive, Fail) \
+ if (is_not_list(x(0))) { Fail; } \
TestHeap(Need, Alive)
+#define IsNonemptyListGetList(Src, H, T, Fail) \
+ if (is_not_list(Src)) { \
+ Fail; \
+ } else { \
+ Eterm* tmp_ptr = list_val(Src); \
+ Eterm hd, tl; \
+ hd = CAR(tmp_ptr); \
+ tl = CDR(tmp_ptr); \
+ H = hd; T = tl; \
+ }
+
#define IsTuple(X, Action) if (is_not_tuple(X)) Action
-#define IsArity(Pointer, Arity, Fail) \
- if (*(Eterm *) \
- EXPAND_POINTER(tmp_arg1 = (Eterm) \
- COMPRESS_POINTER(tuple_val(Pointer))) != (Arity)) \
- { \
- Fail; \
+#define IsArity(Pointer, Arity, Fail) \
+ if (*tuple_val(Pointer) != (Arity)) { \
+ Fail; \
}
#define IsMap(Src, Fail) if (!is_map(Src)) { Fail; }
@@ -738,15 +793,21 @@ void** beam_ops;
} \
} while (0)
-#define IsTupleOfArity(Src, Arity, Fail) \
- do { \
- if (is_not_tuple(Src) || \
- *(Eterm *) \
- EXPAND_POINTER(tmp_arg1 = \
- (Eterm) COMPRESS_POINTER(tuple_val(Src))) != Arity) { \
- Fail; \
- } \
+#ifdef DEBUG
+#define IsTupleOfArity(Src, Arityval, Fail) \
+ do { \
+ if (!(is_tuple(Src) && *tuple_val(Src) == Arityval)) { \
+ Fail; \
+ } \
} while (0)
+#else
+#define IsTupleOfArity(Src, Arityval, Fail) \
+ do { \
+ if (!(is_boxed(Src) && *tuple_val(Src) == Arityval)) { \
+ Fail; \
+ } \
+ } while (0)
+#endif
#define IsBoolean(X, Fail) if ((X) != am_true && (X) != am_false) { Fail; }
@@ -756,7 +817,7 @@ void** beam_ops;
#define IsBitstring(Src, Fail) \
if (is_not_binary(Src)) { Fail; }
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
#define BsSafeMul(A, B, Fail, Target) \
do { Uint64 _res = (A) * (B); \
if (_res / B != A) { Fail; } \
@@ -773,6 +834,7 @@ void** beam_ops;
#define BsGetFieldSize(Bits, Unit, Fail, Target) \
do { \
Sint _signed_size; Uint _uint_size; \
+ Uint temp_bits; \
if (is_small(Bits)) { \
_signed_size = signed_val(Bits); \
if (_signed_size < 0) { Fail; } \
@@ -787,6 +849,7 @@ void** beam_ops;
#define BsGetUncheckedFieldSize(Bits, Unit, Fail, Target) \
do { \
Sint _signed_size; Uint _uint_size; \
+ Uint temp_bits; \
if (is_small(Bits)) { \
_signed_size = signed_val(Bits); \
if (_signed_size < 0) { Fail; } \
@@ -998,23 +1061,17 @@ init_emulator(void)
*/
#if defined(__GNUC__) && defined(sparc) && !defined(DEBUG)
-# define REG_x0 asm("%l0")
# define REG_xregs asm("%l1")
# define REG_htop asm("%l2")
# define REG_stop asm("%l3")
# define REG_I asm("%l4")
# define REG_fcalls asm("%l5")
-# define REG_tmp_arg1 asm("%l6")
-# define REG_tmp_arg2 asm("%l7")
#else
-# define REG_x0
# define REG_xregs
# define REG_htop
# define REG_stop
# define REG_I
# define REG_fcalls
-# define REG_tmp_arg1
-# define REG_tmp_arg2
#endif
#ifdef USE_VM_PROBES
@@ -1132,11 +1189,6 @@ void process_main(void)
ERTS_DECLARE_DUMMY(Eterm pid);
#endif
- /*
- * X register zero; also called r(0)
- */
- register Eterm x0 REG_x0 = NIL;
-
/* Pointer to X registers: x(1)..x(N); reg[0] is used when doing GC,
* in all other cases x0 is used.
*/
@@ -1164,17 +1216,6 @@ void process_main(void)
register Sint FCALLS REG_fcalls = 0;
/*
- * Temporaries used for picking up arguments for instructions.
- */
- register Eterm tmp_arg1 REG_tmp_arg1 = NIL;
- register Eterm tmp_arg2 REG_tmp_arg2 = NIL;
-#if HEAP_ON_C_STACK
- Eterm tmp_big[2]; /* Temporary buffer for small bignums if HEAP_ON_C_STACK. */
-#else
- Eterm *tmp_big; /* Temporary buffer for small bignums if !HEAP_ON_C_STACK. */
-#endif
-
- /*
* X registers and floating point registers are located in
* scheduler specific data.
*/
@@ -1185,8 +1226,6 @@ void process_main(void)
*/
int neg_o_reds = 0;
- Eterm (*arith_func)(Process* p, Eterm* reg, Uint live);
-
#ifdef ERTS_OPCODE_COUNTER_SUPPORT
static void* counting_opcodes[] = { DEFINE_COUNTING_OPCODES };
#else
@@ -1197,8 +1236,6 @@ void process_main(void)
#endif
#endif
- Uint temp_bits; /* Temporary used by BsSkipBits2 & BsGetInteger2 */
-
Eterm pt_arity; /* Used by do_put_tuple */
Uint64 start_time = 0; /* Monitor long schedule */
@@ -1247,9 +1284,6 @@ void process_main(void)
PROCESS_MAIN_CHK_LOCKS(c_p);
ERTS_SMP_UNREQ_PROC_MAIN_LOCK(c_p);
-#if HALFWORD_HEAP
- ASSERT(erts_get_scheduler_data()->num_tmp_heap_used == 0);
-#endif
ERTS_VERIFY_UNUSED_TEMP_ALLOC(c_p);
c_p = schedule(c_p, reds_used);
ERTS_VERIFY_UNUSED_TEMP_ALLOC(c_p);
@@ -1267,9 +1301,6 @@ void process_main(void)
reg = ERTS_PROC_GET_SCHDATA(c_p)->x_reg_array;
freg = ERTS_PROC_GET_SCHDATA(c_p)->f_reg_array;
-#if !HEAP_ON_C_STACK
- tmp_big = ERTS_PROC_GET_SCHDATA(c_p)->beam_emu_tmp_heap;
-#endif
ERL_BITS_RELOAD_STATEP(c_p);
{
int reds;
@@ -1278,7 +1309,7 @@ void process_main(void)
int i;
argp = c_p->arg_reg;
- for (i = c_p->arity - 1; i > 0; i--) {
+ for (i = c_p->arity - 1; i >= 0; i--) {
reg[i] = argp[i];
CHECK_TERM(reg[i]);
}
@@ -1302,12 +1333,6 @@ void process_main(void)
}
next = (BeamInstr *) *I;
- r(0) = c_p->arg_reg[0];
-#ifdef HARDDEBUG
- if (c_p->arity > 0) {
- CHECK_TERM(r(0));
- }
-#endif
SWAPIN;
ASSERT(VALID_INSTR(next));
@@ -1346,26 +1371,24 @@ void process_main(void)
#endif
#include "beam_hot.h"
-#define STORE_ARITH_RESULT(res) StoreBifResult(2, (res));
-#define ARITH_FUNC(name) erts_gc_##name
-
{
Eterm increment_reg_val;
Eterm increment_val;
Uint live;
Eterm result;
- OpCase(i_increment_yIId):
- increment_reg_val = yb(Arg(0));
+ OpCase(i_increment_rIId):
+ increment_reg_val = x(0);
+ I--;
goto do_increment;
OpCase(i_increment_xIId):
increment_reg_val = xb(Arg(0));
goto do_increment;
- OpCase(i_increment_rIId):
- increment_reg_val = r(0);
- I--;
+ OpCase(i_increment_yIId):
+ increment_reg_val = yb(Arg(0));
+ goto do_increment;
do_increment:
increment_val = Arg(1);
@@ -1374,229 +1397,133 @@ void process_main(void)
ASSERT(MY_IS_SSMALL(i) == IS_SSMALL(i));
if (MY_IS_SSMALL(i)) {
result = make_small(i);
- store_result:
StoreBifResult(3, result);
}
}
live = Arg(2);
SWAPOUT;
- reg[0] = r(0);
reg[live] = increment_reg_val;
reg[live+1] = make_small(increment_val);
result = erts_gc_mixed_plus(c_p, reg, live);
- r(0) = reg[0];
SWAPIN;
ERTS_HOLE_CHECK(c_p);
if (is_value(result)) {
- goto store_result;
+ StoreBifResult(3, result);
}
ASSERT(c_p->freason != BADMATCH || is_value(c_p->fvalue));
goto find_func_info;
}
-#define DO_BIG_ARITH(Func,Arg1,Arg2) \
- do { \
- Uint live = Arg(1); \
- SWAPOUT; \
- reg[0] = r(0); \
- reg[live] = (Arg1); \
- reg[live+1] = (Arg2); \
- result = (Func)(c_p, reg, live); \
- r(0) = reg[0]; \
- SWAPIN; \
- ERTS_HOLE_CHECK(c_p); \
- if (is_value(result)) { \
- StoreBifResult(4,result); \
- } \
- goto lb_Cl_error; \
- } while(0)
+#define DO_OUTLINED_ARITH_2(name, Op1, Op2) \
+ do { \
+ Eterm result; \
+ Uint live = Arg(1); \
+ \
+ SWAPOUT; \
+ reg[live] = Op1; \
+ reg[live+1] = Op2; \
+ result = erts_gc_##name(c_p, reg, live); \
+ SWAPIN; \
+ ERTS_HOLE_CHECK(c_p); \
+ if (is_value(result)) { \
+ StoreBifResult(4, result); \
+ } \
+ goto lb_Cl_error; \
+ } while (0)
- OpCase(i_plus_jIxxd):
{
+ Eterm PlusOp1, PlusOp2;
Eterm result;
- if (is_both_small(xb(Arg(2)), xb(Arg(3)))) {
- Sint i = signed_val(xb(Arg(2))) + signed_val(xb(Arg(3)));
+ OpCase(i_plus_jIxxd):
+ PlusOp1 = xb(Arg(2));
+ PlusOp2 = xb(Arg(3));
+ goto do_plus;
+
+ OpCase(i_plus_jIxyd):
+ PlusOp1 = xb(Arg(2));
+ PlusOp2 = yb(Arg(3));
+ goto do_plus;
+
+ OpCase(i_plus_jIssd):
+ GetArg2(2, PlusOp1, PlusOp2);
+ goto do_plus;
+
+ do_plus:
+ if (is_both_small(PlusOp1, PlusOp2)) {
+ Sint i = signed_val(PlusOp1) + signed_val(PlusOp2);
ASSERT(MY_IS_SSMALL(i) == IS_SSMALL(i));
if (MY_IS_SSMALL(i)) {
result = make_small(i);
StoreBifResult(4, result);
}
}
- DO_BIG_ARITH(ARITH_FUNC(mixed_plus), xb(Arg(2)), xb(Arg(3)));
+ DO_OUTLINED_ARITH_2(mixed_plus, PlusOp1, PlusOp2);
}
- OpCase(i_plus_jId):
{
+ Eterm MinusOp1, MinusOp2;
Eterm result;
- if (is_both_small(tmp_arg1, tmp_arg2)) {
- Sint i = signed_val(tmp_arg1) + signed_val(tmp_arg2);
- ASSERT(MY_IS_SSMALL(i) == IS_SSMALL(i));
- if (MY_IS_SSMALL(i)) {
- result = make_small(i);
- STORE_ARITH_RESULT(result);
- }
- }
- arith_func = ARITH_FUNC(mixed_plus);
- goto do_big_arith2;
- }
-
OpCase(i_minus_jIxxd):
- {
- Eterm result;
-
- if (is_both_small(xb(Arg(2)), xb(Arg(3)))) {
- Sint i = signed_val(xb(Arg(2))) - signed_val(xb(Arg(3)));
- ASSERT(MY_IS_SSMALL(i) == IS_SSMALL(i));
- if (MY_IS_SSMALL(i)) {
- result = make_small(i);
- StoreBifResult(4, result);
- }
- }
- DO_BIG_ARITH(ARITH_FUNC(mixed_minus), xb(Arg(2)), xb(Arg(3)));
- }
+ MinusOp1 = xb(Arg(2));
+ MinusOp2 = xb(Arg(3));
+ goto do_minus;
- OpCase(i_minus_jId):
- {
- Eterm result;
+ OpCase(i_minus_jIssd):
+ GetArg2(2, MinusOp1, MinusOp2);
+ goto do_minus;
- if (is_both_small(tmp_arg1, tmp_arg2)) {
- Sint i = signed_val(tmp_arg1) - signed_val(tmp_arg2);
+ do_minus:
+ if (is_both_small(MinusOp1, MinusOp2)) {
+ Sint i = signed_val(MinusOp1) - signed_val(MinusOp2);
ASSERT(MY_IS_SSMALL(i) == IS_SSMALL(i));
if (MY_IS_SSMALL(i)) {
result = make_small(i);
- STORE_ARITH_RESULT(result);
+ StoreBifResult(4, result);
}
}
- arith_func = ARITH_FUNC(mixed_minus);
- goto do_big_arith2;
+ DO_OUTLINED_ARITH_2(mixed_minus, MinusOp1, MinusOp2);
}
- OpCase(i_is_lt_f):
- if (CMP_GE(tmp_arg1, tmp_arg2)) {
- ClauseFail();
- }
- Next(1);
-
- OpCase(i_is_ge_f):
- if (CMP_LT(tmp_arg1, tmp_arg2)) {
- ClauseFail();
- }
- Next(1);
-
- OpCase(i_is_eq_f):
- if (CMP_NE(tmp_arg1, tmp_arg2)) {
- ClauseFail();
- }
- Next(1);
-
- OpCase(i_is_ne_f):
- if (CMP_EQ(tmp_arg1, tmp_arg2)) {
- ClauseFail();
- }
- Next(1);
-
- OpCase(i_is_eq_exact_f):
- if (!EQ(tmp_arg1, tmp_arg2)) {
- ClauseFail();
- }
- Next(1);
-
{
Eterm is_eq_exact_lit_val;
- OpCase(i_is_eq_exact_literal_xfc):
- is_eq_exact_lit_val = xb(Arg(0));
- I++;
+ OpCase(i_is_eq_exact_literal_fxc):
+ is_eq_exact_lit_val = xb(Arg(1));
goto do_is_eq_exact_literal;
- OpCase(i_is_eq_exact_literal_yfc):
- is_eq_exact_lit_val = yb(Arg(0));
- I++;
+ OpCase(i_is_eq_exact_literal_fyc):
+ is_eq_exact_lit_val = yb(Arg(1));
goto do_is_eq_exact_literal;
- OpCase(i_is_eq_exact_literal_rfc):
- is_eq_exact_lit_val = r(0);
-
do_is_eq_exact_literal:
- if (!eq(Arg(1), is_eq_exact_lit_val)) {
+ if (!eq(Arg(2), is_eq_exact_lit_val)) {
ClauseFail();
}
- Next(2);
+ Next(3);
}
{
Eterm is_ne_exact_lit_val;
- OpCase(i_is_ne_exact_literal_xfc):
- is_ne_exact_lit_val = xb(Arg(0));
- I++;
+ OpCase(i_is_ne_exact_literal_fxc):
+ is_ne_exact_lit_val = xb(Arg(1));
goto do_is_ne_exact_literal;
- OpCase(i_is_ne_exact_literal_yfc):
- is_ne_exact_lit_val = yb(Arg(0));
- I++;
+ OpCase(i_is_ne_exact_literal_fyc):
+ is_ne_exact_lit_val = yb(Arg(1));
goto do_is_ne_exact_literal;
- OpCase(i_is_ne_exact_literal_rfc):
- is_ne_exact_lit_val = r(0);
-
do_is_ne_exact_literal:
- if (eq(Arg(1), is_ne_exact_lit_val)) {
+ if (eq(Arg(2), is_ne_exact_lit_val)) {
ClauseFail();
}
- Next(2);
+ Next(3);
}
- OpCase(move_window3_xxxy): {
- BeamInstr *next;
- Eterm xt0, xt1, xt2;
- Eterm *y = (Eterm *)(((unsigned char *)E) + (Arg(3)));
- PreFetch(4, next);
- xt0 = xb(Arg(0));
- xt1 = xb(Arg(1));
- xt2 = xb(Arg(2));
- y[0] = xt0;
- y[1] = xt1;
- y[2] = xt2;
- NextPF(4, next);
- }
- OpCase(move_window4_xxxxy): {
- BeamInstr *next;
- Eterm xt0, xt1, xt2, xt3;
- Eterm *y = (Eterm *)(((unsigned char *)E) + (Arg(4)));
- PreFetch(5, next);
- xt0 = xb(Arg(0));
- xt1 = xb(Arg(1));
- xt2 = xb(Arg(2));
- xt3 = xb(Arg(3));
- y[0] = xt0;
- y[1] = xt1;
- y[2] = xt2;
- y[3] = xt3;
- NextPF(5, next);
- }
- OpCase(move_window5_xxxxxy): {
- BeamInstr *next;
- Eterm xt0, xt1, xt2, xt3, xt4;
- Eterm *y = (Eterm *)(((unsigned char *)E) + (Arg(5)));
- PreFetch(6, next);
- xt0 = xb(Arg(0));
- xt1 = xb(Arg(1));
- xt2 = xb(Arg(2));
- xt3 = xb(Arg(3));
- xt4 = xb(Arg(4));
- y[0] = xt0;
- y[1] = xt1;
- y[2] = xt2;
- y[3] = xt3;
- y[4] = xt4;
- NextPF(6, next);
- }
-
- OpCase(i_move_call_only_fcr): {
+ OpCase(i_move_call_only_fc): {
r(0) = Arg(1);
}
/* FALL THROUGH */
@@ -1606,7 +1533,7 @@ void process_main(void)
Dispatch();
}
- OpCase(i_move_call_last_fPcr): {
+ OpCase(i_move_call_last_fPc): {
r(0) = Arg(2);
}
/* FALL THROUGH */
@@ -1618,7 +1545,7 @@ void process_main(void)
Dispatch();
}
- OpCase(i_move_call_crf): {
+ OpCase(i_move_call_cf): {
r(0) = Arg(0);
I++;
}
@@ -1630,7 +1557,7 @@ void process_main(void)
Dispatch();
}
- OpCase(i_move_call_ext_last_ePcr): {
+ OpCase(i_move_call_ext_last_ePc): {
r(0) = Arg(2);
}
/* FALL THROUGH */
@@ -1646,7 +1573,7 @@ void process_main(void)
DTRACE_GLOBAL_CALL_FROM_EXPORT(c_p, Arg(0));
Dispatchx();
- OpCase(i_move_call_ext_cre): {
+ OpCase(i_move_call_ext_ce): {
r(0) = Arg(0);
I++;
}
@@ -1656,7 +1583,7 @@ void process_main(void)
DTRACE_GLOBAL_CALL_FROM_EXPORT(c_p, Arg(0));
Dispatchx();
- OpCase(i_move_call_ext_only_ecr): {
+ OpCase(i_move_call_ext_only_ec): {
r(0) = Arg(1);
}
/* FALL THROUGH */
@@ -1722,7 +1649,6 @@ void process_main(void)
PRE_BIF_SWAPOUT(c_p);
c_p->fcalls = FCALLS - 1;
- reg[0] = r(0);
result = erl_send(c_p, r(0), x(1));
PreFetch(0, next);
ERTS_VERIFY_UNUSED_TEMP_ALLOC(c_p);
@@ -1730,7 +1656,6 @@ void process_main(void)
PROCESS_MAIN_CHK_LOCKS(c_p);
if (c_p->mbuf || MSO(c_p).overhead >= BIN_VHEAP_SZ(c_p)) {
result = erts_gc_after_bif_call(c_p, result, reg, 2);
- r(0) = reg[0];
E = c_p->stop;
}
HTOP = HEAP_TOP(c_p);
@@ -1743,7 +1668,6 @@ void process_main(void)
SET_CP(c_p, I+1);
SET_I(c_p->i);
SWAPIN;
- r(0) = reg[0];
Dispatch();
}
goto find_func_info;
@@ -1753,29 +1677,23 @@ void process_main(void)
Eterm element_index;
Eterm element_tuple;
- OpCase(i_element_xjsd):
- element_tuple = xb(Arg(0));
- I++;
+ OpCase(i_element_jxsd):
+ element_tuple = xb(Arg(1));
goto do_element;
- OpCase(i_element_yjsd):
- element_tuple = yb(Arg(0));
- I++;
+ OpCase(i_element_jysd):
+ element_tuple = yb(Arg(1));
goto do_element;
- OpCase(i_element_rjsd):
- element_tuple = r(0);
- /* Fall through */
-
do_element:
- GetArg1(1, element_index);
+ GetArg1(2, element_index);
if (is_small(element_index) && is_tuple(element_tuple)) {
Eterm* tp = tuple_val(element_tuple);
if ((signed_val(element_index) >= 1) &&
(signed_val(element_index) <= arityval(*tp))) {
Eterm result = tp[signed_val(element_index)];
- StoreBifResult(2, result);
+ StoreBifResult(3, result);
}
}
}
@@ -1789,29 +1707,24 @@ void process_main(void)
{
Eterm fast_element_tuple;
- OpCase(i_fast_element_rjId):
- fast_element_tuple = r(0);
+ OpCase(i_fast_element_jxId):
+ fast_element_tuple = xb(Arg(1));
+ goto do_fast_element;
+
+ OpCase(i_fast_element_jyId):
+ fast_element_tuple = yb(Arg(1));
+ goto do_fast_element;
do_fast_element:
if (is_tuple(fast_element_tuple)) {
Eterm* tp = tuple_val(fast_element_tuple);
- Eterm pos = Arg(1); /* Untagged integer >= 1 */
+ Eterm pos = Arg(2); /* Untagged integer >= 1 */
if (pos <= arityval(*tp)) {
Eterm result = tp[pos];
- StoreBifResult(2, result);
+ StoreBifResult(3, result);
}
}
goto badarg;
-
- OpCase(i_fast_element_xjId):
- fast_element_tuple = xb(Arg(0));
- I++;
- goto do_fast_element;
-
- OpCase(i_fast_element_yjId):
- fast_element_tuple = yb(Arg(0));
- I++;
- goto do_fast_element;
}
OpCase(catch_yf):
@@ -1917,7 +1830,7 @@ void process_main(void)
* Pick up the next message and place it in x(0).
* If no message, jump to a wait or wait_timeout instruction.
*/
- OpCase(i_loop_rec_fr):
+ OpCase(i_loop_rec_f):
{
BeamInstr *next;
ErlMessage* msgp;
@@ -1951,13 +1864,11 @@ void process_main(void)
ErtsMoveMsgAttachmentIntoProc(msgp, c_p, E, HTOP, FCALLS,
{
SWAPOUT;
- reg[0] = r(0);
PROCESS_MAIN_CHK_LOCKS(c_p);
},
{
ERTS_VERIFY_UNUSED_TEMP_ALLOC(c_p);
PROCESS_MAIN_CHK_LOCKS(c_p);
- r(0) = reg[0];
SWAPIN;
});
if (is_non_value(ERL_MESSAGE_TERM(msgp))) {
@@ -2131,8 +2042,6 @@ void process_main(void)
* c_p->def_arg_reg[0]. Note that it is safe to use this
* location because there are no living x registers in
* a receive statement.
- * Note that for the halfword emulator, the two first elements
- * of the array are used.
*/
BeamInstr** pi = (BeamInstr**) c_p->def_arg_reg;
*pi = I+3;
@@ -2249,10 +2158,6 @@ void process_main(void)
select_val2 = xb(Arg(0));
goto do_select_tuple_arity2;
- OpCase(i_select_tuple_arity2_rfAAff):
- select_val2 = r(0);
- I--;
-
do_select_tuple_arity2:
if (is_not_tuple(select_val2)) {
goto select_val2_fail;
@@ -2268,10 +2173,6 @@ void process_main(void)
select_val2 = xb(Arg(0));
goto do_select_val2;
- OpCase(i_select_val2_rfccff):
- select_val2 = r(0);
- I--;
-
do_select_val2:
if (select_val2 == Arg(2)) {
I += 3;
@@ -2295,10 +2196,6 @@ void process_main(void)
select_val = yb(Arg(0));
goto do_select_tuple_arity;
- OpCase(i_select_tuple_arity_rfI):
- select_val = r(0);
- I--;
-
do_select_tuple_arity:
if (is_tuple(select_val)) {
select_val = *tuple_val(select_val);
@@ -2315,10 +2212,6 @@ void process_main(void)
select_val = yb(Arg(0));
goto do_linear_search;
- OpCase(i_select_val_lins_rfI):
- select_val = r(0);
- I--;
-
do_linear_search: {
BeamInstr *vs = &Arg(3);
int ix = 0;
@@ -2345,10 +2238,6 @@ void process_main(void)
select_val = yb(Arg(0));
goto do_binary_search;
- OpCase(i_select_val_bins_rfI):
- select_val = r(0);
- I--;
-
do_binary_search:
{
struct Pairs {
@@ -2409,10 +2298,6 @@ void process_main(void)
jump_on_val_zero_index = xb(Arg(0));
goto do_jump_on_val_zero_index;
- OpCase(i_jump_on_val_zero_rfI):
- jump_on_val_zero_index = r(0);
- I--;
-
do_jump_on_val_zero_index:
if (is_small(jump_on_val_zero_index)) {
jump_on_val_zero_index = signed_val(jump_on_val_zero_index);
@@ -2437,10 +2322,6 @@ void process_main(void)
jump_on_val_index = xb(Arg(0));
goto do_jump_on_val_index;
- OpCase(i_jump_on_val_rfII):
- jump_on_val_index = r(0);
- I--;
-
do_jump_on_val_index:
if (is_small(jump_on_val_index)) {
jump_on_val_index = (Uint) (signed_val(jump_on_val_index) - Arg(3));
@@ -2460,15 +2341,12 @@ void process_main(void)
do {
Eterm term = *I++;
- switch (term & _TAG_IMMED1_MASK) {
- case (R_REG_DEF << _TAG_PRIMARY_SIZE) | TAG_PRIMARY_HEADER:
- *hp++ = r(0);
- break;
- case (X_REG_DEF << _TAG_PRIMARY_SIZE) | TAG_PRIMARY_HEADER:
- *hp++ = x(term >> _TAG_IMMED1_SIZE);
+ switch (loader_tag(term)) {
+ case LOADER_X_REG:
+ *hp++ = x(loader_x_reg_index(term));
break;
- case (Y_REG_DEF << _TAG_PRIMARY_SIZE) | TAG_PRIMARY_HEADER:
- *hp++ = y(term >> _TAG_IMMED1_SIZE);
+ case LOADER_Y_REG:
+ *hp++ = y(loader_y_reg_index(term));
break;
default:
*hp++ = term;
@@ -2482,31 +2360,26 @@ void process_main(void)
OpCase(new_map_dII): {
Eterm res;
- x(0) = r(0);
SWAPOUT;
res = new_map(c_p, reg, I-1);
SWAPIN;
- r(0) = x(0);
StoreResult(res, Arg(0));
Next(3+Arg(2));
}
-#define PUT_TERM_REG(term, desc) \
-do { \
- switch ((desc) & _TAG_IMMED1_MASK) { \
- case (R_REG_DEF << _TAG_PRIMARY_SIZE) | TAG_PRIMARY_HEADER: \
- r(0) = (term); \
- break; \
- case (X_REG_DEF << _TAG_PRIMARY_SIZE) | TAG_PRIMARY_HEADER: \
- x((desc) >> _TAG_IMMED1_SIZE) = (term); \
- break; \
- case (Y_REG_DEF << _TAG_PRIMARY_SIZE) | TAG_PRIMARY_HEADER: \
- y((desc) >> _TAG_IMMED1_SIZE) = (term); \
- break; \
- default: \
- ASSERT(0); \
- break; \
- } \
+#define PUT_TERM_REG(term, desc) \
+do { \
+ switch (loader_tag(desc)) { \
+ case LOADER_X_REG: \
+ x(loader_x_reg_index(desc)) = (term); \
+ break; \
+ case LOADER_Y_REG: \
+ y(loader_y_reg_index(desc)) = (term); \
+ break; \
+ default: \
+ ASSERT(0); \
+ break; \
+ } \
} while(0)
OpCase(i_get_map_elements_fsI): {
@@ -2577,12 +2450,10 @@ do { \
Eterm map;
GetArg1(1, map);
- x(0) = r(0);
SWAPOUT;
res = update_map_assoc(c_p, reg, map, I);
SWAPIN;
if (is_value(res)) {
- r(0) = x(0);
StoreResult(res, Arg(2));
Next(5+Arg(4));
} else {
@@ -2601,12 +2472,10 @@ do { \
Eterm map;
GetArg1(1, map);
- x(0) = r(0);
SWAPOUT;
res = update_map_exact(c_p, reg, map, I);
SWAPIN;
if (is_value(res)) {
- r(0) = x(0);
StoreResult(res, Arg(2));
Next(5+Arg(4));
} else {
@@ -2688,13 +2557,10 @@ do { \
{
typedef Eterm (*GcBifFunction)(Process*, Eterm*, Uint);
GcBifFunction bf;
- Eterm arg;
Eterm result;
Uint live = (Uint) Arg(3);
- GetArg1(2, arg);
- reg[0] = r(0);
- reg[live] = arg;
+ GetArg1(2, x(live));
bf = (GcBifFunction) Arg(1);
c_p->fcalls = FCALLS;
SWAPOUT;
@@ -2705,7 +2571,6 @@ do { \
ERTS_SMP_REQ_PROC_MAIN_LOCK(c_p);
PROCESS_MAIN_CHK_LOCKS(c_p);
SWAPIN;
- r(0) = reg[0];
ERTS_HOLE_CHECK(c_p);
FCALLS = c_p->fcalls;
if (is_value(result)) {
@@ -2715,12 +2580,12 @@ do { \
SET_I((BeamInstr *) Arg(0));
Goto(*I);
}
- reg[0] = arg;
+ x(0) = x(live);
I = handle_error(c_p, I, reg, translate_gc_bif((void *) bf));
goto post_error_handling;
}
- OpCase(i_gc_bif2_jIId): /* Note, one less parameter than the i_gc_bif1
+ OpCase(i_gc_bif2_jIIssd): /* Note, one less parameter than the i_gc_bif1
and i_gc_bif3 */
{
typedef Eterm (*GcBifFunction)(Process*, Eterm*, Uint);
@@ -2728,9 +2593,13 @@ do { \
Eterm result;
Uint live = (Uint) Arg(2);
- reg[0] = r(0);
- reg[live++] = tmp_arg1;
- reg[live] = tmp_arg2;
+ GetArg2(3, x(live), x(live+1));
+ /*
+ * XXX This calling convention does not make sense. 'live'
+ * should point out the first argument, not the second
+ * (i.e. 'live' should not be incremented below).
+ */
+ live++;
bf = (GcBifFunction) Arg(1);
c_p->fcalls = FCALLS;
SWAPOUT;
@@ -2741,35 +2610,37 @@ do { \
ERTS_SMP_REQ_PROC_MAIN_LOCK(c_p);
PROCESS_MAIN_CHK_LOCKS(c_p);
SWAPIN;
- r(0) = reg[0];
ERTS_HOLE_CHECK(c_p);
FCALLS = c_p->fcalls;
if (is_value(result)) {
- StoreBifResult(3, result);
+ StoreBifResult(5, result);
}
if (Arg(0) != 0) {
SET_I((BeamInstr *) Arg(0));
Goto(*I);
}
- reg[0] = tmp_arg1;
- reg[1] = tmp_arg2;
+ live--;
+ x(0) = x(live);
+ x(1) = x(live+1);
I = handle_error(c_p, I, reg, translate_gc_bif((void *) bf));
goto post_error_handling;
}
- OpCase(i_gc_bif3_jIsId):
+ OpCase(i_gc_bif3_jIIssd):
{
typedef Eterm (*GcBifFunction)(Process*, Eterm*, Uint);
GcBifFunction bf;
- Eterm arg;
Eterm result;
- Uint live = (Uint) Arg(3);
+ Uint live = (Uint) Arg(2);
- GetArg1(2, arg);
- reg[0] = r(0);
- reg[live++] = arg;
- reg[live++] = tmp_arg1;
- reg[live] = tmp_arg2;
+ x(live) = x(SCRATCH_X_REG);
+ GetArg2(3, x(live+1), x(live+2));
+ /*
+ * XXX This calling convention does not make sense. 'live'
+ * should point out the first argument, not the third
+ * (i.e. 'live' should not be incremented below).
+ */
+ live += 2;
bf = (GcBifFunction) Arg(1);
c_p->fcalls = FCALLS;
SWAPOUT;
@@ -2780,19 +2651,19 @@ do { \
ERTS_SMP_REQ_PROC_MAIN_LOCK(c_p);
PROCESS_MAIN_CHK_LOCKS(c_p);
SWAPIN;
- r(0) = reg[0];
ERTS_HOLE_CHECK(c_p);
FCALLS = c_p->fcalls;
if (is_value(result)) {
- StoreBifResult(4, result);
+ StoreBifResult(5, result);
}
if (Arg(0) != 0) {
SET_I((BeamInstr *) Arg(0));
Goto(*I);
}
- reg[0] = arg;
- reg[1] = tmp_arg1;
- reg[2] = tmp_arg2;
+ live -= 2;
+ x(0) = x(live);
+ x(1) = x(live+1);
+ x(2) = x(live+2);
I = handle_error(c_p, I, reg, translate_gc_bif((void *) bf));
goto post_error_handling;
}
@@ -2800,12 +2671,13 @@ do { \
/*
* Guards bifs and, or, xor in guards.
*/
- OpCase(i_bif2_fbd):
+ OpCase(i_bif2_fbssd):
{
- Eterm tmp_reg[2] = {tmp_arg1, tmp_arg2};
+ Eterm tmp_reg[2];
Eterm (*bf)(Process*, Eterm*);
Eterm result;
+ GetArg2(2, tmp_reg[0], tmp_reg[1]);
bf = (BifFunction) Arg(1);
c_p->fcalls = FCALLS;
PROCESS_MAIN_CHK_LOCKS(c_p);
@@ -2817,7 +2689,7 @@ do { \
ERTS_HOLE_CHECK(c_p);
FCALLS = c_p->fcalls;
if (is_value(result)) {
- StoreBifResult(2, result);
+ StoreBifResult(4, result);
}
SET_I((BeamInstr *) Arg(0));
Goto(*I);
@@ -2826,12 +2698,13 @@ do { \
/*
* Guards bifs and, or, xor, relational operators in body.
*/
- OpCase(i_bif2_body_bd):
+ OpCase(i_bif2_body_bssd):
{
- Eterm tmp_reg[2] = {tmp_arg1, tmp_arg2};
+ Eterm tmp_reg[2];
Eterm (*bf)(Process*, Eterm*);
Eterm result;
+ GetArg2(1, tmp_reg[0], tmp_reg[1]);
bf = (BifFunction) Arg(0);
PROCESS_MAIN_CHK_LOCKS(c_p);
ASSERT(!ERTS_PROC_IS_EXITING(c_p));
@@ -2842,10 +2715,10 @@ do { \
ERTS_HOLE_CHECK(c_p);
if (is_value(result)) {
ASSERT(!is_CP(result));
- StoreBifResult(1, result);
+ StoreBifResult(3, result);
}
- reg[0] = tmp_arg1;
- reg[1] = tmp_arg2;
+ reg[0] = tmp_reg[0];
+ reg[1] = tmp_reg[1];
SWAPOUT;
I = handle_error(c_p, I, reg, bf);
goto post_error_handling;
@@ -2869,7 +2742,6 @@ do { \
PreFetch(1, next);
ASSERT(!ERTS_PROC_IS_EXITING(c_p));
ERTS_VERIFY_UNUSED_TEMP_ALLOC(c_p);
- reg[0] = r(0);
result = (*bf)(c_p, reg, I);
ASSERT(!ERTS_PROC_IS_EXITING(c_p) || is_non_value(result));
ERTS_VERIFY_UNUSED_TEMP_ALLOC(c_p);
@@ -2891,7 +2763,6 @@ do { \
SET_CP(c_p, I+2);
SET_I(c_p->i);
SWAPIN;
- r(0) = reg[0];
Dispatch();
}
@@ -2907,111 +2778,81 @@ do { \
* Arithmetic operations.
*/
- OpCase(i_times_jId):
+ OpCase(i_times_jIssd):
{
- arith_func = ARITH_FUNC(mixed_times);
- goto do_big_arith2;
+ Eterm Op1, Op2;
+ GetArg2(2, Op1, Op2);
+ DO_OUTLINED_ARITH_2(mixed_times, Op1, Op2);
}
- OpCase(i_m_div_jId):
+ OpCase(i_m_div_jIssd):
{
- arith_func = ARITH_FUNC(mixed_div);
- goto do_big_arith2;
+ Eterm Op1, Op2;
+ GetArg2(2, Op1, Op2);
+ DO_OUTLINED_ARITH_2(mixed_div, Op1, Op2);
}
- OpCase(i_int_div_jId):
+ OpCase(i_int_div_jIssd):
{
- Eterm result;
+ Eterm Op1, Op2;
- if (tmp_arg2 == SMALL_ZERO) {
+ GetArg2(2, Op1, Op2);
+ if (Op2 == SMALL_ZERO) {
goto badarith;
- } else if (is_both_small(tmp_arg1, tmp_arg2)) {
- Sint ires = signed_val(tmp_arg1) / signed_val(tmp_arg2);
+ } else if (is_both_small(Op1, Op2)) {
+ Sint ires = signed_val(Op1) / signed_val(Op2);
if (MY_IS_SSMALL(ires)) {
- result = make_small(ires);
- STORE_ARITH_RESULT(result);
+ Eterm result = make_small(ires);
+ StoreBifResult(4, result);
}
}
- arith_func = ARITH_FUNC(int_div);
- goto do_big_arith2;
+ DO_OUTLINED_ARITH_2(int_div, Op1, Op2);
}
- OpCase(i_rem_jIxxd):
{
- Eterm result;
+ Eterm RemOp1, RemOp2;
- if (xb(Arg(3)) == SMALL_ZERO) {
- goto badarith;
- } else if (is_both_small(xb(Arg(2)), xb(Arg(3)))) {
- result = make_small(signed_val(xb(Arg(2))) % signed_val(xb(Arg(3))));
+ OpCase(i_rem_jIxxd):
+ RemOp1 = xb(Arg(2));
+ RemOp2 = xb(Arg(3));
+ goto do_rem;
+
+ OpCase(i_rem_jIssd):
+ GetArg2(2, RemOp1, RemOp2);
+ goto do_rem;
+
+ do_rem:
+ if (RemOp2 == SMALL_ZERO) {
+ goto badarith;
+ } else if (is_both_small(RemOp1, RemOp2)) {
+ Eterm result = make_small(signed_val(RemOp1) % signed_val(RemOp2));
StoreBifResult(4, result);
+ } else {
+ DO_OUTLINED_ARITH_2(int_rem, RemOp1, RemOp2);
}
- DO_BIG_ARITH(ARITH_FUNC(int_rem),xb(Arg(2)),xb(Arg(3)));
}
- OpCase(i_rem_jId):
{
- Eterm result;
-
- if (tmp_arg2 == SMALL_ZERO) {
- goto badarith;
- } else if (is_both_small(tmp_arg1, tmp_arg2)) {
- result = make_small(signed_val(tmp_arg1) % signed_val(tmp_arg2));
- STORE_ARITH_RESULT(result);
- } else {
- arith_func = ARITH_FUNC(int_rem);
- goto do_big_arith2;
- }
- }
+ Eterm BandOp1, BandOp2;
OpCase(i_band_jIxcd):
- {
- Eterm result;
+ BandOp1 = xb(Arg(2));
+ BandOp2 = Arg(3);
+ goto do_band;
+
+ OpCase(i_band_jIssd):
+ GetArg2(2, BandOp1, BandOp2);
+ goto do_band;
- if (is_both_small(xb(Arg(2)), Arg(3))) {
+ do_band:
+ if (is_both_small(BandOp1, BandOp2)) {
/*
* No need to untag -- TAG & TAG == TAG.
*/
- result = xb(Arg(2)) & Arg(3);
+ Eterm result = BandOp1 & BandOp2;
StoreBifResult(4, result);
}
- DO_BIG_ARITH(ARITH_FUNC(band),xb(Arg(2)),Arg(3));
- }
-
- OpCase(i_band_jId):
- {
- Eterm result;
-
- if (is_both_small(tmp_arg1, tmp_arg2)) {
- /*
- * No need to untag -- TAG & TAG == TAG.
- */
- result = tmp_arg1 & tmp_arg2;
- STORE_ARITH_RESULT(result);
- }
- arith_func = ARITH_FUNC(band);
- goto do_big_arith2;
- }
-
-#undef DO_BIG_ARITH
-
- do_big_arith2:
- {
- Eterm result;
- Uint live = Arg(1);
-
- SWAPOUT;
- reg[0] = r(0);
- reg[live] = tmp_arg1;
- reg[live+1] = tmp_arg2;
- result = arith_func(c_p, reg, live);
- r(0) = reg[0];
- SWAPIN;
- ERTS_HOLE_CHECK(c_p);
- if (is_value(result)) {
- STORE_ARITH_RESULT(result);
- }
- goto lb_Cl_error;
+ DO_OUTLINED_ARITH_2(band, BandOp1, BandOp2);
}
/*
@@ -3032,97 +2873,102 @@ do { \
goto find_func_info;
}
- OpCase(i_bor_jId):
+ OpCase(i_bor_jIssd):
{
- Eterm result;
+ Eterm Op1, Op2;
- if (is_both_small(tmp_arg1, tmp_arg2)) {
+ GetArg2(2, Op1, Op2);
+ if (is_both_small(Op1, Op2)) {
/*
* No need to untag -- TAG | TAG == TAG.
*/
- result = tmp_arg1 | tmp_arg2;
- STORE_ARITH_RESULT(result);
+ Eterm result = Op1 | Op2;
+ StoreBifResult(4, result);
}
- arith_func = ARITH_FUNC(bor);
- goto do_big_arith2;
+ DO_OUTLINED_ARITH_2(bor, Op1, Op2);
}
- OpCase(i_bxor_jId):
+ OpCase(i_bxor_jIssd):
{
- Eterm result;
+ Eterm Op1, Op2;
- if (is_both_small(tmp_arg1, tmp_arg2)) {
+ GetArg2(2, Op1, Op2);
+ if (is_both_small(Op1, Op2)) {
/*
* We could extract the tag from one argument, but a tag extraction
* could mean a shift. Therefore, play it safe here.
*/
- result = make_small(signed_val(tmp_arg1) ^ signed_val(tmp_arg2));
- STORE_ARITH_RESULT(result);
+ Eterm result = make_small(signed_val(Op1) ^ signed_val(Op2));
+ StoreBifResult(4, result);
}
- arith_func = ARITH_FUNC(bxor);
- goto do_big_arith2;
+ DO_OUTLINED_ARITH_2(bxor, Op1, Op2);
}
{
+ Eterm Op1, Op2;
Sint i;
Sint ires;
Eterm* bigp;
+ Eterm tmp_big[2];
- OpCase(i_bsr_jId):
- if (is_small(tmp_arg2)) {
- i = -signed_val(tmp_arg2);
- if (is_small(tmp_arg1)) {
+ OpCase(i_bsr_jIssd):
+ GetArg2(2, Op1, Op2);
+ if (is_small(Op2)) {
+ i = -signed_val(Op2);
+ if (is_small(Op1)) {
goto small_shift;
- } else if (is_big(tmp_arg1)) {
+ } else if (is_big(Op1)) {
if (i == 0) {
- StoreBifResult(2, tmp_arg1);
+ StoreBifResult(4, Op1);
}
goto big_shift;
}
- } else if (is_big(tmp_arg2)) {
+ } else if (is_big(Op2)) {
/*
* N bsr NegativeBigNum == N bsl MAX_SMALL
* N bsr PositiveBigNum == N bsl MIN_SMALL
*/
- tmp_arg2 = make_small(bignum_header_is_neg(*big_val(tmp_arg2)) ?
+ Op2 = make_small(bignum_header_is_neg(*big_val(Op2)) ?
MAX_SMALL : MIN_SMALL);
goto do_bsl;
}
goto badarith;
- OpCase(i_bsl_jId):
+ OpCase(i_bsl_jIssd):
+ GetArg2(2, Op1, Op2);
+
do_bsl:
- if (is_small(tmp_arg2)) {
- i = signed_val(tmp_arg2);
+ if (is_small(Op2)) {
+ i = signed_val(Op2);
- if (is_small(tmp_arg1)) {
+ if (is_small(Op1)) {
small_shift:
- ires = signed_val(tmp_arg1);
+ ires = signed_val(Op1);
if (i == 0 || ires == 0) {
- StoreBifResult(2, tmp_arg1);
+ StoreBifResult(4, Op1);
} else if (i < 0) { /* Right shift */
i = -i;
if (i >= SMALL_BITS-1) {
- tmp_arg1 = (ires < 0) ? SMALL_MINUS_ONE : SMALL_ZERO;
+ Op1 = (ires < 0) ? SMALL_MINUS_ONE : SMALL_ZERO;
} else {
- tmp_arg1 = make_small(ires >> i);
+ Op1 = make_small(ires >> i);
}
- StoreBifResult(2, tmp_arg1);
+ StoreBifResult(4, Op1);
} else if (i < SMALL_BITS-1) { /* Left shift */
if ((ires > 0 && ((~(Uint)0 << ((SMALL_BITS-1)-i)) & ires) == 0) ||
((~(Uint)0 << ((SMALL_BITS-1)-i)) & ~ires) == 0) {
- tmp_arg1 = make_small(ires << i);
- StoreBifResult(2, tmp_arg1);
+ Op1 = make_small(ires << i);
+ StoreBifResult(4, Op1);
}
}
- tmp_arg1 = small_to_big(ires, tmp_big);
+ Op1 = small_to_big(ires, tmp_big);
big_shift:
if (i > 0) { /* Left shift. */
- ires = big_size(tmp_arg1) + (i / D_EXP);
+ ires = big_size(Op1) + (i / D_EXP);
} else { /* Right shift. */
- ires = big_size(tmp_arg1);
+ ires = big_size(Op1);
if (ires <= (-i / D_EXP))
ires = 3; /* ??? */
else
@@ -3140,14 +2986,14 @@ do { \
c_p->freason = SYSTEM_LIMIT;
goto lb_Cl_error;
}
- TestHeapPreserve(ires+1, Arg(1), tmp_arg1);
+ TestHeapPreserve(ires+1, Arg(1), Op1);
bigp = HTOP;
- tmp_arg1 = big_lshift(tmp_arg1, i, bigp);
- if (is_big(tmp_arg1)) {
+ Op1 = big_lshift(Op1, i, bigp);
+ if (is_big(Op1)) {
HTOP += bignum_header_arity(*HTOP) + 1;
}
HEAP_SPACE_VERIFIED(0);
- if (is_nil(tmp_arg1)) {
+ if (is_nil(Op1)) {
/*
* This result must have been only slight larger
* than allowed since it wasn't caught by the
@@ -3157,25 +3003,25 @@ do { \
goto lb_Cl_error;
}
ERTS_HOLE_CHECK(c_p);
- StoreBifResult(2, tmp_arg1);
+ StoreBifResult(4, Op1);
}
- } else if (is_big(tmp_arg1)) {
+ } else if (is_big(Op1)) {
if (i == 0) {
- StoreBifResult(2, tmp_arg1);
+ StoreBifResult(4, Op1);
}
goto big_shift;
}
- } else if (is_big(tmp_arg2)) {
- if (bignum_header_is_neg(*big_val(tmp_arg2))) {
+ } else if (is_big(Op2)) {
+ if (bignum_header_is_neg(*big_val(Op2))) {
/*
* N bsl NegativeBigNum is either 0 or -1, depending on
* the sign of N. Since we don't believe this case
* is common, do the calculation with the minimum
* amount of code.
*/
- tmp_arg2 = make_small(MIN_SMALL);
+ Op2 = make_small(MIN_SMALL);
goto do_bsl;
- } else if (is_small(tmp_arg1) || is_big(tmp_arg1)) {
+ } else if (is_small(Op1) || is_big(Op1)) {
/*
* N bsl PositiveBigNum is too large to represent.
*/
@@ -3200,10 +3046,8 @@ do { \
} else {
Uint live = Arg(2);
SWAPOUT;
- reg[0] = r(0);
reg[live] = bnot_val;
bnot_val = erts_gc_bnot(c_p, reg, live);
- r(0) = reg[0];
SWAPIN;
ERTS_HOLE_CHECK(c_p);
if (is_nil(bnot_val)) {
@@ -3223,7 +3067,6 @@ do { \
next = apply(c_p, r(0), x(1), x(2), reg);
SWAPIN;
if (next != NULL) {
- r(0) = reg[0];
SET_CP(c_p, I+1);
SET_I(next);
Dispatch();
@@ -3238,8 +3081,7 @@ do { \
next = apply(c_p, r(0), x(1), x(2), reg);
SWAPIN;
if (next != NULL) {
- r(0) = reg[0];
- SET_CP(c_p, (BeamInstr *) EXPAND_POINTER(E[0]));
+ SET_CP(c_p, (BeamInstr *) E[0]);
E = ADD_BYTE_OFFSET(E, Arg(0));
SET_I(next);
Dispatch();
@@ -3254,7 +3096,6 @@ do { \
next = apply(c_p, r(0), x(1), x(2), reg);
SWAPIN;
if (next != NULL) {
- r(0) = reg[0];
SET_I(next);
Dispatch();
}
@@ -3265,12 +3106,10 @@ do { \
OpCase(apply_I): {
BeamInstr *next;
- reg[0] = r(0);
SWAPOUT;
next = fixed_apply(c_p, reg, Arg(0));
SWAPIN;
if (next != NULL) {
- r(0) = reg[0];
SET_CP(c_p, I+2);
SET_I(next);
Dispatch();
@@ -3282,13 +3121,11 @@ do { \
OpCase(apply_last_IP): {
BeamInstr *next;
- reg[0] = r(0);
SWAPOUT;
next = fixed_apply(c_p, reg, Arg(0));
SWAPIN;
if (next != NULL) {
- r(0) = reg[0];
- SET_CP(c_p, (BeamInstr *) EXPAND_POINTER(E[0]));
+ SET_CP(c_p, (BeamInstr *) E[0]);
E = ADD_BYTE_OFFSET(E, Arg(1));
SET_I(next);
Dispatch();
@@ -3304,7 +3141,6 @@ do { \
next = apply_fun(c_p, r(0), x(1), reg);
SWAPIN;
if (next != NULL) {
- r(0) = reg[0];
SET_CP(c_p, I+1);
SET_I(next);
Dispatchfun();
@@ -3319,8 +3155,7 @@ do { \
next = apply_fun(c_p, r(0), x(1), reg);
SWAPIN;
if (next != NULL) {
- r(0) = reg[0];
- SET_CP(c_p, (BeamInstr *) EXPAND_POINTER(E[0]));
+ SET_CP(c_p, (BeamInstr *) E[0]);
E = ADD_BYTE_OFFSET(E, Arg(0));
SET_I(next);
Dispatchfun();
@@ -3335,7 +3170,6 @@ do { \
next = apply_fun(c_p, r(0), x(1), reg);
SWAPIN;
if (next != NULL) {
- r(0) = reg[0];
SET_I(next);
Dispatchfun();
}
@@ -3346,12 +3180,9 @@ do { \
BeamInstr *next;
SWAPOUT;
- reg[0] = r(0);
-
next = call_fun(c_p, Arg(0), reg, THE_NON_VALUE);
SWAPIN;
if (next != NULL) {
- r(0) = reg[0];
SET_CP(c_p, I+2);
SET_I(next);
Dispatchfun();
@@ -3363,12 +3194,10 @@ do { \
BeamInstr *next;
SWAPOUT;
- reg[0] = r(0);
next = call_fun(c_p, Arg(0), reg, THE_NON_VALUE);
SWAPIN;
if (next != NULL) {
- r(0) = reg[0];
- SET_CP(c_p, (BeamInstr *) EXPAND_POINTER(E[0]));
+ SET_CP(c_p, (BeamInstr *) E[0]);
E = ADD_BYTE_OFFSET(E, Arg(1));
SET_I(next);
Dispatchfun();
@@ -3452,10 +3281,9 @@ do { \
*/
argp = c_p->arg_reg;
- for (i = c_p->arity - 1; i > 0; i--) {
+ for (i = c_p->arity - 1; i >= 0; i--) {
argp[i] = reg[i];
}
- c_p->arg_reg[0] = r(0);
SWAPOUT;
c_p->i = I;
goto do_schedule1;
@@ -3468,19 +3296,14 @@ do { \
Eterm* p;
PreFetch(3, next);
- GetArg2(0, element, tuple);
+ GetArg1(0, element);
+ tuple = REG_TARGET(Arg(1));
ASSERT(is_tuple(tuple));
p = (Eterm *) ((unsigned char *) tuple_val(tuple) + Arg(2));
*p = element;
NextPF(3, next);
}
- OpCase(i_is_ne_exact_f):
- if (EQ(tmp_arg1, tmp_arg2)) {
- ClauseFail();
- }
- Next(1);
-
OpCase(normal_exit): {
SWAPOUT;
c_p->freason = EXC_NORMAL;
@@ -3547,25 +3370,14 @@ do { \
{
Eterm badmatch_val;
- OpCase(badmatch_y):
- badmatch_val = yb(Arg(0));
- goto do_badmatch;
-
OpCase(badmatch_x):
badmatch_val = xb(Arg(0));
- goto do_badmatch;
-
- OpCase(badmatch_r):
- badmatch_val = r(0);
-
- do_badmatch:
c_p->fvalue = badmatch_val;
c_p->freason = BADMATCH;
}
/* Fall through here */
find_func_info: {
- reg[0] = r(0);
SWAPOUT;
I = handle_error(c_p, I, reg, NULL);
goto post_error_handling;
@@ -3583,9 +3395,7 @@ do { \
* code[4]: Not used
*/
SWAPOUT;
- reg[0] = r(0);
I = call_error_handler(c_p, I-3, reg, am_undefined_function);
- r(0) = reg[0];
SWAPIN;
if (I) {
Goto(*I);
@@ -3594,14 +3404,12 @@ do { \
/* Fall through */
OpCase(error_action_code): {
handle_error:
- reg[0] = r(0);
SWAPOUT;
I = handle_error(c_p, NULL, reg, NULL);
post_error_handling:
if (I == 0) {
goto do_schedule;
} else {
- r(0) = reg[0];
ASSERT(!is_value(r(0)));
if (c_p->mbuf) {
erts_garbage_collect(c_p, 0, reg+1, 3);
@@ -3644,7 +3452,6 @@ do { \
NifF* fp = vbf = (NifF*) I[1];
struct enif_environment_t env;
erts_pre_nif(&env, c_p, (struct erl_module_nif*)I[2]);
- reg[0] = r(0);
nif_bif_result = (*fp)(&env, bif_nif_arity, reg);
if (env.exception_thrown)
nif_bif_result = THE_NON_VALUE;
@@ -3683,7 +3490,7 @@ do { \
bif_nif_arity = I[-1];
ASSERT(bif_nif_arity <= 4);
ERTS_SMP_UNREQ_PROC_MAIN_LOCK(c_p);
- reg[0] = r(0);
+ ERTS_VERIFY_UNUSED_TEMP_ALLOC(c_p);
{
Eterm (*bf)(Process*, Eterm*, BeamInstr*) = vbf;
ASSERT(!ERTS_PROC_IS_EXITING(c_p));
@@ -3713,7 +3520,6 @@ do { \
Goto(*I);
} else if (c_p->freason == TRAP) {
SET_I(c_p->i);
- r(0) = reg[0];
if (c_p->flags & F_HIBERNATE_SCHED) {
c_p->flags &= ~F_HIBERNATE_SCHED;
goto do_schedule;
@@ -3740,16 +3546,6 @@ do { \
OpCase(case_end_x):
case_end_val = xb(Arg(0));
- goto do_case_end;
-
- OpCase(case_end_y):
- case_end_val = yb(Arg(0));
- goto do_case_end;
-
- OpCase(case_end_r):
- case_end_val = r(0);
-
- do_case_end:
c_p->fvalue = case_end_val;
c_p->freason = EXC_CASE_CLAUSE;
goto find_func_info;
@@ -3797,19 +3593,13 @@ do { \
goto do_bs_init_bits_known;
}
- OpCase(i_bs_init_bits_fail_heap_IjId): {
- /* tmp_arg1 was fetched by an i_fetch instruction */
- num_bits_term = tmp_arg1;
- alloc = Arg(0);
- I++;
+ OpCase(i_bs_init_bits_fail_heap_sIjId): {
+ GetArg1(0, num_bits_term);
+ alloc = Arg(1);
+ I += 2;
goto do_bs_init_bits;
}
- OpCase(i_bs_init_bits_fail_rjId): {
- num_bits_term = r(0);
- alloc = 0;
- goto do_bs_init_bits;
- }
OpCase(i_bs_init_bits_fail_yjId): {
num_bits_term = yb(Arg(0));
I++;
@@ -3929,52 +3719,48 @@ do { \
}
{
- OpCase(i_bs_init_fail_heap_IjId): {
- /* tmp_arg1 was fetched by an i_fetch instruction */
- tmp_arg2 = Arg(0);
- I++;
- goto do_bs_init;
- }
+ Eterm BsOp1, BsOp2;
- OpCase(i_bs_init_fail_rjId): {
- tmp_arg1 = r(0);
- tmp_arg2 = 0;
+ OpCase(i_bs_init_fail_heap_sIjId): {
+ GetArg1(0, BsOp1);
+ BsOp2 = Arg(1);
+ I += 2;
goto do_bs_init;
}
OpCase(i_bs_init_fail_yjId): {
- tmp_arg1 = yb(Arg(0));
- tmp_arg2 = 0;
+ BsOp1 = yb(Arg(0));
+ BsOp2 = 0;
I++;
goto do_bs_init;
}
OpCase(i_bs_init_fail_xjId): {
- tmp_arg1 = xb(Arg(0));
- tmp_arg2 = 0;
+ BsOp1 = xb(Arg(0));
+ BsOp2 = 0;
I++;
}
/* FALL THROUGH */
do_bs_init:
- if (is_small(tmp_arg1)) {
- Sint size = signed_val(tmp_arg1);
+ if (is_small(BsOp1)) {
+ Sint size = signed_val(BsOp1);
if (size < 0) {
goto badarg;
}
- tmp_arg1 = (Eterm) size;
+ BsOp1 = (Eterm) size;
} else {
Uint bytes;
- if (!term_to_Uint(tmp_arg1, &bytes)) {
+ if (!term_to_Uint(BsOp1, &bytes)) {
c_p->freason = bytes;
goto lb_Cl_error;
}
if ((bytes >> (8*sizeof(Uint)-3)) != 0) {
goto system_limit;
}
- tmp_arg1 = (Eterm) bytes;
+ BsOp1 = (Eterm) bytes;
}
- if (tmp_arg1 <= ERL_ONHEAP_BIN_LIMIT) {
+ if (BsOp1 <= ERL_ONHEAP_BIN_LIMIT) {
goto do_heap_bin_alloc;
} else {
goto do_proc_bin_alloc;
@@ -3982,15 +3768,15 @@ do { \
OpCase(i_bs_init_heap_IIId): {
- tmp_arg1 = Arg(0);
- tmp_arg2 = Arg(1);
+ BsOp1 = Arg(0);
+ BsOp2 = Arg(1);
I++;
goto do_proc_bin_alloc;
}
OpCase(i_bs_init_IId): {
- tmp_arg1 = Arg(0);
- tmp_arg2 = 0;
+ BsOp1 = Arg(0);
+ BsOp2 = 0;
}
/* FALL THROUGH */
do_proc_bin_alloc: {
@@ -3999,13 +3785,13 @@ do { \
erts_bin_offset = 0;
erts_writable_bin = 0;
- TestBinVHeap(tmp_arg1 / sizeof(Eterm),
- tmp_arg2 + PROC_BIN_SIZE + ERL_SUB_BIN_SIZE, Arg(1));
+ TestBinVHeap(BsOp1 / sizeof(Eterm),
+ BsOp2 + PROC_BIN_SIZE + ERL_SUB_BIN_SIZE, Arg(1));
/*
* Allocate the binary struct itself.
*/
- bptr = erts_bin_nrml_alloc(tmp_arg1);
+ bptr = erts_bin_nrml_alloc(BsOp1);
erts_refc_init(&bptr->refc, 1);
erts_current_bin = (byte *) bptr->orig_bytes;
@@ -4015,28 +3801,28 @@ do { \
pb = (ProcBin *) HTOP;
HTOP += PROC_BIN_SIZE;
pb->thing_word = HEADER_PROC_BIN;
- pb->size = tmp_arg1;
+ pb->size = BsOp1;
pb->next = MSO(c_p).first;
MSO(c_p).first = (struct erl_off_heap_header*) pb;
pb->val = bptr;
pb->bytes = (byte*) bptr->orig_bytes;
pb->flags = 0;
- OH_OVERHEAD(&(MSO(c_p)), tmp_arg1 / sizeof(Eterm));
+ OH_OVERHEAD(&(MSO(c_p)), BsOp1 / sizeof(Eterm));
StoreBifResult(2, make_binary(pb));
}
OpCase(i_bs_init_heap_bin_heap_IIId): {
- tmp_arg1 = Arg(0);
- tmp_arg2 = Arg(1);
+ BsOp1 = Arg(0);
+ BsOp2 = Arg(1);
I++;
goto do_heap_bin_alloc;
}
OpCase(i_bs_init_heap_bin_IId): {
- tmp_arg1 = Arg(0);
- tmp_arg2 = 0;
+ BsOp1 = Arg(0);
+ BsOp2 = 0;
}
/* Fall through */
do_heap_bin_alloc:
@@ -4044,33 +3830,36 @@ do { \
ErlHeapBin* hb;
Uint bin_need;
- bin_need = heap_bin_size(tmp_arg1);
+ bin_need = heap_bin_size(BsOp1);
erts_bin_offset = 0;
erts_writable_bin = 0;
- TestHeap(bin_need+tmp_arg2+ERL_SUB_BIN_SIZE, Arg(1));
+ TestHeap(bin_need+BsOp2+ERL_SUB_BIN_SIZE, Arg(1));
hb = (ErlHeapBin *) HTOP;
HTOP += bin_need;
- hb->thing_word = header_heap_bin(tmp_arg1);
- hb->size = tmp_arg1;
+ hb->thing_word = header_heap_bin(BsOp1);
+ hb->size = BsOp1;
erts_current_bin = (byte *) hb->data;
- tmp_arg1 = make_binary(hb);
- StoreBifResult(2, tmp_arg1);
+ BsOp1 = make_binary(hb);
+ StoreBifResult(2, BsOp1);
}
}
- OpCase(i_bs_add_jId): {
- Uint Unit = Arg(1);
- if (is_both_small(tmp_arg1, tmp_arg2)) {
- Sint Arg1 = signed_val(tmp_arg1);
- Sint Arg2 = signed_val(tmp_arg2);
+ OpCase(bs_add_jssId): {
+ Eterm Op1, Op2;
+ Uint Unit = Arg(3);
+
+ GetArg2(1, Op1, Op2);
+ if (is_both_small(Op1, Op2)) {
+ Sint Arg1 = signed_val(Op1);
+ Sint Arg2 = signed_val(Op2);
if (Arg1 >= 0 && Arg2 >= 0) {
- BsSafeMul(Arg2, Unit, goto system_limit, tmp_arg1);
- tmp_arg1 += Arg1;
+ BsSafeMul(Arg2, Unit, goto system_limit, Op1);
+ Op1 += Arg1;
store_bs_add_result:
- if (MY_IS_SSMALL((Sint) tmp_arg1)) {
- tmp_arg1 = make_small(tmp_arg1);
+ if (MY_IS_SSMALL((Sint) Op1)) {
+ Op1 = make_small(Op1);
} else {
/*
* May generate a heap fragment, but in this
@@ -4082,10 +3871,10 @@ do { \
* references (such as the heap).
*/
SWAPOUT;
- tmp_arg1 = erts_make_integer(tmp_arg1, c_p);
+ Op1 = erts_make_integer(Op1, c_p);
HTOP = HEAP_TOP(c_p);
}
- StoreBifResult(2, tmp_arg1);
+ StoreBifResult(4, Op1);
}
goto badarg;
} else {
@@ -4108,16 +3897,16 @@ do { \
* an Uint, the reason is SYSTEM_LIMIT.
*/
- if (!term_to_Uint(tmp_arg1, &a)) {
+ if (!term_to_Uint(Op1, &a)) {
if (a == BADARG) {
goto badarg;
}
- if (!term_to_Uint(tmp_arg2, &b)) {
+ if (!term_to_Uint(Op2, &b)) {
c_p->freason = b;
goto lb_Cl_error;
}
goto system_limit;
- } else if (!term_to_Uint(tmp_arg2, &b)) {
+ } else if (!term_to_Uint(Op2, &b)) {
c_p->freason = b;
goto lb_Cl_error;
}
@@ -4127,8 +3916,8 @@ do { \
*/
BsSafeMul(b, Unit, goto system_limit, c);
- tmp_arg1 = a + c;
- if (tmp_arg1 < a) {
+ Op1 = a + c;
+ if (Op1 < a) {
/*
* If the result is less than one of the
* arguments, there must have been an overflow.
@@ -4150,48 +3939,43 @@ do { \
}
/*
- * tmp_arg1 = Number of bytes to build
- * tmp_arg2 = Source binary
- * Operands: Fail ExtraHeap Live Unit Dst
+ * x(SCRATCH_X_REG);
+ * Operands: Fail ExtraHeap Live Unit Size Dst
*/
- OpCase(i_bs_append_jIIId): {
+ OpCase(i_bs_append_jIIIsd): {
Uint live = Arg(2);
Uint res;
+ Eterm Size;
+ GetArg1(4, Size);
SWAPOUT;
- reg[0] = r(0);
- reg[live] = tmp_arg2;
- res = erts_bs_append(c_p, reg, live, tmp_arg1, Arg(1), Arg(3));
- r(0) = reg[0];
+ reg[live] = x(SCRATCH_X_REG);
+ res = erts_bs_append(c_p, reg, live, Size, Arg(1), Arg(3));
SWAPIN;
if (is_non_value(res)) {
/* c_p->freason is already set (may be either BADARG or SYSTEM_LIMIT). */
goto lb_Cl_error;
}
- StoreBifResult(4, res);
+ StoreBifResult(5, res);
}
/*
- * tmp_arg1 = Number of bytes to build
- * tmp_arg2 = Source binary
- * Operands: Fail Unit Dst
+ * Operands: Fail Size Src Unit Dst
*/
- OpCase(i_bs_private_append_jId): {
+ OpCase(i_bs_private_append_jIssd): {
Eterm res;
+ Eterm Size, Src;
- res = erts_bs_private_append(c_p, tmp_arg2, tmp_arg1, Arg(1));
+ GetArg2(2, Size, Src);
+ res = erts_bs_private_append(c_p, Src, Size, Arg(1));
if (is_non_value(res)) {
/* c_p->freason is already set (may be either BADARG or SYSTEM_LIMIT). */
goto lb_Cl_error;
}
- StoreBifResult(2, res);
+ StoreBifResult(4, res);
}
- /*
- * tmp_arg1 = Initial size of writable binary
- * Operands: Live Dst
- */
OpCase(bs_init_writable): {
SWAPOUT;
r(0) = erts_bs_init_writable(c_p, r(0));
@@ -4286,26 +4070,29 @@ do { \
/*
* Only used for validating a value matched out.
- *
- * tmp_arg1 = Integer to validate
- * tmp_arg2 = Match context
*/
- OpCase(i_bs_validate_unicode_retract_j): {
- /*
- * There is no need to untag the integer, but it IS necessary
- * to make sure it is small (a bignum pointer could fall in
- * the valid range).
- */
- if (is_not_small(tmp_arg1) || tmp_arg1 > make_small(0x10FFFFUL) ||
- (make_small(0xD800UL) <= tmp_arg1 &&
- tmp_arg1 <= make_small(0xDFFFUL))) {
- ErlBinMatchBuffer *mb = ms_matchbuffer(tmp_arg2);
+ OpCase(i_bs_validate_unicode_retract_jss): {
+ Eterm i; /* Integer to validate */
- mb->offset -= 32;
- goto badarg;
- }
- Next(1);
- }
+ /*
+ * There is no need to untag the integer, but it IS necessary
+ * to make sure it is small (a bignum pointer could fall in
+ * the valid range).
+ */
+
+ GetArg1(1, i);
+ if (is_not_small(i) || i > make_small(0x10FFFFUL) ||
+ (make_small(0xD800UL) <= i && i <= make_small(0xDFFFUL))) {
+ Eterm ms; /* Match context */
+ ErlBinMatchBuffer* mb;
+
+ GetArg1(2, ms);
+ mb = ms_matchbuffer(ms);
+ mb->offset -= 32;
+ goto badarg;
+ }
+ Next(3);
+ }
/*
* Matching of binaries.
@@ -4317,9 +4104,6 @@ do { \
Uint slots;
Eterm context;
- OpCase(i_bs_start_match2_rfIId): {
- context = r(0);
-
do_start_match:
slots = Arg(2);
if (!is_boxed(context)) {
@@ -4366,7 +4150,7 @@ do { \
ClauseFail();
}
NextPF(4, next);
- }
+
OpCase(i_bs_start_match2_xfIId): {
context = xb(Arg(0));
I++;
@@ -4379,18 +4163,6 @@ do { \
}
}
- OpCase(bs_test_zero_tail2_fr): {
- BeamInstr *next;
- ErlBinMatchBuffer *_mb;
-
- PreFetch(1, next);
- _mb = (ErlBinMatchBuffer*) ms_matchbuffer(r(0));
- if (_mb->size != _mb->offset) {
- ClauseFail();
- }
- NextPF(1, next);
- }
-
OpCase(bs_test_zero_tail2_fx): {
BeamInstr *next;
ErlBinMatchBuffer *_mb;
@@ -4403,16 +4175,6 @@ do { \
NextPF(2, next);
}
- OpCase(bs_test_tail_imm2_frI): {
- BeamInstr *next;
- ErlBinMatchBuffer *_mb;
- PreFetch(2, next);
- _mb = ms_matchbuffer(r(0));
- if (_mb->size - _mb->offset != Arg(1)) {
- ClauseFail();
- }
- NextPF(2, next);
- }
OpCase(bs_test_tail_imm2_fxI): {
BeamInstr *next;
ErlBinMatchBuffer *_mb;
@@ -4424,16 +4186,6 @@ do { \
NextPF(3, next);
}
- OpCase(bs_test_unit_frI): {
- BeamInstr *next;
- ErlBinMatchBuffer *_mb;
- PreFetch(2, next);
- _mb = ms_matchbuffer(r(0));
- if ((_mb->size - _mb->offset) % Arg(1)) {
- ClauseFail();
- }
- NextPF(2, next);
- }
OpCase(bs_test_unit_fxI): {
BeamInstr *next;
ErlBinMatchBuffer *_mb;
@@ -4445,16 +4197,6 @@ do { \
NextPF(3, next);
}
- OpCase(bs_test_unit8_fr): {
- BeamInstr *next;
- ErlBinMatchBuffer *_mb;
- PreFetch(1, next);
- _mb = ms_matchbuffer(r(0));
- if ((_mb->size - _mb->offset) & 7) {
- ClauseFail();
- }
- NextPF(1, next);
- }
OpCase(bs_test_unit8_fx): {
BeamInstr *next;
ErlBinMatchBuffer *_mb;
@@ -4469,19 +4211,11 @@ do { \
{
Eterm bs_get_integer8_context;
- OpCase(i_bs_get_integer_8_rfd): {
- bs_get_integer8_context = r(0);
- goto do_bs_get_integer_8;
- }
-
OpCase(i_bs_get_integer_8_xfd): {
- bs_get_integer8_context = xb(Arg(0));
- I++;
- }
-
- do_bs_get_integer_8: {
ErlBinMatchBuffer *_mb;
Eterm _result;
+ bs_get_integer8_context = xb(Arg(0));
+ I++;
_mb = ms_matchbuffer(bs_get_integer8_context);
if (_mb->size - _mb->offset < 8) {
ClauseFail();
@@ -4499,15 +4233,10 @@ do { \
{
Eterm bs_get_integer_16_context;
- OpCase(i_bs_get_integer_16_rfd):
- bs_get_integer_16_context = r(0);
- goto do_bs_get_integer_16;
-
OpCase(i_bs_get_integer_16_xfd):
bs_get_integer_16_context = xb(Arg(0));
I++;
- do_bs_get_integer_16:
{
ErlBinMatchBuffer *_mb;
Eterm _result;
@@ -4528,17 +4257,10 @@ do { \
{
Eterm bs_get_integer_32_context;
- OpCase(i_bs_get_integer_32_rfId):
- bs_get_integer_32_context = r(0);
- goto do_bs_get_integer_32;
-
-
OpCase(i_bs_get_integer_32_xfId):
bs_get_integer_32_context = xb(Arg(0));
I++;
-
- do_bs_get_integer_32:
{
ErlBinMatchBuffer *_mb;
Uint32 _integer;
@@ -4551,11 +4273,11 @@ do { \
_integer = get_int32(_mb->base + _mb->offset/8);
}
_mb->offset += 32;
-#if !defined(ARCH_64) || HALFWORD_HEAP
+#if !defined(ARCH_64)
if (IS_USMALL(0, _integer)) {
#endif
_result = make_small(_integer);
-#if !defined(ARCH_64) || HALFWORD_HEAP
+#if !defined(ARCH_64)
} else {
TestHeap(BIG_UINT_HEAP_SIZE, Arg(1));
_result = uint_to_big((Uint) _integer, HTOP);
@@ -4567,103 +4289,82 @@ do { \
}
}
- /* Operands: Size Live Fail Flags Dst */
- OpCase(i_bs_get_integer_imm_rIIfId): {
- tmp_arg1 = r(0);
- /* Operands: Size Live Fail Flags Dst */
- goto do_bs_get_integer_imm_test_heap;
- }
+ {
+ Eterm Ms, Sz;
- /* Operands: x(Reg) Size Live Fail Flags Dst */
+ /* Operands: x(Reg) Size Live Fail Flags Dst */
OpCase(i_bs_get_integer_imm_xIIfId): {
- tmp_arg1 = xb(Arg(0));
- I++;
- /* Operands: Size Live Fail Flags Dst */
- goto do_bs_get_integer_imm_test_heap;
- }
-
- /*
- * tmp_arg1 = match context
- * Operands: Size Live Fail Flags Dst
- */
- do_bs_get_integer_imm_test_heap: {
- Uint wordsneeded;
- tmp_arg2 = Arg(0);
- wordsneeded = 1+WSIZE(NBYTES(tmp_arg2));
- TestHeapPreserve(wordsneeded, Arg(1), tmp_arg1);
- I += 2;
- /* Operands: Fail Flags Dst */
- goto do_bs_get_integer_imm;
- }
-
- /* Operands: Size Fail Flags Dst */
- OpCase(i_bs_get_integer_small_imm_rIfId): {
- tmp_arg1 = r(0);
- tmp_arg2 = Arg(0);
- I++;
- /* Operands: Fail Flags Dst */
- goto do_bs_get_integer_imm;
- }
+ Uint wordsneeded;
+ Ms = xb(Arg(0));
+ Sz = Arg(1);
+ wordsneeded = 1+WSIZE(NBYTES(Sz));
+ TestHeapPreserve(wordsneeded, Arg(2), Ms);
+ I += 3;
+ /* Operands: Fail Flags Dst */
+ goto do_bs_get_integer_imm;
+ }
- /* Operands: x(Reg) Size Fail Flags Dst */
+ /* Operands: x(Reg) Size Fail Flags Dst */
OpCase(i_bs_get_integer_small_imm_xIfId): {
- tmp_arg1 = xb(Arg(0));
- tmp_arg2 = Arg(1);
- I += 2;
- /* Operands: Fail Flags Dst */
- goto do_bs_get_integer_imm;
- }
+ Ms = xb(Arg(0));
+ Sz = Arg(1);
+ I += 2;
+ /* Operands: Fail Flags Dst */
+ goto do_bs_get_integer_imm;
+ }
- /*
- * tmp_arg1 = match context
- * tmp_arg2 = size of field
- * Operands: Fail Flags Dst
- */
+ /*
+ * Ms = match context
+ * Sz = size of field
+ * Operands: Fail Flags Dst
+ */
do_bs_get_integer_imm: {
- ErlBinMatchBuffer* mb;
- Eterm result;
+ ErlBinMatchBuffer* mb;
+ Eterm result;
- mb = ms_matchbuffer(tmp_arg1);
- LIGHT_SWAPOUT;
- result = erts_bs_get_integer_2(c_p, tmp_arg2, Arg(1), mb);
- LIGHT_SWAPIN;
- HEAP_SPACE_VERIFIED(0);
- if (is_non_value(result)) {
- ClauseFail();
+ mb = ms_matchbuffer(Ms);
+ LIGHT_SWAPOUT;
+ result = erts_bs_get_integer_2(c_p, Sz, Arg(1), mb);
+ LIGHT_SWAPIN;
+ HEAP_SPACE_VERIFIED(0);
+ if (is_non_value(result)) {
+ ClauseFail();
+ }
+ StoreBifResult(2, result);
}
- StoreBifResult(2, result);
}
/*
- * tmp_arg1 = Match context
- * tmp_arg2 = Size field
- * Operands: Fail Live FlagsAndUnit Dst
+ * Operands: Fail Live FlagsAndUnit Ms Sz Dst
*/
- OpCase(i_bs_get_integer_fIId): {
+ OpCase(i_bs_get_integer_fIIssd): {
Uint flags;
Uint size;
+ Eterm Ms;
+ Eterm Sz;
ErlBinMatchBuffer* mb;
Eterm result;
flags = Arg(2);
- BsGetFieldSize(tmp_arg2, (flags >> 3), ClauseFail(), size);
+ GetArg2(3, Ms, Sz);
+ BsGetFieldSize(Sz, (flags >> 3), ClauseFail(), size);
if (size >= SMALL_BITS) {
Uint wordsneeded;
- /* check bits size before potential gc.
+ /* Check bits size before potential gc.
* We do not want a gc and then realize we don't need
- * the allocated space (i.e. if the op fails)
+ * the allocated space (i.e. if the op fails).
*
- * remember to reacquire the matchbuffer after gc.
+ * Remember to re-acquire the matchbuffer after gc.
*/
- mb = ms_matchbuffer(tmp_arg1);
+ mb = ms_matchbuffer(Ms);
if (mb->size - mb->offset < size) {
ClauseFail();
}
wordsneeded = 1+WSIZE(NBYTES((Uint) size));
- TestHeapPreserve(wordsneeded, Arg(1), tmp_arg1);
+ TestHeapPreserve(wordsneeded, Arg(1), Ms);
}
- mb = ms_matchbuffer(tmp_arg1);
+ mb = ms_matchbuffer(Ms);
LIGHT_SWAPOUT;
result = erts_bs_get_integer_2(c_p, size, flags, mb);
LIGHT_SWAPIN;
@@ -4671,18 +4372,13 @@ do { \
if (is_non_value(result)) {
ClauseFail();
}
- StoreBifResult(3, result);
+ StoreBifResult(5, result);
}
{
Eterm get_utf8_context;
/* Operands: MatchContext Fail Dst */
- OpCase(i_bs_get_utf8_rfd): {
- get_utf8_context = r(0);
- goto do_bs_get_utf8;
- }
-
OpCase(i_bs_get_utf8_xfd): {
get_utf8_context = xb(Arg(0));
I++;
@@ -4693,7 +4389,7 @@ do { \
* Operands: Fail Dst
*/
- do_bs_get_utf8: {
+ {
Eterm result = erts_bs_get_utf8(ms_matchbuffer(get_utf8_context));
if (is_non_value(result)) {
ClauseFail();
@@ -4706,12 +4402,7 @@ do { \
Eterm get_utf16_context;
/* Operands: MatchContext Fail Flags Dst */
- OpCase(i_bs_get_utf16_rfId): {
- get_utf16_context = r(0);
- goto do_bs_get_utf16;
- }
-
- OpCase(i_bs_get_utf16_xfId): {
+ OpCase(i_bs_get_utf16_xfId): {
get_utf16_context = xb(Arg(0));
I++;
}
@@ -4720,7 +4411,7 @@ do { \
* get_utf16_context = match_context
* Operands: Fail Flags Dst
*/
- do_bs_get_utf16: {
+ {
Eterm result = erts_bs_get_utf16(ms_matchbuffer(get_utf16_context),
Arg(1));
if (is_non_value(result)) {
@@ -4739,26 +4430,10 @@ do { \
Uint orig;
Uint hole_size;
- OpCase(bs_context_to_binary_r): {
- context_to_binary_context = x0;
- I -= 2;
- goto do_context_to_binary;
- }
-
- /* Unfortunately, inlining can generate this instruction. */
- OpCase(bs_context_to_binary_y): {
- context_to_binary_context = yb(Arg(0));
- goto do_context_to_binary0;
- }
-
- OpCase(bs_context_to_binary_x): {
+ OpCase(bs_context_to_binary_x):
context_to_binary_context = xb(Arg(0));
-
- do_context_to_binary0:
I--;
- }
- do_context_to_binary:
if (is_boxed(context_to_binary_context) &&
header_is_bin_matchstate(*boxed_val(context_to_binary_context))) {
ErlBinMatchState* ms;
@@ -4770,17 +4445,11 @@ do { \
}
Next(2);
- OpCase(i_bs_get_binary_all_reuse_rfI): {
- context_to_binary_context = x0;
- goto do_bs_get_binary_all_reuse;
- }
-
OpCase(i_bs_get_binary_all_reuse_xfI): {
context_to_binary_context = xb(Arg(0));
I++;
}
- do_bs_get_binary_all_reuse:
mb = ms_matchbuffer(context_to_binary_context);
size = mb->size - mb->offset;
if (size % Arg(1) != 0) {
@@ -4808,16 +4477,11 @@ do { \
{
Eterm match_string_context;
- OpCase(i_bs_match_string_rfII): {
- match_string_context = r(0);
- goto do_bs_match_string;
- }
OpCase(i_bs_match_string_xfII): {
match_string_context = xb(Arg(0));
I++;
}
- do_bs_match_string:
{
BeamInstr *next;
byte* bytes;
@@ -4845,14 +4509,6 @@ do { \
}
}
- OpCase(i_bs_save2_rI): {
- BeamInstr *next;
- ErlBinMatchState *_ms;
- PreFetch(1, next);
- _ms = (ErlBinMatchState*) boxed_val((Eterm) r(0));
- _ms->save_offset[Arg(0)] = _ms->mb.offset;
- NextPF(1, next);
- }
OpCase(i_bs_save2_xI): {
BeamInstr *next;
ErlBinMatchState *_ms;
@@ -4862,14 +4518,6 @@ do { \
NextPF(2, next);
}
- OpCase(i_bs_restore2_rI): {
- BeamInstr *next;
- ErlBinMatchState *_ms;
- PreFetch(1, next);
- _ms = (ErlBinMatchState*) boxed_val((Eterm) r(0));
- _ms->mb.offset = _ms->save_offset[Arg(0)];
- NextPF(1, next);
- }
OpCase(i_bs_restore2_xI): {
BeamInstr *next;
ErlBinMatchState *_ms;
@@ -4917,9 +4565,7 @@ do { \
BeamInstr real_I;
ASSERT(I[-5] == (BeamInstr) BeamOp(op_i_func_info_IaaI));
SWAPOUT;
- reg[0] = r(0);
real_I = erts_generic_breakpoint(c_p, I, reg);
- r(0) = reg[0];
SWAPIN;
ASSERT(VALID_INSTR(real_I));
Goto(real_I);
@@ -4979,7 +4625,7 @@ do { \
BeamInstr *next;
PreFetch(2, next);
- GetR(0, targ1);
+ targ1 = REG_TARGET(Arg(0));
/* Arg(0) == HEADER_FLONUM */
GET_DOUBLE(targ1, *(FloatDef*)ADD_BYTE_OFFSET(freg, fr));
NextPF(2, next);
@@ -4999,7 +4645,7 @@ do { \
Eterm fr = Arg(1);
BeamInstr *next;
- GetR(0, targ1);
+ targ1 = REG_TARGET(Arg(0));
PreFetch(2, next);
if (is_small(targ1)) {
fb(fr) = (double) signed_val(targ1);
@@ -5095,7 +4741,12 @@ do { \
#ifdef HIPE
{
- unsigned cmd;
+#define HIPE_MODE_SWITCH(Cmd) \
+ SWAPOUT; \
+ c_p->fcalls = FCALLS; \
+ c_p->def_arg_reg[4] = -neg_o_reds; \
+ c_p = hipe_mode_switch(c_p, Cmd, reg); \
+ goto L_post_hipe_mode_switch
OpCase(hipe_trap_call): {
/*
@@ -5109,52 +4760,45 @@ do { \
*/
ASSERT(I[-5] == (Uint) OpCode(i_func_info_IaaI));
c_p->hipe.u.ncallee = (void(*)(void)) I[-4];
- cmd = HIPE_MODE_SWITCH_CMD_CALL | (I[-1] << 8);
++hipe_trap_count;
- goto L_hipe_mode_switch;
+ HIPE_MODE_SWITCH(HIPE_MODE_SWITCH_CMD_CALL | (I[-1] << 8));
}
OpCase(hipe_trap_call_closure): {
ASSERT(I[-5] == (Uint) OpCode(i_func_info_IaaI));
c_p->hipe.u.ncallee = (void(*)(void)) I[-4];
- cmd = HIPE_MODE_SWITCH_CMD_CALL_CLOSURE | (I[-1] << 8);
++hipe_trap_count;
- goto L_hipe_mode_switch;
+ HIPE_MODE_SWITCH(HIPE_MODE_SWITCH_CMD_CALL_CLOSURE | (I[-1] << 8));
}
OpCase(hipe_trap_return): {
- cmd = HIPE_MODE_SWITCH_CMD_RETURN;
- goto L_hipe_mode_switch;
+ HIPE_MODE_SWITCH(HIPE_MODE_SWITCH_CMD_RETURN);
}
OpCase(hipe_trap_throw): {
- cmd = HIPE_MODE_SWITCH_CMD_THROW;
- goto L_hipe_mode_switch;
+ HIPE_MODE_SWITCH(HIPE_MODE_SWITCH_CMD_THROW);
}
OpCase(hipe_trap_resume): {
- cmd = HIPE_MODE_SWITCH_CMD_RESUME;
- goto L_hipe_mode_switch;
+ HIPE_MODE_SWITCH(HIPE_MODE_SWITCH_CMD_RESUME);
}
- L_hipe_mode_switch:
- /* XXX: this abuse of def_arg_reg[] is horrid! */
- SWAPOUT;
- c_p->fcalls = FCALLS;
- c_p->def_arg_reg[4] = -neg_o_reds;
- reg[0] = r(0);
- c_p = hipe_mode_switch(c_p, cmd, reg);
+#undef HIPE_MODE_SWITCH
+
+ L_post_hipe_mode_switch:
reg = ERTS_PROC_GET_SCHDATA(c_p)->x_reg_array;
freg = ERTS_PROC_GET_SCHDATA(c_p)->f_reg_array;
ERL_BITS_RELOAD_STATEP(c_p);
+ /* XXX: this abuse of def_arg_reg[] is horrid! */
neg_o_reds = -c_p->def_arg_reg[4];
FCALLS = c_p->fcalls;
SWAPIN;
- switch( c_p->def_arg_reg[3] ) { /* Halfword wont work with hipe yet! */
+ switch( c_p->def_arg_reg[3] ) {
case HIPE_MODE_SWITCH_RES_RETURN:
ASSERT(is_value(reg[0]));
- MoveReturn(reg[0], r(0));
+ SET_I(c_p->cp);
+ c_p->cp = 0;
+ Goto(*I);
case HIPE_MODE_SWITCH_RES_CALL_EXPORTED:
c_p->i = c_p->hipe.u.callee_exp->addressv[erts_active_code_ix()];
/*fall through*/
case HIPE_MODE_SWITCH_RES_CALL_BEAM:
SET_I(c_p->i);
- r(0) = reg[0];
Dispatch();
case HIPE_MODE_SWITCH_RES_CALL_CLOSURE:
/* This can be used to call any function value, but currently it's
@@ -5165,7 +4809,6 @@ do { \
next = call_fun(c_p, c_p->arity - 1, reg, THE_NON_VALUE);
SWAPIN;
if (next != NULL) {
- r(0) = reg[0];
SET_I(next);
Dispatchfun();
}
@@ -5225,9 +4868,7 @@ do { \
OpCase(i_debug_breakpoint): {
SWAPOUT;
- reg[0] = r(0);
I = call_error_handler(c_p, I-3, reg, am_breakpoint);
- r(0) = reg[0];
SWAPIN;
if (I) {
Goto(*I);
@@ -6644,23 +6285,20 @@ static Eterm get_map_element_hash(Eterm map, Eterm key, Uint32 hx)
return vs ? *vs : THE_NON_VALUE;
}
-#define GET_TERM(term, dest) \
-do { \
- Eterm src = (Eterm)(term); \
- switch (src & _TAG_IMMED1_MASK) { \
- case (R_REG_DEF << _TAG_PRIMARY_SIZE) | TAG_PRIMARY_HEADER: \
- dest = x(0); \
- break; \
- case (X_REG_DEF << _TAG_PRIMARY_SIZE) | TAG_PRIMARY_HEADER: \
- dest = x(src >> _TAG_IMMED1_SIZE); \
- break; \
- case (Y_REG_DEF << _TAG_PRIMARY_SIZE) | TAG_PRIMARY_HEADER: \
- dest = y(src >> _TAG_IMMED1_SIZE); \
- break; \
- default: \
- dest = src; \
- break; \
- } \
+#define GET_TERM(term, dest) \
+do { \
+ Eterm src = (Eterm)(term); \
+ switch (loader_tag(src)) { \
+ case LOADER_X_REG: \
+ dest = x(loader_x_reg_index(src)); \
+ break; \
+ case LOADER_Y_REG: \
+ dest = y(loader_y_reg_index(src)); \
+ break; \
+ default: \
+ dest = src; \
+ break; \
+ } \
} while(0)
@@ -7114,6 +6752,15 @@ erts_is_builtin(Eterm Mod, Eterm Name, int arity)
Export e;
Export* ep;
+ if (Mod == am_erlang && Name == am_apply && arity == 3) {
+ /*
+ * Special case. apply/3 is built-in (implemented in C),
+ * but implemented in a different way than all other
+ * BIFs.
+ */
+ return 1;
+ }
+
e.code[0] = Mod;
e.code[1] = Name;
e.code[2] = arity;
diff --git a/erts/emulator/beam/beam_load.c b/erts/emulator/beam/beam_load.c
index b70e5b9a2d..a9d47eb7b0 100644
--- a/erts/emulator/beam/beam_load.c
+++ b/erts/emulator/beam/beam_load.c
@@ -1847,9 +1847,7 @@ load_code(LoaderState* stp)
case TAG_o:
break;
case TAG_x:
- if (last_op->a[arg].val == 0) {
- last_op->a[arg].type = TAG_r;
- } else if (last_op->a[arg].val >= MAX_REG) {
+ if (last_op->a[arg].val >= MAX_REG) {
LoadError1(stp, "invalid x register number: %u",
last_op->a[arg].val);
}
@@ -1894,15 +1892,14 @@ load_code(LoaderState* stp)
*/
{
Eterm* hp;
-/* XXX:PaN - Halfword should use ARCH_64 variant instead */
-#if !defined(ARCH_64) || HALFWORD_HEAP
+#if !defined(ARCH_64)
Uint high, low;
# endif
last_op->a[arg].val = new_literal(stp, &hp,
FLOAT_SIZE_OBJECT);
hp[0] = HEADER_FLONUM;
last_op->a[arg].type = TAG_q;
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
GetInt(stp, 8, hp[1]);
# else
GetInt(stp, 4, high);
@@ -2056,7 +2053,42 @@ load_code(LoaderState* stp)
if (((opc[specific].mask[0] & mask[0]) == mask[0]) &&
((opc[specific].mask[1] & mask[1]) == mask[1]) &&
((opc[specific].mask[2] & mask[2]) == mask[2])) {
- break;
+
+ if (!opc[specific].involves_r) {
+ break; /* No complications - match */
+ }
+
+ /*
+ * The specific operation uses the 'r' operand,
+ * which is shorthand for x(0). Now things
+ * get complicated. First we must check whether
+ * all operands that should be of type 'r' use
+ * x(0) (as opposed to some other X register).
+ */
+ for (arg = 0; arg < arity; arg++) {
+ if (opc[specific].involves_r & (1 << arg) &&
+ tmp_op->a[arg].type == TAG_x) {
+ if (tmp_op->a[arg].val != 0) {
+ break; /* Other X register than 0 */
+ }
+ }
+ }
+
+ if (arg == arity) {
+ /*
+ * All 'r' operands use x(0) in the generic
+ * operation. That means a match. Now we
+ * will need to rewrite the generic instruction
+ * to actually use 'r' instead of 'x(0)'.
+ */
+ for (arg = 0; arg < arity; arg++) {
+ if (opc[specific].involves_r & (1 << arg) &&
+ tmp_op->a[arg].type == TAG_x) {
+ tmp_op->a[arg].type = TAG_r;
+ }
+ }
+ break; /* Match */
+ }
}
specific++;
}
@@ -2167,14 +2199,11 @@ load_code(LoaderState* stp)
break;
case 's': /* Any source (tagged constant or register) */
switch (tag) {
- case TAG_r:
- code[ci++] = make_rreg();
- break;
case TAG_x:
- code[ci++] = make_xreg(tmp_op->a[arg].val);
+ code[ci++] = make_loader_x_reg(tmp_op->a[arg].val);
break;
case TAG_y:
- code[ci++] = make_yreg(tmp_op->a[arg].val);
+ code[ci++] = make_loader_y_reg(tmp_op->a[arg].val);
break;
case TAG_i:
code[ci++] = (BeamInstr) make_small((Uint)tmp_op->a[arg].val);
@@ -2185,6 +2214,10 @@ load_code(LoaderState* stp)
case TAG_n:
code[ci++] = NIL;
break;
+ case TAG_q:
+ new_literal_patch(stp, ci);
+ code[ci++] = tmp_op->a[arg].val;
+ break;
default:
LoadError1(stp, "bad tag %d for general source",
tmp_op->a[arg].type);
@@ -2193,14 +2226,11 @@ load_code(LoaderState* stp)
break;
case 'd': /* Destination (x(0), x(N), y(N) */
switch (tag) {
- case TAG_r:
- code[ci++] = make_rreg();
- break;
case TAG_x:
- code[ci++] = make_xreg(tmp_op->a[arg].val);
+ code[ci++] = tmp_op->a[arg].val * sizeof(Eterm);
break;
case TAG_y:
- code[ci++] = make_yreg(tmp_op->a[arg].val);
+ code[ci++] = tmp_op->a[arg].val * sizeof(Eterm) + 1;
break;
default:
LoadError1(stp, "bad tag %d for destination",
@@ -2357,20 +2387,13 @@ load_code(LoaderState* stp)
stp->labels[tmp_op->a[arg].val].patches = ci;
ci++;
break;
- case TAG_r:
- CodeNeed(1);
- code[ci++] = (R_REG_DEF << _TAG_PRIMARY_SIZE) |
- TAG_PRIMARY_HEADER;
- break;
case TAG_x:
CodeNeed(1);
- code[ci++] = (tmp_op->a[arg].val << _TAG_IMMED1_SIZE) |
- (X_REG_DEF << _TAG_PRIMARY_SIZE) | TAG_PRIMARY_HEADER;
+ code[ci++] = make_loader_x_reg(tmp_op->a[arg].val);
break;
case TAG_y:
CodeNeed(1);
- code[ci++] = (tmp_op->a[arg].val << _TAG_IMMED1_SIZE) |
- (Y_REG_DEF << _TAG_PRIMARY_SIZE) | TAG_PRIMARY_HEADER;
+ code[ci++] = make_loader_y_reg(tmp_op->a[arg].val);
break;
case TAG_n:
CodeNeed(1);
@@ -2458,7 +2481,6 @@ load_code(LoaderState* stp)
stp->on_load = ci;
break;
case op_bs_put_string_II:
- case op_i_bs_match_string_rfII:
case op_i_bs_match_string_xfII:
new_string_patch(stp, ci-1);
break;
@@ -2680,6 +2702,12 @@ same_label(LoaderState* stp, GenOpArg Target, GenOpArg Label)
Target.val == Label.val;
}
+static int
+is_killed(LoaderState* stp, GenOpArg Reg, GenOpArg Live)
+{
+ return Reg.type == TAG_x && Live.type == TAG_u &&
+ Live.val <= Reg.val;
+}
/*
* Generate an instruction for element/2.
@@ -2696,17 +2724,17 @@ gen_element(LoaderState* stp, GenOpArg Fail, GenOpArg Index,
op->next = NULL;
if (Index.type == TAG_i && Index.val > 0 &&
- (Tuple.type == TAG_r || Tuple.type == TAG_x || Tuple.type == TAG_y)) {
+ (Tuple.type == TAG_x || Tuple.type == TAG_y)) {
op->op = genop_i_fast_element_4;
- op->a[0] = Tuple;
- op->a[1] = Fail;
+ op->a[0] = Fail;
+ op->a[1] = Tuple;
op->a[2].type = TAG_u;
op->a[2].val = Index.val;
op->a[3] = Dst;
} else {
op->op = genop_i_element_4;
- op->a[0] = Tuple;
- op->a[1] = Fail;
+ op->a[0] = Fail;
+ op->a[1] = Tuple;
op->a[2] = Index;
op->a[3] = Dst;
}
@@ -2832,23 +2860,16 @@ gen_get_integer2(LoaderState* stp, GenOpArg Fail, GenOpArg Ms, GenOpArg Live,
goto generic;
}
} else {
- GenOp* op2;
- NEW_GENOP(stp, op2);
-
- op->op = genop_i_fetch_2;
- op->arity = 2;
- op->a[0] = Ms;
- op->a[1] = Size;
- op->next = op2;
-
- op2->op = genop_i_bs_get_integer_4;
- op2->arity = 4;
- op2->a[0] = Fail;
- op2->a[1] = Live;
- op2->a[2].type = TAG_u;
- op2->a[2].val = (Unit.val << 3) | Flags.val;
- op2->a[3] = Dst;
- op2->next = NULL;
+ op->op = genop_i_bs_get_integer_6;
+ op->arity = 6;
+ op->a[0] = Fail;
+ op->a[1] = Live;
+ op->a[2].type = TAG_u;
+ op->a[2].val = (Unit.val << 3) | Flags.val;
+ op->a[3] = Ms;
+ op->a[4] = Size;
+ op->a[5] = Dst;
+ op->next = NULL;
return op;
}
op->next = NULL;
@@ -3272,14 +3293,14 @@ gen_literal_timeout(LoaderState* stp, GenOpArg Fail, GenOpArg Time)
op->a[1].type = TAG_u;
if (Time.type == TAG_i && (timeout = Time.val) >= 0 &&
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
(timeout >> 32) == 0
#else
1
#endif
) {
op->a[1].val = timeout;
-#if !defined(ARCH_64) || HALFWORD_HEAP
+#if !defined(ARCH_64)
} else if (Time.type == TAG_q) {
Eterm big;
@@ -3296,7 +3317,7 @@ gen_literal_timeout(LoaderState* stp, GenOpArg Fail, GenOpArg Time)
}
#endif
} else {
-#if !defined(ARCH_64) || HALFWORD_HEAP
+#if !defined(ARCH_64)
error:
#endif
op->op = genop_i_wait_error_0;
@@ -3319,14 +3340,14 @@ gen_literal_timeout_locked(LoaderState* stp, GenOpArg Fail, GenOpArg Time)
op->a[1].type = TAG_u;
if (Time.type == TAG_i && (timeout = Time.val) >= 0 &&
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
(timeout >> 32) == 0
#else
1
#endif
) {
op->a[1].val = timeout;
-#if !defined(ARCH_64) || HALFWORD_HEAP
+#if !defined(ARCH_64)
} else if (Time.type == TAG_q) {
Eterm big;
@@ -3343,7 +3364,7 @@ gen_literal_timeout_locked(LoaderState* stp, GenOpArg Fail, GenOpArg Time)
}
#endif
} else {
-#if !defined(ARCH_64) || HALFWORD_HEAP
+#if !defined(ARCH_64)
error:
#endif
op->op = genop_i_wait_error_locked_0;
@@ -3899,9 +3920,7 @@ gen_make_fun2(LoaderState* stp, GenOpArg idx)
/*
* Rewrite gc_bifs with one parameter (the common case). Utilized
* in ops.tab to rewrite instructions calling bif's in guards
- * to use a garbage collecting implementation. The instructions
- * are sometimes once again rewritten to handle literals (putting the
- * parameter in the mostly unused r[0] before the instruction is executed).
+ * to use a garbage collecting implementation.
*/
static GenOp*
gen_guard_bif1(LoaderState* stp, GenOpArg Fail, GenOpArg Live, GenOpArg Bif,
@@ -3956,10 +3975,6 @@ gen_guard_bif1(LoaderState* stp, GenOpArg Fail, GenOpArg Live, GenOpArg Bif,
/*
* This is used by the ops.tab rule that rewrites gc_bifs with two parameters.
- * The instruction returned is then again rewritten to an i_load instruction
- * followed by i_gc_bif2_jIId, to handle literals properly.
- * As opposed to the i_gc_bif1_jIsId, the instruction i_gc_bif2_jIId is
- * always rewritten, regardless of if there actually are any literals.
*/
static GenOp*
gen_guard_bif2(LoaderState* stp, GenOpArg Fail, GenOpArg Live, GenOpArg Bif,
@@ -3986,23 +4001,19 @@ gen_guard_bif2(LoaderState* stp, GenOpArg Fail, GenOpArg Live, GenOpArg Bif,
op->a[2].val = stp->import[Bif.val].arity;
return op;
}
- op->op = genop_ii_gc_bif2_6;
+ op->op = genop_i_gc_bif2_6;
op->arity = 6;
op->a[0] = Fail;
op->a[1].type = TAG_u;
- op->a[2] = S1;
- op->a[3] = S2;
- op->a[4] = Live;
+ op->a[2] = Live;
+ op->a[3] = S1;
+ op->a[4] = S2;
op->a[5] = Dst;
return op;
}
/*
* This is used by the ops.tab rule that rewrites gc_bifs with three parameters.
- * The instruction returned is then again rewritten to a move instruction that
- * uses r[0] for temp storage, followed by an i_load instruction,
- * followed by i_gc_bif3_jIsId, to handle literals properly. Rewriting
- * always occur, as with the gc_bif2 counterpart.
*/
static GenOp*
gen_guard_bif3(LoaderState* stp, GenOpArg Fail, GenOpArg Live, GenOpArg Bif,
@@ -4033,10 +4044,10 @@ gen_guard_bif3(LoaderState* stp, GenOpArg Fail, GenOpArg Live, GenOpArg Bif,
op->arity = 7;
op->a[0] = Fail;
op->a[1].type = TAG_u;
- op->a[2] = S1;
- op->a[3] = S2;
- op->a[4] = S3;
- op->a[5] = Live;
+ op->a[2] = Live;
+ op->a[3] = S1;
+ op->a[4] = S2;
+ op->a[5] = S3;
op->a[6] = Dst;
op->next = NULL;
return op;
@@ -4323,7 +4334,7 @@ gen_has_map_fields(LoaderState* stp, GenOpArg Fail, GenOpArg Src,
for (i = 0; i < n; i++) {
op->a[3+2*i] = Rest[i];
op->a[3+2*i+1].type = TAG_x;
- op->a[3+2*i+1].val = 0; /* x(0); normally not used */
+ op->a[3+2*i+1].val = SCRATCH_X_REG; /* Ignore result */
}
return op;
}
@@ -4801,7 +4812,8 @@ transform_engine(LoaderState* st)
if (var[i].type != instr->a[ap].type)
goto restart;
switch (var[i].type) {
- case TAG_r: case TAG_n: break;
+ case TAG_n:
+ break;
default:
if (var[i].val != instr->a[ap].val)
goto restart;
@@ -5868,7 +5880,7 @@ make_stub(BeamInstr* fp, Eterm mod, Eterm func, Uint arity, Uint native, BeamIns
fp[4] = arity;
#ifdef HIPE
if (native) {
- fp[5] = BeamOpCode(op_move_return_nr);
+ fp[5] = BeamOpCode(op_move_return_n);
hipe_mfa_save_orig_beam_op(mod, func, arity, fp+5);
}
#endif
@@ -6304,7 +6316,7 @@ erts_make_stub_module(Process* p, Eterm Mod, Eterm Beam, Eterm Info)
#ifdef HIPE
op = (Eterm) BeamOpCode(op_hipe_trap_call); /* Might be changed later. */
#else
- op = (Eterm) BeamOpCode(op_move_return_nr);
+ op = (Eterm) BeamOpCode(op_move_return_n);
#endif
fp = make_stub(fp, Mod, func, arity, (Uint)native_address, op);
}
diff --git a/erts/emulator/beam/beam_load.h b/erts/emulator/beam/beam_load.h
index d5af634fad..eedb5ee4cd 100644
--- a/erts/emulator/beam/beam_load.h
+++ b/erts/emulator/beam/beam_load.h
@@ -52,6 +52,7 @@ extern BeamInstr* em_call_error_handler;
extern BeamInstr* em_apply_bif;
extern BeamInstr* em_call_nif;
+
/*
* The following variables keep a sorted list of address ranges for
* each module. It allows us to quickly find a function given an
diff --git a/erts/emulator/beam/bif.c b/erts/emulator/beam/bif.c
index 4e3a1cef69..453ac74c90 100644
--- a/erts/emulator/beam/bif.c
+++ b/erts/emulator/beam/bif.c
@@ -616,7 +616,7 @@ erts_queue_monitor_message(Process *p,
}
static BIF_RETTYPE
-local_pid_monitor(Process *p, Eterm target, Eterm mon_ref, int bool)
+local_pid_monitor(Process *p, Eterm target, Eterm mon_ref, int boolean)
{
BIF_RETTYPE ret;
Process *rp;
@@ -634,7 +634,7 @@ local_pid_monitor(Process *p, Eterm target, Eterm mon_ref, int bool)
if (!rp) {
erts_smp_proc_unlock(p, ERTS_PROC_LOCK_LINK);
p_locks &= ~ERTS_PROC_LOCK_LINK;
- if (bool)
+ if (boolean)
ret = am_false;
else
erts_queue_monitor_message(p, &p_locks,
@@ -643,7 +643,7 @@ local_pid_monitor(Process *p, Eterm target, Eterm mon_ref, int bool)
else {
ASSERT(rp != p);
- if (bool)
+ if (boolean)
ret = am_true;
erts_add_monitor(&ERTS_P_MONITORS(p), MON_ORIGIN, mon_ref, target, NIL);
@@ -4117,16 +4117,9 @@ BIF_RETTYPE make_fun_3(BIF_ALIST_3)
if (arity < 0) {
goto error;
}
-#if HALFWORD_HEAP
- hp = HAlloc(BIF_P, 3);
- hp[0] = HEADER_EXPORT;
- /* Yes, May be misaligned, but X86_64 will fix it... */
- *((Export **) (hp+1)) = erts_export_get_or_make_stub(BIF_ARG_1, BIF_ARG_2, (Uint) arity);
-#else
hp = HAlloc(BIF_P, 2);
hp[0] = HEADER_EXPORT;
hp[1] = (Eterm) erts_export_get_or_make_stub(BIF_ARG_1, BIF_ARG_2, (Uint) arity);
-#endif
BIF_RET(make_export(hp));
}
@@ -4631,7 +4624,7 @@ BIF_RETTYPE hash_2(BIF_ALIST_2)
if ((range = signed_val(BIF_ARG_2)) <= 0) { /* [1..MAX_SMALL] */
BIF_ERROR(BIF_P, BADARG);
}
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
if (range > ((1L << 27) - 1))
BIF_ERROR(BIF_P, BADARG);
#endif
@@ -4703,7 +4696,7 @@ BIF_RETTYPE phash2_2(BIF_ALIST_2)
/*
* Return either a small or a big. Use the heap for bigs if there is room.
*/
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
BIF_RET(make_small(final_hash));
#else
if (IS_USMALL(0, final_hash)) {
diff --git a/erts/emulator/beam/big.c b/erts/emulator/beam/big.c
index 044bf6a34e..02d37e24df 100644
--- a/erts/emulator/beam/big.c
+++ b/erts/emulator/beam/big.c
@@ -1487,20 +1487,8 @@ Eterm uint_to_big(Uint x, Eterm *y)
Eterm uword_to_big(UWord x, Eterm *y)
{
-#if HALFWORD_HEAP
- Uint upper = x >> 32;
- Uint lower = x & 0xFFFFFFFFUL;
- if (upper == 0) {
- *y = make_pos_bignum_header(1);
- } else {
- *y = make_pos_bignum_header(2);
- BIG_DIGIT(y, 1) = upper;
- }
- BIG_DIGIT(y, 0) = lower;
-#else
*y = make_pos_bignum_header(1);
BIG_DIGIT(y, 0) = x;
-#endif
return make_big(y);
}
@@ -1525,7 +1513,7 @@ Eterm small_to_big(Sint x, Eterm *y)
Eterm erts_uint64_to_big(Uint64 x, Eterm **hpp)
{
Eterm *hp = *hpp;
-#if defined(ARCH_32) || HALFWORD_HEAP
+#if defined(ARCH_32)
if (x >= (((Uint64) 1) << 32)) {
*hp = make_pos_bignum_header(2);
BIG_DIGIT(hp, 0) = (Uint) (x & ((Uint) 0xffffffff));
@@ -1555,7 +1543,7 @@ Eterm erts_sint64_to_big(Sint64 x, Eterm **hpp)
neg = 1;
ux = -(Uint64)x;
}
-#if defined(ARCH_32) || HALFWORD_HEAP
+#if defined(ARCH_32)
if (ux >= (((Uint64) 1) << 32)) {
if (neg)
*hp = make_neg_bignum_header(2);
@@ -1588,7 +1576,7 @@ erts_uint64_array_to_big(Uint **hpp, int neg, int len, Uint64 *array)
pot_digits = digits = 0;
for (i = 0; i < len; i++) {
-#if defined(ARCH_32) || HALFWORD_HEAP
+#if defined(ARCH_32)
Uint low_val = array[i] & ((Uint) 0xffffffff);
Uint high_val = (array[i] >> 32) & ((Uint) 0xffffffff);
BIG_DIGIT(headerp, pot_digits) = low_val;
@@ -1651,8 +1639,6 @@ big_to_double(Wterm x, double* resp)
/*
* Logic has been copied from erl_bif_guard.c and slightly
* modified to use a static instead of dynamic heap
- *
- * HALFWORD: Return relative term with 'heap' as base.
*/
Eterm
double_to_big(double x, Eterm *heap, Uint hsz)
@@ -1683,7 +1669,7 @@ double_to_big(double x, Eterm *heap, Uint hsz)
sz = BIG_NEED_SIZE(ds); /* number of words including arity */
hp = heap;
- res = make_big_rel(hp, heap);
+ res = make_big(hp);
xp = (ErtsDigit*) (hp + 1);
ASSERT(ds < hsz);
@@ -2618,6 +2604,9 @@ Eterm erts_chars_to_integer(Process *BIF_P, char *bytes,
size--;
}
+ if (size == 0)
+ goto bytebuf_to_integer_1_error;
+
if (size < SMALL_DIGITS && base <= 10) {
/* *
* Take shortcut if we know that all chars are '0' < b < '9' and
diff --git a/erts/emulator/beam/big.h b/erts/emulator/beam/big.h
index 4aa9724ae3..94f9bce10e 100644
--- a/erts/emulator/beam/big.h
+++ b/erts/emulator/beam/big.h
@@ -35,7 +35,7 @@
typedef Uint ErtsDigit;
-#if ((SIZEOF_VOID_P == 4) || HALFWORD_HEAP) && defined(SIZEOF_LONG_LONG) && (SIZEOF_LONG_LONG == 8)
+#if (SIZEOF_VOID_P == 4) && defined(SIZEOF_LONG_LONG) && (SIZEOF_LONG_LONG == 8)
/* Assume 32-bit machine with long long support */
typedef Uint64 ErtsDoubleDigit;
typedef Uint16 ErtsHalfDigit;
@@ -90,13 +90,9 @@ typedef Uint dsize_t; /* Vector size type */
#define BIG_UINT_HEAP_SIZE (1 + 1) /* always, since sizeof(Uint) <= sizeof(Eterm) */
-#if HALFWORD_HEAP
-#define BIG_UWORD_HEAP_SIZE(UW) (((UW) >> (sizeof(Uint) * 8)) ? 3 : 2)
-#else
#define BIG_UWORD_HEAP_SIZE(UW) BIG_UINT_HEAP_SIZE
-#endif
-#if defined(ARCH_32) || HALFWORD_HEAP
+#if defined(ARCH_32)
#define ERTS_UINT64_BIG_HEAP_SIZE__(X) \
((X) >= (((Uint64) 1) << 32) ? (1 + 2) : (1 + 1))
@@ -178,4 +174,3 @@ Eterm erts_sint64_to_big(Sint64, Eterm **);
Eterm erts_chars_to_integer(Process *, char*, Uint, const int);
#endif
-
diff --git a/erts/emulator/beam/break.c b/erts/emulator/beam/break.c
index 64c8bc5e58..4ce9d24479 100644
--- a/erts/emulator/beam/break.c
+++ b/erts/emulator/beam/break.c
@@ -536,7 +536,9 @@ do_break(void)
erts_printf("Erlang (%s) emulator version "
ERLANG_VERSION "\n",
EMULATOR);
+#if ERTS_SAVED_COMPILE_TIME
erts_printf("Compiled on " ERLANG_COMPILE_DATE "\n");
+#endif
return;
case 'd':
distribution_info(ERTS_PRINT_STDOUT, NULL);
@@ -774,7 +776,9 @@ erl_crash_dump_v(char *file, int line, char* fmt, va_list args)
}
erts_fdprintf(fd, "System version: ");
erts_print_system_version(fd, NULL, NULL);
+#if ERTS_SAVED_COMPILE_TIME
erts_fdprintf(fd, "%s\n", "Compiled: " ERLANG_COMPILE_DATE);
+#endif
erts_fdprintf(fd, "Taints: ");
erts_print_nif_taints(fd, NULL);
diff --git a/erts/emulator/beam/copy.c b/erts/emulator/beam/copy.c
index 8849dadd00..ec769c3b49 100644
--- a/erts/emulator/beam/copy.c
+++ b/erts/emulator/beam/copy.c
@@ -40,40 +40,37 @@ static void move_one_frag(Eterm** hpp, ErlHeapFragment*, ErlOffHeap*);
/*
* Copy object "obj" to process p.
*/
-Eterm
-copy_object(Eterm obj, Process* to)
-{
- Uint size = size_object(obj);
- Eterm* hp = HAlloc(to, size);
- Eterm res;
+Eterm copy_object_x(Eterm obj, Process* to, Uint extra) {
+ if (!is_immed(obj)) {
+ Uint size = size_object(obj);
+ Eterm* hp = HAllocX(to, size, extra);
+ Eterm res;
#ifdef USE_VM_PROBES
- if (DTRACE_ENABLED(copy_object)) {
- DTRACE_CHARBUF(proc_name, 64);
+ if (DTRACE_ENABLED(copy_object)) {
+ DTRACE_CHARBUF(proc_name, 64);
- erts_snprintf(proc_name, sizeof(DTRACE_CHARBUF_NAME(proc_name)),
- "%T", to->common.id);
- DTRACE2(copy_object, proc_name, size);
- }
+ erts_snprintf(proc_name, sizeof(DTRACE_CHARBUF_NAME(proc_name)),
+ "%T", to->common.id);
+ DTRACE2(copy_object, proc_name, size);
+ }
#endif
- res = copy_struct(obj, size, &hp, &to->off_heap);
+ res = copy_struct(obj, size, &hp, &to->off_heap);
#ifdef DEBUG
- if (eq(obj, res) == 0) {
- erl_exit(ERTS_ABORT_EXIT, "copy not equal to source\n");
- }
+ if (eq(obj, res) == 0) {
+ erl_exit(ERTS_ABORT_EXIT, "copy not equal to source\n");
+ }
#endif
- return res;
+ return res;
+ }
+ return obj;
}
/*
* Return the "flat" size of the object.
*/
-#if HALFWORD_HEAP
-Uint size_object_rel(Eterm obj, Eterm* base)
-#else
Uint size_object(Eterm obj)
-#endif
{
Uint sum = 0;
Eterm* ptr;
@@ -84,7 +81,7 @@ Uint size_object(Eterm obj)
switch (primary_tag(obj)) {
case TAG_PRIMARY_LIST:
sum += 2;
- ptr = list_val_rel(obj,base);
+ ptr = list_val(obj);
obj = *ptr++;
if (!IS_CONST(obj)) {
ESTACK_PUSH(s, obj);
@@ -93,11 +90,11 @@ Uint size_object(Eterm obj)
break;
case TAG_PRIMARY_BOXED:
{
- Eterm hdr = *boxed_val_rel(obj,base);
+ Eterm hdr = *boxed_val(obj);
ASSERT(is_header(hdr));
switch (hdr & _TAG_HEADER_MASK) {
case ARITYVAL_SUBTAG:
- ptr = tuple_val_rel(obj,base);
+ ptr = tuple_val(obj);
arity = header_arity(hdr);
sum += arity + 1;
if (arity == 0) { /* Empty tuple -- unusual. */
@@ -113,7 +110,7 @@ Uint size_object(Eterm obj)
break;
case FUN_SUBTAG:
{
- Eterm* bptr = fun_val_rel(obj,base);
+ Eterm* bptr = fun_val(obj);
ErlFunThing* funp = (ErlFunThing *) bptr;
unsigned eterms = 1 /* creator */ + funp->num_free;
unsigned sz = thing_arityval(hdr);
@@ -134,7 +131,7 @@ Uint size_object(Eterm obj)
{
Uint n;
flatmap_t *mp;
- mp = (flatmap_t*)flatmap_val_rel(obj,base);
+ mp = (flatmap_t*)flatmap_val(obj);
ptr = (Eterm *)mp;
n = flatmap_get_size(mp) + 1;
sum += n + 2;
@@ -153,7 +150,7 @@ Uint size_object(Eterm obj)
{
Eterm *head;
Uint sz;
- head = hashmap_val_rel(obj, base);
+ head = hashmap_val(obj);
sz = hashmap_bitcount(MAP_HEADER_VAL(hdr));
sum += 1 + sz + header_arity(hdr);
head += 1 + header_arity(hdr);
@@ -182,7 +179,7 @@ Uint size_object(Eterm obj)
Uint bitoffs;
Uint extra_bytes;
Eterm hdr;
- ERTS_GET_REAL_BIN_REL(obj, real_bin, offset, bitoffs, bitsize, base);
+ ERTS_GET_REAL_BIN(obj, real_bin, offset, bitoffs, bitsize);
if ((bitsize + bitoffs) > 8) {
sum += ERL_SUB_BIN_SIZE;
extra_bytes = 2;
@@ -192,11 +189,11 @@ Uint size_object(Eterm obj)
} else {
extra_bytes = 0;
}
- hdr = *binary_val_rel(real_bin,base);
+ hdr = *binary_val(real_bin);
if (thing_subtag(hdr) == REFC_BINARY_SUBTAG) {
sum += PROC_BIN_SIZE;
} else {
- sum += heap_bin_size(binary_size_rel(obj,base)+extra_bytes);
+ sum += heap_bin_size(binary_size(obj)+extra_bytes);
}
goto pop_next;
}
@@ -227,12 +224,7 @@ Uint size_object(Eterm obj)
/*
* Copy a structure to a heap.
*/
-#if HALFWORD_HEAP
-Eterm copy_struct_rel(Eterm obj, Uint sz, Eterm** hpp, ErlOffHeap* off_heap,
- Eterm* src_base, Eterm* dst_base)
-#else
Eterm copy_struct(Eterm obj, Uint sz, Eterm** hpp, ErlOffHeap* off_heap)
-#endif
{
char* hstart;
Uint hsize;
@@ -268,7 +260,7 @@ Eterm copy_struct(Eterm obj, Uint sz, Eterm** hpp, ErlOffHeap* off_heap)
switch (primary_tag(obj)) {
case TAG_PRIMARY_LIST:
argp = &res;
- objp = list_val_rel(obj,src_base);
+ objp = list_val(obj);
goto L_copy_list;
case TAG_PRIMARY_BOXED: argp = &res; goto L_copy_boxed;
default:
@@ -286,14 +278,11 @@ Eterm copy_struct(Eterm obj, Uint sz, Eterm** hpp, ErlOffHeap* off_heap)
hp++;
break;
case TAG_PRIMARY_LIST:
- objp = list_val_rel(obj,src_base);
- #if !HALFWORD_HEAP || defined(DEBUG)
+ objp = list_val(obj);
if (in_area(objp,hstart,hsize)) {
- ASSERT(!HALFWORD_HEAP);
hp++;
break;
}
- #endif
argp = hp++;
/* Fall through */
@@ -309,23 +298,15 @@ Eterm copy_struct(Eterm obj, Uint sz, Eterm** hpp, ErlOffHeap* off_heap)
}
else {
CAR(htop) = elem;
- #if HALFWORD_HEAP
- CDR(htop) = CDR(objp);
- *tailp = make_list_rel(htop,dst_base);
- htop += 2;
- goto L_copy;
- #else
tailp = &CDR(htop);
htop += 2;
- #endif
}
- ASSERT(!HALFWORD_HEAP || tp < hp || tp >= hbot);
- *tp = make_list_rel(tailp - 1, dst_base);
+ *tp = make_list(tailp - 1);
obj = CDR(objp);
if (!is_list(obj)) {
break;
}
- objp = list_val_rel(obj,src_base);
+ objp = list_val(obj);
}
switch (primary_tag(obj)) {
case TAG_PRIMARY_IMMED1: *tailp = obj; goto L_copy;
@@ -337,24 +318,21 @@ Eterm copy_struct(Eterm obj, Uint sz, Eterm** hpp, ErlOffHeap* off_heap)
}
case TAG_PRIMARY_BOXED:
- #if !HALFWORD_HEAP || defined(DEBUG)
- if (in_area(boxed_val_rel(obj,src_base),hstart,hsize)) {
- ASSERT(!HALFWORD_HEAP);
+ if (in_area(boxed_val(obj),hstart,hsize)) {
hp++;
break;
}
- #endif
argp = hp++;
L_copy_boxed:
- objp = boxed_val_rel(obj, src_base);
+ objp = boxed_val(obj);
hdr = *objp;
switch (hdr & _TAG_HEADER_MASK) {
case ARITYVAL_SUBTAG:
{
int const_flag = 1; /* assume constant tuple */
i = arityval(hdr);
- *argp = make_tuple_rel(htop, dst_base);
+ *argp = make_tuple(htop);
tp = htop; /* tp is pointer to new arity value */
*htop++ = *objp++; /* copy arity value */
while (i--) {
@@ -383,7 +361,7 @@ Eterm copy_struct(Eterm obj, Uint sz, Eterm** hpp, ErlOffHeap* off_heap)
while (i--) {
*tp++ = *objp++;
}
- *argp = make_binary_rel(hbot, dst_base);
+ *argp = make_binary(hbot);
pb = (ProcBin*) hbot;
erts_refc_inc(&pb->val->refc, 2);
pb->next = off_heap->first;
@@ -410,7 +388,7 @@ Eterm copy_struct(Eterm obj, Uint sz, Eterm** hpp, ErlOffHeap* off_heap)
extra_bytes = 0;
}
real_size = size+extra_bytes;
- objp = binary_val_rel(real_bin,src_base);
+ objp = binary_val(real_bin);
if (thing_subtag(*objp) == HEAP_BINARY_SUBTAG) {
ErlHeapBin* from = (ErlHeapBin *) objp;
ErlHeapBin* to;
@@ -440,7 +418,7 @@ Eterm copy_struct(Eterm obj, Uint sz, Eterm** hpp, ErlOffHeap* off_heap)
off_heap->first = (struct erl_off_heap_header*) to;
OH_OVERHEAD(off_heap, to->size / sizeof(Eterm));
}
- *argp = make_binary_rel(hbot, dst_base);
+ *argp = make_binary(hbot);
if (extra_bytes != 0) {
ErlSubBin* res;
hbot -= ERL_SUB_BIN_SIZE;
@@ -452,7 +430,7 @@ Eterm copy_struct(Eterm obj, Uint sz, Eterm** hpp, ErlOffHeap* off_heap)
res->offs = 0;
res->is_writable = 0;
res->orig = *argp;
- *argp = make_binary_rel(hbot, dst_base);
+ *argp = make_binary(hbot);
}
break;
}
@@ -470,7 +448,7 @@ Eterm copy_struct(Eterm obj, Uint sz, Eterm** hpp, ErlOffHeap* off_heap)
funp->next = off_heap->first;
off_heap->first = (struct erl_off_heap_header*) funp;
erts_refc_inc(&funp->fe->refc, 2);
- *argp = make_fun_rel(tp, dst_base);
+ *argp = make_fun(tp);
}
break;
case EXTERNAL_PID_SUBTAG:
@@ -490,7 +468,7 @@ Eterm copy_struct(Eterm obj, Uint sz, Eterm** hpp, ErlOffHeap* off_heap)
off_heap->first = (struct erl_off_heap_header*)etp;
erts_refc_inc(&etp->node->refc, 2);
- *argp = make_external_rel(tp, dst_base);
+ *argp = make_external(tp);
}
break;
case MAP_SUBTAG:
@@ -498,7 +476,7 @@ Eterm copy_struct(Eterm obj, Uint sz, Eterm** hpp, ErlOffHeap* off_heap)
switch (MAP_HEADER_TYPE(hdr)) {
case MAP_HEADER_TAG_FLATMAP_HEAD :
i = flatmap_get_size(objp) + 3;
- *argp = make_flatmap_rel(htop, dst_base);
+ *argp = make_flatmap(htop);
while (i--) {
*htop++ = *objp++;
}
@@ -509,7 +487,7 @@ Eterm copy_struct(Eterm obj, Uint sz, Eterm** hpp, ErlOffHeap* off_heap)
case MAP_HEADER_TAG_HAMT_NODE_BITMAP :
i = 1 + hashmap_bitcount(MAP_HEADER_VAL(hdr));
while (i--) { *htop++ = *objp++; }
- *argp = make_hashmap_rel(tp, dst_base);
+ *argp = make_hashmap(tp);
break;
default:
erl_exit(ERTS_ABORT_EXIT, "copy_struct: bad hashmap type %d\n", MAP_HEADER_TYPE(hdr));
@@ -522,7 +500,7 @@ Eterm copy_struct(Eterm obj, Uint sz, Eterm** hpp, ErlOffHeap* off_heap)
i = thing_arityval(hdr)+1;
hbot -= i;
tp = hbot;
- *argp = make_boxed_rel(hbot, dst_base);
+ *argp = make_boxed(hbot);
while (i--) {
*tp++ = *objp++;
}
@@ -563,21 +541,12 @@ Eterm copy_struct(Eterm obj, Uint sz, Eterm** hpp, ErlOffHeap* off_heap)
*
* NOTE: Assumes that term is a tuple (ptr is an untagged tuple ptr).
*/
-#if HALFWORD_HEAP
-Eterm copy_shallow_rel(Eterm* ptr, Uint sz, Eterm** hpp, ErlOffHeap* off_heap,
- Eterm* src_base)
-#else
Eterm copy_shallow(Eterm* ptr, Uint sz, Eterm** hpp, ErlOffHeap* off_heap)
-#endif
{
Eterm* tp = ptr;
Eterm* hp = *hpp;
const Eterm res = make_tuple(hp);
-#if HALFWORD_HEAP
- const Sint offs = COMPRESS_POINTER(hp - (tp - src_base));
-#else
const Sint offs = (hp - tp) * sizeof(Eterm);
-#endif
while (sz--) {
Eterm val = *tp++;
diff --git a/erts/emulator/beam/dist.c b/erts/emulator/beam/dist.c
index 23897a49ae..10dd6cf206 100644
--- a/erts/emulator/beam/dist.c
+++ b/erts/emulator/beam/dist.c
@@ -45,6 +45,8 @@
#include "erl_thr_progress.h"
#include "dtrace-wrapper.h"
+#define DIST_CTL_DEFAULT_SIZE 64
+
/* Turn this on to get printouts of all distribution messages
* which go on the line
*/
@@ -66,9 +68,13 @@ static void bw(byte *buf, ErlDrvSizeT sz)
static void
dist_msg_dbg(ErtsDistExternal *edep, char *what, byte *buf, int sz)
{
+ ErtsHeapFactory factory;
+ DeclareTmpHeapNoproc(ctl_default,DIST_CTL_DEFAULT_SIZE);
+ Eterm* ctl = ctl_default;
byte *extp = edep->extp;
Eterm msg;
- Sint size = erts_decode_dist_ext_size(edep);
+ Sint ctl_len;
+ Sint size = ctl_len = erts_decode_dist_ext_size(edep);
if (size < 0) {
erts_fprintf(stderr,
"DIST MSG DEBUG: erts_decode_dist_ext_size(%s) failed:\n",
@@ -76,10 +82,9 @@ dist_msg_dbg(ErtsDistExternal *edep, char *what, byte *buf, int sz)
bw(buf, sz);
}
else {
- Eterm *hp;
ErlHeapFragment *mbuf = new_message_buffer(size);
- hp = mbuf->mem;
- msg = erts_decode_dist_ext(&hp, &mbuf->off_heap, edep);
+ erts_factory_static_init(&factory, ctl, ctl_len, &mbuf->off_heap);
+ msg = erts_decode_dist_ext(&factory, edep);
if (is_value(msg))
erts_fprintf(stderr, " %s: %T\n", what, msg);
else {
@@ -732,19 +737,11 @@ Eterm erts_dsend_export_trap_context(Process* p, ErtsSendContext* ctx)
Binary* ctx_bin = erts_create_magic_binary(sizeof(struct exported_ctx),
erts_dsend_context_dtor);
struct exported_ctx* dst = ERTS_MAGIC_BIN_DATA(ctx_bin);
- Uint ctl_size = !HALFWORD_HEAP ? 0 : (arityval(ctx->ctl_heap[0]) + 1);
- Eterm* hp = HAlloc(p, ctl_size + PROC_BIN_SIZE);
+ Eterm* hp = HAlloc(p, PROC_BIN_SIZE);
sys_memcpy(&dst->ctx, ctx, sizeof(ErtsSendContext));
ASSERT(ctx->dss.ctl == make_tuple(ctx->ctl_heap));
-#if !HALFWORD_HEAP
dst->ctx.dss.ctl = make_tuple(dst->ctx.ctl_heap);
-#else
- /* Must put control tuple in low mem */
- sys_memcpy(hp, ctx->ctl_heap, ctl_size*sizeof(Eterm));
- dst->ctx.dss.ctl = make_tuple(hp);
- hp += ctl_size;
-#endif
if (ctx->dss.acmp) {
sys_memcpy(&dst->acm, ctx->dss.acmp, sizeof(ErtsAtomCacheMap));
dst->ctx.dss.acmp = &dst->acm;
@@ -1136,7 +1133,6 @@ int erts_net_message(Port *prt,
byte *buf,
ErlDrvSizeT len)
{
-#define DIST_CTL_DEFAULT_SIZE 64
ErtsDistExternal ede;
byte *t;
Sint ctl_len;
@@ -1790,8 +1786,8 @@ erts_dsig_send(ErtsDSigData *dsdp, struct erts_dsig_send_context* ctx)
#ifdef ERTS_DIST_MSG_DBG
erts_fprintf(stderr, ">>%s CTL: %T\n", ctx->pass_through_size ? "P" : " ", ctx->ctl);
- if (is_value(msg))
- erts_fprintf(stderr, " MSG: %T\n", msg);
+ if (is_value(ctx->msg))
+ erts_fprintf(stderr, " MSG: %T\n", ctx->msg);
#endif
ctx->data_size = ctx->pass_through_size;
@@ -2061,9 +2057,9 @@ dist_port_commandv(Port *prt, ErtsDistOutputBuf *obuf)
}
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
#define ERTS_PORT_REDS_MASK__ 0x003fffffffffffffL
-#elif defined(ARCH_32) || HALFWORD_HEAP
+#elif defined(ARCH_32)
#define ERTS_PORT_REDS_MASK__ 0x003fffff
#else
# error "Ohh come on ... !?!"
diff --git a/erts/emulator/beam/erl_alloc.c b/erts/emulator/beam/erl_alloc.c
index 55c164bf11..d68f22d573 100644
--- a/erts/emulator/beam/erl_alloc.c
+++ b/erts/emulator/beam/erl_alloc.c
@@ -123,10 +123,6 @@ typedef union {
static ErtsAllocatorState_t std_alloc_state;
static ErtsAllocatorState_t ll_alloc_state;
-#if HALFWORD_HEAP
-static ErtsAllocatorState_t std_low_alloc_state;
-static ErtsAllocatorState_t ll_low_alloc_state;
-#endif
static ErtsAllocatorState_t sl_alloc_state;
static ErtsAllocatorState_t temp_alloc_state;
static ErtsAllocatorState_t eheap_alloc_state;
@@ -150,24 +146,10 @@ typedef struct {
#define ERTS_ALC_INFO_A_MSEG_ALLOC (ERTS_ALC_A_MAX + 2)
#define ERTS_ALC_INFO_A_MAX ERTS_ALC_INFO_A_MSEG_ALLOC
-#if !HALFWORD_HEAP
ERTS_SCHED_PREF_QUICK_ALLOC_IMPL(aireq,
- ErtsAllocInfoReq,
- 5,
- ERTS_ALC_T_AINFO_REQ)
-#else
-static ERTS_INLINE ErtsAllocInfoReq *
-aireq_alloc(void)
-{
- return erts_alloc(ERTS_ALC_T_AINFO_REQ, sizeof(ErtsAllocInfoReq));
-}
-
-static ERTS_INLINE void
-aireq_free(ErtsAllocInfoReq *ptr)
-{
- erts_free(ERTS_ALC_T_AINFO_REQ, ptr);
-}
-#endif
+ ErtsAllocInfoReq,
+ 5,
+ ERTS_ALC_T_AINFO_REQ)
ErtsAlcType_t erts_fix_core_allocator_ix;
@@ -229,10 +211,6 @@ typedef struct {
struct au_init ets_alloc;
struct au_init driver_alloc;
struct au_init fix_alloc;
-#if HALFWORD_HEAP
- struct au_init std_low_alloc;
- struct au_init ll_low_alloc;
-#endif
} erts_alc_hndl_args_init_t;
#define ERTS_AU_INIT__ {0, 0, 1, GOODFIT, DEFAULT_ALLCTR_INIT, {1,1,1,1}}
@@ -259,10 +237,6 @@ set_default_sl_alloc_opts(struct au_init *ip)
#endif
ip->init.util.ts = ERTS_ALC_MTA_SHORT_LIVED;
ip->init.util.rsbcst = 80;
-#if HALFWORD_HEAP
- ip->init.util.force = 1;
- ip->init.util.low_mem = 1;
-#endif
ip->init.util.acul = ERTS_ALC_DEFAULT_ACUL;
}
@@ -328,10 +302,6 @@ set_default_temp_alloc_opts(struct au_init *ip)
ip->init.util.ts = ERTS_ALC_MTA_TEMPORARY;
ip->init.util.rsbcst = 90;
ip->init.util.rmbcmt = 100;
-#if HALFWORD_HEAP
- ip->init.util.force = 1;
- ip->init.util.low_mem = 1;
-#endif
}
static void
@@ -350,10 +320,6 @@ set_default_eheap_alloc_opts(struct au_init *ip)
#endif
ip->init.util.ts = ERTS_ALC_MTA_EHEAP;
ip->init.util.rsbcst = 50;
-#if HALFWORD_HEAP
- ip->init.util.force = 1;
- ip->init.util.low_mem = 1;
-#endif
ip->init.util.acul = ERTS_ALC_DEFAULT_ACUL_EHEAP_ALLOC;
}
@@ -560,12 +526,10 @@ erts_alloc_init(int *argc, char **argv, ErtsAllocInitOpts *eaiop)
fix_type_sizes[ERTS_ALC_FIX_TYPE_IX(ERTS_ALC_T_PROC)]
= sizeof(Process);
-#if !HALFWORD_HEAP
fix_type_sizes[ERTS_ALC_FIX_TYPE_IX(ERTS_ALC_T_MONITOR_SH)]
= ERTS_MONITOR_SH_SIZE * sizeof(Uint);
fix_type_sizes[ERTS_ALC_FIX_TYPE_IX(ERTS_ALC_T_NLINK_SH)]
= ERTS_LINK_SH_SIZE * sizeof(Uint);
-#endif
fix_type_sizes[ERTS_ALC_FIX_TYPE_IX(ERTS_ALC_T_DRV_EV_D_STATE)]
= sizeof(ErtsDrvEventDataState);
fix_type_sizes[ERTS_ALC_FIX_TYPE_IX(ERTS_ALC_T_DRV_SEL_D_STATE)]
@@ -745,24 +709,6 @@ erts_alloc_init(int *argc, char **argv, ErtsAllocInitOpts *eaiop)
erts_allctrs[ERTS_ALC_A_SYSTEM].free = erts_sys_free;
erts_allctrs_info[ERTS_ALC_A_SYSTEM].enabled = 1;
-#if HALFWORD_HEAP
- /* Init low memory variants by cloning */
- init.std_low_alloc = init.std_alloc;
- init.std_low_alloc.init.util.name_prefix = "std_low_";
- init.std_low_alloc.init.util.alloc_no = ERTS_ALC_A_STANDARD_LOW;
- init.std_low_alloc.init.util.force = 1;
- init.std_low_alloc.init.util.low_mem = 1;
-
- init.ll_low_alloc = init.ll_alloc;
- init.ll_low_alloc.init.util.name_prefix = "ll_low_";
- init.ll_low_alloc.init.util.alloc_no = ERTS_ALC_A_LONG_LIVED_LOW;
- init.ll_low_alloc.init.util.force = 1;
- init.ll_low_alloc.init.util.low_mem = 1;
-
- set_au_allocator(ERTS_ALC_A_STANDARD_LOW, &init.std_low_alloc, ncpu);
- set_au_allocator(ERTS_ALC_A_LONG_LIVED_LOW, &init.ll_low_alloc, ncpu);
-#endif /* HALFWORD */
-
set_au_allocator(ERTS_ALC_A_TEMPORARY, &init.temp_alloc, ncpu);
set_au_allocator(ERTS_ALC_A_SHORT_LIVED, &init.sl_alloc, ncpu);
set_au_allocator(ERTS_ALC_A_STANDARD, &init.std_alloc, ncpu);
@@ -805,14 +751,6 @@ erts_alloc_init(int *argc, char **argv, ErtsAllocInitOpts *eaiop)
start_au_allocator(ERTS_ALC_A_LONG_LIVED,
&init.ll_alloc,
&ll_alloc_state);
-#if HALFWORD_HEAP
- start_au_allocator(ERTS_ALC_A_LONG_LIVED_LOW,
- &init.ll_low_alloc,
- &ll_low_alloc_state);
- start_au_allocator(ERTS_ALC_A_STANDARD_LOW,
- &init.std_low_alloc,
- &std_low_alloc_state);
-#endif
start_au_allocator(ERTS_ALC_A_EHEAP,
&init.eheap_alloc,
&eheap_alloc_state);
@@ -836,9 +774,7 @@ erts_alloc_init(int *argc, char **argv, ErtsAllocInitOpts *eaiop)
erts_mtrace_install_wrapper_functions();
extra_block_size += erts_instr_init(init.instr.stat, init.instr.map);
-#if !HALFWORD_HEAP
init_aireq_alloc();
-#endif
#ifdef DEBUG
extra_block_size += install_debug_functions();
@@ -1238,9 +1174,6 @@ get_acul_value(struct au_init *auip, char *param_end, char** argv, int* ip)
if (sys_strcmp(value, "de") == 0) {
switch (auip->init.util.alloc_no) {
case ERTS_ALC_A_LONG_LIVED:
-#if HALFWORD_HEAP
- case ERTS_ALC_A_LONG_LIVED_LOW:
-#endif
return ERTS_ALC_DEFAULT_ENABLED_ACUL_LL_ALLOC;
case ERTS_ALC_A_EHEAP:
return ERTS_ALC_DEFAULT_ENABLED_ACUL_EHEAP_ALLOC;
@@ -1957,48 +1890,6 @@ alcu_size(ErtsAlcType_t ai, ErtsAlcUFixInfo_t *fi, int fisz)
return res;
}
-#if HALFWORD_HEAP
-static ERTS_INLINE int
-alcu_is_low(ErtsAlcType_t ai)
-{
- int is_low = 0;
- ASSERT(erts_allctrs_info[ai].enabled);
- ASSERT(erts_allctrs_info[ai].alloc_util);
-
- if (!erts_allctrs_info[ai].thr_spec) {
- Allctr_t *allctr = erts_allctrs_info[ai].extra;
- is_low = allctr->mseg_opt.low_mem;
- }
- else {
- ErtsAllocatorThrSpec_t *tspec = &erts_allctr_thr_spec[ai];
- int i;
-# ifdef DEBUG
- int found_one = 0;
-# endif
-
- ASSERT(tspec->enabled);
-
- for (i = tspec->size - 1; i >= 0; i--) {
- Allctr_t *allctr = tspec->allctr[i];
- if (allctr) {
-# ifdef DEBUG
- if (!found_one) {
- is_low = allctr->mseg_opt.low_mem;
- found_one = 1;
- }
- else ASSERT(is_low == allctr->mseg_opt.low_mem);
-# else
- is_low = allctr->mseg_opt.low_mem;
- break;
-# endif
- }
- }
- ASSERT(found_one);
- }
- return is_low;
-}
-#endif /* HALFWORD */
-
static ERTS_INLINE void
add_fix_values(UWord *ap, UWord *up, ErtsAlcUFixInfo_t *fi, ErtsAlcType_t type)
{
@@ -2028,9 +1919,6 @@ erts_memory(int *print_to_p, void *print_to_arg, void *proc, Eterm earg)
int code;
int ets;
int maximum;
-#if HALFWORD_HEAP
- int low;
-#endif
} want = {0};
struct {
UWord total;
@@ -2043,9 +1931,6 @@ erts_memory(int *print_to_p, void *print_to_arg, void *proc, Eterm earg)
UWord code;
UWord ets;
UWord maximum;
-#if HALFWORD_HEAP
- UWord low;
-#endif
} size = {0};
Eterm atoms[sizeof(size)/sizeof(UWord)];
UWord *uintps[sizeof(size)/sizeof(UWord)];
@@ -2104,11 +1989,6 @@ erts_memory(int *print_to_p, void *print_to_arg, void *proc, Eterm earg)
atoms[length] = am_maximum;
uintps[length++] = &size.maximum;
}
-#if HALFWORD_HEAP
- want.low = 1;
- atoms[length] = am_low;
- uintps[length++] = &size.low;
-#endif
}
else {
DeclareTmpHeapNoproc(tmp_heap,2);
@@ -2202,15 +2082,6 @@ erts_memory(int *print_to_p, void *print_to_arg, void *proc, Eterm earg)
return am_badarg;
}
break;
-#if HALFWORD_HEAP
- case am_low:
- if (!want.low) {
- want.low = 1;
- atoms[length] = am_low;
- uintps[length++] = &size.low;
- }
- break;
-#endif
default:
UnUseTmpHeapNoproc(2);
return am_badarg;
@@ -2288,11 +2159,6 @@ erts_memory(int *print_to_p, void *print_to_arg, void *proc, Eterm earg)
if (save)
*save = asz;
size.total += asz;
-#if HALFWORD_HEAP
- if (alcu_is_low(ai)) {
- size.low += asz;
- }
-#endif
}
}
}
@@ -2319,7 +2185,6 @@ erts_memory(int *print_to_p, void *print_to_arg, void *proc, Eterm earg)
&size.processes_used,
fi,
ERTS_ALC_T_PROC);
-#if !HALFWORD_HEAP
add_fix_values(&size.processes,
&size.processes_used,
fi,
@@ -2329,7 +2194,6 @@ erts_memory(int *print_to_p, void *print_to_arg, void *proc, Eterm earg)
&size.processes_used,
fi,
ERTS_ALC_T_NLINK_SH);
-#endif
add_fix_values(&size.processes,
&size.processes_used,
fi,
diff --git a/erts/emulator/beam/erl_alloc.types b/erts/emulator/beam/erl_alloc.types
index b1d511ab78..4804fb407d 100644
--- a/erts/emulator/beam/erl_alloc.types
+++ b/erts/emulator/beam/erl_alloc.types
@@ -87,11 +87,6 @@ allocator EHEAP true eheap_alloc
allocator ETS true ets_alloc
allocator FIXED_SIZE true fix_alloc
-+if halfword
-allocator LONG_LIVED_LOW true ll_low_alloc
-allocator STANDARD_LOW true std_low_alloc
-+endif
-
+else # Non smp build
allocator TEMPORARY false temp_alloc
@@ -102,11 +97,6 @@ allocator EHEAP false eheap_alloc
allocator ETS false ets_alloc
allocator FIXED_SIZE false fix_alloc
-+if halfword
-allocator LONG_LIVED_LOW false ll_low_alloc
-allocator STANDARD_LOW false std_low_alloc
-+endif
-
+endif
allocator BINARY true binary_alloc
@@ -349,29 +339,6 @@ type SSB SHORT_LIVED PROCESSES ssb
+endif
-
-+if halfword
-
-type DDLL_PROCESS STANDARD_LOW SYSTEM ddll_processes
-type MONITOR_LH STANDARD_LOW PROCESSES monitor_lh
-type NLINK_LH STANDARD_LOW PROCESSES nlink_lh
-type CODE LONG_LIVED_LOW CODE code
-type DB_HEIR_DATA STANDARD_LOW ETS db_heir_data
-type DB_MS_PSDO_PROC LONG_LIVED_LOW ETS db_match_pseudo_proc
-type SCHDLR_DATA LONG_LIVED_LOW SYSTEM scheduler_data
-type LL_TEMP_TERM LONG_LIVED_LOW SYSTEM ll_temp_term
-
-type NIF_TRAP_EXPORT STANDARD_LOW CODE nif_trap_export_entry
-type EXPORT LONG_LIVED_LOW CODE export_entry
-type MONITOR_SH STANDARD_LOW PROCESSES monitor_sh
-type NLINK_SH STANDARD_LOW PROCESSES nlink_sh
-type AINFO_REQ STANDARD_LOW SYSTEM alloc_info_request
-type SCHED_WTIME_REQ STANDARD_LOW SYSTEM sched_wall_time_request
-type GC_INFO_REQ STANDARD_LOW SYSTEM gc_info_request
-type PORT_DATA_HEAP STANDARD_LOW SYSTEM port_data_heap
-
-+else # "fullword"
-
type DDLL_PROCESS STANDARD SYSTEM ddll_processes
type MONITOR_LH STANDARD PROCESSES monitor_lh
type NLINK_LH STANDARD PROCESSES nlink_lh
@@ -390,9 +357,6 @@ type SCHED_WTIME_REQ SHORT_LIVED SYSTEM sched_wall_time_request
type GC_INFO_REQ SHORT_LIVED SYSTEM gc_info_request
type PORT_DATA_HEAP STANDARD SYSTEM port_data_heap
-+endif
-
-
#
# Types used by system specific code
#
@@ -430,21 +394,6 @@ type SYS_WRITE_BUF BINARY SYSTEM sys_write_buf
+endif
-+if ose
-
-type SYS_READ_BUF TEMPORARY SYSTEM sys_read_buf
-type FD_TAB LONG_LIVED SYSTEM fd_tab
-type FD_ENTRY_BUF STANDARD SYSTEM fd_entry_buf
-type FD_SIG_LIST SHORT_LIVED SYSTEM fd_sig_list
-type DRV_EV STANDARD SYSTEM driver_event
-type CS_PROG_PATH LONG_LIVED SYSTEM cs_prog_path
-type ENVIRONMENT TEMPORARY SYSTEM environment
-type PUTENV_STR SYSTEM SYSTEM putenv_string
-type PRT_REP_EXIT STANDARD SYSTEM port_report_exit
-
-+endif
-
-
+if win32
type DRV_DATA_BUF SYSTEM SYSTEM drv_data_buf
diff --git a/erts/emulator/beam/erl_alloc_util.c b/erts/emulator/beam/erl_alloc_util.c
index 236ee35d18..db4c30b9eb 100644
--- a/erts/emulator/beam/erl_alloc_util.c
+++ b/erts/emulator/beam/erl_alloc_util.c
@@ -2074,7 +2074,7 @@ mbc_alloc_block(Allctr_t *allctr, Uint size, Uint *blk_szp)
if (!blk) {
blk = create_carrier(allctr, get_blk_sz, CFLG_MBC);
-#if !HALFWORD_HEAP && !ERTS_SUPER_ALIGNED_MSEG_ONLY
+#if !ERTS_SUPER_ALIGNED_MSEG_ONLY
if (!blk) {
/* Emergency! We couldn't create the carrier as we wanted.
Try to place it in a sys_alloced sbc. */
@@ -3511,8 +3511,7 @@ create_carrier(Allctr_t *allctr, Uint umem_sz, UWord flags)
int is_mseg = 0;
#endif
- if (HALFWORD_HEAP
- || (ERTS_SUPER_ALIGNED_MSEG_ONLY && (flags & CFLG_MBC))
+ if ((ERTS_SUPER_ALIGNED_MSEG_ONLY && (flags & CFLG_MBC))
|| !allow_sys_alloc_carriers) {
flags |= CFLG_FORCE_MSEG;
flags &= ~CFLG_FORCE_SYS_ALLOC;
@@ -3749,11 +3748,6 @@ resize_carrier(Allctr_t *allctr, Block_t *old_blk, Uint umem_sz, UWord flags)
DEBUG_SAVE_ALIGNMENT(new_crr);
return new_blk;
}
-#if HALFWORD_HEAP
- /* Old carrier unchanged; restore stat */
- STAT_MSEG_SBC_ALLOC(allctr, old_crr_sz, old_blk_sz);
- return NULL;
-#endif
create_flags |= CFLG_FORCE_SYS_ALLOC; /* since mseg_realloc()
failed */
}
@@ -3942,9 +3936,6 @@ static struct {
Eterm e;
Eterm t;
Eterm ramv;
-#if HALFWORD_HEAP
- Eterm low;
-#endif
Eterm sbct;
#if HAVE_ERTS_MSEG
Eterm asbcst;
@@ -4035,9 +4026,6 @@ init_atoms(Allctr_t *allctr)
AM_INIT(e);
AM_INIT(t);
AM_INIT(ramv);
-#if HALFWORD_HEAP
- AM_INIT(low);
-#endif
AM_INIT(sbct);
#if HAVE_ERTS_MSEG
AM_INIT(asbcst);
@@ -4643,9 +4631,6 @@ info_options(Allctr_t *allctr,
"option e: true\n"
"option t: %s\n"
"option ramv: %s\n"
-#if HALFWORD_HEAP
- "option low: %s\n"
-#endif
"option sbct: %beu\n"
#if HAVE_ERTS_MSEG
"option asbcst: %bpu\n"
@@ -4664,9 +4649,6 @@ info_options(Allctr_t *allctr,
"option acul: %d\n",
topt,
allctr->ramv ? "true" : "false",
-#if HALFWORD_HEAP
- allctr->mseg_opt.low_mem ? "true" : "false",
-#endif
allctr->sbc_threshold,
#if HAVE_ERTS_MSEG
allctr->mseg_opt.abs_shrink_th,
@@ -4729,9 +4711,6 @@ info_options(Allctr_t *allctr,
add_2tup(hpp, szp, &res,
am.sbct,
bld_uint(hpp, szp, allctr->sbc_threshold));
-#if HALFWORD_HEAP
- add_2tup(hpp, szp, &res, am.low, allctr->mseg_opt.low_mem ? am_true : am_false);
-#endif
add_2tup(hpp, szp, &res, am.ramv, allctr->ramv ? am_true : am_false);
add_2tup(hpp, szp, &res, am.t, (allctr->t ? am_true : am_false));
add_2tup(hpp, szp, &res, am.e, am_true);
@@ -5416,11 +5395,7 @@ do_erts_alcu_realloc(ErtsAlcType_t type,
Block_t *new_blk;
if(IS_SBC_BLK(blk)) {
do_carrier_resize:
-#if HALFWORD_HEAP
- new_blk = resize_carrier(allctr, blk, size, CFLG_SBC | CFLG_FORCE_MSEG);
-#else
new_blk = resize_carrier(allctr, blk, size, CFLG_SBC);
-#endif
res = new_blk ? BLK2UMEM(new_blk) : NULL;
}
else if (alcu_flgs & ERTS_ALCU_FLG_FAIL_REALLOC_MOVE)
@@ -5714,11 +5689,8 @@ erts_alcu_start(Allctr_t *allctr, AllctrInit_t *init)
#ifdef ERTS_SMP
if (init->tspec || init->tpref)
allctr->mseg_opt.sched_spec = 1;
-#endif
-# if HALFWORD_HEAP
- allctr->mseg_opt.low_mem = init->low_mem;
-# endif
-#endif
+#endif /* ERTS_SMP */
+#endif /* HAVE_ERTS_MSEG */
allctr->name_prefix = init->name_prefix;
if (!allctr->name_prefix)
@@ -5875,7 +5847,7 @@ erts_alcu_start(Allctr_t *allctr, AllctrInit_t *init)
CFLG_MBC
| CFLG_FORCE_SIZE
| CFLG_NO_CPOOL
-#if !HALFWORD_HEAP && !ERTS_SUPER_ALIGNED_MSEG_ONLY
+#if !ERTS_SUPER_ALIGNED_MSEG_ONLY
| CFLG_FORCE_SYS_ALLOC
#endif
| CFLG_MAIN_CARRIER);
diff --git a/erts/emulator/beam/erl_alloc_util.h b/erts/emulator/beam/erl_alloc_util.h
index df1f0aa65a..792f8c63ac 100644
--- a/erts/emulator/beam/erl_alloc_util.h
+++ b/erts/emulator/beam/erl_alloc_util.h
@@ -45,7 +45,6 @@ typedef struct {
int tspec;
int tpref;
int ramv;
- int low_mem; /* HALFWORD only */
UWord sbct;
UWord asbcst;
UWord rsbcst;
@@ -90,7 +89,6 @@ typedef struct {
0, /* (bool) tspec: thread specific */\
0, /* (bool) tpref: thread preferred */\
0, /* (bool) ramv: realloc always moves */\
- 0, /* (bool) low_mem: HALFWORD only */\
512*1024, /* (bytes) sbct: sbc threshold */\
2*1024*2024, /* (amount) asbcst: abs sbc shrink threshold */\
20, /* (%) rsbcst: rel sbc shrink threshold */\
@@ -125,7 +123,6 @@ typedef struct {
0, /* (bool) tspec: thread specific */\
0, /* (bool) tpref: thread preferred */\
0, /* (bool) ramv: realloc always moves */\
- 0, /* (bool) low_mem: HALFWORD only */\
64*1024, /* (bytes) sbct: sbc threshold */\
2*1024*2024, /* (amount) asbcst: abs sbc shrink threshold */\
20, /* (%) rsbcst: rel sbc shrink threshold */\
diff --git a/erts/emulator/beam/erl_arith.c b/erts/emulator/beam/erl_arith.c
index b8c5ef9b09..3671025d22 100644
--- a/erts/emulator/beam/erl_arith.c
+++ b/erts/emulator/beam/erl_arith.c
@@ -42,15 +42,8 @@
# define MAX(x, y) (((x) > (y)) ? (x) : (y))
#endif
-#if !HEAP_ON_C_STACK
-# define DECLARE_TMP(VariableName,N,P) \
- Eterm *VariableName = ((ERTS_PROC_GET_SCHDATA(P)->erl_arith_tmp_heap) + (2 * N))
-#else
-# define DECLARE_TMP(VariableName,N,P) \
- Eterm VariableName[2]
-#endif
-# define ARG_IS_NOT_TMP(Arg,Tmp) ((Arg) != make_big((Tmp)))
-
+#define DECLARE_TMP(VariableName,N,P) Eterm VariableName[2]
+#define ARG_IS_NOT_TMP(Arg,Tmp) ((Arg) != make_big((Tmp)))
static Eterm shift(Process* p, Eterm arg1, Eterm arg2, int right);
diff --git a/erts/emulator/beam/erl_async.c b/erts/emulator/beam/erl_async.c
index f071898046..be0bc0cfec 100644
--- a/erts/emulator/beam/erl_async.c
+++ b/erts/emulator/beam/erl_async.c
@@ -167,7 +167,6 @@ async_ready_q(Uint sched_id)
#endif
-
void
erts_init_async(void)
{
diff --git a/erts/emulator/beam/erl_bif_binary.c b/erts/emulator/beam/erl_bif_binary.c
index b1ebf0327e..b9640e211d 100644
--- a/erts/emulator/beam/erl_bif_binary.c
+++ b/erts/emulator/beam/erl_bif_binary.c
@@ -2786,7 +2786,6 @@ BIF_RETTYPE binary_referenced_byte_size_1(BIF_ALIST_1)
}
pb = (ProcBin *) binary_val(bin);
if (pb->thing_word == HEADER_PROC_BIN) {
- /* XXX:PaN - Halfword - orig_size is a long, we should handle that */
res = erts_make_integer((Uint) pb->val->orig_size, BIF_P);
} else { /* heap binary */
res = erts_make_integer((Uint) ((ErlHeapBin *) pb)->size, BIF_P);
@@ -2804,7 +2803,7 @@ BIF_RETTYPE binary_referenced_byte_size_1(BIF_ALIST_1)
#endif
static int get_need(Uint u) {
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
if (u > 0xFFFFFFFFUL) {
if (u > 0xFFFFFFFFFFFFUL) {
if (u > 0xFFFFFFFFFFFFFFUL) {
diff --git a/erts/emulator/beam/erl_bif_info.c b/erts/emulator/beam/erl_bif_info.c
index b44382cde8..9a132ee007 100644
--- a/erts/emulator/beam/erl_bif_info.c
+++ b/erts/emulator/beam/erl_bif_info.c
@@ -73,9 +73,6 @@ static char otp_version[] = ERLANG_OTP_VERSION;
static char erts_system_version[] = ("Erlang/OTP " ERLANG_OTP_RELEASE
"%s"
" [erts-" ERLANG_VERSION "]"
-#if !HEAP_ON_C_STACK && !HALFWORD_HEAP
- " [no-c-stack-objects]"
-#endif
#ifndef OTP_RELEASE
#ifdef ERLANG_GIT_VERSION
" [source-" ERLANG_GIT_VERSION "]"
@@ -84,12 +81,8 @@ static char erts_system_version[] = ("Erlang/OTP " ERLANG_OTP_RELEASE
#endif
#endif
#ifdef ARCH_64
-#if HALFWORD_HEAP
- " [64-bit halfword]"
-#else
" [64-bit]"
#endif
-#endif
#ifdef ERTS_SMP
" [smp:%beu:%beu]"
#endif
@@ -671,18 +664,12 @@ static Eterm pi_1_keys[] = {
#define ERTS_PI_1_NO_OF_KEYS (sizeof(pi_1_keys)/sizeof(Eterm))
static Eterm pi_1_keys_list;
-#if HEAP_ON_C_STACK
static Eterm pi_1_keys_list_heap[2*ERTS_PI_1_NO_OF_KEYS];
-#endif
static void
process_info_init(void)
{
-#if HEAP_ON_C_STACK
Eterm *hp = &pi_1_keys_list_heap[0];
-#else
- Eterm *hp = erts_alloc(ERTS_ALC_T_LL_TEMP_TERM,sizeof(Eterm)*2*ERTS_PI_1_NO_OF_KEYS);
-#endif
int i;
pi_1_keys_list = NIL;
diff --git a/erts/emulator/beam/erl_bif_op.c b/erts/emulator/beam/erl_bif_op.c
index c9192fc420..d53a9e11ca 100644
--- a/erts/emulator/beam/erl_bif_op.c
+++ b/erts/emulator/beam/erl_bif_op.c
@@ -258,7 +258,7 @@ Eterm erl_is_function(Process* p, Eterm arg1, Eterm arg2)
BIF_RET(am_true);
}
} else if (is_export(arg1)) {
- Export* exp = (Export *) EXPAND_POINTER((export_val(arg1))[1]);
+ Export* exp = (Export *) (export_val(arg1)[1]);
if (exp->code[2] == (Uint) arity) {
BIF_RET(am_true);
diff --git a/erts/emulator/beam/erl_bif_port.c b/erts/emulator/beam/erl_bif_port.c
index 3ff54c7a60..e47d7bcbbb 100644
--- a/erts/emulator/beam/erl_bif_port.c
+++ b/erts/emulator/beam/erl_bif_port.c
@@ -1329,7 +1329,8 @@ BIF_RETTYPE decode_packet_3(BIF_ALIST_3)
ErlSubBin* rest;
Eterm res;
Eterm options;
- int code;
+ int code;
+ char delimiter = '\n';
if (!is_binary(BIF_ARG_2) ||
(!is_list(BIF_ARG_3) && !is_nil(BIF_ARG_3))) {
@@ -1370,6 +1371,11 @@ BIF_RETTYPE decode_packet_3(BIF_ALIST_3)
case am_line_length:
trunc_len = val;
goto next_option;
+ case am_line_delimiter:
+ if (type == TCP_PB_LINE_LF && val >= 0 && val <= 255) {
+ delimiter = (char)val;
+ goto next_option;
+ }
}
}
}
@@ -1390,7 +1396,7 @@ BIF_RETTYPE decode_packet_3(BIF_ALIST_3)
pca.aligned_ptr = bin_ptr;
}
packet_sz = packet_get_length(type, (char*)pca.aligned_ptr, pca.bin_sz,
- max_plen, trunc_len, &http_state);
+ max_plen, trunc_len, delimiter, &http_state);
if (!(packet_sz > 0 && packet_sz <= pca.bin_sz)) {
if (packet_sz < 0) {
goto error;
diff --git a/erts/emulator/beam/erl_bif_re.c b/erts/emulator/beam/erl_bif_re.c
index 86951f32b0..7f7cd376ac 100644
--- a/erts/emulator/beam/erl_bif_re.c
+++ b/erts/emulator/beam/erl_bif_re.c
@@ -100,7 +100,7 @@ Sint erts_re_set_loop_limit(Sint limit)
static int term_to_int(Eterm term, int *sp)
{
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
if (is_small(term)) {
Uint x = signed_val(term);
@@ -151,7 +151,7 @@ static int term_to_int(Eterm term, int *sp)
static Eterm make_signed_integer(int x, Process *p)
{
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
return make_small(x);
#else
Eterm* hp;
diff --git a/erts/emulator/beam/erl_bif_unique.c b/erts/emulator/beam/erl_bif_unique.c
index 5eca09c5a6..c4a39b8897 100644
--- a/erts/emulator/beam/erl_bif_unique.c
+++ b/erts/emulator/beam/erl_bif_unique.c
@@ -338,7 +338,7 @@ static struct {
} w;
} raw_unique_monotonic_integer erts_align_attribute(ERTS_CACHE_LINE_SIZE);
-#if defined(ARCH_32) || HALFWORD_HEAP
+#if defined(ARCH_32)
# define ERTS_UNIQUE_MONOTONIC_OFFSET ERTS_SINT64_MIN
#else
# define ERTS_UNIQUE_MONOTONIC_OFFSET MIN_SMALL
@@ -368,7 +368,7 @@ get_unique_monotonic_integer_heap_size(Uint64 raw, int positive)
Sint64 value = ((Sint64) raw) + ERTS_UNIQUE_MONOTONIC_OFFSET;
if (IS_SSMALL(value))
return 0;
-#if defined(ARCH_32) || HALFWORD_HEAP
+#if defined(ARCH_32)
return ERTS_SINT64_HEAP_SIZE(value);
#else
return ERTS_UINT64_HEAP_SIZE((Uint64) value);
@@ -393,7 +393,7 @@ make_unique_monotonic_integer_value(Eterm *hp, Uint hsz, Uint64 raw, int positiv
if (hsz == 0)
res = make_small(value);
else {
-#if defined(ARCH_32) || HALFWORD_HEAP
+#if defined(ARCH_32)
res = erts_sint64_to_big(value, &hp);
#else
res = erts_uint64_to_big((Uint64) value, &hp);
diff --git a/erts/emulator/beam/erl_binary.h b/erts/emulator/beam/erl_binary.h
index ea01bf08f0..e181b5555d 100644
--- a/erts/emulator/beam/erl_binary.h
+++ b/erts/emulator/beam/erl_binary.h
@@ -72,7 +72,6 @@ typedef struct erl_heap_bin {
*/
#define binary_size(Bin) (binary_val(Bin)[1])
-#define binary_size_rel(Bin,BasePtr) (binary_val_rel(Bin,BasePtr)[1])
#define binary_bitsize(Bin) \
((*binary_val(Bin) == HEADER_SUB_BIN) ? \
@@ -95,12 +94,9 @@ typedef struct erl_heap_bin {
* Bitsize: output variable (Uint)
*/
-#define ERTS_GET_BINARY_BYTES(Bin,Bytep,Bitoffs,Bitsize) \
- ERTS_GET_BINARY_BYTES_REL(Bin,Bytep,Bitoffs,Bitsize,NULL)
-
-#define ERTS_GET_BINARY_BYTES_REL(Bin,Bytep,Bitoffs,Bitsize,BasePtr) \
+#define ERTS_GET_BINARY_BYTES(Bin,Bytep,Bitoffs,Bitsize) \
do { \
- Eterm* _real_bin = binary_val_rel(Bin,BasePtr); \
+ Eterm* _real_bin = binary_val(Bin); \
Uint _offs = 0; \
Bitoffs = Bitsize = 0; \
if (*_real_bin == HEADER_SUB_BIN) { \
@@ -108,7 +104,7 @@ do { \
_offs = _sb->offs; \
Bitoffs = _sb->bitoffs; \
Bitsize = _sb->bitsize; \
- _real_bin = binary_val_rel(_sb->orig,BasePtr); \
+ _real_bin = binary_val(_sb->orig); \
} \
if (*_real_bin == HEADER_PROC_BIN) { \
Bytep = ((ProcBin *) _real_bin)->bytes + _offs; \
@@ -131,11 +127,8 @@ do { \
*/
#define ERTS_GET_REAL_BIN(Bin, RealBin, ByteOffset, BitOffset, BitSize) \
- ERTS_GET_REAL_BIN_REL(Bin, RealBin, ByteOffset, BitOffset, BitSize, NULL)
-
-#define ERTS_GET_REAL_BIN_REL(Bin, RealBin, ByteOffset, BitOffset, BitSize, BasePtr) \
do { \
- ErlSubBin* _sb = (ErlSubBin *) binary_val_rel(Bin,BasePtr); \
+ ErlSubBin* _sb = (ErlSubBin *) binary_val(Bin); \
if (_sb->thing_word == HEADER_SUB_BIN) { \
RealBin = _sb->orig; \
ByteOffset = _sb->offs; \
diff --git a/erts/emulator/beam/erl_bits.c b/erts/emulator/beam/erl_bits.c
index 01734c55d7..11d83686a3 100644
--- a/erts/emulator/beam/erl_bits.c
+++ b/erts/emulator/beam/erl_bits.c
@@ -282,7 +282,7 @@ erts_bs_get_integer_2(Process *p, Uint num_bits, unsigned flags, ErlBinMatchBuff
* Simply shift whole bytes into the result.
*/
switch (BYTE_OFFSET(n)) {
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
case 7: w = (w << 8) | *bp++;
case 6: w = (w << 8) | *bp++;
case 5: w = (w << 8) | *bp++;
@@ -387,7 +387,7 @@ erts_bs_get_integer_2(Process *p, Uint num_bits, unsigned flags, ErlBinMatchBuff
case 3:
v32 = LSB[0] + (LSB[1]<<8) + (LSB[2]<<16);
goto big_small;
-#if !defined(ARCH_64) || HALFWORD_HEAP
+#if !defined(ARCH_64)
case 4:
v32 = (LSB[0] + (LSB[1]<<8) + (LSB[2]<<16) + (LSB[3]<<24));
if (!IS_USMALL(sgn, v32)) {
diff --git a/erts/emulator/beam/erl_db.c b/erts/emulator/beam/erl_db.c
index 878ee32b47..9ec14ab5ae 100644
--- a/erts/emulator/beam/erl_db.c
+++ b/erts/emulator/beam/erl_db.c
@@ -1774,15 +1774,9 @@ BIF_RETTYPE ets_delete_1(BIF_ALIST_1)
* (it looks like an continuation pointer), but that is will crash the
* emulator if this BIF is call traced.
*/
-#if HALFWORD_HEAP
- Eterm *hp = HAlloc(BIF_P, 3);
- hp[0] = make_pos_bignum_header(2);
- *((UWord *) (UWord) (hp+1)) = (UWord) tb;
-#else
Eterm *hp = HAlloc(BIF_P, 2);
hp[0] = make_pos_bignum_header(1);
hp[1] = (Eterm) tb;
-#endif
BIF_TRAP1(&ets_delete_continue_exp, BIF_P, make_big(hp));
}
else {
@@ -2840,7 +2834,7 @@ BIF_RETTYPE ets_match_spec_run_r_3(BIF_ALIST_3)
BIF_TRAP3(bif_export[BIF_ets_match_spec_run_r_3],
BIF_P,lst,BIF_ARG_2,ret);
}
- res = db_prog_match(BIF_P, mp, CAR(list_val(lst)), NULL, NULL, 0,
+ res = db_prog_match(BIF_P, mp, CAR(list_val(lst)), NULL, 0,
ERTS_PAM_COPY_RESULT, &dummy);
if (is_value(res)) {
hp = HAlloc(BIF_P, 2);
@@ -3652,11 +3646,8 @@ static BIF_RETTYPE ets_delete_trap(BIF_ALIST_1)
Eterm* ptr = big_val(cont);
DbTable *tb = *((DbTable **) (UWord) (ptr + 1));
-#if HALFWORD_HEAP
- ASSERT(*ptr == make_pos_bignum_header(2));
-#else
ASSERT(*ptr == make_pos_bignum_header(1));
-#endif
+
db_lock(tb, LCK_WRITE);
trap = free_table_cont(p, tb, 0, 1);
db_unlock(tb, LCK_WRITE);
diff --git a/erts/emulator/beam/erl_db_hash.c b/erts/emulator/beam/erl_db_hash.c
index 98a2e2842a..cff65f244d 100644
--- a/erts/emulator/beam/erl_db_hash.c
+++ b/erts/emulator/beam/erl_db_hash.c
@@ -469,9 +469,6 @@ static ERTS_INLINE void try_shrink(DbTableHash* tb)
}
}
-#define EQ_REL(x,y,y_base) \
- (is_same(x,NULL,y,y_base) || (is_not_both_immed((x),(y)) && eq_rel((x),NULL,(y),y_base)))
-
/* Is this a live object (not pseodo-deleted) with the specified key?
*/
static ERTS_INLINE int has_live_key(DbTableHash* tb, HashDbTerm* b,
@@ -481,7 +478,7 @@ static ERTS_INLINE int has_live_key(DbTableHash* tb, HashDbTerm* b,
else {
Eterm itemKey = GETKEY(tb, b->dbterm.tpl);
ASSERT(!is_header(itemKey));
- return EQ_REL(key, itemKey, b->dbterm.tpl);
+ return EQ(key, itemKey);
}
}
@@ -494,7 +491,7 @@ static ERTS_INLINE int has_key(DbTableHash* tb, HashDbTerm* b,
else {
Eterm itemKey = GETKEY(tb, b->dbterm.tpl);
ASSERT(!is_header(itemKey));
- return EQ_REL(key, itemKey, b->dbterm.tpl);
+ return EQ(key, itemKey);
}
}
@@ -2204,11 +2201,11 @@ static void db_print_hash(int to, void *to_arg, int show, DbTable *tbl)
erts_print(to, to_arg, "*");
if (tb->common.compress) {
Eterm key = GETKEY(tb, list->dbterm.tpl);
- erts_print(to, to_arg, "key=%R", key, list->dbterm.tpl);
+ erts_print(to, to_arg, "key=%T", key);
}
else {
- Eterm obj = make_tuple_rel(list->dbterm.tpl,list->dbterm.tpl);
- erts_print(to, to_arg, "%R", obj, list->dbterm.tpl);
+ Eterm obj = make_tuple(list->dbterm.tpl);
+ erts_print(to, to_arg, "%T", obj);
}
if (list->next != 0)
erts_print(to, to_arg, ",");
@@ -2899,9 +2896,6 @@ Ldone:
handle->dbterm = &b->dbterm;
handle->flags = flags;
handle->new_size = b->dbterm.size;
-#if HALFWORD_HEAP
- handle->abs_vec = NULL;
-#endif
handle->lck = lck;
return 1;
}
diff --git a/erts/emulator/beam/erl_db_tree.c b/erts/emulator/beam/erl_db_tree.c
index 465aa566ad..311b69d114 100644
--- a/erts/emulator/beam/erl_db_tree.c
+++ b/erts/emulator/beam/erl_db_tree.c
@@ -280,7 +280,7 @@ struct select_delete_context {
/*
** Forward declarations
*/
-static TreeDbTerm *linkout_tree(DbTableTree *tb, Eterm key, Eterm* key_base);
+static TreeDbTerm *linkout_tree(DbTableTree *tb, Eterm key);
static TreeDbTerm *linkout_object_tree(DbTableTree *tb,
Eterm object);
static int do_free_tree_cont(DbTableTree *tb, int num_left);
@@ -291,15 +291,15 @@ static int delsub(TreeDbTerm **this);
static TreeDbTerm *slot_search(Process *p, DbTableTree *tb, Sint slot);
static TreeDbTerm *find_node(DbTableTree *tb, Eterm key);
static TreeDbTerm **find_node2(DbTableTree *tb, Eterm key);
-static TreeDbTerm *find_next(DbTableTree *tb, DbTreeStack*, Eterm key, Eterm* kbase);
-static TreeDbTerm *find_prev(DbTableTree *tb, DbTreeStack*, Eterm key, Eterm* kbase);
+static TreeDbTerm *find_next(DbTableTree *tb, DbTreeStack*, Eterm key);
+static TreeDbTerm *find_prev(DbTableTree *tb, DbTreeStack*, Eterm key);
static TreeDbTerm *find_next_from_pb_key(DbTableTree *tb, DbTreeStack*,
Eterm key);
static TreeDbTerm *find_prev_from_pb_key(DbTableTree *tb, DbTreeStack*,
Eterm key);
static void traverse_backwards(DbTableTree *tb,
DbTreeStack*,
- Eterm lastkey, Eterm* lk_base,
+ Eterm lastkey,
int (*doit)(DbTableTree *tb,
TreeDbTerm *,
void *,
@@ -307,7 +307,7 @@ static void traverse_backwards(DbTableTree *tb,
void *context);
static void traverse_forward(DbTableTree *tb,
DbTreeStack*,
- Eterm lastkey, Eterm* lk_base,
+ Eterm lastkey,
int (*doit)(DbTableTree *tb,
TreeDbTerm *,
void *,
@@ -315,8 +315,8 @@ static void traverse_forward(DbTableTree *tb,
void *context);
static int key_given(DbTableTree *tb, Eterm pattern, TreeDbTerm **ret,
Eterm *partly_bound_key);
-static Sint cmp_partly_bound(Eterm partly_bound_key, Eterm bound_key, Eterm* bk_base);
-static Sint do_cmp_partly_bound(Eterm a, Eterm b, Eterm* b_base, int *done);
+static Sint cmp_partly_bound(Eterm partly_bound_key, Eterm bound_key);
+static Sint do_cmp_partly_bound(Eterm a, Eterm b, int *done);
static int analyze_pattern(DbTableTree *tb, Eterm pattern,
struct mp_info *mpi);
@@ -517,7 +517,7 @@ static int db_next_tree(Process *p, DbTable *tbl, Eterm key, Eterm *ret)
if (is_atom(key) && key == am_EOT)
return DB_ERROR_BADKEY;
stack = get_any_stack(tb);
- this = find_next(tb, stack, key, NULL);
+ this = find_next(tb, stack, key);
release_stack(tb,stack);
if (this == NULL) {
*ret = am_EOT;
@@ -563,7 +563,7 @@ static int db_prev_tree(Process *p, DbTable *tbl, Eterm key, Eterm *ret)
if (is_atom(key) && key == am_EOT)
return DB_ERROR_BADKEY;
stack = get_any_stack(tb);
- this = find_prev(tb, stack, key, NULL);
+ this = find_prev(tb, stack, key);
release_stack(tb,stack);
if (this == NULL) {
*ret = am_EOT;
@@ -573,19 +573,13 @@ static int db_prev_tree(Process *p, DbTable *tbl, Eterm key, Eterm *ret)
return DB_ERROR_NONE;
}
-static ERTS_INLINE Sint cmp_key(DbTableTree* tb, Eterm key, Eterm* key_base,
- TreeDbTerm* obj)
-{
- return cmp_rel(key, key_base,
- GETKEY(tb,obj->dbterm.tpl), obj->dbterm.tpl);
+static ERTS_INLINE Sint cmp_key(DbTableTree* tb, Eterm key, TreeDbTerm* obj) {
+ return CMP(key, GETKEY(tb,obj->dbterm.tpl));
}
-static ERTS_INLINE int cmp_key_eq(DbTableTree* tb, Eterm key, Eterm* key_base,
- TreeDbTerm* obj)
-{
+static ERTS_INLINE int cmp_key_eq(DbTableTree* tb, Eterm key, TreeDbTerm* obj) {
Eterm obj_key = GETKEY(tb,obj->dbterm.tpl);
- return is_same(key, key_base, obj_key, obj->dbterm.tpl)
- || cmp_rel(key, key_base, obj_key, obj->dbterm.tpl) == 0;
+ return is_same(key, obj_key) || CMP(key, obj_key) == 0;
}
static int db_put_tree(DbTable *tbl, Eterm obj, int key_clash_fail)
@@ -619,7 +613,7 @@ static int db_put_tree(DbTable *tbl, Eterm obj, int key_clash_fail)
(*this)->balance = 0;
(*this)->left = (*this)->right = NULL;
break;
- } else if ((c = cmp_key(tb, key, NULL, *this)) < 0) {
+ } else if ((c = cmp_key(tb, key, *this)) < 0) {
/* go lefts */
dstack[dpos++] = DIR_LEFT;
tstack[tpos++] = this;
@@ -774,7 +768,7 @@ static int db_erase_tree(DbTable *tbl, Eterm key, Eterm *ret)
*ret = am_true;
- if ((res = linkout_tree(tb, key, NULL)) != NULL) {
+ if ((res = linkout_tree(tb, key)) != NULL) {
free_term(tb, res);
}
return DB_ERROR_NONE;
@@ -970,15 +964,15 @@ static int db_select_continue_tree(Process *p,
stack = get_any_stack(tb);
if (chunk_size) {
if (reverse) {
- traverse_backwards(tb, stack, lastkey, NULL, &doit_select_chunk, &sc);
+ traverse_backwards(tb, stack, lastkey, &doit_select_chunk, &sc);
} else {
- traverse_forward(tb, stack, lastkey, NULL, &doit_select_chunk, &sc);
+ traverse_forward(tb, stack, lastkey, &doit_select_chunk, &sc);
}
} else {
if (reverse) {
- traverse_forward(tb, stack, lastkey, NULL, &doit_select, &sc);
+ traverse_forward(tb, stack, lastkey, &doit_select, &sc);
} else {
- traverse_backwards(tb, stack, lastkey, NULL, &doit_select, &sc);
+ traverse_backwards(tb, stack, lastkey, &doit_select, &sc);
}
}
release_stack(tb,stack);
@@ -1003,9 +997,9 @@ static int db_select_continue_tree(Process *p,
}
key = GETKEY(tb, sc.lastobj);
- sz = size_object_rel(key,sc.lastobj);
+ sz = size_object(key);
hp = HAlloc(p, 9 + sz);
- key = copy_struct_rel(key, sz, &hp, &MSO(p), sc.lastobj, NULL);
+ key = copy_struct(key, sz, &hp, &MSO(p));
continuation = TUPLE8
(hp,
tptr[1],
@@ -1026,8 +1020,8 @@ static int db_select_continue_tree(Process *p,
key = GETKEY(tb, sc.lastobj);
if (chunk_size) {
if (end_condition != NIL &&
- ((!reverse && cmp_partly_bound(end_condition,key,sc.lastobj) < 0) ||
- (reverse && cmp_partly_bound(end_condition,key,sc.lastobj) > 0))) {
+ ((!reverse && cmp_partly_bound(end_condition,key) < 0) ||
+ (reverse && cmp_partly_bound(end_condition,key) > 0))) {
/* done anyway */
if (!sc.got) {
RET_TO_BIF(am_EOT, DB_ERROR_NONE);
@@ -1039,16 +1033,16 @@ static int db_select_continue_tree(Process *p,
}
} else {
if (end_condition != NIL &&
- ((!reverse && cmp_partly_bound(end_condition,key,sc.lastobj) > 0) ||
- (reverse && cmp_partly_bound(end_condition,key,sc.lastobj) < 0))) {
+ ((!reverse && cmp_partly_bound(end_condition,key) > 0) ||
+ (reverse && cmp_partly_bound(end_condition,key) < 0))) {
/* done anyway */
RET_TO_BIF(sc.accum,DB_ERROR_NONE);
}
}
/* Not done yet, let's trap. */
- sz = size_object_rel(key,sc.lastobj);
+ sz = size_object(key);
hp = HAlloc(p, 9 + sz);
- key = copy_struct_rel(key, sz, &hp, &MSO(p), sc.lastobj, NULL);
+ key = copy_struct(key, sz, &hp, &MSO(p));
continuation = TUPLE8
(hp,
tptr[1],
@@ -1075,7 +1069,6 @@ static int db_select_tree(Process *p, DbTable *tbl,
struct select_context sc;
struct mp_info mpi;
Eterm lastkey = THE_NON_VALUE;
- Eterm* lk_base = NULL;
Eterm key;
Eterm continuation;
unsigned sz;
@@ -1127,20 +1120,18 @@ static int db_select_tree(Process *p, DbTable *tbl,
if (mpi.some_limitation) {
if ((this = find_prev_from_pb_key(tb, stack, mpi.least)) != NULL) {
lastkey = GETKEY(tb, this->dbterm.tpl);
- lk_base = this->dbterm.tpl;
}
sc.end_condition = mpi.most;
}
- traverse_forward(tb, stack, lastkey, lk_base, &doit_select, &sc);
+ traverse_forward(tb, stack, lastkey, &doit_select, &sc);
} else {
if (mpi.some_limitation) {
if ((this = find_next_from_pb_key(tb, stack, mpi.most)) != NULL) {
lastkey = GETKEY(tb, this->dbterm.tpl);
- lk_base = this->dbterm.tpl;
}
sc.end_condition = mpi.least;
}
- traverse_backwards(tb, stack, lastkey, lk_base, &doit_select, &sc);
+ traverse_backwards(tb, stack, lastkey, &doit_select, &sc);
}
release_stack(tb,stack);
#ifdef HARDDEBUG
@@ -1153,9 +1144,9 @@ static int db_select_tree(Process *p, DbTable *tbl,
}
key = GETKEY(tb, sc.lastobj);
- sz = size_object_rel(key, sc.lastobj);
+ sz = size_object(key);
hp = HAlloc(p, 9 + sz + PROC_BIN_SIZE);
- key = copy_struct_rel(key, sz, &hp, &MSO(p), sc.lastobj, NULL);
+ key = copy_struct(key, sz, &hp, &MSO(p));
if (mpi.all_objects)
(mpi.mp)->flags |= BIN_FLAG_ALL_OBJECTS;
mpb=db_make_mp_binary(p,mpi.mp,&hp);
@@ -1236,7 +1227,7 @@ static int db_select_count_continue_tree(Process *p,
}
stack = get_any_stack(tb);
- traverse_backwards(tb, stack, lastkey, NULL, &doit_select_count, &sc);
+ traverse_backwards(tb, stack, lastkey, &doit_select_count, &sc);
release_stack(tb,stack);
BUMP_REDS(p, 1000 - sc.max);
@@ -1246,12 +1237,12 @@ static int db_select_count_continue_tree(Process *p,
}
key = GETKEY(tb, sc.lastobj);
if (end_condition != NIL &&
- (cmp_partly_bound(end_condition,key,sc.lastobj) > 0)) {
+ (cmp_partly_bound(end_condition,key) > 0)) {
/* done anyway */
RET_TO_BIF(make_small(sc.got),DB_ERROR_NONE);
}
/* Not done yet, let's trap. */
- sz = size_object_rel(key, sc.lastobj);
+ sz = size_object(key);
if (IS_USMALL(0, sc.got)) {
hp = HAlloc(p, sz + 6);
egot = make_small(sc.got);
@@ -1261,7 +1252,7 @@ static int db_select_count_continue_tree(Process *p,
egot = uint_to_big(sc.got, hp);
hp += BIG_UINT_HEAP_SIZE;
}
- key = copy_struct_rel(key, sz, &hp, &MSO(p), sc.lastobj, NULL);
+ key = copy_struct(key, sz, &hp, &MSO(p));
continuation = TUPLE5
(hp,
tptr[1],
@@ -1284,7 +1275,6 @@ static int db_select_count_tree(Process *p, DbTable *tbl,
struct select_count_context sc;
struct mp_info mpi;
Eterm lastkey = THE_NON_VALUE;
- Eterm* lk_base = NULL;
Eterm key;
Eterm continuation;
unsigned sz;
@@ -1334,12 +1324,11 @@ static int db_select_count_tree(Process *p, DbTable *tbl,
if (mpi.some_limitation) {
if ((this = find_next_from_pb_key(tb, stack, mpi.most)) != NULL) {
lastkey = GETKEY(tb, this->dbterm.tpl);
- lk_base = this->dbterm.tpl;
}
sc.end_condition = mpi.least;
}
- traverse_backwards(tb, stack, lastkey, lk_base, &doit_select_count, &sc);
+ traverse_backwards(tb, stack, lastkey, &doit_select_count, &sc);
release_stack(tb,stack);
BUMP_REDS(p, 1000 - sc.max);
if (sc.max > 0) {
@@ -1347,7 +1336,7 @@ static int db_select_count_tree(Process *p, DbTable *tbl,
}
key = GETKEY(tb, sc.lastobj);
- sz = size_object_rel(key, sc.lastobj);
+ sz = size_object(key);
if (IS_USMALL(0, sc.got)) {
hp = HAlloc(p, sz + PROC_BIN_SIZE + 6);
egot = make_small(sc.got);
@@ -1357,7 +1346,7 @@ static int db_select_count_tree(Process *p, DbTable *tbl,
egot = uint_to_big(sc.got, hp);
hp += BIG_UINT_HEAP_SIZE;
}
- key = copy_struct_rel(key, sz, &hp, &MSO(p), sc.lastobj, NULL);
+ key = copy_struct(key, sz, &hp, &MSO(p));
if (mpi.all_objects)
(mpi.mp)->flags |= BIN_FLAG_ALL_OBJECTS;
mpb = db_make_mp_binary(p,mpi.mp,&hp);
@@ -1388,7 +1377,6 @@ static int db_select_chunk_tree(Process *p, DbTable *tbl,
struct select_context sc;
struct mp_info mpi;
Eterm lastkey = THE_NON_VALUE;
- Eterm* lk_base = NULL;
Eterm key;
Eterm continuation;
unsigned sz;
@@ -1445,20 +1433,18 @@ static int db_select_chunk_tree(Process *p, DbTable *tbl,
if (mpi.some_limitation) {
if ((this = find_next_from_pb_key(tb, stack, mpi.most)) != NULL) {
lastkey = GETKEY(tb, this->dbterm.tpl);
- lk_base = this->dbterm.tpl;
}
sc.end_condition = mpi.least;
}
- traverse_backwards(tb, stack, lastkey, lk_base, &doit_select_chunk, &sc);
+ traverse_backwards(tb, stack, lastkey, &doit_select_chunk, &sc);
} else {
if (mpi.some_limitation) {
if ((this = find_prev_from_pb_key(tb, stack, mpi.least)) != NULL) {
lastkey = GETKEY(tb, this->dbterm.tpl);
- lk_base = this->dbterm.tpl;
}
sc.end_condition = mpi.most;
}
- traverse_forward(tb, stack, lastkey, lk_base, &doit_select_chunk, &sc);
+ traverse_forward(tb, stack, lastkey, &doit_select_chunk, &sc);
}
release_stack(tb,stack);
@@ -1483,9 +1469,9 @@ static int db_select_chunk_tree(Process *p, DbTable *tbl,
}
key = GETKEY(tb, sc.lastobj);
- sz = size_object_rel(key, sc.lastobj);
+ sz = size_object(key);
hp = HAlloc(p, 9 + sz + PROC_BIN_SIZE);
- key = copy_struct_rel(key, sz, &hp, &MSO(p), sc.lastobj, NULL);
+ key = copy_struct(key, sz, &hp, &MSO(p));
if (mpi.all_objects)
(mpi.mp)->flags |= BIN_FLAG_ALL_OBJECTS;
mpb = db_make_mp_binary(p,mpi.mp,&hp);
@@ -1508,9 +1494,9 @@ static int db_select_chunk_tree(Process *p, DbTable *tbl,
}
key = GETKEY(tb, sc.lastobj);
- sz = size_object_rel(key, sc.lastobj);
+ sz = size_object(key);
hp = HAlloc(p, 9 + sz + PROC_BIN_SIZE);
- key = copy_struct_rel(key, sz, &hp, &MSO(p), sc.lastobj, NULL);
+ key = copy_struct(key, sz, &hp, &MSO(p));
if (mpi.all_objects)
(mpi.mp)->flags |= BIN_FLAG_ALL_OBJECTS;
@@ -1586,7 +1572,7 @@ static int db_select_delete_continue_tree(Process *p,
sc.keypos = tb->common.keypos;
ASSERT(!erts_smp_atomic_read_nob(&tb->is_stack_busy));
- traverse_backwards(tb, &tb->static_stack, lastkey, NULL, &doit_select_delete, &sc);
+ traverse_backwards(tb, &tb->static_stack, lastkey, &doit_select_delete, &sc);
BUMP_REDS(p, 1000 - sc.max);
@@ -1595,11 +1581,11 @@ static int db_select_delete_continue_tree(Process *p,
}
key = GETKEY(tb, (sc.lastterm)->dbterm.tpl);
if (end_condition != NIL &&
- cmp_partly_bound(end_condition,key,sc.lastterm->dbterm.tpl) > 0) { /* done anyway */
+ cmp_partly_bound(end_condition,key) > 0) { /* done anyway */
RET_TO_BIF(erts_make_integer(sc.accum,p),DB_ERROR_NONE);
}
/* Not done yet, let's trap. */
- sz = size_object_rel(key, sc.lastterm->dbterm.tpl);
+ sz = size_object(key);
if (IS_USMALL(0, sc.accum)) {
hp = HAlloc(p, sz + 6);
eaccsum = make_small(sc.accum);
@@ -1609,7 +1595,7 @@ static int db_select_delete_continue_tree(Process *p,
eaccsum = uint_to_big(sc.accum, hp);
hp += BIG_UINT_HEAP_SIZE;
}
- key = copy_struct_rel(key, sz, &hp, &MSO(p), sc.lastterm->dbterm.tpl, NULL);
+ key = copy_struct(key, sz, &hp, &MSO(p));
continuation = TUPLE5
(hp,
tptr[1],
@@ -1630,7 +1616,6 @@ static int db_select_delete_tree(Process *p, DbTable *tbl,
struct select_delete_context sc;
struct mp_info mpi;
Eterm lastkey = THE_NON_VALUE;
- Eterm* lk_base = NULL;
Eterm key;
Eterm continuation;
unsigned sz;
@@ -1683,12 +1668,11 @@ static int db_select_delete_tree(Process *p, DbTable *tbl,
if (mpi.some_limitation) {
if ((this = find_next_from_pb_key(tb, &tb->static_stack, mpi.most)) != NULL) {
lastkey = GETKEY(tb, this->dbterm.tpl);
- lk_base = this->dbterm.tpl;
}
sc.end_condition = mpi.least;
}
- traverse_backwards(tb, &tb->static_stack, lastkey, lk_base, &doit_select_delete, &sc);
+ traverse_backwards(tb, &tb->static_stack, lastkey, &doit_select_delete, &sc);
BUMP_REDS(p, 1000 - sc.max);
if (sc.max > 0) {
@@ -1696,7 +1680,7 @@ static int db_select_delete_tree(Process *p, DbTable *tbl,
}
key = GETKEY(tb, (sc.lastterm)->dbterm.tpl);
- sz = size_object_rel(key, sc.lastterm->dbterm.tpl);
+ sz = size_object(key);
if (IS_USMALL(0, sc.accum)) {
hp = HAlloc(p, sz + PROC_BIN_SIZE + 6);
eaccsum = make_small(sc.accum);
@@ -1706,7 +1690,7 @@ static int db_select_delete_tree(Process *p, DbTable *tbl,
eaccsum = uint_to_big(sc.accum, hp);
hp += BIG_UINT_HEAP_SIZE;
}
- key = copy_struct_rel(key, sz, &hp, &MSO(p), sc.lastterm->dbterm.tpl, NULL);
+ key = copy_struct(key, sz, &hp, &MSO(p));
mpb = db_make_mp_binary(p,mpi.mp,&hp);
continuation = TUPLE5
@@ -1734,7 +1718,7 @@ static int db_take_tree(Process *p, DbTable *tbl, Eterm key, Eterm *ret)
TreeDbTerm *this;
*ret = NIL;
- this = linkout_tree(tb, key, NULL);
+ this = linkout_tree(tb, key);
if (this) {
Eterm copy, *hp, *hend;
@@ -1845,9 +1829,7 @@ do_db_tree_foreach_offheap(TreeDbTerm *tdbt,
do_db_tree_foreach_offheap(tdbt->right, func, arg);
}
-static TreeDbTerm *linkout_tree(DbTableTree *tb,
- Eterm key, Eterm* key_base)
-{
+static TreeDbTerm *linkout_tree(DbTableTree *tb, Eterm key) {
TreeDbTerm **tstack[STACK_NEED];
int tpos = 0;
int dstack[STACK_NEED+1];
@@ -1869,7 +1851,7 @@ static TreeDbTerm *linkout_tree(DbTableTree *tb,
for (;;) {
if (!*this) { /* Failure */
return NULL;
- } else if ((c = cmp_key(tb, key, key_base, *this)) < 0) {
+ } else if ((c = cmp_key(tb, key, *this)) < 0) {
dstack[dpos++] = DIR_LEFT;
tstack[tpos++] = this;
this = &((*this)->left);
@@ -1933,7 +1915,7 @@ static TreeDbTerm *linkout_object_tree(DbTableTree *tb,
for (;;) {
if (!*this) { /* Failure */
return NULL;
- } else if ((c = cmp_key(tb,key,NULL,*this)) < 0) {
+ } else if ((c = cmp_key(tb,key,*this)) < 0) {
dstack[dpos++] = DIR_LEFT;
tstack[tpos++] = this;
this = &((*this)->left);
@@ -2319,15 +2301,13 @@ done:
* Find next and previous in sort order
*/
-static TreeDbTerm *find_next(DbTableTree *tb, DbTreeStack* stack,
- Eterm key, Eterm* key_base)
-{
+static TreeDbTerm *find_next(DbTableTree *tb, DbTreeStack* stack, Eterm key) {
TreeDbTerm *this;
TreeDbTerm *tmp;
Sint c;
if(( this = TOP_NODE(stack)) != NULL) {
- if (!cmp_key_eq(tb,key,key_base,this)) {
+ if (!cmp_key_eq(tb,key,this)) {
/* Start from the beginning */
stack->pos = stack->slot = 0;
}
@@ -2337,7 +2317,7 @@ static TreeDbTerm *find_next(DbTableTree *tb, DbTreeStack* stack,
return NULL;
for (;;) {
PUSH_NODE(stack, this);
- if (( c = cmp_key(tb,key,key_base,this) ) > 0) {
+ if (( c = cmp_key(tb,key,this) ) > 0) {
if (this->right == NULL) /* We are at the previos
and the element does
not exist */
@@ -2377,15 +2357,13 @@ static TreeDbTerm *find_next(DbTableTree *tb, DbTreeStack* stack,
return this;
}
-static TreeDbTerm *find_prev(DbTableTree *tb, DbTreeStack* stack,
- Eterm key, Eterm* key_base)
-{
+static TreeDbTerm *find_prev(DbTableTree *tb, DbTreeStack* stack, Eterm key) {
TreeDbTerm *this;
TreeDbTerm *tmp;
Sint c;
if(( this = TOP_NODE(stack)) != NULL) {
- if (!cmp_key_eq(tb,key,key_base,this)) {
+ if (!cmp_key_eq(tb,key,this)) {
/* Start from the beginning */
stack->pos = stack->slot = 0;
}
@@ -2395,7 +2373,7 @@ static TreeDbTerm *find_prev(DbTableTree *tb, DbTreeStack* stack,
return NULL;
for (;;) {
PUSH_NODE(stack, this);
- if (( c = cmp_key(tb,key,key_base,this) ) < 0) {
+ if (( c = cmp_key(tb,key,this) ) < 0) {
if (this->left == NULL) /* We are at the next
and the element does
not exist */
@@ -2448,8 +2426,7 @@ static TreeDbTerm *find_next_from_pb_key(DbTableTree *tb, DbTreeStack* stack,
return NULL;
for (;;) {
PUSH_NODE(stack, this);
- if (( c = cmp_partly_bound(key,GETKEY(tb, this->dbterm.tpl),
- this->dbterm.tpl) ) >= 0) {
+ if (( c = cmp_partly_bound(key,GETKEY(tb, this->dbterm.tpl))) >= 0) {
if (this->right == NULL) {
do {
tmp = POP_NODE(stack);
@@ -2482,8 +2459,7 @@ static TreeDbTerm *find_prev_from_pb_key(DbTableTree *tb, DbTreeStack* stack,
return NULL;
for (;;) {
PUSH_NODE(stack, this);
- if (( c = cmp_partly_bound(key,GETKEY(tb, this->dbterm.tpl),
- this->dbterm.tpl) ) <= 0) {
+ if (( c = cmp_partly_bound(key,GETKEY(tb, this->dbterm.tpl))) <= 0) {
if (this->left == NULL) {
do {
tmp = POP_NODE(stack);
@@ -2514,10 +2490,10 @@ static TreeDbTerm *find_node(DbTableTree *tb, Eterm key)
DbTreeStack* stack = get_static_stack(tb);
if(!stack || EMPTY_NODE(stack)
- || !cmp_key_eq(tb, key, NULL, (this=TOP_NODE(stack)))) {
+ || !cmp_key_eq(tb, key, (this=TOP_NODE(stack)))) {
this = tb->root;
- while (this != NULL && (res = cmp_key(tb,key,NULL,this)) != 0) {
+ while (this != NULL && (res = cmp_key(tb,key,this)) != 0) {
if (res < 0)
this = this->left;
else
@@ -2539,7 +2515,7 @@ static TreeDbTerm **find_node2(DbTableTree *tb, Eterm key)
Sint res;
this = &tb->root;
- while ((*this) != NULL && (res = cmp_key(tb, key, NULL, *this)) != 0) {
+ while ((*this) != NULL && (res = cmp_key(tb, key, *this)) != 0) {
if (res < 0)
this = &((*this)->left);
else
@@ -2589,9 +2565,6 @@ db_lookup_dbterm_tree(Process *p, DbTable *tbl, Eterm key, Eterm obj,
handle->flags = flags;
handle->bp = (void**) pp;
handle->new_size = (*pp)->dbterm.size;
-#if HALFWORD_HEAP
- handle->abs_vec = NULL;
-#endif
return 1;
}
@@ -2622,7 +2595,7 @@ db_finalize_dbterm_tree(int cret, DbUpdateHandle *handle)
*/
static void traverse_backwards(DbTableTree *tb,
DbTreeStack* stack,
- Eterm lastkey, Eterm* lk_base,
+ Eterm lastkey,
int (*doit)(DbTableTree *,
TreeDbTerm *,
void *,
@@ -2641,16 +2614,15 @@ static void traverse_backwards(DbTableTree *tb,
this = this->right;
}
this = TOP_NODE(stack);
- next = find_prev(tb, stack, GETKEY(tb, this->dbterm.tpl),
- this->dbterm.tpl);
+ next = find_prev(tb, stack, GETKEY(tb, this->dbterm.tpl));
if (!((*doit)(tb, this, context, 0)))
return;
} else {
- next = find_prev(tb, stack, lastkey, lk_base);
+ next = find_prev(tb, stack, lastkey);
}
while ((this = next) != NULL) {
- next = find_prev(tb, stack, GETKEY(tb, this->dbterm.tpl), this->dbterm.tpl);
+ next = find_prev(tb, stack, GETKEY(tb, this->dbterm.tpl));
if (!((*doit)(tb, this, context, 0)))
return;
}
@@ -2661,7 +2633,7 @@ static void traverse_backwards(DbTableTree *tb,
*/
static void traverse_forward(DbTableTree *tb,
DbTreeStack* stack,
- Eterm lastkey, Eterm* lk_base,
+ Eterm lastkey,
int (*doit)(DbTableTree *,
TreeDbTerm *,
void *,
@@ -2680,15 +2652,15 @@ static void traverse_forward(DbTableTree *tb,
this = this->left;
}
this = TOP_NODE(stack);
- next = find_next(tb, stack, GETKEY(tb, this->dbterm.tpl), this->dbterm.tpl);
+ next = find_next(tb, stack, GETKEY(tb, this->dbterm.tpl));
if (!((*doit)(tb, this, context, 1)))
return;
} else {
- next = find_next(tb, stack, lastkey, lk_base);
+ next = find_next(tb, stack, lastkey);
}
while ((this = next) != NULL) {
- next = find_next(tb, stack, GETKEY(tb, this->dbterm.tpl), this->dbterm.tpl);
+ next = find_next(tb, stack, GETKEY(tb, this->dbterm.tpl));
if (!((*doit)(tb, this, context, 1)))
return;
}
@@ -2725,7 +2697,7 @@ static int key_given(DbTableTree *tb, Eterm pattern, TreeDbTerm **ret,
-static Sint do_cmp_partly_bound(Eterm a, Eterm b, Eterm* b_base, int *done)
+static Sint do_cmp_partly_bound(Eterm a, Eterm b, int *done)
{
Eterm* aa;
Eterm* bb;
@@ -2739,44 +2711,44 @@ static Sint do_cmp_partly_bound(Eterm a, Eterm b, Eterm* b_base, int *done)
*done = 1;
return 0;
}
- if (is_same(a,NULL,b,b_base))
+ if (is_same(a,b))
return 0;
switch (a & _TAG_PRIMARY_MASK) {
case TAG_PRIMARY_LIST:
if (!is_list(b)) {
- return cmp_rel(a,NULL,b,b_base);
+ return CMP(a,b);
}
aa = list_val(a);
- bb = list_val_rel(b,b_base);
+ bb = list_val(b);
while (1) {
- if ((j = do_cmp_partly_bound(*aa++, *bb++, b_base, done)) != 0 || *done)
+ if ((j = do_cmp_partly_bound(*aa++, *bb++, done)) != 0 || *done)
return j;
- if (is_same(*aa, NULL, *bb, b_base))
+ if (is_same(*aa, *bb))
return 0;
if (is_not_list(*aa) || is_not_list(*bb))
- return do_cmp_partly_bound(*aa, *bb, b_base, done);
+ return do_cmp_partly_bound(*aa, *bb, done);
aa = list_val(*aa);
- bb = list_val_rel(*bb,b_base);
+ bb = list_val(*bb);
}
case TAG_PRIMARY_BOXED:
if ((b & _TAG_PRIMARY_MASK) != TAG_PRIMARY_BOXED) {
- return cmp_rel(a,NULL,b,b_base);
+ return CMP(a,b);
}
a_hdr = ((*boxed_val(a)) & _TAG_HEADER_MASK) >> _TAG_PRIMARY_SIZE;
- b_hdr = ((*boxed_val_rel(b,b_base)) & _TAG_HEADER_MASK) >> _TAG_PRIMARY_SIZE;
+ b_hdr = ((*boxed_val(b)) & _TAG_HEADER_MASK) >> _TAG_PRIMARY_SIZE;
if (a_hdr != b_hdr) {
- return cmp_rel(a, NULL, b, b_base);
+ return CMP(a,b);
}
if (a_hdr == (_TAG_HEADER_ARITYVAL >> _TAG_PRIMARY_SIZE)) {
aa = tuple_val(a);
- bb = tuple_val_rel(b, b_base);
+ bb = tuple_val(b);
/* compare the arities */
i = arityval(*aa); /* get the arity*/
if (i < arityval(*bb)) return(-1);
if (i > arityval(*bb)) return(1);
while (i--) {
- if ((j = do_cmp_partly_bound(*++aa, *++bb, b_base, done)) != 0
+ if ((j = do_cmp_partly_bound(*++aa, *++bb, done)) != 0
|| *done)
return j;
}
@@ -2784,14 +2756,13 @@ static Sint do_cmp_partly_bound(Eterm a, Eterm b, Eterm* b_base, int *done)
}
/* Drop through */
default:
- return cmp_rel(a, NULL, b, b_base);
+ return CMP(a,b);
}
}
-static Sint cmp_partly_bound(Eterm partly_bound_key, Eterm bound_key, Eterm* bk_base)
-{
+static Sint cmp_partly_bound(Eterm partly_bound_key, Eterm bound_key) {
int done = 0;
- Sint ret = do_cmp_partly_bound(partly_bound_key, bound_key, bk_base, &done);
+ Sint ret = do_cmp_partly_bound(partly_bound_key, bound_key, &done);
#ifdef HARDDEBUG
erts_fprintf(stderr,"\ncmp_partly_bound: %T", partly_bound_key);
if (ret < 0)
@@ -2800,7 +2771,7 @@ static Sint cmp_partly_bound(Eterm partly_bound_key, Eterm bound_key, Eterm* bk_
erts_fprintf(stderr," > ");
else
erts_fprintf(stderr," == ");
- erts_fprintf(stderr,"%R\n", bound_key, bk_base);
+ erts_fprintf(stderr,"%T\n", bound_key);
#endif
return ret;
}
@@ -3017,12 +2988,10 @@ static int doit_select(DbTableTree *tb, TreeDbTerm *this, void *ptr,
if (sc->end_condition != NIL &&
((forward &&
cmp_partly_bound(sc->end_condition,
- GETKEY_WITH_POS(sc->keypos, this->dbterm.tpl),
- this->dbterm.tpl) < 0) ||
+ GETKEY_WITH_POS(sc->keypos, this->dbterm.tpl)) < 0) ||
(!forward &&
cmp_partly_bound(sc->end_condition,
- GETKEY_WITH_POS(sc->keypos, this->dbterm.tpl),
- this->dbterm.tpl) > 0))) {
+ GETKEY_WITH_POS(sc->keypos, this->dbterm.tpl)) > 0))) {
return 0;
}
ret = db_match_dbterm(&tb->common,sc->p,sc->mp,sc->all_objects,
@@ -3054,8 +3023,7 @@ static int doit_select_count(DbTableTree *tb, TreeDbTerm *this, void *ptr,
/* Always backwards traversing */
if (sc->end_condition != NIL &&
(cmp_partly_bound(sc->end_condition,
- GETKEY_WITH_POS(sc->keypos, this->dbterm.tpl),
- this->dbterm.tpl) > 0)) {
+ GETKEY_WITH_POS(sc->keypos, this->dbterm.tpl)) > 0)) {
return 0;
}
ret = db_match_dbterm(&tb->common, sc->p, sc->mp, 0,
@@ -3081,12 +3049,10 @@ static int doit_select_chunk(DbTableTree *tb, TreeDbTerm *this, void *ptr,
if (sc->end_condition != NIL &&
((forward &&
cmp_partly_bound(sc->end_condition,
- GETKEY_WITH_POS(sc->keypos, this->dbterm.tpl),
- this->dbterm.tpl) < 0) ||
+ GETKEY_WITH_POS(sc->keypos, this->dbterm.tpl)) < 0) ||
(!forward &&
cmp_partly_bound(sc->end_condition,
- GETKEY_WITH_POS(sc->keypos, this->dbterm.tpl),
- this->dbterm.tpl) > 0))) {
+ GETKEY_WITH_POS(sc->keypos, this->dbterm.tpl)) > 0))) {
return 0;
}
@@ -3124,14 +3090,13 @@ static int doit_select_delete(DbTableTree *tb, TreeDbTerm *this, void *ptr,
if (sc->end_condition != NIL &&
cmp_partly_bound(sc->end_condition,
- GETKEY_WITH_POS(sc->keypos, this->dbterm.tpl),
- this->dbterm.tpl) > 0)
+ GETKEY_WITH_POS(sc->keypos, this->dbterm.tpl)) > 0)
return 0;
ret = db_match_dbterm(&tb->common, sc->p, sc->mp, 0,
&this->dbterm, NULL, 0);
if (ret == am_true) {
key = GETKEY(sc->tb, this->dbterm.tpl);
- linkout_tree(sc->tb, key, this->dbterm.tpl);
+ linkout_tree(sc->tb, key);
sc->erase_lastterm = 1;
++sc->accum;
}
@@ -3157,11 +3122,10 @@ static void do_dump_tree2(DbTableTree* tb, int to, void *to_arg, int show,
}
else {
prefix = "";
- term = make_tuple_rel(t->dbterm.tpl,t->dbterm.tpl);
+ term = make_tuple(t->dbterm.tpl);
}
- erts_print(to, to_arg, "%*s%s%R (addr = %p, bal = %d)\n",
- offset, "", prefix, term, t->dbterm.tpl,
- t, t->balance);
+ erts_print(to, to_arg, "%*s%s%T (addr = %p, bal = %d)\n",
+ offset, "", prefix, term, t, t->balance);
}
do_dump_tree2(tb, to, to_arg, show, t->left, offset + 4);
}
diff --git a/erts/emulator/beam/erl_db_util.c b/erts/emulator/beam/erl_db_util.c
index dab357a079..0bf9558ac9 100644
--- a/erts/emulator/beam/erl_db_util.c
+++ b/erts/emulator/beam/erl_db_util.c
@@ -239,11 +239,7 @@ typedef enum {
matchCall2,
matchCall3,
matchPushV,
-#if HALFWORD_HEAP
- matchPushVGuard, /* First guard-only variable reference */
-#endif
- matchPushVResult, /* First variable reference in result, or (if HALFWORD)
- in guard if also referenced in result */
+ matchPushVResult, /* First variable reference in result */
matchPushExpr, /* Push the whole expression we're matching ('$_') */
matchPushArrayAsList, /* Only when parameter is an Array and
not an erlang term (DCOMP_TRACE) */
@@ -310,9 +306,6 @@ DMC_DECLARE_STACK_TYPE(unsigned);
typedef struct DMCVariable {
int is_bound;
int is_in_body;
-#if HALFWORD_HEAP
- int first_guard_label; /* to maybe change from PushVGuard to PushVResult */
-#endif
} DMCVariable;
typedef struct DMCHeap {
@@ -374,7 +367,6 @@ typedef struct MatchVariable {
Eterm term;
#ifdef DEBUG
Process* proc;
- Eterm* base;
#endif
} MatchVariable;
@@ -415,7 +407,7 @@ cleanup_match_pseudo_process(ErtsMatchPseudoProcess *mpsp, int keep_heap)
else {
int i;
for (i = 0; i < ERTS_DEFAULT_MS_HEAP_SIZE; i++) {
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
mpsp->default_heap[i] = (Eterm) 0xdeadbeefdeadbeef;
#else
mpsp->default_heap[i] = (Eterm) 0xdeadbeef;
@@ -1240,7 +1232,7 @@ Eterm erts_match_set_run(Process *p, Binary *mpsp,
{
Eterm ret;
- ret = db_prog_match(p, mpsp, NIL, NULL, args, num_args,
+ ret = db_prog_match(p, mpsp, NIL, args, num_args,
in_flags, return_flags);
#if defined(HARDDEBUG)
if (is_non_value(ret)) {
@@ -1265,7 +1257,7 @@ static Eterm erts_match_set_run_ets(Process *p, Binary *mpsp,
{
Eterm ret;
- ret = db_prog_match(p, mpsp, args, NULL, NULL, num_args,
+ ret = db_prog_match(p, mpsp, args, NULL, num_args,
ERTS_PAM_COPY_RESULT,
return_flags);
#if defined(HARDDEBUG)
@@ -1755,71 +1747,6 @@ static Eterm dpm_array_to_list(Process *psp, Eterm *arr, int arity)
return ret;
}
-
-#if HALFWORD_HEAP
-struct heap_checkpoint_t
-{
- Process *p;
- Eterm* htop;
- ErlHeapFragment* mbuf;
- unsigned used_size;
- ErlOffHeap off_heap;
-};
-
-static void heap_checkpoint_init(Process* p, struct heap_checkpoint_t* hcp)
-{
- hcp->p = p;
- hcp->htop = HEAP_TOP(p);
- hcp->mbuf = MBUF(p);
- hcp->used_size = hcp->mbuf ? hcp->mbuf->used_size : 0;
- hcp->off_heap = MSO(p);
-}
-
-static void heap_checkpoint_revert(struct heap_checkpoint_t* hcp)
-{
- struct erl_off_heap_header* oh = MSO(hcp->p).first;
-
- if (oh != hcp->off_heap.first) {
- ASSERT(oh != NULL);
- if (hcp->off_heap.first) {
- while (oh->next != hcp->off_heap.first) {
- oh = oh->next;
- }
- oh->next = NULL;
- }
- erts_cleanup_offheap(&MSO(hcp->p));
- MSO(hcp->p) = hcp->off_heap;
- }
- if (MBUF(hcp->p) != hcp->mbuf) {
- ErlHeapFragment* hf = MBUF(hcp->p);
- ASSERT(hf != NULL);
- if (hcp->mbuf) {
- while (hf->next != hcp->mbuf) {
- hf = hf->next;
- }
- hf->next = NULL;
- }
- free_message_buffer(MBUF(hcp->p));
- MBUF(hcp->p) = hcp->mbuf;
- }
- if (hcp->mbuf != NULL && hcp->mbuf->used_size != hcp->used_size) {
- hcp->mbuf->used_size = hcp->used_size;
- }
- HEAP_TOP(hcp->p) = hcp->htop;
-}
-#endif /* HALFWORD_HEAP */
-
-static ERTS_INLINE Eterm copy_object_rel(Process* p, Eterm term, Eterm* base)
-{
- if (!is_immed(term)) {
- Uint sz = size_object_rel(term, base);
- Eterm* top = HAllocX(p, sz, HEAP_XTRA);
- return copy_struct_rel(term, sz, &top, &MSO(p), base, NULL);
- }
- return term;
-}
-
-
/*
** Execution of the match program, this is Pam.
** May return THE_NON_VALUE, which is a bailout.
@@ -1827,7 +1754,7 @@ static ERTS_INLINE Eterm copy_object_rel(Process* p, Eterm term, Eterm* base)
** i.e. 'DCOMP_TRACE' was specified
*/
Eterm db_prog_match(Process *c_p, Binary *bprog,
- Eterm term, Eterm* base,
+ Eterm term,
Eterm *termp,
int arity,
enum erts_pam_run_flags in_flags,
@@ -1855,17 +1782,12 @@ Eterm db_prog_match(Process *c_p, Binary *bprog,
Eterm bif_args[3];
int fail_label;
int atomic_trace;
-#if HALFWORD_HEAP
- struct heap_checkpoint_t c_p_checkpoint = {};
-#endif
#ifdef DMC_DEBUG
Uint *heap_fence;
Uint *stack_fence;
Uint save_op;
#endif /* DMC_DEBUG */
- ASSERT(base==NULL || HALFWORD_HEAP);
-
mpsp = get_match_pseudo_process(c_p, prog->heap_size);
psp = &mpsp->process;
@@ -1916,11 +1838,7 @@ Eterm db_prog_match(Process *c_p, Binary *bprog,
do_catch != 0 */
*return_flags = 0U;
-
variables = mpsp->u.variables;
-#if HALFWORD_HEAP
- c_p_checkpoint.p = NULL;
-#endif
restart:
ep = &term;
@@ -1931,14 +1849,12 @@ restart:
fail_label = -1;
build_proc = psp;
esdp->current_process = psp;
- ASSERT_HALFWORD(!c_p_checkpoint.p);
#ifdef DEBUG
ASSERT(variables == mpsp->u.variables);
for (i=0; i<prog->num_bindings; i++) {
variables[i].term = THE_NON_VALUE;
variables[i].proc = NULL;
- variables[i].base = base;
}
#endif
@@ -1974,9 +1890,9 @@ restart:
variables[n].term = dpm_array_to_list(psp, termp, arity);
break;
case matchTuple: /* *ep is a tuple of arity n */
- if (!is_tuple_rel(*ep,base))
+ if (!is_tuple(*ep))
FAIL();
- ep = tuple_val_rel(*ep,base);
+ ep = tuple_val(*ep);
n = *pc++;
if (arityval(*ep) != n)
FAIL();
@@ -1984,9 +1900,9 @@ restart:
break;
case matchPushT: /* *ep is a tuple of arity n,
push ptr to first element */
- if (!is_tuple_rel(*ep,base))
+ if (!is_tuple(*ep))
FAIL();
- tp = tuple_val_rel(*ep,base);
+ tp = tuple_val(*ep);
n = *pc++;
if (arityval(*tp) != n)
FAIL();
@@ -1996,51 +1912,51 @@ restart:
case matchList:
if (!is_list(*ep))
FAIL();
- ep = list_val_rel(*ep,base);
+ ep = list_val(*ep);
break;
case matchPushL:
if (!is_list(*ep))
FAIL();
- *sp++ = list_val_rel(*ep,base);
+ *sp++ = list_val(*ep);
++ep;
break;
case matchMap:
- if (!is_map_rel(*ep, base)) {
+ if (!is_map(*ep)) {
FAIL();
}
n = *pc++;
- if (is_flatmap_rel(*ep,base)) {
- if (flatmap_get_size(flatmap_val_rel(*ep, base)) < n) {
+ if (is_flatmap(*ep)) {
+ if (flatmap_get_size(flatmap_val(*ep)) < n) {
FAIL();
}
} else {
- ASSERT(is_hashmap_rel(*ep,base));
- if (hashmap_size_rel(*ep, base) < n) {
+ ASSERT(is_hashmap(*ep));
+ if (hashmap_size(*ep) < n) {
FAIL();
}
}
- ep = flatmap_val_rel(*ep, base);
+ ep = flatmap_val(*ep);
break;
case matchPushM:
- if (!is_map_rel(*ep, base)) {
+ if (!is_map(*ep)) {
FAIL();
}
n = *pc++;
- if (is_flatmap_rel(*ep,base)) {
- if (flatmap_get_size(flatmap_val_rel(*ep, base)) < n) {
+ if (is_flatmap(*ep)) {
+ if (flatmap_get_size(flatmap_val(*ep)) < n) {
FAIL();
}
} else {
- ASSERT(is_hashmap_rel(*ep,base));
- if (hashmap_size_rel(*ep, base) < n) {
+ ASSERT(is_hashmap(*ep));
+ if (hashmap_size(*ep) < n) {
FAIL();
}
}
- *sp++ = flatmap_val_rel(*ep++, base);
+ *sp++ = flatmap_val(*ep++);
break;
case matchKey:
t = (Eterm) *pc++;
- tp = erts_maps_get_rel(t, make_boxed_rel(ep, base), base);
+ tp = erts_maps_get(t, make_boxed(ep));
if (!tp) {
FAIL();
}
@@ -2061,29 +1977,29 @@ restart:
break;
case matchCmp:
n = *pc++;
- if (!eq_rel(variables[n].term, base, *ep, base))
+ if (!EQ(variables[n].term, *ep))
FAIL();
++ep;
break;
case matchEqBin:
t = (Eterm) *pc++;
- if (!eq_rel(t,NULL,*ep,base))
+ if (!EQ(t,*ep))
FAIL();
++ep;
break;
case matchEqFloat:
- if (!is_float_rel(*ep,base))
+ if (!is_float(*ep))
FAIL();
- if (memcmp(float_val_rel(*ep,base) + 1, pc, sizeof(double)))
+ if (memcmp(float_val(*ep) + 1, pc, sizeof(double)))
FAIL();
pc += TermWords(2);
++ep;
break;
case matchEqRef: {
Eterm* epc = (Eterm*)pc;
- if (!is_ref_rel(*ep,base))
+ if (!is_ref(*ep))
FAIL();
- if (!eq_rel(make_internal_ref_rel(epc, epc), epc, *ep, base)) {
+ if (!EQ(make_internal_ref(epc), *ep)) {
FAIL();
}
i = thing_arityval(*epc);
@@ -2092,9 +2008,9 @@ restart:
break;
}
case matchEqBig:
- if (!is_big_rel(*ep,base))
+ if (!is_big(*ep))
FAIL();
- tp = big_val_rel(*ep,base);
+ tp = big_val(*ep);
{
Eterm *epc = (Eterm *) pc;
if (*tp != *epc)
@@ -2236,62 +2152,36 @@ restart:
esp -= 2;
esp[-1] = t;
break;
-
- #if HALFWORD_HEAP
- case matchPushVGuard:
- if (!base) goto case_matchPushV;
- /* Build NULL-based copy on pseudo heap for easy disposal */
- n = *pc++;
- ASSERT(is_value(variables[n].term));
- ASSERT(!variables[n].proc);
- variables[n].term = copy_object_rel(psp, variables[n].term, base);
- *esp++ = variables[n].term;
- #ifdef DEBUG
- variables[n].proc = psp;
- variables[n].base = NULL;
- #endif
- break;
- #endif
case matchPushVResult:
if (!(in_flags & ERTS_PAM_COPY_RESULT)) goto case_matchPushV;
-
- /* Build (NULL-based) copy on callers heap */
- #if HALFWORD_HEAP
- if (!do_catch && !c_p_checkpoint.p) {
- heap_checkpoint_init(c_p, &c_p_checkpoint);
- }
- #endif
+ /* Build copy on callers heap */
n = *pc++;
ASSERT(is_value(variables[n].term));
ASSERT(!variables[n].proc);
- variables[n].term = copy_object_rel(c_p, variables[n].term, base);
+ variables[n].term = copy_object_x(variables[n].term, c_p, HEAP_XTRA);
*esp++ = variables[n].term;
#ifdef DEBUG
variables[n].proc = c_p;
- variables[n].base = NULL;
#endif
break;
case matchPushV:
case_matchPushV:
n = *pc++;
ASSERT(is_value(variables[n].term));
- ASSERT(!variables[n].base);
*esp++ = variables[n].term;
break;
case matchPushExpr:
if (in_flags & ERTS_PAM_COPY_RESULT) {
Uint sz;
Eterm* top;
- sz = size_object_rel(term, base);
+ sz = size_object(term);
top = HAllocX(build_proc, sz, HEAP_XTRA);
if (in_flags & ERTS_PAM_CONTIGUOUS_TUPLE) {
- ASSERT(is_tuple_rel(term,base));
- *esp++ = copy_shallow_rel(tuple_val_rel(term,base), sz,
- &top, &MSO(build_proc), base);
+ ASSERT(is_tuple(term));
+ *esp++ = copy_shallow(tuple_val(term), sz, &top, &MSO(build_proc));
}
else {
- *esp++ = copy_struct_rel(term, sz, &top, &MSO(build_proc),
- base, NULL);
+ *esp++ = copy_struct(term, sz, &top, &MSO(build_proc));
}
}
else {
@@ -2299,7 +2189,6 @@ restart:
}
break;
case matchPushArrayAsList:
- ASSERT_HALFWORD(base == NULL);
n = arity; /* Only happens when 'term' is an array */
tp = termp;
ehp = HAllocX(build_proc, n*2, HEAP_XTRA);
@@ -2315,7 +2204,6 @@ restart:
break;
case matchPushArrayAsListU:
/* This instruction is NOT efficient. */
- ASSERT_HALFWORD(base == NULL);
*esp++ = dpm_array_to_list(build_proc, termp, arity);
break;
case matchTrue:
@@ -2619,13 +2507,6 @@ restart:
}
}
fail:
-#if HALFWORD_HEAP
- if (c_p_checkpoint.p) {
- /* Dispose garbage built by guards on caller heap */
- heap_checkpoint_revert(&c_p_checkpoint);
- c_p_checkpoint.p = NULL;
- }
-#endif
*return_flags = 0U;
if (fail_label >= 0) { /* We failed during a "TryMeElse",
lets restart, with the next match
@@ -2788,13 +2669,6 @@ Wterm db_do_read_element(DbUpdateHandle* handle, Sint position)
{
Eterm elem = handle->dbterm->tpl[position];
if (!is_header(elem)) {
-#if HALFWORD_HEAP
- if (!is_immed(elem)
- && !handle->tb->common.compress
- && !(handle->abs_vec && handle->abs_vec[position])) {
- return rterm2wterm(elem, handle->dbterm->tpl);
- }
-#endif
return elem;
}
@@ -2822,9 +2696,6 @@ void db_do_update_element(DbUpdateHandle* handle,
Eterm* oldp;
Uint newval_sz;
Uint oldval_sz;
-#if HALFWORD_HEAP
- Eterm* old_base;
-#endif
if (is_both_immed(newval,oldval)) {
handle->dbterm->tpl[position] = newval;
@@ -2841,15 +2712,8 @@ void db_do_update_element(DbUpdateHandle* handle,
handle->dbterm);
handle->flags |= DB_MUST_RESIZE;
oldval = handle->dbterm->tpl[position];
- #if HALFWORD_HEAP
- old_base = NULL;
- #endif
}
else {
- #if HALFWORD_HEAP
- ASSERT(!handle->abs_vec);
- old_base = handle->dbterm->tpl;
- #endif
if (is_boxed(newval)) {
newp = boxed_val(newval);
switch (*newp & _TAG_HEADER_MASK) {
@@ -2859,7 +2723,7 @@ void db_do_update_element(DbUpdateHandle* handle,
case _TAG_HEADER_HEAP_BIN:
newval_sz = header_arity(*newp) + 1;
if (is_boxed(oldval)) {
- oldp = boxed_val_rel(oldval,old_base);
+ oldp = boxed_val(oldval);
switch (*oldp & _TAG_HEADER_MASK) {
case _TAG_HEADER_POS_BIG:
case _TAG_HEADER_NEG_BIG:
@@ -2879,20 +2743,13 @@ void db_do_update_element(DbUpdateHandle* handle,
}
}
}
-#if HALFWORD_HEAP
- else {
- old_base = (handle->tb->common.compress
- || (handle->abs_vec && handle->abs_vec[position])) ?
- NULL : handle->dbterm->tpl;
- }
-#endif
/* Not possible for simple memcpy or dbterm is already non-contiguous, */
/* need to realloc... */
newval_sz = is_immed(newval) ? 0 : size_object(newval);
new_size_set:
- oldval_sz = is_immed(oldval) ? 0 : size_object_rel(oldval,old_base);
+ oldval_sz = is_immed(oldval) ? 0 : size_object(oldval);
both_size_set:
handle->new_size = handle->new_size - oldval_sz + newval_sz;
@@ -2900,19 +2757,6 @@ both_size_set:
/* write new value in old dbterm, finalize will make a flat copy */
handle->dbterm->tpl[position] = newval;
handle->flags |= DB_MUST_RESIZE;
-
-#if HALFWORD_HEAP
- if (old_base && newval_sz > 0) {
- ASSERT(!handle->tb->common.compress);
- if (!handle->abs_vec) {
- int i = header_arity(handle->dbterm->tpl[0]);
- handle->abs_vec = erts_alloc(ERTS_ALC_T_TMP, (i+1)*sizeof(char));
- sys_memset(handle->abs_vec, 0, i+1);
- /* abs_vec[0] not used */
- }
- handle->abs_vec[position] = 1;
- }
-#endif
}
static ERTS_INLINE byte* db_realloc_term(DbTableCommon* tb, void* old,
@@ -3011,7 +2855,7 @@ static void* copy_to_comp(DbTableCommon* tb, Eterm obj, DbTerm* dest,
tpl[arity + 1] = alloc_size;
tmp_offheap.first = NULL;
- tpl[tb->keypos] = copy_struct_rel(key, size_object(key), &top.ep, &tmp_offheap, NULL, tpl);
+ tpl[tb->keypos] = copy_struct(key, size_object(key), &top.ep, &tmp_offheap);
dest->first_oh = tmp_offheap.first;
for (i=1; i<=arity; i++) {
if (i != tb->keypos) {
@@ -3030,7 +2874,7 @@ static void* copy_to_comp(DbTableCommon* tb, Eterm obj, DbTerm* dest,
Eterm* dbg_top = erts_alloc(ERTS_ALC_T_DB_TERM, dest->size * sizeof(Eterm));
dest->debug_clone = dbg_top;
tmp_offheap.first = dest->first_oh;
- copy_struct_rel(obj, dest->size, &dbg_top, &tmp_offheap, NULL, dbg_top);
+ copy_struct(obj, dest->size, &dbg_top, &tmp_offheap);
dest->first_oh = tmp_offheap.first;
ASSERT(dbg_top == dest->debug_clone + dest->size);
}
@@ -3077,7 +2921,7 @@ void* db_store_term(DbTableCommon *tb, DbTerm* old, Uint offset, Eterm obj)
newp->size = size;
top = newp->tpl;
tmp_offheap.first = NULL;
- copy_struct_rel(obj, size, &top, &tmp_offheap, NULL, top);
+ copy_struct(obj, size, &top, &tmp_offheap);
newp->first_oh = tmp_offheap.first;
#ifdef DEBUG_CLONE
newp->debug_clone = NULL;
@@ -3160,29 +3004,8 @@ void db_finalize_resize(DbUpdateHandle* handle, Uint offset)
tmp_offheap.first = NULL;
- #if HALFWORD_HEAP
- if (handle->abs_vec) {
- int i, arity = header_arity(handle->dbterm->tpl[0]);
-
- top[0] = tpl[0];
- top += arity + 1;
- for (i=1; i<=arity; i++) {
- Eterm* src_base = handle->abs_vec[i] ? NULL : tpl;
-
- newDbTerm->tpl[i] = copy_struct_rel(tpl[i],
- size_object_rel(tpl[i],src_base),
- &top, &tmp_offheap, src_base,
- newDbTerm->tpl);
- }
- newDbTerm->first_oh = tmp_offheap.first;
- ASSERT((byte*)top <= (newp + alloc_sz));
- erts_free(ERTS_ALC_T_TMP, handle->abs_vec);
- }
- else
- #endif /* HALFWORD_HEAP */
{
- copy_struct_rel(make_tuple_rel(tpl,tpl), handle->new_size, &top,
- &tmp_offheap, tpl, top);
+ copy_struct(make_tuple(tpl), handle->new_size, &top, &tmp_offheap);
newDbTerm->first_oh = tmp_offheap.first;
ASSERT((byte*)top == (newp + alloc_sz));
}
@@ -3199,9 +3022,9 @@ Eterm db_copy_from_comp(DbTableCommon* tb, DbTerm* bp, Eterm** hpp,
hp[0] = bp->tpl[0];
*hpp += arity + 1;
- hp[tb->keypos] = copy_struct_rel(bp->tpl[tb->keypos],
- size_object_rel(bp->tpl[tb->keypos], bp->tpl),
- hpp, off_heap, bp->tpl, NULL);
+ hp[tb->keypos] = copy_struct(bp->tpl[tb->keypos],
+ size_object(bp->tpl[tb->keypos]),
+ hpp, off_heap);
erts_factory_static_init(&factory, *hpp, bp->size - (arity+1), off_heap);
@@ -3221,7 +3044,7 @@ Eterm db_copy_from_comp(DbTableCommon* tb, DbTerm* bp, Eterm** hpp,
ASSERT((*hpp - hp) <= bp->size);
#ifdef DEBUG_CLONE
- ASSERT(eq_rel(make_tuple(hp),NULL,make_tuple(bp->debug_clone),bp->debug_clone));
+ ASSERT(EQ(make_tuple(hp),make_tuple(bp->debug_clone)));
#endif
return make_tuple(hp);
}
@@ -3245,14 +3068,14 @@ Eterm db_copy_element_from_ets(DbTableCommon* tb, Process* p,
*hpp = erts_produce_heap(&factory, extra, 0);
erts_factory_close(&factory);
#ifdef DEBUG_CLONE
- ASSERT(eq_rel(copy, NULL, obj->debug_clone[pos], obj->debug_clone));
+ ASSERT(EQ(copy, obj->debug_clone[pos]));
#endif
return copy;
}
else {
- Uint sz = size_object_rel(obj->tpl[pos], obj->tpl);
+ Uint sz = size_object(obj->tpl[pos]);
*hpp = HAlloc(p, sz + extra);
- return copy_struct_rel(obj->tpl[pos], sz, hpp, &MSO(p), obj->tpl, NULL);
+ return copy_struct(obj->tpl[pos], sz, hpp, &MSO(p));
}
}
@@ -3599,26 +3422,10 @@ static DMCRet dmc_one_term(DMCContext *context,
{
Eterm* ref_val = internal_ref_val(c);
DMC_PUSH(*text, matchEqRef);
-#if HALFWORD_HEAP
- {
- union {
- UWord u;
- Uint t[2];
- } fiddle;
- ASSERT(thing_arityval(ref_val[0]) == 3);
- fiddle.t[0] = ref_val[0];
- fiddle.t[1] = ref_val[1];
- DMC_PUSH(*text, fiddle.u);
- fiddle.t[0] = ref_val[2];
- fiddle.t[1] = ref_val[3];
- DMC_PUSH(*text, fiddle.u);
- }
-#else
n = thing_arityval(ref_val[0]);
for (i = 0; i <= n; ++i) {
DMC_PUSH(*text, ref_val[i]);
}
-#endif
break;
}
case (_TAG_HEADER_POS_BIG >> _TAG_PRIMARY_SIZE):
@@ -3627,53 +3434,19 @@ static DMCRet dmc_one_term(DMCContext *context,
Eterm* bval = big_val(c);
n = thing_arityval(bval[0]);
DMC_PUSH(*text, matchEqBig);
-#if HALFWORD_HEAP
- {
- union {
- UWord u;
- Uint t[2];
- } fiddle;
- ASSERT(n >= 1);
- fiddle.t[0] = bval[0];
- fiddle.t[1] = bval[1];
- DMC_PUSH(*text, fiddle.u);
- for (i = 2; i <= n; ++i) {
- fiddle.t[0] = bval[i];
- if (++i <= n) {
- fiddle.t[1] = bval[i];
- } else {
- fiddle.t[1] = (Uint) 0;
- }
- DMC_PUSH(*text, fiddle.u);
- }
- }
-#else
for (i = 0; i <= n; ++i) {
DMC_PUSH(*text, (Uint) bval[i]);
}
-#endif
break;
}
case (_TAG_HEADER_FLOAT >> _TAG_PRIMARY_SIZE):
DMC_PUSH(*text,matchEqFloat);
-#if HALFWORD_HEAP
- {
- union {
- UWord u;
- Uint t[2];
- } fiddle;
- fiddle.t[0] = float_val(c)[1];
- fiddle.t[1] = float_val(c)[2];
- DMC_PUSH(*text, fiddle.u);
- }
-#else
DMC_PUSH(*text, (Uint) float_val(c)[1]);
#ifdef ARCH_64
DMC_PUSH(*text, (Uint) 0);
#else
DMC_PUSH(*text, (Uint) float_val(c)[2]);
#endif
-#endif
break;
default: /* BINARY, FUN, VECTOR, or EXTERNAL */
DMC_PUSH(*text, matchEqBin);
@@ -3997,24 +3770,8 @@ static void dmc_add_pushv_variant(DMCContext *context, DMCHeap *heap,
MatchOps instr = matchPushV;
ASSERT(n < heap->vars_used && v->is_bound);
- if (context->is_guard) {
- #if HALFWORD_HEAP
- if (!v->first_guard_label) {
- v->first_guard_label = DMC_STACK_NUM(*text);
- ASSERT(v->first_guard_label);
- instr = matchPushVGuard; /* may be changed to PushVResult below */
- }
- #endif
- }
- else { /* body */
- #if HALFWORD_HEAP
- if (v->first_guard_label) {
- /* Avoid double-copy, copy to result heap at first encounter in guard */
- DMC_POKE(*text, v->first_guard_label, matchPushVResult);
- v->is_in_body = 1;
- }
- #endif
- if (!v->is_in_body) {
+ if (!context->is_guard) {
+ if(!v->is_in_body) {
instr = matchPushVResult;
v->is_in_body = 1;
}
@@ -5443,16 +5200,13 @@ Eterm db_match_dbterm(DbTableCommon* tb, Process* c_p, Binary* bprog,
int all, DbTerm* obj, Eterm** hpp, Uint extra)
{
Uint32 dummy;
- Eterm* base;
Eterm res;
if (tb->compress) {
obj = db_alloc_tmp_uncompressed(tb, obj);
- base = NULL;
}
- else base = HALFWORD_HEAP ? obj->tpl : NULL;
- res = db_prog_match(c_p, bprog, make_tuple_rel(obj->tpl,base), base, NULL, 0,
+ res = db_prog_match(c_p, bprog, make_tuple(obj->tpl), NULL, 0,
ERTS_PAM_COPY_RESULT|ERTS_PAM_CONTIGUOUS_TUPLE, &dummy);
if (is_value(res) && hpp!=NULL) {
@@ -5573,7 +5327,7 @@ void db_match_dis(Binary *bp)
first = 0;
else
erts_printf(", ");
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
erts_printf("0x%016bex", rt->data.ui[ri]);
#else
erts_printf("0x%08bex", rt->data.ui[ri]);
@@ -5597,7 +5351,7 @@ void db_match_dis(Binary *bp)
first = 0;
else
erts_printf(", ");
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
erts_printf("0x%016bex", *et);
#else
erts_printf("0x%08bex", *et);
@@ -5720,13 +5474,6 @@ void db_match_dis(Binary *bp)
++t;
erts_printf("PushV\t%beu\n", n);
break;
- #if HALFWORD_HEAP
- case matchPushVGuard:
- n = (Uint) *++t;
- ++t;
- erts_printf("PushVGuard\t%beu\n", n);
- break;
- #endif
case matchPushVResult:
n = (Uint) *++t;
++t;
diff --git a/erts/emulator/beam/erl_db_util.h b/erts/emulator/beam/erl_db_util.h
index 1ccdc0305b..c0966655cd 100644
--- a/erts/emulator/beam/erl_db_util.h
+++ b/erts/emulator/beam/erl_db_util.h
@@ -90,9 +90,6 @@ typedef struct {
Uint new_size;
int flags;
void* lck;
-#if HALFWORD_HEAP
- unsigned char* abs_vec; /* [i] true if dbterm->tpl[i] is absolute Eterm */
-#endif
} DbUpdateHandle;
@@ -287,10 +284,10 @@ ERTS_GLB_INLINE Eterm db_copy_key(Process* p, DbTable* tb, DbTerm* obj)
Eterm key = GETKEY(tb, obj->tpl);
if IS_CONST(key) return key;
else {
- Uint size = size_object_rel(key, obj->tpl);
+ Uint size = size_object(key);
Eterm* hp = HAlloc(p, size);
- Eterm res = copy_struct_rel(key, size, &hp, &MSO(p), obj->tpl, NULL);
- ASSERT(eq_rel(res,NULL,key,obj->tpl));
+ Eterm res = copy_struct(key, size, &hp, &MSO(p));
+ ASSERT(EQ(res,key));
return res;
}
}
@@ -302,14 +299,14 @@ ERTS_GLB_INLINE Eterm db_copy_object_from_ets(DbTableCommon* tb, DbTerm* bp,
return db_copy_from_comp(tb, bp, hpp, off_heap);
}
else {
- return copy_shallow_rel(bp->tpl, bp->size, hpp, off_heap, bp->tpl);
+ return copy_shallow(bp->tpl, bp->size, hpp, off_heap);
}
}
ERTS_GLB_INLINE int db_eq(DbTableCommon* tb, Eterm a, DbTerm* b)
{
if (!tb->compress) {
- return eq_rel(a, NULL, make_tuple_rel(b->tpl,b->tpl), b->tpl);
+ return EQ(a, make_tuple(b->tpl));
}
else {
return db_eq_comp(tb, a, b);
@@ -435,7 +432,7 @@ Binary *db_match_compile(Eterm *matchexpr, Eterm *guards,
Eterm db_match_dbterm(DbTableCommon* tb, Process* c_p, Binary* bprog,
int all, DbTerm* obj, Eterm** hpp, Uint extra);
-Eterm db_prog_match(Process *p, Binary *prog, Eterm term, Eterm* base,
+Eterm db_prog_match(Process *p, Binary *prog, Eterm term,
Eterm *termp, int arity,
enum erts_pam_run_flags in_flags,
Uint32 *return_flags /* Zeroed on enter */);
diff --git a/erts/emulator/beam/erl_debug.c b/erts/emulator/beam/erl_debug.c
index 2dcfb79f00..fae38728e4 100644
--- a/erts/emulator/beam/erl_debug.c
+++ b/erts/emulator/beam/erl_debug.c
@@ -631,29 +631,4 @@ void print_memory_info(Process *p)
}
erts_printf("+-----------------%s-%s-%s-%s-+\n",dashes,dashes,dashes,dashes);
}
-#if !HEAP_ON_C_STACK && defined(DEBUG)
-Eterm *erts_debug_allocate_tmp_heap(int size, Process *p)
-{
- ErtsSchedulerData *sd = ((p == NULL) ? erts_get_scheduler_data() : ERTS_PROC_GET_SCHDATA(p));
- int offset = sd->num_tmp_heap_used;
-
- ASSERT(offset+size <= TMP_HEAP_SIZE);
- return (sd->tmp_heap)+offset;
-}
-void erts_debug_use_tmp_heap(int size, Process *p)
-{
- ErtsSchedulerData *sd = ((p == NULL) ? erts_get_scheduler_data() : ERTS_PROC_GET_SCHDATA(p));
-
- sd->num_tmp_heap_used += size;
- ASSERT(sd->num_tmp_heap_used <= TMP_HEAP_SIZE);
-}
-void erts_debug_unuse_tmp_heap(int size, Process *p)
-{
- ErtsSchedulerData *sd = ((p == NULL) ? erts_get_scheduler_data() : ERTS_PROC_GET_SCHDATA(p));
-
- sd->num_tmp_heap_used -= size;
- ASSERT(sd->num_tmp_heap_used >= 0);
-}
#endif
-#endif
-
diff --git a/erts/emulator/beam/erl_debug.h b/erts/emulator/beam/erl_debug.h
index 4905e64f07..f4259e7dae 100644
--- a/erts/emulator/beam/erl_debug.h
+++ b/erts/emulator/beam/erl_debug.h
@@ -92,10 +92,4 @@ extern void print_tagged_memory(Eterm *start, Eterm *end);
extern void print_untagged_memory(Eterm *start, Eterm *end);
extern void print_memory(Process *p);
extern void print_memory_info(Process *p);
-#if defined(DEBUG) && !HEAP_ON_C_STACK
-extern Eterm *erts_debug_allocate_tmp_heap(int, Process *);
-extern void erts_debug_use_tmp_heap(int, Process *);
-extern void erts_debug_unuse_tmp_heap(int, Process *);
-#endif
-
#endif /* _ERL_DEBUG_H_ */
diff --git a/erts/emulator/beam/erl_driver.h b/erts/emulator/beam/erl_driver.h
index 6b406d069c..e71b87803b 100644
--- a/erts/emulator/beam/erl_driver.h
+++ b/erts/emulator/beam/erl_driver.h
@@ -57,10 +57,6 @@
# define SIZEOF_LONG_LONG_SAVED__ SIZEOF_LONG_LONG
# undef SIZEOF_LONG_LONG
#endif
-#ifdef HALFWORD_HEAP_EMULATOR
-# define HALFWORD_HEAP_EMULATOR_SAVED__ HALFWORD_HEAP_EMULATOR
-# undef HALFWORD_HEAP_EMULATOR
-#endif
#include "erl_int_sizes_config.h"
#if defined(SIZEOF_CHAR_SAVED__) && SIZEOF_CHAR_SAVED__ != SIZEOF_CHAR
# error SIZEOF_CHAR mismatch
@@ -78,11 +74,6 @@
# error SIZEOF_LONG_LONG mismatch
#endif
-/* This is OK to override by the NIF/driver implementor */
-#if defined(HALFWORD_HEAP_EMULATOR_SAVED__) && !defined(HALFWORD_HEAP_EMULATOR)
-#define HALFWORD_HEAP_EMULATOR HALFWORD_HEAP_EMULATOR_SAVED__
-#endif
-
#include "erl_drv_nif.h"
#include <stdlib.h>
@@ -699,16 +690,6 @@ EXTERN char *driver_dl_error(void);
EXTERN int erl_drv_putenv(char *key, char *value);
EXTERN int erl_drv_getenv(char *key, char *value, size_t *value_size);
-#ifdef __OSE__
-typedef ErlDrvUInt ErlDrvOseEventId;
-EXTERN union SIGNAL *erl_drv_ose_get_signal(ErlDrvEvent ev);
-EXTERN ErlDrvEvent erl_drv_ose_event_alloc(SIGSELECT sig, ErlDrvOseEventId handle,
- ErlDrvOseEventId (*resolve_signal)(union SIGNAL *sig), void *extra);
-EXTERN void erl_drv_ose_event_free(ErlDrvEvent ev);
-EXTERN void erl_drv_ose_event_fetch(ErlDrvEvent ev, SIGSELECT *sig,
- ErlDrvOseEventId *handle, void **extra);
-#endif
-
#endif /* !ERL_DRIVER_TYPES_ONLY */
#ifdef WIN32_DYNAMIC_ERL_DRIVER
diff --git a/erts/emulator/beam/erl_gc.c b/erts/emulator/beam/erl_gc.c
index d2604f1595..29579f74e6 100644
--- a/erts/emulator/beam/erl_gc.c
+++ b/erts/emulator/beam/erl_gc.c
@@ -128,7 +128,7 @@ static void disallow_heap_frag_ref_in_old_heap(Process* p);
static void disallow_heap_frag_ref(Process* p, Eterm* n_htop, Eterm* objv, int nobj);
#endif
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
# define MAX_HEAP_SIZES 154
#else
# define MAX_HEAP_SIZES 59
@@ -147,26 +147,10 @@ typedef struct {
erts_smp_atomic32_t refc;
} ErtsGCInfoReq;
-#if !HALFWORD_HEAP
ERTS_SCHED_PREF_QUICK_ALLOC_IMPL(gcireq,
- ErtsGCInfoReq,
- 5,
- ERTS_ALC_T_GC_INFO_REQ)
-#else
-static ERTS_INLINE ErtsGCInfoReq *
-gcireq_alloc(void)
-{
- return erts_alloc(ERTS_ALC_T_GC_INFO_REQ,
- sizeof(ErtsGCInfoReq));
-}
-
-static ERTS_INLINE void
-gcireq_free(ErtsGCInfoReq *ptr)
-{
- erts_free(ERTS_ALC_T_GC_INFO_REQ, ptr);
-}
-#endif
-
+ ErtsGCInfoReq,
+ 5,
+ ERTS_ALC_T_GC_INFO_REQ)
/*
* Initialize GC global data.
*/
@@ -208,7 +192,7 @@ erts_init_gc(void)
}
- /* for 32 bit we want max_heap_size to be MAX(32bit) / 4 [words] (and halfword)
+ /* for 32 bit we want max_heap_size to be MAX(32bit) / 4 [words]
* for 64 bit we want max_heap_size to be MAX(52bit) / 8 [words]
*/
@@ -232,10 +216,7 @@ erts_init_gc(void)
init_gc_info(&esdp->gc_info);
}
-#if !HALFWORD_HEAP
init_gcireq_alloc();
-#endif
-
}
/*
@@ -867,7 +848,6 @@ minor_collection(Process* p, int need, Eterm* objv, int nobj, Uint *recl)
if (OLD_HEAP(p) &&
((mature <= OLD_HEND(p) - OLD_HTOP(p)) &&
- ((BIN_VHEAP_MATURE(p) < ( BIN_OLD_VHEAP_SZ(p) - BIN_OLD_VHEAP(p)))) &&
((BIN_OLD_VHEAP_SZ(p) > BIN_OLD_VHEAP(p))) ) ) {
ErlMessage *msgp;
Uint size_after;
@@ -1681,7 +1661,7 @@ disallow_heap_frag_ref_in_old_heap(Process* p)
val = *hp++;
switch (primary_tag(val)) {
case TAG_PRIMARY_BOXED:
- ptr = (Eterm *) EXPAND_POINTER(val);
+ ptr = (Eterm *) val;
if (!in_area(ptr, old_heap, old_heap_size)) {
if (in_area(ptr, new_heap, new_heap_size)) {
abort();
@@ -1694,7 +1674,7 @@ disallow_heap_frag_ref_in_old_heap(Process* p)
}
break;
case TAG_PRIMARY_LIST:
- ptr = (Eterm *) EXPAND_POINTER(val);
+ ptr = (Eterm *) val;
if (!in_area(ptr, old_heap, old_heap_size)) {
if (in_area(ptr, new_heap, new_heap_size)) {
abort();
@@ -2392,7 +2372,6 @@ sweep_off_heap(Process *p, int fullsweep)
}
BIN_VHEAP_SZ(p) = next_vheap_size(p, bin_vheap, BIN_VHEAP_SZ(p));
MSO(p).overhead = bin_vheap;
- BIN_VHEAP_MATURE(p) = bin_vheap;
/*
* If we got any shrink candidates, check them out.
diff --git a/erts/emulator/beam/erl_init.c b/erts/emulator/beam/erl_init.c
index d9c3b0dcf4..5c209a4af2 100644
--- a/erts/emulator/beam/erl_init.c
+++ b/erts/emulator/beam/erl_init.c
@@ -91,11 +91,6 @@ const int etp_arch_bits = 32;
#else
# error "Not 64-bit, nor 32-bit arch"
#endif
-#if HALFWORD_HEAP
-const int etp_halfword = 1;
-#else
-const int etp_halfword = 0;
-#endif
#ifdef HIPE
const int etp_hipe = 1;
#else
diff --git a/erts/emulator/beam/erl_lock_check.c b/erts/emulator/beam/erl_lock_check.c
index 3b3b247020..84bee976ff 100644
--- a/erts/emulator/beam/erl_lock_check.c
+++ b/erts/emulator/beam/erl_lock_check.c
@@ -156,9 +156,6 @@ static erts_lc_lock_order_t erts_lock_order[] = {
{ "instr", NULL },
{ "alcu_allocator", "index" },
{ "mseg", NULL },
-#if HALFWORD_HEAP
- { "pmmap", NULL },
-#endif
#ifdef ERTS_SMP
{ "port_task_pre_alloc_lock", "address" },
{ "proclist_pre_alloc_lock", "address" },
diff --git a/erts/emulator/beam/erl_map.c b/erts/emulator/beam/erl_map.c
index ff2a355309..29b3024644 100644
--- a/erts/emulator/beam/erl_map.c
+++ b/erts/emulator/beam/erl_map.c
@@ -172,26 +172,22 @@ BIF_RETTYPE maps_to_list_1(BIF_ALIST_1) {
*/
const Eterm *
-#if HALFWORD_HEAP
-erts_maps_get_rel(Eterm key, Eterm map, Eterm *map_base)
-#else
erts_maps_get(Eterm key, Eterm map)
-#endif
{
Uint32 hx;
- if (is_flatmap_rel(map, map_base)) {
+ if (is_flatmap(map)) {
Eterm *ks, *vs;
flatmap_t *mp;
Uint n, i;
- mp = (flatmap_t *)flatmap_val_rel(map, map_base);
+ mp = (flatmap_t *)flatmap_val(map);
n = flatmap_get_size(mp);
if (n == 0) {
return NULL;
}
- ks = (Eterm *)tuple_val_rel(mp->keys, map_base) + 1;
+ ks = (Eterm *)tuple_val(mp->keys) + 1;
vs = flatmap_get_values(mp);
if (is_immed(key)) {
@@ -203,16 +199,16 @@ erts_maps_get(Eterm key, Eterm map)
}
for (i = 0; i < n; i++) {
- if (eq_rel(ks[i], map_base, key, NULL)) {
+ if (EQ(ks[i], key)) {
return &vs[i];
}
}
return NULL;
}
- ASSERT(is_hashmap_rel(map, map_base));
+ ASSERT(is_hashmap(map));
hx = hashmap_make_hash(key);
- return erts_hashmap_get_rel(hx, key, map, map_base);
+ return erts_hashmap_get(hx, key, map);
}
BIF_RETTYPE maps_find_2(BIF_ALIST_2) {
@@ -1998,11 +1994,7 @@ Eterm* hashmap_iterator_prev(ErtsWStack* s) {
}
const Eterm *
-#if HALFWORD_HEAP
-erts_hashmap_get_rel(Uint32 hx, Eterm key, Eterm node, Eterm *map_base)
-#else
erts_hashmap_get(Uint32 hx, Eterm key, Eterm node)
-#endif
{
Eterm *ptr, hdr, *res;
Uint ix, lvl = 0;
@@ -2011,7 +2003,7 @@ erts_hashmap_get(Uint32 hx, Eterm key, Eterm node)
UseTmpHeapNoproc(2);
ASSERT(is_boxed(node));
- ptr = boxed_val_rel(node, map_base);
+ ptr = boxed_val(node);
hdr = *ptr;
ASSERT(is_header(hdr));
ASSERT(is_hashmap_header_head(hdr));
@@ -2032,15 +2024,15 @@ erts_hashmap_get(Uint32 hx, Eterm key, Eterm node)
node = ptr[ix+1];
if (is_list(node)) { /* LEAF NODE [K|V] */
- ptr = list_val_rel(node,map_base);
- res = eq_rel(CAR(ptr), map_base, key, NULL) ? &(CDR(ptr)) : NULL;
+ ptr = list_val(node);
+ res = EQ(CAR(ptr), key) ? &(CDR(ptr)) : NULL;
break;
}
hx = hashmap_shift_hash(th,hx,lvl,key);
ASSERT(is_boxed(node));
- ptr = boxed_val_rel(node, map_base);
+ ptr = boxed_val(node);
hdr = *ptr;
ASSERT(is_header(hdr));
ASSERT(!is_hashmap_header_head(hdr));
diff --git a/erts/emulator/beam/erl_map.h b/erts/emulator/beam/erl_map.h
index c391de3f11..be6f791a4e 100644
--- a/erts/emulator/beam/erl_map.h
+++ b/erts/emulator/beam/erl_map.h
@@ -57,7 +57,6 @@ typedef struct flatmap_s {
#define hashmap_size(x) (((hashmap_head_t*) hashmap_val(x))->size)
-#define hashmap_size_rel(RTERM, BASE) hashmap_size(rterm2wterm(RTERM, BASE))
#define hashmap_make_hash(Key) make_internal_hash(Key)
#define hashmap_restore_hash(Heap,Lvl,Key) \
@@ -104,23 +103,9 @@ Eterm erts_hashmap_from_array(ErtsHeapFactory*, Eterm *leafs, Uint n, int rejec
Eterm erts_hashmap_from_ks_and_vs_extra(Process *p, Eterm *ks, Eterm *vs, Uint n,
Eterm k, Eterm v);
-const Eterm *
-#if HALFWORD_HEAP
-erts_maps_get_rel(Eterm key, Eterm map, Eterm *map_base);
-# define erts_maps_get(A, B) erts_maps_get_rel(A, B, NULL)
-#else
-erts_maps_get(Eterm key, Eterm map);
-# define erts_maps_get_rel(A, B, B_BASE) erts_maps_get(A, B)
-#endif
+const Eterm *erts_maps_get(Eterm key, Eterm map);
-const Eterm *
-#if HALFWORD_HEAP
-erts_hashmap_get_rel(Uint32 hx, Eterm key, Eterm node, Eterm *map_base);
-# define erts_hashmap_get(Hx, K, M) erts_hashmap_get_rel(Hx, K, M, NULL)
-#else
-erts_hashmap_get(Uint32 hx, Eterm key, Eterm map);
-# define erts_hashmap_get_rel(Hx, K, M, M_BASE) erts_hashmap_get(Hx, K, M)
-#endif
+const Eterm *erts_hashmap_get(Uint32 hx, Eterm key, Eterm map);
/* hamt nodes v2.0
*
diff --git a/erts/emulator/beam/erl_message.h b/erts/emulator/beam/erl_message.h
index fbdf3fb0e2..f37b430d27 100644
--- a/erts/emulator/beam/erl_message.h
+++ b/erts/emulator/beam/erl_message.h
@@ -32,9 +32,6 @@ struct external_thing_;
struct erl_off_heap_header {
Eterm thing_word;
Uint size;
-#if HALFWORD_HEAP
- void* dummy_ptr_padding__;
-#endif
struct erl_off_heap_header* next;
};
diff --git a/erts/emulator/beam/erl_nif.h b/erts/emulator/beam/erl_nif.h
index 7d880126f8..5da6bb877a 100644
--- a/erts/emulator/beam/erl_nif.h
+++ b/erts/emulator/beam/erl_nif.h
@@ -86,10 +86,6 @@
# define SIZEOF_LONG_LONG_SAVED__ SIZEOF_LONG_LONG
# undef SIZEOF_LONG_LONG
#endif
-#ifdef HALFWORD_HEAP_EMULATOR
-# define HALFWORD_HEAP_EMULATOR_SAVED__ HALFWORD_HEAP_EMULATOR
-# undef HALFWORD_HEAP_EMULATOR
-#endif
#include "erl_int_sizes_config.h"
#ifdef __cplusplus
@@ -109,16 +105,11 @@ typedef long long ErlNifSInt64;
#error No 64-bit integer type
#endif
-#ifdef HALFWORD_HEAP_EMULATOR
-# define ERL_NIF_VM_VARIANT "beam.halfword"
-typedef unsigned int ERL_NIF_TERM;
-#else
-# define ERL_NIF_VM_VARIANT "beam.vanilla"
-# if SIZEOF_LONG == SIZEOF_VOID_P
+#define ERL_NIF_VM_VARIANT "beam.vanilla"
+#if SIZEOF_LONG == SIZEOF_VOID_P
typedef unsigned long ERL_NIF_TERM;
-# elif SIZEOF_LONG_LONG == SIZEOF_VOID_P
+#elif SIZEOF_LONG_LONG == SIZEOF_VOID_P
typedef unsigned long long ERL_NIF_TERM;
-# endif
#endif
typedef ERL_NIF_TERM ERL_NIF_UINT;
diff --git a/erts/emulator/beam/erl_nif_api_funcs.h b/erts/emulator/beam/erl_nif_api_funcs.h
index f93152c921..2f2180e1aa 100644
--- a/erts/emulator/beam/erl_nif_api_funcs.h
+++ b/erts/emulator/beam/erl_nif_api_funcs.h
@@ -543,7 +543,7 @@ static ERL_NIF_INLINE ERL_NIF_TERM enif_make_list9(ErlNifEnv* env,
#ifndef enif_make_pid
-# define enif_make_pid(ENV, PID) ((const ERL_NIF_TERM)((PID)->pid))
+# define enif_make_pid(ENV, PID) ((void)(ENV),(const ERL_NIF_TERM)((PID)->pid))
#if SIZEOF_LONG == 8
# define enif_get_int64 enif_get_long
diff --git a/erts/emulator/beam/erl_node_container_utils.h b/erts/emulator/beam/erl_node_container_utils.h
index 211b1a0090..b6a3531e28 100644
--- a/erts/emulator/beam/erl_node_container_utils.h
+++ b/erts/emulator/beam/erl_node_container_utils.h
@@ -255,7 +255,7 @@ extern ErtsPTab erts_port;
* Refs *
\* */
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
#define internal_ref_no_of_numbers(x) \
(internal_ref_data((x))[0])
@@ -328,8 +328,6 @@ extern ErtsPTab erts_port;
: external_ref_channel_no((x)))
#define is_ref(x) (is_internal_ref((x)) \
|| is_external_ref((x)))
-#define is_ref_rel(x,Base) (is_internal_ref_rel((x),Base) \
- || is_external_ref_rel((x),Base))
#define is_not_ref(x) (!is_ref(x))
#endif
diff --git a/erts/emulator/beam/erl_node_tables.c b/erts/emulator/beam/erl_node_tables.c
index 2fb790b953..62a44f7129 100644
--- a/erts/emulator/beam/erl_node_tables.c
+++ b/erts/emulator/beam/erl_node_tables.c
@@ -1207,23 +1207,11 @@ insert_offheap(ErlOffHeap *oh, int type, Eterm id)
break;
}
if (insert_bin) {
-#if HALFWORD_HEAP
- UWord val = (UWord) u.pb->val;
- DeclareTmpHeapNoproc(id_heap,BIG_UINT_HEAP_SIZE*2); /* extra place allocated */
-#else
DeclareTmpHeapNoproc(id_heap,BIG_UINT_HEAP_SIZE);
-#endif
Uint *hp = &id_heap[0];
InsertedBin *nib;
-#if HALFWORD_HEAP
- int actual_need = BIG_UWORD_HEAP_SIZE(val);
- ASSERT(actual_need <= (BIG_UINT_HEAP_SIZE*2));
- UseTmpHeapNoproc(actual_need);
- a.id = erts_bld_uword(&hp, NULL, (UWord) val);
-#else
UseTmpHeapNoproc(BIG_UINT_HEAP_SIZE);
a.id = erts_bld_uint(&hp, NULL, (Uint) u.pb->val);
-#endif
erts_match_prog_foreach_offheap(u.pb->val,
insert_offheap2,
(void *) &a);
@@ -1231,11 +1219,7 @@ insert_offheap(ErlOffHeap *oh, int type, Eterm id)
nib->bin_val = u.pb->val;
nib->next = inserted_bins;
inserted_bins = nib;
-#if HALFWORD_HEAP
- UnUseTmpHeapNoproc(actual_need);
-#else
UnUseTmpHeapNoproc(BIG_UINT_HEAP_SIZE);
-#endif
}
}
break;
diff --git a/erts/emulator/beam/erl_node_tables.h b/erts/emulator/beam/erl_node_tables.h
index 694ac84232..64278d2ea0 100644
--- a/erts/emulator/beam/erl_node_tables.h
+++ b/erts/emulator/beam/erl_node_tables.h
@@ -66,7 +66,7 @@
#define ERTS_DE_QFLGS_ALL (ERTS_DE_QFLG_BUSY \
| ERTS_DE_QFLG_EXIT)
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
#define ERTS_DIST_OUTPUT_BUF_DBG_PATTERN ((Uint) 0xf713f713f713f713UL)
#else
#define ERTS_DIST_OUTPUT_BUF_DBG_PATTERN ((Uint) 0xf713f713)
diff --git a/erts/emulator/beam/erl_port_task.c b/erts/emulator/beam/erl_port_task.c
index 5c38db1cbc..2c09834d19 100644
--- a/erts/emulator/beam/erl_port_task.c
+++ b/erts/emulator/beam/erl_port_task.c
@@ -1734,7 +1734,7 @@ erts_port_task_execute(ErtsRunQueue *runq, Port **curr_port_pp)
reds = ERTS_PORT_REDS_INPUT;
ASSERT((state & ERTS_PORT_SFLGS_DEAD) == 0);
DTRACE_DRIVER(driver_ready_input, pp);
- /* NOTE some windows/ose drivers use ->ready_input
+ /* NOTE some windows drivers use ->ready_input
for input and output */
(*pp->drv_ptr->ready_input)((ErlDrvData) pp->drv_data,
ptp->u.alive.td.io.event);
diff --git a/erts/emulator/beam/erl_printf_term.c b/erts/emulator/beam/erl_printf_term.c
index 2917d58932..45ba4371dc 100644
--- a/erts/emulator/beam/erl_printf_term.c
+++ b/erts/emulator/beam/erl_printf_term.c
@@ -117,13 +117,12 @@ do { \
/* return 0 if list is not a non-empty flat list of printable characters */
static int
-is_printable_string(Eterm list, Eterm* base)
-{
+is_printable_string(Eterm list) {
int len = 0;
int c;
while(is_list(list)) {
- Eterm* consp = list_val_rel(list, base);
+ Eterm* consp = list_val(list);
Eterm hd = CAR(consp);
if (!is_byte(hd))
@@ -260,9 +259,7 @@ static char *format_binary(Uint16 x, char *b) {
#endif
static int
-print_term(fmtfn_t fn, void* arg, Eterm obj, long *dcount,
- Eterm* obj_base) /* ignored if !HALFWORD_HEAP */
-{
+print_term(fmtfn_t fn, void* arg, Eterm obj, long *dcount) {
DECLARE_WSTACK(s);
int res;
int i;
@@ -308,7 +305,7 @@ print_term(fmtfn_t fn, void* arg, Eterm obj, long *dcount,
obj = (Eterm) popped.word;
L_print_one_cons:
{
- Eterm* cons = list_val_rel(obj, obj_base);
+ Eterm* cons = list_val(obj);
Eterm tl;
obj = CAR(cons);
@@ -344,11 +341,7 @@ print_term(fmtfn_t fn, void* arg, Eterm obj, long *dcount,
PRINT_CHAR(res, fn, arg, '>');
goto L_done;
}
-#if HALFWORD_HEAP
- wobj = is_immed(obj) ? (Wterm)obj : rterm2wterm(obj, obj_base);
-#else
wobj = (Wterm)obj;
-#endif
switch (tag_val_def(wobj)) {
case NIL_DEF:
PRINT_STRING(res, fn, arg, "[]");
@@ -424,10 +417,10 @@ print_term(fmtfn_t fn, void* arg, Eterm obj, long *dcount,
PRINT_CHAR(res, fn, arg, '>');
break;
case LIST_DEF:
- if (is_printable_string(obj, obj_base)) {
+ if (is_printable_string(obj)) {
int c;
PRINT_CHAR(res, fn, arg, '"');
- nobj = list_val_rel(obj, obj_base);
+ nobj = list_val(obj);
while (1) {
if ((*dcount)-- <= 0)
goto L_done;
@@ -441,7 +434,7 @@ print_term(fmtfn_t fn, void* arg, Eterm obj, long *dcount,
}
if (is_not_list(*nobj))
break;
- nobj = list_val_rel(*nobj, obj_base);
+ nobj = list_val(*nobj);
}
PRINT_CHAR(res, fn, arg, '"');
} else {
@@ -469,11 +462,11 @@ print_term(fmtfn_t fn, void* arg, Eterm obj, long *dcount,
case BINARY_DEF:
{
byte* bytep;
- Uint bytesize = binary_size_rel(obj,obj_base);
+ Uint bytesize = binary_size(obj);
Uint bitoffs;
Uint bitsize;
byte octet;
- ERTS_GET_BINARY_BYTES_REL(obj, bytep, bitoffs, bitsize, obj_base);
+ ERTS_GET_BINARY_BYTES(obj, bytep, bitoffs, bitsize);
if (bitsize || !bytesize
|| !is_printable_ascii(bytep, bytesize, bitoffs)) {
@@ -648,13 +641,11 @@ print_term(fmtfn_t fn, void* arg, Eterm obj, long *dcount,
int
-erts_printf_term(fmtfn_t fn, void* arg, ErlPfEterm term, long precision,
- ErlPfEterm* term_base)
-{
+erts_printf_term(fmtfn_t fn, void* arg, ErlPfEterm term, long precision) {
int res;
ERTS_CT_ASSERT(sizeof(ErlPfEterm) == sizeof(Eterm));
- res = print_term(fn, arg, (Eterm)term, &precision, (Eterm*)term_base);
+ res = print_term(fn, arg, (Eterm)term, &precision);
if (res < 0)
return res;
if (precision <= 0)
diff --git a/erts/emulator/beam/erl_printf_term.h b/erts/emulator/beam/erl_printf_term.h
index 87618a36d7..4618457f27 100644
--- a/erts/emulator/beam/erl_printf_term.h
+++ b/erts/emulator/beam/erl_printf_term.h
@@ -22,6 +22,5 @@
#define ERL_PRINTF_TERM_H__
#include "erl_printf_format.h"
-int erts_printf_term(fmtfn_t fn, void* arg, ErlPfEterm term, long precision,
- ErlPfEterm* term_base);
+int erts_printf_term(fmtfn_t fn, void* arg, ErlPfEterm term, long precision);
#endif
diff --git a/erts/emulator/beam/erl_process.c b/erts/emulator/beam/erl_process.c
index 7135c0475e..15a6d5d651 100644
--- a/erts/emulator/beam/erl_process.c
+++ b/erts/emulator/beam/erl_process.c
@@ -58,11 +58,7 @@
#define ERTS_PROC_MIN_CONTEXT_SWITCH_REDS_COST (CONTEXT_REDS/10)
-#ifndef ERTS_SCHED_MIN_SPIN
#define ERTS_SCHED_SPIN_UNTIL_YIELD 100
-#else
-#define ERTS_SCHED_SPIN_UNTIL_YIELD 1
-#endif
#define ERTS_SCHED_SYS_SLEEP_SPINCOUNT_VERY_LONG 40
#define ERTS_SCHED_AUX_WORK_SLEEP_SPINCOUNT_FACT_VERY_LONG 1000
@@ -119,7 +115,7 @@
#define RUNQ_SET_RQ(X, RQ) erts_smp_atomic_set_nob((X), (erts_aint_t) (RQ))
#ifdef DEBUG
-# if defined(ARCH_64) && !HALFWORD_HEAP
+# if defined(ARCH_64)
# define ERTS_DBG_SET_INVALID_RUNQP(RQP, N) \
(RUNQ_SET_RQ((RQP), (0xdeadbeefdead0003LL | ((N) << 4)))
# define ERTS_DBG_VERIFY_VALID_RUNQP(RQP) \
@@ -152,12 +148,7 @@ extern BeamInstr beam_apply[];
extern BeamInstr beam_exit[];
extern BeamInstr beam_continue_exit[];
-#ifdef __OSE__
-/* Eager check I/O not supported on OSE yet. */
-int erts_eager_check_io = 0;
-#else
int erts_eager_check_io = 1;
-#endif
int erts_sched_compact_load;
int erts_sched_balance_util = 0;
Uint erts_no_schedulers;
@@ -971,25 +962,10 @@ typedef struct {
erts_smp_atomic32_t refc;
} ErtsSchedWallTimeReq;
-#if !HALFWORD_HEAP
ERTS_SCHED_PREF_QUICK_ALLOC_IMPL(swtreq,
- ErtsSchedWallTimeReq,
- 5,
- ERTS_ALC_T_SCHED_WTIME_REQ)
-#else
-static ERTS_INLINE ErtsSchedWallTimeReq *
-swtreq_alloc(void)
-{
- return erts_alloc(ERTS_ALC_T_SCHED_WTIME_REQ,
- sizeof(ErtsSchedWallTimeReq));
-}
-
-static ERTS_INLINE void
-swtreq_free(ErtsSchedWallTimeReq *ptr)
-{
- erts_free(ERTS_ALC_T_SCHED_WTIME_REQ, ptr);
-}
-#endif
+ ErtsSchedWallTimeReq,
+ 5,
+ ERTS_ALC_T_SCHED_WTIME_REQ)
static void
reply_sched_wall_time(void *vswtrp)
@@ -2536,19 +2512,10 @@ try_set_sys_scheduling(void)
#endif
static ERTS_INLINE int
-prepare_for_sys_schedule(ErtsSchedulerData *esdp, int non_blocking)
+prepare_for_sys_schedule(int non_blocking)
{
if (non_blocking && erts_eager_check_io) {
#ifdef ERTS_SMP
-#ifdef ERTS_SCHED_ONLY_POLL_SCHED_1
- if (esdp->no != 1) {
- /* If we are not scheduler 1 and ERTS_SCHED_ONLY_POLL_SCHED_1 is used
- then we make sure to wake scheduler 1 */
- ErtsRunQueue *rq = ERTS_RUNQ_IX(0);
- wake_scheduler(rq);
- return 0;
- }
-#endif
return try_set_sys_scheduling();
#else
return 1;
@@ -2558,16 +2525,6 @@ prepare_for_sys_schedule(ErtsSchedulerData *esdp, int non_blocking)
#ifdef ERTS_SMP
while (!erts_port_task_have_outstanding_io_tasks()
&& try_set_sys_scheduling()) {
-#ifdef ERTS_SCHED_ONLY_POLL_SCHED_1
- if (esdp->no != 1) {
- /* If we are not scheduler 1 and ERTS_SCHED_ONLY_POLL_SCHED_1 is used
- then we make sure to wake scheduler 1 */
- ErtsRunQueue *rq = ERTS_RUNQ_IX(0);
- clear_sys_scheduling();
- wake_scheduler(rq);
- return 0;
- }
-#endif
if (!erts_port_task_have_outstanding_io_tasks())
return 1;
clear_sys_scheduling();
@@ -2891,8 +2848,6 @@ aux_thread(void *unused)
erts_thr_progress_active(NULL, thr_prgr_active = 0);
erts_thr_progress_prepare_wait(NULL);
- ERTS_SCHED_FAIR_YIELD();
-
flgs = sched_spin_wait(ssi, 0);
if (flgs & ERTS_SSI_FLG_SLEEPING) {
@@ -2960,7 +2915,7 @@ scheduler_wait(int *fcalls, ErtsSchedulerData *esdp, ErtsRunQueue *rq)
* be waiting in erl_sys_schedule()
*/
- if (ERTS_SCHEDULER_IS_DIRTY(esdp) || !prepare_for_sys_schedule(esdp, 0)) {
+ if (ERTS_SCHEDULER_IS_DIRTY(esdp) || !prepare_for_sys_schedule(0)) {
sched_waiting(esdp->no, rq);
@@ -3025,8 +2980,6 @@ scheduler_wait(int *fcalls, ErtsSchedulerData *esdp, ErtsRunQueue *rq)
erts_thr_progress_prepare_wait(esdp);
}
- ERTS_SCHED_FAIR_YIELD();
-
flgs = sched_spin_wait(ssi, spincount);
if (flgs & ERTS_SSI_FLG_SLEEPING) {
ASSERT(flgs & ERTS_SSI_FLG_WAITING);
@@ -3097,13 +3050,8 @@ scheduler_wait(int *fcalls, ErtsSchedulerData *esdp, ErtsRunQueue *rq)
#ifdef ERTS_DIRTY_SCHEDULERS
ASSERT(!ERTS_SCHEDULER_IS_DIRTY(esdp));
#endif
-
-#ifdef ERTS_SCHED_ONLY_POLL_SCHED_1
- ASSERT(esdp->no == 1);
-#endif
sched_waiting_sys(esdp->no, rq);
-
erts_smp_runq_unlock(rq);
ASSERT(working);
@@ -3173,7 +3121,7 @@ scheduler_wait(int *fcalls, ErtsSchedulerData *esdp, ErtsRunQueue *rq)
* Got to check that we still got I/O tasks; otherwise
* we have to continue checking for I/O...
*/
- if (!prepare_for_sys_schedule(esdp, 0)) {
+ if (!prepare_for_sys_schedule(0)) {
spincount *= ERTS_SCHED_TSE_SLEEP_SPINCOUNT_FACT;
goto tse_wait;
}
@@ -3195,7 +3143,7 @@ scheduler_wait(int *fcalls, ErtsSchedulerData *esdp, ErtsRunQueue *rq)
* Got to check that we still got I/O tasks; otherwise
* we have to wait in erl_sys_schedule() after all...
*/
- if (!prepare_for_sys_schedule(esdp, 0)) {
+ if (!prepare_for_sys_schedule(0)) {
/*
* Not allowed to wait in erl_sys_schedule;
* do tse wait instead...
@@ -5316,17 +5264,11 @@ erts_early_init_scheduling(int no_schedulers)
wakeup_other.threshold = ERTS_SCHED_WAKEUP_OTHER_THRESHOLD_MEDIUM;
wakeup_other.type = ERTS_SCHED_WAKEUP_OTHER_TYPE_DEFAULT;
#endif
-#ifndef ERTS_SCHED_MIN_SPIN
sched_busy_wait.sys_schedule = ERTS_SCHED_SYS_SLEEP_SPINCOUNT_MEDIUM;
sched_busy_wait.tse = (ERTS_SCHED_SYS_SLEEP_SPINCOUNT_MEDIUM
* ERTS_SCHED_TSE_SLEEP_SPINCOUNT_FACT);
sched_busy_wait.aux_work = (ERTS_SCHED_SYS_SLEEP_SPINCOUNT_MEDIUM
* ERTS_SCHED_AUX_WORK_SLEEP_SPINCOUNT_FACT_MEDIUM);
-#else
- sched_busy_wait.sys_schedule = ERTS_SCHED_SYS_SLEEP_SPINCOUNT_NONE;
- sched_busy_wait.tse = ERTS_SCHED_SYS_SLEEP_SPINCOUNT_NONE;
- sched_busy_wait.aux_work = ERTS_SCHED_SYS_SLEEP_SPINCOUNT_NONE;
-#endif
}
int
@@ -5510,9 +5452,6 @@ init_scheduler_data(ErtsSchedulerData* esdp, int num,
esdp->f_reg_array =
erts_alloc_permanent_cache_aligned(ERTS_ALC_T_BEAM_REGISTER,
MAX_REG * sizeof(FloatDef));
-#if !HEAP_ON_C_STACK
- esdp->num_tmp_heap_used = 0;
-#endif
#ifdef ERTS_DIRTY_SCHEDULERS
if (ERTS_RUNQ_IX_IS_DIRTY(runq->ix)) {
esdp->no = 0;
@@ -5797,9 +5736,7 @@ erts_init_scheduling(int no_schedulers, int no_schedulers_online
#endif
init_misc_aux_work();
-#if !HALFWORD_HEAP
init_swtreq_alloc();
-#endif
erts_atomic32_init_nob(&debug_wait_completed_count, 0); /* debug only */
debug_wait_completed_flags = 0;
@@ -7938,11 +7875,16 @@ sched_thread_func(void *vesdp)
ErtsThrPrgrCallbacks callbacks;
ErtsSchedulerData *esdp = vesdp;
Uint no = esdp->no;
+#ifdef ERTS_SMP
+ erts_tse_t *tse;
+#endif
erts_sched_init_time_sup(esdp);
#ifdef ERTS_SMP
- ERTS_SCHED_SLEEP_INFO_IX(no - 1)->event = erts_tse_fetch();
+ tse = erts_tse_fetch();
+ erts_tse_prepare_timed(tse);
+ ERTS_SCHED_SLEEP_INFO_IX(no - 1)->event = tse;
callbacks.arg = (void *) esdp->ssi;
callbacks.wakeup = thr_prgr_wakeup;
callbacks.prepare_wait = thr_prgr_prep_wait;
@@ -8204,18 +8146,12 @@ erts_start_schedulers(void)
erts_snprintf(opts.name, 16, "%lu_scheduler", actual + 1);
-#ifdef __OSE__
- /* This should be done in the bind strategy */
- opts.coreNo = (actual+1) % ose_num_cpus();
-#endif
-
res = ethr_thr_create(&esdp->tid, sched_thread_func, (void*)esdp, &opts);
if (res != 0) {
break;
}
}
-
erts_no_schedulers = actual;
#ifdef ERTS_DIRTY_SCHEDULERS
@@ -8244,10 +8180,6 @@ erts_start_schedulers(void)
erts_snprintf(opts.name, 16, "aux");
-#ifdef __OSE__
- opts.coreNo = 0;
-#endif /* __OSE__ */
-
res = ethr_thr_create(&aux_tid, aux_thread, NULL, &opts);
if (res != 0)
erl_exit(1, "Failed to create aux thread\n");
@@ -8267,7 +8199,6 @@ erts_start_schedulers(void)
actual, actual == 1 ? " was" : "s were");
erts_send_error_to_logger_nogl(dsbufp);
}
-
}
#endif /* ERTS_SMP */
@@ -8286,7 +8217,7 @@ add_pend_suspend(Process *suspendee,
sizeof(ErtsPendingSuspend));
psp->next = NULL;
#ifdef DEBUG
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
psp->end = (ErtsPendingSuspend *) 0xdeaddeaddeaddead;
#else
psp->end = (ErtsPendingSuspend *) 0xdeaddead;
@@ -9412,12 +9343,10 @@ Process *schedule(Process *p, int calls)
int leader_update = ERTS_SCHEDULER_IS_DIRTY(esdp) ? 0
: erts_thr_progress_update(esdp);
aux_work = erts_atomic32_read_acqb(&esdp->ssi->aux_work);
- if (aux_work | leader_update | ERTS_SCHED_FAIR) {
+ if (aux_work | leader_update) {
erts_smp_runq_unlock(rq);
if (leader_update)
erts_thr_progress_leader_update(esdp);
- else if (ERTS_SCHED_FAIR)
- ERTS_SCHED_FAIR_YIELD();
if (aux_work)
handle_aux_work(&esdp->aux_work_data, aux_work, 0);
erts_smp_runq_lock(rq);
@@ -9493,7 +9422,7 @@ Process *schedule(Process *p, int calls)
}
else if (!ERTS_SCHEDULER_IS_DIRTY(esdp) &&
(fcalls > input_reductions &&
- prepare_for_sys_schedule(esdp, !0))) {
+ prepare_for_sys_schedule(!0))) {
ErtsMonotonicTime current_time;
/*
* Schedule system-level activities.
@@ -10905,7 +10834,6 @@ erl_create_process(Process* parent, /* Parent of process (default group leader).
p->bin_vheap_sz = p->min_vheap_size;
p->bin_old_vheap_sz = p->min_vheap_size;
p->bin_old_vheap = 0;
- p->bin_vheap_mature = 0;
p->sys_task_qs = NULL;
@@ -11125,7 +11053,6 @@ void erts_init_empty_process(Process *p)
p->bin_old_vheap_sz = BIN_VH_MIN_SIZE;
p->bin_old_vheap = 0;
p->sys_task_qs = NULL;
- p->bin_vheap_mature = 0;
ERTS_PTMR_INIT(p);
p->next = NULL;
p->off_heap.first = NULL;
@@ -12542,7 +12469,7 @@ stack_element_dump(int to, void *to_arg, Eterm* sp, int yreg)
}
if (is_CP(x)) {
- erts_print(to, to_arg, "Return addr %p (", (Eterm *) EXPAND_POINTER(x));
+ erts_print(to, to_arg, "Return addr %p (", (Eterm *) x);
print_function_from_pc(to, to_arg, cp_val(x));
erts_print(to, to_arg, ")\n");
yreg = 0;
diff --git a/erts/emulator/beam/erl_process.h b/erts/emulator/beam/erl_process.h
index 20ffe7ea7c..e7c5614b9c 100644
--- a/erts/emulator/beam/erl_process.h
+++ b/erts/emulator/beam/erl_process.h
@@ -632,12 +632,6 @@ struct ErtsSchedulerData_ {
Process *free_process;
ErtsThrPrgrData thr_progress_data;
#endif
-#if !HEAP_ON_C_STACK
- Eterm tmp_heap[TMP_HEAP_SIZE];
- int num_tmp_heap_used;
- Eterm beam_emu_tmp_heap[BEAM_EMU_TMP_HEAP_SIZE];
- Eterm erl_arith_tmp_heap[ERL_ARITH_TMP_HEAP_SIZE];
-#endif
ErtsSchedulerSleepInfo *ssi;
Process *current_process;
Uint no; /* Scheduler number for normal schedulers */
@@ -691,13 +685,6 @@ extern ErtsAlignedSchedulerData *erts_aligned_dirty_io_scheduler_data;
extern ErtsSchedulerData *erts_scheduler_data;
#endif
-#ifdef ERTS_SCHED_FAIR
-#define ERTS_SCHED_FAIR_YIELD() ETHR_YIELD()
-#else
-#define ERTS_SCHED_FAIR 0
-#define ERTS_SCHED_FAIR_YIELD()
-#endif
-
#if defined(ERTS_SMP) && defined(ERTS_ENABLE_LOCK_CHECK)
int erts_smp_lc_runq_is_locked(ErtsRunQueue *);
#endif
@@ -911,7 +898,6 @@ struct ErtsPendingSuspend_ {
# define MIN_VHEAP_SIZE(p) (p)->min_vheap_size
# define BIN_VHEAP_SZ(p) (p)->bin_vheap_sz
-# define BIN_VHEAP_MATURE(p) (p)->bin_vheap_mature
# define BIN_OLD_VHEAP_SZ(p) (p)->bin_old_vheap_sz
# define BIN_OLD_VHEAP(p) (p)->bin_old_vheap
@@ -1030,7 +1016,6 @@ struct process {
ErtsPSD *psd; /* Rarely used process specific data */
Uint64 bin_vheap_sz; /* Virtual heap block size for binaries */
- Uint64 bin_vheap_mature; /* Virtual heap block size for binaries */
Uint64 bin_old_vheap_sz; /* Virtual old heap block size for binaries */
Uint64 bin_old_vheap; /* Virtual old heap size for binaries */
diff --git a/erts/emulator/beam/erl_process_dump.c b/erts/emulator/beam/erl_process_dump.c
index 25f0b1ed38..3b8ae11e94 100644
--- a/erts/emulator/beam/erl_process_dump.c
+++ b/erts/emulator/beam/erl_process_dump.c
@@ -365,7 +365,7 @@ heap_dump(int to, void *to_arg, Eterm x)
while (x != OUR_NIL) {
if (is_CP(x)) {
- next = (Eterm *) EXPAND_POINTER(x);
+ next = (Eterm *) x;
} else if (is_list(x)) {
ptr = list_val(x);
if (ptr[0] != OUR_NIL) {
@@ -378,7 +378,7 @@ heap_dump(int to, void *to_arg, Eterm x)
ptr[1] = make_small(0);
}
x = ptr[0];
- ptr[0] = (Eterm) COMPRESS_POINTER(next);
+ ptr[0] = (Eterm) next;
next = ptr + 1;
continue;
}
@@ -408,7 +408,7 @@ heap_dump(int to, void *to_arg, Eterm x)
ptr[0] = OUR_NIL;
} else {
x = ptr[arity];
- ptr[0] = (Eterm) COMPRESS_POINTER(next);
+ ptr[0] = (Eterm) next;
next = ptr + arity - 1;
continue;
}
diff --git a/erts/emulator/beam/erl_process_lock.h b/erts/emulator/beam/erl_process_lock.h
index 788348e613..a64c993e8f 100644
--- a/erts/emulator/beam/erl_process_lock.h
+++ b/erts/emulator/beam/erl_process_lock.h
@@ -854,9 +854,6 @@ ERTS_GLB_INLINE void erts_proc_dec_refc(Process *p)
#endif
if (!referred) {
ASSERT(ERTS_PROC_IS_EXITING(p));
- ASSERT(ERTS_AINT_NULL
- == erts_ptab_pix2intptr_ddrb(&erts_proc,
- internal_pid_index(p->common.id)));
erts_free_proc(p);
}
}
@@ -872,9 +869,6 @@ ERTS_GLB_INLINE void erts_proc_add_refc(Process *p, Sint add_refc)
#endif
if (!referred) {
ASSERT(ERTS_PROC_IS_EXITING(p));
- ASSERT(ERTS_AINT_NULL
- == erts_ptab_pix2intptr_ddrb(&erts_proc,
- internal_pid_index(p->common.id)));
erts_free_proc(p);
}
}
diff --git a/erts/emulator/beam/erl_term.c b/erts/emulator/beam/erl_term.c
index e5050bfaa5..ed302fa2fa 100644
--- a/erts/emulator/beam/erl_term.c
+++ b/erts/emulator/beam/erl_term.c
@@ -174,9 +174,7 @@ ET_DEFINE_CHECKED(Uint,external_thing_data_words,ExternalThing*,is_thing_ptr);
ET_DEFINE_CHECKED(Eterm,make_cp,UWord *,_is_taggable_pointer);
ET_DEFINE_CHECKED(UWord *,cp_val,Eterm,is_CP);
ET_DEFINE_CHECKED(Uint,catch_val,Eterm,is_catch);
-ET_DEFINE_CHECKED(Uint,x_reg_offset,Uint,_is_xreg);
-ET_DEFINE_CHECKED(Uint,y_reg_offset,Uint,_is_yreg);
-ET_DEFINE_CHECKED(Uint,x_reg_index,Uint,_is_xreg);
-ET_DEFINE_CHECKED(Uint,y_reg_index,Uint,_is_yreg);
+ET_DEFINE_CHECKED(Uint,loader_x_reg_index,Uint,_is_loader_x_reg);
+ET_DEFINE_CHECKED(Uint,loader_y_reg_index,Uint,_is_loader_y_reg);
#endif /* ET_DEBUG */
diff --git a/erts/emulator/beam/erl_term.h b/erts/emulator/beam/erl_term.h
index d5e91d80d9..01ef567dcd 100644
--- a/erts/emulator/beam/erl_term.h
+++ b/erts/emulator/beam/erl_term.h
@@ -21,34 +21,8 @@
#ifndef __ERL_TERM_H
#define __ERL_TERM_H
-#include "sys.h" /* defines HALFWORD_HEAP */
-
typedef UWord Wterm; /* Full word terms */
-#if HALFWORD_HEAP
-# define HEAP_ON_C_STACK 0
-# if HALFWORD_ASSERT
-# ifdef ET_DEBUG
-# undef ET_DEBUG
-# endif
-# define ET_DEBUG 1
-# endif
-# if 1
-# define CHECK_POINTER_MASK 0xFFFFFFFF00000000UL
-# define COMPRESS_POINTER(APointer) ((Eterm) (UWord) (APointer))
-# define EXPAND_POINTER(AnEterm) ((UWord) (AnEterm))
-# else
-# define CHECK_POINTER_MASK 0x0UL
-# define COMPRESS_POINTER(AnUint) (AnUint)
-# define EXPAND_POINTER(APointer) (APointer)
-# endif
-#else
-# define HEAP_ON_C_STACK 1
-# define CHECK_POINTER_MASK 0x0UL
-# define COMPRESS_POINTER(AnUint) (AnUint)
-# define EXPAND_POINTER(APointer) (APointer)
-#endif
-
struct erl_node_; /* Declared in erl_node_tables.h */
/*
@@ -190,15 +164,12 @@ struct erl_node_; /* Declared in erl_node_tables.h */
/* boxed object access methods */
-#if HALFWORD_HEAP
-#define _is_taggable_pointer(x) (((UWord)(x) & (CHECK_POINTER_MASK | 0x3)) == 0)
-#define _boxed_precond(x) (is_boxed(x))
-#else
+
#define _is_taggable_pointer(x) (((Uint)(x) & 0x3) == 0)
#define _boxed_precond(x) (is_boxed(x))
-#endif
+
#define _is_aligned(x) (((Uint)(x) & 0x3) == 0)
-#define _unchecked_make_boxed(x) ((Uint) COMPRESS_POINTER(x) + TAG_PRIMARY_BOXED)
+#define _unchecked_make_boxed(x) ((Uint)(x) + TAG_PRIMARY_BOXED)
_ET_DECLARE_CHECKED(Eterm,make_boxed,const Eterm*)
#define make_boxed(x) _ET_APPLY(make_boxed,(x))
#if 1
@@ -209,12 +180,12 @@ _ET_DECLARE_CHECKED(int,is_boxed,Eterm)
#else
#define is_boxed(x) (((x) & _TAG_PRIMARY_MASK) == TAG_PRIMARY_BOXED)
#endif
-#define _unchecked_boxed_val(x) ((Eterm*) EXPAND_POINTER(((x) - TAG_PRIMARY_BOXED)))
+#define _unchecked_boxed_val(x) ((Eterm*) ((x) - TAG_PRIMARY_BOXED))
_ET_DECLARE_CHECKED(Eterm*,boxed_val,Wterm)
#define boxed_val(x) _ET_APPLY(boxed_val,(x))
/* cons cell ("list") access methods */
-#define _unchecked_make_list(x) ((Uint) COMPRESS_POINTER(x) + TAG_PRIMARY_LIST)
+#define _unchecked_make_list(x) ((Uint)(x) + TAG_PRIMARY_LIST)
_ET_DECLARE_CHECKED(Eterm,make_list,const Eterm*)
#define make_list(x) _ET_APPLY(make_list,(x))
#if 1
@@ -226,12 +197,8 @@ _ET_DECLARE_CHECKED(int,is_not_list,Eterm)
#define is_list(x) (((x) & _TAG_PRIMARY_MASK) == TAG_PRIMARY_LIST)
#define is_not_list(x) (!is_list((x)))
#endif
-#if HALFWORD_HEAP
#define _list_precond(x) (is_list(x))
-#else
-#define _list_precond(x) (is_list(x))
-#endif
-#define _unchecked_list_val(x) ((Eterm*) EXPAND_POINTER((x) - TAG_PRIMARY_LIST))
+#define _unchecked_list_val(x) ((Eterm*) ((x) - TAG_PRIMARY_LIST))
_ET_DECLARE_CHECKED(Eterm*,list_val,Wterm)
#define list_val(x) _ET_APPLY(list_val,(x))
@@ -242,7 +209,7 @@ _ET_DECLARE_CHECKED(Eterm*,list_val,Wterm)
#define CDR(x) ((x)[1])
/* generic tagged pointer (boxed or list) access methods */
-#define _unchecked_ptr_val(x) ((Eterm*) EXPAND_POINTER((x) & ~((Uint) 0x3)))
+#define _unchecked_ptr_val(x) ((Eterm*) ((x) & ~((Uint) 0x3)))
#define ptr_val(x) _unchecked_ptr_val((x)) /*XXX*/
#define _unchecked_offset_ptr(x,offs) ((x)+((offs)*sizeof(Eterm)))
#define offset_ptr(x,offs) _unchecked_offset_ptr(x,offs) /*XXX*/
@@ -250,7 +217,7 @@ _ET_DECLARE_CHECKED(Eterm*,list_val,Wterm)
#define byte_offset_ptr(x,offs) _unchecked_byte_offset_ptr(x,offs) /*XXX*/
/* fixnum ("small") access methods */
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
#define SMALL_BITS (64-4)
#define SMALL_DIGITS (17)
#else
@@ -396,11 +363,7 @@ _ET_DECLARE_CHECKED(Eterm*,fun_val,Wterm)
_ET_DECLARE_CHECKED(Eterm*,export_val,Wterm)
#define export_val(x) _ET_APPLY(export_val,(x))
#define is_export_header(x) ((x) == HEADER_EXPORT)
-#if HALFWORD_HEAP
-#define HEADER_EXPORT _make_header(2,_TAG_HEADER_EXPORT)
-#else
#define HEADER_EXPORT _make_header(1,_TAG_HEADER_EXPORT)
-#endif
/* bignum access methods */
#define make_pos_bignum_header(sz) _make_header((sz),_TAG_HEADER_POS_BIG)
@@ -424,7 +387,7 @@ _ET_DECLARE_CHECKED(Eterm*,big_val,Wterm)
#define big_val(x) _ET_APPLY(big_val,(x))
/* flonum ("float") access methods */
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
#define HEADER_FLONUM _make_header(1,_TAG_HEADER_FLOAT)
#else
#define HEADER_FLONUM _make_header(2,_TAG_HEADER_FLOAT)
@@ -445,12 +408,12 @@ typedef union float_def
byte fb[sizeof(ieee754_8)];
Uint16 fs[sizeof(ieee754_8) / sizeof(Uint16)];
Uint32 fw[sizeof(ieee754_8) / sizeof(Uint32)];
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
Uint fdw;
#endif
} FloatDef;
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
#define FLOAT_VAL_GET_DOUBLE(fval, f) (f).fdw = *((fval)+1)
@@ -727,7 +690,7 @@ _ET_DECLARE_CHECKED(struct erl_node_*,internal_port_node,Eterm)
#define ERTS_MAX_REF_NUMBERS 3
#define ERTS_REF_NUMBERS ERTS_MAX_REF_NUMBERS
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
# define ERTS_REF_WORDS (ERTS_REF_NUMBERS/2 + 1)
# define ERTS_REF_32BIT_WORDS (ERTS_REF_NUMBERS+1)
#else
@@ -749,7 +712,7 @@ typedef struct {
#define make_ref_thing_header(DW) \
_make_header((DW)+REF_THING_HEAD_SIZE-1,_TAG_HEADER_REF)
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
/*
* Ref layout on a 64-bit little endian machine:
@@ -1009,27 +972,20 @@ _ET_DECLARE_CHECKED(struct erl_node_*,external_ref_node,Eterm)
#define MAP_HEADER_VAL(Hdr) (((Hdr) >> (_HEADER_ARITY_OFFS + MAP_HEADER_TAG_SZ + MAP_HEADER_ARITY_SZ)) & (0xffff))
#define make_hashmap(x) make_boxed((Eterm*)(x))
-#define make_hashmap_rel make_boxed_rel
#define is_hashmap(x) (is_boxed((x)) && is_hashmap_header(*boxed_val((x))))
#define is_not_hashmap(x) (!is_hashmap(x))
-#define is_hashmap_rel(RTERM,BASE) is_hashmap(rterm2wterm(RTERM,BASE))
#define is_hashmap_header(x) (((x) & (_HEADER_MAP_HASHMAP_HEAD_MASK)) == HAMT_SUBTAG_HEAD_ARRAY)
#define hashmap_val(x) _unchecked_boxed_val((x))
-#define hashmap_val_rel(RTERM, BASE) hashmap_val(rterm2wterm(RTERM, BASE))
#define make_flatmap(x) make_boxed((Eterm*)(x))
-#define make_flatmap_rel(x, BASE) make_boxed_rel((Eterm*)(x),(BASE))
#define is_flatmap(x) (is_boxed((x)) && is_flatmap_header(*boxed_val((x))))
-#define is_flatmap_rel(RTERM,BASE) is_flatmap(rterm2wterm(RTERM,BASE))
#define is_not_flatmap(x) (!is_flatmap((x)))
#define is_flatmap_header(x) (((x) & (_HEADER_MAP_SUBTAG_MASK)) == HAMT_SUBTAG_HEAD_FLATMAP)
#define flatmap_val(x) (_unchecked_boxed_val((x)))
-#define flatmap_val_rel(RTERM, BASE) flatmap_val(rterm2wterm(RTERM, BASE))
#define is_map_header(x) (((x) & (_TAG_HEADER_MASK)) == _TAG_HEADER_MAP)
#define is_map(x) (is_boxed((x)) && is_map_header(*boxed_val(x)))
#define is_not_map(x) (!is_map(x))
-#define is_map_rel(RTERM,BASE) is_map(rterm2wterm(RTERM,BASE))
/* number tests */
@@ -1048,14 +1004,14 @@ _ET_DECLARE_CHECKED(struct erl_node_*,external_ref_node,Eterm)
#error "fix yer arch, like"
#endif
-#define _unchecked_make_cp(x) ((Eterm) COMPRESS_POINTER(x))
+#define _unchecked_make_cp(x) ((Eterm)(x))
_ET_DECLARE_CHECKED(Eterm,make_cp,BeamInstr*)
#define make_cp(x) _ET_APPLY(make_cp,(x))
#define is_not_CP(x) ((x) & _CPMASK)
#define is_CP(x) (!is_not_CP(x))
-#define _unchecked_cp_val(x) ((BeamInstr*) EXPAND_POINTER(x))
+#define _unchecked_cp_val(x) ((BeamInstr*) (x))
_ET_DECLARE_CHECKED(BeamInstr*,cp_val,Eterm)
#define cp_val(x) _ET_APPLY(cp_val,(x))
@@ -1071,44 +1027,40 @@ _ET_DECLARE_CHECKED(Uint,catch_val,Eterm)
/*
* Overloaded tags.
*
- * SMALL = 15
- * ATOM/NIL=7
+ * In the loader, we want to tag a term in a way so that it can
+ * be any literal (atom/integer/float/tuple/list/binary) or a
+ * register.
*
- * Note that the two least significant bits in SMALL/ATOM/NIL always are 3;
- * thus, we can distinguish register from literals by looking at only these
- * two bits.
+ * We can achive that by overloading the PID and PORT tags to
+ * mean X and Y registers. That works because there are no
+ * pid or port literals.
*/
-#define X_REG_DEF 0
-#define Y_REG_DEF 1
-#define R_REG_DEF 2
-
-#define beam_reg_tag(x) ((x) & 3)
+#define _LOADER_TAG_XREG _TAG_IMMED1_PID
+#define _LOADER_TAG_YREG _TAG_IMMED1_PORT
+#define _LOADER_TAG_SIZE _TAG_IMMED1_SIZE
+#define _LOADER_MASK _TAG_IMMED1_MASK
-#define make_rreg() R_REG_DEF
-#define make_xreg(ix) (((ix) * sizeof(Eterm)) | X_REG_DEF)
-#define make_yreg(ix) (((ix) * sizeof(Eterm)) | Y_REG_DEF)
+#define LOADER_X_REG _LOADER_TAG_XREG
+#define LOADER_Y_REG _LOADER_TAG_YREG
-#define _is_xreg(x) (beam_reg_tag(x) == X_REG_DEF)
-#define _is_yreg(x) (beam_reg_tag(x) == Y_REG_DEF)
+#define make_loader_x_reg(R) (((R) << _LOADER_TAG_SIZE) | _LOADER_TAG_XREG)
+#define make_loader_y_reg(R) (((R) << _LOADER_TAG_SIZE) | _LOADER_TAG_YREG)
-#define _unchecked_x_reg_offset(R) ((R) - X_REG_DEF)
-_ET_DECLARE_CHECKED(Uint,x_reg_offset,Uint)
-#define x_reg_offset(R) _ET_APPLY(x_reg_offset,(R))
+#define loader_reg_index(R) ((R) >> _LOADER_TAG_SIZE)
-#define _unchecked_y_reg_offset(R) ((R) - Y_REG_DEF)
-_ET_DECLARE_CHECKED(Uint,y_reg_offset,Uint)
-#define y_reg_offset(R) _ET_APPLY(y_reg_offset,(R))
+#define loader_tag(T) ((T) & _LOADER_MASK)
-#define reg_index(R) ((R) / sizeof(Eterm))
+#define _is_loader_x_reg(x) (loader_tag(x) == _LOADER_TAG_XREG)
+#define _is_loader_y_reg(x) (loader_tag(x) == _LOADER_TAG_YREG)
-#define _unchecked_x_reg_index(R) ((R) >> 2)
-_ET_DECLARE_CHECKED(Uint,x_reg_index,Uint)
-#define x_reg_index(R) _ET_APPLY(x_reg_index,(R))
+#define _unchecked_loader_x_reg_index(R) ((R) >> _LOADER_TAG_SIZE)
+_ET_DECLARE_CHECKED(Uint,loader_x_reg_index,Uint)
+#define loader_x_reg_index(R) _ET_APPLY(loader_x_reg_index,(R))
-#define _unchecked_y_reg_index(R) ((R) >> 2)
-_ET_DECLARE_CHECKED(Uint,y_reg_index,Uint)
-#define y_reg_index(R) _ET_APPLY(y_reg_index,(R))
+#define _unchecked_loader_y_reg_index(R) ((R) >> _LOADER_TAG_SIZE)
+_ET_DECLARE_CHECKED(Uint,loader_y_reg_index,Uint)
+#define loader_y_reg_index(R) _ET_APPLY(loader_y_reg_index,(R))
/*
* Backwards compatibility definitions:
@@ -1160,82 +1112,7 @@ extern unsigned tag_val_def(Wterm);
#define FLOAT_BIG _NUMBER_CODE(FLOAT_DEF,BIG_DEF)
#define FLOAT_FLOAT _NUMBER_CODE(FLOAT_DEF,FLOAT_DEF)
-#if HALFWORD_HEAP
-#define ptr2rel(PTR,BASE) ((Eterm*)((char*)(PTR) - (char*)(BASE)))
-#define rterm2wterm(REL,BASE) ((Wterm)(REL) + (Wterm)(BASE))
-
-#else /* HALFWORD_HEAP */
-
-#define ptr2rel(PTR,BASE) (PTR)
-#define rterm2wterm(REL,BASE) (REL)
-
-#endif /* !HALFWORD_HEAP */
-
-#define make_list_rel(PTR, BASE) make_list(ptr2rel(PTR,BASE))
-#define make_boxed_rel(PTR, BASE) make_boxed(ptr2rel(PTR,BASE))
-#define make_fun_rel make_boxed_rel
-#define make_binary_rel make_boxed_rel
-#define make_tuple_rel make_boxed_rel
-#define make_external_rel make_boxed_rel
-#define make_internal_ref_rel make_boxed_rel
-#define make_big_rel make_boxed_rel
-
-#define binary_val_rel(RTERM, BASE) binary_val(rterm2wterm(RTERM, BASE))
-#define list_val_rel(RTERM, BASE) list_val(rterm2wterm(RTERM, BASE))
-#define boxed_val_rel(RTERM, BASE) boxed_val(rterm2wterm(RTERM, BASE))
-#define tuple_val_rel(RTERM, BASE) tuple_val(rterm2wterm(RTERM, BASE))
-#define export_val_rel(RTERM, BASE) export_val(rterm2wterm(RTERM, BASE))
-#define fun_val_rel(RTERM, BASE) fun_val(rterm2wterm(RTERM, BASE))
-#define big_val_rel(RTERM,BASE) big_val(rterm2wterm(RTERM,BASE))
-#define float_val_rel(RTERM,BASE) float_val(rterm2wterm(RTERM,BASE))
-#define internal_ref_val_rel(RTERM,BASE) internal_ref_val(rterm2wterm(RTERM,BASE))
-
-#define external_thing_ptr_rel(RTERM, BASE) external_thing_ptr(rterm2wterm(RTERM, BASE))
-#define external_data_words_rel(RTERM,BASE) external_data_words(rterm2wterm(RTERM,BASE))
-
-#define external_port_node_rel(RTERM,BASE) external_port_node(rterm2wterm(RTERM,BASE))
-#define external_port_data_rel(RTERM,BASE) external_port_data(rterm2wterm(RTERM,BASE))
-
-#define is_external_pid_rel(RTERM,BASE) is_external_pid(rterm2wterm(RTERM,BASE))
-#define external_pid_node_rel(RTERM,BASE) external_pid_node(rterm2wterm(RTERM,BASE))
-#define external_pid_data_rel(RTERM,BASE) external_pid_data(rterm2wterm(RTERM,BASE))
-
-#define is_binary_rel(RTERM,BASE) is_binary(rterm2wterm(RTERM,BASE))
-#define is_float_rel(RTERM,BASE) is_float(rterm2wterm(RTERM,BASE))
-#define is_fun_rel(RTERM,BASE) is_fun(rterm2wterm(RTERM,BASE))
-#define is_big_rel(RTERM,BASE) is_big(rterm2wterm(RTERM,BASE))
-#define is_export_rel(RTERM,BASE) is_export(rterm2wterm(RTERM,BASE))
-#define is_tuple_rel(RTERM,BASE) is_tuple(rterm2wterm(RTERM,BASE))
-
-#define GET_DOUBLE_REL(RTERM, f, BASE) GET_DOUBLE(rterm2wterm(RTERM,BASE), f)
-
-#define ref_thing_ptr_rel(RTERM,BASE) ref_thing_ptr(rterm2wterm(RTERM,BASE))
-#define is_internal_ref_rel(RTERM,BASE) is_internal_ref(rterm2wterm(RTERM,BASE))
-#define is_external_rel(RTERM,BASE) is_external(rterm2wterm(RTERM,BASE))
-#define is_external_port_rel(RTERM,BASE) is_external_port(rterm2wterm(RTERM,BASE))
-#define is_external_ref_rel(RTERM,BASE) is_external_ref(rterm2wterm(RTERM,BASE))
-
-#define external_node_rel(RTERM,BASE) external_node(rterm2wterm(RTERM,BASE))
-
-
-#if HALFWORD_HEAP
-ERTS_GLB_INLINE int is_same(Eterm a, Eterm* a_base, Eterm b, Eterm* b_base);
-
-#if ERTS_GLB_INLINE_INCL_FUNC_DEF
-ERTS_GLB_INLINE int is_same(Eterm a, Eterm* a_base, Eterm b, Eterm* b_base)
-{
- /* If bases differ, assume a and b are on different "heaps",
- ie can only be same if immed */
- ASSERT(a_base == b_base || is_immed(a) || is_immed(b)
- || rterm2wterm(a,a_base) != rterm2wterm(b,b_base));
-
- return a == b && (a_base == b_base || is_immed(a));
-}
-#endif
-
-#else /* !HALFWORD_HEAP */
-#define is_same(A,A_BASE,B,B_BASE) ((A)==(B))
-#endif
+#define is_same(A,B) ((A)==(B))
#endif /* __ERL_TERM_H */
diff --git a/erts/emulator/beam/erl_threads.h b/erts/emulator/beam/erl_threads.h
index 5347979372..34f91e2ec8 100644
--- a/erts/emulator/beam/erl_threads.h
+++ b/erts/emulator/beam/erl_threads.h
@@ -649,6 +649,7 @@ ERTS_GLB_INLINE void erts_tsd_set(erts_tsd_key_t key, void *value);
ERTS_GLB_INLINE void * erts_tsd_get(erts_tsd_key_t key);
ERTS_GLB_INLINE erts_tse_t *erts_tse_fetch(void);
ERTS_GLB_INLINE void erts_tse_return(erts_tse_t *ep);
+ERTS_GLB_INLINE void erts_tse_prepare_timed(erts_tse_t *ep);
ERTS_GLB_INLINE void erts_tse_set(erts_tse_t *ep);
ERTS_GLB_INLINE void erts_tse_reset(erts_tse_t *ep);
ERTS_GLB_INLINE int erts_tse_wait(erts_tse_t *ep);
@@ -3461,6 +3462,15 @@ ERTS_GLB_INLINE void erts_tse_return(erts_tse_t *ep)
#endif
}
+ERTS_GLB_INLINE void erts_tse_prepare_timed(erts_tse_t *ep)
+{
+#ifdef USE_THREADS
+ int res = ethr_event_prepare_timed(&((ethr_ts_event *) ep)->event);
+ if (res != 0)
+ erts_thr_fatal_error(res, "prepare timed");
+#endif
+}
+
ERTS_GLB_INLINE void erts_tse_set(erts_tse_t *ep)
{
#ifdef USE_THREADS
diff --git a/erts/emulator/beam/erl_trace.c b/erts/emulator/beam/erl_trace.c
index e1b03a057f..e9dd96efc4 100644
--- a/erts/emulator/beam/erl_trace.c
+++ b/erts/emulator/beam/erl_trace.c
@@ -1677,12 +1677,7 @@ erts_call_trace(Process* p, BeamInstr mfa[3], Binary *match_spec,
args = transformed_args;
if (is_internal_port(*tracer_pid)) {
-#if HEAP_ON_C_STACK
Eterm local_heap[64+MAX_ARG];
-#else
- Eterm *local_heap = erts_alloc(ERTS_ALC_T_TEMP_TERM,
- sizeof(Eterm)*(64+MAX_ARG));
-#endif
hp = local_heap;
if (!erts_is_valid_tracer_port(*tracer_pid)) {
@@ -1697,9 +1692,6 @@ erts_call_trace(Process* p, BeamInstr mfa[3], Binary *match_spec,
if (is_not_nil(tracee))
erts_smp_proc_unlock(p, ERTS_PROC_LOCKS_ALL_MINOR);
#endif
-#if !HEAP_ON_C_STACK
- erts_free(ERTS_ALC_T_TEMP_TERM,local_heap);
-#endif
UnUseTmpHeap(ERL_SUB_BIN_SIZE,p);
return 0;
}
@@ -1727,9 +1719,6 @@ erts_call_trace(Process* p, BeamInstr mfa[3], Binary *match_spec,
ERTS_PAM_TMP_RESULT, &return_flags);
if (is_non_value(pam_result)) {
erts_match_set_release_result(p);
-#if !HEAP_ON_C_STACK
- erts_free(ERTS_ALC_T_TEMP_TERM,local_heap);
-#endif
UnUseTmpHeap(ERL_SUB_BIN_SIZE,p);
return 0;
}
@@ -1738,9 +1727,6 @@ erts_call_trace(Process* p, BeamInstr mfa[3], Binary *match_spec,
/* Meta trace */
if (pam_result == am_false) {
erts_match_set_release_result(p);
-#if !HEAP_ON_C_STACK
- erts_free(ERTS_ALC_T_TEMP_TERM,local_heap);
-#endif
UnUseTmpHeap(ERL_SUB_BIN_SIZE,p);
return return_flags;
}
@@ -1748,17 +1734,11 @@ erts_call_trace(Process* p, BeamInstr mfa[3], Binary *match_spec,
/* Non-meta trace */
if (*tracee_flags & F_TRACE_SILENT) {
erts_match_set_release_result(p);
-#if !HEAP_ON_C_STACK
- erts_free(ERTS_ALC_T_TEMP_TERM,local_heap);
-#endif
UnUseTmpHeap(ERL_SUB_BIN_SIZE,p);
return 0;
}
if (pam_result == am_false) {
erts_match_set_release_result(p);
-#if !HEAP_ON_C_STACK
- erts_free(ERTS_ALC_T_TEMP_TERM,local_heap);
-#endif
UnUseTmpHeap(ERL_SUB_BIN_SIZE,p);
return return_flags;
}
@@ -1802,9 +1782,6 @@ erts_call_trace(Process* p, BeamInstr mfa[3], Binary *match_spec,
send_to_port(p, mess, tracer_pid, tracee_flags);
erts_smp_mtx_unlock(&smq_mtx);
erts_match_set_release_result(p);
-#if !HEAP_ON_C_STACK
- erts_free(ERTS_ALC_T_TEMP_TERM,local_heap);
-#endif
UnUseTmpHeap(ERL_SUB_BIN_SIZE,p);
return *tracer_pid == NIL ? 0 : return_flags;
@@ -1823,7 +1800,6 @@ erts_call_trace(Process* p, BeamInstr mfa[3], Binary *match_spec,
#ifdef DEBUG
Eterm* limit;
#endif
-
ASSERT(is_internal_pid(*tracer_pid));
tracer = erts_pid2proc(p, ERTS_PROC_LOCK_MAIN,
@@ -3297,8 +3273,6 @@ sys_msg_dispatcher_func(void *unused)
if (erts_thr_progress_update(NULL))
erts_thr_progress_leader_update(NULL);
- ERTS_SCHED_FAIR_YIELD();
-
#ifdef DEBUG_PRINTOUTS
print_msg_type(smqp);
#endif
@@ -3453,9 +3427,6 @@ static void
init_sys_msg_dispatcher(void)
{
erts_smp_thr_opts_t thr_opts = ERTS_SMP_THR_OPTS_DEFAULT_INITER;
-#ifdef __OSE__
- thr_opts.coreNo = 0;
-#endif
thr_opts.detached = 1;
thr_opts.name = "sys_msg_dispatcher";
init_smq_element_alloc();
@@ -3463,7 +3434,6 @@ init_sys_msg_dispatcher(void)
sys_message_queue_end = NULL;
erts_smp_cnd_init(&smq_cnd);
erts_smp_mtx_init(&smq_mtx, "sys_msg_q");
-
erts_smp_thr_create(&sys_msg_dispatcher_tid,
sys_msg_dispatcher_func,
NULL,
diff --git a/erts/emulator/beam/erl_utils.h b/erts/emulator/beam/erl_utils.h
index 6dab3bf297..4058d63eaf 100644
--- a/erts/emulator/beam/erl_utils.h
+++ b/erts/emulator/beam/erl_utils.h
@@ -157,32 +157,15 @@ void erts_init_utils_mem(void);
erts_dsprintf_buf_t *erts_create_tmp_dsbuf(Uint);
void erts_destroy_tmp_dsbuf(erts_dsprintf_buf_t *);
-#if HALFWORD_HEAP
-int eq_rel(Eterm a, Eterm* a_base, Eterm b, Eterm* b_base);
-# define eq(A,B) eq_rel(A,NULL,B,NULL)
-#else
int eq(Eterm, Eterm);
-# define eq_rel(A,A_BASE,B,B_BASE) eq(A,B)
-#endif
#define EQ(x,y) (((x) == (y)) || (is_not_both_immed((x),(y)) && eq((x),(y))))
-#if HALFWORD_HEAP
-Sint erts_cmp_rel_opt(Eterm, Eterm*, Eterm, Eterm*, int, int);
-#define cmp_rel(A,A_BASE,B,B_BASE) erts_cmp_rel_opt(A,A_BASE,B,B_BASE,0,0)
-#define cmp_rel_term(A,A_BASE,B,B_BASE) erts_cmp_rel_opt(A,A_BASE,B,B_BASE,1,0)
-#define CMP(A,B) erts_cmp_rel_opt(A,NULL,B,NULL,0,0)
-#define CMP_TERM(A,B) erts_cmp_rel_opt(A,NULL,B,NULL,1,0)
-#define CMP_EQ_ONLY(A,B) erts_cmp_rel_opt(A,NULL,B,NULL,0,1)
-#else
Sint erts_cmp(Eterm, Eterm, int, int);
Sint cmp(Eterm a, Eterm b);
-#define cmp_rel(A,A_BASE,B,B_BASE) erts_cmp(A,B,0,0)
-#define cmp_rel_term(A,A_BASE,B,B_BASE) erts_cmp(A,B,1,0)
#define CMP(A,B) erts_cmp(A,B,0,0)
#define CMP_TERM(A,B) erts_cmp(A,B,1,0)
#define CMP_EQ_ONLY(A,B) erts_cmp(A,B,0,1)
-#endif
#define cmp_lt(a,b) (CMP((a),(b)) < 0)
#define cmp_le(a,b) (CMP((a),(b)) <= 0)
diff --git a/erts/emulator/beam/erl_vm.h b/erts/emulator/beam/erl_vm.h
index 8948ca2ea9..98f27a1725 100644
--- a/erts/emulator/beam/erl_vm.h
+++ b/erts/emulator/beam/erl_vm.h
@@ -40,14 +40,6 @@
#define MAX_ARG 255 /* Max number of arguments allowed */
#define MAX_REG 1024 /* Max number of x(N) registers used */
-/* Scheduler stores data for temporary heaps if
- !HEAP_ON_C_STACK. Macros (*TmpHeap*) in global.h selects if we put temporary
- heap data on the C stack or if we use the buffers in the scheduler data. */
-#define TMP_HEAP_SIZE 128 /* Number of Eterm in the schedulers
- small heap for transient heap data */
-#define ERL_ARITH_TMP_HEAP_SIZE 4 /* as does erl_arith... */
-#define BEAM_EMU_TMP_HEAP_SIZE 2 /* and beam_emu... */
-
/*
* The new arithmetic operations need some extra X registers in the register array.
* so does the gc_bif's (i_gc_bif3 need 3 extra).
@@ -117,12 +109,8 @@
#define HeapWordsLeft(p) (HEAP_LIMIT(p) - HEAP_TOP(p))
#if defined(DEBUG) || defined(CHECK_FOR_HOLES)
-#if HALFWORD_HEAP
-# define ERTS_HOLE_MARKER (0xdeadbeef)
-#else
# define ERTS_HOLE_MARKER (((0xdeadbeef << 24) << 8) | 0xdeadbeef)
-#endif
-#endif
+#endif /* egil: 32-bit ? */
/*
* Allocate heap memory on the ordinary heap, NEVER in a heap
@@ -153,6 +141,7 @@
typedef struct op_entry {
char* name; /* Name of instruction. */
Uint32 mask[3]; /* Signature mask. */
+ unsigned involves_r; /* Needs special attention when matching. */
int sz; /* Number of loaded words. */
char* pack; /* Instructions for packing engine. */
char* sign; /* Signature string. */
diff --git a/erts/emulator/beam/external.c b/erts/emulator/beam/external.c
index c6d7e3fcc5..c3e93d1ad2 100644
--- a/erts/emulator/beam/external.c
+++ b/erts/emulator/beam/external.c
@@ -2339,10 +2339,6 @@ enc_term_int(TTBEncodeContext* ctx, ErtsAtomCacheMap *acmp, Eterm obj, byte* ep,
Eterm val;
FloatDef f;
Sint r = 0;
-#if HALFWORD_HEAP
- UWord wobj;
-#endif
-
if (ctx) {
WSTACK_CHANGE_ALLOCATOR(s, ERTS_ALC_T_SAVED_ESTACK);
@@ -2362,11 +2358,8 @@ enc_term_int(TTBEncodeContext* ctx, ErtsAtomCacheMap *acmp, Eterm obj, byte* ep,
outer_loop:
while (!WSTACK_ISEMPTY(s)) {
-#if HALFWORD_HEAP
- obj = (Eterm) (wobj = WSTACK_POP(s));
-#else
obj = WSTACK_POP(s);
-#endif
+
switch (val = WSTACK_POP(s)) {
case ENC_TERM:
break;
@@ -2384,11 +2377,7 @@ enc_term_int(TTBEncodeContext* ctx, ErtsAtomCacheMap *acmp, Eterm obj, byte* ep,
break;
case ENC_PATCH_FUN_SIZE:
{
-#if HALFWORD_HEAP
- byte* size_p = (byte *) wobj;
-#else
byte* size_p = (byte *) obj;
-#endif
put_int32(ep - size_p, size_p);
}
goto outer_loop;
@@ -2435,21 +2424,13 @@ enc_term_int(TTBEncodeContext* ctx, ErtsAtomCacheMap *acmp, Eterm obj, byte* ep,
case ENC_LAST_ARRAY_ELEMENT:
/* obj is the tuple */
{
-#if HALFWORD_HEAP
- Eterm* ptr = (Eterm *) wobj;
-#else
Eterm* ptr = (Eterm *) obj;
-#endif
obj = *ptr;
}
break;
default: /* ENC_LAST_ARRAY_ELEMENT+1 and upwards */
{
-#if HALFWORD_HEAP
- Eterm* ptr = (Eterm *) wobj;
-#else
Eterm* ptr = (Eterm *) obj;
-#endif
obj = *ptr++;
WSTACK_PUSH2(s, val-1, (UWord)ptr);
}
@@ -2977,7 +2958,7 @@ dec_term(ErtsDistExternal *edep,
case B2TDecodeList:
objp = next - 2;
while (n > 0) {
- objp[0] = (Eterm) COMPRESS_POINTER(next);
+ objp[0] = (Eterm) next;
objp[1] = make_list(next);
next = objp;
objp -= 2;
@@ -2988,7 +2969,7 @@ dec_term(ErtsDistExternal *edep,
case B2TDecodeTuple:
objp = next - 1;
while (n-- > 0) {
- objp[0] = (Eterm) COMPRESS_POINTER(next);
+ objp[0] = (Eterm) next;
next = objp;
objp--;
}
@@ -3041,7 +3022,7 @@ dec_term(ErtsDistExternal *edep,
while (next != NULL) {
objp = next;
- next = (Eterm *) EXPAND_POINTER(*objp);
+ next = (Eterm *) *objp;
switch (*ep++) {
case INTEGER_EXT:
@@ -3049,7 +3030,7 @@ dec_term(ErtsDistExternal *edep,
Sint sn = get_int32(ep);
ep += 4;
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
*objp = make_small(sn);
#else
if (MY_IS_SSMALL(sn)) {
@@ -3172,7 +3153,7 @@ dec_term_atom_common:
reds -= n;
}
while (n-- > 0) {
- objp[0] = (Eterm) COMPRESS_POINTER(next);
+ objp[0] = (Eterm) next;
next = objp;
objp--;
}
@@ -3190,8 +3171,8 @@ dec_term_atom_common:
*objp = make_list(hp);
hp += 2 * n;
objp = hp - 2;
- objp[0] = (Eterm) COMPRESS_POINTER((objp+1));
- objp[1] = (Eterm) COMPRESS_POINTER(next);
+ objp[0] = (Eterm) (objp+1);
+ objp[1] = (Eterm) next;
next = objp;
objp -= 2;
n--;
@@ -3204,7 +3185,7 @@ dec_term_atom_common:
reds -= n;
}
while (n > 0) {
- objp[0] = (Eterm) COMPRESS_POINTER(next);
+ objp[0] = (Eterm) next;
objp[1] = make_list(next);
next = objp;
objp -= 2;
@@ -3371,7 +3352,7 @@ dec_term_atom_common:
RefThing *rtp = (RefThing *) hp;
ref_num = (Uint32 *) (hp + REF_THING_HEAD_SIZE);
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
hp += REF_THING_HEAD_SIZE + ref_words/2 + 1;
rtp->header = make_ref_thing_header(ref_words/2 + 1);
#else
@@ -3382,13 +3363,13 @@ dec_term_atom_common:
}
else {
ExternalThing *etp = (ExternalThing *) hp;
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
hp += EXTERNAL_THING_HEAD_SIZE + ref_words/2 + 1;
#else
hp += EXTERNAL_THING_HEAD_SIZE + ref_words;
#endif
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
etp->header = make_external_ref_header(ref_words/2 + 1);
#else
etp->header = make_external_ref_header(ref_words);
@@ -3401,7 +3382,7 @@ dec_term_atom_common:
ref_num = &(etp->data.ui32[0]);
}
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
*(ref_num++) = ref_words /* 32-bit arity */;
#endif
ref_num[0] = r0;
@@ -3409,7 +3390,7 @@ dec_term_atom_common:
ref_num[i] = get_int32(ep);
ep += 4;
}
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
if ((1 + ref_words) % 2)
ref_num[ref_words] = 0;
#endif
@@ -3561,12 +3542,7 @@ dec_term_atom_common:
}
*objp = make_export(hp);
*hp++ = HEADER_EXPORT;
-#if HALFWORD_HEAP
- *((UWord *) (UWord) hp) = (UWord) erts_export_get_or_make_stub(mod, name, arity);
- hp += 2;
-#else
*hp++ = (Eterm) erts_export_get_or_make_stub(mod, name, arity);
-#endif
break;
}
break;
@@ -3600,7 +3576,7 @@ dec_term_atom_common:
* The list of maps is for later validation.
*/
- mp->thing_word = (Eterm) COMPRESS_POINTER(maps_list);
+ mp->thing_word = (Eterm) maps_list;
maps_list = (Eterm *) mp;
mp->size = size;
@@ -3608,8 +3584,8 @@ dec_term_atom_common:
*objp = make_flatmap(mp);
for (n = size; n; n--) {
- *vptr = (Eterm) COMPRESS_POINTER(next);
- *kptr = (Eterm) COMPRESS_POINTER(vptr);
+ *vptr = (Eterm) next;
+ *kptr = (Eterm) vptr;
next = kptr;
vptr--;
kptr--;
@@ -3623,8 +3599,8 @@ dec_term_atom_common:
hamt->leaf_array = hp;
for (n = size; n; n--) {
- CDR(hp) = (Eterm) COMPRESS_POINTER(next);
- CAR(hp) = (Eterm) COMPRESS_POINTER(&CDR(hp));
+ CDR(hp) = (Eterm) next;
+ CAR(hp) = (Eterm) &CDR(hp);
next = &CAR(hp);
hp += 2;
}
@@ -3701,11 +3677,11 @@ dec_term_atom_common:
/* Environment */
for (i = num_free-1; i >= 0; i--) {
- funp->env[i] = (Eterm) COMPRESS_POINTER(next);
+ funp->env[i] = (Eterm) next;
next = funp->env + i;
}
/* Creator */
- funp->creator = (Eterm) COMPRESS_POINTER(next);
+ funp->creator = (Eterm) next;
next = &(funp->creator);
break;
}
@@ -3774,7 +3750,7 @@ dec_term_atom_common:
/* Environment */
for (i = num_free-1; i >= 0; i--) {
- funp->env[i] = (Eterm) COMPRESS_POINTER(next);
+ funp->env[i] = (Eterm) next;
next = funp->env + i;
}
break;
@@ -3870,11 +3846,11 @@ dec_term_atom_common:
*/
while (maps_list) {
- next = (Eterm *)(EXPAND_POINTER(*maps_list));
+ next = (Eterm *) *maps_list;
*maps_list = MAP_HEADER_FLATMAP;
if (!erts_validate_and_sort_flatmap((flatmap_t*)maps_list))
goto error;
- maps_list = next;
+ maps_list = next;
}
ASSERT(hp <= factory->hp_end
@@ -3900,7 +3876,7 @@ dec_term_atom_common:
PSTACK_DESTROY(hamt_array);
}
- ASSERT((Eterm*)EXPAND_POINTER(*dbg_resultp) != NULL);
+ ASSERT((Eterm*)*dbg_resultp != NULL);
if (ctx) {
ctx->state = B2TDone;
@@ -4192,11 +4168,7 @@ encode_size_struct_int(TTBSizeContext* ctx, ErtsAtomCacheMap *acmp, Eterm obj,
case EXPORT_DEF:
{
Export* ep = *((Export **) (export_val(obj) + 1));
-#if HALFWORD_HEAP
- result += 2;
-#else
result += 1;
-#endif
result += encode_size_struct2(acmp, ep->code[0], dflags);
result += encode_size_struct2(acmp, ep->code[1], dflags);
result += encode_size_struct2(acmp, make_small(ep->code[2]), dflags);
@@ -4311,7 +4283,7 @@ init_done:
switch (tag) {
case INTEGER_EXT:
SKIP(4);
-#if !defined(ARCH_64) || HALFWORD_HEAP
+#if !defined(ARCH_64)
heap_size += BIG_UINT_HEAP_SIZE;
#endif
break;
@@ -4400,7 +4372,7 @@ init_done:
ep += 2;
atom_extra_skip = 1 + 4*id_words;
/* In case it is an external ref */
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
heap_size += EXTERNAL_THING_HEAD_SIZE + id_words/2 + 1;
#else
heap_size += EXTERNAL_THING_HEAD_SIZE + id_words;
@@ -4486,11 +4458,7 @@ init_done:
break;
case EXPORT_EXT:
terms += 3;
-#if HALFWORD_HEAP
- heap_size += 3;
-#else
heap_size += 2;
-#endif
break;
case NEW_FUN_EXT:
{
diff --git a/erts/emulator/beam/global.h b/erts/emulator/beam/global.h
index ec9296d034..b4d02dd1dd 100644
--- a/erts/emulator/beam/global.h
+++ b/erts/emulator/beam/global.h
@@ -310,9 +310,6 @@ typedef union {
typedef struct proc_bin {
Eterm thing_word; /* Subtag REFC_BINARY_SUBTAG. */
Uint size; /* Binary size in bytes. */
-#if HALFWORD_HEAP
- void* dummy_ptr_padding__;
-#endif
struct erl_off_heap_header *next;
Binary *val; /* Pointer to Binary structure. */
byte *bytes; /* Pointer to the actual data bytes. */
@@ -957,31 +954,12 @@ __decl_noreturn void __noreturn erl_exit_flush_async(int n, char*, ...);
void erl_error(char*, va_list);
/* copy.c */
-Eterm copy_object(Eterm, Process*);
-
-#if HALFWORD_HEAP
-Uint size_object_rel(Eterm, Eterm*);
-# define size_object(A) size_object_rel(A,NULL)
-
-Eterm copy_struct_rel(Eterm, Uint, Eterm**, ErlOffHeap*, Eterm* src_base, Eterm* dst_base);
-# define copy_struct(OBJ,SZ,HPP,OH) copy_struct_rel(OBJ,SZ,HPP,OH, NULL,NULL)
-
-Eterm copy_shallow_rel(Eterm*, Uint, Eterm**, ErlOffHeap*, Eterm* src_base);
-# define copy_shallow(A,B,C,D) copy_shallow_rel(A,B,C,D,NULL)
-
-#else /* !HALFWORD_HEAP */
+Eterm copy_object_x(Eterm, Process*, Uint);
+#define copy_object(Term, Proc) copy_object_x(Term,Proc,0)
Uint size_object(Eterm);
-# define size_object_rel(A,B) size_object(A)
-
Eterm copy_struct(Eterm, Uint, Eterm**, ErlOffHeap*);
-# define copy_struct_rel(OBJ,SZ,HPP,OH, SB,DB) copy_struct(OBJ,SZ,HPP,OH)
-
Eterm copy_shallow(Eterm*, Uint, Eterm**, ErlOffHeap*);
-# define copy_shallow_rel(A,B,C,D, BASE) copy_shallow(A,B,C,D)
-
-#endif
-
void move_multi_frags(Eterm** hpp, ErlOffHeap*, ErlHeapFragment* first,
Eterm* refs, unsigned nrefs);
@@ -1180,7 +1158,7 @@ void bin_write(int, void*, byte*, size_t);
int intlist_to_buf(Eterm, char*, int); /* most callers pass plain char*'s */
struct Sint_buf {
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
char s[22];
#else
char s[12];
@@ -1466,69 +1444,16 @@ erts_alloc_message_heap(Uint size,
#endif /* #if ERTS_GLB_INLINE_INCL_FUNC_DEF */
-#if !HEAP_ON_C_STACK
-# if defined(DEBUG)
-# define DeclareTmpHeap(VariableName,Size,Process) \
- Eterm *VariableName = erts_debug_allocate_tmp_heap(Size,Process)
-# define DeclareTypedTmpHeap(Type,VariableName,Process) \
- Type *VariableName = (Type *) erts_debug_allocate_tmp_heap(sizeof(Type)/sizeof(Eterm),Process)
-# define DeclareTmpHeapNoproc(VariableName,Size) \
- Eterm *VariableName = erts_debug_allocate_tmp_heap(Size,NULL)
-# define UseTmpHeap(Size,Proc) \
- do { \
- erts_debug_use_tmp_heap((Size),(Proc)); \
- } while (0)
-# define UnUseTmpHeap(Size,Proc) \
- do { \
- erts_debug_unuse_tmp_heap((Size),(Proc)); \
- } while (0)
-# define UseTmpHeapNoproc(Size) \
- do { \
- erts_debug_use_tmp_heap(Size,NULL); \
- } while (0)
-# define UnUseTmpHeapNoproc(Size) \
- do { \
- erts_debug_unuse_tmp_heap(Size,NULL); \
- } while (0)
-# else
-# define DeclareTmpHeap(VariableName,Size,Process) \
- Eterm *VariableName = (ERTS_PROC_GET_SCHDATA(Process)->tmp_heap)+(ERTS_PROC_GET_SCHDATA(Process)->num_tmp_heap_used)
-# define DeclareTypedTmpHeap(Type,VariableName,Process) \
- Type *VariableName = (Type *) (ERTS_PROC_GET_SCHDATA(Process)->tmp_heap)+(ERTS_PROC_GET_SCHDATA(Process)->num_tmp_heap_used)
-# define DeclareTmpHeapNoproc(VariableName,Size) \
- Eterm *VariableName = (erts_get_scheduler_data()->tmp_heap)+(erts_get_scheduler_data()->num_tmp_heap_used)
-# define UseTmpHeap(Size,Proc) \
- do { \
- ERTS_PROC_GET_SCHDATA(Proc)->num_tmp_heap_used += (Size); \
- } while (0)
-# define UnUseTmpHeap(Size,Proc) \
- do { \
- ERTS_PROC_GET_SCHDATA(Proc)->num_tmp_heap_used -= (Size); \
- } while (0)
-# define UseTmpHeapNoproc(Size) \
- do { \
- erts_get_scheduler_data()->num_tmp_heap_used += (Size); \
- } while (0)
-# define UnUseTmpHeapNoproc(Size) \
- do { \
- erts_get_scheduler_data()->num_tmp_heap_used -= (Size); \
- } while (0)
-
-
-# endif
-
-#else
-# define DeclareTmpHeap(VariableName,Size,Process) \
+#define DeclareTmpHeap(VariableName,Size,Process) \
Eterm VariableName[Size]
-# define DeclareTypedTmpHeap(Type,VariableName,Process) \
+#define DeclareTypedTmpHeap(Type,VariableName,Process) \
Type VariableName[1]
-# define DeclareTmpHeapNoproc(VariableName,Size) \
+#define DeclareTmpHeapNoproc(VariableName,Size) \
Eterm VariableName[Size]
-# define UseTmpHeap(Size,Proc) /* Nothing */
-# define UnUseTmpHeap(Size,Proc) /* Nothing */
-# define UseTmpHeapNoproc(Size) /* Nothing */
-# define UnUseTmpHeapNoproc(Size) /* Nothing */
-#endif /* HEAP_ON_C_STACK */
+#define UseTmpHeap(Size,Proc) /* Nothing */
+#define UnUseTmpHeap(Size,Proc) /* Nothing */
+#define UseTmpHeapNoproc(Size) /* Nothing */
+#define UnUseTmpHeapNoproc(Size) /* Nothing */
ERTS_GLB_INLINE void dtrace_pid_str(Eterm pid, char *process_buf);
ERTS_GLB_INLINE void dtrace_proc_str(Process *process, char *process_buf);
diff --git a/erts/emulator/beam/io.c b/erts/emulator/beam/io.c
index 900616c981..fdd26fcc4b 100644
--- a/erts/emulator/beam/io.c
+++ b/erts/emulator/beam/io.c
@@ -52,9 +52,7 @@
#include "erl_hl_timer.h"
extern ErlDrvEntry fd_driver_entry;
-#ifndef __OSE__
extern ErlDrvEntry vanilla_driver_entry;
-#endif
extern ErlDrvEntry spawn_driver_entry;
extern ErlDrvEntry *driver_tab[]; /* table of static drivers, only used during initialization */
@@ -1105,7 +1103,7 @@ io_list_vec_len(Eterm obj, int* vsize, Uint* csize,
Uint p_v_size = 0;
Uint p_c_size = 0;
Uint p_in_clist = 0;
- Uint total; /* Uint due to halfword emulator */
+ Uint total;
goto L_jump_start; /* avoid a push */
@@ -2794,9 +2792,7 @@ void erts_init_io(int port_tab_size,
erts_smp_rwmtx_rwlock(&erts_driver_list_lock);
init_driver(&fd_driver, &fd_driver_entry, NULL);
-#ifndef __OSE__
init_driver(&vanilla_driver, &vanilla_driver_entry, NULL);
-#endif
init_driver(&spawn_driver, &spawn_driver_entry, NULL);
erts_init_static_drivers();
for (dp = driver_tab; *dp != NULL; dp++)
@@ -4091,10 +4087,10 @@ erts_port_control(Process* c_p,
binp = NULL;
if (is_binary(data) && binary_bitoffset(data) == 0) {
- Eterm *ebinp = binary_val_rel(data, NULL);
+ Eterm *ebinp = binary_val(data);
ASSERT(!tmp_alloced);
if (*ebinp == HEADER_SUB_BIN)
- ebinp = binary_val_rel(((ErlSubBin *) ebinp)->orig, NULL);
+ ebinp = binary_val(((ErlSubBin *) ebinp)->orig);
if (*ebinp != HEADER_PROC_BIN)
copy = 1;
else {
@@ -5248,25 +5244,17 @@ driver_deliver_term(Eterm to, ErlDrvTermData* data, int len)
break;
case ERL_DRV_INT: /* signed int argument */
ERTS_DDT_CHK_ENOUGH_ARGS(1);
-#if HALFWORD_HEAP
- erts_bld_sint64(NULL, &need, (Sint64)ptr[0]);
-#else
/* check for bignum */
if (!IS_SSMALL((Sint)ptr[0]))
need += BIG_UINT_HEAP_SIZE; /* use small_to_big */
-#endif
ptr++;
depth++;
break;
case ERL_DRV_UINT: /* unsigned int argument */
ERTS_DDT_CHK_ENOUGH_ARGS(1);
-#if HALFWORD_HEAP
- erts_bld_uint64(NULL, &need, (Uint64)ptr[0]);
-#else
/* check for bignum */
if (!IS_USMALL(0, (Uint)ptr[0]))
need += BIG_UINT_HEAP_SIZE; /* use small_to_big */
-#endif
ptr++;
depth++;
break;
@@ -5465,10 +5453,6 @@ driver_deliver_term(Eterm to, ErlDrvTermData* data, int len)
break;
case ERL_DRV_INT: /* signed int argument */
-#if HALFWORD_HEAP
- erts_reserve_heap(&factory, BIG_NEED_SIZE(2));
- mess = erts_bld_sint64(&factory.hp, NULL, (Sint64)ptr[0]);
-#else
erts_reserve_heap(&factory, BIG_UINT_HEAP_SIZE);
if (IS_SSMALL((Sint)ptr[0]))
mess = make_small((Sint)ptr[0]);
@@ -5476,15 +5460,10 @@ driver_deliver_term(Eterm to, ErlDrvTermData* data, int len)
mess = small_to_big((Sint)ptr[0], factory.hp);
factory.hp += BIG_UINT_HEAP_SIZE;
}
-#endif
ptr++;
break;
case ERL_DRV_UINT: /* unsigned int argument */
-#if HALFWORD_HEAP
- erts_reserve_heap(&factory, BIG_NEED_FOR_BITS(64));
- mess = erts_bld_uint64(&factory.hp, NULL, (Uint64)ptr[0]);
-#else
erts_reserve_heap(&factory, BIG_UINT_HEAP_SIZE);
if (IS_USMALL(0, (Uint)ptr[0]))
mess = make_small((Uint)ptr[0]);
@@ -5492,7 +5471,6 @@ driver_deliver_term(Eterm to, ErlDrvTermData* data, int len)
mess = uint_to_big((Uint)ptr[0], factory.hp);
factory.hp += BIG_UINT_HEAP_SIZE;
}
-#endif
ptr++;
break;
@@ -6809,7 +6787,7 @@ int driver_monitor_process(ErlDrvPort drvport,
{
Port *prt;
int ret;
-#if !HEAP_ON_C_STACK || (defined(ERTS_SMP) && defined(ERTS_ENABLE_LOCK_CHECK))
+#if defined(ERTS_SMP) && defined(ERTS_ENABLE_LOCK_CHECK)
ErtsSchedulerData *sched = erts_get_scheduler_data();
#endif
@@ -6820,16 +6798,6 @@ int driver_monitor_process(ErlDrvPort drvport,
/* Now (in SMP) we should have either the port lock (if we have a scheduler) or the port data lock
(if we're a driver thread) */
ERTS_SMP_LC_ASSERT((sched != NULL || prt->port_data_lock));
-
-#if !HEAP_ON_C_STACK
- if (!sched) {
- /* Need a separate allocation for the ref :( */
- Eterm *buf = erts_alloc(ERTS_ALC_T_TEMP_TERM,
- sizeof(Eterm)*REF_THING_SIZE);
- ret = do_driver_monitor_process(prt,buf,process,monitor);
- erts_free(ERTS_ALC_T_TEMP_TERM,buf);
- } else
-#endif
{
DeclareTmpHeapNoproc(buf,REF_THING_SIZE);
UseTmpHeapNoproc(REF_THING_SIZE);
@@ -6882,7 +6850,7 @@ int driver_demonitor_process(ErlDrvPort drvport,
{
Port *prt;
int ret;
-#if !HEAP_ON_C_STACK || (defined(ERTS_SMP) && defined(ERTS_ENABLE_LOCK_CHECK))
+#if defined(ERTS_SMP) && defined(ERTS_ENABLE_LOCK_CHECK)
ErtsSchedulerData *sched = erts_get_scheduler_data();
#endif
@@ -6893,15 +6861,6 @@ int driver_demonitor_process(ErlDrvPort drvport,
/* Now we should have either the port lock (if we have a scheduler) or the port data lock
(if we're a driver thread) */
ERTS_SMP_LC_ASSERT((sched != NULL || prt->port_data_lock));
-#if !HEAP_ON_C_STACK
- if (!sched) {
- /* Need a separate allocation for the ref :( */
- Eterm *buf = erts_alloc(ERTS_ALC_T_TEMP_TERM,
- sizeof(Eterm)*REF_THING_SIZE);
- ret = do_driver_demonitor_process(prt,buf,monitor);
- erts_free(ERTS_ALC_T_TEMP_TERM,buf);
- } else
-#endif
{
DeclareTmpHeapNoproc(buf,REF_THING_SIZE);
UseTmpHeapNoproc(REF_THING_SIZE);
@@ -6937,7 +6896,7 @@ ErlDrvTermData driver_get_monitored_process(ErlDrvPort drvport,
{
Port *prt;
ErlDrvTermData ret;
-#if !HEAP_ON_C_STACK || (defined(ERTS_SMP) && defined(ERTS_ENABLE_LOCK_CHECK))
+#if defined(ERTS_SMP) && defined(ERTS_ENABLE_LOCK_CHECK)
ErtsSchedulerData *sched = erts_get_scheduler_data();
#endif
@@ -6948,16 +6907,6 @@ ErlDrvTermData driver_get_monitored_process(ErlDrvPort drvport,
/* Now we should have either the port lock (if we have a scheduler) or the port data lock
(if we're a driver thread) */
ERTS_SMP_LC_ASSERT((sched != NULL || prt->port_data_lock));
-
-#if !HEAP_ON_C_STACK
- if (!sched) {
- /* Need a separate allocation for the ref :( */
- Eterm *buf = erts_alloc(ERTS_ALC_T_TEMP_TERM,
- sizeof(Eterm)*REF_THING_SIZE);
- ret = do_driver_get_monitored_process(prt,buf,monitor);
- erts_free(ERTS_ALC_T_TEMP_TERM,buf);
- } else
-#endif
{
DeclareTmpHeapNoproc(buf,REF_THING_SIZE);
UseTmpHeapNoproc(REF_THING_SIZE);
diff --git a/erts/emulator/beam/ops.tab b/erts/emulator/beam/ops.tab
index 1d32e72247..46fefb88af 100644
--- a/erts/emulator/beam/ops.tab
+++ b/erts/emulator/beam/ops.tab
@@ -39,8 +39,8 @@ too_old_compiler | never() =>
# necessary.) Since the instructions don't work correctly in R12B, simply
# refuse to load the module.
-func_info M=a a==am_module_info A=u==0 | label L | move n r => too_old_compiler
-func_info M=a a==am_module_info A=u==1 | label L | move n r => too_old_compiler
+func_info M=a a==am_module_info A=u==0 | label L | move n x==0 => too_old_compiler
+func_info M=a a==am_module_info A=u==1 | label L | move n x==0 => too_old_compiler
# The undocumented and unsupported guard BIF is_constant/1 was removed
# in R13. The is_constant/2 operation is marked as obsolete in genop.tab,
@@ -76,17 +76,6 @@ return
# with the following call instruction, we need to make sure that
# there is no line/1 instruction between the move and the call.
#
-
-move S r | line Loc | call_ext Ar Func => \
- line Loc | move S r | call_ext Ar Func
-move S r | line Loc | call_ext_last Ar Func=u$is_bif D => \
- line Loc | move S r | call_ext_last Ar Func D
-move S r | line Loc | call_ext_only Ar Func=u$is_bif => \
- line Loc | move S r | call_ext_only Ar Func
-move S r | line Loc | call Ar Func => \
- line Loc | move S r | call Ar Func
-
-#
# A tail-recursive call to an external function (non-BIF) will
# never be saved on the stack, so there is no reason to keep
# the line instruction. (The compiler did not remove the line
@@ -94,10 +83,14 @@ move S r | line Loc | call Ar Func => \
# BIFs and ordinary Erlang functions.)
#
-line Loc | call_ext_last Ar Func=u$is_not_bif D => \
- call_ext_last Ar Func D
-line Loc | call_ext_only Ar Func=u$is_not_bif => \
- call_ext_only Ar Func
+move S X0=x==0 | line Loc | call_ext Ar Func => \
+ line Loc | move S X0 | call_ext Ar Func
+move S X0=x==0 | line Loc | call_ext_last Ar Func=u$is_not_bif D => \
+ move S X0 | call_ext_last Ar Func D
+move S X0=x==0 | line Loc | call_ext_only Ar Func=u$is_not_bif => \
+ move S X0 | call_ext_only Ar Func
+move S X0=x==0 | line Loc | call Ar Func => \
+ line Loc | move S X0 | call Ar Func
line Loc | func_info M F A => func_info M F A | line Loc
@@ -167,31 +160,24 @@ is_tuple Fail=f S | select_tuple_arity S=d Fail=f Size=u Rest=* => \
select_tuple_arity S=d Fail=f Size=u Rest=* => \
gen_select_tuple_arity(S, Fail, Size, Rest)
-i_select_val_bins r f I
i_select_val_bins x f I
i_select_val_bins y f I
-i_select_val_lins r f I
i_select_val_lins x f I
i_select_val_lins y f I
-i_select_val2 r f c c f f
i_select_val2 x f c c f f
i_select_val2 y f c c f f
-i_select_tuple_arity r f I
i_select_tuple_arity x f I
i_select_tuple_arity y f I
-i_select_tuple_arity2 r f A A f f
i_select_tuple_arity2 x f A A f f
i_select_tuple_arity2 y f A A f f
-i_jump_on_val_zero r f I
i_jump_on_val_zero x f I
i_jump_on_val_zero y f I
-i_jump_on_val r f I I
i_jump_on_val x f I I
i_jump_on_val y f I I
@@ -203,30 +189,21 @@ is_ne_exact L1 S1 S2 | jump Fail | label L2 | same_label(L1, L2) => \
%macro: get_list GetList -pack
get_list x x x
get_list x x y
-get_list x x r
get_list x y x
get_list x y y
-get_list x y r
-get_list x r x
-get_list x r y
get_list y x x
get_list y x y
-get_list y x r
get_list y y x
get_list y y y
-get_list y y r
-get_list y r x
-get_list y r y
+# The following get_list instructions using x(0) are frequently used.
get_list r x x
+get_list r r y
+get_list x r x
get_list r x y
-get_list r x r
-get_list r y x
-get_list r y y
get_list r y r
-get_list r r x
-get_list r r y
+get_list r x r
# Old-style catch.
catch y f
@@ -237,33 +214,31 @@ try Y F => catch Y F
try_case Y => try_end Y
try_end y
-try_case_end Literal=q => move Literal x | try_case_end x
try_case_end s
# Destructive set tuple element
-set_tuple_element Lit=q Tuple Pos => move Lit x | set_tuple_element x Tuple Pos
set_tuple_element s d P
# Get tuple element
%macro: i_get_tuple_element GetTupleElement -pack
i_get_tuple_element x P x
-i_get_tuple_element r P x
i_get_tuple_element y P x
-i_get_tuple_element x P r
-i_get_tuple_element y P r
%cold
-i_get_tuple_element r P r
i_get_tuple_element x P y
-i_get_tuple_element r P y
i_get_tuple_element y P y
%hot
+%macro: i_get_tuple_element2 GetTupleElement2 -pack
+i_get_tuple_element2 x P x
+
+%macro: i_get_tuple_element3 GetTupleElement3 -pack
+i_get_tuple_element3 x P x
+
%macro: is_number IsNumber -fail_action
%cold
-is_number f r
is_number f x
is_number f y
%hot
@@ -273,16 +248,12 @@ is_number Fail Literal=q => move Literal x | is_number Fail x
jump f
-case_end Literal=cq => move Literal x | case_end x
-badmatch Literal=cq => move Literal x | badmatch x
+case_end NotInX=cy => move NotInX x | case_end x
+badmatch NotInX=cy => move NotInX x | badmatch x
-case_end r
case_end x
-case_end y
-badmatch r
badmatch x
-badmatch y
if_end
raise s s
@@ -291,7 +262,7 @@ raise s s
badarg j
system_limit j
-move C=cxy r | jump Lbl => move_jump Lbl C
+move C=cxy x==0 | jump Lbl => move_jump Lbl C
%macro: move_jump MoveJump -nonext
move_jump f n
@@ -309,8 +280,6 @@ move_window/6
# x -> y
-move S1=r S2=y | move X1=x Y1=y => move2 S1 S2 X1 Y1
-
move X1=x Y1=y | move X2=x Y2=y | move X3=x Y3=y | succ(Y1,Y2) | succ(Y2,Y3) => \
move_window X1 X2 X3 Y1 Y3
@@ -323,24 +292,76 @@ move_window X1=x X2=x X3=x X4=x Y1=y Y4=y | move X5=x Y5=y | succ(Y4,Y5) => \
move_window X1=x X2=x X3=x Y1=y Y3=y => move_window3 X1 X2 X3 Y1
move_window X1=x X2=x X3=x X4=x Y1=y Y4=y => move_window4 X1 X2 X3 X4 Y1
+%macro: move_window3 MoveWindow3 -pack
+%macro: move_window4 MoveWindow4 -pack
+%macro: move_window5 MoveWindow5 -pack
+
move_window3 x x x y
move_window4 x x x x y
move_window5 x x x x x y
-move X1=x Y1=y | move X2=x Y2=y => move2 X1 Y1 X2 Y2
-move Y1=y X1=x | move Y2=y X2=x => move2 Y1 X1 Y2 X2
-move X1=x X2=x | move X3=x X4=x => move2 X1 X2 X3 X4
+# Swap registers.
+move R1=x Tmp=x | move R2=xy R1 | move Tmp R2 => swap_temp R1 R2 Tmp
+
+swap_temp R1 R2 Tmp | line Loc | apply Live | is_killed(Tmp, Live) => \
+ swap R1 R2 | line Loc | apply Live
+
+swap_temp R1 R2 Tmp | line Loc | call Live Addr | is_killed(Tmp, Live) => \
+ swap R1 R2 | line Loc | call Live Addr
+swap_temp R1 R2 Tmp | call_only Live Addr | \
+ is_killed(Tmp, Live) => swap R1 R2 | call_only Live Addr
+swap_temp R1 R2 Tmp | call_last Live Addr D | \
+ is_killed(Tmp, Live) => swap R1 R2 | call_last Live Addr D
-move S1=x S2=r | move S3=x S4=x => move2 S1 S2 S3 S4
-move S1=x S2=r | move X1=x Y1=y => move2 S1 S2 X1 Y1
-move S1=y S2=r | move X1=x Y1=y => move2 S1 S2 X1 Y1
+swap_temp R1 R2 Tmp | line Loc | call_ext Live Addr | is_killed(Tmp, Live) => \
+ swap R1 R2 | line Loc | call_ext Live Addr
+swap_temp R1 R2 Tmp | line Loc | call_ext_only Live Addr | \
+ is_killed(Tmp, Live) => swap R1 R2 | line Loc | call_ext_only Live Addr
+swap_temp R1 R2 Tmp | line Loc | call_ext_last Live Addr D | \
+ is_killed(Tmp, Live) => swap R1 R2 | line Loc | call_ext_last Live Addr D
-move Y1=y X1=x | move S1=r D1=x => move2 Y1 X1 S1 D1
-move S1=r D1=x | move Y1=y X1=x => move2 S1 D1 Y1 X1
+%macro: swap_temp SwapTemp -pack
+swap_temp x x x
+swap_temp x y x
-move2 X1=x Y1=y X2=x Y2=y | move X3=x Y3=y => move3 X1 Y1 X2 Y2 X3 Y3
-move2 Y1=y X1=x Y2=y X2=x | move Y3=y X3=x => move3 Y1 X1 Y2 X2 Y3 X3
-move2 X1=x X2=x X3=x X4=x | move X5=x X6=x => move3 X1 X2 X3 X4 X5 X6
+%macro: swap Swap -pack
+swap x x
+swap x y
+
+move Src=x D1=x | move Src=x D2=x => move_dup Src D1 D2
+move Src=x SD=x | move SD=x D=x => move_dup Src SD D
+move Src=x D1=x | move Src=x D2=y => move_dup Src D1 D2
+move Src=y SD=x | move SD=x D=y => move_dup Src SD D
+move Src=x SD=x | move SD=x D=y => move_dup Src SD D
+move Src=y SD=x | move SD=x D=x => move_dup Src SD D
+
+move SD=x D=x | move Src=xy SD=x => move_shift Src SD D
+move SD=y D=x | move Src=x SD=y => move_shift Src SD D
+move SD=x D=y | move Src=x SD=x => move_shift Src SD D
+
+# The transformations above guarantee that the source for
+# the second move is not the same as the destination for
+# the first move. That means that we can do the moves in
+# parallel (fetch both values, then store them) which could
+# be faster.
+
+move X1=x Y1=y | move X2=x Y2=y => move2_par X1 Y1 X2 Y2
+move Y1=y X1=x | move Y2=y X2=x => move2_par Y1 X1 Y2 X2
+
+move X1=x X2=x | move X3=x X4=x => move2_par X1 X2 X3 X4
+
+move X1=x X2=x | move X3=x Y1=y => move2_par X1 X2 X3 Y1
+
+move S1=x S2=x | move X1=x Y1=y => move2_par S1 S2 X1 Y1
+
+move S1=y S2=x | move X1=x Y1=y => move2_par S1 S2 X1 Y1
+
+move Y1=y X1=x | move S1=x D1=x => move2_par Y1 X1 S1 D1
+move S1=x D1=x | move Y1=y X1=x => move2_par S1 D1 Y1 X1
+
+move2_par X1=x Y1=y X2=x Y2=y | move X3=x Y3=y => move3 X1 Y1 X2 Y2 X3 Y3
+move2_par Y1=y X1=x Y2=y X2=x | move Y3=y X3=x => move3 Y1 X1 Y2 X2 Y3 X3
+move2_par X1=x X2=x X3=x X4=x | move X5=x X6=x => move3 X1 X2 X3 X4 X5 X6
move C=aiq X=x==1 => move_x1 C
move C=aiq X=x==2 => move_x2 C
@@ -348,21 +369,32 @@ move C=aiq X=x==2 => move_x2 C
move_x1 c
move_x2 c
-%macro: move2 Move2 -pack
-move2 x y x y
-move2 y x y x
-move2 x x x x
+%macro: move_shift MoveShift -pack
+move_shift x x x
+move_shift y x x
+move_shift x y x
+move_shift x x y
+
+%macro: move_dup MoveDup -pack
+move_dup x x x
+move_dup x x y
+move_dup y x x
+move_dup y x y
-move2 x r x x
+%macro: move2_par Move2Par -pack
-move2 x r x y
-move2 r y x y
-move2 y r x y
+move2_par x y x y
+move2_par y x y x
+move2_par x x x x
-move2 r x y x
-move2 y x r x
+move2_par x x x y
-%macro: move3 Move3
+move2_par y x x y
+
+move2_par x x y x
+move2_par y x x x
+
+%macro: move3 Move3 -pack
move3 x y x y x y
move3 y x y x y x
move3 x x x x x x
@@ -375,20 +407,22 @@ move S=c D=y => move S x | move x D
%macro:move Move -pack -gen_dest
move x x
move x y
-move x r
move y x
-move y r
-move r x
-move r y
-move c r
move c x
move n x
-move n r
move y y
+# The following move instructions using x(0) are frequently used.
+
+move x r
+move r x
+move y r
+move c r
+move r y
+
# Receive operations.
-loop_rec Fail Src | smp_mark_target_label(Fail) => i_loop_rec Fail Src
+loop_rec Fail x==0 | smp_mark_target_label(Fail) => i_loop_rec Fail
label L | wait_timeout Fail Src | smp_already_locked(L) => label L | i_wait_timeout_locked Fail Src
wait_timeout Fail Src => i_wait_timeout Fail Src
@@ -403,7 +437,7 @@ label L | timeout | smp_already_locked(L) => label L | timeout_locked
remove_message
timeout
timeout_locked
-i_loop_rec f r
+i_loop_rec f
loop_rec_end f
wait f
wait_locked f
@@ -421,93 +455,57 @@ send
# Optimized comparisons with one immediate/literal operand.
#
-is_eq_exact Lbl R=rxy C=ian => i_is_eq_exact_immed Lbl R C
-is_eq_exact Lbl R=rxy C=q => i_is_eq_exact_literal R Lbl C
+is_eq_exact Lbl R=xy C=ian => i_is_eq_exact_immed Lbl R C
+is_eq_exact Lbl R=xy C=q => i_is_eq_exact_literal Lbl R C
-is_ne_exact Lbl R=rxy C=ian => i_is_ne_exact_immed Lbl R C
-is_ne_exact Lbl R=rxy C=q => i_is_ne_exact_literal R Lbl C
+is_ne_exact Lbl R=xy C=ian => i_is_ne_exact_immed Lbl R C
+is_ne_exact Lbl R=xy C=q => i_is_ne_exact_literal Lbl R C
%macro: i_is_eq_exact_immed EqualImmed -fail_action
i_is_eq_exact_immed f r c
i_is_eq_exact_immed f x c
i_is_eq_exact_immed f y c
-i_is_eq_exact_literal r f c
-i_is_eq_exact_literal x f c
-i_is_eq_exact_literal y f c
+i_is_eq_exact_literal f x c
+i_is_eq_exact_literal f y c
%macro: i_is_ne_exact_immed NotEqualImmed -fail_action
-i_is_ne_exact_immed f r c
i_is_ne_exact_immed f x c
i_is_ne_exact_immed f y c
-i_is_ne_exact_literal r f c
-i_is_ne_exact_literal x f c
-i_is_ne_exact_literal y f c
-
-#
-# Common Compare Specializations
-# We don't do all of them since we want
-# to keep the instruction set small-ish
-#
-
-is_eq_exact Lbl S1=xy S2=r => is_eq_exact Lbl S2 S1
-is_eq_exact Lbl S1=rx S2=xy => i_is_eq_exact_spec Lbl S1 S2
-%macro: i_is_eq_exact_spec EqualExact -fail_action
-
-i_is_eq_exact_spec f x x
-i_is_eq_exact_spec f x y
-i_is_eq_exact_spec f r x
-i_is_eq_exact_spec f r y
-%cold
-i_is_eq_exact_spec f r r
-%hot
+i_is_ne_exact_literal f x c
+i_is_ne_exact_literal f y c
-is_lt Lbl S1=rxc S2=rxc => i_is_lt_spec Lbl S1 S2
+is_eq_exact Lbl Y=y X=x => is_eq_exact Lbl X Y
+%macro: is_eq_exact EqualExact -fail_action -pack
+is_eq_exact f x x
+is_eq_exact f x y
+is_eq_exact f s s
-%macro: i_is_lt_spec IsLessThan -fail_action
-
-i_is_lt_spec f x x
-i_is_lt_spec f x r
-i_is_lt_spec f x c
-i_is_lt_spec f r x
-i_is_lt_spec f r c
-i_is_lt_spec f c x
-i_is_lt_spec f c r
+%macro: is_lt IsLessThan -fail_action
+is_lt f x x
+is_lt f x c
+is_lt f c x
%cold
-i_is_lt_spec f r r
-i_is_lt_spec f c c
+is_lt f s s
%hot
-is_ge Lbl S1=xc S2=xc => i_is_ge_spec Lbl S1 S2
-
-%macro: i_is_ge_spec IsGreaterEqual -fail_action
-
-i_is_ge_spec f x x
-i_is_ge_spec f x c
-i_is_ge_spec f c x
+%macro: is_ge IsGreaterEqual -fail_action
+is_ge f x x
+is_ge f x c
+is_ge f c x
%cold
-i_is_ge_spec f c c
+is_ge f s s
%hot
-#
-# All other comparisons.
-#
+%macro: is_ne_exact NotEqualExact -fail_action
+is_ne_exact f s s
-is_eq_exact Lbl S1 S2 => i_fetch S1 S2 | i_is_eq_exact Lbl
-is_ne_exact Lbl S1 S2 => i_fetch S1 S2 | i_is_ne_exact Lbl
+%macro: is_eq Equal -fail_action
+is_eq f s s
-is_lt Lbl S1 S2 => i_fetch S1 S2 | i_is_lt Lbl
-is_ge Lbl S1 S2 => i_fetch S1 S2 | i_is_ge Lbl
-is_eq Lbl S1 S2 => i_fetch S1 S2 | i_is_eq Lbl
-is_ne Lbl S1 S2 => i_fetch S1 S2 | i_is_ne Lbl
-
-i_is_eq_exact f
-i_is_ne_exact f
-i_is_lt f
-i_is_ge f
-i_is_eq f
-i_is_ne f
+%macro: is_ne NotEqual -fail_action
+is_ne f s s
#
# Putting things.
@@ -525,7 +523,6 @@ i_put_tuple Dst Arity Puts=* | put S => \
i_put_tuple/2
%macro:i_put_tuple PutTuple -pack -goto:do_put_tuple
-i_put_tuple r I
i_put_tuple x I
i_put_tuple y I
@@ -542,74 +539,36 @@ put_list x n x
put_list y n x
put_list x x x
put_list y x x
-put_list x x r
-put_list y r r
put_list y y x
put_list x y x
-put_list r x x
-put_list r y x
-put_list r x r
-put_list y y r
-put_list y r x
-put_list r n x
-put_list x r x
-put_list x y r
-put_list y x r
put_list y x x
-put_list x r r
-
# put_list SrcReg Constant Dst
-put_list r c r
-put_list r c x
-put_list r c y
-put_list x c r
put_list x c x
put_list x c y
-put_list y c r
put_list y c x
-put_list y c y
# put_list Constant SrcReg Dst
-put_list c r r
-put_list c r x
-put_list c r y
-put_list c x r
put_list c x x
-put_list c x y
-
-put_list c y r
put_list c y x
-put_list c y y
-%cold
-put_list s s d
-%hot
+# The following put_list instructions using x(0) are frequently used.
-%macro: i_fetch FetchArgs -pack
-i_fetch c r
-i_fetch c x
-i_fetch c y
-i_fetch r c
-i_fetch r x
-i_fetch r y
-i_fetch x c
-i_fetch x r
-i_fetch x x
-i_fetch x y
-i_fetch y c
-i_fetch y r
-i_fetch y x
-i_fetch y y
+put_list y r r
+put_list x r r
+put_list r n r
+put_list r n x
+put_list r x x
+put_list r x r
+put_list x x r
%cold
-i_fetch c c
-i_fetch s s
+put_list s s d
%hot
#
@@ -631,27 +590,27 @@ return_trace
# Note: There is no 'move_return y r', since there never are any y registers
# when we do move_return (if we have y registers, we must do move_deallocate_return).
-move S r | return => move_return S r
+move S x==0 | return => move_return S
%macro: move_return MoveReturn -nonext
-move_return x r
-move_return c r
-move_return n r
+move_return x
+move_return c
+move_return n
-move S r | deallocate D | return => move_deallocate_return S r D
+move S x==0 | deallocate D | return => move_deallocate_return S D
%macro: move_deallocate_return MoveDeallocateReturn -pack -nonext
-move_deallocate_return x r Q
-move_deallocate_return y r Q
-move_deallocate_return c r Q
-move_deallocate_return n r Q
+move_deallocate_return x Q
+move_deallocate_return y Q
+move_deallocate_return c Q
+move_deallocate_return n Q
deallocate D | return => deallocate_return D
%macro: deallocate_return DeallocateReturn -nonext
deallocate_return Q
-test_heap Need u==1 | put_list Y=y r r => test_heap_1_put_list Need Y
+test_heap Need u==1 | put_list Y=y x==0 x==0 => test_heap_1_put_list Need Y
%macro: test_heap_1_put_list TestHeapPutList -pack
test_heap_1_put_list I y
@@ -660,18 +619,18 @@ test_heap_1_put_list I y
is_tuple Fail Literal=q => move Literal x | is_tuple Fail x
is_tuple Fail=f c => jump Fail
-is_tuple Fail=f S=rxy | test_arity Fail=f S=rxy Arity => is_tuple_of_arity Fail S Arity
+is_tuple Fail=f S=xy | test_arity Fail=f S=xy Arity => is_tuple_of_arity Fail S Arity
%macro:is_tuple_of_arity IsTupleOfArity -fail_action
+is_tuple_of_arity f r A
is_tuple_of_arity f x A
is_tuple_of_arity f y A
-is_tuple_of_arity f r A
%macro: is_tuple IsTuple -fail_action
+is_tuple f r
is_tuple f x
is_tuple f y
-is_tuple f r
test_arity Fail Literal=q Arity => move Literal x | test_arity Fail x Arity
test_arity Fail=f c Arity => jump Fail
@@ -679,95 +638,63 @@ test_arity Fail=f c Arity => jump Fail
%macro: test_arity IsArity -fail_action
test_arity f x A
test_arity f y A
-test_arity f r A
-
-is_tuple_of_arity Fail=f Reg Arity | get_tuple_element Reg P=u==0 Dst=xy => \
- is_tuple_of_arity Fail Reg Arity | extract_next_element Dst | original_reg Reg P
-
-test_arity Fail Reg Arity | get_tuple_element Reg P=u==0 Dst=xy => \
- test_arity Fail Reg Arity | extract_next_element Dst | original_reg Reg P
-
-original_reg Reg P1 | get_tuple_element Reg P2 Dst=xy | succ(P1, P2) => \
- extract_next_element Dst | original_reg Reg P2
-
-get_tuple_element Reg P Dst => i_get_tuple_element Reg P Dst | original_reg Reg P
-
-original_reg Reg Pos =>
-
-original_reg/2
-
-extract_next_element D1=xy | original_reg Reg P1 | get_tuple_element Reg P2 D2=xy | \
-succ(P1, P2) | succ(D1, D2) => \
- extract_next_element2 D1 | original_reg Reg P2
-
-extract_next_element2 D1=xy | original_reg Reg P1 | get_tuple_element Reg P2 D2=xy | \
-succ(P1, P2) | succ2(D1, D2) => \
- extract_next_element3 D1 | original_reg Reg P2
-
-#extract_next_element3 D1=xy | original_reg Reg P1 | get_tuple_element Reg P2 D2=xy | \
-#succ(P1, P2) | succ3(D1, D2) => \
-# extract_next_element4 D1 | original_reg Reg P2
-
-%macro: extract_next_element ExtractNextElement -pack
-extract_next_element x
-extract_next_element y
-%macro: extract_next_element2 ExtractNextElement2 -pack
-extract_next_element2 x
-extract_next_element2 y
+get_tuple_element Reg=x P1 D1=x | get_tuple_element Reg=x P2 D2=x | \
+ get_tuple_element Reg=x P3 D3=x | \
+ succ(P1, P2) | succ(P2, P3) | \
+ succ(D1, D2) | succ(D2, D3) => i_get_tuple_element3 Reg P1 D1
-%macro: extract_next_element3 ExtractNextElement3 -pack
-extract_next_element3 x
-extract_next_element3 y
+get_tuple_element Reg=x P1 D1=x | get_tuple_element Reg=x P2 D2=x | \
+ succ(P1, P2) | succ(D1, D2) => i_get_tuple_element2 Reg P1 D1
-#%macro: extract_next_element4 ExtractNextElement4 -pack
-#extract_next_element4 x
-#extract_next_element4 y
+get_tuple_element Reg P Dst => i_get_tuple_element Reg P Dst
is_integer Fail=f i =>
is_integer Fail=f an => jump Fail
is_integer Fail Literal=q => move Literal x | is_integer Fail x
-is_integer Fail=f S=rx | allocate Need Regs => is_integer_allocate Fail S Need Regs
+is_integer Fail=f S=x | allocate Need Regs => is_integer_allocate Fail S Need Regs
%macro: is_integer_allocate IsIntegerAllocate -fail_action
is_integer_allocate f x I I
-is_integer_allocate f r I I
%macro: is_integer IsInteger -fail_action
is_integer f x
is_integer f y
-is_integer f r
is_list Fail=f n =>
is_list Fail Literal=q => move Literal x | is_list Fail x
is_list Fail=f c => jump Fail
%macro: is_list IsList -fail_action
-is_list f r
is_list f x
%cold
is_list f y
%hot
-is_nonempty_list Fail=f S=rx | allocate Need Rs => is_nonempty_list_allocate Fail S Need Rs
+is_nonempty_list Fail=f S=x | allocate Need Rs => is_nonempty_list_allocate Fail S Need Rs
%macro:is_nonempty_list_allocate IsNonemptyListAllocate -fail_action -pack
-is_nonempty_list_allocate f x I t
is_nonempty_list_allocate f r I t
+is_nonempty_list_allocate f x I t
-is_nonempty_list F=f r | test_heap I1 I2 => is_non_empty_list_test_heap F r I1 I2
+is_nonempty_list F=f x==0 | test_heap I1 I2 => is_non_empty_list_test_heap F I1 I2
%macro: is_non_empty_list_test_heap IsNonemptyListTestHeap -fail_action -pack
-is_non_empty_list_test_heap f r I t
+is_non_empty_list_test_heap f I t
+
+is_nonempty_list Fail=f S=x | get_list S D1=x D2=x => \
+ is_nonempty_list_get_list Fail S D1 D2
+
+%macro: is_nonempty_list_get_list IsNonemptyListGetList -fail_action -pack
+is_nonempty_list_get_list f r x x
+is_nonempty_list_get_list f x x x
%macro: is_nonempty_list IsNonemptyList -fail_action
is_nonempty_list f x
is_nonempty_list f y
-is_nonempty_list f r
%macro: is_atom IsAtom -fail_action
is_atom f x
-is_atom f r
%cold
is_atom f y
%hot
@@ -775,7 +702,6 @@ is_atom Fail=f a =>
is_atom Fail=f niq => jump Fail
%macro: is_float IsFloat -fail_action
-is_float f r
is_float f x
%cold
is_float f y
@@ -789,12 +715,10 @@ is_nil Fail=f qia => jump Fail
%macro: is_nil IsNil -fail_action
is_nil f x
is_nil f y
-is_nil f r
is_binary Fail Literal=q => move Literal x | is_binary Fail x
is_binary Fail=f c => jump Fail
%macro: is_binary IsBinary -fail_action
-is_binary f r
is_binary f x
%cold
is_binary f y
@@ -806,7 +730,6 @@ is_bitstr Fail Term => is_bitstring Fail Term
is_bitstring Fail Literal=q => move Literal x | is_bitstring Fail x
is_bitstring Fail=f c => jump Fail
%macro: is_bitstring IsBitstring -fail_action
-is_bitstring f r
is_bitstring f x
%cold
is_bitstring f y
@@ -814,7 +737,6 @@ is_bitstring f y
is_reference Fail=f cq => jump Fail
%macro: is_reference IsRef -fail_action
-is_reference f r
is_reference f x
%cold
is_reference f y
@@ -822,7 +744,6 @@ is_reference f y
is_pid Fail=f cq => jump Fail
%macro: is_pid IsPid -fail_action
-is_pid f r
is_pid f x
%cold
is_pid f y
@@ -830,7 +751,6 @@ is_pid f y
is_port Fail=f cq => jump Fail
%macro: is_port IsPort -fail_action
-is_port f r
is_port f x
%cold
is_port f y
@@ -842,14 +762,12 @@ is_boolean Fail=f ac => jump Fail
%cold
%macro: is_boolean IsBoolean -fail_action
-is_boolean f r
is_boolean f x
is_boolean f y
%hot
is_function2 Fail=f acq Arity => jump Fail
is_function2 Fail=f Fun a => jump Fail
-is_function2 Fail Fun Literal=q => move Literal x | is_function2 Fail Fun x
is_function2 f s s
%macro: is_function2 IsFunction2 -fail_action
@@ -989,76 +907,76 @@ call_ext_only u==3 u$func:erlang:hibernate/3 => i_hibernate
%unless USE_VM_PROBES
call_ext Arity u$func:erlang:dt_get_tag/0 => \
- move a=am_undefined r
+ move a=am_undefined x=0
call_ext_last Arity u$func:erlang:dt_get_tag/0 D => \
- move a=am_undefined r | deallocate D | return
+ move a=am_undefined x=0 | deallocate D | return
call_ext_only Arity u$func:erlang:dt_get_tag/0 => \
- move a=am_undefined r | return
-
-move Any r | call_ext Arity u$func:erlang:dt_put_tag/1 => \
- move a=am_undefined r
-move Any r | call_ext_last Arity u$func:erlang:dt_put_tag/1 D => \
- move a=am_undefined r | deallocate D | return
-move Any r | call_ext_only Arity u$func:erlang:dt_put_tag/1 => \
- move a=am_undefined r | return
+ move a=am_undefined x=0 | return
+
+move Any x==0 | call_ext Arity u$func:erlang:dt_put_tag/1 => \
+ move a=am_undefined x=0
+move Any x==0 | call_ext_last Arity u$func:erlang:dt_put_tag/1 D => \
+ move a=am_undefined x=0 | deallocate D | return
+move Any x==0 | call_ext_only Arity u$func:erlang:dt_put_tag/1 => \
+ move a=am_undefined x=0 | return
call_ext Arity u$func:erlang:dt_put_tag/1 => \
- move a=am_undefined r
+ move a=am_undefined x=0
call_ext_last Arity u$func:erlang:dt_put_tag/1 D => \
- move a=am_undefined r | deallocate D | return
+ move a=am_undefined x=0 | deallocate D | return
call_ext_only Arity u$func:erlang:dt_put_tag/1 => \
- move a=am_undefined r | return
+ move a=am_undefined x=0 | return
call_ext Arity u$func:erlang:dt_get_tag_data/0 => \
- move a=am_undefined r
+ move a=am_undefined x=0
call_ext_last Arity u$func:erlang:dt_get_tag_data/0 D => \
- move a=am_undefined r | deallocate D | return
+ move a=am_undefined x=0 | deallocate D | return
call_ext_only Arity u$func:erlang:dt_get_tag_data/0 => \
- move a=am_undefined r | return
-
-move Any r | call_ext Arity u$func:erlang:dt_spread_tag/1 => \
- move a=am_true r
-move Any r | call_ext_last Arity u$func:erlang:dt_spread_tag/1 D => \
- move a=am_true r | deallocate D | return
-move Any r | call_ext_only Arity u$func:erlang:dt_spread_tag/1 => \
- move a=am_true r | return
+ move a=am_undefined x=0 | return
+
+move Any x==0 | call_ext Arity u$func:erlang:dt_spread_tag/1 => \
+ move a=am_true x=0
+move Any x==0 | call_ext_last Arity u$func:erlang:dt_spread_tag/1 D => \
+ move a=am_true x=0 | deallocate D | return
+move Any x==0 | call_ext_only Arity u$func:erlang:dt_spread_tag/1 => \
+ move a=am_true x=0 | return
call_ext Arity u$func:erlang:dt_spread_tag/1 => \
- move a=am_true r
+ move a=am_true x=0
call_ext_last Arity u$func:erlang:dt_spread_tag/1 D => \
- move a=am_true r | deallocate D | return
+ move a=am_true x=0 | deallocate D | return
call_ext_only Arity u$func:erlang:dt_spread_tag/1 => \
- move a=am_true r | return
-
-move Any r | call_ext Arity u$func:erlang:dt_restore_tag/1 => \
- move a=am_true r
-move Any r | call_ext_last Arity u$func:erlang:dt_restore_tag/1 D => \
- move a=am_true r | deallocate D | return
-move Any r | call_ext_only Arity u$func:erlang:dt_restore_tag/1 => \
- move a=am_true r | return
+ move a=am_true x=0 | return
+
+move Any x==0 | call_ext Arity u$func:erlang:dt_restore_tag/1 => \
+ move a=am_true x=0
+move Any x==0 | call_ext_last Arity u$func:erlang:dt_restore_tag/1 D => \
+ move a=am_true x=0 | deallocate D | return
+move Any x==0 | call_ext_only Arity u$func:erlang:dt_restore_tag/1 => \
+ move a=am_true x=0 | return
call_ext Arity u$func:erlang:dt_restore_tag/1 => \
- move a=am_true r
+ move a=am_true x=0
call_ext_last Arity u$func:erlang:dt_restore_tag/1 D => \
- move a=am_true r | deallocate D | return
+ move a=am_true x=0 | deallocate D | return
call_ext_only Arity u$func:erlang:dt_restore_tag/1 => \
- move a=am_true r | return
-
-move Any r | call_ext Arity u$func:erlang:dt_prepend_vm_tag_data/1 => \
- move Any r
-move Any r | call_ext_last Arity u$func:erlang:dt_prepend_vm_tag_data/1 D => \
- move Any r | deallocate D | return
-move Any r | call_ext_only Arity u$func:erlang:dt_prepend_vm_tag_data/1 => \
- move Any r | return
+ move a=am_true x=0 | return
+
+move Any x==0 | call_ext Arity u$func:erlang:dt_prepend_vm_tag_data/1 => \
+ move Any x=0
+move Any x==0 | call_ext_last Arity u$func:erlang:dt_prepend_vm_tag_data/1 D => \
+ move Any x=0 | deallocate D | return
+move Any x==0 | call_ext_only Arity u$func:erlang:dt_prepend_vm_tag_data/1 => \
+ move Any x=0 | return
call_ext Arity u$func:erlang:dt_prepend_vm_tag_data/1 =>
call_ext_last Arity u$func:erlang:dt_prepend_vm_tag_data/1 D => \
deallocate D | return
call_ext_only Arity u$func:erlang:dt_prepend_vm_tag_data/1 => \
return
-move Any r | call_ext Arity u$func:erlang:dt_append_vm_tag_data/1 => \
- move Any r
-move Any r | call_ext_last Arity u$func:erlang:dt_append_vm_tag_data/1 D => \
- move Any r | deallocate D | return
-move Any r | call_ext_only Arity u$func:erlang:dt_append_vm_tag_data/1 => \
- move Any r | return
+move Any x==0 | call_ext Arity u$func:erlang:dt_append_vm_tag_data/1 => \
+ move Any x=0
+move Any x==0 | call_ext_last Arity u$func:erlang:dt_append_vm_tag_data/1 D => \
+ move Any x=0 | deallocate D | return
+move Any x==0 | call_ext_only Arity u$func:erlang:dt_append_vm_tag_data/1 => \
+ move Any x=0 | return
call_ext Arity u$func:erlang:dt_append_vm_tag_data/1 =>
call_ext_last Arity u$func:erlang:dt_append_vm_tag_data/1 D => \
deallocate D | return
@@ -1066,7 +984,7 @@ call_ext_only Arity u$func:erlang:dt_append_vm_tag_data/1 => \
return
# Can happen after one of the transformations above.
-move Discarded r | move Something r => move Something r
+move Discarded x==0 | move Something x==0 => move Something x=0
%endif
@@ -1091,9 +1009,9 @@ call_ext_only Ar=u Bif=u$is_bif => \
# with call instructions.
#
-move S=c r | call_ext Ar=u Func=u$is_not_bif => i_move_call_ext S r Func
-move S=c r | call_ext_last Ar=u Func=u$is_not_bif D => i_move_call_ext_last Func D S r
-move S=c r | call_ext_only Ar=u Func=u$is_not_bif => i_move_call_ext_only Func S r
+move S=c x==0 | call_ext Ar=u Func=u$is_not_bif => i_move_call_ext S Func
+move S=c x==0 | call_ext_last Ar=u Func=u$is_not_bif D => i_move_call_ext_last Func D S
+move S=c x==0 | call_ext_only Ar=u Func=u$is_not_bif => i_move_call_ext_only Func S
call_ext Ar Func => i_call_ext Func
call_ext_last Ar Func D => i_call_ext_last Func D
@@ -1120,78 +1038,71 @@ bif0 u$bif:erlang:node/0 Dst=d => node Dst
bif1 Fail Bif=u$bif:erlang:get/1 Src=s Dst=d => i_get Src Dst
-bif2 Jump=j u$bif:erlang:element/2 S1=s S2=rxy Dst=d => gen_element(Jump, S1, S2, Dst)
+bif2 Jump=j u$bif:erlang:element/2 S1=s S2=xy Dst=d => gen_element(Jump, S1, S2, Dst)
-bif1 Fail Bif Literal=q Dst => move Literal x | bif1 Fail Bif x Dst
bif1 p Bif S1 Dst => bif1_body Bif S1 Dst
-bif1_body Bif Literal=q Dst => move Literal x | bif1_body Bif x Dst
-
-bif2 p Bif S1 S2 Dst => i_fetch S1 S2 | i_bif2_body Bif Dst
-bif2 Fail Bif S1 S2 Dst => i_fetch S1 S2 | i_bif2 Fail Bif Dst
+bif2 p Bif S1 S2 Dst => i_bif2_body Bif S1 S2 Dst
+bif2 Fail Bif S1 S2 Dst => i_bif2 Fail Bif S1 S2 Dst
i_get s d
%macro: self Self
-self r
self x
self y
%macro: node Node
-node r
node x
%cold
node y
%hot
-i_fast_element r j I d
-i_fast_element x j I d
-i_fast_element y j I d
+i_fast_element j x I d
+i_fast_element j y I d
-i_element r j s d
-i_element x j s d
-i_element y j s d
+i_element j x s d
+i_element j y s d
bif1 f b s d
bif1_body b s d
-i_bif2 f b d
-i_bif2_body b d
+i_bif2 f b s s d
+i_bif2_body b s s d
#
# Internal calls.
#
-move S=c r | call Ar P=f => i_move_call S r P
-move S=s r | call Ar P=f => move_call S r P
+move S=c x==0 | call Ar P=f => i_move_call S P
+move S=s x==0 | call Ar P=f => move_call S P
-i_move_call c r f
+i_move_call c f
%macro:move_call MoveCall -arg_f -size -nonext
-move_call/3
+move_call/2
-move_call x r f
-move_call y r f
+move_call x f
+move_call y f
-move S=c r | call_last Ar P=f D => i_move_call_last P D S r
-move S r | call_last Ar P=f D => move_call_last S r P D
+move S=c x==0 | call_last Ar P=f D => i_move_call_last P D S
+move S x==0 | call_last Ar P=f D => move_call_last S P D
-i_move_call_last f P c r
+i_move_call_last f P c
%macro:move_call_last MoveCallLast -arg_f -nonext -pack
-move_call_last/4
-move_call_last x r f Q
-move_call_last y r f Q
+move_call_last/3
+move_call_last x f Q
+move_call_last y f Q
-move S=c r | call_only Ar P=f => i_move_call_only P S r
-move S=x r | call_only Ar P=f => move_call_only S r P
+move S=c x==0 | call_only Ar P=f => i_move_call_only P S
+move S=x x==0 | call_only Ar P=f => move_call_only S P
-i_move_call_only f c r
+i_move_call_only f c
%macro:move_call_only MoveCallOnly -arg_f -nonext
-move_call_only/3
+move_call_only/2
-move_call_only x r f
+move_call_only x f
call Ar Func => i_call Func
call_last Ar Func D => i_call_last Func D
@@ -1205,9 +1116,9 @@ i_call_ext e
i_call_ext_last e P
i_call_ext_only e
-i_move_call_ext c r e
-i_move_call_ext_last e P c r
-i_move_call_ext_only e c r
+i_move_call_ext c e
+i_move_call_ext_last e P c
+i_move_call_ext_only e c
# Fun calls.
@@ -1227,7 +1138,6 @@ i_make_fun I t
%macro: is_function IsFunction -fail_action
is_function f x
is_function f y
-is_function f r
is_function Fail=f c => jump Fail
func_info M F A => i_func_info u M F A
@@ -1239,131 +1149,105 @@ func_info M F A => i_func_info u M F A
%cold
bs_start_match2 Fail=f ica X Y D => jump Fail
bs_start_match2 Fail Bin X Y D => i_bs_start_match2 Bin Fail X Y D
-i_bs_start_match2 r f I I d
i_bs_start_match2 x f I I d
i_bs_start_match2 y f I I d
bs_save2 Reg Index => gen_bs_save(Reg, Index)
-i_bs_save2 r I
i_bs_save2 x I
bs_restore2 Reg Index => gen_bs_restore(Reg, Index)
-i_bs_restore2 r I
i_bs_restore2 x I
# Matching integers
bs_match_string Fail Ms Bits Val => i_bs_match_string Ms Fail Bits Val
-i_bs_match_string r f I I
i_bs_match_string x f I I
# Fetching integers from binaries.
-bs_get_integer2 Fail=f Ms=rx Live=u Sz=sq Unit=u Flags=u Dst=d => \
+bs_get_integer2 Fail=f Ms=x Live=u Sz=sq Unit=u Flags=u Dst=d => \
gen_get_integer2(Fail, Ms, Live, Sz, Unit, Flags, Dst)
-i_bs_get_integer_small_imm r I f I d
i_bs_get_integer_small_imm x I f I d
-i_bs_get_integer_imm r I I f I d
i_bs_get_integer_imm x I I f I d
-i_bs_get_integer f I I d
-i_bs_get_integer_8 r f d
+i_bs_get_integer f I I s s d
i_bs_get_integer_8 x f d
-i_bs_get_integer_16 r f d
i_bs_get_integer_16 x f d
-i_bs_get_integer_32 r f I d
i_bs_get_integer_32 x f I d
# Fetching binaries from binaries.
-bs_get_binary2 Fail=f Ms=rx Live=u Sz=sq Unit=u Flags=u Dst=d => \
+bs_get_binary2 Fail=f Ms=x Live=u Sz=sq Unit=u Flags=u Dst=d => \
gen_get_binary2(Fail, Ms, Live, Sz, Unit, Flags, Dst)
%macro: i_bs_get_binary_imm2 BsGetBinaryImm_2 -fail_action -gen_dest
%macro: i_bs_get_binary2 BsGetBinary_2 -fail_action -gen_dest
%macro: i_bs_get_binary_all2 BsGetBinaryAll_2 -fail_action -gen_dest
-i_bs_get_binary_imm2 f r I I I d
i_bs_get_binary_imm2 f x I I I d
-i_bs_get_binary2 f r I s I d
i_bs_get_binary2 f x I s I d
-i_bs_get_binary_all2 f r I I d
i_bs_get_binary_all2 f x I I d
-i_bs_get_binary_all_reuse r f I
i_bs_get_binary_all_reuse x f I
# Fetching float from binaries.
-bs_get_float2 Fail=f Ms=rx Live=u Sz=s Unit=u Flags=u Dst=d => \
+bs_get_float2 Fail=f Ms=x Live=u Sz=s Unit=u Flags=u Dst=d => \
gen_get_float2(Fail, Ms, Live, Sz, Unit, Flags, Dst)
-bs_get_float2 Fail=f Ms=rx Live=u Sz=q Unit=u Flags=u Dst=d => jump Fail
+bs_get_float2 Fail=f Ms=x Live=u Sz=q Unit=u Flags=u Dst=d => jump Fail
%macro: i_bs_get_float2 BsGetFloat2 -fail_action -gen_dest
-i_bs_get_float2 f r I s I d
i_bs_get_float2 f x I s I d
# Miscellanous
-bs_skip_bits2 Fail=f Ms=rx Sz=s Unit=u Flags=u => \
- gen_skip_bits2(Fail, Ms, Sz, Unit, Flags)
-bs_skip_bits2 Fail=f Ms=rx Sz=q Unit=u Flags=u => \
+bs_skip_bits2 Fail=f Ms=x Sz=sq Unit=u Flags=u => \
gen_skip_bits2(Fail, Ms, Sz, Unit, Flags)
%macro: i_bs_skip_bits_imm2 BsSkipBitsImm2 -fail_action
-i_bs_skip_bits_imm2 f r I
i_bs_skip_bits_imm2 f x I
%macro: i_bs_skip_bits2 BsSkipBits2 -fail_action
-i_bs_skip_bits2 f r x I
-i_bs_skip_bits2 f r y I
i_bs_skip_bits2 f x x I
-i_bs_skip_bits2 f x r I
i_bs_skip_bits2 f x y I
%macro: i_bs_skip_bits_all2 BsSkipBitsAll2 -fail_action
-i_bs_skip_bits_all2 f r I
i_bs_skip_bits_all2 f x I
-bs_test_tail2 Fail=f Ms=rx Bits=u==0 => bs_test_zero_tail2 Fail Ms
-bs_test_tail2 Fail=f Ms=rx Bits=u => bs_test_tail_imm2 Fail Ms Bits
-bs_test_zero_tail2 f r
+bs_test_tail2 Fail=f Ms=x Bits=u==0 => bs_test_zero_tail2 Fail Ms
+bs_test_tail2 Fail=f Ms=x Bits=u => bs_test_tail_imm2 Fail Ms Bits
bs_test_zero_tail2 f x
-bs_test_tail_imm2 f r I
bs_test_tail_imm2 f x I
bs_test_unit F Ms Unit=u==8 => bs_test_unit8 F Ms
-bs_test_unit f r I
bs_test_unit f x I
-bs_test_unit8 f r
bs_test_unit8 f x
-bs_context_to_binary r
+# An y register operand for bs_context_to_binary is rare,
+# but can happen because of inlining.
+
+bs_context_to_binary Y=y => move Y x | bs_context_to_binary x
+
bs_context_to_binary x
-bs_context_to_binary y
#
# Utf8/utf16/utf32 support. (R12B-5)
#
-bs_get_utf8 Fail=f Ms=rx u u Dst=d => i_bs_get_utf8 Ms Fail Dst
-i_bs_get_utf8 r f d
+bs_get_utf8 Fail=f Ms=x u u Dst=d => i_bs_get_utf8 Ms Fail Dst
i_bs_get_utf8 x f d
-bs_skip_utf8 Fail=f Ms=rx u u => i_bs_get_utf8 Ms Fail x
+bs_skip_utf8 Fail=f Ms=x u u => i_bs_get_utf8 Ms Fail x
-bs_get_utf16 Fail=f Ms=rx u Flags=u Dst=d => i_bs_get_utf16 Ms Fail Flags Dst
-bs_skip_utf16 Fail=f Ms=rx u Flags=u => i_bs_get_utf16 Ms Fail Flags x
+bs_get_utf16 Fail=f Ms=x u Flags=u Dst=d => i_bs_get_utf16 Ms Fail Flags Dst
+bs_skip_utf16 Fail=f Ms=x u Flags=u => i_bs_get_utf16 Ms Fail Flags x
-i_bs_get_utf16 r f I d
i_bs_get_utf16 x f I d
-bs_get_utf32 Fail=f Ms=rx Live=u Flags=u Dst=d => \
+bs_get_utf32 Fail=f Ms=x Live=u Flags=u Dst=d => \
bs_get_integer2 Fail Ms Live i=32 u=1 Flags Dst | \
- i_fetch Dst Ms | \
- i_bs_validate_unicode_retract Fail
-bs_skip_utf32 Fail=f Ms=rx Live=u Flags=u => \
+ i_bs_validate_unicode_retract Fail Dst Ms
+bs_skip_utf32 Fail=f Ms=x Live=u Flags=u => \
bs_get_integer2 Fail Ms Live i=32 u=1 Flags x | \
- i_fetch x Ms | \
- i_bs_validate_unicode_retract Fail
+ i_bs_validate_unicode_retract Fail x Ms
-i_bs_validate_unicode_retract j
+i_bs_validate_unicode_retract j s s
%hot
#
@@ -1385,13 +1269,12 @@ bs_init2 Fail Sz=u Words Regs Flags Dst => \
bs_init2 Fail Sz Words=u==0 Regs Flags Dst => \
i_bs_init_fail Sz Fail Regs Dst
bs_init2 Fail Sz Words Regs Flags Dst => \
- i_fetch Sz r | i_bs_init_fail_heap Words Fail Regs Dst
+ i_bs_init_fail_heap Sz Words Fail Regs Dst
-i_bs_init_fail r j I d
i_bs_init_fail x j I d
i_bs_init_fail y j I d
-i_bs_init_fail_heap I j I d
+i_bs_init_fail_heap s I j I d
i_bs_init I I d
i_bs_init_heap_bin I I d
@@ -1408,39 +1291,35 @@ bs_init_bits Fail Sz=u Words Regs Flags Dst => i_bs_init_bits_heap Sz Words Reg
bs_init_bits Fail Sz Words=u==0 Regs Flags Dst => \
i_bs_init_bits_fail Sz Fail Regs Dst
bs_init_bits Fail Sz Words Regs Flags Dst => \
- i_fetch Sz r | i_bs_init_bits_fail_heap Words Fail Regs Dst
+ i_bs_init_bits_fail_heap Sz Words Fail Regs Dst
-i_bs_init_bits_fail r j I d
i_bs_init_bits_fail x j I d
i_bs_init_bits_fail y j I d
-i_bs_init_bits_fail_heap I j I d
+i_bs_init_bits_fail_heap s I j I d
i_bs_init_bits I I d
i_bs_init_bits_heap I I I d
bs_add Fail S1=i==0 S2 Unit=u==1 D => move S2 D
-bs_add Fail S1 S2 Unit D => i_fetch S1 S2 | i_bs_add Fail Unit D
-i_bs_add j I d
+bs_add j s s I d
bs_append Fail Size Extra Live Unit Bin Flags Dst => \
- i_fetch Size Bin | i_bs_append Fail Extra Live Unit Dst
+ move Bin x | i_bs_append Fail Extra Live Unit Size Dst
bs_private_append Fail Size Unit Bin Flags Dst => \
- i_fetch Size Bin | i_bs_private_append Fail Unit Dst
+ i_bs_private_append Fail Unit Size Bin Dst
bs_init_writable
-i_bs_append j I I I d
-i_bs_private_append j I d
+i_bs_append j I I I s d
+i_bs_private_append j I s s d
#
# Storing integers into binaries.
#
-bs_put_integer Fail=j Sz=s Unit=u Flags=u Literal=q => \
- move Literal x | bs_put_integer Fail Sz Unit Flags x
bs_put_integer Fail=j Sz=sq Unit=u Flags=u Src=s => \
gen_put_integer(Fail, Sz, Unit, Flags, Src)
@@ -1454,32 +1333,22 @@ i_new_bs_put_integer_imm j I I s
# Utf8/utf16/utf32 support. (R12B-5)
#
-bs_utf8_size Fail Literal=q Dst=d => \
- move Literal x | bs_utf8_size Fail x Dst
bs_utf8_size j Src=s Dst=d => i_bs_utf8_size Src Dst
i_bs_utf8_size s d
-bs_utf16_size Fail Literal=q Dst=d => \
- move Literal x | bs_utf16_size Fail x Dst
bs_utf16_size j Src=s Dst=d => i_bs_utf16_size Src Dst
i_bs_utf16_size s d
-bs_put_utf8 Fail=j Flags=u Literal=q => \
- move Literal x | bs_put_utf8 Fail Flags x
bs_put_utf8 Fail u Src=s => i_bs_put_utf8 Fail Src
i_bs_put_utf8 j s
-bs_put_utf16 Fail=j Flags=u Literal=q => \
- move Literal x | bs_put_utf16 Fail Flags x
bs_put_utf16 Fail Flags=u Src=s => i_bs_put_utf16 Fail Flags Src
i_bs_put_utf16 j I s
-bs_put_utf32 Fail=j Flags=u Literal=q => \
- move Literal x | bs_put_utf32 Fail Flags x
bs_put_utf32 Fail=j Flags=u Src=s => \
i_bs_validate_unicode Fail Src | bs_put_integer Fail i=32 u=1 Flags Src
@@ -1490,9 +1359,6 @@ i_bs_validate_unicode j s
#
bs_put_float Fail Sz=q Unit Flags Val => badarg Fail
-bs_put_float Fail=j Sz Unit=u Flags=u Literal=q => \
- move Literal x | bs_put_float Fail Sz Unit Flags x
-
bs_put_float Fail=j Sz=s Unit=u Flags=u Src=s => \
gen_put_float(Fail, Sz, Unit, Flags, Src)
@@ -1506,8 +1372,6 @@ i_new_bs_put_float_imm j I I s
# Storing binaries into binaries.
#
-bs_put_binary Fail Sz Unit Flags Literal=q => \
- move Literal x | bs_put_binary Fail Sz Unit Flags x
bs_put_binary Fail=j Sz=s Unit=u Flags=u Src=s => \
gen_put_binary(Fail, Sz, Unit, Flags, Src)
@@ -1600,7 +1464,6 @@ is_map Fail Lit=q | literal_is_map(Lit) =>
is_map Fail cq => jump Fail
%macro: is_map IsMap -fail_action
-is_map f r
is_map f x
is_map f y
@@ -1611,101 +1474,120 @@ has_map_fields Fail Src Size Rest=* => \
## Transform get_map_elements(s) #{ K1 := V1, K2 := V2 }
-get_map_elements Fail Src=rxy Size=u==2 Rest=* => \
+get_map_elements Fail Src=xy Size=u==2 Rest=* => \
gen_get_map_element(Fail, Src, Size, Rest)
get_map_elements Fail Src Size Rest=* | map_key_sort(Size, Rest) => \
gen_get_map_elements(Fail, Src, Size, Rest)
i_get_map_elements f s I
-i_get_map_element Fail Src=rxy Key=ry Dst => \
+i_get_map_element Fail Src=xy Key=y Dst => \
move Key x | i_get_map_element Fail Src x Dst
%macro: i_get_map_element_hash GetMapElementHash -fail_action
-i_get_map_element_hash f r c I r
-i_get_map_element_hash f x c I r
-i_get_map_element_hash f y c I r
-i_get_map_element_hash f r c I x
i_get_map_element_hash f x c I x
i_get_map_element_hash f y c I x
-i_get_map_element_hash f r c I y
i_get_map_element_hash f x c I y
i_get_map_element_hash f y c I y
%macro: i_get_map_element GetMapElement -fail_action
-i_get_map_element f r x r
-i_get_map_element f x x r
-i_get_map_element f y x r
-i_get_map_element f r x x
i_get_map_element f x x x
i_get_map_element f y x x
-i_get_map_element f r x y
i_get_map_element f x x y
i_get_map_element f y x y
#
+# Convert the plus operations to a generic plus instruction.
+#
+gen_plus/5
+gen_minus/5
+
+gc_bif1 Fail Live u$bif:erlang:splus/1 Src Dst => \
+ gen_plus Fail Live Src i Dst
+gc_bif2 Fail Live u$bif:erlang:splus/2 S1 S2 Dst => \
+ gen_plus Fail Live S1 S2 Dst
+
+gc_bif1 Fail Live u$bif:erlang:sminus/1 Src Dst => \
+ gen_minus Fail Live i Src Dst
+gc_bif2 Fail Live u$bif:erlang:sminus/2 S1 S2 Dst => \
+ gen_minus Fail Live S1 S2 Dst
+
+#
# Optimize addition and subtraction of small literals using
# the i_increment/4 instruction (in bodies, not in guards).
#
-gc_bif2 p Live u$bif:erlang:splus/2 Int=i Reg=d Dst => \
+gen_plus p Live Int=i Reg=d Dst => \
gen_increment(Reg, Int, Live, Dst)
-gc_bif2 p Live u$bif:erlang:splus/2 Reg=d Int=i Dst => \
+gen_plus p Live Reg=d Int=i Dst => \
gen_increment(Reg, Int, Live, Dst)
-gc_bif2 p Live u$bif:erlang:sminus/2 Reg=d Int=i Dst | \
- negation_is_small(Int) => \
+gen_minus p Live Reg=d Int=i Dst | negation_is_small(Int) => \
gen_increment_from_minus(Reg, Int, Live, Dst)
#
# GCing arithmetic instructions.
#
-gc_bif2 Fail I u$bif:erlang:splus/2 S1=x S2=x Dst=d => i_plus Fail I S1 S2 Dst
-gc_bif2 Fail I u$bif:erlang:splus/2 S1 S2 Dst=d => i_fetch S1 S2 | i_plus Fail I Dst
-gc_bif2 Fail I u$bif:erlang:sminus/2 S1=x S2=x Dst=d => i_minus Fail I S1 S2 Dst
-gc_bif2 Fail I u$bif:erlang:sminus/2 S1 S2 Dst=d => i_fetch S1 S2 | i_minus Fail I Dst
-gc_bif2 Fail I u$bif:erlang:stimes/2 S1 S2 Dst=d => i_fetch S1 S2 | i_times Fail I Dst
-gc_bif2 Fail I u$bif:erlang:div/2 S1 S2 Dst=d => i_fetch S1 S2 | i_m_div Fail I Dst
+gen_plus Fail Live Y=y X=x Dst => i_plus Fail Live X Y Dst
+gen_plus Fail Live S1 S2 Dst => i_plus Fail Live S1 S2 Dst
-gc_bif2 Fail I u$bif:erlang:intdiv/2 S1 S2 Dst=d => i_fetch S1 S2 | i_int_div Fail I Dst
-gc_bif2 Fail I u$bif:erlang:rem/2 S1=x S2=x Dst=d => i_rem Fail I S1 S2 Dst
-gc_bif2 Fail I u$bif:erlang:rem/2 S1 S2 Dst=d => i_fetch S1 S2 | i_rem Fail I Dst
+gen_minus Fail Live S1 S2 Dst => i_minus Fail Live S1 S2 Dst
-gc_bif2 Fail I u$bif:erlang:bsl/2 S1 S2 Dst=d => i_fetch S1 S2 | i_bsl Fail I Dst
-gc_bif2 Fail I u$bif:erlang:bsr/2 S1 S2 Dst=d => i_fetch S1 S2 | i_bsr Fail I Dst
+gc_bif2 Fail Live u$bif:erlang:stimes/2 S1 S2 Dst => \
+ i_times Fail Live S1 S2 Dst
-gc_bif2 Fail I u$bif:erlang:band/2 S1=x S2=c Dst=d => i_band Fail I S1 S2 Dst
-gc_bif2 Fail I u$bif:erlang:band/2 S1 S2 Dst=d => i_fetch S1 S2 | i_band Fail I Dst
-gc_bif2 Fail I u$bif:erlang:bor/2 S1 S2 Dst=d => i_fetch S1 S2 | i_bor Fail I Dst
-gc_bif2 Fail I u$bif:erlang:bxor/2 S1 S2 Dst=d => i_fetch S1 S2 | i_bxor Fail I Dst
+gc_bif2 Fail Live u$bif:erlang:div/2 S1 S2 Dst => \
+ i_m_div Fail Live S1 S2 Dst
+gc_bif2 Fail Live u$bif:erlang:intdiv/2 S1 S2 Dst => \
+ i_int_div Fail Live S1 S2 Dst
-gc_bif1 Fail I u$bif:erlang:bnot/1 Src Dst=d => i_int_bnot Fail Src I Dst
+gc_bif2 Fail Live u$bif:erlang:rem/2 S1 S2 Dst => \
+ i_rem Fail Live S1 S2 Dst
+
+gc_bif2 Fail Live u$bif:erlang:bsl/2 S1 S2 Dst => \
+ i_bsl Fail Live S1 S2 Dst
+gc_bif2 Fail Live u$bif:erlang:bsr/2 S1 S2 Dst => \
+ i_bsr Fail Live S1 S2 Dst
+
+gc_bif2 Fail Live u$bif:erlang:band/2 S1 S2 Dst => \
+ i_band Fail Live S1 S2 Dst
+
+gc_bif2 Fail Live u$bif:erlang:bor/2 S1 S2 Dst => \
+ i_bor Fail Live S1 S2 Dst
-gc_bif1 Fail I u$bif:erlang:sminus/1 Src Dst=d => i_fetch i Src | i_minus Fail I Dst
-gc_bif1 Fail I u$bif:erlang:splus/1 Src Dst=d => i_fetch i Src | i_plus Fail I Dst
+gc_bif2 Fail Live u$bif:erlang:bxor/2 S1 S2 Dst => \
+ i_bxor Fail Live S1 S2 Dst
+
+gc_bif1 Fail I u$bif:erlang:bnot/1 Src Dst=d => i_int_bnot Fail Src I Dst
i_increment r I I d
i_increment x I I d
i_increment y I I d
i_plus j I x x d
-i_plus j I d
+i_plus j I x y d
+i_plus j I s s d
+
i_minus j I x x d
-i_minus j I d
-i_times j I d
-i_m_div j I d
-i_int_div j I d
+i_minus j I s s d
+
+i_times j I s s d
+
+i_m_div j I s s d
+i_int_div j I s s d
+
i_rem j I x x d
-i_rem j I d
+i_rem j I s s d
-i_bsl j I d
-i_bsr j I d
+i_bsl j I s s d
+i_bsr j I s s d
i_band j I x c d
-i_band j I d
-i_bor j I d
-i_bxor j I d
+i_band j I s s d
+
+i_bor j I s s d
+i_bxor j I s s d
i_int_bnot j s I d
@@ -1731,21 +1613,18 @@ gc_bif2 Fail I Bif S1 S2 Dst => \
gc_bif3 Fail I Bif S1 S2 S3 Dst => \
gen_guard_bif3(Fail, I, Bif, S1, S2, S3, Dst)
-i_gc_bif1 Fail Bif V=q Live D => move V x | i_gc_bif1 Fail Bif x Live D
-
i_gc_bif1 j I s I d
-ii_gc_bif2/6
-
-ii_gc_bif2 Fail Bif S1 S2 Live D => i_fetch S1 S2 | i_gc_bif2 Fail Bif Live D
-
-i_gc_bif2 j I I d
+i_gc_bif2 j I I s s d
ii_gc_bif3/7
-ii_gc_bif3 Fail Bif S1 S2 S3 Live D => move S1 x | i_fetch S2 S3 | i_gc_bif3 Fail Bif x Live D
+# A specific instruction can only have 6 operands, so we must
+# pass one of the arguments in an x register.
+ii_gc_bif3 Fail Bif Live S1 S2 S3 Dst => \
+ move S1 x | i_gc_bif3 Fail Bif Live S2 S3 Dst
-i_gc_bif3 j I s I d
+i_gc_bif3 j I I s s d
#
# The following instruction is specially handled in beam_load.c
diff --git a/erts/emulator/beam/packet_parser.c b/erts/emulator/beam/packet_parser.c
index 2dd421a9e9..a737a86f14 100644
--- a/erts/emulator/beam/packet_parser.c
+++ b/erts/emulator/beam/packet_parser.c
@@ -256,6 +256,7 @@ int packet_get_length(enum PacketParseType htype,
const char* ptr, unsigned n, /* Bytes read so far */
unsigned max_plen, /* Max packet length, 0=no limit */
unsigned trunc_len, /* Truncate (lines) if longer, 0=no limit */
+ char delimiter, /* Line delimiting character */
int* statep) /* Protocol specific state */
{
unsigned hlen, plen;
@@ -299,9 +300,9 @@ int packet_get_length(enum PacketParseType htype,
goto remain;
case TCP_PB_LINE_LF: {
- /* TCP_PB_LINE_LF: [Data ... \n] */
+ /* TCP_PB_LINE_LF: [Data ... Delimiter] */
const char* ptr2;
- if ((ptr2 = memchr(ptr, '\n', n)) == NULL) {
+ if ((ptr2 = memchr(ptr, delimiter, n)) == NULL) {
if (n > max_plen && max_plen != 0) { /* packet full */
DEBUGF((" => packet full (no NL)=%d\r\n", n));
goto error;
diff --git a/erts/emulator/beam/packet_parser.h b/erts/emulator/beam/packet_parser.h
index ff158ff8b8..717d905fad 100644
--- a/erts/emulator/beam/packet_parser.h
+++ b/erts/emulator/beam/packet_parser.h
@@ -105,7 +105,8 @@ int packet_get_length(enum PacketParseType htype,
const char* ptr, unsigned n, /* Bytes read so far */
unsigned max_plen, /* Packet max length, 0=no limit */
unsigned trunc_len, /* Truncate (lines) if longer, 0=no limit */
- int* statep); /* Internal protocol state */
+ char delimiter, /* Line delimiting character */
+ int* statep); /* Internal protocol state */
ERTS_GLB_INLINE
void packet_get_body(enum PacketParseType htype,
diff --git a/erts/emulator/beam/sys.h b/erts/emulator/beam/sys.h
index bb871b05ba..34011147d9 100644
--- a/erts/emulator/beam/sys.h
+++ b/erts/emulator/beam/sys.h
@@ -74,9 +74,7 @@
#if defined (__WIN32__)
# include "erl_win_sys.h"
-#elif defined (__OSE__)
-# include "erl_ose_sys.h"
-#else
+#else
# include "erl_unix_sys.h"
#ifndef UNIX
# define UNIX 1
@@ -285,62 +283,11 @@ __decl_noreturn void __noreturn erl_assert_error(const char* expr, const char *f
#else
#error Neither 32 nor 64 bit architecture
#endif
-#if defined(ARCH_64) && defined(HALFWORD_HEAP_EMULATOR)
-# define HALFWORD_HEAP 1
-# define HALFWORD_ASSERT 0
-# define ASSERT_HALFWORD(COND) ASSERT(COND)
-# undef ERTS_SIZEOF_TERM
-# define ERTS_SIZEOF_TERM 4
-#else
-# define HALFWORD_HEAP 0
-# define HALFWORD_ASSERT 0
-# define ASSERT_HALFWORD(COND)
-#endif
#if SIZEOF_VOID_P != SIZEOF_SIZE_T
#error sizeof(void*) != sizeof(size_t)
#endif
-#if HALFWORD_HEAP
-
-#if SIZEOF_INT == 4
-typedef unsigned int Eterm;
-typedef unsigned int Uint;
-typedef int Sint;
-#define ERTS_UINT_MAX UINT_MAX
-#define ERTS_SIZEOF_ETERM SIZEOF_INT
-#define ErtsStrToSint strtol
-#else
-#error Found no appropriate type to use for 'Eterm', 'Uint' and 'Sint'
-#endif
-
-#if SIZEOF_VOID_P == SIZEOF_LONG
-typedef unsigned long UWord;
-typedef long SWord;
-#define SWORD_CONSTANT(Const) Const##L
-#define UWORD_CONSTANT(Const) Const##UL
-#define ERTS_UWORD_MAX ULONG_MAX
-#define ERTS_SWORD_MAX LONG_MAX
-#elif SIZEOF_VOID_P == SIZEOF_INT
-typedef unsigned int UWord;
-typedef int SWord;
-#define SWORD_CONSTANT(Const) Const
-#define UWORD_CONSTANT(Const) Const##U
-#define ERTS_UWORD_MAX UINT_MAX
-#define ERTS_SWORD_MAX INT_MAX
-#elif SIZEOF_VOID_P == SIZEOF_LONG_LONG
-typedef unsigned long long UWord;
-typedef long long SWord;
-#define SWORD_CONSTANT(Const) Const##LL
-#define UWORD_CONSTANT(Const) Const##ULL
-#define ERTS_UWORD_MAX ULLONG_MAX
-#define ERTS_SWORD_MAX LLONG_MAX
-#else
-#error Found no appropriate type to use for 'Eterm', 'Uint' and 'Sint'
-#endif
-
-#else /* !HALFWORD_HEAP */
-
#if SIZEOF_VOID_P == SIZEOF_LONG
typedef unsigned long Eterm;
typedef unsigned long Uint;
@@ -383,8 +330,6 @@ typedef Uint UWord;
typedef Sint SWord;
#define ERTS_UINT_MAX ERTS_UWORD_MAX
-#endif /* HALFWORD_HEAP */
-
typedef UWord BeamInstr;
#ifndef HAVE_INT64
diff --git a/erts/emulator/beam/utils.c b/erts/emulator/beam/utils.c
index e9d7c91ac9..5fe4091adc 100644
--- a/erts/emulator/beam/utils.c
+++ b/erts/emulator/beam/utils.c
@@ -897,7 +897,7 @@ tail_recur:
Uint y2 = y1 < 0 ? -(Uint)y1 : y1;
UINT32_HASH_STEP(y2, FUNNY_NUMBER2);
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
if (y2 >> 32)
UINT32_HASH_STEP(y2 >> 32, FUNNY_NUMBER2);
#endif
@@ -1018,7 +1018,7 @@ tail_recur:
}
d = BIG_DIGIT(ptr, k);
k = sizeof(ErtsDigit);
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
if (!(d >> 32))
k /= 2;
#endif
@@ -1988,7 +1988,7 @@ tail_recur:
(atom_tab(atom_val(term))->slot.bucket.hvalue);
break;
case SMALL_DEF:
-#if defined(ARCH_64) && !HALFWORD_HEAP
+#if defined(ARCH_64)
{
Sint y1 = signed_val(term);
Uint y2 = y1 < 0 ? -(Uint)y1 : y1;
@@ -2597,11 +2597,7 @@ erts_destroy_tmp_dsbuf(erts_dsprintf_buf_t *dsbufp)
* Test for equality of two terms.
* Returns 0 if not equal, or a non-zero value otherwise.
*/
-#if HALFWORD_HEAP
-int eq_rel(Eterm a, Eterm* a_base, Eterm b, Eterm* b_base)
-#else
int eq(Eterm a, Eterm b)
-#endif
{
DECLARE_WSTACK(stack);
Sint sz;
@@ -2609,18 +2605,18 @@ int eq(Eterm a, Eterm b)
Eterm* bb;
tailrecur:
- if (is_same(a, a_base, b, b_base)) goto pop_next;
+ if (is_same(a, b)) goto pop_next;
tailrecur_ne:
switch (primary_tag(a)) {
case TAG_PRIMARY_LIST:
if (is_list(b)) {
- Eterm* aval = list_val_rel(a, a_base);
- Eterm* bval = list_val_rel(b, b_base);
+ Eterm* aval = list_val(a);
+ Eterm* bval = list_val(b);
while (1) {
Eterm atmp = CAR(aval);
Eterm btmp = CAR(bval);
- if (!is_same(atmp,a_base,btmp,b_base)) {
+ if (!is_same(atmp,btmp)) {
WSTACK_PUSH2(stack,(UWord) CDR(bval),(UWord) CDR(aval));
a = atmp;
b = btmp;
@@ -2628,7 +2624,7 @@ tailrecur_ne:
}
atmp = CDR(aval);
btmp = CDR(bval);
- if (is_same(atmp,a_base,btmp,b_base)) {
+ if (is_same(atmp,btmp)) {
goto pop_next;
}
if (is_not_list(atmp) || is_not_list(btmp)) {
@@ -2636,22 +2632,22 @@ tailrecur_ne:
b = btmp;
goto tailrecur_ne;
}
- aval = list_val_rel(atmp, a_base);
- bval = list_val_rel(btmp, b_base);
+ aval = list_val(atmp);
+ bval = list_val(btmp);
}
}
break; /* not equal */
case TAG_PRIMARY_BOXED:
{
- Eterm hdr = *boxed_val_rel(a,a_base);
+ Eterm hdr = *boxed_val(a);
switch (hdr & _TAG_HEADER_MASK) {
case ARITYVAL_SUBTAG:
{
- aa = tuple_val_rel(a, a_base);
- if (!is_boxed(b) || *boxed_val_rel(b,b_base) != *aa)
+ aa = tuple_val(a);
+ if (!is_boxed(b) || *boxed_val(b) != *aa)
goto not_equal;
- bb = tuple_val_rel(b,b_base);
+ bb = tuple_val(b);
if ((sz = arityval(*aa)) == 0) goto pop_next;
++aa;
++bb;
@@ -2670,16 +2666,16 @@ tailrecur_ne:
Uint a_bitoffs;
Uint b_bitoffs;
- if (!is_binary_rel(b,b_base)) {
+ if (!is_binary(b)) {
goto not_equal;
}
- a_size = binary_size_rel(a,a_base);
- b_size = binary_size_rel(b,b_base);
+ a_size = binary_size(a);
+ b_size = binary_size(b);
if (a_size != b_size) {
goto not_equal;
}
- ERTS_GET_BINARY_BYTES_REL(a, a_ptr, a_bitoffs, a_bitsize, a_base);
- ERTS_GET_BINARY_BYTES_REL(b, b_ptr, b_bitoffs, b_bitsize, b_base);
+ ERTS_GET_BINARY_BYTES(a, a_ptr, a_bitoffs, a_bitsize);
+ ERTS_GET_BINARY_BYTES(b, b_ptr, b_bitoffs, b_bitsize);
if ((a_bitsize | b_bitsize | a_bitoffs | b_bitoffs) == 0) {
if (sys_memcmp(a_ptr, b_ptr, a_size) == 0) goto pop_next;
} else if (a_bitsize == b_bitsize) {
@@ -2690,9 +2686,9 @@ tailrecur_ne:
}
case EXPORT_SUBTAG:
{
- if (is_export_rel(b,b_base)) {
- Export* a_exp = *((Export **) (export_val_rel(a,a_base) + 1));
- Export* b_exp = *((Export **) (export_val_rel(b,b_base) + 1));
+ if (is_export(b)) {
+ Export* a_exp = *((Export **) (export_val(a) + 1));
+ Export* b_exp = *((Export **) (export_val(b) + 1));
if (a_exp == b_exp) goto pop_next;
}
break; /* not equal */
@@ -2702,10 +2698,10 @@ tailrecur_ne:
ErlFunThing* f1;
ErlFunThing* f2;
- if (!is_fun_rel(b,b_base))
+ if (!is_fun(b))
goto not_equal;
- f1 = (ErlFunThing *) fun_val_rel(a,a_base);
- f2 = (ErlFunThing *) fun_val_rel(b,b_base);
+ f1 = (ErlFunThing *) fun_val(a);
+ f2 = (ErlFunThing *) fun_val(b);
if (f1->fe->module != f2->fe->module ||
f1->fe->old_index != f2->fe->old_index ||
f1->fe->old_uniq != f2->fe->old_uniq ||
@@ -2723,15 +2719,15 @@ tailrecur_ne:
ExternalThing *ap;
ExternalThing *bp;
- if(!is_external_rel(b,b_base))
+ if(!is_external(b))
goto not_equal;
- ap = external_thing_ptr_rel(a,a_base);
- bp = external_thing_ptr_rel(b,b_base);
+ ap = external_thing_ptr(a);
+ bp = external_thing_ptr(b);
if(ap->header == bp->header && ap->node == bp->node) {
- ASSERT(1 == external_data_words_rel(a,a_base));
- ASSERT(1 == external_data_words_rel(b,b_base));
+ ASSERT(1 == external_data_words(a));
+ ASSERT(1 == external_data_words(b));
if (ap->data.ui[0] == bp->data.ui[0]) goto pop_next;
}
@@ -2752,11 +2748,11 @@ tailrecur_ne:
ExternalThing* athing;
ExternalThing* bthing;
- if(!is_external_ref_rel(b,b_base))
+ if(!is_external_ref(b))
goto not_equal;
- athing = external_thing_ptr_rel(a,a_base);
- bthing = external_thing_ptr_rel(b,b_base);
+ athing = external_thing_ptr(a);
+ bthing = external_thing_ptr(b);
if(athing->node != bthing->node)
goto not_equal;
@@ -2768,12 +2764,12 @@ tailrecur_ne:
goto ref_common;
case REF_SUBTAG:
- if (!is_internal_ref_rel(b,b_base))
+ if (!is_internal_ref(b))
goto not_equal;
{
- RefThing* athing = ref_thing_ptr_rel(a,a_base);
- RefThing* bthing = ref_thing_ptr_rel(b,b_base);
+ RefThing* athing = ref_thing_ptr(a);
+ RefThing* bthing = ref_thing_ptr(b);
alen = internal_thing_ref_no_of_numbers(athing);
blen = internal_thing_ref_no_of_numbers(bthing);
anum = internal_thing_ref_numbers(athing);
@@ -2823,10 +2819,10 @@ tailrecur_ne:
{
int i;
- if (!is_big_rel(b,b_base))
+ if (!is_big(b))
goto not_equal;
- aa = big_val_rel(a,a_base);
- bb = big_val_rel(b,b_base);
+ aa = big_val(a);
+ bb = big_val(b);
if (*aa != *bb)
goto not_equal;
i = BIG_ARITY(aa);
@@ -2841,19 +2837,19 @@ tailrecur_ne:
FloatDef af;
FloatDef bf;
- if (is_float_rel(b,b_base)) {
- GET_DOUBLE_REL(a, af, a_base);
- GET_DOUBLE_REL(b, bf, b_base);
+ if (is_float(b)) {
+ GET_DOUBLE(a, af);
+ GET_DOUBLE(b, bf);
if (af.fd == bf.fd) goto pop_next;
}
break; /* not equal */
}
case MAP_SUBTAG:
- if (is_flatmap_rel(a, a_base)) {
- aa = flatmap_val_rel(a, a_base);
- if (!is_boxed(b) || *boxed_val_rel(b,b_base) != *aa)
+ if (is_flatmap(a)) {
+ aa = flatmap_val(a);
+ if (!is_boxed(b) || *boxed_val(b) != *aa)
goto not_equal;
- bb = flatmap_val_rel(b,b_base);
+ bb = flatmap_val(b);
sz = flatmap_get_size((flatmap_t*)aa);
if (sz != flatmap_get_size((flatmap_t*)bb)) goto not_equal;
@@ -2865,11 +2861,11 @@ tailrecur_ne:
goto term_array;
} else {
- if (!is_boxed(b) || *boxed_val_rel(b,b_base) != hdr)
+ if (!is_boxed(b) || *boxed_val(b) != hdr)
goto not_equal;
- aa = hashmap_val_rel(a, a_base) + 1;
- bb = hashmap_val_rel(b, b_base) + 1;
+ aa = hashmap_val(a) + 1;
+ bb = hashmap_val(b) + 1;
switch (hdr & _HEADER_MAP_SUBTAG_MASK) {
case HAMT_SUBTAG_HEAD_ARRAY:
aa++; bb++;
@@ -2902,7 +2898,7 @@ term_array: /* arrays in 'aa' and 'bb', length in 'sz' */
Eterm* bp = bb;
Sint i = sz;
for (;;) {
- if (!is_same(*ap,a_base,*bp,b_base)) break;
+ if (!is_same(*ap,*bp)) break;
if (--i == 0) goto pop_next;
++ap;
++bp;
@@ -2991,7 +2987,6 @@ static int cmp_atoms(Eterm a, Eterm b)
bb->name+3, bb->len-3);
}
-#if !HALFWORD_HEAP
/* cmp(Eterm a, Eterm b)
* For compatibility with HiPE - arith-based compare.
*/
@@ -2999,39 +2994,22 @@ Sint cmp(Eterm a, Eterm b)
{
return erts_cmp(a, b, 0, 0);
}
-#endif
-#if HALFWORD_HEAP
-static Sint erts_cmp_compound_rel_opt(Eterm a, Eterm* a_base,
- Eterm b, Eterm* b_base,
- int exact, int eq_only);
-#else
static Sint erts_cmp_compound(Eterm a, Eterm b, int exact, int eq_only);
-#endif
-#if HALFWORD_HEAP
-Sint erts_cmp_rel_opt(Eterm a, Eterm* a_base,
- Eterm b, Eterm* b_base,
- int exact, int eq_only)
-#else
Sint erts_cmp(Eterm a, Eterm b, int exact, int eq_only)
-#endif
{
if (is_atom(a) && is_atom(b)) {
return cmp_atoms(a, b);
} else if (is_both_small(a, b)) {
return (signed_val(a) - signed_val(b));
- } else if (is_float_rel(a, a_base) && is_float_rel(b, b_base)) {
+ } else if (is_float(a) && is_float(b)) {
FloatDef af, bf;
- GET_DOUBLE_REL(a, af, a_base);
- GET_DOUBLE_REL(b, bf, b_base);
+ GET_DOUBLE(a, af);
+ GET_DOUBLE(b, bf);
return float_comp(af.fd, bf.fd);
}
-#if HALFWORD_HEAP
- return erts_cmp_compound_rel_opt(a,a_base,b,b_base,exact,eq_only);
-#else
return erts_cmp_compound(a,b,exact,eq_only);
-#endif
}
@@ -3039,13 +3017,7 @@ Sint erts_cmp(Eterm a, Eterm b, int exact, int eq_only)
* exact = 1 -> term-based compare
* exact = 0 -> arith-based compare
*/
-#if HALFWORD_HEAP
-static Sint erts_cmp_compound_rel_opt(Eterm a, Eterm* a_base,
- Eterm b, Eterm* b_base,
- int exact, int eq_only)
-#else
static Sint erts_cmp_compound(Eterm a, Eterm b, int exact, int eq_only)
-#endif
{
#define PSTACK_TYPE struct erts_cmp_hashmap_state
struct erts_cmp_hashmap_state {
@@ -3112,7 +3084,7 @@ static Sint erts_cmp_compound(Eterm a, Eterm b, int exact, int eq_only)
bodyrecur:
j = 0;
tailrecur:
- if (is_same(a,a_base,b,b_base)) { /* Equal values or pointers. */
+ if (is_same(a,b)) { /* Equal values or pointers. */
goto pop_next;
}
tailrecur_ne:
@@ -3138,9 +3110,9 @@ tailrecur_ne:
if (is_internal_port(b)) {
bnode = erts_this_node;
bdata = internal_port_data(b);
- } else if (is_external_port_rel(b,b_base)) {
- bnode = external_port_node_rel(b,b_base);
- bdata = external_port_data_rel(b,b_base);
+ } else if (is_external_port(b)) {
+ bnode = external_port_node(b);
+ bdata = external_port_data(b);
} else {
a_tag = PORT_DEF;
goto mixed_types;
@@ -3156,9 +3128,9 @@ tailrecur_ne:
if (is_internal_pid(b)) {
bnode = erts_this_node;
bdata = internal_pid_data(b);
- } else if (is_external_pid_rel(b,b_base)) {
- bnode = external_pid_node_rel(b,b_base);
- bdata = external_pid_data_rel(b,b_base);
+ } else if (is_external_pid(b)) {
+ bnode = external_pid_node(b);
+ bdata = external_pid_data(b);
} else {
a_tag = PID_DEF;
goto mixed_types;
@@ -3191,12 +3163,12 @@ tailrecur_ne:
a_tag = LIST_DEF;
goto mixed_types;
}
- aa = list_val_rel(a,a_base);
- bb = list_val_rel(b,b_base);
+ aa = list_val(a);
+ bb = list_val(b);
while (1) {
Eterm atmp = CAR(aa);
Eterm btmp = CAR(bb);
- if (!is_same(atmp,a_base,btmp,b_base)) {
+ if (!is_same(atmp,btmp)) {
WSTACK_PUSH2(stack,(UWord) CDR(bb),(UWord) CDR(aa));
a = atmp;
b = btmp;
@@ -3204,7 +3176,7 @@ tailrecur_ne:
}
atmp = CDR(aa);
btmp = CDR(bb);
- if (is_same(atmp,a_base,btmp,b_base)) {
+ if (is_same(atmp,btmp)) {
goto pop_next;
}
if (is_not_list(atmp) || is_not_list(btmp)) {
@@ -3212,20 +3184,20 @@ tailrecur_ne:
b = btmp;
goto tailrecur_ne;
}
- aa = list_val_rel(atmp,a_base);
- bb = list_val_rel(btmp,b_base);
+ aa = list_val(atmp);
+ bb = list_val(btmp);
}
case TAG_PRIMARY_BOXED:
{
- Eterm ahdr = *boxed_val_rel(a,a_base);
+ Eterm ahdr = *boxed_val(a);
switch ((ahdr & _TAG_HEADER_MASK) >> _TAG_PRIMARY_SIZE) {
case (_TAG_HEADER_ARITYVAL >> _TAG_PRIMARY_SIZE):
- if (!is_tuple_rel(b,b_base)) {
+ if (!is_tuple(b)) {
a_tag = TUPLE_DEF;
goto mixed_types;
}
- aa = tuple_val_rel(a,a_base);
- bb = tuple_val_rel(b,b_base);
+ aa = tuple_val(a);
+ bb = tuple_val(b);
/* compare the arities */
i = arityval(ahdr); /* get the arity*/
if (i != arityval(*bb)) {
@@ -3241,18 +3213,18 @@ tailrecur_ne:
{
struct erts_cmp_hashmap_state* sp;
if (is_flatmap_header(ahdr)) {
- if (!is_flatmap_rel(b,b_base)) {
- if (is_hashmap_rel(b,b_base)) {
- aa = (Eterm *)flatmap_val_rel(a,a_base);
- i = flatmap_get_size((flatmap_t*)aa) - hashmap_size_rel(b,b_base);
+ if (!is_flatmap(b)) {
+ if (is_hashmap(b)) {
+ aa = (Eterm *)flatmap_val(a);
+ i = flatmap_get_size((flatmap_t*)aa) - hashmap_size(b);
ASSERT(i != 0);
RETURN_NEQ(i);
}
a_tag = MAP_DEF;
goto mixed_types;
}
- aa = (Eterm *)flatmap_val_rel(a,a_base);
- bb = (Eterm *)flatmap_val_rel(b,b_base);
+ aa = (Eterm *)flatmap_val(a);
+ bb = (Eterm *)flatmap_val(b);
i = flatmap_get_size((flatmap_t*)aa);
if (i != flatmap_get_size((flatmap_t*)bb)) {
@@ -3279,21 +3251,21 @@ tailrecur_ne:
goto bodyrecur;
}
}
- if (!is_hashmap_rel(b,b_base)) {
- if (is_flatmap_rel(b,b_base)) {
- bb = (Eterm *)flatmap_val_rel(b,b_base);
- i = hashmap_size_rel(a,a_base) - flatmap_get_size((flatmap_t*)bb);
+ if (!is_hashmap(b)) {
+ if (is_flatmap(b)) {
+ bb = (Eterm *)flatmap_val(b);
+ i = hashmap_size(a) - flatmap_get_size((flatmap_t*)bb);
ASSERT(i != 0);
RETURN_NEQ(i);
}
a_tag = MAP_DEF;
goto mixed_types;
}
- i = hashmap_size_rel(a,a_base) - hashmap_size_rel(b,b_base);
+ i = hashmap_size(a) - hashmap_size(b);
if (i) {
RETURN_NEQ(i);
}
- if (hashmap_size_rel(a,a_base) == 0) {
+ if (hashmap_size(a) == 0) {
goto pop_next;
}
@@ -3328,31 +3300,31 @@ tailrecur_ne:
goto bodyrecur;
}
case (_TAG_HEADER_FLOAT >> _TAG_PRIMARY_SIZE):
- if (!is_float_rel(b,b_base)) {
+ if (!is_float(b)) {
a_tag = FLOAT_DEF;
goto mixed_types;
} else {
FloatDef af;
FloatDef bf;
- GET_DOUBLE_REL(a, af, a_base);
- GET_DOUBLE_REL(b, bf, b_base);
+ GET_DOUBLE(a, af);
+ GET_DOUBLE(b, bf);
ON_CMP_GOTO(float_comp(af.fd, bf.fd));
}
case (_TAG_HEADER_POS_BIG >> _TAG_PRIMARY_SIZE):
case (_TAG_HEADER_NEG_BIG >> _TAG_PRIMARY_SIZE):
- if (!is_big_rel(b,b_base)) {
+ if (!is_big(b)) {
a_tag = BIG_DEF;
goto mixed_types;
}
- ON_CMP_GOTO(big_comp(rterm2wterm(a,a_base), rterm2wterm(b,b_base)));
+ ON_CMP_GOTO(big_comp(a, b));
case (_TAG_HEADER_EXPORT >> _TAG_PRIMARY_SIZE):
- if (!is_export_rel(b,b_base)) {
+ if (!is_export(b)) {
a_tag = EXPORT_DEF;
goto mixed_types;
} else {
- Export* a_exp = *((Export **) (export_val_rel(a,a_base) + 1));
- Export* b_exp = *((Export **) (export_val_rel(b,b_base) + 1));
+ Export* a_exp = *((Export **) (export_val(a) + 1));
+ Export* b_exp = *((Export **) (export_val(b) + 1));
if ((j = cmp_atoms(a_exp->code[0], b_exp->code[0])) != 0) {
RETURN_NEQ(j);
@@ -3364,12 +3336,12 @@ tailrecur_ne:
}
break;
case (_TAG_HEADER_FUN >> _TAG_PRIMARY_SIZE):
- if (!is_fun_rel(b,b_base)) {
+ if (!is_fun(b)) {
a_tag = FUN_DEF;
goto mixed_types;
} else {
- ErlFunThing* f1 = (ErlFunThing *) fun_val_rel(a,a_base);
- ErlFunThing* f2 = (ErlFunThing *) fun_val_rel(b,b_base);
+ ErlFunThing* f1 = (ErlFunThing *) fun_val(a);
+ ErlFunThing* f2 = (ErlFunThing *) fun_val(b);
Sint diff;
diff = cmpbytes(atom_tab(atom_val(f1->fe->module))->name,
@@ -3401,29 +3373,29 @@ tailrecur_ne:
if (is_internal_pid(b)) {
bnode = erts_this_node;
bdata = internal_pid_data(b);
- } else if (is_external_pid_rel(b,b_base)) {
- bnode = external_pid_node_rel(b,b_base);
- bdata = external_pid_data_rel(b,b_base);
+ } else if (is_external_pid(b)) {
+ bnode = external_pid_node(b);
+ bdata = external_pid_data(b);
} else {
a_tag = EXTERNAL_PID_DEF;
goto mixed_types;
}
- anode = external_pid_node_rel(a,a_base);
- adata = external_pid_data_rel(a,a_base);
+ anode = external_pid_node(a);
+ adata = external_pid_data(a);
goto pid_common;
case (_TAG_HEADER_EXTERNAL_PORT >> _TAG_PRIMARY_SIZE):
if (is_internal_port(b)) {
bnode = erts_this_node;
bdata = internal_port_data(b);
- } else if (is_external_port_rel(b,b_base)) {
- bnode = external_port_node_rel(b,b_base);
- bdata = external_port_data_rel(b,b_base);
+ } else if (is_external_port(b)) {
+ bnode = external_port_node(b);
+ bdata = external_port_data(b);
} else {
a_tag = EXTERNAL_PORT_DEF;
goto mixed_types;
}
- anode = external_port_node_rel(a,a_base);
- adata = external_port_data_rel(a,a_base);
+ anode = external_port_node(a);
+ adata = external_port_data(a);
goto port_common;
case (_TAG_HEADER_REF >> _TAG_PRIMARY_SIZE):
/*
@@ -3431,14 +3403,13 @@ tailrecur_ne:
* (32-bit words), *not* ref data words.
*/
-
- if (is_internal_ref_rel(b,b_base)) {
- RefThing* bthing = ref_thing_ptr_rel(b,b_base);
+ if (is_internal_ref(b)) {
+ RefThing* bthing = ref_thing_ptr(b);
bnode = erts_this_node;
bnum = internal_thing_ref_numbers(bthing);
blen = internal_thing_ref_no_of_numbers(bthing);
- } else if(is_external_ref_rel(b,b_base)) {
- ExternalThing* bthing = external_thing_ptr_rel(b,b_base);
+ } else if(is_external_ref(b)) {
+ ExternalThing* bthing = external_thing_ptr(b);
bnode = bthing->node;
bnum = external_thing_ref_numbers(bthing);
blen = external_thing_ref_no_of_numbers(bthing);
@@ -3447,7 +3418,7 @@ tailrecur_ne:
goto mixed_types;
}
{
- RefThing* athing = ref_thing_ptr_rel(a,a_base);
+ RefThing* athing = ref_thing_ptr(a);
anode = erts_this_node;
anum = internal_thing_ref_numbers(athing);
alen = internal_thing_ref_no_of_numbers(athing);
@@ -3480,13 +3451,13 @@ tailrecur_ne:
RETURN_NEQ((Sint32) (anum[i] - bnum[i]));
goto pop_next;
case (_TAG_HEADER_EXTERNAL_REF >> _TAG_PRIMARY_SIZE):
- if (is_internal_ref_rel(b,b_base)) {
- RefThing* bthing = ref_thing_ptr_rel(b,b_base);
+ if (is_internal_ref(b)) {
+ RefThing* bthing = ref_thing_ptr(b);
bnode = erts_this_node;
bnum = internal_thing_ref_numbers(bthing);
blen = internal_thing_ref_no_of_numbers(bthing);
- } else if (is_external_ref_rel(b,b_base)) {
- ExternalThing* bthing = external_thing_ptr_rel(b,b_base);
+ } else if (is_external_ref(b)) {
+ ExternalThing* bthing = external_thing_ptr(b);
bnode = bthing->node;
bnum = external_thing_ref_numbers(bthing);
blen = external_thing_ref_no_of_numbers(bthing);
@@ -3495,7 +3466,7 @@ tailrecur_ne:
goto mixed_types;
}
{
- ExternalThing* athing = external_thing_ptr_rel(a,a_base);
+ ExternalThing* athing = external_thing_ptr(a);
anode = athing->node;
anum = external_thing_ref_numbers(athing);
alen = external_thing_ref_no_of_numbers(athing);
@@ -3503,13 +3474,13 @@ tailrecur_ne:
goto ref_common;
default:
/* Must be a binary */
- ASSERT(is_binary_rel(a,a_base));
- if (!is_binary_rel(b,b_base)) {
+ ASSERT(is_binary(a));
+ if (!is_binary(b)) {
a_tag = BINARY_DEF;
goto mixed_types;
} else {
- Uint a_size = binary_size_rel(a,a_base);
- Uint b_size = binary_size_rel(b,b_base);
+ Uint a_size = binary_size(a);
+ Uint b_size = binary_size(b);
Uint a_bitsize;
Uint b_bitsize;
Uint a_bitoffs;
@@ -3518,8 +3489,8 @@ tailrecur_ne:
int cmp;
byte* a_ptr;
byte* b_ptr;
- ERTS_GET_BINARY_BYTES_REL(a, a_ptr, a_bitoffs, a_bitsize, a_base);
- ERTS_GET_BINARY_BYTES_REL(b, b_ptr, b_bitoffs, b_bitsize, b_base);
+ ERTS_GET_BINARY_BYTES(a, a_ptr, a_bitoffs, a_bitsize);
+ ERTS_GET_BINARY_BYTES(b, b_ptr, b_bitoffs, b_bitsize);
if ((a_bitsize | b_bitsize | a_bitoffs | b_bitoffs) == 0) {
min_size = (a_size < b_size) ? a_size : b_size;
if ((cmp = sys_memcmp(a_ptr, b_ptr, min_size)) != 0) {
@@ -3550,13 +3521,8 @@ tailrecur_ne:
{
FloatDef f1, f2;
Eterm big;
-#if HALFWORD_HEAP
- Wterm aw = is_immed(a) ? a : rterm2wterm(a,a_base);
- Wterm bw = is_immed(b) ? b : rterm2wterm(b,b_base);
-#else
Eterm aw = a;
Eterm bw = b;
-#endif
#define MAX_LOSSLESS_FLOAT ((double)((1LL << 53) - 2))
#define MIN_LOSSLESS_FLOAT ((double)(((1LL << 53) - 2)*-1))
#define BIG_ARITY_FLOAT_MAX (1024 / D_EXP) /* arity of max float as a bignum */
@@ -3628,7 +3594,7 @@ tailrecur_ne:
}
} else {
big = double_to_big(f2.fd, big_buf, sizeof(big_buf)/sizeof(Eterm));
- j = big_comp(aw, rterm2wterm(big,big_buf));
+ j = big_comp(aw, big);
}
if (_NUMBER_CODE(a_tag, b_tag) == FLOAT_BIG) {
j = -j;
@@ -3676,7 +3642,7 @@ term_array: /* arrays in 'aa' and 'bb', length in 'i' */
while (--i) {
a = *aa++;
b = *bb++;
- if (!is_same(a,a_base, b,b_base)) {
+ if (!is_same(a, b)) {
if (is_atom(a) && is_atom(b)) {
if ((j = cmp_atoms(a, b)) != 0) {
goto not_equal;
@@ -4368,7 +4334,7 @@ iolist_size(const int yield_support, ErtsIOListState *state, Eterm obj, ErlDrvSi
{
int res, init_yield_count, yield_count;
Eterm* objp;
- Uint size = (Uint) *sizep; /* Intentionally Uint due to halfword heap */
+ Uint size = (Uint) *sizep;
DECLARE_ESTACK(s);
if (!yield_support)
diff --git a/erts/emulator/drivers/common/efile_drv.c b/erts/emulator/drivers/common/efile_drv.c
index 8aff6c1865..2cb4662fc3 100644
--- a/erts/emulator/drivers/common/efile_drv.c
+++ b/erts/emulator/drivers/common/efile_drv.c
@@ -101,15 +101,9 @@
# include "config.h"
#endif
-#ifndef __OSE__
#include <ctype.h>
#include <sys/types.h>
#include <stdlib.h>
-#else
-#include "ctype.h"
-#include "sys/types.h"
-#include "stdlib.h"
-#endif
/* Need (NON)BLOCKING macros for sendfile */
#ifndef WANT_NONBLOCKING
@@ -895,7 +889,7 @@ static void reply_Uint_posix_error(file_descriptor *desc, Uint num,
TRACE_C('N');
response[0] = FILE_RESP_NUMERR;
-#if SIZEOF_VOID_P == 4 || HALFWORD_HEAP
+#if SIZEOF_VOID_P == 4
put_int32(0, response+1);
#else
put_int32(num>>32, response+1);
@@ -964,7 +958,7 @@ static int reply_Uint(file_descriptor *desc, Uint result) {
TRACE_C('R');
tmp[0] = FILE_RESP_NUMBER;
-#if SIZEOF_VOID_P == 4 || HALFWORD_HEAP
+#if SIZEOF_VOID_P == 4
put_int32(0, tmp+1);
#else
put_int32(result>>32, tmp+1);
diff --git a/erts/emulator/drivers/common/inet_drv.c b/erts/emulator/drivers/common/inet_drv.c
index 549de6503c..1e3360c2b1 100644
--- a/erts/emulator/drivers/common/inet_drv.c
+++ b/erts/emulator/drivers/common/inet_drv.c
@@ -94,10 +94,6 @@ typedef unsigned long long llu_t;
#define INT16_MAX (32767)
#endif
-#ifdef __OSE__
-#include "inet.h"
-#endif
-
#ifdef __WIN32__
#define STRNCASECMP strncasecmp
@@ -298,139 +294,7 @@ static unsigned long one_value = 1;
#define TCP_SHUT_RD SD_RECEIVE
#define TCP_SHUT_RDWR SD_BOTH
-#elif defined (__OSE__)
-
-/*
- * Some notes about how inet (currently only tcp) works on OSE.
- * The driver uses OSE signals to communicate with the one_inet
- * process. Because of the difference in how signals and file descriptors
- * work the whole select/deselect mechanic is very different.
- * In ose when a sock_select is done a function is called. That function
- * notes the changes that the driver want to do, but does not act on it.
- * later when the function returns the new desired state is compared
- * to the previous state and the apprioriate actions are taken. The action
- * is usually to either request more data from the stack or stop requesting
- * data.
- *
- * One thing to note is that the driver never does select/deselect. It always
- * listens for the signals. Flow of data is regulated by sending or not sending
- * signals to the ose inet process.
- *
- * The interesting functions to look at are:
- * * inet_driver_select : called when sock_select is called
- * * tcp_inet_ose_dispatch_signal : checks state changes and sends new signals
- * * tcp_inet_drv_output_ose : ready output callback, reads signals and calls
- * dispatch_signal
- * * tcp_inet_drv_input_ose : ready input callback.
- */
-
-#include "efs.h"
-#include "sys/socket.h"
-#include "sys/uio.h"
-#include "sfk/sys/sfk_uio.h"
-#include "netinet/in.h"
-#include "netinet/tcp.h"
-#include "netdb.h"
-#include "ose_spi/socket.sig"
-
-
-static ssize_t writev_fallback(int fd, const struct iovec *iov, int iovcnt, int max_sz);
-
-#define INVALID_SOCKET -1
-#define INVALID_EVENT -1
-#define SOCKET_ERROR -1
-
-#define SOCKET int
-#define HANDLE int
-#define FD_READ ERL_DRV_READ
-#define FD_WRITE ERL_DRV_WRITE
-#define FD_CLOSE 0
-#define FD_CONNECT (1<<4)
-#define FD_ACCEPT (1<<5)
-#define SOCK_FD_ERROR (1<<6)
-
-#define sock_connect(s, addr, len) connect((s), (addr), (len))
-#define sock_listen(s, b) listen((s), (b))
-#define sock_bind(s, addr, len) bind((s), (addr), (len))
-#define sock_getopt(s,t,n,v,l) getsockopt((s),(t),(n),(v),(l))
-#define sock_setopt(s,t,n,v,l) setsockopt((s),(t),(n),(v),(l))
-#define sock_name(s, addr, len) getsockname((s), (addr), (len))
-#define sock_peer(s, addr, len) getpeername((s), (addr), (len))
-#define sock_ntohs(x) ntohs((x))
-#define sock_ntohl(x) ntohl((x))
-#define sock_htons(x) htons((x))
-#define sock_htonl(x) htonl((x))
-
-#define sock_accept(s, addr, len) accept((s), (addr), (len))
-#define sock_send(s,buf,len,flag) inet_send((s),(buf),(len),(flag))
-#define sock_sendto(s,buf,blen,flag,addr,alen) \
- sendto((s),(buf),(blen),(flag),(addr),(alen))
-#define sock_sendv(s, vec, size, np, flag) \
- (*(np) = writev_fallback((s), (struct iovec*)(vec), (size), (*(np))))
-#define sock_sendmsg(s,msghdr,flag) sendmsg((s),(msghdr),(flag))
-
-#define sock_open(af, type, proto) socket((af), (type), (proto))
-#define sock_close(s) close((s))
-#define sock_dup(s) dup((s))
-#define sock_shutdown(s, how) shutdown((s), (how))
-
-#define sock_hostname(buf, len) gethostname((buf), (len))
-#define sock_getservbyname(name,proto) getservbyname((name), (proto))
-#define sock_getservbyport(port,proto) getservbyport((port), (proto))
-
-#define sock_recv(s,buf,len,flag) recv((s),(buf),(len),(flag))
-#define sock_recvfrom(s,buf,blen,flag,addr,alen) \
- recvfrom((s),(buf),(blen),(flag),(addr),(alen))
-#define sock_recvmsg(s,msghdr,flag) recvmsg((s),(msghdr),(flag))
-
-#define sock_errno() errno
-#define sock_create_event(d) ((d)->s) /* return file descriptor */
-#define sock_close_event(e) /* do nothing */
-
-#ifndef WANT_NONBLOCKING
-#define WANT_NONBLOCKING
-#endif
-#include "sys.h"
-
-typedef unsigned long u_long;
-#define IN_CLASSA(a) ((((in_addr_t)(a)) & 0x80000000) == 0)
-#define IN_CLASSA_NET 0xff000000
-#define IN_CLASSA_NSHIFT 24
-#define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET)
-#define IN_CLASSA_MAX 128
-
-#define IN_CLASSB(a) ((((in_addr_t)(a)) & 0xc0000000) == 0x80000000)
-#define IN_CLASSB_NET 0xffff0000
-#define IN_CLASSB_NSHIFT 16
-#define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET)
-#define IN_CLASSB_MAX 65536
-
-#define IN_CLASSC(a) ((((in_addr_t)(a)) & 0xe0000000) == 0xc0000000)
-#define IN_CLASSC_NET 0xffffff00
-#define IN_CLASSC_NSHIFT 8
-#define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET)
-
-#define IN_CLASSD(a) ((((in_addr_t)(a)) & 0xf0000000) == 0xe0000000)
-#define IN_MULTICAST(a) IN_CLASSD(a)
-
-#define IN_EXPERIMENTAL(a) ((((in_addr_t)(a)) & 0xe0000000) == 0xe0000000)
-#define IN_BADCLASS(a) ((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000)
-
-#define sock_select(d, flags, onoff) do { \
- ASSERT(!(d)->is_ignored); \
- (d)->event_mask = (onoff) ? \
- ((d)->event_mask | (flags)) : \
- ((d)->event_mask & ~(flags)); \
- DEBUGF(("(%s / %d) sock_select(%ld): flags=%02X, onoff=%d, event_mask=%02lX, s=%d\r\n", \
- __FILE__, __LINE__, (long) (d)->port, (flags), (onoff), (unsigned long) (d)->event_mask, (d)->s)); \
- inet_driver_select((d), (flags), (onoff)); \
- } while(0)
-
-#define TCP_SHUT_WR SHUT_WR
-#define TCP_SHUT_RD SHUT_RD
-#define TCP_SHUT_RDWR SHUT_RDWR
-
-#else /* !__OSE__ && !__WIN32__ */
+#else /* !__WIN32__ */
#include <sys/time.h>
#ifdef NETDB_H_NEEDS_IN_H
@@ -704,7 +568,7 @@ static int my_strncasecmp(const char *s1, const char *s2, size_t n)
#define TCP_SHUT_RD SHUT_RD
#define TCP_SHUT_RDWR SHUT_RDWR
-#endif /* !__WIN32__ && !__OSE__ */
+#endif /* !__WIN32__ */
#ifdef HAVE_SOCKLEN_T
# define SOCKLEN_T socklen_t
@@ -885,6 +749,7 @@ static int my_strncasecmp(const char *s1, const char *s2, size_t n)
#define INET_LOPT_MSGQ_LOWTRMRK 37 /* set local msgq low watermark */
#define INET_LOPT_NETNS 38 /* Network namespace pathname */
#define INET_LOPT_TCP_SHOW_ECONNRESET 39 /* tell user about incoming RST */
+#define INET_LOPT_LINE_DELIM 40 /* Line delimiting char */
/* SCTP options: a separate range, from 100: */
#define SCTP_OPT_RTOINFO 100
#define SCTP_OPT_ASSOCINFO 101
@@ -1154,6 +1019,7 @@ typedef struct {
#else
Uint32 send_oct[2]; /* number of octets sent, 64 bits */
#endif
+ char delimiter; /* Line delimiting character (def: '\n') */
unsigned long send_cnt; /* number of packets sent */
unsigned long send_max; /* maximum packet send */
double send_avg; /* average packet size sent */
@@ -1166,13 +1032,6 @@ typedef struct {
char *netns; /* Socket network namespace name
as full file path */
#endif
-#ifdef __OSE__
- int select_state; /* state to keep track of whether we
- should trigger another read/write
- request at end of ready_input/output */
- ErlDrvEvent events[6];
-#endif
-
} inet_descriptor;
@@ -1188,10 +1047,8 @@ static void tcp_inet_stop(ErlDrvData);
static void tcp_inet_command(ErlDrvData, char*, ErlDrvSizeT);
static void tcp_inet_commandv(ErlDrvData, ErlIOVec*);
static void tcp_inet_flush(ErlDrvData drv_data);
-#ifndef __OSE__
static void tcp_inet_drv_input(ErlDrvData, ErlDrvEvent);
static void tcp_inet_drv_output(ErlDrvData data, ErlDrvEvent event);
-#endif
static ErlDrvData tcp_inet_start(ErlDrvPort, char* command);
static ErlDrvSSizeT tcp_inet_ctl(ErlDrvData, unsigned int,
char*, ErlDrvSizeT, char**, ErlDrvSizeT);
@@ -1204,71 +1061,6 @@ static void tcp_inet_event(ErlDrvData, ErlDrvEvent);
static void find_dynamic_functions(void);
#endif
-#ifdef __OSE__
-/* The structure of the signal used for requesting asynchronous
- * notification from the stack. Under normal circumstances the network stack
- * shouldn't overwrite the value set in the fd field by the sender
- * of the request */
-struct OseAsyncSig {
- struct FmEvent event;
- int fd;
-};
-
-union SIGNAL {
- SIGSELECT signo;
- struct OseAsyncSig async;
-};
-
-static ErlDrvSSizeT tcp_inet_ctl_ose(ErlDrvData e, unsigned int cmd,
- char* buf, ErlDrvSizeT len,
- char** rbuf, ErlDrvSizeT rsize);
-static void tcp_inet_commandv_ose(ErlDrvData e, ErlIOVec* ev);
-static void tcp_inet_drv_output_ose(ErlDrvData data, ErlDrvEvent event);
-static void tcp_inet_drv_input_ose(ErlDrvData data, ErlDrvEvent event);
-static ErlDrvOseEventId inet_resolve_signal(union SIGNAL *sig);
-
-#ifdef INET_DRV_DEBUG
-
-static char *read_req = "SO_EVENT_READ_REQUEST";
-static char *read_rep = "SO_EVENT_READ_REPLY";
-static char *write_req = "SO_EVENT_WRITE_REQUEST";
-static char *write_rep = "SO_EVENT_WRITE_REPLY";
-static char *eof_req = "SO_EVENT_EOF_REQUEST";
-static char *eof_rep = "SO_EVENT_EOF_REPLY";
-static char *accept_req = "SO_EVENT_ACCEPT_REQUEST";
-static char *accept_rep = "SO_EVENT_ACCEPT_REPLY";
-static char *connect_req = "SO_EVENT_CONNECT_REQUEST";
-static char *connect_rep = "SO_EVENT_CONNECT_REPLY";
-static char *error_req = "SO_EVENT_ERROR_REQUEST";
-static char *error_rep = "SO_EVENT_ERROR_REPLY";
-static char signo_tmp[32];
-
-static char *signo_to_string(SIGSELECT signo) {
- switch (signo) {
- case SO_EVENT_READ_REQUEST: { return read_req; }
- case SO_EVENT_READ_REPLY: { return read_rep; }
- case SO_EVENT_WRITE_REQUEST: { return write_req; }
- case SO_EVENT_WRITE_REPLY: { return write_rep; }
- case SO_EVENT_EOF_REQUEST: { return eof_req; }
- case SO_EVENT_EOF_REPLY: { return eof_rep; }
- case SO_EVENT_ACCEPT_REQUEST: { return accept_req; }
- case SO_EVENT_ACCEPT_REPLY: { return accept_rep; }
- case SO_EVENT_CONNECT_REQUEST: { return connect_req; }
- case SO_EVENT_CONNECT_REPLY: { return connect_rep; }
- case SO_EVENT_ERROR_REQUEST: { return error_req; }
- case SO_EVENT_ERROR_REPLY: { return error_rep; }
- }
-
- snprintf(signo_tmp,32,"0x%x",signo);
-
- return signo_tmp;
-}
-
-#endif
-
-#endif /* __OSE__ */
-
-
static struct erl_drv_entry tcp_inet_driver_entry =
{
tcp_inet_init, /* inet_init will add this driver !! */
@@ -1278,9 +1070,6 @@ static struct erl_drv_entry tcp_inet_driver_entry =
#ifdef __WIN32__
tcp_inet_event,
NULL,
-#elif defined(__OSE__)
- tcp_inet_drv_input_ose, /*ready_input*/
- tcp_inet_drv_output_ose, /*ready_output*/
#else
tcp_inet_drv_input,
tcp_inet_drv_output,
@@ -1288,17 +1077,9 @@ static struct erl_drv_entry tcp_inet_driver_entry =
"tcp_inet",
NULL,
NULL,
-#ifdef __OSE__
- tcp_inet_ctl_ose,
-#else
tcp_inet_ctl,
-#endif
tcp_inet_timeout,
-#ifdef __OSE__
- tcp_inet_commandv_ose,
-#else
tcp_inet_commandv,
-#endif
NULL,
tcp_inet_flush,
NULL,
@@ -1450,14 +1231,6 @@ static int packet_inet_output(udp_descriptor* udesc, HANDLE event);
/* convert descriptor pointer to inet_descriptor pointer */
#define INETP(d) (&(d)->inet)
-#ifdef __OSE__
-static void inet_driver_select(inet_descriptor* desc,
- int flags, int onoff);
-static void tcp_inet_ose_dispatch_signals(tcp_descriptor *desc,
- int prev_select_state,
- union SIGNAL *sig);
-#endif
-
static int async_ref = 0; /* async reference id generator */
#define NEW_ASYNC_ID() ((async_ref++) & 0xffff)
@@ -2749,7 +2522,7 @@ int ssl_tls_inetdrv(void* arg, unsigned type, unsigned major, unsigned minor,
{
tcp_descriptor* desc = (tcp_descriptor*) arg;
int i = 0;
- ErlDrvTermData spec[28];
+ ErlDrvTermData spec[30];
ErlDrvTermData caller = ERL_DRV_NIL;
ErlDrvBinary* bin;
int ret;
@@ -2790,11 +2563,11 @@ int ssl_tls_inetdrv(void* arg, unsigned type, unsigned major, unsigned minor,
if (desc->inet.active == INET_PASSIVE) {
i = LOAD_TUPLE(spec, i, 2);
i = LOAD_TUPLE(spec, i, 4);
- ASSERT(i <= 28);
+ ASSERT(i <= sizeof(spec)/sizeof(*spec));
ret = erl_drv_send_term(desc->inet.dport, caller, spec, i);
}
else {
- ASSERT(i <= 28);
+ ASSERT(i <= sizeof(spec)/sizeof(*spec));
ret = erl_drv_output_term(desc->inet.dport, spec, i);
}
done:
@@ -4353,16 +4126,6 @@ static void desc_close(inet_descriptor* desc)
desc->forced_events = 0;
desc->send_would_block = 0;
#endif
-#ifdef __OSE__
- if (desc->events[0]) {
- driver_select(desc->port,desc->events[0],FD_READ|FD_WRITE|ERL_DRV_USE,0);
- driver_select(desc->port,desc->events[1],FD_READ|FD_WRITE|ERL_DRV_USE,0);
- driver_select(desc->port,desc->events[2],FD_READ|FD_WRITE|ERL_DRV_USE,0);
- driver_select(desc->port,desc->events[3],FD_READ|FD_WRITE|ERL_DRV_USE,0);
- driver_select(desc->port,desc->events[4],FD_READ|FD_WRITE|ERL_DRV_USE,0);
- driver_select(desc->port,desc->events[5],FD_READ|FD_WRITE|ERL_DRV_USE,0);
- }
-#else
/*
* We should close the fd here, but the other driver might still
* be selecting on it.
@@ -4372,7 +4135,6 @@ static void desc_close(inet_descriptor* desc)
ERL_DRV_USE, 0);
else
inet_stop_select((ErlDrvEvent)(long)desc->event,NULL);
-#endif
desc->event = INVALID_EVENT; /* closed by stop_select callback */
desc->s = INVALID_SOCKET;
desc->event_mask = 0;
@@ -4414,65 +4176,6 @@ static int erl_inet_close(inet_descriptor* desc)
return 0;
}
-#ifdef __OSE__
-static void inet_select_init(inet_descriptor* desc)
-{
- desc->events[0] =
- erl_drv_ose_event_alloc(SO_EVENT_READ_REPLY,
- desc->s,
- inet_resolve_signal,
- NULL);
- driver_select(desc->port, desc->events[0],
- ERL_DRV_READ|ERL_DRV_USE, 1);
-
- desc->events[1] =
- erl_drv_ose_event_alloc(SO_EVENT_EOF_REPLY,
- desc->s,
- inet_resolve_signal,
- NULL);
- driver_select(desc->port, desc->events[1],
- ERL_DRV_READ|ERL_DRV_USE, 1);
-
- desc->events[2] =
- erl_drv_ose_event_alloc(SO_EVENT_ACCEPT_REPLY,
- desc->s,
- inet_resolve_signal,
- NULL);
- driver_select(desc->port, desc->events[2],
- ERL_DRV_READ|ERL_DRV_USE, 1);
-
- /* trigger tcp_inet_input */
- desc->events[3] =
- erl_drv_ose_event_alloc(SO_EVENT_WRITE_REPLY,
- desc->s,
- inet_resolve_signal,
- NULL);
- driver_select(desc->port, desc->events[3],
- ERL_DRV_WRITE|ERL_DRV_USE, 1);
-
- desc->events[4] =
- erl_drv_ose_event_alloc(SO_EVENT_CONNECT_REPLY,
- desc->s,
- inet_resolve_signal,
- NULL);
- driver_select(desc->port, desc->events[4],
- ERL_DRV_WRITE|ERL_DRV_USE, 1);
-
- desc->events[5] =
- erl_drv_ose_event_alloc(SO_EVENT_ERROR_REPLY,
- desc->s,
- inet_resolve_signal,
- NULL);
- driver_select(desc->port, desc->events[5],
- ERL_DRV_WRITE|ERL_DRV_USE, 1);
-
- /* Issue a select on error event before any other select to be sure we are
- prepared to receive error notifications from the stack, even in the
- situations when select isn't issued */
- sock_select(desc, SOCK_FD_ERROR, 1);
-}
-#endif
-
static ErlDrvSSizeT inet_ctl_open(inet_descriptor* desc, int domain, int type,
char** rbuf, ErlDrvSizeT rsize)
{
@@ -4555,9 +4258,6 @@ static ErlDrvSSizeT inet_ctl_open(inet_descriptor* desc, int domain, int type,
#ifdef __WIN32__
driver_select(desc->port, desc->event, ERL_DRV_READ, 1);
#endif
-#ifdef __OSE__
- inet_select_init(desc);
-#endif
desc->state = INET_STATE_OPEN;
desc->stype = type;
@@ -4581,13 +4281,7 @@ static ErlDrvSSizeT inet_ctl_fdopen(inet_descriptor* desc, int domain, int type,
if (name.sa.sa_family != domain)
return ctl_error(EINVAL, rbuf, rsize);
}
-#ifdef __OSE__
- /* for fdopen duplicating the sd will allow to uniquely identify
- the signal from OSE with erlang port */
- desc->s = sock_dup(s);
-#else
desc->s = s;
-#endif
if ((desc->event = sock_create_event(desc)) == INVALID_EVENT)
return ctl_error(sock_errno(), rbuf, rsize);
@@ -4605,12 +4299,6 @@ static ErlDrvSSizeT inet_ctl_fdopen(inet_descriptor* desc, int domain, int type,
sz = sizeof(name);
if (!IS_SOCKET_ERROR(sock_peer(s, (struct sockaddr*) &name, &sz))) {
desc->state = INET_STATE_CONNECTED;
-#ifdef __OSE__
- /* since we are dealing with different descriptors (i.e. inet and
- socket) the select part should be initialized with the right
- values */
- inet_select_init(desc);
-#endif
}
}
@@ -6276,6 +5964,12 @@ static int inet_set_opts(inet_descriptor* desc, char* ptr, int len)
}
continue;
+ case INET_LOPT_LINE_DELIM:
+ DEBUGF(("inet_set_opts(%ld): s=%d, LINE_DELIM=%d\r\n",
+ (long)desc->port, desc->s, ival));
+ desc->delimiter = (char)ival;
+ continue;
+
case INET_OPT_REUSEADDR:
#ifdef __WIN32__
continue; /* Bjorn says */
@@ -8371,6 +8065,7 @@ static ErlDrvData inet_start(ErlDrvPort port, int size, int protocol)
desc->deliver = INET_DELIVER_TERM; /* standard term format */
desc->active = INET_PASSIVE; /* start passive */
desc->active_count = 0;
+ desc->delimiter = '\n'; /* line delimiting char */
desc->oph = NULL;
desc->opt = NULL;
@@ -8404,15 +8099,6 @@ static ErlDrvData inet_start(ErlDrvPort port, int size, int protocol)
#ifdef HAVE_SETNS
desc->netns = NULL;
#endif
-#ifdef __OSE__
- desc->select_state = 0;
- desc->events[0] = NULL;
- desc->events[1] = NULL;
- desc->events[2] = NULL;
- desc->events[3] = NULL;
- desc->events[4] = NULL;
- desc->events[5] = NULL;
-#endif
return (ErlDrvData)desc;
}
@@ -9139,10 +8825,6 @@ static tcp_descriptor* tcp_inet_copy(tcp_descriptor* desc,SOCKET s,
copy_desc->inet.port = port;
copy_desc->inet.dport = driver_mk_port(port);
-#ifdef __OSE__
- inet_select_init(&copy_desc->inet);
-#endif
-
*err = 0;
return copy_desc;
}
@@ -9204,23 +8886,6 @@ static void tcp_inet_stop(ErlDrvData e)
inet_stop(INETP(desc));
}
-#ifdef __OSE__
-
-static ErlDrvSSizeT tcp_inet_ctl_ose(ErlDrvData e, unsigned int cmd,
- char* buf, ErlDrvSizeT len,
- char** rbuf, ErlDrvSizeT rsize) {
-
- tcp_descriptor* desc = (tcp_descriptor*)e;
- int prev_select_state = INETP(desc)->select_state;
-
- ErlDrvSSizeT res = tcp_inet_ctl(e,cmd,buf,len,rbuf,rsize);
-
- tcp_inet_ose_dispatch_signals((tcp_descriptor*)e,prev_select_state,NULL);
-
- return res;
-}
-#endif
-
/* TCP requests from Erlang */
static ErlDrvSSizeT tcp_inet_ctl(ErlDrvData e, unsigned int cmd,
char* buf, ErlDrvSizeT len,
@@ -9662,17 +9327,6 @@ static void tcp_inet_command(ErlDrvData e, char *buf, ErlDrvSizeT len)
DEBUGF(("tcp_inet_command(%ld) }\r\n", (long)desc->inet.port));
}
-#ifdef __OSE__
-
-static void tcp_inet_commandv_ose(ErlDrvData e, ErlIOVec* ev) {
- int prev_select_state = INETP((tcp_descriptor*)e)->select_state;
- tcp_inet_commandv(e, ev);
- tcp_inet_ose_dispatch_signals((tcp_descriptor*)e,prev_select_state,NULL);
-}
-
-#endif
-
-
static void tcp_inet_commandv(ErlDrvData e, ErlIOVec* ev)
{
tcp_descriptor* desc = (tcp_descriptor*)e;
@@ -9745,22 +9399,6 @@ static void inet_stop_select(ErlDrvEvent event, void* _)
{
#ifdef __WIN32__
WSACloseEvent((HANDLE)event);
-#elif defined(__OSE__)
- ErlDrvOseEventId id;
- union SIGNAL *sig;
- erl_drv_ose_event_fetch(event, NULL, &id,NULL);
- DEBUGF(("inet_stop_select(?#?) {s=%d\n",id));
- sock_close((int)id);
- /* On socket close all the signals waiting to be processed as part of the
- select should be deallocated */
- while((sig = erl_drv_ose_get_signal(event))) {
- DEBUGF(("inet_stop_select(?#?): Freeing signal %s\n",
- signo_to_string(sig->signo)));
- free_buf(&sig);
- }
- erl_drv_ose_event_free(event);
- DEBUGF(("inet_stop_select(?#?) }\n"));
-
#else
sock_close((SOCKET)(long)event);
#endif
@@ -9882,7 +9520,7 @@ static int tcp_remain(tcp_descriptor* desc, int* len)
tlen = packet_get_length(desc->inet.htype, ptr, n,
desc->inet.psize, desc->i_bufsz,
- &desc->http_state);
+ desc->inet.delimiter, &desc->http_state);
DEBUGF(("tcp_remain(%ld): s=%d, n=%d, nfill=%d nsz=%d, tlen %d\r\n",
(long)desc->inet.port, desc->inet.s, n, nfill, nsz, tlen));
@@ -10309,146 +9947,7 @@ static void tcp_inet_event(ErlDrvData e, ErlDrvEvent event)
return;
}
-#elif defined(__OSE__) /* !__WIN32__ */
-/* The specific resolve signal function. It will return the socket descriptor
- for which the select was issued */
-static ErlDrvOseEventId inet_resolve_signal(union SIGNAL *sig) {
- DEBUGF(("%s(?#?): s=%d got signal %s, status = %d, extra = %d, sender = 0x%x\n",
- __FUNCTION__,sig->async.fd,signo_to_string(sig->signo),
- sig->async.event.status,
- sig->async.event.extra,sender(&sig)));
- if (sig->signo == SO_EVENT_READ_REPLY ||
- sig->signo == SO_EVENT_ACCEPT_REPLY ||
- sig->signo == SO_EVENT_EOF_REPLY ||
- sig->signo == SO_EVENT_WRITE_REPLY ||
- sig->signo == SO_EVENT_ERROR_REPLY ||
- sig->signo == SO_EVENT_CONNECT_REPLY ) {
- return sig->async.fd;
- }
-
- return -1;
-}
-
-static void inet_driver_select(inet_descriptor* desc,
- int flags, int onoff) {
- ASSERT(!desc->is_ignored);
-
- if(onoff) {
- desc->select_state |= flags;
- } else {
- desc->select_state &= ~flags;
- }
-}
-
-static ssize_t writev_fallback(int fd, const struct iovec *iov, int iovcnt, int max_sz)
-{
- size_t data_len = 0;
- size_t sent = 0;
- ssize_t n;
- int i;
-
- for(i = 0; i < iovcnt; i++)
- {
- data_len = iov[i].iov_len;
-tryagain:
- n = sock_send(fd, iov[i].iov_base, data_len, 0);
- if (IS_SOCKET_ERROR(n)) {
- /* If buffer length is greater than the amount stack is able to
- * send out then try to send at least max_sz (this comes with
- * SO_EVENT_WRITE_REPLY signal*/
- if ((errno == EMSGSIZE) && (max_sz > 0) && (data_len > max_sz)) {
- data_len = max_sz;
- goto tryagain;
- }
- break;
- }
- sent += n;
- }
- return sent;
-}
-
-#define OSE_EVENT_REQ(TCP_DESC,EVENT) do { \
- union SIGNAL *sig = alloc(sizeof(struct OseAsyncSig), EVENT); \
- sig->async.fd = INETP(TCP_DESC)->s; \
- ose_request_event(INETP(TCP_DESC)->s, &sig, 1); \
- DEBUGF(("%s(%ld): s=%d sent %s\r\n",__FUNCTION__, \
- INETP(TCP_DESC)->port,INETP(TCP_DESC)->s,signo_to_string(EVENT))); \
- } while(0)
-
-static void tcp_inet_ose_dispatch_signals(tcp_descriptor *desc,
- int prev_select_state,
- union SIGNAL *sig) {
- if (sig) {
- DEBUGF(("tcp_inet_ose_dispatch_signals(%ld) {s=%d resend\r\n",
- (long)INETP(desc)->port,INETP(desc)->s));
- /* We are reacting to a signal, which means that if
- the select_state for that signal is still activated
- we should send a new signal */
- switch (sig->signo) {
- case SO_EVENT_READ_REPLY: {
- if (INETP(desc)->select_state & FD_READ)
- OSE_EVENT_REQ(desc,SO_EVENT_READ_REQUEST);
- break;
- }
- case SO_EVENT_WRITE_REPLY: {
- if (INETP(desc)->select_state & FD_WRITE)
- OSE_EVENT_REQ(desc,SO_EVENT_WRITE_REQUEST);
- break;
- }
- case SO_EVENT_CONNECT_REPLY: {
- if (INETP(desc)->select_state & FD_CONNECT)
- OSE_EVENT_REQ(desc,SO_EVENT_CONNECT_REQUEST);
- break;
- }
- case SO_EVENT_ACCEPT_REPLY: {
- if (INETP(desc)->select_state & FD_ACCEPT)
- OSE_EVENT_REQ(desc,SO_EVENT_ACCEPT_REQUEST);
- break;
- }
- case SO_EVENT_ERROR_REPLY: {
- if (INETP(desc)->select_state & SOCK_FD_ERROR)
- OSE_EVENT_REQ(desc,SO_EVENT_ERROR_REQUEST);
- break;
- }
-
- }
- DEBUGF(("tcp_inet_ose_dispatch_signals(%ld) }\r\n",
- (long)INETP(desc)->port));
- }
-
- if (INETP(desc)->select_state != prev_select_state) {
- /* If the select state has changed we have to issue signals for
- the state parts that have changed. */
- int xor_select_state = INETP(desc)->select_state ^ prev_select_state;
- DEBUGF(("tcp_inet_ose_dispatch_signals(%ld) {s=%d select change\r\n",
- (long)INETP(desc)->port,INETP(desc)->s));
- if ((xor_select_state & FD_READ) &&
- (INETP(desc)->select_state & FD_READ)) {
- OSE_EVENT_REQ(desc,SO_EVENT_READ_REQUEST);
- }
- if ((xor_select_state & FD_WRITE) &&
- (INETP(desc)->select_state & FD_WRITE)) {
- OSE_EVENT_REQ(desc,SO_EVENT_WRITE_REQUEST);
- }
- if ((xor_select_state & FD_CONNECT) &&
- (INETP(desc)->select_state & FD_CONNECT)) {
- OSE_EVENT_REQ(desc,SO_EVENT_CONNECT_REQUEST);
- }
- if ((xor_select_state & FD_ACCEPT) &&
- (INETP(desc)->select_state & FD_ACCEPT)) {
- OSE_EVENT_REQ(desc,SO_EVENT_ACCEPT_REQUEST);
- }
- if ((xor_select_state & SOCK_FD_ERROR) &&
- (INETP(desc)->select_state & SOCK_FD_ERROR)) {
- OSE_EVENT_REQ(desc,SO_EVENT_ERROR_REQUEST);
- }
-
- DEBUGF(("tcp_inet_ose_dispatch_signals(%ld) }\r\n",
- (long)INETP(desc)->port));
- }
-}
-
-#endif /* __OSE__ */
+#endif /* __WIN32__ */
/* socket has input:
@@ -10935,49 +10434,6 @@ static void tcp_shutdown_async(tcp_descriptor* desc)
desc->tcp_add_flags |= TCP_ADDF_SHUTDOWN_WR_DONE;
}
-#ifdef __OSE__
-
-static void tcp_inet_drv_output_ose(ErlDrvData data, ErlDrvEvent event)
-{
- union SIGNAL *event_sig = erl_drv_ose_get_signal(event);
-
- while (event_sig) {
- int prev_select_state = INETP((tcp_descriptor*)data)->select_state;
- int res = tcp_inet_output((tcp_descriptor*)data, (HANDLE)event_sig);
- if (res != -1) {
- tcp_inet_ose_dispatch_signals((tcp_descriptor*)data,
- prev_select_state,event_sig);
- free_buf(&event_sig);
- event_sig = erl_drv_ose_get_signal(event);
- } else {
- /* NOTE: here the event object could have been deallocated!!!!
- inet_stop_select is called when doing driver_select(ERL_DRV_USE,0)
- */
- free_buf(&event_sig);
- return;
- }
- }
-}
-
-static void tcp_inet_drv_input_ose(ErlDrvData data, ErlDrvEvent event)
-{
- union SIGNAL *event_sig = erl_drv_ose_get_signal(event);
-
- while (event_sig) {
- int prev_select_state = INETP((tcp_descriptor*)data)->select_state;
- int res = tcp_inet_input((tcp_descriptor*)data, (HANDLE)event);
- if (res != -1) {
- tcp_inet_ose_dispatch_signals((tcp_descriptor*)data, prev_select_state,
- event_sig);
- free_buf(&event_sig);
- event_sig = erl_drv_ose_get_signal(event);
- } else {
- free_buf(&event_sig);
- return;
- }
- }
-}
-#else
static void tcp_inet_drv_output(ErlDrvData data, ErlDrvEvent event)
{
(void)tcp_inet_output((tcp_descriptor*)data, (HANDLE)event);
@@ -10987,7 +10443,6 @@ static void tcp_inet_drv_input(ErlDrvData data, ErlDrvEvent event)
{
(void)tcp_inet_input((tcp_descriptor*)data, (HANDLE)event);
}
-#endif
/* socket ready for ouput:
** 1. INET_STATE_CONNECTING => non block connect ?
@@ -11053,13 +10508,6 @@ static int tcp_inet_output(tcp_descriptor* desc, HANDLE event)
ssize_t n;
SysIOVec* iov;
-#ifdef __OSE__
- /* For large size buffers case the amount of data that the stack is
- able to send out (received in the .extra field) should be passed
- down to writev_fallback */
- n = event ? ((union SIGNAL*)event)->async.event.extra : 0;
-#endif
-
if ((iov = driver_peekq(ix, &vsize)) == NULL) {
sock_select(INETP(desc), FD_WRITE, 0);
send_empty_out_q_msgs(INETP(desc));
@@ -11087,12 +10535,6 @@ static int tcp_inet_output(tcp_descriptor* desc, HANDLE event)
sizes > (max 32 bit signed int) */
size_t howmuch = 0x7FFFFFFF; /* max signed 32 bit */
int x;
-#ifdef __OSE__
- /* For EWOULDBLOCK sock_sendv returns 0 so we have to be sure it
- wasn't the case */
- if(sock_errno() == ERRNO_BLOCK)
- goto done;
-#endif
for(x = 0; x < vsize && iov[x].iov_len == 0; ++x)
;
if (x < vsize) {
diff --git a/erts/emulator/drivers/ose/ose_efile.c b/erts/emulator/drivers/ose/ose_efile.c
deleted file mode 100644
index c8337a95d5..0000000000
--- a/erts/emulator/drivers/ose/ose_efile.c
+++ /dev/null
@@ -1,1125 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1997-2012. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- */
-/*
- * Purpose: Provides file and directory operations for OSE.
- */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-#if defined(HAVE_POSIX_FALLOCATE) && !defined(__sun) && !defined(__sun__)
-#define _XOPEN_SOURCE 600
-#endif
-#if !defined(_GNU_SOURCE) && defined(HAVE_LINUX_FALLOC_H)
-#define _GNU_SOURCE
-#endif
-#include "sys.h"
-#include "erl_driver.h"
-#include "erl_efile.h"
-#if defined(DARWIN) || defined(HAVE_LINUX_FALLOC_H) || defined(HAVE_POSIX_FALLOCATE)
-#include "fcntl.h"
-#endif
-#include "ose.h"
-#include "unistd.h"
-#include "sys/stat.h"
-#include "dirent.h"
-#include "sys/time.h"
-#include "time.h"
-#include "assert.h"
-
-/* Find a definition of MAXIOV, that is used in the code later. */
-#if defined IOV_MAX
-#define MAXIOV IOV_MAX
-#elif defined UIO_MAXIOV
-#define MAXIOV UIO_MAXIOV
-#else
-#define MAXIOV 16
-#endif
-
-/*
- * Macros for testing file types.
- */
-
-#define ISDIR(st) (((st).st_mode & S_IFMT) == S_IFDIR)
-#define ISREG(st) (((st).st_mode & S_IFMT) == S_IFREG)
-#define ISDEV(st) \
- (((st).st_mode&S_IFMT) == S_IFCHR || ((st).st_mode&S_IFMT) == S_IFBLK)
-#define ISLNK(st) (((st).st_mode & S_IFLNK) == S_IFLNK)
-#ifdef NO_UMASK
-#define FILE_MODE 0644
-#define DIR_MODE 0755
-#else
-#define FILE_MODE 0666
-#define DIR_MODE 0777
-#endif
-
-#define IS_DOT_OR_DOTDOT(s) \
- (s[0] == '.' && (s[1] == '\0' || (s[1] == '.' && s[2] == '\0')))
-
-/*
- * Macros for handling local file descriptors
- * and mutexes.
- *
- * Handling of files like this is necessary because OSE
- * does not allow seeking after the end of a file. So
- * what we do it emulate this by keeping track of the size
- * of the file and where the file's positions is. If a
- * write happens after eof then we pad it.
- *
- * Given time this should be rewritten to get rid of the
- * mutex and use the port lock to protect the data. This
- * could be done be done by adapting the efile api for some
- * calls to allow some meta-data to be associated with the
- * open file.
- */
-
-#define L_FD_IS_VALID(fd_data) ((fd_data)->beyond_eof > 0)
-#define L_FD_INVALIDATE(fd_data) (fd_data)->beyond_eof = 0
-#define L_FD_CUR(fd_data) (fd_data)->pos
-#define L_FD_OFFS_BEYOND_EOF(fd_data, offs) \
- (((fd_data)->size > offs) ? 0 : 1)
-
-#define L_FD_FAIL -1
-#define L_FD_SUCCESS 1
-#define L_FD_PAD_SIZE 255
-
-struct fd_meta {
- ErlDrvMutex *meta_mtx;
- struct fd_data *fd_data_list;
-};
-
-struct fd_data {
- int fd;
- struct fd_data *next;
- struct fd_data *prev;
- int pos;
- int beyond_eof;
- size_t size;
-#ifdef DEBUG
- PROCESS owner;
-#endif
-};
-
-static int l_invalidate_local_fd(int fd);
-static int l_pad_file(struct fd_data *fd_data, off_t offset);
-static int check_error(int result, Efile_error* errInfo);
-static struct fd_data* l_new_fd(void);
-static int l_remove_local_fd(int fd);
-static struct fd_data* l_find_local_fd(int fd);
-static int l_update_local_fd(int fd, int pos, int size);
-
-static struct fd_meta* fdm = NULL;
-
-
-/***************************************************************************/
-
-static int
-l_remove_local_fd(int fd)
-{
- struct fd_data *fd_data;
- fd_data = l_find_local_fd(fd);
-
- if (fd_data == NULL) {
- return L_FD_FAIL;
- }
-#ifdef DEBUG
- assert(fd_data->owner == current_process());
-#endif
- erl_drv_mutex_lock(fdm->meta_mtx);
- /* head ? */
- if (fd_data == fdm->fd_data_list) {
- if (fd_data->next != NULL) {
- /* remove link to head */
- fd_data->next->prev = NULL;
- /* set new head */
- fdm->fd_data_list = fd_data->next;
- }
- else {
- /* head is lonely */
- fdm->fd_data_list = NULL;
- }
- }
- else { /* not head */
- if (fd_data->prev == NULL) {
- erl_drv_mutex_unlock(fdm->meta_mtx);
- return L_FD_FAIL;
- }
- else {
- if (fd_data->next != NULL) {
- fd_data->next->prev = fd_data->prev;
- fd_data->prev->next = fd_data->next;
- }
- else {
- fd_data->prev->next = NULL;
- }
- }
- }
-
- /* scramble values */
- fd_data->beyond_eof = -1;
- fd_data->next = NULL;
- fd_data->prev = NULL;
- fd_data->fd = -1;
-
- /* unlock and clean */
- driver_free(fd_data);
- erl_drv_mutex_unlock(fdm->meta_mtx);
-
- return L_FD_SUCCESS;
-}
-
-/***************************************************************************/
-
-static int
-l_invalidate_local_fd(int fd) {
- struct fd_data *fd_data;
-
- if ((fd_data = l_find_local_fd(fd)) == NULL) {
- return L_FD_FAIL;
- }
-
- fd_data->beyond_eof = 0;
- return L_FD_SUCCESS;
-}
-
-/****************************************************************************/
-
-static struct fd_data*
-l_find_local_fd(int fd) {
- struct fd_data *fd_data;
-
- fd_data = NULL;
- erl_drv_mutex_lock(fdm->meta_mtx);
- for (fd_data = fdm->fd_data_list; fd_data != NULL; ) {
- if (fd_data->fd == fd) {
-#ifdef DEBUG
- assert(fd_data->owner == current_process());
-#endif
- break;
- }
- fd_data = fd_data->next;
- }
- erl_drv_mutex_unlock(fdm->meta_mtx);
- return fd_data;
-}
-
-/***************************************************************************/
-
-static struct fd_data*
-l_new_fd(void) {
- struct fd_data *fd_data;
-
- fd_data = driver_alloc(sizeof(struct fd_data));
- if (fd_data == NULL) {
- return NULL;
- }
- erl_drv_mutex_lock(fdm->meta_mtx);
- if (fdm->fd_data_list == NULL) {
- fdm->fd_data_list = fd_data;
- fdm->fd_data_list->prev = NULL;
- fdm->fd_data_list->next = NULL;
- }
- else {
- fd_data->next = fdm->fd_data_list;
- fdm->fd_data_list = fd_data;
- fdm->fd_data_list->prev = NULL;
- }
-#ifdef DEBUG
- fd_data->owner = current_process();
-#endif
- erl_drv_mutex_unlock(fdm->meta_mtx);
- return fd_data;
-}
-
-/***************************************************************************/
-
-static int
-l_update_local_fd(int fd, int pos, int size) {
- struct fd_data *fd_data = NULL;
-
- fd_data = l_find_local_fd(fd);
- /* new fd to handle? */
- if (fd_data == NULL) {
- fd_data = l_new_fd();
- if (fd_data == NULL) {
- /* out of memory */
- return L_FD_FAIL;
- }
- }
- fd_data->size = size;
- fd_data->pos = pos;
- fd_data->fd = fd;
- fd_data->beyond_eof = 1;
-
- return L_FD_SUCCESS;
-}
-
-/***************************************************************************/
-
-static int
-l_pad_file(struct fd_data *fd_data, off_t offset) {
- int size_dif;
- int written = 0;
- int ret_val = L_FD_SUCCESS;
- char padding[L_FD_PAD_SIZE];
-
- size_dif = (offset - fd_data->size);
- memset(&padding, '\0', L_FD_PAD_SIZE);
-
- while (size_dif > 0) {
- written = write(fd_data->fd, padding,
- (size_dif < L_FD_PAD_SIZE) ?
- size_dif : L_FD_PAD_SIZE);
- if (written < 0 && errno != EINTR && errno != EAGAIN) {
- ret_val = -1;
- break;
- }
- size_dif -= written;
- }
- L_FD_INVALIDATE(fd_data);
- return ret_val;
-}
-
-/***************************************************************************/
-
-static int
-check_error(int result, Efile_error *errInfo) {
- if (result < 0) {
- errInfo->posix_errno = errInfo->os_errno = errno;
- return 0;
- }
- return 1;
-}
-
-/***************************************************************************/
-
-int
-efile_init() {
- fdm = driver_alloc(sizeof(struct fd_meta));
- if (fdm == NULL) {
- return L_FD_FAIL;
- }
- fdm->meta_mtx = erl_drv_mutex_create("ose_efile local fd mutex\n");
- erl_drv_mutex_lock(fdm->meta_mtx);
- fdm->fd_data_list = NULL;
- erl_drv_mutex_unlock(fdm->meta_mtx);
- return L_FD_SUCCESS;
-}
-
-/***************************************************************************/
-
-int
-efile_mkdir(Efile_error* errInfo, /* Where to return error codes. */
- char* name) /* Name of directory to create. */
-{
-#ifdef NO_MKDIR_MODE
- return check_error(mkdir(name), errInfo);
-#else
- int res = mkdir(name, DIR_MODE);
- if (res < 0 && errno == EINVAL) {
- errno = ENOENT;
- }
- return check_error(res, errInfo);
-#endif
-}
-
-/***************************************************************************/
-
-int
-efile_rmdir(Efile_error* errInfo, /* Where to return error codes. */
- char* name) /* Name of directory to delete. */
-{
- if (rmdir(name) == 0) {
- return 1;
- }
- if (errno == ENOTEMPTY) {
- errno = EEXIST;
- }
- if (errno == EEXIST || errno == EINVAL) {
- int saved_errno = errno;
- struct stat file_stat;
- struct stat cwd_stat;
-
- if(stat(name, &file_stat) != 0) {
- errno = ENOENT;
- return check_error(-1, errInfo);
- }
- /*
- * The error code might be wrong if this is the current directory.
- */
- if (stat(name, &file_stat) == 0 && stat(".", &cwd_stat) == 0 &&
- file_stat.st_ino == cwd_stat.st_ino &&
- file_stat.st_dev == cwd_stat.st_dev) {
- saved_errno = EACCES;
- }
- errno = saved_errno;
- }
- return check_error(-1, errInfo);
-}
-
-/***************************************************************************/
-
-int
-efile_delete_file(Efile_error* errInfo, /* Where to return error codes. */
- char* name) /* Name of file to delete. */
-{
- struct stat statbuf;
-
- if (stat(name, &statbuf) >= 0) {
- /* Do not let unlink() remove directories */
- if (ISDIR(statbuf)) {
- errno = EPERM;
- return check_error(-1, errInfo);
- }
-
- if (unlink(name) == 0) {
- return 1;
- }
-
- if (errno == EISDIR) {
- errno = EPERM;
- return check_error(-1, errInfo);
- }
- }
- else {
- if (errno == EINVAL) {
- errno = ENOENT;
- return check_error(-1, errInfo);
- }
- }
- return check_error(-1, errInfo);
-}
-
-/*
- *---------------------------------------------------------------------------
- *
- * Changes the name of an existing file or directory, from src to dst.
- * If src and dst refer to the same file or directory, does nothing
- * and returns success. Otherwise if dst already exists, it will be
- * deleted and replaced by src subject to the following conditions:
- * If src is a directory, dst may be an empty directory.
- * If src is a file, dst may be a file.
- * In any other situation where dst already exists, the rename will
- * fail.
- *
- * Results:
- * If the directory was successfully created, returns 1.
- * Otherwise the return value is 0 and errno is set to
- * indicate the error. Some possible values for errno are:
- *
- * EACCES: src or dst parent directory can't be read and/or written.
- * EEXIST: dst is a non-empty directory.
- * EINVAL: src is a root directory or dst is a subdirectory of src.
- * EISDIR: dst is a directory, but src is not.
- * ENOENT: src doesn't exist, or src or dst is "".
- * ENOTDIR: src is a directory, but dst is not.
- * EXDEV: src and dst are on different filesystems.
- *
- * Side effects:
- * The implementation of rename may allow cross-filesystem renames,
- * but the caller should be prepared to emulate it with copy and
- * delete if errno is EXDEV.
- *
- *---------------------------------------------------------------------------
- */
-
-int
-efile_rename(Efile_error* errInfo, /* Where to return error codes. */
- char* src, /* Original name. */
- char* dst) /* New name. */
-{
-
- /* temporary fix AFM does not recognize ./<file name>
- * in destination remove pending on adaption of AFM fix
- */
-
- char *dot_str;
- if (dst != NULL) {
- dot_str = strchr(dst, '.');
- if (dot_str && dot_str == dst && dot_str[1] == '/') {
- dst = dst+2;
- }
- }
-
- if (rename(src, dst) == 0) {
- return 1;
- }
- if (errno == ENOTEMPTY) {
- errno = EEXIST;
- }
- if (errno == EINVAL) {
- struct stat file_stat;
-
- if (stat(dst, &file_stat)== 0) {
- if (ISDIR(file_stat)) {
- errno = EISDIR;
- }
- else if (ISREG(file_stat)) {
- errno = ENOTDIR;
- }
- else {
- errno = EINVAL;
- }
- }
- else {
- errno = EINVAL;
- }
- }
-
- if (strcmp(src, "/") == 0) {
- errno = EINVAL;
- }
- return check_error(-1, errInfo);
-}
-
-/***************************************************************************/
-
-int
-efile_chdir(Efile_error* errInfo, /* Where to return error codes. */
- char* name) /* Name of directory to make current. */
-{
- return check_error(chdir(name), errInfo);
-}
-
-/***************************************************************************/
-
-int
-efile_getdcwd(Efile_error* errInfo, /* Where to return error codes. */
- int drive, /* 0 - current, 1 - A, 2 - B etc. */
- char* buffer, /* Where to return the current
- directory. */
- size_t size) /* Size of buffer. */
-{
- if (drive == 0) {
- if (getcwd(buffer, size) == NULL)
- return check_error(-1, errInfo);
-
- return 1;
- }
-
- /*
- * Drives other than 0 is not supported on Unix.
- */
-
- errno = ENOTSUP;
- return check_error(-1, errInfo);
-}
-
-/***************************************************************************/
-
-int
-efile_readdir(Efile_error* errInfo, /* Where to return error codes. */
- char* name, /* Name of directory to open. */
- EFILE_DIR_HANDLE* p_dir_handle, /* Pointer to directory
- handle of
- open directory.*/
- char* buffer, /* Pointer to buffer for
- one filename. */
- size_t *size) /* in-out Size of buffer, length
- of name. */
-{
- DIR *dp; /* Pointer to directory structure. */
- struct dirent* dirp; /* Pointer to directory entry. */
-
- /*
- * If this is the first call, we must open the directory.
- */
-
- if (*p_dir_handle == NULL) {
- dp = opendir(name);
- if (dp == NULL)
- return check_error(-1, errInfo);
- *p_dir_handle = (EFILE_DIR_HANDLE) dp;
- }
-
- /*
- * Retrieve the name of the next file using the directory handle.
- */
-
- dp = *((DIR **)((void *)p_dir_handle));
- for (;;) {
- dirp = readdir(dp);
- if (dirp == NULL) {
- closedir(dp);
- return 0;
- }
- if (IS_DOT_OR_DOTDOT(dirp->d_name))
- continue;
- buffer[0] = '\0';
- strncat(buffer, dirp->d_name, (*size)-1);
- *size = strlen(dirp->d_name);
- return 1;
- }
-}
-
-/***************************************************************************/
-
-int
-efile_openfile(Efile_error* errInfo, /* Where to return error codes. */
- char* name, /* Name of directory to open. */
- int flags, /* Flags to user for opening. */
- int* pfd, /* Where to store the file
- descriptor. */
- Sint64 *pSize) /* Where to store the size of the
- file. */
-{
- struct stat statbuf;
- int fd;
- int mode; /* Open mode. */
-
- if (stat(name, &statbuf) >= 0 && !ISREG(statbuf)) {
- errno = EISDIR;
- return check_error(-1, errInfo);
- }
-
- switch (flags & (EFILE_MODE_READ|EFILE_MODE_WRITE)) {
- case EFILE_MODE_READ:
- mode = O_RDONLY;
- break;
- case EFILE_MODE_WRITE:
- if (flags & EFILE_NO_TRUNCATE)
- mode = O_WRONLY | O_CREAT;
- else
- mode = O_WRONLY | O_CREAT | O_TRUNC;
- break;
- case EFILE_MODE_READ_WRITE:
- mode = O_RDWR | O_CREAT;
- break;
- default:
- errno = EINVAL;
- return check_error(-1, errInfo);
- }
-
-
- if (flags & EFILE_MODE_APPEND) {
- mode &= ~O_TRUNC;
- mode |= O_APPEND;
- }
-
- if (flags & EFILE_MODE_EXCL) {
- mode |= O_EXCL;
- }
-
- fd = open(name, mode, FILE_MODE);
-
- if (!check_error(fd, errInfo))
- return 0;
-
- *pfd = fd;
- if (pSize) {
- *pSize = statbuf.st_size;
- }
- return 1;
-}
-
-/***************************************************************************/
-
-int
-efile_may_openfile(Efile_error* errInfo, char *name) {
- struct stat statbuf; /* Information about the file */
- int result;
-
- result = stat(name, &statbuf);
- if (!check_error(result, errInfo))
- return 0;
- if (!ISREG(statbuf)) {
- errno = EISDIR;
- return check_error(-1, errInfo);
- }
- return 1;
-}
-
-/***************************************************************************/
-
-void
-efile_closefile(int fd)
-{
- if (l_find_local_fd(fd) != NULL) {
- l_remove_local_fd(fd);
- }
- close(fd);
-}
-
-/***************************************************************************/
-
-int
-efile_fdatasync(Efile_error *errInfo, /* Where to return error codes. */
- int fd) /* File descriptor for file to sync data. */
-{
- return efile_fsync(errInfo, fd);
-}
-
-/***************************************************************************/
-
-int
-efile_fsync(Efile_error *errInfo, /* Where to return error codes. */
- int fd) /* File descriptor for file to sync. */
-{
- return check_error(fsync(fd), errInfo);
-}
-
-/***************************************************************************/
-
-int
-efile_fileinfo(Efile_error* errInfo, Efile_info* pInfo,
- char* name, int info_for_link)
-{
- struct stat statbuf; /* Information about the file */
- int result;
-
- result = stat(name, &statbuf);
- if (!check_error(result, errInfo)) {
- return 0;
- }
-
-#if SIZEOF_OFF_T == 4
- pInfo->size_high = 0;
-#else
- pInfo->size_high = (Uint32)(statbuf.st_size >> 32);
-#endif
- pInfo->size_low = (Uint32)statbuf.st_size;
-
-#ifdef NO_ACCESS
- /* Just look at read/write access for owner. */
-
- pInfo->access = ((statbuf.st_mode >> 6) & 07) >> 1;
-
-#else
- pInfo->access = FA_NONE;
- if (access(name, R_OK) == 0)
- pInfo->access |= FA_READ;
- if (access(name, W_OK) == 0)
- pInfo->access |= FA_WRITE;
-
-#endif
-
- if (ISDEV(statbuf))
- pInfo->type = FT_DEVICE;
- else if (ISDIR(statbuf))
- pInfo->type = FT_DIRECTORY;
- else if (ISREG(statbuf))
- pInfo->type = FT_REGULAR;
- else if (ISLNK(statbuf))
- pInfo->type = FT_SYMLINK;
- else
- pInfo->type = FT_OTHER;
-
- pInfo->accessTime = statbuf.st_atime;
- pInfo->modifyTime = statbuf.st_mtime;
- pInfo->cTime = statbuf.st_ctime;
-
- pInfo->mode = statbuf.st_mode;
- pInfo->links = statbuf.st_nlink;
- pInfo->major_device = statbuf.st_dev;
- pInfo->inode = statbuf.st_ino;
- pInfo->uid = statbuf.st_uid;
- pInfo->gid = statbuf.st_gid;
-
- return 1;
-}
-
-/***************************************************************************/
-
-int
-efile_write_info(Efile_error *errInfo, Efile_info *pInfo, char *name)
-{
- /*
- * On some systems chown will always fail for a non-root user unless
- * POSIX_CHOWN_RESTRICTED is not set. Others will succeed as long as
- * you don't try to chown a file to someone besides youself.
- */
- if (pInfo->mode != -1) {
- mode_t newMode = pInfo->mode & (S_ISUID | S_ISGID |
- S_IRWXU | S_IRWXG | S_IRWXO);
- if (chmod(name, newMode)) {
- newMode &= ~(S_ISUID | S_ISGID);
- if (chmod(name, newMode)) {
- return check_error(-1, errInfo);
- }
- }
- }
-
- return 1;
-}
-
-/***************************************************************************/
-
-int
-efile_write(Efile_error* errInfo, /* Where to return error codes. */
- int flags, /* Flags given when file was
- opened. */
- int fd, /* File descriptor to write to. */
- char* buf, /* Buffer to write. */
- size_t count) /* Number of bytes to write. */
-{
- ssize_t written; /* Bytes written in last operation. */
- struct fd_data *fd_data;
-
- if ((fd_data = l_find_local_fd(fd)) != NULL) {
- if (L_FD_IS_VALID(fd_data)) {
- /* we are beyond eof and need to pad*/
- if (l_pad_file(fd_data, L_FD_CUR(fd_data)) < 0) {
- return check_error(-1, errInfo);
- }
- }
- }
-
- while (count > 0) {
- if ((written = write(fd, buf, count)) < 0) {
- if (errno != EINTR) {
- return check_error(-1, errInfo);
- }
- else {
- written = 0;
- }
- }
- ASSERT(written <= count);
- buf += written;
- count -= written;
- }
- return 1;
-}
-
-/***************************************************************************/
-
-int
-efile_writev(Efile_error* errInfo, /* Where to return error codes */
- int flags, /* Flags given when file was
- * opened */
- int fd, /* File descriptor to write to */
- SysIOVec* iov, /* Vector of buffer structs.
- * The structs may be changed i.e.
- * due to incomplete writes */
- int iovcnt) /* Number of structs in vector */
-{
- struct fd_data *fd_data;
- int cnt = 0; /* Buffers so far written */
-
- ASSERT(iovcnt >= 0);
- if ((fd_data = l_find_local_fd(fd)) != NULL) {
- if (L_FD_IS_VALID(fd_data)) {
- /* we are beyond eof and need to pad*/
- if (l_pad_file(fd_data, L_FD_CUR(fd_data)) < 0) {
- return check_error(-1, errInfo);
- }
- }
- }
- while (cnt < iovcnt) {
- if ((! iov[cnt].iov_base) || (iov[cnt].iov_len <= 0)) {
- /* Empty buffer - skip */
- cnt++;
- }
- else { /* Non-empty buffer */
- ssize_t w; /* Bytes written in this call */
- do {
- w = write(fd, iov[cnt].iov_base, iov[cnt].iov_len);
- } while (w < 0 && errno == EINTR);
-
- ASSERT(w <= iov[cnt].iov_len || w == -1);
-
- if (w < 0) {
- return check_error(-1, errInfo);
- }
- /* Move forward to next buffer to write */
- for (; cnt < iovcnt && w > 0; cnt++) {
- if (iov[cnt].iov_base && iov[cnt].iov_len > 0) {
- if (w < iov[cnt].iov_len) {
- /* Adjust the buffer for next write */
- iov[cnt].iov_len -= w;
- iov[cnt].iov_base += w;
- w = 0;
- break;
- }
- else {
- w -= iov[cnt].iov_len;
- }
- }
- }
- ASSERT(w == 0);
- } /* else Non-empty buffer */
- } /* while (cnt< iovcnt) */
- return 1;
-}
-
-/***************************************************************************/
-
-int
-efile_read(Efile_error* errInfo, /* Where to return error codes. */
- int flags, /* Flags given when file was opened. */
- int fd, /* File descriptor to read from. */
- char* buf, /* Buffer to read into. */
- size_t count, /* Number of bytes to read. */
- size_t *pBytesRead) /* Where to return number of
- bytes read. */
-{
- ssize_t n;
- struct fd_data *fd_data;
-
- if ((fd_data = l_find_local_fd(fd)) != NULL) {
- if (L_FD_IS_VALID(fd_data)) {
- *pBytesRead = 0;
- return 1;
- }
- }
- for (;;) {
- if ((n = read(fd, buf, count)) >= 0) {
- break;
- }
- else if (errno != EINTR) {
- return check_error(-1, errInfo);
- }
- }
- if (fd_data != NULL && L_FD_IS_VALID(fd_data)) {
- L_FD_INVALIDATE(fd_data);
- }
- *pBytesRead = (size_t) n;
- return 1;
-}
-
-/* pread() and pwrite() */
-/* Some unix systems, notably Solaris has these syscalls */
-/* It is especially nice for i.e. the dets module to have support */
-/* for this, even if the underlying OS dosn't support it, it is */
-/* reasonably easy to work around by first calling seek, and then */
-/* calling read(). */
-/* This later strategy however changes the file pointer, which pread() */
-/* does not do. We choose to ignore this and say that the location */
-/* of the file pointer is undefined after a call to any of the p functions*/
-
-
-int
-efile_pread(Efile_error* errInfo, /* Where to return error codes. */
- int fd, /* File descriptor to read from. */
- Sint64 offset, /* Offset in bytes from BOF. */
- char* buf, /* Buffer to read into. */
- size_t count, /* Number of bytes to read. */
- size_t *pBytesRead) /* Where to return
- number of bytes read. */
-{
- int res = efile_seek(errInfo, fd, offset, EFILE_SEEK_SET, NULL);
- if (res) {
- return efile_read(errInfo, 0, fd, buf, count, pBytesRead);
- } else {
- return res;
- }
-}
-
-
-/***************************************************************************/
-
-int
-efile_pwrite(Efile_error* errInfo, /* Where to return error codes. */
- int fd, /* File descriptor to write to. */
- char* buf, /* Buffer to write. */
- size_t count, /* Number of bytes to write. */
- Sint64 offset) /* where to write it */
-{
- int res = efile_seek(errInfo, fd, offset, EFILE_SEEK_SET, NULL);
-
- if (res) {
- return efile_write(errInfo, 0, fd, buf, count);
- } else {
- return res;
- }
-}
-
-/***************************************************************************/
-
-int
-efile_seek(Efile_error* errInfo, /* Where to return error codes. */
- int fd, /* File descriptor to do the seek on. */
- Sint64 offset, /* Offset in bytes from the given
- origin. */
- int origin, /* Origin of seek (SEEK_SET, SEEK_CUR,
- SEEK_END). */
- Sint64 *new_location) /* Resulting new location in file. */
-{
- off_t off, result;
- off = (off_t) offset;
-
- switch (origin) {
- case EFILE_SEEK_SET:
- origin = SEEK_SET;
- break;
- case EFILE_SEEK_CUR:
- origin = SEEK_CUR;
- break;
- case EFILE_SEEK_END:
- origin = SEEK_END;
- break;
- default:
- errno = EINVAL;
- return check_error(-1, errInfo);
- }
-
- if (off != offset) {
- errno = EINVAL;
- return check_error(-1, errInfo);
- }
-
- errno = 0;
- result = lseek(fd, off, origin);
-
- if (result >= 0) {
- l_invalidate_local_fd(fd);
- }
-
- if (result < 0)
- {
- if (errno == ENOSYS) {
- int size, cur_pos;
-
- if (off < 0) {
- errno = EINVAL;
- return check_error(-1, errInfo);
- }
-
- cur_pos = lseek(fd, 0, SEEK_CUR);
- size = lseek(fd, 0, SEEK_END);
-
- if (origin == SEEK_SET) {
- result = offset;
- }
- else if (origin == SEEK_CUR) {
- result = offset + cur_pos;
- }
- else if (origin == SEEK_END) {
- result = size + offset;
- }
-
- /* sanity check our result */
- if (size > result) {
- return check_error(-1, errInfo);
- }
-
- /* store the data localy */
- l_update_local_fd(fd, result, size);
-
- /* reset the original file position */
- if (origin != SEEK_END) {
- lseek(fd, cur_pos, SEEK_SET);
- }
- }
- else if (errno == 0) {
- errno = EINVAL;
- }
- }
-
- if (new_location) {
- *new_location = result;
- }
-
- return 1;
-}
-
-/***************************************************************************/
-
-int
-efile_truncate_file(Efile_error* errInfo, int *fd, int flags)
-{
- off_t offset;
- struct fd_data *fd_data;
-
- if ((fd_data = l_find_local_fd(*fd)) != NULL && L_FD_IS_VALID(fd_data)) {
- offset = L_FD_CUR(fd_data);
- }
- else {
- offset = lseek(*fd, 0, SEEK_CUR);
- }
-
- return check_error(((offset >= 0) &&
- (ftruncate(*fd, offset) == 0)) ? 1 : -1, errInfo);
-}
-
-/***************************************************************************/
-
-int
-efile_readlink(Efile_error* errInfo, char* name, char* buffer, size_t size)
-{
- errno = ENOTSUP;
- return check_error(-1, errInfo);
-}
-
-/***************************************************************************/
-
-int
-efile_altname(Efile_error* errInfo, char* name, char* buffer, size_t size)
-{
- errno = ENOTSUP;
- return check_error(-1, errInfo);
-}
-
-/***************************************************************************/
-
-int
-efile_link(Efile_error* errInfo, char* old, char* new)
-{
- errno = ENOTSUP;
- return check_error(-1, errInfo);
-}
-
-/***************************************************************************/
-
-int
-efile_symlink(Efile_error* errInfo, char* old, char* new)
-{
- errno = ENOTSUP;
- return check_error(-1, errInfo);
-}
-
-/***************************************************************************/
-
-int
-efile_fadvise(Efile_error* errInfo, int fd, Sint64 offset,
- Sint64 length, int advise)
-{
- return check_error(posix_fadvise(fd, offset, length, advise), errInfo);
-}
-
-/***************************************************************************/
-
-static int
-call_posix_fallocate(int fd, Sint64 offset, Sint64 length)
-{
- int ret;
-
- /*
- * On Linux and Solaris for example, posix_fallocate() returns
- * a positive error number on error and it does not set errno.
- * On FreeBSD however (9.0 at least), it returns -1 on error
- * and it sets errno.
- */
- do {
- ret = posix_fallocate(fd, (off_t) offset, (off_t) length);
- if (ret > 0) {
- errno = ret;
- ret = -1;
- }
- } while (ret != 0 && errno == EINTR);
-
- return ret;
-}
-
-/***************************************************************************/
-
-int
-efile_fallocate(Efile_error* errInfo, int fd, Sint64 offset, Sint64 length)
-{
- return check_error(call_posix_fallocate(fd, offset, length), errInfo);
-}
diff --git a/erts/emulator/drivers/ose/ose_signal_drv.c b/erts/emulator/drivers/ose/ose_signal_drv.c
deleted file mode 100644
index 2be9462a47..0000000000
--- a/erts/emulator/drivers/ose/ose_signal_drv.c
+++ /dev/null
@@ -1,897 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 2013-2013. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "errno.h"
-#include "stdio.h"
-#include "string.h"
-#include "stddef.h"
-
-#include "sys.h"
-#include "erl_driver.h"
-#include "ose.h"
-
-
-#ifdef HAVE_OSE_SPI_H
-#include "ose_spi/ose_spi.h"
-#endif
-
-#define DEBUG_ATTACH 0
-#define DEBUG_HUNT 0
-#define DEBUG_SEND 0
-#define DEBUG_LISTEN 0
-
-#if 0
-#define DEBUGP(FMT,...) printf(FMT, __VA_ARGS__)
-#else
-#define DEBUGP(FMT,...)
-#endif
-
-#if DEBUG_ATTACH
-#define DEBUGP_ATTACH(...) DEBUGP( __VA_ARGS__)
-#else
-#define DEBUGP_ATTACH(...)
-#endif
-
-#if DEBUG_HUNT
-#define DEBUGP_HUNT(...) DEBUGP( __VA_ARGS__)
-#else
-#define DEBUGP_HUNT(...)
-#endif
-
-#if DEBUG_LISTEN
-#define DEBUGP_LISTEN(...) DEBUGP( __VA_ARGS__)
-#else
-#define DEBUGP_LISTEN(...)
-#endif
-
-#if DEBUG_SEND
-#define DEBUGP_SEND(...) DEBUGP( __VA_ARGS__)
-#else
-#define DEBUGP_SEND(...)
-#endif
-
-
-#define DRIVER_NAME "ose_signal_drv"
-#define GET_SPID 1
-#define GET_NAME 2
-#define HUNT 100
-#define DEHUNT 101
-#define ATTACH 102
-#define DETACH 103
-#define SEND 104
-#define SEND_W_S 105
-#define LISTEN 106
-#define OPEN 200
-
-#define REF_SEGMENT_SIZE 8
-
-struct async {
- SIGSELECT signo;
- ErlDrvTermData port;
- ErlDrvTermData proc;
- PROCESS spid;
- PROCESS target;
- Uint32 ref;
-};
-
-/**
- * OSE signals
- **/
-union SIGNAL {
- SIGSELECT signo;
- struct async async;
-};
-
-/**
- * The driver's context
- **/
-typedef struct _driver_context {
- ErlDrvPort port;
- PROCESS spid;
- ErlDrvEvent perm_events[2];
- ErlDrvEvent *events;
- Uint32 event_cnt;
- Uint32 ref;
- Uint32 *outstanding_refs;
- Uint32 outstanding_refs_max;
- Uint32 outstanding_refs_cnt;
-} driver_context_t;
-
-/**
- * Global variables
- **/
-static ErlDrvTermData a_ok;
-static ErlDrvTermData a_error;
-static ErlDrvTermData a_enomem;
-static ErlDrvTermData a_enoent;
-static ErlDrvTermData a_badarg;
-static ErlDrvTermData a_mailbox_up;
-static ErlDrvTermData a_mailbox_down;
-static ErlDrvTermData a_ose_drv_reply;
-static ErlDrvTermData a_message;
-static PROCESS proxy_proc;
-
-
-/**
- * Serialize/unserialize unsigned 32-bit values
- **/
-static char *put_u32(unsigned int value, char *ptr) {
- *ptr++ = (value & 0xff000000) >> 24;
- *ptr++ = (value & 0x00ff0000) >> 16;
- *ptr++ = (value & 0x0000ff00) >> 8;
- *ptr++ = (value & 0xff);
-
- return ptr;
-}
-
-static unsigned int get_u32(char *ptr) {
- unsigned int result = 0;
- result += (ptr[0] & 0xff) << 24;
- result += (ptr[1] & 0xff) << 16;
- result += (ptr[2] & 0xff) << 8;
- result += (ptr[3] & 0xff);
-
- return result;
-}
-
-
-/* Stolen from efile_drv.c */
-
-/* char EV_CHAR_P(ErlIOVec *ev, int p, int q) */
-#define EV_CHAR_P(ev, p, q) \
- (((char *)(ev)->iov[(q)].iov_base) + (p))
-
-/* int EV_GET_CHAR(ErlIOVec *ev, char *p, int *pp, int *qp) */
-#define EV_GET_CHAR(ev, p, pp, qp) ev_get_char(ev, p ,pp, qp)
-static int
-ev_get_char(ErlIOVec *ev, char *p, int *pp, int *qp) {
- if (*(pp)+1 <= (ev)->iov[*(qp)].iov_len) {
- *(p) = *EV_CHAR_P(ev, *(pp), *(qp));
- if (*(pp)+1 < (ev)->iov[*(qp)].iov_len)
- *(pp) = *(pp)+1;
- else {
- (*(qp))++;
- *pp = 0;
- }
- return !0;
- }
- return 0;
-}
-
-/* Uint32 EV_UINT32(ErlIOVec *ev, int p, int q)*/
-#define EV_UINT32(ev, p, q) \
- ((Uint32) *(((unsigned char *)(ev)->iov[(q)].iov_base) + (p)))
-
-/* int EV_GET_UINT32(ErlIOVec *ev, Uint32 *p, int *pp, int *qp) */
-#define EV_GET_UINT32(ev, p, pp, qp) ev_get_uint32(ev,(Uint32*)(p),pp,qp)
-static int
-ev_get_uint32(ErlIOVec *ev, Uint32 *p, int *pp, int *qp) {
- if (*(pp)+4 <= (ev)->iov[*(qp)].iov_len) {
- *(p) = (EV_UINT32(ev, *(pp), *(qp)) << 24)
- | (EV_UINT32(ev, *(pp)+1, *(qp)) << 16)
- | (EV_UINT32(ev, *(pp)+2, *(qp)) << 8)
- | (EV_UINT32(ev, *(pp)+3, *(qp)));
- if (*(pp)+4 < (ev)->iov[*(qp)].iov_len)
- *(pp) = *(pp)+4;
- else {
- (*(qp))++;
- *pp = 0;
- }
- return !0;
- }
- return 0;
-}
-
-/**
- * Convinience macros
- **/
-#define send_response(port,output) erl_drv_send_term(driver_mk_port(port),\
- driver_caller(port), output, sizeof(output) / sizeof(output[0]));
-
-void iov_memcpy(void *dest,ErlIOVec *ev,int ind,int off);
-void iov_memcpy(void *dest,ErlIOVec *ev,int ind,int off) {
- int i;
- memcpy(dest,ev->iov[ind].iov_base+off,ev->iov[ind].iov_len-off);
- for (i = ind+1; i < ev->vsize; i++)
- memcpy(dest,ev->iov[i].iov_base,ev->iov[i].iov_len);
-}
-
-/**
- * Reference handling
- **/
-
-static int add_reference(driver_context_t *ctxt, Uint32 ref) {
-
- /*
- * Premature optimizations may be evil, but they sure are fun.
- */
-
- if (ctxt->outstanding_refs == NULL) {
- /* First ref to be ignored */
- ctxt->outstanding_refs = driver_alloc(REF_SEGMENT_SIZE*sizeof(Uint32));
- if (!ctxt->outstanding_refs)
- return 1;
-
- memset(ctxt->outstanding_refs,0,REF_SEGMENT_SIZE*sizeof(Uint32));
- ctxt->outstanding_refs_max += REF_SEGMENT_SIZE;
- ctxt->outstanding_refs[ctxt->outstanding_refs_cnt++] = ref;
- } else if (ctxt->outstanding_refs_cnt == ctxt->outstanding_refs_max) {
- /* Expand ref array */
- Uint32 *new_array;
- ctxt->outstanding_refs_max += REF_SEGMENT_SIZE;
- new_array = driver_realloc(ctxt->outstanding_refs,
- ctxt->outstanding_refs_max*sizeof(Uint32));
-
- if (!new_array) {
- ctxt->outstanding_refs_max -= REF_SEGMENT_SIZE;
- return 1;
- }
-
- ctxt->outstanding_refs = new_array;
-
- memset(ctxt->outstanding_refs+ctxt->outstanding_refs_cnt,0,
- REF_SEGMENT_SIZE*sizeof(Uint32));
- ctxt->outstanding_refs[ctxt->outstanding_refs_cnt++] = ref;
-
- } else {
- /* Find an empty slot:
- * First we try current index,
- * then we scan for a slot.
- */
- if (!ctxt->outstanding_refs[ctxt->outstanding_refs_cnt]) {
- ctxt->outstanding_refs[ctxt->outstanding_refs_cnt++] = ref;
- } else {
- int i;
- ASSERT(ctxt->outstanding_refs_cnt < ctxt->outstanding_refs_max);
- for (i = 0; i < ctxt->outstanding_refs_max; i++)
- if (!ctxt->outstanding_refs[i])
- break;
- ASSERT(ctxt->outstanding_refs[i] == 0);
- ctxt->outstanding_refs[i] = ref;
- ctxt->outstanding_refs_cnt++;
- }
- }
- return 0;
-}
-
-/* Return 0 if removed, 1 if does not exist, */
-static int remove_reference(driver_context_t *ctxt, Uint32 ref) {
- int i,j;
-
- if (ctxt->outstanding_refs_max == 0 && ctxt->outstanding_refs_cnt == 0) {
- ASSERT(ctxt->outstanding_refs == NULL);
- return 1;
- }
-
- for (i = 0; i < ctxt->outstanding_refs_max; i++) {
- if (ctxt->outstanding_refs[i] == ref) {
- ctxt->outstanding_refs[i] = 0;
- ctxt->outstanding_refs_cnt--;
- i = -1;
- break;
- }
- }
-
- if (i != -1)
- return 1;
-
- if (ctxt->outstanding_refs_cnt == 0) {
- driver_free(ctxt->outstanding_refs);
- ctxt->outstanding_refs = NULL;
- ctxt->outstanding_refs_max = 0;
- } else if (ctxt->outstanding_refs_cnt == (ctxt->outstanding_refs_max - REF_SEGMENT_SIZE)) {
- Uint32 *new_array;
- for (i = 0, j = 0; i < ctxt->outstanding_refs_cnt; i++) {
- if (ctxt->outstanding_refs[i] == 0) {
- for (j = i+1; j < ctxt->outstanding_refs_max; j++)
- if (ctxt->outstanding_refs[j]) {
- ctxt->outstanding_refs[i] = ctxt->outstanding_refs[j];
- ctxt->outstanding_refs[j] = 0;
- break;
- }
- }
- }
- ctxt->outstanding_refs_max -= REF_SEGMENT_SIZE;
- new_array = driver_realloc(ctxt->outstanding_refs,
- ctxt->outstanding_refs_max*sizeof(Uint32));
- if (!new_array) {
- ctxt->outstanding_refs_max += REF_SEGMENT_SIZE;
- return 2;
- }
-
- ctxt->outstanding_refs = new_array;
-
- }
-
- return 0;
-}
-
-/**
- * The OSE proxy process. This only handles ERTS_SIGNAL_OSE_DRV_ATTACH.
- * The process is needed because signals triggered by attach ignore
- * redir tables.
- *
- * We have one global proxy process to save memory. An attempt to make each
- * port phantom into a proxy was made, but that used way to much memory.
- */
-static OS_PROCESS(driver_proxy_process) {
- SIGSELECT sigs[] = {1,ERTS_SIGNAL_OSE_DRV_ATTACH};
- PROCESS master = 0;
-
- while (1) {
- union SIGNAL *sig = receive(sigs);
-
- if (sig->signo == ERTS_SIGNAL_OSE_DRV_ATTACH) {
-
- /* The first message is used to determine who to send messages to. */
- if (master == 0)
- master = sender(&sig);
-
- if (sig->async.target == 0) {
- PROCESS from = sender(&sig);
- restore(sig);
- DEBUGP_ATTACH("0x%x: got attach 0x%x, sending to 0x%x\n",
- current_process(),from,master);
- sig->async.target = from;
- send(&sig,master);
- } else {
- PROCESS target = sig->async.target;
- restore(sig);
- sig->async.target = 0;
- DEBUGP_ATTACH("0x%x: doing attach on 0x%x\n",current_process(),target);
- attach(&sig,target);
- }
- }
- }
-}
-
-
-/**
- * Init routine for the driver
- **/
-static int drv_init(void) {
-
- a_ok = driver_mk_atom("ok");
- a_error = driver_mk_atom("error");
- a_enomem = driver_mk_atom("enomem");
- a_enoent = driver_mk_atom("enoent");
- a_badarg = driver_mk_atom("badarg");
- a_mailbox_up = driver_mk_atom("mailbox_up");
- a_mailbox_down = driver_mk_atom("mailbox_down");
- a_ose_drv_reply = driver_mk_atom("ose_drv_reply");
- a_message = driver_mk_atom("message");
-
- proxy_proc = create_process(get_ptype(current_process()),
- "ose_signal_driver_proxy",
- driver_proxy_process, 10000,
- get_pri(current_process()),
- 0, 0, NULL, 0, 0);
-
-#ifdef DEBUG
- efs_clone(proxy_proc);
-#endif
- start(proxy_proc);
-
- return 0;
-}
-
-/* Signal resolution callback */
-static ErlDrvOseEventId resolve_signal(union SIGNAL* osig) {
- union SIGNAL *sig = osig;
- if (sig->signo == ERTS_SIGNAL_OSE_DRV_HUNT ||
- sig->signo == ERTS_SIGNAL_OSE_DRV_ATTACH) {
- return sig->async.spid;
- }
- DEBUGP("%p: Got signal %d sent to %p from 0x%p\n",
- current_process(),sig->signo,addressee(&sig),sender(&sig));
- return addressee(&sig);
-}
-
-
-/**
- * Start routine for the driver
- **/
-static ErlDrvData drv_start(ErlDrvPort port, char *command)
-{
- driver_context_t *ctxt = driver_alloc(sizeof(driver_context_t));
-
- ctxt->perm_events[0] = NULL;
- ctxt->perm_events[1] = NULL;
-
- ctxt->spid = 0;
- ctxt->port = port;
- ctxt->event_cnt = 0;
- ctxt->events = NULL;
- ctxt->ref = 0;
- ctxt->outstanding_refs = NULL;
- ctxt->outstanding_refs_max = 0;
- ctxt->outstanding_refs_cnt = 0;
-
-
- /* Set the communication protocol to Erlang to be binary */
- set_port_control_flags(port, PORT_CONTROL_FLAG_BINARY);
-
- /* Everything ok */
- return (ErlDrvData)ctxt;
-}
-
-/**
- * Stop routine for the driver
- **/
-static void drv_stop(ErlDrvData driver_data)
-{
- driver_context_t *ctxt = (driver_context_t *)driver_data;
- int i;
-
- /* HUNT + ATTACH */
- if (ctxt->perm_events[0])
- driver_select(ctxt->port, ctxt->perm_events[0],
- ERL_DRV_USE|ERL_DRV_READ, 0);
- if (ctxt->perm_events[1])
- driver_select(ctxt->port, ctxt->perm_events[1],
- ERL_DRV_USE|ERL_DRV_READ, 0);
-
- for (i = 0; i < ctxt->event_cnt; i++) {
- driver_select(ctxt->port, ctxt->events[i], ERL_DRV_USE|ERL_DRV_READ, 0);
- }
-
- if (ctxt->spid != 0)
- kill_proc(ctxt->spid);
- DEBUGP("0x%x: stopped\n",ctxt->spid);
- if (ctxt->events)
- driver_free(ctxt->events);
- if (ctxt->outstanding_refs)
- driver_free(ctxt->outstanding_refs);
-
- driver_free(ctxt);
-}
-
-/**
- * Output from Erlang
- **/
-static void outputv(ErlDrvData driver_data, ErlIOVec *ev)
-{
- driver_context_t *ctxt = (driver_context_t *)driver_data;
- int p = 0, q = 1;
- char cmd;
-
- if (! EV_GET_CHAR(ev,&cmd,&p,&q)) {
- ErlDrvTermData output[] = {
- ERL_DRV_ATOM, a_ose_drv_reply,
- ERL_DRV_PORT, driver_mk_port(ctxt->port),
- ERL_DRV_ATOM, a_badarg,
- ERL_DRV_TUPLE, 3};
- send_response(ctxt->port, output);
- return;
- }
-
- /* Command is in the buffer's first byte */
- switch(cmd) {
-
- case OPEN: {
- char *name = driver_alloc(ev->size - 1+1);
- struct OS_redir_entry redir[2];
-
- redir[0].sig = 1;
- redir[0].pid = current_process();
-
- iov_memcpy(name,ev,q,p);
- name[ev->size-1] = '\0';
-
- ctxt->spid = create_process(OS_PHANTOM, name, NULL, 0,
- 0, 0, 0, redir, 0, 0);
-
- DEBUGP("0x%x: open\n",ctxt->spid);
-
- ctxt->perm_events[1] =
- erl_drv_ose_event_alloc(ERTS_SIGNAL_OSE_DRV_ATTACH,(int)ctxt->spid,
- resolve_signal, NULL);
- driver_select(ctxt->port,ctxt->perm_events[1],ERL_DRV_READ|ERL_DRV_USE,1);
-
- ctxt->perm_events[0] =
- erl_drv_ose_event_alloc(ERTS_SIGNAL_OSE_DRV_HUNT,(int)ctxt->spid,
- resolve_signal, NULL);
- driver_select(ctxt->port,ctxt->perm_events[0],ERL_DRV_READ|ERL_DRV_USE,1);
-
- start(ctxt->spid);
-
- {
- ErlDrvTermData output[] = {
- ERL_DRV_ATOM, a_ose_drv_reply,
- ERL_DRV_PORT, driver_mk_port(ctxt->port),
- ERL_DRV_ATOM, a_ok,
- ERL_DRV_TUPLE, 3};
-
- send_response(ctxt->port, output);
- }
-
- break;
-
- }
-
- case ATTACH:
- case HUNT:
- {
- union SIGNAL *sig = alloc(sizeof(union SIGNAL),
- cmd == HUNT ? ERTS_SIGNAL_OSE_DRV_HUNT:ERTS_SIGNAL_OSE_DRV_ATTACH);
-
- sig->async.port = driver_mk_port(ctxt->port);
- sig->async.proc = driver_caller(ctxt->port);
- sig->async.spid = ctxt->spid;
- sig->async.ref = ++ctxt->ref;
-
- if (add_reference(ctxt,ctxt->ref)) {
- ErlDrvTermData output[] = {
- ERL_DRV_ATOM, a_ose_drv_reply,
- ERL_DRV_PORT, driver_mk_port(ctxt->port),
- ERL_DRV_ATOM, a_enomem,
- ERL_DRV_TUPLE, 3};
- send_response(ctxt->port, output);
- free_buf(&sig);
- } else {
- ErlDrvTermData output[] = {
- ERL_DRV_ATOM, a_ose_drv_reply,
- ERL_DRV_PORT, driver_mk_port(ctxt->port),
- ERL_DRV_PORT, driver_mk_port(ctxt->port),
- ERL_DRV_INT, (ErlDrvUInt)ctxt->ref,
- ERL_DRV_TUPLE, 2,
- ERL_DRV_TUPLE, 3};
- send_response(ctxt->port, output);
-
- if (cmd == HUNT) {
- char *huntname = driver_alloc(sizeof(char)*((ev->size-1)+1));
-
- iov_memcpy(huntname,ev,q,p);
- huntname[ev->size-1] = '\0';
-
- DEBUGP_HUNT("0x%x: hunt %s -> %u (%u,%u)\n",
- ctxt->spid,huntname,ctxt->ref,
- ctxt->outstanding_refs_cnt,
- ctxt->outstanding_refs_max);
-
- hunt(huntname, 0, NULL, &sig);
-
- driver_free(huntname);
- } else {
- EV_GET_UINT32(ev,&sig->async.target,&p,&q);
- DEBUGP_ATTACH("0x%x: attach %u -> %u (%u,%u)\n",
- ctxt->spid,sig->async.target,
- ctxt->ref,
- ctxt->outstanding_refs_cnt,
- ctxt->outstanding_refs_max);
-
- send(&sig,proxy_proc);
- }
-
- }
-
- break;
- }
-
- case DETACH:
- case DEHUNT:
- {
-
- Uint32 ref;
-
- EV_GET_UINT32(ev,&ref,&p,&q);
- if (cmd == DETACH) {
- DEBUGP_ATTACH("0x%x: detach %u (%u,%u)\n",ctxt->spid,ref,
- ctxt->outstanding_refs_cnt,
- ctxt->outstanding_refs_max);
- } else {
- DEBUGP_HUNT("0x%x: dehunt %u (%u,%u)\n",ctxt->spid,ref,
- ctxt->outstanding_refs_cnt,
- ctxt->outstanding_refs_max);
- }
-
- if (remove_reference(ctxt,ref)) {
- ErlDrvTermData output[] = {
- ERL_DRV_ATOM, a_ose_drv_reply,
- ERL_DRV_PORT, driver_mk_port(ctxt->port),
- ERL_DRV_ATOM, a_error,
- ERL_DRV_ATOM, a_enoent,
- ERL_DRV_TUPLE, 2,
- ERL_DRV_TUPLE, 3};
-
- send_response(ctxt->port, output);
- } else {
- ErlDrvTermData output[] = {
- ERL_DRV_ATOM, a_ose_drv_reply,
- ERL_DRV_PORT, driver_mk_port(ctxt->port),
- ERL_DRV_ATOM, a_ok,
- ERL_DRV_TUPLE, 3};
-
- send_response(ctxt->port, output);
- }
-
- break;
- }
-
- case SEND:
- case SEND_W_S:
- {
- PROCESS spid;
- PROCESS sender;
- SIGSELECT signo;
- OSBUFSIZE size = ev->size-9;
- union SIGNAL *sig;
-
- EV_GET_UINT32(ev,&spid,&p,&q);
-
- if (cmd == SEND_W_S) {
- EV_GET_UINT32(ev,&sender,&p,&q);
- size -= 4;
- } else {
- sender = ctxt->spid;
- }
-
- EV_GET_UINT32(ev,&signo,&p,&q);
-
- sig = alloc(size + sizeof(SIGSELECT),signo);
-
- if (cmd == SEND_W_S) {
- DEBUGP_SEND("0x%x: send_w_s(%u,%u,%u)\n",ctxt->spid,spid,signo,sender);
- } else {
- DEBUGP_SEND("0x%x: send(%u,%u)\n",ctxt->spid,spid,signo);
- }
-
- iov_memcpy(((char *)&sig->signo) + sizeof(SIGSELECT),ev,q,p);
-
- send_w_s(&sig, sender, spid);
-
- break;
- }
-
- case LISTEN:
- {
- int i,j,event_cnt = (ev->size - 1)/4;
- ErlDrvEvent *events = NULL;
- SIGSELECT signo,tmp_signo;
-
- if (event_cnt == 0) {
- for (i = 0; i < ctxt->event_cnt; i++)
- driver_select(ctxt->port,ctxt->events[i],ERL_DRV_READ|ERL_DRV_USE,0);
- if (ctxt->events)
- driver_free(ctxt->events);
- } else {
- events = driver_alloc(sizeof(ErlDrvEvent)*event_cnt);
- EV_GET_UINT32(ev,&signo,&p,&q);
- for (i = 0, j = 0; i < event_cnt || j < ctxt->event_cnt; ) {
-
- if (ctxt->events)
- erl_drv_ose_event_fetch(ctxt->events[j],&tmp_signo,NULL,NULL);
-
- if (signo == tmp_signo) {
- events[i++] = ctxt->events[j++];
- EV_GET_UINT32(ev,&signo,&p,&q);
- } else if (signo < tmp_signo || !ctxt->events) {
- /* New signal to select on */
- events[i] = erl_drv_ose_event_alloc(signo,(int)ctxt->spid,
- resolve_signal, NULL);
- driver_select(ctxt->port,events[i++],ERL_DRV_READ|ERL_DRV_USE,1);
- EV_GET_UINT32(ev,&signo,&p,&q);
- } else {
- /* Remove old signal to select on */
- driver_select(ctxt->port,ctxt->events[j++],ERL_DRV_READ|ERL_DRV_USE,0);
- }
- }
- if (ctxt->events)
- driver_free(ctxt->events);
- }
- ctxt->events = events;
- ctxt->event_cnt = event_cnt;
-
- {
- ErlDrvTermData output[] = {
- ERL_DRV_ATOM, a_ose_drv_reply,
- ERL_DRV_PORT, driver_mk_port(ctxt->port),
- ERL_DRV_ATOM, a_ok,
- ERL_DRV_TUPLE, 3};
- send_response(ctxt->port, output);
- }
- break;
- }
-
- default:
- {
- DEBUGP("Warning: 'ose_signal_drv' unknown command '%d'\n", cmd);
- break;
- }
- }
-}
-
-/**
- * Handler for when OSE signal arrives
- **/
-static void ready_input(ErlDrvData driver_data, ErlDrvEvent event)
-{
- driver_context_t *ctxt = (driver_context_t *)driver_data;
- union SIGNAL *sig = erl_drv_ose_get_signal(event);
-
- while (sig != NULL) {
-
- switch(sig->signo)
- {
- /* Remote process is available */
- case ERTS_SIGNAL_OSE_DRV_HUNT:
- {
- const PROCESS spid = sender(&sig);
-
- if (remove_reference(ctxt,sig->async.ref)) {
- DEBUGP_HUNT("0x%x: Got hunt from 0x%x -> %u (CANCELLED) (%u,%u)\n",
- ctxt->spid,spid,sig->async.ref,
- ctxt->outstanding_refs_cnt,
- ctxt->outstanding_refs_max);
- /* Already removed by dehunt */
- } else {
- ErlDrvTermData reply[] = {
- ERL_DRV_ATOM, a_mailbox_up,
- ERL_DRV_PORT, sig->async.port,
- ERL_DRV_PORT, sig->async.port,
- ERL_DRV_UINT, (ErlDrvUInt)sig->async.ref,
- ERL_DRV_TUPLE, 2,
- ERL_DRV_UINT, (ErlDrvUInt)spid,
- ERL_DRV_TUPLE, 4};
- DEBUGP_HUNT("0x%x: Got hunt from 0x%x -> %u (%u,%u)\n",
- ctxt->spid,spid,sig->async.ref,
- ctxt->outstanding_refs_cnt,
- ctxt->outstanding_refs_max);
- erl_drv_send_term(sig->async.port, sig->async.proc, reply,
- sizeof(reply) / sizeof(reply[0]));
- }
- break;
- }
-
- /* Remote process is down */
- case ERTS_SIGNAL_OSE_DRV_ATTACH:
- {
- PROCESS spid = sig->async.target;
-
- if (remove_reference(ctxt,sig->async.ref)) {
- DEBUGP_ATTACH("0x%x: Got attach from 0x%x -> %u (CANCELLED) (%u,%u)\n",
- ctxt->spid,spid,sig->async.ref,
- ctxt->outstanding_refs_cnt,
- ctxt->outstanding_refs_max);
- /* Already removed by detach */
- } else {
- ErlDrvTermData reply[] = {
- ERL_DRV_ATOM, a_mailbox_down,
- ERL_DRV_PORT, sig->async.port,
- ERL_DRV_PORT, sig->async.port,
- ERL_DRV_UINT, sig->async.ref,
- ERL_DRV_TUPLE, 2,
- ERL_DRV_UINT, (ErlDrvUInt)spid,
- ERL_DRV_TUPLE, 4};
- DEBUGP_ATTACH("0x%x: Got attach from 0x%x -> %u (%u,%u)\n",
- ctxt->spid,spid,sig->async.ref,
- ctxt->outstanding_refs_cnt,
- ctxt->outstanding_refs_max);
- erl_drv_send_term(sig->async.port, sig->async.proc, reply,
- sizeof(reply) / sizeof(reply[0]));
- }
- break;
- }
-
- /* Received user defined signal */
- default:
- {
- const PROCESS spid = sender(&sig);
- const OSBUFSIZE size = sigsize(&sig) - sizeof(SIGSELECT);
- const char *sig_data = ((char *)&sig->signo) + sizeof(SIGSELECT);
-
- ErlDrvTermData reply[] = {
- ERL_DRV_ATOM, a_message,
- ERL_DRV_PORT, driver_mk_port(ctxt->port),
- ERL_DRV_UINT, (ErlDrvUInt)spid,
- ERL_DRV_UINT, (ErlDrvUInt)ctxt->spid,
- ERL_DRV_UINT, (ErlDrvUInt)sig->signo,
- ERL_DRV_BUF2BINARY, (ErlDrvTermData)sig_data, (ErlDrvUInt)size,
- ERL_DRV_TUPLE, 4,
- ERL_DRV_TUPLE, 3};
-
- DEBUGP_SEND("0x%x: Got 0x%u\r\n", spid, sig->signo);
-
- erl_drv_output_term(driver_mk_port(ctxt->port), reply,
- sizeof(reply) / sizeof(reply[0]));
- break;
- }
- }
-
- free_buf(&sig);
- sig = erl_drv_ose_get_signal(event);
- }
-}
-
-/**
- * Handler for 'port_control'
- **/
-static ErlDrvSSizeT control(ErlDrvData driver_data, unsigned int cmd,
- char *buf, ErlDrvSizeT len,
- char **rbuf, ErlDrvSizeT rlen)
-{
- driver_context_t *ctxt = (driver_context_t *)driver_data;
-
- switch(cmd)
- {
- case GET_SPID:
- {
- const PROCESS spid = ctxt->spid;
- put_u32(spid, *rbuf);
- return sizeof(PROCESS);
- }
-
-#ifdef HAVE_OSE_SPI_H
- case GET_NAME:
- {
- const PROCESS spid = get_u32(buf);
- char *name = (char*)get_pid_info(spid,OSE_PI_NAME);
- int n;
- if (!name) {
- *rbuf = NULL;
- return 0;
- }
-
- if (rlen < (n = strlen(name))) {
- ErlDrvBinary *bin = driver_alloc_binary(n);
- strncpy(bin->orig_bytes,name,n);
- *rbuf = (char*)bin;
- } else
- strncpy(*rbuf,name,n);
- free_buf((union SIGNAL**)&name);
-
- return n;
- }
-#endif
- default:
- {
- /* Unknown command */
- return (ErlDrvSSizeT)ERL_DRV_ERROR_GENERAL;
- break;
- }
- }
-}
-
-static void stop_select(ErlDrvEvent event, void *reserved)
-{
- erl_drv_ose_event_free(event);
-}
-
-/**
- * Setup the driver entry for the Erlang runtime
- **/
-ErlDrvEntry ose_signal_driver_entry = {
- .init = drv_init,
- .start = drv_start,
- .stop = drv_stop,
- .outputv = outputv,
- .ready_input = ready_input,
- .driver_name = DRIVER_NAME,
- .control = control,
- .extended_marker = ERL_DRV_EXTENDED_MARKER,
- .major_version = ERL_DRV_EXTENDED_MAJOR_VERSION,
- .minor_version = ERL_DRV_EXTENDED_MINOR_VERSION,
- .driver_flags = ERL_DRV_FLAG_USE_PORT_LOCKING,
- .stop_select = stop_select
-};
-
diff --git a/erts/emulator/drivers/ose/ttsl_drv.c b/erts/emulator/drivers/ose/ttsl_drv.c
deleted file mode 100644
index f759b47984..0000000000
--- a/erts/emulator/drivers/ose/ttsl_drv.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1996-2013. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- */
-/*
- * Stub tty driver because group/user depend on this.
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "erl_driver.h"
-
-static int ttysl_init(void);
-static ErlDrvData ttysl_start(ErlDrvPort, char*);
-
-/* Define the driver table entry. */
-struct erl_drv_entry ttsl_driver_entry = {
- ttysl_init,
- ttysl_start,
- NULL,
- NULL,
- NULL,
- NULL,
- "tty_sl",
- NULL,
- NULL,
- NULL,
- NULL, /* timeout */
- NULL, /* outputv */
- NULL, /* ready_async */
- NULL, /* flush */
- NULL, /* call */
- NULL, /* event */
- ERL_DRV_EXTENDED_MARKER,
- ERL_DRV_EXTENDED_MAJOR_VERSION,
- ERL_DRV_EXTENDED_MINOR_VERSION,
- 0, /* ERL_DRV_FLAGs */
- NULL,
- NULL, /* process_exit */
- NULL
-};
-
-
-static int ttysl_init(void)
-{
- return 0;
-}
-
-static ErlDrvData ttysl_start(ErlDrvPort port, char* buf)
-{
- return ERL_DRV_ERROR_GENERAL;
-}
diff --git a/erts/emulator/drivers/unix/ttsl_drv.c b/erts/emulator/drivers/unix/ttsl_drv.c
index 53146e71f0..25cad37e25 100644
--- a/erts/emulator/drivers/unix/ttsl_drv.c
+++ b/erts/emulator/drivers/unix/ttsl_drv.c
@@ -733,13 +733,13 @@ static void ttysl_from_erlang(ErlDrvData ttysl_data, char* buf, ErlDrvSizeT coun
else
written = 0;
if (written < 0) {
- if (errno == EAGAIN) {
+ if (errno == ERRNO_BLOCK || errno == EINTR) {
driver_select(ttysl_port,(ErlDrvEvent)(long)ttysl_fd,
ERL_DRV_USE|ERL_DRV_WRITE,1);
break;
} else {
- /* we ignore all other errors */
- break;
+ driver_failure_posix(ttysl_port, errno);
+ return;
}
} else {
if (driver_deq(ttysl_port, written) == 0)
@@ -779,11 +779,12 @@ static void ttysl_to_tty(ErlDrvData ttysl_data, ErlDrvEvent fd) {
else
written = 0;
if (written < 0) {
- if (errno == EAGAIN) {
- break;
- } else {
- /* we ignore all other errors */
+ if (errno == EINTR) {
+ continue;
+ } else if (errno != ERRNO_BLOCK){
+ driver_failure_posix(ttysl_port, errno);
}
+ break;
} else {
sz = driver_deq(ttysl_port, written);
if (sz < TTY_BUFFSIZE && ttysl_send_ok) {
diff --git a/erts/emulator/drivers/unix/unix_efile.c b/erts/emulator/drivers/unix/unix_efile.c
index 06ba986044..46eccc6568 100644
--- a/erts/emulator/drivers/unix/unix_efile.c
+++ b/erts/emulator/drivers/unix/unix_efile.c
@@ -45,10 +45,10 @@
#endif
#if defined(__APPLE__) && defined(__MACH__) && !defined(__DARWIN__)
-#define DARWIN 1
+#define __DARWIN__ 1
#endif
-#if defined(DARWIN) || defined(HAVE_LINUX_FALLOC_H) || defined(HAVE_POSIX_FALLOCATE)
+#if defined(__DARWIN__) || defined(HAVE_LINUX_FALLOC_H) || defined(HAVE_POSIX_FALLOCATE)
#include <fcntl.h>
#endif
@@ -476,11 +476,11 @@ efile_fsync(Efile_error *errInfo, /* Where to return error codes. */
#ifdef NO_FSYNC
undefined fsync /* XXX: Really? */
#else
-#if defined(DARWIN) && defined(F_FULLFSYNC)
+#if defined(__DARWIN__) && defined(F_FULLFSYNC)
return check_error(fcntl(fd, F_FULLFSYNC), errInfo);
#else
return check_error(fsync(fd), errInfo);
-#endif /* DARWIN */
+#endif /* __DARWIN__ */
#endif /* NO_FSYNC */
}
@@ -962,7 +962,7 @@ efile_sendfile(Efile_error* errInfo, int in_fd, int out_fd,
retval = len;
}
} while (len == SENDFILE_CHUNK_SIZE);
-#elif defined(DARWIN)
+#elif defined(__DARWIN__)
int retval;
off_t len;
do {
diff --git a/erts/emulator/hipe/hipe_native_bif.c b/erts/emulator/hipe/hipe_native_bif.c
index 98bda43f0e..688378b2fe 100644
--- a/erts/emulator/hipe/hipe_native_bif.c
+++ b/erts/emulator/hipe/hipe_native_bif.c
@@ -93,9 +93,6 @@ BIF_RETTYPE hipe_set_timeout(BIF_ALIST_1)
{
Process* p = BIF_P;
Eterm timeout_value = BIF_ARG_1;
-#if !defined(ARCH_64)
- Uint time_val;
-#endif
/* XXX: This should be converted to follow BEAM conventions,
* but that requires some compiler changes.
*
diff --git a/erts/emulator/sys/common/erl_check_io.c b/erts/emulator/sys/common/erl_check_io.c
index 105b129065..f87196d724 100644
--- a/erts/emulator/sys/common/erl_check_io.c
+++ b/erts/emulator/sys/common/erl_check_io.c
@@ -1337,11 +1337,7 @@ print_select_op(erts_dsprintf_buf_t *dsbufp,
{
Port *pp = erts_drvport2port(ix);
erts_dsprintf(dsbufp,
-#ifdef __OSE__
- "driver_select(%p, %d,%s%s%s%s | %d, %d) "
-#else
"driver_select(%p, %d,%s%s%s%s, %d) "
-#endif
"by ",
ix,
(int) GET_FD(fd),
@@ -1861,25 +1857,6 @@ stale_drv_select(Eterm id, ErtsDrvEventState *state, int mode)
#ifndef ERTS_SYS_CONTINOUS_FD_NUMBERS
-#ifdef __OSE__
-static SafeHashValue drv_ev_state_hash(void *des)
-{
- ErtsSysFdType fd = ((ErtsDrvEventState *) des)->fd;
- /* We use hash on signo ^ id in order for steal to happen when the
- same signo + fd is selected on by two different ports */
- SafeHashValue val = (SafeHashValue)(fd->signo ^ fd->id);
- return val ^ (val >> 8);
-}
-
-static int drv_ev_state_cmp(void *des1, void *des2)
-{
- ErtsSysFdType fd1 = ((ErtsDrvEventState *) des1)->fd;
- ErtsSysFdType fd2 = ((ErtsDrvEventState *) des2)->fd;
- if (fd1->signo == fd2->signo && fd1->id == fd2->id)
- return 0;
- return 1;
-}
-#else /* !__OSE__ && !ERTS_SYS_CONTINOUS_FD_NUMBERS i.e. probably windows */
static SafeHashValue drv_ev_state_hash(void *des)
{
SafeHashValue val = (SafeHashValue) ((ErtsDrvEventState *) des)->fd;
@@ -1891,7 +1868,6 @@ static int drv_ev_state_cmp(void *des1, void *des2)
return ( ((ErtsDrvEventState *) des1)->fd == ((ErtsDrvEventState *) des2)->fd
? 0 : 1);
}
-#endif
static void *drv_ev_state_alloc(void *des_tmpl)
{
diff --git a/erts/emulator/sys/common/erl_mmap.c b/erts/emulator/sys/common/erl_mmap.c
index 754047829f..e6d0e1e281 100644
--- a/erts/emulator/sys/common/erl_mmap.c
+++ b/erts/emulator/sys/common/erl_mmap.c
@@ -2453,7 +2453,6 @@ Eterm erts_mmap_debug_info(Process* p)
UWord values[4];
Eterm *hp, *hp_end;
Uint may_need;
- const Uint PTR_BIG_SZ = HALFWORD_HEAP ? 3 : 2;
erts_smp_mtx_lock(&mmap_state.mtx);
values[0] = (UWord)mmap_state.sa.bot;
@@ -2464,7 +2463,7 @@ Eterm erts_mmap_debug_info(Process* p)
sua_list = build_free_seg_list(p, &mmap_state.sua.map);
erts_smp_mtx_unlock(&mmap_state.mtx);
- may_need = 4*(2+3+PTR_BIG_SZ) + 2*(2+3);
+ may_need = 4*(2+3+2) + 2*(2+3);
hp = HAlloc(p, may_need);
hp_end = hp + may_need;
diff --git a/erts/emulator/sys/common/erl_mseg.c b/erts/emulator/sys/common/erl_mseg.c
index 0d51aad863..7eb8a4a460 100644
--- a/erts/emulator/sys/common/erl_mseg.c
+++ b/erts/emulator/sys/common/erl_mseg.c
@@ -99,17 +99,12 @@ static const int debruijn[32] = {
static int atoms_initialized;
-typedef struct mem_kind_t MemKind;
-
const ErtsMsegOpt_t erts_mseg_default_opt = {
1, /* Use cache */
1, /* Preserv data */
0, /* Absolute shrink threshold */
0, /* Relative shrink threshold */
0 /* Scheduler specific */
-#if HALFWORD_HEAP
- ,0 /* need low memory */
-#endif
};
@@ -142,7 +137,14 @@ struct cache_t_ {
typedef struct ErtsMsegAllctr_t_ ErtsMsegAllctr_t;
-struct mem_kind_t {
+struct ErtsMsegAllctr_t_ {
+ int ix;
+
+ int is_init_done;
+ int is_thread_safe;
+ erts_mtx_t mtx;
+
+ int is_cache_check_scheduled;
cache_t cache[MAX_CACHE_SIZE];
cache_t cache_unpowered_node;
@@ -168,29 +170,6 @@ struct mem_kind_t {
} max_ever;
} segments;
- ErtsMsegAllctr_t *ma;
- const char* name;
- MemKind* next;
-};/*MemKind*/
-
-struct ErtsMsegAllctr_t_ {
- int ix;
-
- int is_init_done;
- int is_thread_safe;
- erts_mtx_t mtx;
-
- int is_cache_check_scheduled;
-
- MemKind* mk_list;
-
-#if HALFWORD_HEAP
- MemKind low_mem;
- MemKind hi_mem;
-#else
- MemKind the_mem;
-#endif
-
Uint max_cache_size;
Uint abs_max_cache_bad_fit;
Uint rel_max_cache_bad_fit;
@@ -302,18 +281,13 @@ schedule_cache_check(ErtsMsegAllctr_t *ma) {
/* #define ERTS_PRINT_ERTS_MMAP */
static ERTS_INLINE void *
-mseg_create(ErtsMsegAllctr_t *ma, Uint flags, MemKind* mk, UWord *sizep)
+mseg_create(ErtsMsegAllctr_t *ma, Uint flags, UWord *sizep)
{
#ifdef ERTS_PRINT_ERTS_MMAP
UWord req_size = *sizep;
#endif
void *seg;
Uint32 mmap_flags = 0;
-#if HALFWORD_HEAP
- mmap_flags |= ((mk == &ma->low_mem)
- ? ERTS_MMAPFLG_SUPERCARRIER_ONLY
- : ERTS_MMAPFLG_OS_ONLY);
-#endif
if (MSEG_FLG_IS_2POW(flags))
mmap_flags |= ERTS_MMAPFLG_SUPERALIGNED;
@@ -331,14 +305,9 @@ mseg_create(ErtsMsegAllctr_t *ma, Uint flags, MemKind* mk, UWord *sizep)
}
static ERTS_INLINE void
-mseg_destroy(ErtsMsegAllctr_t *ma, Uint flags, MemKind* mk, void *seg_p, UWord size) {
+mseg_destroy(ErtsMsegAllctr_t *ma, Uint flags, void *seg_p, UWord size) {
Uint32 mmap_flags = 0;
-#if HALFWORD_HEAP
- mmap_flags |= ((mk == &ma->low_mem)
- ? ERTS_MMAPFLG_SUPERCARRIER_ONLY
- : ERTS_MMAPFLG_OS_ONLY);
-#endif
if (MSEG_FLG_IS_2POW(flags))
mmap_flags |= ERTS_MMAPFLG_SUPERALIGNED;
@@ -353,18 +322,13 @@ mseg_destroy(ErtsMsegAllctr_t *ma, Uint flags, MemKind* mk, void *seg_p, UWord s
}
static ERTS_INLINE void *
-mseg_recreate(ErtsMsegAllctr_t *ma, Uint flags, MemKind* mk, void *old_seg, UWord old_size, UWord *sizep)
+mseg_recreate(ErtsMsegAllctr_t *ma, Uint flags, void *old_seg, UWord old_size, UWord *sizep)
{
#ifdef ERTS_PRINT_ERTS_MMAP
UWord req_size = *sizep;
#endif
void *new_seg;
Uint32 mmap_flags = 0;
-#if HALFWORD_HEAP
- mmap_flags |= ((mk == &ma->low_mem)
- ? ERTS_MMAPFLG_SUPERCARRIER_ONLY
- : ERTS_MMAPFLG_OS_ONLY);
-#endif
if (MSEG_FLG_IS_2POW(flags))
mmap_flags |= ERTS_MMAPFLG_SUPERALIGNED;
@@ -392,11 +356,8 @@ do { \
|| erts_smp_thr_progress_is_blocking() \
|| ERTS_IS_CRASH_DUMPING); \
} while (0)
-#define ERTS_DBG_MK_CHK_THR_ACCESS(MK) \
- ERTS_DBG_MA_CHK_THR_ACCESS((MK)->ma)
#else
#define ERTS_DBG_MA_CHK_THR_ACCESS(MA)
-#define ERTS_DBG_MK_CHK_THR_ACCESS(MK)
#endif
/* Cache interface */
@@ -409,10 +370,10 @@ static ERTS_INLINE void mseg_cache_clear_node(cache_t *c) {
c->prev = c;
}
-static ERTS_INLINE int cache_bless_segment(MemKind *mk, void *seg, UWord size, Uint flags) {
+static ERTS_INLINE int cache_bless_segment(ErtsMsegAllctr_t *ma, void *seg, UWord size, Uint flags) {
cache_t *c;
- ERTS_DBG_MK_CHK_THR_ACCESS(mk);
+ ERTS_DBG_MA_CHK_THR_ACCESS(ma);
ASSERT(!MSEG_FLG_IS_2POW(flags) || (MSEG_FLG_IS_2POW(flags) && MAP_IS_ALIGNED(seg) && IS_2POW(size)));
@@ -421,11 +382,11 @@ static ERTS_INLINE int cache_bless_segment(MemKind *mk, void *seg, UWord size, U
* Large blocks has no such cache and it is up to mseg to cache them to speed things up.
*/
- if (!erts_circleq_is_empty(&(mk->cache_free))) {
+ if (!erts_circleq_is_empty(&(ma->cache_free))) {
/* We have free slots, use one to cache the segment */
- c = erts_circleq_head(&(mk->cache_free));
+ c = erts_circleq_head(&(ma->cache_free));
erts_circleq_remove(c);
c->seg = seg;
@@ -437,29 +398,28 @@ static ERTS_INLINE int cache_bless_segment(MemKind *mk, void *seg, UWord size, U
ASSERT(ix < CACHE_AREAS);
ASSERT((1 << (ix + MSEG_ALIGN_BITS)) == size);
- erts_circleq_push_head(&(mk->cache_powered_node[ix]), c);
+ erts_circleq_push_head(&(ma->cache_powered_node[ix]), c);
} else
- erts_circleq_push_head(&(mk->cache_unpowered_node), c);
+ erts_circleq_push_head(&(ma->cache_unpowered_node), c);
- mk->cache_size++;
- ASSERT(mk->cache_size <= mk->ma->max_cache_size);
+ ma->cache_size++;
return 1;
- } else if (!MSEG_FLG_IS_2POW(flags) && !erts_circleq_is_empty(&(mk->cache_unpowered_node))) {
+ } else if (!MSEG_FLG_IS_2POW(flags) && !erts_circleq_is_empty(&(ma->cache_unpowered_node))) {
/* No free slots.
* Evict oldest slot from unpowered cache so we can cache an unpowered (sbc) segment */
- c = erts_circleq_tail(&(mk->cache_unpowered_node));
+ c = erts_circleq_tail(&(ma->cache_unpowered_node));
erts_circleq_remove(c);
- mseg_destroy(mk->ma, ERTS_MSEG_FLG_NONE, mk, c->seg, c->size);
+ mseg_destroy(ma, ERTS_MSEG_FLG_NONE, c->seg, c->size);
mseg_cache_clear_node(c);
c->seg = seg;
c->size = size;
- erts_circleq_push_head(&(mk->cache_unpowered_node), c);
+ erts_circleq_push_head(&(ma->cache_unpowered_node), c);
return 1;
} else if (!MSEG_FLG_IS_2POW(flags)) {
@@ -473,20 +433,20 @@ static ERTS_INLINE int cache_bless_segment(MemKind *mk, void *seg, UWord size, U
int i;
for( i = 0; i < CACHE_AREAS; i++) {
- if (erts_circleq_is_empty(&(mk->cache_powered_node[i])))
+ if (erts_circleq_is_empty(&(ma->cache_powered_node[i])))
continue;
- c = erts_circleq_tail(&(mk->cache_powered_node[i]));
+ c = erts_circleq_tail(&(ma->cache_powered_node[i]));
erts_circleq_remove(c);
- mseg_destroy(mk->ma, ERTS_MSEG_FLG_2POW, mk, c->seg, c->size);
+ mseg_destroy(ma, ERTS_MSEG_FLG_2POW, c->seg, c->size);
mseg_cache_clear_node(c);
c->seg = seg;
c->size = size;
- erts_circleq_push_head(&(mk->cache_unpowered_node), c);
+ erts_circleq_push_head(&(ma->cache_unpowered_node), c);
return 1;
}
@@ -495,11 +455,11 @@ static ERTS_INLINE int cache_bless_segment(MemKind *mk, void *seg, UWord size, U
return 0;
}
-static ERTS_INLINE void *cache_get_segment(MemKind *mk, UWord *size_p, Uint flags) {
+static ERTS_INLINE void *cache_get_segment(ErtsMsegAllctr_t *ma, UWord *size_p, Uint flags) {
UWord size = *size_p;
- ERTS_DBG_MK_CHK_THR_ACCESS(mk);
+ ERTS_DBG_MA_CHK_THR_ACCESS(ma);
if (MSEG_FLG_IS_2POW(flags)) {
@@ -512,10 +472,10 @@ static ERTS_INLINE void *cache_get_segment(MemKind *mk, UWord *size_p, Uint flag
for( i = ix; i < CACHE_AREAS; i++) {
- if (erts_circleq_is_empty(&(mk->cache_powered_node[i])))
+ if (erts_circleq_is_empty(&(ma->cache_powered_node[i])))
continue;
- c = erts_circleq_head(&(mk->cache_powered_node[i]));
+ c = erts_circleq_head(&(ma->cache_powered_node[i]));
erts_circleq_remove(c);
ASSERT(IS_2POW(c->size));
@@ -524,31 +484,31 @@ static ERTS_INLINE void *cache_get_segment(MemKind *mk, UWord *size_p, Uint flag
csize = c->size;
seg = (char*) c->seg;
- mk->cache_size--;
- mk->cache_hits++;
+ ma->cache_size--;
+ ma->cache_hits++;
/* link to free cache list */
mseg_cache_clear_node(c);
- erts_circleq_push_head(&(mk->cache_free), c);
+ erts_circleq_push_head(&(ma->cache_free), c);
- ASSERT(!(mk->cache_size < 0));
+ ASSERT(!(ma->cache_size < 0));
if (csize != size)
- mseg_destroy(mk->ma, ERTS_MSEG_FLG_2POW, mk, seg + size, csize - size);
+ mseg_destroy(ma, ERTS_MSEG_FLG_2POW, seg + size, csize - size);
return seg;
}
}
- else if (!erts_circleq_is_empty(&(mk->cache_unpowered_node))) {
+ else if (!erts_circleq_is_empty(&(ma->cache_unpowered_node))) {
void *seg;
cache_t *c;
cache_t *best = NULL;
UWord bdiff = 0;
UWord csize;
- UWord bad_max_abs = mk->ma->abs_max_cache_bad_fit;
- UWord bad_max_rel = mk->ma->rel_max_cache_bad_fit;
+ UWord bad_max_abs = ma->abs_max_cache_bad_fit;
+ UWord bad_max_rel = ma->rel_max_cache_bad_fit;
- erts_circleq_foreach(c, &(mk->cache_unpowered_node)) {
+ erts_circleq_foreach(c, &(ma->cache_unpowered_node)) {
csize = c->size;
if (csize >= size) {
if (((csize - size)*100 < bad_max_rel*size) && (csize - size) < bad_max_abs ) {
@@ -557,11 +517,11 @@ static ERTS_INLINE void *cache_get_segment(MemKind *mk, UWord *size_p, Uint flag
erts_circleq_remove(c);
- mk->cache_size--;
- mk->cache_hits++;
+ ma->cache_size--;
+ ma->cache_hits++;
mseg_cache_clear_node(c);
- erts_circleq_push_head(&(mk->cache_free), c);
+ erts_circleq_push_head(&(ma->cache_free), c);
*size_p = csize;
@@ -584,7 +544,7 @@ static ERTS_INLINE void *cache_get_segment(MemKind *mk, UWord *size_p, Uint flag
ASSERT(best->seg);
ASSERT(best->size > 0);
- mk->cache_hits++;
+ ma->cache_hits++;
/* Use current cache placement for remaining segment space */
@@ -608,7 +568,7 @@ static ERTS_INLINE void *cache_get_segment(MemKind *mk, UWord *size_p, Uint flag
* using callbacks from aux-work in the scheduler.
*/
-static ERTS_INLINE Uint mseg_drop_one_memkind_cache_size(MemKind *mk, Uint flags, cache_t *head) {
+static ERTS_INLINE Uint mseg_drop_one_cache_size(ErtsMsegAllctr_t *ma, Uint flags, cache_t *head) {
cache_t *c = NULL;
c = erts_circleq_tail(head);
@@ -617,19 +577,19 @@ static ERTS_INLINE Uint mseg_drop_one_memkind_cache_size(MemKind *mk, Uint flags
if (erts_mtrace_enabled)
erts_mtrace_crr_free(SEGTYPE, SEGTYPE, c->seg);
- mseg_destroy(mk->ma, flags, mk, c->seg, c->size);
+ mseg_destroy(ma, flags, c->seg, c->size);
mseg_cache_clear_node(c);
- erts_circleq_push_head(&(mk->cache_free), c);
+ erts_circleq_push_head(&(ma->cache_free), c);
- mk->segments.current.watermark--;
- mk->cache_size--;
+ ma->segments.current.watermark--;
+ ma->cache_size--;
- ASSERT( mk->cache_size >= 0 );
+ ASSERT(ma->cache_size >= 0);
- return mk->cache_size;
+ return ma->cache_size;
}
-static ERTS_INLINE Uint mseg_drop_memkind_cache_size(MemKind *mk, Uint flags, cache_t *head) {
+static ERTS_INLINE Uint mseg_drop_cache_size(ErtsMsegAllctr_t *ma, Uint flags, cache_t *head) {
cache_t *c = NULL;
while (!erts_circleq_is_empty(head)) {
@@ -640,58 +600,52 @@ static ERTS_INLINE Uint mseg_drop_memkind_cache_size(MemKind *mk, Uint flags, ca
if (erts_mtrace_enabled)
erts_mtrace_crr_free(SEGTYPE, SEGTYPE, c->seg);
- mseg_destroy(mk->ma, flags, mk, c->seg, c->size);
+ mseg_destroy(ma, flags, c->seg, c->size);
mseg_cache_clear_node(c);
- erts_circleq_push_head(&(mk->cache_free), c);
-
- mk->segments.current.watermark--;
- mk->cache_size--;
+ erts_circleq_push_head(&(ma->cache_free), c);
+ ma->segments.current.watermark--;
+ ma->cache_size--;
}
- ASSERT( mk->cache_size >= 0 );
+ ASSERT(ma->cache_size >= 0);
- return mk->cache_size;
+ return ma->cache_size;
}
-/* mseg_check_memkind_cache
- * - Check if we can empty some cached segments in this
- * MemKind.
+/* mseg_check_cache
+ * - Check if we can empty some cached segments in this allocator
*/
-static Uint mseg_check_memkind_cache(MemKind *mk) {
+static Uint mseg_check_cache(ErtsMsegAllctr_t *ma) {
int i;
- ERTS_DBG_MK_CHK_THR_ACCESS(mk);
+ ERTS_DBG_MA_CHK_THR_ACCESS(ma);
for (i = 0; i < CACHE_AREAS; i++) {
- if (!erts_circleq_is_empty(&(mk->cache_powered_node[i])))
- return mseg_drop_one_memkind_cache_size(mk, ERTS_MSEG_FLG_2POW, &(mk->cache_powered_node[i]));
+ if (!erts_circleq_is_empty(&(ma->cache_powered_node[i])))
+ return mseg_drop_one_cache_size(ma, ERTS_MSEG_FLG_2POW, &(ma->cache_powered_node[i]));
}
- if (!erts_circleq_is_empty(&(mk->cache_unpowered_node)))
- return mseg_drop_one_memkind_cache_size(mk, ERTS_MSEG_FLG_NONE, &(mk->cache_unpowered_node));
+ if (!erts_circleq_is_empty(&(ma->cache_unpowered_node)))
+ return mseg_drop_one_cache_size(ma, ERTS_MSEG_FLG_NONE, &(ma->cache_unpowered_node));
return 0;
}
/* mseg_cache_check
* - Check if we have some cache we can purge
- * in any of the memkinds.
*/
static void mseg_cache_check(ErtsMsegAllctr_t *ma) {
- MemKind* mk;
Uint empty_cache = 1;
ERTS_MSEG_LOCK(ma);
- for (mk = ma->mk_list; mk; mk = mk->next) {
- if (mseg_check_memkind_cache(mk))
- empty_cache = 0;
- }
+ if (mseg_check_cache(ma))
+ empty_cache = 0;
/* If all MemKinds caches are empty,
* remove aux-work callback
@@ -709,7 +663,7 @@ static void mseg_cache_check(ErtsMsegAllctr_t *ma) {
/* erts_mseg_cache_check
* - This is a callback that is scheduled as aux-work from
* schedulers and is called at some interval if we have a cache
- * on this mseg-allocator and memkind.
+ * on this mseg-allocator.
* - Purpose: Empty cache slowly so we don't collect mapped areas
* and bloat memory.
*/
@@ -719,42 +673,32 @@ void erts_mseg_cache_check(void) {
}
-/* *_mseg_clear_*_cache
+/* mseg_clear_cache
* Remove cached segments from the allocator completely
*/
-static void mseg_clear_memkind_cache(MemKind *mk) {
+
+static void mseg_clear_cache(ErtsMsegAllctr_t *ma) {
int i;
+ ERTS_MSEG_LOCK(ma);
+ ERTS_DBG_MA_CHK_THR_ACCESS(ma);
/* drop pow2 caches */
for (i = 0; i < CACHE_AREAS; i++) {
- if (erts_circleq_is_empty(&(mk->cache_powered_node[i])))
+ if (erts_circleq_is_empty(&(ma->cache_powered_node[i])))
continue;
- mseg_drop_memkind_cache_size(mk, ERTS_MSEG_FLG_2POW, &(mk->cache_powered_node[i]));
- ASSERT(erts_circleq_is_empty(&(mk->cache_powered_node[i])));
+ mseg_drop_cache_size(ma, ERTS_MSEG_FLG_2POW, &(ma->cache_powered_node[i]));
+ ASSERT(erts_circleq_is_empty(&(ma->cache_powered_node[i])));
}
/* drop varied caches */
- if (!erts_circleq_is_empty(&(mk->cache_unpowered_node)))
- mseg_drop_memkind_cache_size(mk, ERTS_MSEG_FLG_NONE, &(mk->cache_unpowered_node));
-
- ASSERT(erts_circleq_is_empty(&(mk->cache_unpowered_node)));
- ASSERT(mk->cache_size == 0);
-}
-
-static void mseg_clear_cache(ErtsMsegAllctr_t *ma) {
- MemKind* mk;
-
- ERTS_MSEG_LOCK(ma);
- ERTS_DBG_MA_CHK_THR_ACCESS(ma);
+ if (!erts_circleq_is_empty(&(ma->cache_unpowered_node)))
+ mseg_drop_cache_size(ma, ERTS_MSEG_FLG_NONE, &(ma->cache_unpowered_node));
-
- for (mk = ma->mk_list; mk; mk = mk->next) {
- mseg_clear_memkind_cache(mk);
- }
+ ASSERT(erts_circleq_is_empty(&(ma->cache_unpowered_node)));
+ ASSERT(ma->cache_size == 0);
INC_CC(ma, clear_cache);
-
ERTS_MSEG_UNLOCK(ma);
}
@@ -763,25 +707,12 @@ void erts_mseg_clear_cache(void) {
mseg_clear_cache(ERTS_MSEG_ALLCTR_IX(0));
}
-
-
-static ERTS_INLINE MemKind* memkind(ErtsMsegAllctr_t *ma,
- const ErtsMsegOpt_t *opt)
-{
-#if HALFWORD_HEAP
- return opt->low_mem ? &ma->low_mem : &ma->hi_mem;
-#else
- return &ma->the_mem;
-#endif
-}
-
static void *
mseg_alloc(ErtsMsegAllctr_t *ma, ErtsAlcType_t atype, UWord *size_p,
Uint flags, const ErtsMsegOpt_t *opt)
{
UWord size;
void *seg;
- MemKind* mk = memkind(ma, opt);
INC_CC(ma, alloc);
@@ -795,10 +726,10 @@ mseg_alloc(ErtsMsegAllctr_t *ma, ErtsAlcType_t atype, UWord *size_p,
}
}
- if (opt->cache && mk->cache_size > 0 && (seg = cache_get_segment(mk, &size, flags)) != NULL)
+ if (opt->cache && ma->cache_size > 0 && (seg = cache_get_segment(ma, &size, flags)) != NULL)
goto done;
- seg = mseg_create(ma, flags, mk, &size);
+ seg = mseg_create(ma, flags, &size);
if (!seg)
*size_p = 0;
@@ -808,7 +739,7 @@ done:
if (erts_mtrace_enabled)
erts_mtrace_crr_alloc(seg, atype, ERTS_MTRACE_SEGMENT_ID, size);
- ERTS_MSEG_ALLOC_STAT(mk,size);
+ ERTS_MSEG_ALLOC_STAT(ma,size);
}
return seg;
@@ -819,11 +750,9 @@ static void
mseg_dealloc(ErtsMsegAllctr_t *ma, ErtsAlcType_t atype, void *seg, UWord size,
Uint flags, const ErtsMsegOpt_t *opt)
{
- MemKind* mk = memkind(ma, opt);
+ ERTS_MSEG_DEALLOC_STAT(ma,size);
- ERTS_MSEG_DEALLOC_STAT(mk,size);
-
- if (opt->cache && cache_bless_segment(mk, seg, size, flags)) {
+ if (opt->cache && cache_bless_segment(ma, seg, size, flags)) {
schedule_cache_check(ma);
goto done;
}
@@ -831,7 +760,7 @@ mseg_dealloc(ErtsMsegAllctr_t *ma, ErtsAlcType_t atype, void *seg, UWord size,
if (erts_mtrace_enabled)
erts_mtrace_crr_free(atype, SEGTYPE, seg);
- mseg_destroy(ma, flags, mk, seg, size);
+ mseg_destroy(ma, flags, seg, size);
done:
@@ -842,7 +771,6 @@ static void *
mseg_realloc(ErtsMsegAllctr_t *ma, ErtsAlcType_t atype, void *seg,
UWord old_size, UWord *new_size_p, Uint flags, const ErtsMsegOpt_t *opt)
{
- MemKind* mk;
void *new_seg;
UWord new_size;
@@ -861,7 +789,6 @@ mseg_realloc(ErtsMsegAllctr_t *ma, ErtsAlcType_t atype, void *seg,
return NULL;
}
- mk = memkind(ma, opt);
new_seg = seg;
if (!MSEG_FLG_IS_2POW(flags))
@@ -876,7 +803,7 @@ mseg_realloc(ErtsMsegAllctr_t *ma, ErtsAlcType_t atype, void *seg,
if (new_size > old_size) {
if (opt->preserv) {
- new_seg = mseg_recreate(ma, flags, mk, (void *) seg, old_size, &new_size);
+ new_seg = mseg_recreate(ma, flags, (void *) seg, old_size, &new_size);
if (!new_seg)
new_size = old_size;
}
@@ -896,7 +823,7 @@ mseg_realloc(ErtsMsegAllctr_t *ma, ErtsAlcType_t atype, void *seg,
new_size = old_size;
}
else {
- new_seg = mseg_recreate(ma, flags, mk, (void *) seg, old_size, &new_size);
+ new_seg = mseg_recreate(ma, flags, (void *) seg, old_size, &new_size);
if (!new_seg)
new_size = old_size;
}
@@ -910,7 +837,7 @@ mseg_realloc(ErtsMsegAllctr_t *ma, ErtsAlcType_t atype, void *seg,
ASSERT(!MSEG_FLG_IS_2POW(flags) || IS_2POW(new_size));
*new_size_p = new_size;
- ERTS_MSEG_REALLOC_STAT(mk, old_size, new_size);
+ ERTS_MSEG_REALLOC_STAT(ma, old_size, new_size);
return new_seg;
}
@@ -1180,63 +1107,63 @@ info_calls(ErtsMsegAllctr_t *ma, int *print_to_p, void *print_to_arg, Uint **hpp
}
static Eterm
-info_status(ErtsMsegAllctr_t *ma, MemKind* mk, int *print_to_p, void *print_to_arg,
+info_status(ErtsMsegAllctr_t *ma, int *print_to_p, void *print_to_arg,
int begin_new_max_period, Uint **hpp, Uint *szp)
{
Eterm res = THE_NON_VALUE;
- if (mk->segments.max_ever.no < mk->segments.max.no)
- mk->segments.max_ever.no = mk->segments.max.no;
- if (mk->segments.max_ever.sz < mk->segments.max.sz)
- mk->segments.max_ever.sz = mk->segments.max.sz;
+ if (ma->segments.max_ever.no < ma->segments.max.no)
+ ma->segments.max_ever.no = ma->segments.max.no;
+ if (ma->segments.max_ever.sz < ma->segments.max.sz)
+ ma->segments.max_ever.sz = ma->segments.max.sz;
if (print_to_p) {
int to = *print_to_p;
void *arg = print_to_arg;
- erts_print(to, arg, "cached_segments: %beu\n", mk->cache_size);
- erts_print(to, arg, "cache_hits: %beu\n", mk->cache_hits);
+ erts_print(to, arg, "cached_segments: %beu\n", ma->cache_size);
+ erts_print(to, arg, "cache_hits: %beu\n", ma->cache_hits);
erts_print(to, arg, "segments: %beu %beu %beu\n",
- mk->segments.current.no, mk->segments.max.no, mk->segments.max_ever.no);
+ ma->segments.current.no, ma->segments.max.no, ma->segments.max_ever.no);
erts_print(to, arg, "segments_size: %beu %beu %beu\n",
- mk->segments.current.sz, mk->segments.max.sz, mk->segments.max_ever.sz);
+ ma->segments.current.sz, ma->segments.max.sz, ma->segments.max_ever.sz);
erts_print(to, arg, "segments_watermark: %beu\n",
- mk->segments.current.watermark);
+ ma->segments.current.watermark);
}
if (hpp || szp) {
res = NIL;
add_2tup(hpp, szp, &res,
am.segments_watermark,
- bld_unstable_uint(hpp, szp, mk->segments.current.watermark));
+ bld_unstable_uint(hpp, szp, ma->segments.current.watermark));
add_4tup(hpp, szp, &res,
am.segments_size,
- bld_unstable_uint(hpp, szp, mk->segments.current.sz),
- bld_unstable_uint(hpp, szp, mk->segments.max.sz),
- bld_unstable_uint(hpp, szp, mk->segments.max_ever.sz));
+ bld_unstable_uint(hpp, szp, ma->segments.current.sz),
+ bld_unstable_uint(hpp, szp, ma->segments.max.sz),
+ bld_unstable_uint(hpp, szp, ma->segments.max_ever.sz));
add_4tup(hpp, szp, &res,
am.segments,
- bld_unstable_uint(hpp, szp, mk->segments.current.no),
- bld_unstable_uint(hpp, szp, mk->segments.max.no),
- bld_unstable_uint(hpp, szp, mk->segments.max_ever.no));
+ bld_unstable_uint(hpp, szp, ma->segments.current.no),
+ bld_unstable_uint(hpp, szp, ma->segments.max.no),
+ bld_unstable_uint(hpp, szp, ma->segments.max_ever.no));
add_2tup(hpp, szp, &res,
am.cache_hits,
- bld_unstable_uint(hpp, szp, mk->cache_hits));
+ bld_unstable_uint(hpp, szp, ma->cache_hits));
add_2tup(hpp, szp, &res,
am.cached_segments,
- bld_unstable_uint(hpp, szp, mk->cache_size));
+ bld_unstable_uint(hpp, szp, ma->cache_size));
}
if (begin_new_max_period) {
- mk->segments.max.no = mk->segments.current.no;
- mk->segments.max.sz = mk->segments.current.sz;
+ ma->segments.max.no = ma->segments.current.no;
+ ma->segments.max.sz = ma->segments.current.sz;
}
return res;
}
-static Eterm info_memkind(ErtsMsegAllctr_t *ma, MemKind* mk, int *print_to_p, void *print_to_arg,
+static Eterm info_memkind(ErtsMsegAllctr_t *ma, int *print_to_p, void *print_to_arg,
int begin_max_per, Uint **hpp, Uint *szp)
{
Eterm res = THE_NON_VALUE;
@@ -1244,15 +1171,15 @@ static Eterm info_memkind(ErtsMsegAllctr_t *ma, MemKind* mk, int *print_to_p, vo
Eterm values[3];
if (print_to_p) {
- erts_print(*print_to_p, print_to_arg, "memory kind: %s\n", mk->name);
+ erts_print(*print_to_p, print_to_arg, "memory kind: %s\n", "all memory");
}
if (hpp || szp) {
atoms[0] = am.name;
atoms[1] = am.status;
atoms[2] = am.calls;
- values[0] = erts_bld_string(hpp, szp, mk->name);
+ values[0] = erts_bld_string(hpp, szp, "all memory");
}
- values[1] = info_status(ma, mk, print_to_p, print_to_arg, begin_max_per, hpp, szp);
+ values[1] = info_status(ma, print_to_p, print_to_arg, begin_max_per, hpp, szp);
values[2] = info_calls(ma, print_to_p, print_to_arg, hpp, szp);
if (hpp || szp)
@@ -1261,7 +1188,6 @@ static Eterm info_memkind(ErtsMsegAllctr_t *ma, MemKind* mk, int *print_to_p, vo
return res;
}
-
static Eterm
info_version(ErtsMsegAllctr_t *ma, int *print_to_p, void *print_to_arg, Uint **hpp, Uint *szp)
{
@@ -1326,12 +1252,7 @@ erts_mseg_info(int ix,
ERTS_MSEG_LOCK(ma);
ERTS_DBG_MA_CHK_THR_ACCESS(ma);
-#if HALFWORD_HEAP
- values[n++] = info_memkind(ma, &ma->low_mem, print_to_p, print_to_arg, begin_max_per, hpp, szp);
- values[n++] = info_memkind(ma, &ma->hi_mem, print_to_p, print_to_arg, begin_max_per, hpp, szp);
-#else
- values[n++] = info_memkind(ma, &ma->the_mem, print_to_p, print_to_arg, begin_max_per, hpp, szp);
-#endif
+ values[n++] = info_memkind(ma, print_to_p, print_to_arg, begin_max_per, hpp, szp);
if (hpp || szp)
res = bld_2tup_list(hpp, szp, n, atoms, values);
@@ -1408,13 +1329,10 @@ Uint
erts_mseg_no(const ErtsMsegOpt_t *opt)
{
ErtsMsegAllctr_t *ma = ERTS_MSEG_ALLCTR_OPT(opt);
- MemKind* mk;
- Uint n = 0;
+ Uint n;
ERTS_MSEG_LOCK(ma);
ERTS_DBG_MA_CHK_THR_ACCESS(ma);
- for (mk=ma->mk_list; mk; mk=mk->next) {
- n += mk->segments.current.no;
- }
+ n = ma->segments.current.no;
ERTS_MSEG_UNLOCK(ma);
return n;
}
@@ -1426,16 +1344,16 @@ erts_mseg_unit_size(void)
}
-static void mem_kind_init(ErtsMsegAllctr_t *ma, MemKind* mk, const char* name)
+static void mem_cache_init(ErtsMsegAllctr_t *ma)
{
int i;
/* Clear all cache headers */
- mseg_cache_clear_node(&(mk->cache_free));
- mseg_cache_clear_node(&(mk->cache_unpowered_node));
+ mseg_cache_clear_node(&(ma->cache_free));
+ mseg_cache_clear_node(&(ma->cache_unpowered_node));
for (i = 0; i < CACHE_AREAS; i++) {
- mseg_cache_clear_node(&(mk->cache_powered_node[i]));
+ mseg_cache_clear_node(&(ma->cache_powered_node[i]));
}
/* Populate cache free list */
@@ -1443,25 +1361,20 @@ static void mem_kind_init(ErtsMsegAllctr_t *ma, MemKind* mk, const char* name)
ASSERT(ma->max_cache_size <= MAX_CACHE_SIZE);
for (i = 0; i < ma->max_cache_size; i++) {
- mseg_cache_clear_node(&(mk->cache[i]));
- erts_circleq_push_head(&(mk->cache_free), &(mk->cache[i]));
+ mseg_cache_clear_node(&(ma->cache[i]));
+ erts_circleq_push_head(&(ma->cache_free), &(ma->cache[i]));
}
- mk->cache_size = 0;
- mk->cache_hits = 0;
-
- mk->segments.current.watermark = 0;
- mk->segments.current.no = 0;
- mk->segments.current.sz = 0;
- mk->segments.max.no = 0;
- mk->segments.max.sz = 0;
- mk->segments.max_ever.no = 0;
- mk->segments.max_ever.sz = 0;
-
- mk->ma = ma;
- mk->name = name;
- mk->next = ma->mk_list;
- ma->mk_list = mk;
+ ma->cache_size = 0;
+ ma->cache_hits = 0;
+
+ ma->segments.current.watermark = 0;
+ ma->segments.current.no = 0;
+ ma->segments.current.sz = 0;
+ ma->segments.max.no = 0;
+ ma->segments.max.sz = 0;
+ ma->segments.max_ever.no = 0;
+ ma->segments.max_ever.sz = 0;
}
void
@@ -1488,15 +1401,6 @@ erts_mseg_init(ErtsMsegInit_t *init)
erts_mtx_init(&init_atoms_mutex, "mseg_init_atoms");
-#if HALFWORD_HEAP
- if (sizeof(void *) != 8)
- erl_exit(-1,"Halfword emulator cannot be run in 32bit mode");
-
- init->mmap.virtual_range.start = (char *) sbrk(0);
- init->mmap.virtual_range.end = (char *) 0x100000000UL;
- init->mmap.sco = 0;
-#endif
-
erts_mmap_init(&init->mmap);
if (!IS_2POW(GET_PAGE_SIZE))
@@ -1529,14 +1433,7 @@ erts_mseg_init(ErtsMsegInit_t *init)
if (ma->max_cache_size > MAX_CACHE_SIZE)
ma->max_cache_size = MAX_CACHE_SIZE;
- ma->mk_list = NULL;
-
-#if HALFWORD_HEAP
- mem_kind_init(ma, &ma->low_mem, "low memory");
- mem_kind_init(ma, &ma->hi_mem, "high memory");
-#else
- mem_kind_init(ma, &ma->the_mem, "all memory");
-#endif
+ mem_cache_init(ma);
sys_memzero((void *) &ma->calls, sizeof(ErtsMsegCalls));
}
@@ -1545,13 +1442,8 @@ erts_mseg_init(ErtsMsegInit_t *init)
static ERTS_INLINE Uint tot_cache_size(ErtsMsegAllctr_t *ma)
{
- MemKind* mk;
- Uint sz = 0;
ERTS_DBG_MA_CHK_THR_ACCESS(ma);
- for (mk=ma->mk_list; mk; mk=mk->next) {
- sz += mk->cache_size;
- }
- return sz;
+ return ma->cache_size;
}
/*
diff --git a/erts/emulator/sys/common/erl_mseg.h b/erts/emulator/sys/common/erl_mseg.h
index ba04e919fc..656484702d 100644
--- a/erts/emulator/sys/common/erl_mseg.h
+++ b/erts/emulator/sys/common/erl_mseg.h
@@ -87,9 +87,6 @@ typedef struct {
UWord abs_shrink_th;
UWord rel_shrink_th;
int sched_spec;
-#if HALFWORD_HEAP
- int low_mem;
-#endif
} ErtsMsegOpt_t;
extern const ErtsMsegOpt_t erts_mseg_default_opt;
diff --git a/erts/emulator/sys/common/erl_poll.h b/erts/emulator/sys/common/erl_poll.h
index 19ce582154..6d8aef822e 100644
--- a/erts/emulator/sys/common/erl_poll.h
+++ b/erts/emulator/sys/common/erl_poll.h
@@ -93,7 +93,7 @@
# if defined(ERTS_USE_POLL)
# undef ERTS_POLL_USE_POLL
# define ERTS_POLL_USE_POLL 1
-# elif !defined(__WIN32__) && !defined(__OSE__)
+# elif !defined(__WIN32__)
# undef ERTS_POLL_USE_SELECT
# define ERTS_POLL_USE_SELECT 1
# endif
@@ -104,31 +104,13 @@
typedef Uint32 ErtsPollEvents;
#undef ERTS_POLL_EV_E2N
-#if defined(__WIN32__) || defined(__OSE__) /* --- win32 or ose -------- */
+#if defined(__WIN32__) /* --- win32 --------------------------------------- */
#define ERTS_POLL_EV_IN 1
#define ERTS_POLL_EV_OUT 2
#define ERTS_POLL_EV_ERR 4
#define ERTS_POLL_EV_NVAL 8
-#ifdef __OSE__
-
-typedef struct ErtsPollOseMsgList_ {
- struct ErtsPollOseMsgList_ *next;
- union SIGNAL *data;
-} ErtsPollOseMsgList;
-
-struct erts_sys_fd_type {
- SIGSELECT signo;
- ErlDrvOseEventId id;
- ErtsPollOseMsgList *msgs;
- ErlDrvOseEventId (*resolve_signal)(union SIGNAL *sig);
- ethr_mutex mtx;
- void *extra;
-};
-
-#endif
-
#elif ERTS_POLL_USE_EPOLL /* --- epoll ------------------------------- */
#include <sys/epoll.h>
diff --git a/erts/emulator/sys/ose/beam.lmconf b/erts/emulator/sys/ose/beam.lmconf
deleted file mode 100644
index 4ad46b01d9..0000000000
--- a/erts/emulator/sys/ose/beam.lmconf
+++ /dev/null
@@ -1,26 +0,0 @@
-OSE_LM_STACK_SIZES=256,512,1024,2048,4096,8192,16384,65536
-OSE_LM_SIGNAL_SIZES=31,63,127,255,1023,4095,16383,65535
-OSE_LM_POOL_SIZE=0x200000
-OSE_LM_MAIN_NAME=main
-OSE_LM_MAIN_STACK_SIZE=0xF000
-OSE_LM_MAIN_PRIORITY=20
-## Has to be of a type that allows MAM
-OSE_LM_PROGRAM_TYPE=APP_RAM
-OSE_LM_DATA_INIT=YES
-OSE_LM_BSS_INIT=YES
-OSE_LM_EXEC_MODEL=SHARED
-HEAP_MAX_SIZE=1000000000
-HEAP_SMALL_BUF_INIT_SIZE=20971520
-HEAP_LARGE_BUF_THRESHOLD=16000000
-HEAP_LOCK_TYPE=2
-
-ERTS_DEFAULT_PRIO=24
-ERTS_SCHEDULER_PRIO=24
-ERTS_ASYNC_PRIO=22
-ERTS_AUX_PRIO=24
-ERTS_SYS_MSG_DISPATCHER_PRIO=21
-
-# Setting the environment variable EFS_RESOLVE_TMO on the block to 0.
-# This will eliminiate delays when trying to open files on not mounted
-# volumes.
-EFS_RESOLVE_TMO=0
diff --git a/erts/emulator/sys/ose/driver_int.h b/erts/emulator/sys/ose/driver_int.h
deleted file mode 100644
index 4a5b7171d1..0000000000
--- a/erts/emulator/sys/ose/driver_int.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1997-2009. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- */
-/*
- * System dependant driver declarations
- */
-
-#ifndef __DRIVER_INT_H__
-#define __DRIVER_INT_H__
-
-#ifdef HAVE_SYS_UIO_H
-#include <sys/types.h>
-#include <sys/uio.h>
-
-typedef struct iovec SysIOVec;
-
-#else
-
-typedef struct {
- char* iov_base;
- int iov_len;
-} SysIOVec;
-
-#endif
-
-#endif
diff --git a/erts/emulator/sys/ose/erl_main.c b/erts/emulator/sys/ose/erl_main.c
deleted file mode 100644
index 877e85f43a..0000000000
--- a/erts/emulator/sys/ose/erl_main.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 2000-2009. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-#include <stdlib.h>
-
-#include "sys.h"
-#include "erl_vm.h"
-#include "global.h"
-#include "ose.h"
-
-int
-main(int argc, char **argv) {
-
- (void)stdin;(void)stdout;(void)stderr;
-
- /* When starting using pm_create -c ARGV="-- -root ..", argv[0] is the first
- part of ARGV and not the name of the executable. So we shuffle some
- pointers here to make erl_start happy. */
- if (argv[0][0] == '-') {
- int i;
- char **tmp_argv = malloc(sizeof(char*)*(argc+1));
- for (i = 0; i < argc; i++)
- tmp_argv[i+1] = argv[i];
- tmp_argv[0] = "beam";
- erl_start(argc+1,tmp_argv);
- free(tmp_argv);
- } else {
- erl_start(argc,argv);
- }
-
- stop(current_process());
-
- return 0;
-}
diff --git a/erts/emulator/sys/ose/erl_ose_sys.h b/erts/emulator/sys/ose/erl_ose_sys.h
deleted file mode 100644
index d0cd3180bf..0000000000
--- a/erts/emulator/sys/ose/erl_ose_sys.h
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1997-2011. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- *
- * This file handles differences between different Unix systems.
- * This should be the only place with conditional compilation
- * depending on the type of OS.
- */
-
-#ifndef _ERL_OSE_SYS_H
-#define _ERL_OSE_SYS_H
-
-#include "ose.h"
-#undef NIL
-#include "ramlog.h"
-#include "erts.sig"
-
-#include "fcntl.h"
-#include "math.h"
-#include "stdio.h"
-#include "stdlib.h"
-#include "string.h"
-#include "sys/param.h"
-#include "sys/time.h"
-#include "time.h"
-#include "dirent.h"
-#include "ethread.h"
-
-/* FIXME: configuration options */
-#define ERTS_SCHED_MIN_SPIN 1
-#define ERTS_SCHED_ONLY_POLL_SCHED_1 1
-#define ERTS_SCHED_FAIR 1
-#define NO_SYSCONF 1
-#define OPEN_MAX FOPEN_MAX
-
-#define MAP_ANON MAP_ANONYMOUS
-
-#ifndef HAVE_MMAP
-# define HAVE_MMAP 0
-#endif
-
-#if HAVE_MMAP
-# include "sys/mman.h"
-#endif
-
-/*
- * Min number of async threads
- */
-#define ERTS_MIN_NO_OF_ASYNC_THREADS 1
-
-/*
- * Our own type of "FD's"
- */
-#define ERTS_SYS_FD_TYPE struct erts_sys_fd_type*
-#define NO_FSTAT_ON_SYS_FD_TYPE 1 /* They are signals, not files */
-
-#include "sys/stat.h"
-
-/* FIXME mremap is not defined in OSE - POSIX issue */
-extern void *mremap (void *__addr, size_t __old_len, size_t __new_len,
- int __flags, ...);
-
-/* FIXME: mremap constants */
-#define MREMAP_MAYMOVE 1
-#define MREMAP_FIXED 2
-
-typedef void *GETENV_STATE;
-
-/*
-** For the erl_timer_sup module.
-*/
-#define HAVE_GETHRTIME
-
-typedef long long SysHrTime;
-extern SysHrTime sys_gethrtime(void);
-
-void sys_init_hrtime(void);
-
-typedef time_t erts_time_t;
-
-typedef struct timeval SysTimeval;
-
-#define sys_gettimeofday(Arg) ((void) gettimeofday((Arg), NULL))
-
-typedef struct {
- clock_t tms_utime;
- clock_t tms_stime;
- clock_t tms_cutime;
- clock_t tms_cstime;
-} SysTimes;
-
-extern int erts_ticks_per_sec;
-
-#define SYS_CLK_TCK (erts_ticks_per_sec)
-
-extern clock_t sys_times(SysTimes *buffer);
-
-/* No use in having other resolutions than 1 Ms. */
-#define SYS_CLOCK_RESOLUTION 1
-
-#define erts_isfinite finite
-
-#ifdef NO_FPE_SIGNALS
-
-#define erts_get_current_fp_exception() NULL
-#ifdef ERTS_SMP
-#define erts_thread_init_fp_exception() do{}while(0)
-#endif
-# define __ERTS_FP_CHECK_INIT(fpexnp) do {} while (0)
-# define __ERTS_FP_ERROR(fpexnp, f, Action) if (!finite(f)) { Action; } else {}
-# define __ERTS_FP_ERROR_THOROUGH(fpexnp, f, Action) __ERTS_FP_ERROR(fpexnp, f, Action)
-# define __ERTS_SAVE_FP_EXCEPTION(fpexnp)
-# define __ERTS_RESTORE_FP_EXCEPTION(fpexnp)
-
-#define erts_sys_block_fpe() 0
-#define erts_sys_unblock_fpe(x) do{}while(0)
-
-#else /* !NO_FPE_SIGNALS */
-
-extern volatile unsigned long *erts_get_current_fp_exception(void);
-#ifdef ERTS_SMP
-extern void erts_thread_init_fp_exception(void);
-#endif
-# if (defined(__i386__) || defined(__x86_64__)) && defined(__GNUC__)
-# define erts_fwait(fpexnp,f) \
- __asm__ __volatile__("fwait" : "=m"(*(fpexnp)) : "m"(f))
-# elif (defined(__powerpc__) || defined(__ppc__)) && defined(__GNUC__)
-# define erts_fwait(fpexnp,f) \
- __asm__ __volatile__("" : "=m"(*(fpexnp)) : "fm"(f))
-# elif defined(__sparc__) && defined(__linux__) && defined(__GNUC__)
-# define erts_fwait(fpexnp,f) \
- __asm__ __volatile__("" : "=m"(*(fpexnp)) : "em"(f))
-# else
-# define erts_fwait(fpexnp,f) \
- __asm__ __volatile__("" : "=m"(*(fpexnp)) : "g"(f))
-# endif
-# if (defined(__i386__) || defined(__x86_64__)) && defined(__GNUC__)
- extern void erts_restore_fpu(void);
-# else
-# define erts_restore_fpu() /*empty*/
-# endif
-# if (!defined(__GNUC__) || \
- (__GNUC__ < 2) || \
- (__GNUC__ == 2 && __GNUC_MINOR < 96)) && \
- !defined(__builtin_expect)
-# define __builtin_expect(x, expected_value) (x)
-# endif
-static __inline__ int erts_check_fpe(volatile unsigned long *fp_exception, double f)
-{
- erts_fwait(fp_exception, f);
- if (__builtin_expect(*fp_exception == 0, 1))
- return 0;
- *fp_exception = 0;
- erts_restore_fpu();
- return 1;
-}
-# undef erts_fwait
-# undef erts_restore_fpu
-extern void erts_fp_check_init_error(volatile unsigned long *fp_exception);
-static __inline__ void __ERTS_FP_CHECK_INIT(volatile unsigned long *fp_exception)
-{
- if (__builtin_expect(*fp_exception == 0, 1))
- return;
- erts_fp_check_init_error(fp_exception);
-}
-# define __ERTS_FP_ERROR(fpexnp, f, Action) do { if (erts_check_fpe((fpexnp),(f))) { Action; } } while (0)
-# define __ERTS_SAVE_FP_EXCEPTION(fpexnp) unsigned long old_erl_fp_exception = *(fpexnp)
-# define __ERTS_RESTORE_FP_EXCEPTION(fpexnp) \
- do { *(fpexnp) = old_erl_fp_exception; } while (0)
- /* This is for library calls where we don't trust the external
- code to always throw floating-point exceptions on errors. */
-static __inline__ int erts_check_fpe_thorough(volatile unsigned long *fp_exception, double f)
-{
- return erts_check_fpe(fp_exception, f) || !finite(f);
-}
-# define __ERTS_FP_ERROR_THOROUGH(fpexnp, f, Action) \
- do { if (erts_check_fpe_thorough((fpexnp),(f))) { Action; } } while (0)
-
-int erts_sys_block_fpe(void);
-void erts_sys_unblock_fpe(int);
-
-#endif /* !NO_FPE_SIGNALS */
-
-#define ERTS_FP_CHECK_INIT(p) __ERTS_FP_CHECK_INIT(&(p)->fp_exception)
-#define ERTS_FP_ERROR(p, f, A) __ERTS_FP_ERROR(&(p)->fp_exception, f, A)
-#define ERTS_FP_ERROR_THOROUGH(p, f, A) __ERTS_FP_ERROR_THOROUGH(&(p)->fp_exception, f, A)
-
-/* FIXME: force HAVE_GETPAGESIZE and stub getpagesize */
-#ifndef HAVE_GETPAGESIZE
-#define HAVE_GETPAGESIZE 1
-#endif
-
-extern int getpagesize(void);
-
-#ifndef HZ
-#define HZ 60
-#endif
-
-/* OSE5 doesn't provide limits.h so a number of macros should be
- * added manually */
-
-#ifndef CHAR_BIT
-#define CHAR_BIT 8
-#endif
-
-/* Minimum and maximum values a `signed int' can hold. */
-#ifndef INT_MAX
-#define INT_MAX 2147483647
-#endif
-
-#ifndef INT_MIN
-#define INT_MIN (-INT_MAX - 1)
-#endif
-
-#ifndef UINT_MAX
-# define UINT_MAX 4294967295U
-#endif
-
-/*
-static void erts_ose_sys_send(union SIGNAL **signal,PROCESS dst,
- char* file,int line) {
- SIGSELECT **ziggy = (SIGSELECT**)signal;
- printf("%s:%d 0x%x Send signal 0x%x(0x%x) to 0x%x\r\n",
- file,line,current_process(),ziggy[0][0],*ziggy,dst);
- send(signal,dst);
-}
-#define send(signal,dst) erts_ose_sys_send(signal,dst,__FILE__,__LINE__)
-
-static void erts_ose_sys_send_w_sender(union SIGNAL **signal,
- PROCESS sender,PROCESS dst,
- char* file,int line) {
- SIGSELECT **ziggy = (SIGSELECT**)signal;
- printf("%s:%d 0x%x Send signal 0x%x(0x%x) to 0x%x as 0x%x\r\n",
- file,line,current_process(),ziggy[0][0],*ziggy,dst,sender);
- send_w_sender(signal,sender,dst);
-}
-#define send_w_sender(signal,sender,dst) \
- erts_ose_sys_send_w_sender(signal,sender,dst,__FILE__,__LINE__)
-
-
-static union SIGNAL *erts_ose_sys_receive(SIGSELECT *sigsel,
- char *file,
- int line) {
- SIGSELECT *sig;
- int i;
-
- printf("%s:%d 0x%x receive({%d,",file,line,current_process(),sigsel[0]);
- for (i = 1; i < sigsel[0]; i++)
- printf("0x%x, ",sigsel[i]);
- if (sigsel[0] != 0)
- printf("0x%x",sigsel[i]);
- printf("})\n");
- sig = (SIGSELECT*)receive(sigsel);
- printf("%s:%d 0x%x got 0x%x from 0x%x\n",file,line,current_process(),
- *sig,sender((union SIGNAL**)(&sig)));
- return (union SIGNAL*)sig;
-}
-#define receive(SIGSEL) erts_ose_sys_receive(SIGSEL,__FILE__,__LINE__)
-
-static union SIGNAL *erts_ose_sys_receive_w_tmo(OSTIME tmo,SIGSELECT *sigsel,
- char *file,int line) {
- SIGSELECT *sig;
- int i;
- if (tmo == 0) {
- sig = (SIGSELECT*)receive_w_tmo(tmo,sigsel);
- if (sig != NULL) {
- printf("%s:%d 0x%x receive_w_tmo(0,{%d,",file,line,current_process(),
- sigsel[0]);
- for (i = 1; i < sigsel[0]; i++)
- printf("0x%x, ",sigsel[i]);
- if (sigsel[0] != 0)
- printf("0x%x",sigsel[i]);
- printf("})\n");
- printf("%s:%d 0x%x got 0x%x from 0x%x\n",file,line,current_process(),
- *sig,sender((union SIGNAL**)(&sig)));
- }
- } else {
- printf("%s:%d 0x%x receive_w_tmo(%u,{%d,",file,line,current_process(),tmo,
- sigsel[0]);
- for (i = 1; i < sigsel[0]; i++)
- printf("0x%x, ",sigsel[i]);
- if (sigsel[0] != 0)
- printf("0x%x",sigsel[i]);
- printf("})\n");
- sig = (SIGSELECT*)receive_w_tmo(tmo,sigsel);
- printf("%s:%d 0x%x got ",file,line,current_process());
- if (sig == NULL)
- printf("TIMEOUT\n");
- else
- printf("0x%x from 0x%x\n",*sig,sender((union SIGNAL**)(&sig)));
- }
-
- return (union SIGNAL*)sig;
-}
-
-#define receive_w_tmo(tmo,sigsel) erts_ose_sys_receive_w_tmo(tmo,sigsel, \
- __FILE__,__LINE__)
-
-static union SIGNAL *erts_ose_sys_receive_fsem(OSTIME tmo,SIGSELECT *sigsel,
- OSFSEMVAL fsem,
- char *file,int line) {
- SIGSELECT *sig;
- int i;
- if (tmo == 0) {
- sig = (SIGSELECT*)receive_fsem(tmo,sigsel,fsem);
- if (sig != NULL && sig != OS_RCV_FSEM) {
- printf("%s:%d 0x%x receive_fsem(0,{%d,",file,line,current_process(),
- sigsel[0]);
- for (i = 1; i < sigsel[0]; i++)
- printf("0x%x, ",sigsel[i]);
- if (sigsel[0] != 0)
- printf("0x%x",sigsel[i]);
- printf("},%d)\n",fsem);
- printf("%s:%d 0x%x got 0x%x from 0x%x\n",file,line,current_process(),
- *sig,sender((union SIGNAL**)(&sig)));
- }
- } else {
- printf("%s:%d 0x%x receive_fsem(%u,{%d,",file,line,current_process(),tmo,
- sigsel[0]);
- for (i = 1; i < sigsel[0]; i++)
- printf("0x%x, ",sigsel[i]);
- if (sigsel[0] != 0)
- printf("0x%x",sigsel[i]);
- printf("},%d)\n",fsem);
- sig = (SIGSELECT*)receive_fsem(tmo,sigsel,fsem);
- printf("%s:%d 0x%x got ",file,line,current_process());
- if (sig == NULL)
- printf("TIMEOUT\n");
- else if (sig == OS_RCV_FSEM)
- printf("FSEM\n");
- else
- printf("0x%x from 0x%x\n",*sig,sender((union SIGNAL**)(&sig)));
- }
-
- return (union SIGNAL*)sig;
-}
-
-#define receive_fsem(tmo,sigsel,fsem) \
- erts_ose_sys_receive_fsem(tmo,sigsel,fsem,__FILE__,__LINE__)
-*/
-#endif /* _ERL_OSE_SYS_H */
diff --git a/erts/emulator/sys/ose/erl_ose_sys_ddll.c b/erts/emulator/sys/ose/erl_ose_sys_ddll.c
deleted file mode 100644
index 5051f7fcc1..0000000000
--- a/erts/emulator/sys/ose/erl_ose_sys_ddll.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 2006-2013. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- */
-
-/*
- * Interface functions to the dynamic linker using dl* functions.
- * (No support in OSE, we use static linkage instead)
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "sys.h"
-#include "erl_vm.h"
-#include "global.h"
-
-
-void erl_sys_ddll_init(void) {
-}
-
-/*
- * Open a shared object
- */
-int erts_sys_ddll_open(const char *full_name, void **handle, ErtsSysDdllError* err)
-{
- return ERL_DE_ERROR_NO_DDLL_FUNCTIONALITY;
-}
-
-int erts_sys_ddll_open_noext(char *dlname, void **handle, ErtsSysDdllError* err)
-{
- return ERL_DE_ERROR_NO_DDLL_FUNCTIONALITY;
-}
-
-/*
- * Find a symbol in the shared object
- */
-int erts_sys_ddll_sym2(void *handle, const char *func_name, void **function,
- ErtsSysDdllError* err)
-{
- return ERL_DE_ERROR_NO_DDLL_FUNCTIONALITY;
-}
-
-/* XXX:PaN These two will be changed with new driver interface! */
-
-/*
- * Load the driver init function, might appear under different names depending on object arch...
- */
-
-int erts_sys_ddll_load_driver_init(void *handle, void **function)
-{
- void *fn;
- int res;
- if ((res = erts_sys_ddll_sym2(handle, "driver_init", &fn, NULL)) != ERL_DE_NO_ERROR) {
- res = erts_sys_ddll_sym2(handle, "_driver_init", &fn, NULL);
- }
- if (res == ERL_DE_NO_ERROR) {
- *function = fn;
- }
- return res;
-}
-
-int erts_sys_ddll_load_nif_init(void *handle, void **function, ErtsSysDdllError* err)
-{
- void *fn;
- int res;
- if ((res = erts_sys_ddll_sym2(handle, "nif_init", &fn, err)) != ERL_DE_NO_ERROR) {
- res = erts_sys_ddll_sym2(handle, "_nif_init", &fn, err);
- }
- if (res == ERL_DE_NO_ERROR) {
- *function = fn;
- }
- return res;
-}
-
-/*
- * Call the driver_init function, whatever it's really called, simple on unix...
-*/
-void *erts_sys_ddll_call_init(void *function) {
- void *(*initfn)(void) = function;
- return (*initfn)();
-}
-void *erts_sys_ddll_call_nif_init(void *function) {
- return erts_sys_ddll_call_init(function);
-}
-
-
-
-/*
- * Close a chared object
- */
-int erts_sys_ddll_close2(void *handle, ErtsSysDdllError* err)
-{
- return ERL_DE_ERROR_NO_DDLL_FUNCTIONALITY;
-}
-
-
-/*
- * Return string that describes the (current) error
- */
-char *erts_sys_ddll_error(int code)
-{
- return "Unspecified error";
-}
-
-void erts_sys_ddll_free_error(ErtsSysDdllError* err)
-{
- if (err->str != NULL) {
- erts_free(ERTS_ALC_T_DDLL_TMP_BUF, err->str);
- }
-}
diff --git a/erts/emulator/sys/ose/erl_poll.c b/erts/emulator/sys/ose/erl_poll.c
deleted file mode 100644
index 5cee582a00..0000000000
--- a/erts/emulator/sys/ose/erl_poll.c
+++ /dev/null
@@ -1,818 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 2006-2012. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- */
-
-/*
- * Description: Poll interface suitable for ERTS on OSE with or without
- * SMP support.
- *
- * The interface is currently implemented using:
- * - receive + receive_fsem
- *
- * Author: Lukas Larsson
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "erl_thr_progress.h"
-#include "erl_driver.h"
-#include "erl_alloc.h"
-#include "erl_poll.h"
-
-#define NOFILE 4096
-
-/*
- * Some debug macros
- */
-
-/* #define HARDDEBUG
-#define HARDTRACE*/
-#ifdef HARDDEBUG
-#ifdef HARDTRACE
-#define HARDTRACEF(X, ...) { fprintf(stderr, X, __VA_ARGS__); fprintf(stderr,"\r\n"); }
-#else
-#define HARDTRACEF(...)
-#endif
-
-#else
-#define HARDTRACEF(X,...)
-#define HARDDEBUGF(...)
-#endif
-
-#if 0
-#define ERTS_POLL_DEBUG_PRINT
-#endif
-
-#if defined(DEBUG) && 0
-#define HARD_DEBUG
-#endif
-
-# define SEL_ALLOC erts_alloc
-# define SEL_REALLOC realloc_wrap
-# define SEL_FREE erts_free
-
-#ifdef ERTS_SMP
-
-#define ERTS_POLLSET_LOCK(PS) \
- erts_smp_mtx_lock(&(PS)->mtx)
-#define ERTS_POLLSET_UNLOCK(PS) \
- erts_smp_mtx_unlock(&(PS)->mtx)
-
-#else
-
-#define ERTS_POLLSET_LOCK(PS)
-#define ERTS_POLLSET_UNLOCK(PS)
-
-#endif
-
-/*
- * --- Data types ------------------------------------------------------------
- */
-
-union SIGNAL {
- SIGSELECT sig_no;
-};
-
-typedef struct erts_sigsel_item_ ErtsSigSelItem;
-
-struct erts_sigsel_item_ {
- ErtsSigSelItem *next;
- ErtsSysFdType fd;
- ErtsPollEvents events;
-};
-
-typedef struct erts_sigsel_info_ ErtsSigSelInfo;
-
-struct erts_sigsel_info_ {
- ErtsSigSelInfo *next;
- SIGSELECT signo;
- ErlDrvOseEventId (*decode)(union SIGNAL* sig);
- ErtsSigSelItem *fds;
-};
-
-struct ErtsPollSet_ {
- SIGSELECT *sigs;
- ErtsSigSelInfo *info;
- Uint sig_count;
- Uint item_count;
- PROCESS interrupt;
- erts_atomic32_t wakeup_state;
- erts_atomic64_t timeout_time;
-#ifdef ERTS_SMP
- erts_smp_mtx_t mtx;
-#endif
-};
-
-static int max_fds = -1;
-
-static ERTS_INLINE void
-init_timeout_time(ErtsPollSet ps)
-{
- erts_atomic64_init_nob(&ps->timeout_time,
- (erts_aint64_t) ERTS_MONOTONIC_TIME_MAX);
-}
-
-static ERTS_INLINE void
-set_timeout_time(ErtsPollSet ps, ErtsMonotonicTime time)
-{
- erts_atomic64_set_relb(&ps->timeout_time,
- (erts_aint64_t) time);
-}
-
-static ERTS_INLINE ErtsMonotonicTime
-get_timeout_time(ErtsPollSet ps)
-{
- return (ErtsMonotonicTime) erts_atomic64_read_acqb(&ps->timeout_time);
-}
-
-#define ERTS_POLL_NOT_WOKEN ((erts_aint32_t) (1 << 0))
-#define ERTS_POLL_WOKEN_INTR ((erts_aint32_t) (1 << 1))
-#define ERTS_POLL_WOKEN_TIMEDOUT ((erts_aint32_t) (1 << 2))
-#define ERTS_POLL_WOKEN_IO_READY ((erts_aint32_t) (1 << 3))
-#define ERTS_POLL_SLEEPING ((erts_aint32_t) (1 << 4))
-
-/* signal list prototypes */
-static ErtsSigSelInfo *get_sigsel_info(ErtsPollSet ps, SIGSELECT signo);
-static ErtsSigSelItem *get_sigsel_item(ErtsPollSet ps, ErtsSysFdType fd);
-static ErtsSigSelInfo *add_sigsel_info(ErtsPollSet ps, ErtsSysFdType fd,
- ErlDrvOseEventId (*decode)(union SIGNAL* sig));
-static ErtsSigSelItem *add_sigsel_item(ErtsPollSet ps, ErtsSysFdType fd,
- ErlDrvOseEventId (*decode)(union SIGNAL* sig));
-static int del_sigsel_info(ErtsPollSet ps, ErtsSigSelInfo *info);
-static int del_sigsel_item(ErtsPollSet ps, ErtsSigSelItem *item);
-static int update_sigsel(ErtsPollSet ps);
-
-static ErtsSigSelInfo *
-get_sigsel_info(ErtsPollSet ps, SIGSELECT signo) {
- ErtsSigSelInfo *curr = ps->info;
- while (curr != NULL) {
- if (curr->signo == signo)
- return curr;
- curr = curr->next;
- }
- return NULL;
-}
-
-static ErtsSigSelItem *
-get_sigsel_item(ErtsPollSet ps, ErtsSysFdType fd) {
- ErtsSigSelInfo *info = get_sigsel_info(ps,fd->signo);
- ErtsSigSelItem *curr;
-
- if (info == NULL)
- return NULL;
-
- curr = info->fds;
-
- while (curr != NULL) {
- if (curr->fd->id == fd->id) {
- ASSERT(curr->fd->signo == fd->signo);
- return curr;
- }
- curr = curr->next;
- }
- return NULL;
-}
-
-static ErtsSigSelInfo *
-add_sigsel_info(ErtsPollSet ps, ErtsSysFdType fd,
- ErlDrvOseEventId (*decode)(union SIGNAL* sig)) {
- ErtsSigSelInfo *info = SEL_ALLOC(ERTS_ALC_T_POLLSET,
- sizeof(ErtsSigSelInfo));
- info->next = ps->info;
- info->fds = NULL;
- info->signo = fd->signo;
- info->decode = decode;
- ps->info = info;
- ps->sig_count++;
- return info;
-}
-
-static ErtsSigSelItem *
-add_sigsel_item(ErtsPollSet ps, ErtsSysFdType fd,
- ErlDrvOseEventId (*decode)(union SIGNAL* sig)) {
- ErtsSigSelInfo *info = get_sigsel_info(ps,fd->signo);
- ErtsSigSelItem *item = SEL_ALLOC(ERTS_ALC_T_POLLSET,
- sizeof(ErtsSigSelItem));
- if (info == NULL)
- info = add_sigsel_info(ps, fd, decode);
- if (info->decode != decode) {
- erts_dsprintf_buf_t *dsbufp = erts_create_logger_dsbuf();
- erts_dsprintf(dsbufp, "erts_poll_control() inconsistency: multiple resolve_signal functions for same signal (%d)\n",
- fd->signo);
- erts_send_error_to_logger_nogl(dsbufp);
- }
- ASSERT(info->decode == decode);
- item->next = info->fds;
- item->fd = fd;
- item->events = 0;
- info->fds = item;
- ps->item_count++;
- return item;
-}
-
-static int del_sigsel_info(ErtsPollSet ps, ErtsSigSelInfo *info) {
- ErtsSigSelInfo *curr, *prev;
-
- if (ps->info == info) {
- ps->info = ps->info->next;
- } else {
- curr = ps->info->next;
- prev = ps->info;
-
- while (curr != info) {
- if (curr == NULL)
- return 1;
- prev = curr;
- curr = curr->next;
- }
- prev->next = curr->next;
- }
-
- ps->sig_count--;
- SEL_FREE(ERTS_ALC_T_POLLSET, info);
- return 0;
-}
-
-static int del_sigsel_item(ErtsPollSet ps, ErtsSigSelItem *item) {
- ErtsSigSelInfo *info = get_sigsel_info(ps,item->fd->signo);
- ErtsSigSelItem *curr, *prev;
-
- ps->item_count--;
- ASSERT(ps->item_count >= 0);
-
- if (info->fds == item) {
- info->fds = info->fds->next;
- SEL_FREE(ERTS_ALC_T_POLLSET,item);
- if (info->fds == NULL)
- return del_sigsel_info(ps,info);
- return 0;
- }
-
- curr = info->fds->next;
- prev = info->fds;
-
- while (curr != item) {
- if (curr == NULL) {
- /* We did not find an item to delete so we have to
- * increment item count again.
- */
- ps->item_count++;
- return 1;
- }
- prev = curr;
- curr = curr->next;
- }
- prev->next = curr->next;
- SEL_FREE(ERTS_ALC_T_POLLSET,item);
- return 0;
-}
-
-#ifdef ERTS_SMP
-
-static void update_redir_tables(ErtsPollSet ps) {
- struct OS_redir_entry *redir_table;
- PROCESS sched_1 = ERTS_SCHEDULER_IX(0)->tid.id;
- int i;
- redir_table = SEL_ALLOC(ERTS_ALC_T_POLLSET,
- sizeof(struct OS_redir_entry)*(ps->sig_count+1));
-
- redir_table[0].sig = ps->sig_count+1;
- redir_table[0].pid = 0;
-
- for (i = 1; i < ps->sig_count+1; i++) {
- redir_table[i].sig = ps->sigs[i];
- redir_table[i].pid = sched_1;
- }
-
- for (i = 1; i < erts_no_schedulers; i++) {
- ErtsSchedulerData *esdp = ERTS_SCHEDULER_IX(i);
- set_redirection(esdp->tid.id,redir_table);
- }
-
- SEL_FREE(ERTS_ALC_T_POLLSET,redir_table);
-}
-
-#endif
-
-static int update_sigsel(ErtsPollSet ps) {
- ErtsSigSelInfo *info = ps->info;
-
- int i;
-
- if (ps->sigs != NULL)
- SEL_FREE(ERTS_ALC_T_POLLSET,ps->sigs);
-
- if (ps->sig_count == 0) {
- /* If there are no signals we place a non-valid signal to make sure that
- * we do not trigger on a any unrelated signals which are sent to the
- * process.
- */
- ps->sigs = SEL_ALLOC(ERTS_ALC_T_POLLSET,sizeof(SIGSELECT)*(2));
- ps->sigs[0] = 1;
- ps->sigs[1] = ERTS_SIGNAL_INVALID;
- return 0;
- }
-
- ps->sigs = SEL_ALLOC(ERTS_ALC_T_POLLSET,sizeof(SIGSELECT)*(ps->sig_count+1));
- ps->sigs[0] = ps->sig_count;
-
- for (i = 1; info != NULL; i++, info = info->next)
- ps->sigs[i] = info->signo;
-
-#ifdef ERTS_SMP
- update_redir_tables(ps);
-#endif
-
- return 0;
-}
-
-static ERTS_INLINE void
-wake_poller(ErtsPollSet ps)
-{
- erts_aint32_t wakeup_state;
-
- ERTS_THR_MEMORY_BARRIER;
- wakeup_state = erts_atomic32_read_nob(&ps->wakeup_state);
- while (wakeup_state != ERTS_POLL_WOKEN_IO_READY
- && wakeup_state != ERTS_POLL_WOKEN_INTR) {
- erts_aint32_t act = erts_atomic32_cmpxchg_nob(&ps->wakeup_state,
- ERTS_POLL_WOKEN_INTR,
- wakeup_state);
- if (act == wakeup_state) {
- wakeup_state = act;
- break;
- }
- wakeup_state = act;
- }
- if (wakeup_state == ERTS_POLL_SLEEPING) {
- /*
- * Since we don't know the internals of signal_fsem() we issue
- * a memory barrier as a safety precaution ensuring that
- * the store we just made to wakeup_state wont be reordered
- * with loads in signal_fsem().
- */
- ERTS_THR_MEMORY_BARRIER;
- signal_fsem(ps->interrupt);
- }
-}
-
-static ERTS_INLINE void
-reset_interrupt(ErtsPollSet ps)
-{
- /* We need to keep io-ready if set */
- erts_aint32_t wakeup_state = erts_atomic32_read_nob(&ps->wakeup_state);
- while (wakeup_state != ERTS_POLL_NOT_WOKEN &&
- wakeup_state != ERTS_POLL_SLEEPING) {
- erts_aint32_t act = erts_atomic32_cmpxchg_nob(&ps->wakeup_state,
- ERTS_POLL_NOT_WOKEN,
- wakeup_state);
- if (wakeup_state == act)
- break;
- wakeup_state = act;
- }
- ERTS_THR_MEMORY_BARRIER;
-}
-
-static ERTS_INLINE void
-set_interrupt(ErtsPollSet ps)
-{
- wake_poller(ps);
-}
-
-void erts_poll_interrupt(ErtsPollSet ps,int set) {
- HARDTRACEF("erts_poll_interrupt called!\n");
-
- if (!set)
- reset_interrupt(ps);
- else
- set_interrupt(ps);
-
-}
-
-void erts_poll_interrupt_timed(ErtsPollSet ps,
- int set,
- ErtsTimeoutTime timeout_time) {
- HARDTRACEF("erts_poll_interrupt_timed called!\n");
-
- if (!set)
- reset_interrupt(ps);
- else if (get_timeout_time(ps) > timeout_time)
- set_interrupt(ps);
-}
-
-ErtsPollEvents erts_poll_control(ErtsPollSet ps, ErtsSysFdType fd,
- ErtsPollEvents pe, int on, int* do_wake) {
- ErtsSigSelItem *curr;
- ErtsPollEvents new_events;
- int old_sig_count;
-
- HARDTRACEF(
- "%ux: In erts_poll_control, fd = %d, pe = %d, on = %d, *do_wake = %d, curr = 0x%xu",
- ps, fd, pe, on, do_wake, curr);
-
- ERTS_POLLSET_LOCK(ps);
-
- if (on && (pe & ERTS_POLL_EV_IN) && (pe & ERTS_POLL_EV_OUT)) {
- /* Check to make sure both in and out are not used at the same time */
- new_events = ERTS_POLL_EV_NVAL;
- goto done;
- }
-
- curr = get_sigsel_item(ps, fd);
- old_sig_count = ps->sig_count;
-
- if (curr == NULL && on) {
- curr = add_sigsel_item(ps, fd, fd->resolve_signal);
- } else if (curr == NULL && !on) {
- new_events = ERTS_POLL_EV_NVAL;
- goto done;
- }
-
- new_events = curr->events;
-
- if (pe == 0) {
- *do_wake = 0;
- goto done;
- }
-
- if (on) {
- new_events |= pe;
- curr->events = new_events;
- } else {
- new_events &= ~pe;
- curr->events = new_events;
- if (new_events == 0 && del_sigsel_item(ps, curr)) {
- new_events = ERTS_POLL_EV_NVAL;
- goto done;
- }
- }
-
- if (ps->sig_count != old_sig_count) {
- if (update_sigsel(ps))
- new_events = ERTS_POLL_EV_NVAL;
- }
-done:
- ERTS_POLLSET_UNLOCK(ps);
- HARDTRACEF("%ux: Out erts_poll_control", ps);
- return new_events;
-}
-
-int erts_poll_wait(ErtsPollSet ps,
- ErtsPollResFd pr[],
- int *len,
- ErtsMonotonicTime timeout_time)
-{
- int res = ETIMEDOUT, no_fds, currid = 0;
- OSTIME timeout;
- union SIGNAL *sig;
- ErtsMonotonicTime current_time, diff_time, timeout;
- // HARDTRACEF("%ux: In erts_poll_wait",ps);
- if (ps->interrupt == (PROCESS)0)
- ps->interrupt = current_process();
-
- ASSERT(current_process() == ps->interrupt);
- ASSERT(get_fsem(current_process()) == 0);
- ASSERT(erts_atomic32_read_nob(&ps->wakeup_state) &
- (ERTS_POLL_NOT_WOKEN | ERTS_POLL_WOKEN_INTR));
- /* Max no of spots avable in pr */
- no_fds = *len;
-
- *len = 0;
-
- /* erts_printf("Entering erts_poll_wait(), timeout_time=%bps\n",
- timeout_time); */
-
- if (timeout_time == ERTS_POLL_NO_TIMEOUT) {
- no_timeout:
- timeout = (OSTIME) 0;
- save_timeout_time = ERTS_MONOTONIC_TIME_MIN;
- }
- else {
- ErtsMonotonicTime current_time, diff_time;
- current_time = erts_get_monotonic_time(NULL);
- diff_time = timeout_time - current_time;
- if (diff_time <= 0)
- goto no_timeout;
- diff_time = (ERTS_MONOTONIC_TO_MSEC(diff_time - 1) + 1);
- if (diff_time > INT_MAX)
- diff_time = INT_MAX;
- timeout = (OSTIME) diff_time;
- save_timeout_time = current_time;
- save_timeout_time += ERTS_MSEC_TO_MONOTONIC(diff_time);
- }
-
- set_timeout_time(ps, save_timeout_time);
-
- while (currid < no_fds) {
- if (timeout > 0) {
- erts_aint32_t act = erts_atomic32_cmpxchg_nob(&ps->wakeup_state,
- ERTS_POLL_SLEEPING,
- ERTS_POLL_NOT_WOKEN);
- if (act == ERTS_POLL_NOT_WOKEN) {
-#ifdef ERTS_SMP
- erts_thr_progress_prepare_wait(NULL);
-#endif
- sig = receive_fsem(timeout, ps->sigs, 1);
-#ifdef ERTS_SMP
- erts_thr_progress_finalize_wait(NULL);
-#endif
- } else {
- ASSERT(act == ERTS_POLL_WOKEN_INTR);
- sig = OS_RCV_FSEM;
- }
- } else
- sig = receive_w_tmo(0, ps->sigs);
-
- if (sig == NULL) {
- if (timeout > 0) {
- erts_aint32_t act = erts_atomic32_cmpxchg_nob(&ps->wakeup_state,
- ERTS_POLL_WOKEN_TIMEDOUT,
- ERTS_POLL_SLEEPING);
- if (act == ERTS_POLL_WOKEN_INTR)
- /* Restore fsem as it was signaled but we got a timeout */
- wait_fsem(1);
- } else
- erts_atomic32_cmpxchg_nob(&ps->wakeup_state,
- ERTS_POLL_WOKEN_TIMEDOUT,
- ERTS_POLL_NOT_WOKEN);
- break;
- } else if (sig == OS_RCV_FSEM) {
- ASSERT(erts_atomic32_read_nob(&ps->wakeup_state) == ERTS_POLL_WOKEN_INTR);
- break;
- }
- {
- ErtsSigSelInfo *info = get_sigsel_info(ps, sig->sig_no);
- struct erts_sys_fd_type fd = { sig->sig_no, info->decode(sig) };
- ErtsSigSelItem *item = get_sigsel_item(ps, &fd);
-
- ASSERT(sig);
- if (currid == 0 && timeout > 0) {
- erts_aint32_t act = erts_atomic32_cmpxchg_nob(&ps->wakeup_state,
- ERTS_POLL_WOKEN_IO_READY,
- ERTS_POLL_SLEEPING);
- if (act == ERTS_POLL_WOKEN_INTR) {
- /* Restore fsem as it was signaled but we got a msg */
- wait_fsem(1);
- act = erts_atomic32_cmpxchg_nob(&ps->wakeup_state,
- ERTS_POLL_WOKEN_IO_READY,
- ERTS_POLL_WOKEN_INTR);
- }
- } else if (currid == 0) {
- erts_atomic32_set_nob(&ps->wakeup_state,
- ERTS_POLL_WOKEN_IO_READY);
- }
-
- if (item == NULL) {
- erts_dsprintf_buf_t *dsbufp = erts_create_logger_dsbuf();
- erts_dsprintf(
- dsbufp,
- "erts_poll_wait() failed: found unkown signal id %d (signo %u) "
- "(curr_proc 0x%x)\n",
- fd.id, fd.signo, current_process());
- erts_send_error_to_logger_nogl(dsbufp);
- timeout = 0;
- /* Under normal circumstances the signal is deallocated by the
- * driver that issued the select operation. But in this case
- * there's no driver waiting for such signal so we have to
- * deallocate it here */
- if (sig)
- free_buf(&sig);
- } else {
- int i;
- struct erts_sys_fd_type *fd = NULL;
- ErtsPollOseMsgList *tl,*new;
-
- /* Check if this fd has already been triggered by a previous signal */
- for (i = 0; i < currid;i++) {
- if (pr[i].fd == item->fd) {
- fd = pr[i].fd;
- pr[i].events |= item->events;
- break;
- }
- }
-
- /* First time this fd is triggered */
- if (fd == NULL) {
- pr[currid].fd = item->fd;
- pr[currid].events = item->events;
- fd = item->fd;
- timeout = 0;
- currid++;
- }
-
- /* Insert new signal in approriate list */
- new = erts_alloc(ERTS_ALC_T_FD_SIG_LIST,sizeof(ErtsPollOseMsgList));
- new->next = NULL;
- new->data = sig;
-
- ethr_mutex_lock(&fd->mtx);
- tl = fd->msgs;
-
- if (tl == NULL) {
- fd->msgs = new;
- } else {
- while (tl->next != NULL)
- tl = tl->next;
- tl->next = new;
- }
- ethr_mutex_unlock(&fd->mtx);
- }
-
- }
- }
-
- {
- erts_aint32_t wakeup_state = erts_atomic32_read_nob(&ps->wakeup_state);
-
- switch (wakeup_state) {
- case ERTS_POLL_WOKEN_IO_READY:
- res = 0;
- break;
- case ERTS_POLL_WOKEN_INTR:
- res = EINTR;
- break;
- case ERTS_POLL_WOKEN_TIMEDOUT:
- res = ETIMEDOUT;
- break;
- case ERTS_POLL_NOT_WOKEN:
- /* This happens when we get an invalid signal only */
- res = EINVAL;
- break;
- default:
- res = 0;
- erl_exit(ERTS_ABORT_EXIT,
- "%s:%d: Internal error: Invalid wakeup_state=%d\n",
- __FILE__, __LINE__, (int) wakeup_state);
- }
- }
-
- erts_atomic32_set_nob(&ps->wakeup_state, ERTS_POLL_NOT_WOKEN);
- set_timeout_time(ps, ERTS_MONOTONIC_TIME_MAX);
-
- *len = currid;
-
- // HARDTRACEF("%ux: Out erts_poll_wait",ps);
- return res;
-}
-
-int erts_poll_max_fds(void)
-{
-
- HARDTRACEF("In/Out erts_poll_max_fds -> %d",max_fds);
- return max_fds;
-}
-
-void erts_poll_info(ErtsPollSet ps,
- ErtsPollInfo *pip)
-{
- Uint size = 0;
- Uint num_events = 0;
-
- size += sizeof(struct ErtsPollSet_);
- size += sizeof(ErtsSigSelInfo)*ps->sig_count;
- size += sizeof(ErtsSigSelItem)*ps->item_count;
- size += sizeof(SIGSELECT)*(ps->sig_count+1);
-
- pip->primary = "receive_fsem";
-
- pip->fallback = NULL;
-
- pip->kernel_poll = NULL;
-
- pip->memory_size = size;
-
- pip->poll_set_size = num_events;
-
- pip->fallback_poll_set_size = 0;
-
- pip->lazy_updates = 0;
-
- pip->pending_updates = 0;
-
- pip->batch_updates = 0;
-
- pip->concurrent_updates = 0;
-
-
- pip->max_fds = erts_poll_max_fds();
- HARDTRACEF("%ux: Out erts_poll_info",ps);
-
-}
-
-ErtsPollSet erts_poll_create_pollset(void)
-{
- ErtsPollSet ps = SEL_ALLOC(ERTS_ALC_T_POLLSET,
- sizeof(struct ErtsPollSet_));
-
- ps->sigs = NULL;
- ps->sig_count = 0;
- ps->item_count = 0;
- ps->info = NULL;
- ps->interrupt = (PROCESS)0;
- erts_atomic32_init_nob(&ps->wakeup_state, ERTS_POLL_NOT_WOKEN);
- init_timeout_time(ps);
-#ifdef ERTS_SMP
- erts_smp_mtx_init(&ps->mtx, "pollset");
-#endif
- update_sigsel(ps);
- HARDTRACEF("%ux: Out erts_poll_create_pollset",ps);
- return ps;
-}
-
-void erts_poll_destroy_pollset(ErtsPollSet ps)
-{
- ErtsSigSelInfo *info;
- for (info = ps->info; ps->info != NULL; info = ps->info, ps->info = ps->info->next) {
- ErtsSigSelItem *item;
- for (item = info->fds; info->fds != NULL; item = info->fds, info->fds = info->fds->next)
- SEL_FREE(ERTS_ALC_T_POLLSET, item);
- SEL_FREE(ERTS_ALC_T_POLLSET, info);
- }
-
- SEL_FREE(ERTS_ALC_T_POLLSET,ps->sigs);
-
-#ifdef ERTS_SMP
- erts_smp_mtx_destroy(&ps->mtx);
-#endif
-
- SEL_FREE(ERTS_ALC_T_POLLSET,ps);
-}
-
-void erts_poll_init(void)
-{
- HARDTRACEF("In %s", __FUNCTION__);
- max_fds = 256;
-
- HARDTRACEF("Out %s", __FUNCTION__);
-}
-
-
-/* OSE driver functions */
-
-union SIGNAL *erl_drv_ose_get_signal(ErlDrvEvent drv_ev) {
- struct erts_sys_fd_type *ev = (struct erts_sys_fd_type *)drv_ev;
- ethr_mutex_lock(&ev->mtx);
- if (ev->msgs == NULL) {
- ethr_mutex_unlock(&ev->mtx);
- return NULL;
- } else {
- ErtsPollOseMsgList *msg = ev->msgs;
- union SIGNAL *sig = (union SIGNAL*)msg->data;
- ASSERT(msg->data);
- ev->msgs = msg->next;
- ethr_mutex_unlock(&ev->mtx);
- erts_free(ERTS_ALC_T_FD_SIG_LIST,msg);
- restore(sig);
- return sig;
- }
-}
-
-ErlDrvEvent
-erl_drv_ose_event_alloc(SIGSELECT signo, ErlDrvOseEventId id,
- ErlDrvOseEventId (*resolve_signal)(union SIGNAL *sig), void *extra) {
- struct erts_sys_fd_type *ev = erts_alloc(ERTS_ALC_T_DRV_EV,
- sizeof(struct erts_sys_fd_type));
- ev->signo = signo;
- ev->extra = extra;
- ev->id = id;
- ev->msgs = NULL;
- ev->resolve_signal = resolve_signal;
- ethr_mutex_init(&ev->mtx);
- return (ErlDrvEvent)ev;
-}
-
-void erl_drv_ose_event_free(ErlDrvEvent drv_ev) {
- struct erts_sys_fd_type *ev = (struct erts_sys_fd_type *)drv_ev;
- ASSERT(ev->msgs == NULL);
- ethr_mutex_destroy(&ev->mtx);
- erts_free(ERTS_ALC_T_DRV_EV,ev);
-}
-
-void erl_drv_ose_event_fetch(ErlDrvEvent drv_ev, SIGSELECT *signo,
- ErlDrvOseEventId *id, void **extra) {
- struct erts_sys_fd_type *ev = (struct erts_sys_fd_type *)drv_ev;
- if (signo)
- *signo = ev->signo;
- if (extra)
- *extra = ev->extra;
- if (id)
- *id = ev->id;
-}
diff --git a/erts/emulator/sys/ose/erts.sig b/erts/emulator/sys/ose/erts.sig
deleted file mode 100644
index 78b883ee6c..0000000000
--- a/erts/emulator/sys/ose/erts.sig
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef ERTS_OSE_SIGNALS
-#define ERTS_OSE_SIGNALS
-
-#ifndef ERTS_OSE_SIGNAL_BASE
-#define ERTS_OSE_SIGNAL_BASE 0x01900280
-#endif
-
-#define ERTS_SIGNAL_INVALID ERTS_OSE_SIGNAL_BASE
-#define ERTS_SIGNAL_FD_DRV_CONFIG ERTS_OSE_SIGNAL_BASE+1
-#define ERTS_SIGNAL_FD_DRV_ASYNC ERTS_OSE_SIGNAL_BASE+2
-#define ERTS_SIGNAL_OSE_DRV_ATTACH ERTS_OSE_SIGNAL_BASE+3
-#define ERTS_SIGNAL_OSE_DRV_HUNT ERTS_OSE_SIGNAL_BASE+4
-
-#define ERTS_SIGNAL_RUN_ERL_SETUP ERTS_OSE_SIGNAL_BASE+100
-#define ERTS_SIGNAL_RUN_ERL_DAEMON ERTS_OSE_SIGNAL_BASE+101
-
-#endif
diff --git a/erts/emulator/sys/ose/gcc_4.4.3_lm_ppc.lcf b/erts/emulator/sys/ose/gcc_4.4.3_lm_ppc.lcf
deleted file mode 100644
index a19d23facf..0000000000
--- a/erts/emulator/sys/ose/gcc_4.4.3_lm_ppc.lcf
+++ /dev/null
@@ -1,182 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013-2014 by Enea Software AB,
- * 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 copyright holder 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 COPYRIGHT HOLDER 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.
- ******************************************************************************/
-
-OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc")
-OUTPUT_ARCH("powerpc")
-ENTRY("crt0_lm")
-MEMORY
-{
- rom : ORIGIN = 0x01000000, LENGTH = 0x01000000
- ram : ORIGIN = 0x02000000, LENGTH = 0x01000000
-}
-PHDRS
-{
- ph_conf PT_LOAD ;
- ph_rom PT_LOAD ;
- ph_ram PT_LOAD ;
-}
-SECTIONS
-{
- .text :
- {
- *(.text_first)
- *(.text)
- *(.text.*)
- *(.stub)
- *(oscode)
- *(.init*)
- *(.fini*)
- *(.gnu.warning)
- *(.gnu.linkonce.t.*)
- *(.glue_7t)
- *(.glue_7)
- } > rom :ph_rom = 0
- .ose_sfk_biosentry :
- {
- *(.ose_sfk_biosentry)
- } > rom :ph_rom
- .ctors :
- {
- __CTOR_LIST__ = .;
- *(.ctors)
- *(SORT(.ctors.*))
- __CTOR_END__ = .;
- } > rom :ph_rom
- .dtors :
- {
- __DTOR_LIST__ = .;
- *(.dtors)
- *(SORT(.dtors.*))
- __DTOR_END__ = .;
- } > rom :ph_rom
- OSESYMS :
- {
- *(.osesyms)
- } > rom :ph_rom
- .rodata :
- {
- *(.rodata)
- *(.rodata.*)
- *(.gnu.linkonce.r.*)
- } > rom :ph_rom
- .eh_frame_hdr :
- {
- *(.eh_frame_hdr)
- } > rom :ph_rom
- .eh_frame :
- {
- __EH_FRAME_BEGIN__ = .;
- *(.eh_frame)
- LONG(0)
- __EH_FRAME_END__ = .;
- } > rom :ph_rom
- .gcc_except_table :
- {
- *(.gcc_except_table .gcc_except_table.*)
- } > rom :ph_rom
- .sdata2 :
- {
- PROVIDE (_SDA2_BASE_ = .);
- *(.sdata2)
- *(.sdata2.*)
- *(.gnu.linkonce.s2.*)
- } > rom :ph_rom
- .sbss2 :
- {
- *(.sbss2)
- *(.sbss2.*)
- *(.gnu.linkonce.sb2.*)
- } > rom :ph_rom
- LMCONF :
- {
- obj/?*?/ose_confd.o(.rodata)
- *(LMCONF)
- } > rom :ph_conf
- .data :
- {
- LONG(0xDEADBABE)
- *(.data)
- *(.data.*)
- *(.gnu.linkonce.d.*)
- SORT(CONSTRUCTORS)
- . = ALIGN(0x10);
- } > ram :ph_ram = 0
- .sdata2 :
- {
- _SDA2_BASE_ = .;
- *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
- }> ram :ph_ram
- .sdata :
- {
- PROVIDE (_SDA_BASE_ = .);
- *(.sdata)
- *(.sdata.*)
- *(.gnu.linkonce.s.*)
- } > ram :ph_ram
- .sbss :
- {
- *(.sbss)
- *(.sbss.*)
- *(.scommon)
- *(.gnu.linkonce.sb.*)
- } > ram :ph_ram
- .bss (NOLOAD) :
- {
- *(.bss)
- *(.bss.*)
- *(COMMON)
- *(.gnu.linkonce.b.*)
- *(.osvars)
- } > ram :ph_ram
- .ignore (NOLOAD) :
- {
- *(.rel.dyn)
- } > ram :ph_ram
- .debug 0 : { *(.debug) }
- .line 0 : { *(.line) }
- .debug_srcinfo 0 : { *(.debug_srcinfo) }
- .debug_sfnames 0 : { *(.debug_sfnames) }
- .debug_aranges 0 : { *(.debug_aranges) }
- .debug_pubnames 0 : { *(.debug_pubnames) }
- .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
- .debug_abbrev 0 : { *(.debug_abbrev) }
- .debug_line 0 : { *(.debug_line) }
- .debug_frame 0 : { *(.debug_frame) }
- .debug_str 0 : { *(.debug_str) }
- .debug_loc 0 : { *(.debug_loc) }
- .debug_macinfo 0 : { *(.debug_macinfo) }
- .debug_weaknames 0 : { *(.debug_weaknames) }
- .debug_funcnames 0 : { *(.debug_funcnames) }
- .debug_typenames 0 : { *(.debug_typenames) }
- .debug_varnames 0 : { *(.debug_varnames) }
-}
-__OSESYMS_START = ADDR(OSESYMS);
-__OSESYMS_END = ADDR(OSESYMS) + SIZEOF(OSESYMS);
diff --git a/erts/emulator/sys/ose/gcc_4.6.3_lm_ppc.lcf b/erts/emulator/sys/ose/gcc_4.6.3_lm_ppc.lcf
deleted file mode 100644
index 3440c2961b..0000000000
--- a/erts/emulator/sys/ose/gcc_4.6.3_lm_ppc.lcf
+++ /dev/null
@@ -1,242 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013-2014 by Enea Software AB,
- * 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 copyright holder 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 COPYRIGHT HOLDER 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.
- ******************************************************************************/
-
-OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc")
-OUTPUT_ARCH("powerpc")
-
-ENTRY("crt0_lm")
-
-/* Note:
- * You may have to increase the length of the "rom" memory region and the
- * origin and length of the "ram" memory region below depending on the size
- * of the code and data in your load module.
- */
-
-MEMORY
-{
- conf : ORIGIN = 0x00100000, LENGTH = 0x00030000
- rom : ORIGIN = 0x01000000, LENGTH = 0x01000000
- ram : ORIGIN = 0x03000000, LENGTH = 0x01000000
-}
-
-PHDRS
-{
- ph_conf PT_LOAD ;
- ph_rom PT_LOAD ;
- ph_ram PT_LOAD ;
-}
-
-SECTIONS
-{
-/*---------------------------------------------------------------------------
- * Load module configuration area
- *-------------------------------------------------------------------------*/
-
- /* Load module configuration section. */
- LMCONF :
- {
- obj/?*?/ose_confd.o(.rodata)
- *(LMCONF)
- } > conf :ph_conf
-
-/*---------------------------------------------------------------------------
- * Read-only area
- *-------------------------------------------------------------------------*/
-
- /* Code section. */
- .text :
- {
- *(.text)
- *(.text.*)
- *(.stub)
- *(oscode)
- *(.init*)
- *(.fini*)
- *(.gnu.warning)
- *(.gnu.linkonce.t.*)
- } > rom :ph_rom = 0
-
- /* OSE symbols section. */
- OSESYMS :
- {
- *(.osesyms)
- } > rom :ph_rom
-
- /* Read-only data section. */
- .rodata :
- {
- *(.rodata)
- *(.rodata.*)
- *(.gnu.linkonce.r.*)
- } > rom :ph_rom
-
- /* C++ exception handling section. */
- .eh_frame :
- {
- __EH_FRAME_BEGIN__ = .;
- *(.eh_frame)
- LONG(0)
- __EH_FRAME_END__ = .;
- } > rom :ph_rom
-
- /* C++ exception handling section. */
- .gcc_except_table :
- {
- *(.gcc_except_table .gcc_except_table.*)
- } > rom :ph_rom
-
- /* PowerPC EABI initialized read-only data section. */
- .sdata2 :
- {
- PROVIDE (_SDA2_BASE_ = .);
- *(.sdata2)
- *(.sdata2.*)
- *(.gnu.linkonce.s2.*)
- } > rom :ph_rom
-
- /* PowerPC EABI uninitialized read-only data section. */
- .sbss2 :
- {
- *(.sbss2)
- *(.sbss2.*)
- *(.gnu.linkonce.sb2.*)
- } > rom :ph_rom
-
-/*---------------------------------------------------------------------------
- * Read-write area
- *-------------------------------------------------------------------------*/
-
- /*-------------------------------------------------------------------
- * Initialized data (copied by PM)
- *-----------------------------------------------------------------*/
-
- /* Data section. */
- .data :
- {
- *(.data)
- *(.data.*)
- *(.gnu.linkonce.d.*)
- SORT(CONSTRUCTORS)
- } > ram :ph_ram
-
- /* C++ constructor section. */
- .ctors :
- {
- __CTOR_LIST__ = .;
- *(.ctors)
- *(SORT(.ctors.*))
- __CTOR_END__ = .;
- } > ram :ph_ram
-
- /* C++ destructor section. */
- .dtors :
- {
- __DTOR_LIST__ = .;
- *(.dtors)
- *(SORT(.dtors.*))
- __DTOR_END__ = .;
- } > ram :ph_ram
-
-
- /* Small data section. */
- .sdata ALIGN(0x10) :
- {
- PROVIDE (_SDA_BASE_ = .);
- *(.sdata)
- *(.sdata.*)
- *(.gnu.linkonce.s.*)
- } > ram :ph_ram
-
- /*-------------------------------------------------------------------
- * Uninitialized data (cleared by PM)
- *-----------------------------------------------------------------*/
-
- /* Small bss section. */
- .sbss :
- {
- *(.sbss)
- *(.sbss.*)
- *(.scommon)
- *(.gnu.linkonce.sb.*)
- } > ram :ph_ram
-
- /* Bss section. */
- .bss :
- {
- *(.bss)
- *(.bss.*)
- *(COMMON)
- *(.gnu.linkonce.b.*)
- } > ram :ph_ram
-
-/*---------------------------------------------------------------------------
- * Debug information
- *-------------------------------------------------------------------------*/
-
- /*
- * Stabs debug sections.
- */
-
- .stab 0 : { *(.stab) }
- .stabstr 0 : { *(.stabstr) }
- .stab.excl 0 : { *(.stab.excl) }
- .stab.exclstr 0 : { *(.stab.exclstr) }
- .stab.index 0 : { *(.stab.index) }
- .stab.indexstr 0 : { *(.stab.indexstr) }
- .comment 0 : { *(.comment) }
-
- /*
- * DWARF debug sections.
- */
-
- /* DWARF 1 */
- .debug 0 : { *(.debug) }
- .line 0 : { *(.line) }
- /* GNU DWARF 1 extensions */
- .debug_srcinfo 0 : { *(.debug_srcinfo) }
- .debug_sfnames 0 : { *(.debug_sfnames) }
- /* DWARF 1.1 and DWARF 2 */
- .debug_aranges 0 : { *(.debug_aranges) }
- .debug_pubnames 0 : { *(.debug_pubnames) }
- /* DWARF 2 */
- .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
- .debug_abbrev 0 : { *(.debug_abbrev) }
- .debug_line 0 : { *(.debug_line) }
- .debug_frame 0 : { *(.debug_frame) }
- .debug_str 0 : { *(.debug_str) }
- .debug_loc 0 : { *(.debug_loc) }
- .debug_macinfo 0 : { *(.debug_macinfo) }
- /* SGI/MIPS DWARF 2 extensions */
- .debug_weaknames 0 : { *(.debug_weaknames) }
- .debug_funcnames 0 : { *(.debug_funcnames) }
- .debug_typenames 0 : { *(.debug_typenames) }
- .debug_varnames 0 : { *(.debug_varnames) }
-}
diff --git a/erts/emulator/sys/ose/sys.c b/erts/emulator/sys/ose/sys.c
deleted file mode 100644
index bcd0ffa0b6..0000000000
--- a/erts/emulator/sys/ose/sys.c
+++ /dev/null
@@ -1,1847 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1996-2013. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-#include "sys/time.h"
-#include "time.h"
-#include "sys/uio.h"
-#include "termios.h"
-#include "ctype.h"
-#include "termios.h"
-
-#ifdef HAVE_FCNTL_H
-#include "fcntl.h"
-#endif
-
-#ifdef HAVE_SYS_IOCTL_H
-#include "sys/ioctl.h"
-#endif
-
-#define ERTS_WANT_BREAK_HANDLING
-#define WANT_NONBLOCKING
-#include "sys.h"
-#include "erl_thr_progress.h"
-
-#ifdef USE_THREADS
-#include "erl_threads.h"
-#endif
-
-#include "erl_mseg.h"
-
-#include "unistd.h"
-#include "efs.h"
-#include "erl_printf.h"
-#include "aio.h"
-#include "pm.h"
-#include "fcntl.h"
-
-/* Set the define to 1 to get some logging */
-#if 0
-#include "ramlog.h"
-#define LOG(output) ramlog_printf output
-#else
-#define LOG(output)
-#endif
-
-extern char **environ;
-static erts_smp_rwmtx_t environ_rwmtx;
-static PROCESS sig_proxy_pid = 0;
-
-#define MAX_VSIZE 16 /* Max number of entries allowed in an I/O
- * vector sock_sendv().
- */
-/*
- * Don't need global.h, but bif_table.h (included by bif.h),
- * won't compile otherwise
- */
-#include "global.h"
-#include "bif.h"
-
-#include "erl_sys_driver.h"
-#include "erl_check_io.h"
-#include "erl_cpu_topology.h"
-
-/* The priority for reader/writer processes */
-#define FD_PROC_PRI get_pri(current_process())
-
-typedef struct ErtsSysReportExit_ ErtsSysReportExit;
-struct ErtsSysReportExit_ {
- ErtsSysReportExit *next;
- Eterm port;
- int pid;
- int ifd;
- int ofd;
- ErlDrvEvent attach_event;
- ErlDrvEvent input_event;
- ErlDrvEvent output_event;
-};
-
-/* This data is shared by these drivers - initialized by spawn_init() */
-static struct driver_data {
- ErlDrvPort port_num;
- int ofd;
- int ifd;
- int packet_bytes;
- ErtsSysReportExit *report_exit;
- int pid;
- int alive;
- int status;
- ErlDrvEvent input_event;
- ErlDrvEvent output_event;
- struct aiocb aiocb;
- FmHandle handle;
- char *install_handle;
-} *driver_data; /* indexed by fd */
-
-struct async {
- SIGSELECT signo;
- ErlDrvTermData port;
- ErlDrvTermData proc;
- PROCESS spid;
- PROCESS target;
- Uint32 ref;
-};
-
-static ErtsSysReportExit *report_exit_list;
-static ERTS_INLINE void report_exit_status(ErtsSysReportExit *rep, int status);
-
-extern int driver_interrupt(int, int);
-extern void do_break(void);
-
-extern void erl_sys_args(int*, char**);
-
-/* The following two defs should probably be moved somewhere else */
-
-extern void erts_sys_init_float(void);
-
-extern void erl_crash_dump(char* file, int line, char* fmt, ...);
-
-#define DIR_SEPARATOR_CHAR '/'
-
-#if defined(DEBUG)
-#define ERL_BUILD_TYPE_MARKER ".debug"
-#else /* opt */
-#define ERL_BUILD_TYPE_MARKER
-#endif
-
-#define CHILD_SETUP_PROG_NAME "child_setup" ERL_BUILD_TYPE_MARKER
-
-#ifdef DEBUG
-static int debug_log = 0;
-#endif
-
-#ifdef ERTS_SMP
-static erts_smp_atomic32_t have_prepared_crash_dump;
-#define ERTS_PREPARED_CRASH_DUMP \
- ((int) erts_smp_atomic32_xchg_nob(&have_prepared_crash_dump, 1))
-#else
-static volatile int have_prepared_crash_dump;
-#define ERTS_PREPARED_CRASH_DUMP \
- (have_prepared_crash_dump++)
-#endif
-
-static erts_smp_atomic_t sys_misc_mem_sz;
-
-#if defined(ERTS_SMP)
-erts_mtx_t chld_stat_mtx;
-#endif
-
-#if defined(ERTS_SMP) /* ------------------------------------------------- */
-#define CHLD_STAT_LOCK erts_mtx_lock(&chld_stat_mtx)
-#define CHLD_STAT_UNLOCK erts_mtx_unlock(&chld_stat_mtx)
-
-#else /* ------------------------------------------------------------------- */
-#define CHLD_STAT_LOCK
-#define CHLD_STAT_UNLOCK
-static volatile int children_died;
-#endif
-
-#define SET_AIO(REQ,FD,SIZE,BUFF) \
- memset(&(REQ),0,sizeof(REQ)); \
- (REQ).aio_fildes = FD; \
- (REQ).aio_offset = FM_POSITION_CURRENT; \
- (REQ).aio_nbytes = SIZE; \
- (REQ).aio_buf = BUFF; \
- (REQ).aio_sigevent.sigev_notify = SIGEV_NONE
-
-/* the first sizeof(struct aiocb *) bytes of the write buffer
- * will contain the pointer to the aiocb struct, this needs
- * to be freed between asynchronous writes.
- * A write of 0 bytes is ignored. */
-#define WRITE_AIO(FD,SIZE,BUFF) do { \
- if (SIZE > 0) { \
- struct aiocb *write_req = driver_alloc(sizeof(struct aiocb)); \
- char *write_buff = driver_alloc((sizeof(char)*SIZE)+1+ \
- (sizeof(struct aiocb *))); \
- *(struct aiocb **)write_buff = (struct aiocb *)write_req; \
- write_buff += sizeof(struct aiocb *); \
- memcpy(write_buff,BUFF,SIZE+1); \
- SET_AIO(*write_req,FD,SIZE,write_buff); \
- if (aio_write(write_req)) \
- ramlog_printf("%s:%d: write failed with %d\n", \
- __FILE__,__LINE__,errno); \
- } \
-} while(0)
-
-/* free the write_buffer and write_req
- * created in the WRITE_AIO() request macro */
-#define FREE_AIO(ptr) do { \
- struct aiocb *aiocb_ptr; \
- char *buffer_ptr; \
- aiocb_ptr = *(struct aiocb **)((ptr)-sizeof(struct aiocb *)); \
- buffer_ptr = (((char*)ptr)-sizeof(struct aiocb *)); \
- driver_free(aiocb_ptr); \
- driver_free(buffer_ptr); \
-} while(0)
-
-#define DISPATCH_AIO(sig) do { \
- if (aio_dispatch(sig)) \
- ramlog_printf("%s:%d: dispatch failed with %d\n", \
- __FILE__,__LINE__,errno); \
- } while(0)
-
-#define AIO_PIPE_SIZE 1024
-
-/* debug print macros */
-#define DEBUG_RES 0
-
-#ifdef DEBUG_RES
-#define DEBUG_CHECK_RES(actual, expected) \
- do { \
- if (actual != expected ) { \
- ramlog_printf("Result check failed" \
- " got: 0x%08x expected:0x%08x\nat: %s:%d\n", \
- actual, expected, __FILE__, __LINE__); \
- abort(); /* This might perhaps be too harsh? */ \
- } \
- } while(0)
-#else
-#define DEBUG_CHECK_RES
-#endif
-
-static struct fd_data {
- char pbuf[4]; /* hold partial packet bytes */
- int psz; /* size of pbuf */
- char *buf;
- char *cpos;
- int sz;
- int remain; /* for input on fd */
-} *fd_data; /* indexed by fd */
-
-/********************* General functions ****************************/
-
-/* This is used by both the drivers and general I/O, must be set early */
-static int max_files = -1;
-
-/*
- * a few variables used by the break handler
- */
-#ifdef ERTS_SMP
-erts_smp_atomic32_t erts_break_requested;
-#define ERTS_SET_BREAK_REQUESTED \
- erts_smp_atomic32_set_nob(&erts_break_requested, (erts_aint32_t) 1)
-#define ERTS_UNSET_BREAK_REQUESTED \
- erts_smp_atomic32_set_nob(&erts_break_requested, (erts_aint32_t) 0)
-#else
-volatile int erts_break_requested = 0;
-#define ERTS_SET_BREAK_REQUESTED (erts_break_requested = 1)
-#define ERTS_UNSET_BREAK_REQUESTED (erts_break_requested = 0)
-#endif
-/* set early so the break handler has access to initial mode */
-static struct termios initial_tty_mode;
-static int replace_intr = 0;
-/* assume yes initially, ttsl_init will clear it */
-int using_oldshell = 1;
-static PROCESS get_signal_proxy_pid(void);
-
-static void
-init_check_io(void)
-{
- erts_init_check_io();
- max_files = erts_check_io_max_files();
-}
-
-#ifdef ERTS_POLL_NEED_ASYNC_INTERRUPT_SUPPORT
-#define ERTS_CHK_IO_AS_INTR() erts_check_io_async_sig_interrupt()
-#else
-#define ERTS_CHK_IO_AS_INTR() erts_check_io_interrupt(1)
-#endif
-#define ERTS_CHK_IO_INTR erts_check_io_interrupt
-#define ERTS_CHK_IO_INTR_TMD erts_check_io_interrupt_timed
-#define ERTS_CHK_IO erts_check_io
-#define ERTS_CHK_IO_SZ erts_check_io_size
-
-
-void
-erts_sys_schedule_interrupt(int set)
-{
- ERTS_CHK_IO_INTR(set);
-}
-
-#ifdef ERTS_SMP
-void
-erts_sys_schedule_interrupt_timed(int set, ErtsMonotonicTime timeout_time)
-{
- ERTS_CHK_IO_INTR_TMD(set, timeout_time);
-}
-#endif
-
-Uint
-erts_sys_misc_mem_sz(void)
-{
- Uint res = ERTS_CHK_IO_SZ();
- res += erts_smp_atomic_read_mb(&sys_misc_mem_sz);
- return res;
-}
-
-/*
- * reset the terminal to the original settings on exit
- */
-void sys_tty_reset(int exit_code)
-{
- if (using_oldshell && !replace_intr) {
- SET_BLOCKING(0);
- }
- else if (isatty(0)) {
- tcsetattr(0,TCSANOW,&initial_tty_mode);
- }
-}
-
-#ifdef USE_THREADS
-
-typedef struct {
- int sched_bind_data;
-} erts_thr_create_data_t;
-
-/*
- * thr_create_prepare() is called in parent thread before thread creation.
- * Returned value is passed as argument to thr_create_cleanup().
- */
-static void *
-thr_create_prepare(void)
-{
- erts_thr_create_data_t *tcdp;
-
- tcdp = erts_alloc(ERTS_ALC_T_TMP, sizeof(erts_thr_create_data_t));
-
- tcdp->sched_bind_data = erts_sched_bind_atthrcreate_prepare();
-
- return (void *) tcdp;
-}
-
-
-/* thr_create_cleanup() is called in parent thread after thread creation. */
-static void
-thr_create_cleanup(void *vtcdp)
-{
- erts_thr_create_data_t *tcdp = (erts_thr_create_data_t *) vtcdp;
-
- erts_sched_bind_atthrcreate_parent(tcdp->sched_bind_data);
-
- erts_free(ERTS_ALC_T_TMP, tcdp);
-}
-
-static void
-thr_create_prepare_child(void *vtcdp)
-{
- erts_thr_create_data_t *tcdp = (erts_thr_create_data_t *) vtcdp;
-
-#ifdef ERTS_ENABLE_LOCK_COUNT
- erts_lcnt_thread_setup();
-#endif
-
- erts_sched_bind_atthrcreate_child(tcdp->sched_bind_data);
-}
-
-#endif /* #ifdef USE_THREADS */
-
-/* The two functions below are stolen from win_con.c
- They have to use malloc/free/realloc directly becasue
- we want to do able to do erts_printf very early on.
- */
-#define VPRINTF_BUF_INC_SIZE 128
-static erts_dsprintf_buf_t *
-grow_vprintf_buf(erts_dsprintf_buf_t *dsbufp, size_t need)
-{
- char *buf;
- size_t size;
-
- ASSERT(dsbufp);
-
- if (!dsbufp->str) {
- size = (((need + VPRINTF_BUF_INC_SIZE - 1)
- / VPRINTF_BUF_INC_SIZE)
- * VPRINTF_BUF_INC_SIZE);
- buf = (char *) malloc(size * sizeof(char));
- }
- else {
- size_t free_size = dsbufp->size - dsbufp->str_len;
-
- if (need <= free_size)
- return dsbufp;
-
- size = need - free_size + VPRINTF_BUF_INC_SIZE;
- size = (((size + VPRINTF_BUF_INC_SIZE - 1)
- / VPRINTF_BUF_INC_SIZE)
- * VPRINTF_BUF_INC_SIZE);
- size += dsbufp->size;
- buf = (char *) realloc((void *) dsbufp->str,
- size * sizeof(char));
- }
- if (!buf)
- return NULL;
- if (buf != dsbufp->str)
- dsbufp->str = buf;
- dsbufp->size = size;
- return dsbufp;
-}
-
-static int erts_sys_ramlog_printf(char *format, va_list arg_list)
-{
- int res,i;
- erts_dsprintf_buf_t dsbuf = ERTS_DSPRINTF_BUF_INITER(grow_vprintf_buf);
- res = erts_vdsprintf(&dsbuf, format, arg_list);
- if (res >= 0) {
- for (i = 0; i < dsbuf.str_len; i+= 50)
- /* We print 50 characters at a time because otherwise
- the ramlog looks broken */
- ramlog_printf("%.*s",dsbuf.str_len-50 < 0?dsbuf.str_len:50,dsbuf.str+i);
- }
- if (dsbuf.str)
- free((void *) dsbuf.str);
- return res;
-}
-
-void
-erts_sys_pre_init(void)
-{
- erts_printf_add_cr_to_stdout = 1;
- erts_printf_add_cr_to_stderr = 1;
-#ifdef USE_THREADS
- {
- erts_thr_init_data_t eid = ERTS_THR_INIT_DATA_DEF_INITER;
-
- eid.thread_create_child_func = thr_create_prepare_child;
- /* Before creation in parent */
- eid.thread_create_prepare_func = thr_create_prepare;
- /* After creation in parent */
- eid.thread_create_parent_func = thr_create_cleanup,
-
- erts_thr_init(&eid);
-
- report_exit_list = NULL;
-
-#ifdef ERTS_ENABLE_LOCK_COUNT
- erts_lcnt_init();
-#endif
-
-#if defined(ERTS_SMP)
- erts_mtx_init(&chld_stat_mtx, "child_status");
-#endif
- }
-#ifdef ERTS_SMP
- erts_smp_atomic32_init_nob(&erts_break_requested, 0);
- erts_smp_atomic32_init_nob(&have_prepared_crash_dump, 0);
-#else
- erts_break_requested = 0;
- have_prepared_crash_dump = 0;
-#endif
-#if !defined(ERTS_SMP)
- children_died = 0;
-#endif
-#endif /* USE_THREADS */
-
- erts_printf_stdout_func = erts_sys_ramlog_printf;
-
- erts_smp_atomic_init_nob(&sys_misc_mem_sz, 0);
-}
-
-void
-erl_sys_init(void)
-{
-
-#ifdef USE_SETLINEBUF
- setlinebuf(stdout);
-#else
- setvbuf(stdout, (char *)NULL, _IOLBF, BUFSIZ);
-#endif
-
- erts_sys_init_float();
-
- /* we save this so the break handler can set and reset it properly */
- /* also so that we can reset on exit (break handler or not) */
- if (isatty(0)) {
- tcgetattr(0,&initial_tty_mode);
- }
- tzset(); /* Required at least for NetBSD with localtime_r() */
-}
-
-static ERTS_INLINE int
-prepare_crash_dump(int secs)
-{
-#define NUFBUF (3)
- int i, max;
- char env[21]; /* enough to hold any 64-bit integer */
- size_t envsz;
- /*DeclareTmpHeapNoproc(heap,NUFBUF);*/
- /*Eterm *hp = heap;*/
- /*Eterm list = NIL;*/
- int has_heart = 0;
-
- UseTmpHeapNoproc(NUFBUF);
-
- if (ERTS_PREPARED_CRASH_DUMP)
- return 0; /* We have already been called */
-
-
- /* Positive secs means an alarm must be set
- * 0 or negative means no alarm
- *
- * Set alarm before we try to write to a port
- * we don't want to hang on a port write with
- * no alarm.
- *
- */
-
-#if 0 /*ose TBD!!!*/
- if (secs >= 0) {
- alarm((unsigned int)secs);
- }
-#endif
-
- /* Make sure we unregister at epmd (unknown fd) and get at least
- one free filedescriptor (for erl_crash.dump) */
-
- max = max_files;
- if (max < 1024)
- max = 1024;
- for (i = 3; i < max; i++) {
- close(i);
- }
-
- envsz = sizeof(env);
- i = erts_sys_getenv__("ERL_CRASH_DUMP_NICE", env, &envsz);
- if (i >= 0) {
- int nice_val;
- nice_val = i != 0 ? 0 : atoi(env);
- if (nice_val > 39) {
- nice_val = 39;
- }
- set_pri(nice_val);
- }
-
- UnUseTmpHeapNoproc(NUFBUF);
-#undef NUFBUF
- return has_heart;
-}
-
-int erts_sys_prepare_crash_dump(int secs)
-{
- return prepare_crash_dump(secs);
-}
-
-static ERTS_INLINE void
-break_requested(void)
-{
- /*
- * just set a flag - checked for and handled by
- * scheduler threads erts_check_io() (not signal handler).
- */
-#ifdef DEBUG
- fprintf(stderr,"break!\n");
-#endif
- if (ERTS_BREAK_REQUESTED)
- erl_exit(ERTS_INTR_EXIT, "");
-
- ERTS_SET_BREAK_REQUESTED;
- ERTS_CHK_IO_AS_INTR(); /* Make sure we don't sleep in poll */
-}
-
-/* Disable break */
-void erts_set_ignore_break(void) {
-
-}
-
-/* Don't use ctrl-c for break handler but let it be
- used by the shell instead (see user_drv.erl) */
-void erts_replace_intr(void) {
- struct termios mode;
-
- if (isatty(0)) {
- tcgetattr(0, &mode);
-
- /* here's an example of how to replace ctrl-c with ctrl-u */
- /* mode.c_cc[VKILL] = 0;
- mode.c_cc[VINTR] = CKILL; */
-
- mode.c_cc[VINTR] = 0; /* disable ctrl-c */
- tcsetattr(0, TCSANOW, &mode);
- replace_intr = 1;
- }
-}
-
-void init_break_handler(void)
-{
-
-}
-
-int sys_max_files(void)
-{
- return(max_files);
-}
-
-
-/************************** OS info *******************************/
-
-/* Used by erlang:info/1. */
-/* (This code was formerly in drv.XXX/XXX_os_drv.c) */
-
-char os_type[] = "ose";
-
-void
-os_flavor(char* namebuf, /* Where to return the name. */
- unsigned size) /* Size of name buffer. */
-{
-#if 0
- struct utsname uts; /* Information about the system. */
- char* s;
-
- (void) uname(&uts);
- for (s = uts.sysname; *s; s++) {
- if (isupper((int) *s)) {
- *s = tolower((int) *s);
- }
- }
- strcpy(namebuf, uts.sysname);
-#else
- strncpy(namebuf, "release", size);
-#endif
-}
-
-void
-os_version(pMajor, pMinor, pBuild)
-int* pMajor; /* Pointer to major version. */
-int* pMinor; /* Pointer to minor version. */
-int* pBuild; /* Pointer to build number. */
-{
- *pMajor = 5;
- *pMinor = 7;
- *pBuild = 0;
-}
-
-void init_getenv_state(GETENV_STATE *state)
-{
- erts_smp_rwmtx_rlock(&environ_rwmtx);
- *state = NULL;
-}
-
-char **environ; /*ose - needs replacement*/
-
-char *getenv_string(GETENV_STATE *state0)
-{
- char **state = (char **) *state0;
- char *cp;
-
- ERTS_SMP_LC_ASSERT(erts_smp_lc_rwmtx_is_rlocked(&environ_rwmtx));
-
- if (state == NULL)
- state = environ;
-
- cp = *state++;
- *state0 = (GETENV_STATE) state;
-
- return cp;
-}
-
-void fini_getenv_state(GETENV_STATE *state)
-{
- *state = NULL;
- erts_smp_rwmtx_runlock(&environ_rwmtx);
-}
-
-
-/************************** Port I/O *******************************/
-
-/* I. Common stuff */
-
-union SIGNAL {
- SIGSELECT sig_no;
- struct FmReadPtr fm_read_reply;
- struct FmWritePtr fm_write_reply;
- struct async async;
-};
-
-/* II. The spawn/fd drivers */
-
-/*
- * Decreasing the size of it below 16384 is not allowed.
- */
-#define ERTS_SYS_READ_BUF_SZ (64*1024)
-
-/* Driver interfaces */
-static ErlDrvData spawn_start(ErlDrvPort, char*, SysDriverOpts*);
-static ErlDrvData fd_start(ErlDrvPort, char*, SysDriverOpts*);
-static ErlDrvSSizeT fd_control(ErlDrvData, unsigned int, char *, ErlDrvSizeT,
- char **, ErlDrvSizeT);
-static int spawn_init(void);
-static void fd_stop(ErlDrvData);
-static void erl_stop(ErlDrvData);
-static void ready_input(ErlDrvData, ErlDrvEvent);
-static void ready_output(ErlDrvData, ErlDrvEvent);
-static void output(ErlDrvData, char*, ErlDrvSizeT);
-static void stop_select(ErlDrvEvent, void*);
-
-static PROCESS
-get_signal_proxy_pid(void) {
- union SIGNAL *sig;
- SIGSELECT any_sig[] = {1,ERTS_SIGNAL_OSE_DRV_ATTACH};
-
- if (!sig_proxy_pid) {
- sig = alloc(sizeof(union SIGNAL), ERTS_SIGNAL_OSE_DRV_ATTACH);
- hunt("ose_signal_driver_proxy", 0, NULL, &sig);
- sig = receive(any_sig);
- sig_proxy_pid = sender(&sig);
- free_buf(&sig);
- }
- ASSERT(sig_proxy_pid);
- return sig_proxy_pid;
-}
-
-static ErlDrvOseEventId
-resolve_signal(union SIGNAL* sig) {
- switch(sig->sig_no) {
-
- case FM_READ_PTR_REPLY:
- return (ErlDrvOseEventId)sig->fm_read_reply.handle;
-
- case FM_WRITE_PTR_REPLY:
- return (ErlDrvOseEventId)sig->fm_write_reply.handle;
-
- case ERTS_SIGNAL_OSE_DRV_ATTACH:
- return (ErlDrvOseEventId)sig->async.target;
-
- default:
- break;
- }
- return (ErlDrvOseEventId)-1;
-}
-
-struct erl_drv_entry spawn_driver_entry = {
- spawn_init,
- spawn_start,
- NULL, /* erl_stop, */
- output,
- ready_input,
- ready_output,
- "spawn",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- ERL_DRV_EXTENDED_MARKER,
- ERL_DRV_EXTENDED_MAJOR_VERSION,
- ERL_DRV_EXTENDED_MINOR_VERSION,
- ERL_DRV_FLAG_USE_PORT_LOCKING,
- NULL, NULL,
- stop_select
-};
-struct erl_drv_entry fd_driver_entry = {
- NULL,
- fd_start,
- fd_stop,
- output,
- ready_input,
- ready_output,
- "fd",
- NULL,
- NULL,
- fd_control,
- NULL,
- NULL,
- NULL, /* ready_async */
- NULL, /* flush */
- NULL, /* call */
- NULL, /* event */
- ERL_DRV_EXTENDED_MARKER,
- ERL_DRV_EXTENDED_MAJOR_VERSION,
- ERL_DRV_EXTENDED_MINOR_VERSION,
- 0, /* ERL_DRV_FLAGs */
- NULL, /* handle2 */
- NULL, /* process_exit */
- stop_select
-};
-
-static void
-set_spawn_fd(int local_fd, int remote_fd, PROCESS remote_pid) {
- PROCESS vm_pid;
- FmHandle handle;
- char env_val[55];
- char env_name[10];
- EfsStatus efs_res;
-
- /* get pid of pipevm and handle of chosen fd */
- efs_res = efs_examine_fd(local_fd, FLIB_FD_VMPID, &vm_pid, 0);
- DEBUG_CHECK_RES(efs_res, EFS_SUCCESS);
-
- /* setup the file descriptor to buffer per line */
- efs_res = efs_config_fd(local_fd, FLIB_FD_BUFMODE, FM_BUFF_LINE,
- FLIB_FD_BUFSIZE, 80, 0);
- DEBUG_CHECK_RES(efs_res, EFS_SUCCESS);
-
- /* duplicate handle and set spawn pid owner */
- efs_res = efs_dup_to(local_fd, remote_pid, &handle);
- DEBUG_CHECK_RES(efs_res, EFS_SUCCESS);
-
- sprintf(env_name, "FD%d", remote_fd);
-
- /* Syntax of the environment variable:
- * "FD#" "<pid of pipevm>,<handle>,<buffer mode>,<buff size>,<omode>" */
- sprintf(env_val, "0x%lx,0x%lx,%lu,%lu,0x%x",
- vm_pid, handle,
- FM_BUFF_LINE, 80,
- O_APPEND);
-
- set_env(remote_pid, env_name, env_val);
-}
-
-static ErlDrvData
-set_driver_data(ErlDrvPort port_num,
- int ifd,
- int ofd,
- int packet_bytes,
- int read_write,
- int exit_status,
- PROCESS pid)
-{
- Port *prt;
- ErtsSysReportExit *report_exit;
-
- prt = erts_drvport2port(port_num);
- if (prt != ERTS_INVALID_ERL_DRV_PORT) {
- prt->os_pid = pid;
- }
-
- /* READ */
- if (read_write & DO_READ) {
- EfsStatus res = efs_examine_fd(ifd, FLIB_FD_HANDLE,
- &driver_data[ifd].handle, 0);
- if (res != EFS_SUCCESS)
- ramlog_printf("%s:%d: efs_examine_fd(%d) failed with %d\n",
- __FILE__,__LINE__,ifd,errno);
- driver_data[ifd].ifd = ifd;
- driver_data[ifd].packet_bytes = packet_bytes;
- driver_data[ifd].port_num = port_num;
- driver_data[ifd].pid = pid;
-
- /* async read struct */
- memset(&driver_data[ifd].aiocb, 0, sizeof(struct aiocb));
- driver_data[ifd].aiocb.aio_buf = driver_alloc(AIO_PIPE_SIZE);
- driver_data[ifd].aiocb.aio_fildes = ifd;
- driver_data[ifd].aiocb.aio_nbytes = (packet_bytes?packet_bytes:AIO_PIPE_SIZE);
- driver_data[ifd].alive = 1;
- driver_data[ifd].status = 0;
- driver_data[ifd].input_event =
- erl_drv_ose_event_alloc(FM_READ_PTR_REPLY,
- driver_data[ifd].handle, resolve_signal,
- &driver_data[ifd].ifd);
-
- /* READ & WRITE */
- if (read_write & DO_WRITE) {
- driver_data[ifd].ofd = ofd;
- efs_examine_fd(ofd, FLIB_FD_HANDLE, &driver_data[ofd].handle, 0);
-
- driver_data[ifd].output_event =
- erl_drv_ose_event_alloc(FM_WRITE_PTR_REPLY,
- driver_data[ofd].handle, resolve_signal,
- &driver_data[ofd].ofd);
- driver_data[ofd].pid = pid;
- if (ifd != ofd) {
- driver_data[ofd] = driver_data[ifd];
- driver_data[ofd].aiocb.aio_buf = NULL;
- }
- }
- else { /* READ ONLY */
- driver_data[ifd].ofd = -1;
- }
-
- /* enable input event */
- (void) driver_select(port_num, driver_data[ifd].input_event,
- (ERL_DRV_READ | ERL_DRV_USE), 1);
-
- if (aio_read(&driver_data[ifd].aiocb))
- ramlog_printf("%s:%d: aio_read(%d) failed with %d\n",
- __FILE__,__LINE__,ifd,errno);
- }
- else { /* WRITE ONLY */
- efs_examine_fd(ofd, FLIB_FD_HANDLE, &driver_data[ofd].handle, 0);
- driver_data[ofd].packet_bytes = packet_bytes;
- driver_data[ofd].port_num = port_num;
- driver_data[ofd].ofd = ofd;
- driver_data[ofd].pid = pid;
- driver_data[ofd].alive = 1;
- driver_data[ofd].status = 0;
- driver_data[ofd].output_event =
- erl_drv_ose_event_alloc(FM_WRITE_PTR_REPLY, driver_data[ofd].handle,
- resolve_signal, &driver_data[ofd].ofd);
- driver_data[ofd].input_event = driver_data[ofd].output_event;
- }
-
- /* this is used for spawned load modules, and is needed
- * to properly uninstall them */
- if (exit_status) {
- struct PmProgramInfo *info;
- int install_handle_size;
- union SIGNAL *sig;
- PmStatus pm_status;
- report_exit = erts_alloc(ERTS_ALC_T_PRT_REP_EXIT,
- sizeof(ErtsSysReportExit));
- report_exit->next = report_exit_list;
- report_exit->port = erts_drvport2id(port_num);
- report_exit->pid = pid;
- report_exit->ifd = (read_write & DO_READ) ? ifd : -1;
- report_exit->ofd = (read_write & DO_WRITE) ? ofd : -1;
- report_exit_list = report_exit;
- report_exit->attach_event =
- erl_drv_ose_event_alloc(ERTS_SIGNAL_OSE_DRV_ATTACH, pid,
- resolve_signal, &driver_data[ifd].ifd);
-
- /* setup ifd and ofd report exit */
- driver_data[ifd].report_exit = report_exit;
- driver_data[ofd].report_exit = report_exit;
-
- pm_status = ose_pm_program_info(pid, &info);
- DEBUG_CHECK_RES(pm_status, PM_SUCCESS);
-
- install_handle_size = strlen(info->install_handle)+1;
- driver_data[ifd].install_handle = driver_alloc(install_handle_size);
- strcpy(driver_data[ifd].install_handle,
- info->install_handle);
-
- free_buf((union SIGNAL **)&info);
-
- sig = alloc(sizeof(struct async), ERTS_SIGNAL_OSE_DRV_ATTACH);
- sig->async.target = pid;
- send(&sig, get_signal_proxy_pid());
-
- /* this event will trigger when we receive an attach signal
- * from the recently dead load module */
- (void)driver_select(port_num,report_exit->attach_event, DO_READ, 1);
- }
- else {
- report_exit = NULL;
- }
-
- /* the return value is the pointer to the driver_data struct we created
- * in this function, it will be used in the drivers input
- * and output functions */
- return (ErlDrvData)((!(read_write & DO_READ) && read_write & DO_WRITE)
- ? &driver_data[ofd]
- : &driver_data[ifd]);
-}
-
-static int spawn_init()
-{
- int i;
-
- driver_data = (struct driver_data *)
- erts_alloc(ERTS_ALC_T_DRV_TAB, max_files * sizeof(struct driver_data));
- erts_smp_atomic_add_nob(&sys_misc_mem_sz,
- max_files * sizeof(struct driver_data));
-
- for (i = 0; i < max_files; i++)
- driver_data[i].pid = -1;
-
- return 1;
-}
-
-static void
-init_fd_data(int fd, ErlDrvPort port_num)
-{
- fd_data[fd].buf = NULL;
- fd_data[fd].cpos = NULL;
- fd_data[fd].remain = 0;
- fd_data[fd].sz = 0;
- fd_data[fd].psz = 0;
-}
-
-/* FIXME write a decent text on pipes on ose */
-static ErlDrvData
-spawn_start(ErlDrvPort port_num, char* name, SysDriverOpts* opts)
-{
- int ifd[2];
- int ofd[2];
- static uint32_t ticker = 1;
- PmStatus pm_status;
- OSDOMAIN domain = PM_NEW_DOMAIN;
- PROCESS progpid, mainbid, mainpid;
- char *handle = NULL;
- struct PmProgramInfo *info;
- char *args = NULL;
- char *tmp_handle;
- ErlDrvData res = (ErlDrvData)-1;
- int handle_size;
- char *ptr;
-
-
- args = driver_alloc(strlen(name)+1);
- strcpy(args, name);
- /* We need to handle name in three parts
- * - install handle (must be unique)
- * - install binary (needed for ose_pm_install_load_module())
- * - full path (as argument to the spawned applications env.var
- */
-
- /* full path including arguments */
- args = driver_alloc(strlen(name)+1);
- strcpy(args, name);
-
- /* handle path */
- tmp_handle = strrchr(name, '/');
- if (tmp_handle == NULL) {
- tmp_handle = name;
- }
- else {
- tmp_handle++;
- }
-
- /* handle args */
- ptr = strchr(tmp_handle, ' ');
- if (ptr != NULL) {
- *ptr = '\0';
- handle_size = ptr - tmp_handle;
- }
- else {
- handle_size = strlen(name)+1;
- }
-
- /* make room for ticker */
- handle_size += (ticker<10)?3:((ticker<100)?4:5);
- handle = driver_alloc(handle_size);
-
- do {
- snprintf(handle, handle_size, "%s_%d", tmp_handle, ticker);
- pm_status = ose_pm_install_load_module(0, "ELF", name, handle,
- 0, 0, NULL);
- ticker++;
- } while (pm_status == PM_EINSTALL_HANDLE_ALREADY_INSTALLED);
-
- if (pm_status != PM_SUCCESS) {
- errno = ENOSYS; /* FIXME add comment */
- return ERL_DRV_ERROR_ERRNO;
- }
-
- /* Create Program */
- pm_status = ose_pm_create_program(&domain, handle, 0, 0,
- NULL, &progpid, &mainbid);
- DEBUG_CHECK_RES(pm_status, PM_SUCCESS);
-
- /* Get the mainpid from the newly created program */
- pm_status = ose_pm_program_info(progpid, &info);
- DEBUG_CHECK_RES(pm_status, PM_SUCCESS);
-
- mainpid = info->main_process;
- free_buf ((union SIGNAL **)&info);
-
- /* pipevm needs to be started
- * pipe will return 0 if success, -1 if not,
- * errno will be set */
- if (pipe(ifd) != 0 || pipe(ofd) != 0) {
- DEBUG_CHECK_RES(0, -1);
- ASSERT(0);
- }
-
- /* setup driver data */
- res = set_driver_data(port_num, ofd[0], ifd[1], opts->packet_bytes,
- opts->read_write, 1 /* opts->exit_status */, progpid);
-
- /* init the fd_data array for read/write */
- init_fd_data(ofd[0], port_num);
- init_fd_data(ifd[1], port_num);
-
- /* setup additional configurations
- * for the spawned applications environment */
- if (args != NULL) {
- set_env(progpid, "ARGV", args);
- }
- set_env(mainbid, "EFS_RESOLVE_TMO", 0);
- set_spawn_fd(ifd[0], 0, mainpid);
- set_spawn_fd(ofd[1], 1, mainpid);
- set_spawn_fd(ofd[1], 2, mainpid);
-
- /* start the spawned program */
- pm_status = ose_pm_start_program(mainbid);
- DEBUG_CHECK_RES(pm_status, PM_SUCCESS);
-
- /* close unused fd's */
- close(ifd[0]);
- close(ofd[1]);
-
- if (handle) {
- driver_free(handle);
- }
-
- return (ErlDrvData)res;
-}
-
-#define FD_DEF_HEIGHT 24
-#define FD_DEF_WIDTH 80
-/* Control op */
-#define FD_CTRL_OP_GET_WINSIZE 100
-
-static int fd_get_window_size(int fd, Uint32 *width, Uint32 *height)
-{
-#ifdef TIOCGWINSZ
- struct winsize ws;
- if (ioctl(fd,TIOCGWINSZ,&ws) == 0) {
- *width = (Uint32) ws.ws_col;
- *height = (Uint32) ws.ws_row;
- return 0;
- }
-#endif
- return -1;
-}
-
-static ErlDrvSSizeT fd_control(ErlDrvData drv_data,
- unsigned int command,
- char *buf, ErlDrvSizeT len,
- char **rbuf, ErlDrvSizeT rlen)
-{
- struct driver_data *data = (struct driver_data *)drv_data;
- char resbuff[2*sizeof(Uint32)];
- switch (command) {
- case FD_CTRL_OP_GET_WINSIZE:
- {
- Uint32 w,h;
- if (fd_get_window_size(data->ifd,&w,&h))
- return 0;
- memcpy(resbuff,&w,sizeof(Uint32));
- memcpy(resbuff+sizeof(Uint32),&h,sizeof(Uint32));
- }
- break;
- default:
- return 0;
- }
- if (rlen < 2*sizeof(Uint32)) {
- *rbuf = driver_alloc(2*sizeof(Uint32));
- }
- memcpy(*rbuf,resbuff,2*sizeof(Uint32));
- return 2*sizeof(Uint32);
-}
-
-static ErlDrvData fd_start(ErlDrvPort port_num, char* name,
- SysDriverOpts* opts)
-{
- ErlDrvData res;
-
- CHLD_STAT_LOCK;
- if (opts->read_write & DO_READ) {
- init_fd_data(opts->ifd, port_num);
- }
- if (opts->read_write & DO_WRITE) {
- init_fd_data(opts->ofd, port_num);
- }
- res = set_driver_data(port_num, opts->ifd, opts->ofd,
- opts->packet_bytes,
- opts->read_write, 0, -1);
- CHLD_STAT_UNLOCK;
- return res;
-}
-
-static void clear_fd_data(int fd)
-{
- if (fd_data[fd].sz > 0) {
- erts_free(ERTS_ALC_T_FD_ENTRY_BUF, (void *) fd_data[fd].buf);
- ASSERT(erts_smp_atomic_read_nob(&sys_misc_mem_sz) >= fd_data[fd].sz);
- erts_smp_atomic_add_nob(&sys_misc_mem_sz, -1*fd_data[fd].sz);
- }
- fd_data[fd].buf = NULL;
- fd_data[fd].sz = 0;
- fd_data[fd].remain = 0;
- fd_data[fd].cpos = NULL;
- fd_data[fd].psz = 0;
-}
-
-static void nbio_stop_fd(ErlDrvPort prt, ErlDrvEvent ev)
-{
- int *fd;
- driver_select(prt,ev,DO_READ|DO_WRITE,0);
- erl_drv_ose_event_fetch(ev, NULL, NULL, (void **)&fd);
- clear_fd_data(*fd);
- SET_BLOCKING(*fd);
-}
-
-static void fd_stop(ErlDrvData drv_data) /* Does not close the fds */
-{
- struct driver_data *data = (struct driver_data *)drv_data;
-
- if (data->ofd != -1) {
- if (data->ifd != data->ofd) { /* read and write */
- nbio_stop_fd(data->port_num, data->input_event);
- nbio_stop_fd(data->port_num, data->output_event);
- }
- else { /* write only */
- nbio_stop_fd(data->port_num, data->output_event);
- }
- }
- else { /* read only */
- nbio_stop_fd(data->port_num, data->input_event);
- }
-}
-
-
-static void erl_stop(ErlDrvData drv_data)
-{
- struct driver_data *data = (struct driver_data *)drv_data;
-
- CHLD_STAT_LOCK;
- data->pid = -1;
- CHLD_STAT_UNLOCK;
-
- if (data->ofd != -1) {
- if (data->ifd != data->ofd) { /* read and write */
- nbio_stop_fd(data->port_num, data->input_event);
- nbio_stop_fd(data->port_num, data->output_event);
- }
- else { /* write only */
- nbio_stop_fd(data->port_num, data->output_event);
- }
- }
- else { /* read only */
- nbio_stop_fd(data->port_num, data->input_event);
- }
- close(data->ifd);
- close(data->ofd);
-}
-
-/* The parameter e is a pointer to the driver_data structure
- * related to the fd to be used as output */
-static void output(ErlDrvData drv_data, char* buf, ErlDrvSizeT len)
-{
- ErlDrvSizeT sz;
- char lb[4];
- char* lbp;
- struct driver_data *data = (struct driver_data *)drv_data;
-
- if (((data->packet_bytes == 2) &&
- (len > 0xffff)) || (data->packet_bytes == 1 && len > 0xff)) {
- driver_failure_posix(data->port_num, EINVAL);
- return; /* -1; */
- }
- put_int32(len, lb);
- lbp = lb + (4-(data->packet_bytes));
-
- if ((sz = driver_sizeq(data->port_num)) > 0) {
- if (data->packet_bytes != 0) {
- driver_enq(data->port_num, lbp, data->packet_bytes);
- }
- driver_enq(data->port_num, buf, len);
-
- if (sz + len + data->packet_bytes >= (1 << 13))
- set_busy_port(data->port_num, 1);
- }
- else {
- char *pbbuf;
- if (data->packet_bytes != 0) {
- pbbuf = malloc(len + data->packet_bytes);
- int i;
- for (i = 0; i < data->packet_bytes; i++) {
- *pbbuf++ = *lbp++;
- }
- strncpy(pbbuf, buf, len);
- pbbuf -= data->packet_bytes;
- }
- driver_select(data->port_num, data->output_event,
- ERL_DRV_WRITE|ERL_DRV_USE, 1);
- WRITE_AIO(data->ofd,
- (data->packet_bytes ? len+data->packet_bytes : len),
- (data->packet_bytes ? pbbuf : buf));
- if (data->packet_bytes != 0) free(pbbuf);
- }
- return; /* 0; */
-}
-
-/* This function is being run when we in recieve
- * either a read of 0 bytes, or the attach signal from a dying
- * spawned load module */
-static int port_inp_failure(ErlDrvPort port_num, ErlDrvEvent ready_fd, int res)
- /* Result: 0 (eof) or -1 (error) */
-{
- int *fd;
- SIGSELECT sig_no;
- ASSERT(res <= 0);
-
- erl_drv_ose_event_fetch(ready_fd,&sig_no, NULL, (void **)&fd);
- /* As we need to handle two signals, we do this in two steps */
- if (driver_data[*fd].alive) {
- report_exit_status(driver_data[*fd].report_exit, 0); /* status? */
- }
- else {
- driver_select(port_num,ready_fd,DO_READ|DO_WRITE,0);
- clear_fd_data(*fd);
- driver_report_exit(driver_data[*fd].port_num, driver_data[*fd].status);
- /* As we do not really know if the spawn has crashed or exited nicely
- * we do not check the result status of the following call.. FIXME
- * can we handle this in a better way? */
- ose_pm_uninstall_load_module(driver_data[*fd].install_handle);
- driver_free(driver_data[*fd].install_handle);
- driver_free((void *)driver_data[*fd].aiocb.aio_buf);
-
- close(*fd);
- }
-
- return 0;
-}
-
-/* The parameter e is a pointer to the driver_data structure
- * related to the fd to be used as output.
- * ready_fd is the event that triggered this call to ready_input */
-static void ready_input(ErlDrvData drv_data, ErlDrvEvent ready_fd)
-{
- int res;
- Uint h;
- char *buf;
- union SIGNAL *sig;
- struct driver_data *data = (struct driver_data *)drv_data;
-
- sig = erl_drv_ose_get_signal(ready_fd);
- ASSERT(sig);
-
-
- while (sig) {
- /* If we've recieved an attach signal, we need to handle
- * it in port_inp_failure */
- if (sig->sig_no == ERTS_SIGNAL_OSE_DRV_ATTACH) {
- port_inp_failure(data->port_num, ready_fd, 0);
- }
- else {
- res = sig->fm_read_reply.actual;
- if (res == 0) {
- port_inp_failure(data->port_num, ready_fd, res);
- break;
- }
-
- if (data->packet_bytes == 0) {
- if (res < 0) {
- if ((errno != EINTR) && (errno != ERRNO_BLOCK)) {
- port_inp_failure(data->port_num, ready_fd, res);
- }
- }
- else if (res == 0) {
- /* read of 0 bytes, eof, otherside of pipe is assumed dead */
- port_inp_failure(data->port_num, ready_fd, res);
- break;
- }
- else {
- buf = driver_alloc(res);
- memcpy(buf, (void *)data->aiocb.aio_buf, res);
- driver_select(data->port_num, data->output_event,
- ERL_DRV_WRITE|ERL_DRV_USE, 1);
- driver_output(data->port_num, (char*) buf, res);
- driver_free(buf);
- }
- /* clear the previous read */
- memset(data->aiocb.aio_buf, 0, res);
-
- /* issue a new read */
- DISPATCH_AIO(sig);
- aio_read(&data->aiocb);
- }
- else if (data->packet_bytes && fd_data[data->ifd].remain > 0) {
- /* we've read a partial package, or a header */
-
- if (res == fd_data[data->ifd].remain) { /* we are done! */
- char *buf = data->aiocb.aio_buf;
- int i;
-
- /* do we have anything buffered? */
- if (fd_data[data->ifd].buf != NULL) {
- memcpy(fd_data[data->ifd].buf + fd_data[data->ifd].sz,
- buf, res);
- buf = fd_data[data->ifd].buf;
- }
-
- fd_data[data->ifd].sz += res;
- driver_output(data->port_num, buf, (fd_data[data->ifd].sz>0?fd_data[data->ifd].sz:res));
- clear_fd_data(data->ifd);
-
- /* clear the previous read */
- memset(data->aiocb.aio_buf, 0, res);
-
- /* issue a new read */
- DISPATCH_AIO(sig);
- data->aiocb.aio_nbytes = data->packet_bytes;
-
- if (data->aiocb.aio_buf == NULL) {
- port_inp_failure(data->port_num, ready_fd, -1);
- }
- aio_read(&data->aiocb);
- }
- else if(res < fd_data[data->ifd].remain) { /* received part of a package */
- if (fd_data[data->ifd].sz == 0) {
-
- fd_data[data->ifd].sz += res;
- memcpy(fd_data[data->ifd].buf, data->aiocb.aio_buf, res);
- fd_data[data->ifd].remain -= res;
- }
- else {
- memcpy(fd_data[data->ifd].buf + fd_data[data->ifd].sz,
- data->aiocb.aio_buf, res);
- fd_data[data->ifd].sz += res;
- fd_data[data->ifd].remain -= res;
- }
- /* clear the previous read */
- memset(data->aiocb.aio_buf, 0, res);
-
- /* issue a new read */
- DISPATCH_AIO(sig);
- data->aiocb.aio_nbytes = fd_data[data->ifd].remain;
-
- if (data->aiocb.aio_buf == NULL) {
- port_inp_failure(data->port_num, ready_fd, -1);
- }
- aio_read(&data->aiocb);
- }
- }
- else if (data->packet_bytes && fd_data[data->ifd].remain == 0) { /* we've recieved a header */
-
- /* analyze the header FIXME */
- switch (data->packet_bytes) {
- case 1: h = get_int8(data->aiocb.aio_buf); break;
- case 2: h = get_int16(data->aiocb.aio_buf); break;
- case 4: h = get_int32(data->aiocb.aio_buf); break;
- }
-
- fd_data[data->ifd].buf = erts_alloc_fnf(ERTS_ALC_T_FD_ENTRY_BUF, h + data->packet_bytes);
- fd_data[data->ifd].remain = ((h + data->packet_bytes) - res);
-
- /* clear the previous read */
- memset(data->aiocb.aio_buf, 0, data->packet_bytes);
-
- /* issue a new read */
- DISPATCH_AIO(sig);
- data->aiocb.aio_nbytes = h;
-
- if (data->aiocb.aio_buf == NULL) {
- port_inp_failure(data->port_num, ready_fd, -1);
- }
- aio_read(&data->aiocb);
- }
- }
- sig = erl_drv_ose_get_signal(ready_fd);
- }
-}
-
-
-/* The parameter e is a pointer to the driver_data structure
- * related to the fd to be used as output.
- * ready_fd is the event that triggered this call to ready_input */
-static void ready_output(ErlDrvData drv_data, ErlDrvEvent ready_fd)
-{
- SysIOVec *iov;
- int vlen;
- int res;
- union SIGNAL *sig;
- struct driver_data *data = (struct driver_data *)drv_data;
-
- sig = erl_drv_ose_get_signal(ready_fd);
- ASSERT(sig);
-
- while (sig != NULL) {
- if (sig->fm_write_reply.actual <= 0) {
- int status;
-
- status = efs_status_to_errno(sig->fm_write_reply.status);
- driver_select(data->port_num, ready_fd, ERL_DRV_WRITE, 0);
- DISPATCH_AIO(sig);
- FREE_AIO(sig->fm_write_reply.buffer);
-
- driver_failure_posix(data->port_num, status);
- }
- else { /* written bytes > 0 */
- iov = driver_peekq(data->port_num, &vlen);
- if (vlen > 0) {
- DISPATCH_AIO(sig);
- FREE_AIO(sig->fm_write_reply.buffer);
- res = driver_deq(data->port_num, iov[0].iov_len);
- if (res > 0) {
- iov = driver_peekq(data->port_num, &vlen);
- WRITE_AIO(data->ofd, iov[0].iov_len, iov[0].iov_base);
- }
- }
- else if (vlen == 0) {
- DISPATCH_AIO(sig);
- FREE_AIO(sig->fm_write_reply.buffer);
- }
-
- }
- sig = erl_drv_ose_get_signal(ready_fd);
- }
-}
-
-static void stop_select(ErlDrvEvent ready_fd, void* _)
-{
- int *fd;
- erl_drv_ose_event_fetch(ready_fd, NULL, NULL, (void **)&fd);
- erl_drv_ose_event_free(ready_fd);
- close(*fd);
-}
-
-
-void erts_do_break_handling(void)
-{
- struct termios temp_mode;
- int saved = 0;
-
- /*
- * Most functions that do_break() calls are intentionally not thread safe;
- * therefore, make sure that all threads but this one are blocked before
- * proceeding!
- */
- erts_smp_thr_progress_block();
-
- /* during break we revert to initial settings */
- /* this is done differently for oldshell */
- if (using_oldshell && !replace_intr) {
- SET_BLOCKING(1);
- }
- else if (isatty(0)) {
- tcgetattr(0,&temp_mode);
- tcsetattr(0,TCSANOW,&initial_tty_mode);
- saved = 1;
- }
-
- /* call the break handling function, reset the flag */
- do_break();
-
- fflush(stdout);
-
- /* after break we go back to saved settings */
- if (using_oldshell && !replace_intr) {
- SET_NONBLOCKING(1);
- }
- else if (saved) {
- tcsetattr(0,TCSANOW,&temp_mode);
- }
-
- erts_smp_thr_progress_unblock();
-}
-
-static pid_t
-getpid(void)
-{
- return get_bid(current_process());
-}
-
-int getpagesize(void)
-{
- return 1024;
-}
-
-
-/* Fills in the systems representation of the jam/beam process identifier.
-** The Pid is put in STRING representation in the supplied buffer,
-** no interpretatione of this should be done by the rest of the
-** emulator. The buffer should be at least 21 bytes long.
-*/
-void sys_get_pid(char *buffer, size_t buffer_size){
- pid_t p = getpid();
- /* Assume the pid is scalar and can rest in an unsigned long... */
- erts_snprintf(buffer, buffer_size, "%lu",(unsigned long) p);
-}
-
-int
-erts_sys_putenv_raw(char *key, char *value) {
- return erts_sys_putenv(key, value);
-}
-int
-erts_sys_putenv(char *key, char *value)
-{
- int res;
-
- erts_smp_rwmtx_rwlock(&environ_rwmtx);
- res = set_env(get_bid(current_process()), key,
- value);
- erts_smp_rwmtx_rwunlock(&environ_rwmtx);
- return res;
-}
-
-
-int
-erts_sys_unsetenv(char *key)
-{
- int res;
-
- erts_smp_rwmtx_rwlock(&environ_rwmtx);
- res = set_env(get_bid(current_process()),key,NULL);
- erts_smp_rwmtx_rwunlock(&environ_rwmtx);
-
- return res;
-}
-
-int
-erts_sys_getenv__(char *key, char *value, size_t *size)
-{
- int res;
- char *orig_value = get_env(get_bid(current_process()), key);
- if (!orig_value)
- res = -1;
- else {
- size_t len = sys_strlen(orig_value);
- if (len >= *size) {
- *size = len + 1;
- res = 1;
- }
- else {
- *size = len;
- sys_memcpy((void *) value, (void *) orig_value, len+1);
- res = 0;
- }
- free_buf((union SIGNAL **)&orig_value);
- }
- return res;
-}
-
-int
-erts_sys_getenv_raw(char *key, char *value, size_t *size) {
- return erts_sys_getenv(key, value, size);
-}
-
-/*
- * erts_sys_getenv
- * returns:
- * -1, if environment key is not set with a value
- * 0, if environment key is set and value fits into buffer res
- * 1, if environment key is set but does not fit into buffer res
- * res is set with the needed buffer res value
- */
-
-int
-erts_sys_getenv(char *key, char *value, size_t *size)
-{
- int res;
- erts_smp_rwmtx_rlock(&environ_rwmtx);
- res = erts_sys_getenv__(key, value, size);
- erts_smp_rwmtx_runlock(&environ_rwmtx);
- return res;
-}
-
-void
-sys_init_io(void)
-{
- fd_data = (struct fd_data *)
- erts_alloc(ERTS_ALC_T_FD_TAB, max_files * sizeof(struct fd_data));
- erts_smp_atomic_add_nob(&sys_misc_mem_sz,
- max_files * sizeof(struct fd_data));
-}
-
-extern const char pre_loaded_code[];
-extern Preload pre_loaded[];
-
-void erts_sys_alloc_init(void)
-{
-}
-
-void *erts_sys_alloc(ErtsAlcType_t t, void *x, Uint sz)
-{
- void *res = malloc((size_t) sz);
-#if HAVE_ERTS_MSEG
- if (!res) {
- erts_mseg_clear_cache();
- return malloc((size_t) sz);
- }
-#endif
- return res;
-}
-
-void *erts_sys_realloc(ErtsAlcType_t t, void *x, void *p, Uint sz)
-{
- void *res = realloc(p, (size_t) sz);
-#if HAVE_ERTS_MSEG
- if (!res) {
- erts_mseg_clear_cache();
- return realloc(p, (size_t) sz);
- }
-#endif
- return res;
-}
-
-void erts_sys_free(ErtsAlcType_t t, void *x, void *p)
-{
- free(p);
-}
-
-/* Return a pointer to a vector of names of preloaded modules */
-
-Preload*
-sys_preloaded(void)
-{
- return pre_loaded;
-}
-
-/* Return a pointer to preloaded code for module "module" */
-unsigned char*
-sys_preload_begin(Preload* p)
-{
- return p->code;
-}
-
-/* Clean up if allocated */
-void sys_preload_end(Preload* p)
-{
- /* Nothing */
-}
-
-/* Read a key from console (?) */
-
-int sys_get_key(fd)
-int fd;
-{
- int c;
- unsigned char rbuf[64];
-
- fflush(stdout); /* Flush query ??? */
-
- if ((c = read(fd,rbuf,64)) <= 0) {
- return c;
- }
-
- return rbuf[0];
-}
-
-
-#ifdef DEBUG
-
-extern int erts_initialized;
-void
-erl_assert_error(const char* expr, const char* func,
- const char* file, int line)
-{
- fflush(stdout);
- fprintf(stderr, "%s:%d:%s() Assertion failed: %s\n",
- file, line, func, expr);
- fflush(stderr);
- ramlog_printf("%s:%d:%s() Assertion failed: %s\n",
- file, line, func, expr);
-
- abort();
-}
-
-void
-erl_debug(char* fmt, ...)
-{
- char sbuf[1024]; /* Temporary buffer. */
- va_list va;
-
- if (debug_log) {
- va_start(va, fmt);
- vsprintf(sbuf, fmt, va);
- va_end(va);
- fprintf(stderr, "%s", sbuf);
- }
-}
-
-#endif /* DEBUG */
-
-static ERTS_INLINE void
-report_exit_status(ErtsSysReportExit *rep, int status)
-{
- if (rep->ifd >= 0) {
- driver_data[rep->ifd].alive = 0;
- driver_data[rep->ifd].status = status;
- }
- if (rep->ofd >= 0) {
- driver_data[rep->ofd].alive = 0;
- driver_data[rep->ofd].status = status;
- }
-
- erts_free(ERTS_ALC_T_PRT_REP_EXIT, rep);
-}
-
-#define ERTS_REPORT_EXIT_STATUS report_exit_status
-
-/*
- * Called from schedule() when it runs out of runnable processes,
- * or when Erlang code has performed INPUT_REDUCTIONS reduction
- * steps. runnable == 0 iff there are no runnable Erlang processes.
- */
-void
-erl_sys_schedule(int runnable)
-{
- ASSERT(get_fsem(current_process()) == 0);
-#ifdef ERTS_SMP
- ASSERT(erts_get_scheduler_data()->no == 1);
- ERTS_CHK_IO(!runnable);
-#else
- ERTS_CHK_IO( 1 );
-#endif
- ASSERT(get_fsem(current_process()) == 0);
- ERTS_SMP_LC_ASSERT(!erts_thr_progress_is_blocking());
-}
-
-
-#ifdef ERTS_SMP
-
-void
-erts_sys_main_thread(void)
-{
- erts_thread_disable_fpe();
-
- /* Become signal receiver thread... */
-#ifdef ERTS_ENABLE_LOCK_CHECK
- erts_lc_set_thread_name("signal_receiver");
-#endif
-
- while (1) {
- static const SIGSELECT sigsel[] = {0};
- union SIGNAL *msg = receive(sigsel);
-
- fprintf(stderr,"Main thread got message %d from 0x%x!!\r\n",
- msg->sig_no, sender(&msg));
- free_buf(&msg);
- }
-}
-
-#endif /* ERTS_SMP */
-
-void
-erl_sys_args(int* argc, char** argv)
-{
- int i, j;
-
- erts_smp_rwmtx_init(&environ_rwmtx, "environ");
-
- init_check_io();
-
- /* Handled arguments have been marked with NULL. Slide arguments
- not handled towards the beginning of argv. */
- for (i = 0, j = 0; i < *argc; i++) {
- if (argv[i])
- argv[j++] = argv[i];
- }
- *argc = j;
-
-}
diff --git a/erts/emulator/sys/ose/sys_float.c b/erts/emulator/sys/ose/sys_float.c
deleted file mode 100644
index 3d9abc6bd1..0000000000
--- a/erts/emulator/sys/ose/sys_float.c
+++ /dev/null
@@ -1,845 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 2001-2013. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "sys.h"
-#include "global.h"
-#include "erl_process.h"
-
-
-#ifdef NO_FPE_SIGNALS
-
-void
-erts_sys_init_float(void)
-{
-# ifdef SIGFPE
- sys_sigset(SIGFPE, SIG_IGN); /* Ignore so we can test for NaN and Inf */
-# endif
-}
-
-#else /* !NO_FPE_SIGNALS */
-
-#ifdef ERTS_SMP
-static erts_tsd_key_t fpe_key;
-
-/* once-only initialisation early in the main thread (via erts_sys_init_float()) */
-static void erts_init_fp_exception(void)
-{
- /* XXX: the wrappers prevent using a pthread destructor to
- deallocate the key's value; so when/where do we do that? */
- erts_tsd_key_create(&fpe_key);
-}
-
-void erts_thread_init_fp_exception(void)
-{
- unsigned long *fpe = erts_alloc(ERTS_ALC_T_FP_EXCEPTION, sizeof(*fpe));
- *fpe = 0L;
- erts_tsd_set(fpe_key, fpe);
-}
-
-static ERTS_INLINE volatile unsigned long *erts_thread_get_fp_exception(void)
-{
- return (volatile unsigned long*)erts_tsd_get(fpe_key);
-}
-#else /* !SMP */
-#define erts_init_fp_exception() /*empty*/
-static volatile unsigned long fp_exception;
-#define erts_thread_get_fp_exception() (&fp_exception)
-#endif /* SMP */
-
-volatile unsigned long *erts_get_current_fp_exception(void)
-{
- Process *c_p;
-
- c_p = erts_get_current_process();
- if (c_p)
- return &c_p->fp_exception;
- return erts_thread_get_fp_exception();
-}
-
-static void set_current_fp_exception(unsigned long pc)
-{
- volatile unsigned long *fpexnp = erts_get_current_fp_exception();
- ASSERT(fpexnp != NULL);
- *fpexnp = pc;
-}
-
-void erts_fp_check_init_error(volatile unsigned long *fpexnp)
-{
- char buf[64];
- snprintf(buf, sizeof buf, "ERTS_FP_CHECK_INIT at %p: detected unhandled FPE at %p\r\n",
- __builtin_return_address(0), (void*)*fpexnp);
- if (write(2, buf, strlen(buf)) <= 0)
- erl_exit(ERTS_ABORT_EXIT, "%s", buf);
- *fpexnp = 0;
-#if defined(__i386__) || defined(__x86_64__)
- erts_restore_fpu();
-#endif
-}
-
-/* Is there no standard identifier for Darwin/MacOSX ? */
-#if defined(__APPLE__) && defined(__MACH__) && !defined(__DARWIN__)
-#define __DARWIN__ 1
-#endif
-
-#if (defined(__i386__) || defined(__x86_64__)) && defined(__GNUC__)
-
-static void unmask_x87(void)
-{
- unsigned short cw;
-
- __asm__ __volatile__("fstcw %0" : "=m"(cw));
- cw &= ~(0x01|0x04|0x08); /* unmask IM, ZM, OM */
- __asm__ __volatile__("fldcw %0" : : "m"(cw));
-}
-
-/* mask x87 FPE, return true if the previous state was unmasked */
-static int mask_x87(void)
-{
- unsigned short cw;
- int unmasked;
-
- __asm__ __volatile__("fstcw %0" : "=m"(cw));
- unmasked = (cw & (0x01|0x04|0x08)) == 0;
- /* or just set cw = 0x37f */
- cw |= (0x01|0x04|0x08); /* mask IM, ZM, OM */
- __asm__ __volatile__("fldcw %0" : : "m"(cw));
- return unmasked;
-}
-
-static void unmask_sse2(void)
-{
- unsigned int mxcsr;
-
- __asm__ __volatile__("stmxcsr %0" : "=m"(mxcsr));
- mxcsr &= ~(0x003F|0x0680); /* clear exn flags, unmask OM, ZM, IM (not PM, UM, DM) */
- __asm__ __volatile__("ldmxcsr %0" : : "m"(mxcsr));
-}
-
-/* mask SSE2 FPE, return true if the previous state was unmasked */
-static int mask_sse2(void)
-{
- unsigned int mxcsr;
- int unmasked;
-
- __asm__ __volatile__("stmxcsr %0" : "=m"(mxcsr));
- unmasked = (mxcsr & 0x0680) == 0;
- /* or just set mxcsr = 0x1f80 */
- mxcsr &= ~0x003F; /* clear exn flags */
- mxcsr |= 0x0680; /* mask OM, ZM, IM (not PM, UM, DM) */
- __asm__ __volatile__("ldmxcsr %0" : : "m"(mxcsr));
- return unmasked;
-}
-
-#if defined(__x86_64__)
-
-static inline int cpu_has_sse2(void) { return 1; }
-
-#else /* !__x86_64__ */
-
-/*
- * Check if an x86-32 processor has SSE2.
- */
-static unsigned int xor_eflags(unsigned int mask)
-{
- unsigned int eax, edx;
-
- eax = mask; /* eax = mask */
- __asm__("pushfl\n\t"
- "popl %0\n\t" /* edx = original EFLAGS */
- "xorl %0, %1\n\t" /* eax = mask ^ EFLAGS */
- "pushl %1\n\t"
- "popfl\n\t" /* new EFLAGS = mask ^ original EFLAGS */
- "pushfl\n\t"
- "popl %1\n\t" /* eax = new EFLAGS */
- "xorl %0, %1\n\t" /* eax = new EFLAGS ^ old EFLAGS */
- "pushl %0\n\t"
- "popfl" /* restore original EFLAGS */
- : "=d"(edx), "=a"(eax)
- : "1"(eax));
- return eax;
-}
-
-static __inline__ unsigned int cpuid_eax(unsigned int op)
-{
- unsigned int eax, save_ebx;
-
- /* In PIC mode i386 reserves EBX. So we must save
- and restore it ourselves to not upset gcc. */
- __asm__(
- "movl %%ebx, %1\n\t"
- "cpuid\n\t"
- "movl %1, %%ebx"
- : "=a"(eax), "=m"(save_ebx)
- : "0"(op)
- : "cx", "dx");
- return eax;
-}
-
-static __inline__ unsigned int cpuid_edx(unsigned int op)
-{
- unsigned int eax, edx, save_ebx;
-
- /* In PIC mode i386 reserves EBX. So we must save
- and restore it ourselves to not upset gcc. */
- __asm__(
- "movl %%ebx, %2\n\t"
- "cpuid\n\t"
- "movl %2, %%ebx"
- : "=a"(eax), "=d"(edx), "=m"(save_ebx)
- : "0"(op)
- : "cx");
- return edx;
-}
-
-/* The AC bit, bit #18, is a new bit introduced in the EFLAGS
- * register on the Intel486 processor to generate alignment
- * faults. This bit cannot be set on the Intel386 processor.
- */
-static __inline__ int is_386(void)
-{
- return ((xor_eflags(1<<18) >> 18) & 1) == 0;
-}
-
-/* Newer x86 processors have a CPUID instruction, as indicated by
- * the ID bit (#21) in EFLAGS being modifiable.
- */
-static __inline__ int has_CPUID(void)
-{
- return (xor_eflags(1<<21) >> 21) & 1;
-}
-
-static int cpu_has_sse2(void)
-{
- unsigned int maxlev, features;
- static int has_sse2 = -1;
-
- if (has_sse2 >= 0)
- return has_sse2;
- has_sse2 = 0;
-
- if (is_386())
- return 0;
- if (!has_CPUID())
- return 0;
- maxlev = cpuid_eax(0);
- /* Intel A-step Pentium had a preliminary version of CPUID.
- It also didn't have SSE2. */
- if ((maxlev & 0xFFFFFF00) == 0x0500)
- return 0;
- /* If max level is zero then CPUID cannot report any features. */
- if (maxlev == 0)
- return 0;
- features = cpuid_edx(1);
- has_sse2 = (features & (1 << 26)) != 0;
-
- return has_sse2;
-}
-#endif /* !__x86_64__ */
-
-static void unmask_fpe(void)
-{
- __asm__ __volatile__("fnclex");
- unmask_x87();
- if (cpu_has_sse2())
- unmask_sse2();
-}
-
-static void unmask_fpe_conditional(int unmasked)
-{
- if (unmasked)
- unmask_fpe();
-}
-
-/* mask x86 FPE, return true if the previous state was unmasked */
-static int mask_fpe(void)
-{
- int unmasked;
-
- unmasked = mask_x87();
- if (cpu_has_sse2())
- unmasked |= mask_sse2();
- return unmasked;
-}
-
-void erts_restore_fpu(void)
-{
- __asm__ __volatile__("fninit");
- unmask_x87();
- if (cpu_has_sse2())
- unmask_sse2();
-}
-
-#elif defined(__sparc__) && defined(__linux__)
-
-#if defined(__arch64__)
-#define LDX "ldx"
-#define STX "stx"
-#else
-#define LDX "ld"
-#define STX "st"
-#endif
-
-static void unmask_fpe(void)
-{
- unsigned long fsr;
-
- __asm__(STX " %%fsr, %0" : "=m"(fsr));
- fsr &= ~(0x1FUL << 23); /* clear FSR[TEM] field */
- fsr |= (0x1AUL << 23); /* enable NV, OF, DZ exceptions */
- __asm__ __volatile__(LDX " %0, %%fsr" : : "m"(fsr));
-}
-
-static void unmask_fpe_conditional(int unmasked)
-{
- if (unmasked)
- unmask_fpe();
-}
-
-/* mask SPARC FPE, return true if the previous state was unmasked */
-static int mask_fpe(void)
-{
- unsigned long fsr;
- int unmasked;
-
- __asm__(STX " %%fsr, %0" : "=m"(fsr));
- unmasked = ((fsr >> 23) & 0x1A) == 0x1A;
- fsr &= ~(0x1FUL << 23); /* clear FSR[TEM] field */
- __asm__ __volatile__(LDX " %0, %%fsr" : : "m"(fsr));
- return unmasked;
-}
-
-#elif (defined(__powerpc__) && defined(__linux__)) || (defined(__ppc__) && defined(__DARWIN__))
-
-#if defined(__linux__)
-#include <sys/prctl.h>
-
-static void set_fpexc_precise(void)
-{
- if (prctl(PR_SET_FPEXC, PR_FP_EXC_PRECISE) < 0) {
- perror("PR_SET_FPEXC");
- exit(1);
- }
-}
-
-#elif defined(__DARWIN__)
-
-#include <mach/mach.h>
-#include <pthread.h>
-
-/*
- * FE0 FE1 MSR bits
- * 0 0 floating-point exceptions disabled
- * 0 1 floating-point imprecise nonrecoverable
- * 1 0 floating-point imprecise recoverable
- * 1 1 floating-point precise mode
- *
- * Apparently:
- * - Darwin 5.5 (MacOS X <= 10.1) starts with FE0 == FE1 == 0,
- * and resets FE0 and FE1 to 0 after each SIGFPE.
- * - Darwin 6.0 (MacOS X 10.2) starts with FE0 == FE1 == 1,
- * and does not reset FE0 or FE1 after a SIGFPE.
- */
-#define FE0_MASK (1<<11)
-#define FE1_MASK (1<<8)
-
-/* a thread cannot get or set its own MSR bits */
-static void *fpu_fpe_enable(void *arg)
-{
- thread_t t = *(thread_t*)arg;
- struct ppc_thread_state state;
- unsigned int state_size = PPC_THREAD_STATE_COUNT;
-
- if (thread_get_state(t, PPC_THREAD_STATE, (natural_t*)&state, &state_size) != KERN_SUCCESS) {
- perror("thread_get_state");
- exit(1);
- }
- if ((state.srr1 & (FE1_MASK|FE0_MASK)) != (FE1_MASK|FE0_MASK)) {
-#if 1
- /* This would also have to be performed in the SIGFPE handler
- to work around the MSR reset older Darwin releases do. */
- state.srr1 |= (FE1_MASK|FE0_MASK);
- thread_set_state(t, PPC_THREAD_STATE, (natural_t*)&state, state_size);
-#else
- fprintf(stderr, "srr1 == 0x%08x, your Darwin is too old\n", state.srr1);
- exit(1);
-#endif
- }
- return NULL; /* Ok, we appear to be on Darwin 6.0 or later */
-}
-
-static void set_fpexc_precise(void)
-{
- thread_t self = mach_thread_self();
- pthread_t enabler;
-
- if (pthread_create(&enabler, NULL, fpu_fpe_enable, &self)) {
- perror("pthread_create");
- } else if (pthread_join(enabler, NULL)) {
- perror("pthread_join");
- }
-}
-
-#endif
-
-static void set_fpscr(unsigned int fpscr)
-{
- union {
- double d;
- unsigned int fpscr[2];
- } u;
-
- u.fpscr[0] = 0xFFF80000;
- u.fpscr[1] = fpscr;
- __asm__ __volatile__("mtfsf 255,%0" : : "f"(u.d));
-}
-
-static unsigned int get_fpscr(void)
-{
- union {
- double d;
- unsigned int fpscr[2];
- } u;
-
- __asm__("mffs %0" : "=f"(u.d));
- return u.fpscr[1];
-}
-
-static void unmask_fpe(void)
-{
- set_fpexc_precise();
- set_fpscr(0x80|0x40|0x10); /* VE, OE, ZE; not UE or XE */
-}
-
-static void unmask_fpe_conditional(int unmasked)
-{
- if (unmasked)
- unmask_fpe();
-}
-
-/* mask PowerPC FPE, return true if the previous state was unmasked */
-static int mask_fpe(void)
-{
- int unmasked;
-
- unmasked = (get_fpscr() & (0x80|0x40|0x10)) == (0x80|0x40|0x10);
- set_fpscr(0x00);
- return unmasked;
-}
-
-#else
-
-static void unmask_fpe(void)
-{
- fpsetmask(FP_X_INV | FP_X_OFL | FP_X_DZ);
-}
-
-static void unmask_fpe_conditional(int unmasked)
-{
- if (unmasked)
- unmask_fpe();
-}
-
-/* mask IEEE FPE, return true if previous state was unmasked */
-static int mask_fpe(void)
-{
- const fp_except unmasked_mask = FP_X_INV | FP_X_OFL | FP_X_DZ;
- fp_except old_mask;
-
- old_mask = fpsetmask(0);
- return (old_mask & unmasked_mask) == unmasked_mask;
-}
-
-#endif
-
-#if (defined(__linux__) && (defined(__i386__) || defined(__x86_64__) || defined(__sparc__) || defined(__powerpc__))) || (defined(__DARWIN__) && (defined(__i386__) || defined(__x86_64__) || defined(__ppc__))) || (defined(__FreeBSD__) && (defined(__x86_64__) || defined(__i386__))) || ((defined(__NetBSD__) || defined(__OpenBSD__)) && defined(__x86_64__)) || (defined(__sun__) && defined(__x86_64__))
-
-#if defined(__linux__) && defined(__i386__)
-#if !defined(X86_FXSR_MAGIC)
-#define X86_FXSR_MAGIC 0x0000
-#endif
-#elif defined(__FreeBSD__) && defined(__x86_64__)
-#include <sys/types.h>
-#include <machine/fpu.h>
-#elif defined(__FreeBSD__) && defined(__i386__)
-#include <sys/types.h>
-#include <machine/npx.h>
-#elif defined(__DARWIN__)
-#include <machine/signal.h>
-#elif defined(__OpenBSD__) && defined(__x86_64__)
-#include <sys/types.h>
-#include <machine/fpu.h>
-#endif
-#if !(defined(__OpenBSD__) && defined(__x86_64__))
-#include <ucontext.h>
-#endif
-#include <string.h>
-
-#if defined(__linux__) && defined(__x86_64__)
-#define mc_pc(mc) ((mc)->gregs[REG_RIP])
-#elif defined(__linux__) && defined(__i386__)
-#define mc_pc(mc) ((mc)->gregs[REG_EIP])
-#elif defined(__DARWIN__) && defined(__i386__)
-#ifdef DARWIN_MODERN_MCONTEXT
-#define mc_pc(mc) ((mc)->__ss.__eip)
-#else
-#define mc_pc(mc) ((mc)->ss.eip)
-#endif
-#elif defined(__DARWIN__) && defined(__x86_64__)
-#ifdef DARWIN_MODERN_MCONTEXT
-#define mc_pc(mc) ((mc)->__ss.__rip)
-#else
-#define mc_pc(mc) ((mc)->ss.rip)
-#endif
-#elif defined(__FreeBSD__) && defined(__x86_64__)
-#define mc_pc(mc) ((mc)->mc_rip)
-#elif defined(__FreeBSD__) && defined(__i386__)
-#define mc_pc(mc) ((mc)->mc_eip)
-#elif defined(__NetBSD__) && defined(__x86_64__)
-#define mc_pc(mc) ((mc)->__gregs[_REG_RIP])
-#elif defined(__NetBSD__) && defined(__i386__)
-#define mc_pc(mc) ((mc)->__gregs[_REG_EIP])
-#elif defined(__OpenBSD__) && defined(__x86_64__)
-#define mc_pc(mc) ((mc)->sc_rip)
-#elif defined(__sun__) && defined(__x86_64__)
-#define mc_pc(mc) ((mc)->gregs[REG_RIP])
-#endif
-
-static void fpe_sig_action(int sig, siginfo_t *si, void *puc)
-{
- ucontext_t *uc = puc;
- unsigned long pc;
-
-#if defined(__linux__)
-#if defined(__x86_64__)
- mcontext_t *mc = &uc->uc_mcontext;
- fpregset_t fpstate = mc->fpregs;
- pc = mc_pc(mc);
- /* A failed SSE2 instruction will restart. To avoid
- looping we mask SSE2 exceptions now and unmask them
- again later in erts_check_fpe()/erts_restore_fpu().
- On RISCs we update PC to skip the failed instruction,
- but the ever increasing complexity of the x86 instruction
- set encoding makes that a poor solution here. */
- fpstate->mxcsr = 0x1F80;
- fpstate->swd &= ~0xFF;
-#elif defined(__i386__)
- mcontext_t *mc = &uc->uc_mcontext;
- fpregset_t fpstate = mc->fpregs;
- pc = mc_pc(mc);
- if ((fpstate->status >> 16) == X86_FXSR_MAGIC)
- ((struct _fpstate*)fpstate)->mxcsr = 0x1F80;
- fpstate->sw &= ~0xFF;
-#elif defined(__sparc__) && defined(__arch64__)
- /* on SPARC the 3rd parameter points to a sigcontext not a ucontext */
- struct sigcontext *sc = (struct sigcontext*)puc;
- pc = sc->sigc_regs.tpc;
- sc->sigc_regs.tpc = sc->sigc_regs.tnpc;
- sc->sigc_regs.tnpc += 4;
-#elif defined(__sparc__)
- /* on SPARC the 3rd parameter points to a sigcontext not a ucontext */
- struct sigcontext *sc = (struct sigcontext*)puc;
- pc = sc->si_regs.pc;
- sc->si_regs.pc = sc->si_regs.npc;
- sc->si_regs.npc = (unsigned long)sc->si_regs.npc + 4;
-#elif defined(__powerpc__)
-#if defined(__powerpc64__)
- mcontext_t *mc = &uc->uc_mcontext;
- unsigned long *regs = &mc->gp_regs[0];
-#else
- mcontext_t *mc = uc->uc_mcontext.uc_regs;
- unsigned long *regs = &mc->gregs[0];
-#endif
- pc = regs[PT_NIP];
- regs[PT_NIP] += 4;
- regs[PT_FPSCR] = 0x80|0x40|0x10; /* VE, OE, ZE; not UE or XE */
-#endif
-#elif defined(__DARWIN__) && (defined(__i386__) || defined(__x86_64__))
-#ifdef DARWIN_MODERN_MCONTEXT
- mcontext_t mc = uc->uc_mcontext;
- pc = mc_pc(mc);
- mc->__fs.__fpu_mxcsr = 0x1F80;
- *(unsigned short *)&mc->__fs.__fpu_fsw &= ~0xFF;
-#else
- mcontext_t mc = uc->uc_mcontext;
- pc = mc_pc(mc);
- mc->fs.fpu_mxcsr = 0x1F80;
- *(unsigned short *)&mc->fs.fpu_fsw &= ~0xFF;
-#endif /* DARWIN_MODERN_MCONTEXT */
-#elif defined(__DARWIN__) && defined(__ppc__)
- mcontext_t mc = uc->uc_mcontext;
- pc = mc->ss.srr0;
- mc->ss.srr0 += 4;
- mc->fs.fpscr = 0x80|0x40|0x10;
-#elif defined(__FreeBSD__) && defined(__x86_64__)
- mcontext_t *mc = &uc->uc_mcontext;
- struct savefpu *savefpu = (struct savefpu*)&mc->mc_fpstate;
- struct envxmm *envxmm = &savefpu->sv_env;
- pc = mc_pc(mc);
- envxmm->en_mxcsr = 0x1F80;
- envxmm->en_sw &= ~0xFF;
-#elif defined(__FreeBSD__) && defined(__i386__)
- mcontext_t *mc = &uc->uc_mcontext;
- union savefpu *savefpu = (union savefpu*)&mc->mc_fpstate;
- pc = mc_pc(mc);
- if (mc->mc_fpformat == _MC_FPFMT_XMM) {
- struct envxmm *envxmm = &savefpu->sv_xmm.sv_env;
- envxmm->en_mxcsr = 0x1F80;
- envxmm->en_sw &= ~0xFF;
- } else {
- struct env87 *env87 = &savefpu->sv_87.sv_env;
- env87->en_sw &= ~0xFF;
- }
-#elif defined(__NetBSD__) && defined(__x86_64__)
- mcontext_t *mc = &uc->uc_mcontext;
- struct fxsave64 *fxsave = (struct fxsave64 *)&mc->__fpregs;
- pc = mc_pc(mc);
- fxsave->fx_mxcsr = 0x1F80;
- fxsave->fx_fsw &= ~0xFF;
-#elif defined(__NetBSD__) && defined(__i386__)
- mcontext_t *mc = &uc->uc_mcontext;
- pc = mc_pc(mc);
- if (uc->uc_flags & _UC_FXSAVE) {
- struct envxmm *envxmm = (struct envxmm *)&mc->__fpregs;
- envxmm->en_mxcsr = 0x1F80;
- envxmm->en_sw &= ~0xFF;
- } else {
- struct env87 *env87 = (struct env87 *)&mc->__fpregs;
- env87->en_sw &= ~0xFF;
- }
-#elif defined(__OpenBSD__) && defined(__x86_64__)
- struct fxsave64 *fxsave = uc->sc_fpstate;
- pc = mc_pc(uc);
- fxsave->fx_mxcsr = 0x1F80;
- fxsave->fx_fsw &= ~0xFF;
-#elif defined(__sun__) && defined(__x86_64__)
- mcontext_t *mc = &uc->uc_mcontext;
- struct fpchip_state *fpstate = &mc->fpregs.fp_reg_set.fpchip_state;
- pc = mc_pc(mc);
- fpstate->mxcsr = 0x1F80;
- fpstate->sw &= ~0xFF;
-#endif
-#if 0
- {
- char buf[64];
- snprintf(buf, sizeof buf, "%s: FPE at %p\r\n", __FUNCTION__, (void*)pc);
- write(2, buf, strlen(buf));
- }
-#endif
- set_current_fp_exception(pc);
-}
-
-static void erts_thread_catch_fp_exceptions(void)
-{
- struct sigaction act;
- memset(&act, 0, sizeof act);
- act.sa_sigaction = fpe_sig_action;
- act.sa_flags = SA_SIGINFO;
- sigaction(SIGFPE, &act, NULL);
- unmask_fpe();
-}
-
-#else /* !((__linux__ && (__i386__ || __x86_64__ || __powerpc__)) || (__DARWIN__ && (__i386__ || __x86_64__ || __ppc__))) */
-
-static void fpe_sig_handler(int sig)
-{
- set_current_fp_exception(1); /* XXX: convert to sigaction so we can get the trap PC */
-}
-
-static void erts_thread_catch_fp_exceptions(void)
-{
- sys_sigset(SIGFPE, fpe_sig_handler);
- unmask_fpe();
-}
-
-#endif /* (__linux__ && (__i386__ || __x86_64__ || __powerpc__)) || (__DARWIN__ && (__i386__ || __x86_64__ || __ppc__))) */
-
-/* once-only initialisation early in the main thread */
-void erts_sys_init_float(void)
-{
- erts_init_fp_exception();
- erts_thread_catch_fp_exceptions();
- erts_printf_block_fpe = erts_sys_block_fpe;
- erts_printf_unblock_fpe = erts_sys_unblock_fpe;
-}
-
-#endif /* NO_FPE_SIGNALS */
-
-void erts_thread_init_float(void)
-{
-#ifdef ERTS_SMP
- /* This allows Erlang schedulers to leave Erlang-process context
- and still have working FP exceptions. XXX: is this needed? */
- erts_thread_init_fp_exception();
-#endif
-
-#ifndef NO_FPE_SIGNALS
- /* NOTE:
- * erts_thread_disable_fpe() is called in all threads at
- * creation. We at least need to call unmask_fpe()
- */
-#if defined(__DARWIN__) || defined(__FreeBSD__)
- /* Darwin (7.9.0) does not appear to propagate FP exception settings
- to a new thread from its parent. So if we want FP exceptions, we
- must manually re-enable them in each new thread.
- FreeBSD 6.1 appears to suffer from a similar issue. */
- erts_thread_catch_fp_exceptions();
-#else
- unmask_fpe();
-#endif
-
-#endif
-}
-
-void erts_thread_disable_fpe(void)
-{
-#if !defined(NO_FPE_SIGNALS)
- (void)mask_fpe();
-#endif
-}
-
-#if !defined(NO_FPE_SIGNALS)
-int erts_sys_block_fpe(void)
-{
- return mask_fpe();
-}
-
-void erts_sys_unblock_fpe(int unmasked)
-{
- unmask_fpe_conditional(unmasked);
-}
-#endif
-
-/* The following check is incorporated from the Vee machine */
-
-#define ISDIGIT(d) ((d) >= '0' && (d) <= '9')
-
-/*
- ** Convert a double to ascii format 0.dddde[+|-]ddd
- ** return number of characters converted or -1 if error.
- **
- ** These two functions should maybe use localeconv() to pick up
- ** the current radix character, but since it is uncertain how
- ** expensive such a system call is, and since no-one has heard
- ** of other radix characters than '.' and ',' an ad-hoc
- ** low execution time solution is used instead.
- */
-
-int
-sys_double_to_chars_ext(double fp, char *buffer, size_t buffer_size, size_t decimals)
-{
- char *s = buffer;
-
- if (erts_snprintf(buffer, buffer_size, "%.*e", decimals, fp) >= buffer_size)
- return -1;
- /* Search upto decimal point */
- if (*s == '+' || *s == '-') s++;
- while (ISDIGIT(*s)) s++;
- if (*s == ',') *s++ = '.'; /* Replace ',' with '.' */
- /* Scan to end of string */
- while (*s) s++;
- return s-buffer; /* i.e strlen(buffer) */
-}
-
-/* Float conversion */
-
-int
-sys_chars_to_double(char* buf, double* fp)
-{
-#ifndef NO_FPE_SIGNALS
- volatile unsigned long *fpexnp = erts_get_current_fp_exception();
-#endif
- char *s = buf, *t, *dp;
-
- /* Robert says that something like this is what he really wanted:
- * (The [.,] radix test is NOT what Robert wanted - it was added later)
- *
- * 7 == sscanf(Tbuf, "%[+-]%[0-9][.,]%[0-9]%[eE]%[+-]%[0-9]%s", ....);
- * if (*s2 == 0 || *s3 == 0 || *s4 == 0 || *s6 == 0 || *s7)
- * break;
- */
-
- /* Scan string to check syntax. */
- if (*s == '+' || *s == '-') s++;
- if (!ISDIGIT(*s)) /* Leading digits. */
- return -1;
- while (ISDIGIT(*s)) s++;
- if (*s != '.' && *s != ',') /* Decimal part. */
- return -1;
- dp = s++; /* Remember decimal point pos just in case */
- if (!ISDIGIT(*s))
- return -1;
- while (ISDIGIT(*s)) s++;
- if (*s == 'e' || *s == 'E') {
- /* There is an exponent. */
- s++;
- if (*s == '+' || *s == '-') s++;
- if (!ISDIGIT(*s))
- return -1;
- while (ISDIGIT(*s)) s++;
- }
- if (*s) /* That should be it */
- return -1;
-
-#ifdef NO_FPE_SIGNALS
- errno = 0;
-#endif
- __ERTS_FP_CHECK_INIT(fpexnp);
- *fp = strtod(buf, &t);
- __ERTS_FP_ERROR_THOROUGH(fpexnp, *fp, return -1);
- if (t != s) { /* Whole string not scanned */
- /* Try again with other radix char */
- *dp = (*dp == '.') ? ',' : '.';
- errno = 0;
- __ERTS_FP_CHECK_INIT(fpexnp);
- *fp = strtod(buf, &t);
- __ERTS_FP_ERROR_THOROUGH(fpexnp, *fp, return -1);
- }
-
-#ifdef NO_FPE_SIGNALS
- if (errno == ERANGE) {
- if (*fp == HUGE_VAL || *fp == -HUGE_VAL) {
- /* overflow, should give error */
- return -1;
- } else if (t == s && *fp == 0.0) {
- /* This should give 0.0 - OTP-7178 */
- errno = 0;
-
- } else if (*fp == 0.0) {
- return -1;
- }
- }
-#endif
- return 0;
-}
-
-int
-matherr(struct exception *exc)
-{
-#if !defined(NO_FPE_SIGNALS)
- volatile unsigned long *fpexnp = erts_get_current_fp_exception();
- if (fpexnp != NULL)
- *fpexnp = (unsigned long)__builtin_return_address(0);
-#endif
- return 1;
-}
diff --git a/erts/emulator/sys/ose/sys_time.c b/erts/emulator/sys/ose/sys_time.c
deleted file mode 100644
index 5dac75956a..0000000000
--- a/erts/emulator/sys/ose/sys_time.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 2005-2009. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "sys.h"
-#include "global.h"
-
-/******************* Routines for time measurement *********************/
-
-int erts_ticks_per_sec = 0; /* Will be SYS_CLK_TCK in erl_unix_sys.h */
-
-int sys_init_time(void)
-{
- return SYS_CLOCK_RESOLUTION;
-}
-
-clock_t sys_times(SysTimes *now) {
- now->tms_utime = now->tms_stime = now->tms_cutime = now->tms_cstime = 0;
- return 0;
-}
-
-static OSTICK last_tick_count = 0;
-static SysHrTime wrap = 0;
-static OSTICK us_per_tick;
-
-void sys_init_hrtime() {
- us_per_tick = system_tick();
-}
-
-SysHrTime sys_gethrtime() {
- OSTICK ticks = get_ticks();
- if (ticks < (SysHrTime) last_tick_count) {
- wrap += 1ULL << 32;
- }
- last_tick_count = ticks;
- return ((((SysHrTime) ticks) + wrap) * 1000*us_per_tick);
-}
diff --git a/erts/emulator/test/alloc_SUITE.erl b/erts/emulator/test/alloc_SUITE.erl
index 7c7ddde5d4..3ad1b88b2d 100644
--- a/erts/emulator/test/alloc_SUITE.erl
+++ b/erts/emulator/test/alloc_SUITE.erl
@@ -113,13 +113,10 @@ cpool(doc) -> [];
cpool(Cfg) -> ?line drv_case(Cfg).
erts_mmap(Config) when is_list(Config) ->
- case {?t:os_type(), is_halfword_vm()} of
- {{unix, _}, false} ->
+ case ?t:os_type() of
+ {unix, _} ->
[erts_mmap_do(Config, SCO, SCRPM, SCRFSD)
|| SCO <-[true,false], SCRFSD <-[1234,0], SCRPM <- [true,false]];
-
- {_,true} ->
- {skipped, "No supercarrier support on halfword vm"};
{SkipOs,_} ->
?line {skipped,
lists:flatten(["Not run on "
@@ -254,10 +251,3 @@ start_node(Config, Opts) when is_list(Config), is_list(Opts) ->
stop_node(Node) ->
?t:stop_node(Node).
-
-is_halfword_vm() ->
- case {erlang:system_info({wordsize, internal}),
- erlang:system_info({wordsize, external})} of
- {4, 8} -> true;
- {WS, WS} -> false
- end.
diff --git a/erts/emulator/test/bif_SUITE.erl b/erts/emulator/test/bif_SUITE.erl
index d6a771e7b9..ebc4db53c4 100644
--- a/erts/emulator/test/bif_SUITE.erl
+++ b/erts/emulator/test/bif_SUITE.erl
@@ -32,7 +32,8 @@
specs/1,improper_bif_stubs/1,auto_imports/1,
t_list_to_existing_atom/1,os_env/1,otp_7526/1,
binary_to_atom/1,binary_to_existing_atom/1,
- atom_to_binary/1,min_max/1, erlang_halt/1]).
+ atom_to_binary/1,min_max/1, erlang_halt/1,
+ is_builtin/1]).
suite() -> [{ct_hooks,[ts_install_cth]}].
@@ -42,7 +43,7 @@ all() ->
t_list_to_existing_atom, os_env, otp_7526,
display,
atom_to_binary, binary_to_atom, binary_to_existing_atom,
- min_max, erlang_halt].
+ min_max, erlang_halt, is_builtin].
groups() ->
[].
@@ -716,6 +717,22 @@ wait_until_stable_size(File,PrevSz) ->
wait_until_stable_size(File,NewSz)
end.
+is_builtin(_Config) ->
+ Exp0 = [{M,F,A} || {M,_} <- code:all_loaded(),
+ {F,A} <- M:module_info(exports)],
+ Exp = ordsets:from_list(Exp0),
+
+ %% erlang:apply/3 is considered to be built-in, but is not
+ %% implemented as other BIFs.
+
+ Builtins0 = [{erlang,apply,3}|erlang:system_info(snifs)],
+ Builtins = ordsets:from_list(Builtins0),
+ NotBuiltin = ordsets:subtract(Exp, Builtins),
+ _ = [true = erlang:is_builtin(M, F, A) || {M,F,A} <- Builtins],
+ _ = [false = erlang:is_builtin(M, F, A) || {M,F,A} <- NotBuiltin],
+
+ ok.
+
%% Helpers
diff --git a/erts/emulator/test/driver_SUITE.erl b/erts/emulator/test/driver_SUITE.erl
index 4211c49848..b72d6cbe52 100644
--- a/erts/emulator/test/driver_SUITE.erl
+++ b/erts/emulator/test/driver_SUITE.erl
@@ -1877,10 +1877,7 @@ mseg_alloc_cached_segments() ->
mseg_alloc_cached_segments(mseg_inst_info(0)).
mseg_alloc_cached_segments(MsegAllocInfo) ->
- MemName = case is_halfword_vm() of
- true -> "high memory";
- false -> "all memory"
- end,
+ MemName = "all memory",
?line [{memkind,DrvMem}]
= lists:filter(fun(E) -> case E of
{memkind, [{name, MemName} | _]} -> true;
@@ -1899,13 +1896,6 @@ mseg_inst_info(I) ->
erlang:system_info({allocator,mseg_alloc})),
Value.
-is_halfword_vm() ->
- case {erlang:system_info({wordsize, internal}),
- erlang:system_info({wordsize, external})} of
- {4, 8} -> true;
- {WS, WS} -> false
- end.
-
driver_alloc_sbct() ->
{_, _, _, As} = erlang:system_info(allocator),
case lists:keysearch(driver_alloc, 1, As) of
diff --git a/erts/emulator/test/emulator.spec.ose b/erts/emulator/test/emulator.spec.ose
deleted file mode 100644
index 9f494609d9..0000000000
--- a/erts/emulator/test/emulator.spec.ose
+++ /dev/null
@@ -1,2 +0,0 @@
-{topcase, {dir, "../emulator_test"}}.
-{skip, {obsolete_SUITE, "Not on ose"}}.
diff --git a/erts/emulator/test/num_bif_SUITE.erl b/erts/emulator/test/num_bif_SUITE.erl
index f07f79b83d..90b6a36262 100644
--- a/erts/emulator/test/num_bif_SUITE.erl
+++ b/erts/emulator/test/num_bif_SUITE.erl
@@ -429,7 +429,7 @@ t_string_to_integer(Config) when is_list(Config) ->
list_to_binary(Value))),
{'EXIT', {badarg, _}} =
(catch erlang:list_to_integer(Value))
- end,["1.0"," 1"," -1",""]),
+ end,["1.0"," 1"," -1","","+"]),
% Custom base error cases
lists:foreach(fun({Value,Base}) ->
diff --git a/erts/emulator/test/process_SUITE.erl b/erts/emulator/test/process_SUITE.erl
index 4c311e1f06..97aa5e573e 100644
--- a/erts/emulator/test/process_SUITE.erl
+++ b/erts/emulator/test/process_SUITE.erl
@@ -1478,7 +1478,15 @@ processes_this_tab(doc) ->
processes_this_tab(suite) ->
[];
processes_this_tab(Config) when is_list(Config) ->
- sys_mem_cond_run(1024, fun () -> chk_processes_bif_test_res(processes_bif_test()) end).
+ Mem = case {erlang:system_info(build_type),
+ erlang:system_info(allocator)} of
+ {lcnt, {_, _Vsn, [sys_alloc], _Opts}} ->
+ %% When running +Mea min + lcnt we may need more memory
+ 1024 * 4;
+ _ ->
+ 1024
+ end,
+ sys_mem_cond_run(Mem, fun () -> chk_processes_bif_test_res(processes_bif_test()) end).
chk_processes_bif_test_res(ok) -> ok;
chk_processes_bif_test_res({comment, _} = Comment) -> Comment;
diff --git a/erts/emulator/test/system_info_SUITE.erl b/erts/emulator/test/system_info_SUITE.erl
index bee42c07d9..51122e5d55 100644
--- a/erts/emulator/test/system_info_SUITE.erl
+++ b/erts/emulator/test/system_info_SUITE.erl
@@ -185,8 +185,6 @@ wordsize(Config) when is_list(Config) ->
{comment, "True 32-bit emulator"};
{8,8} ->
{comment, "True 64-bit emulator"};
- {8,4} ->
- {comment, "Halfword 64-bit emulator"};
Other ->
exit({unexpected_wordsizes,Other})
end.
diff --git a/erts/emulator/utils/beam_makeops b/erts/emulator/utils/beam_makeops
index 9a8c3585e6..f805e7cc64 100755
--- a/erts/emulator/utils/beam_makeops
+++ b/erts/emulator/utils/beam_makeops
@@ -48,12 +48,17 @@ $pack_shift[4] = ['0', 'BEAM_LOOSE_SHIFT', # Only for 64 bit wordsize
'(3*BEAM_LOOSE_SHIFT)'];
$pack_mask[2] = ['BEAM_LOOSE_MASK', $WHOLE_WORD];
-$pack_mask[3] = ['BEAM_TIGHT_MASK', 'BEAM_TIGHT_MASK', 'BEAM_TIGHT_MASK'];
+$pack_mask[3] = ['BEAM_TIGHT_MASK', 'BEAM_TIGHT_MASK', $WHOLE_WORD];
$pack_mask[4] = ['BEAM_LOOSE_MASK', # Only for 64 bit wordsize
'BEAM_LOOSE_MASK',
'BEAM_LOOSE_MASK',
$WHOLE_WORD];
+# Mapping from packagable arguments to number of packed arguments per
+# word. Initialized after the wordsize is known.
+
+my @args_per_word;
+
# There are two types of instructions: generic and specific.
# The generic instructions are those generated by the Beam compiler.
# Corresponding to each generic instruction, there is generally a
@@ -176,11 +181,12 @@ sub define_type_bit {
}
# Composed types.
- define_type_bit('d', $type_bit{'x'} | $type_bit{'y'} | $type_bit{'r'});
+ define_type_bit('d', $type_bit{'x'} | $type_bit{'y'});
define_type_bit('c', $type_bit{'i'} | $type_bit{'a'} |
$type_bit{'n'} | $type_bit{'q'});
define_type_bit('s', $type_bit{'d'} | $type_bit{'i'} |
- $type_bit{'a'} | $type_bit{'n'});
+ $type_bit{'a'} | $type_bit{'n'} |
+ $type_bit{'q'});
define_type_bit('j', $type_bit{'f'} | $type_bit{'p'});
# Aliases (for matching purposes).
@@ -236,6 +242,20 @@ while (@ARGV && $ARGV[0] =~ /^-(.*)/) {
}
#
+# Initialize number of arguments per packed word.
+#
+
+$args_per_word[2] = 2;
+$args_per_word[3] = 3;
+$args_per_word[4] = 2;
+$args_per_word[5] = 3;
+$args_per_word[6] = 3;
+
+if ($wordsize == 64) {
+ $args_per_word[4] = 4;
+}
+
+#
# Parse the input files.
#
@@ -527,12 +547,16 @@ sub emulator_output {
my(@bits) = (0) x ($max_spec_operands/2);
my($i);
+ my $involves_r = 0;
for ($i = 0; $i < $max_spec_operands && defined $args[$i]; $i++) {
my $t = $args[$i];
- if (defined $type_bit{$t}) {
- my $shift = $max_genop_types * ($i % 2);
- $bits[int($i/2)] |= $type_bit{$t} << $shift;
+ my $bits = $type_bit{$t};
+ if ($t eq 'r') {
+ $bits |= $type_bit{'x'};
+ $involves_r |= 1 << $i;
}
+ my $shift = $max_genop_types * ($i % 2);
+ $bits[int($i/2)] |= $bits << $shift;
}
printf "/* %3d */ ", $spec_opnum;
@@ -544,7 +568,7 @@ sub emulator_output {
$sep = ",";
}
$init .= "}";
- &init_item($print_name, $init, $size, $pack, $sign, 0);
+ init_item($print_name, $init, $involves_r, $size, $pack, $sign, 0);
$op_to_name[$spec_opnum] = $instr;
$spec_opnum++;
}
@@ -601,15 +625,12 @@ sub emulator_output {
print "#define MAX_GENERIC_OPCODE ", $num_file_opcodes-1, "\n";
print "#define NUM_GENERIC_OPS ", scalar(@gen_opname), "\n";
print "#define NUM_SPECIFIC_OPS ", scalar(@op_to_name), "\n";
+ print "#define SCRATCH_X_REG 1023\n";
print "\n";
print "#ifdef ARCH_64\n";
print "# define BEAM_WIDE_MASK 0xFFFFUL\n";
- print "# define BEAM_LOOSE_MASK 0x1FFFUL\n";
- print "#if HALFWORD_HEAP\n";
- print "# define BEAM_TIGHT_MASK 0x1FFCUL\n";
- print "#else\n";
- print "# define BEAM_TIGHT_MASK 0x1FF8UL\n";
- print "#endif\n";
+ print "# define BEAM_LOOSE_MASK 0xFFFFUL\n";
+ print "# define BEAM_TIGHT_MASK 0xFFFFUL\n";
print "# define BEAM_WIDE_SHIFT 32\n";
print "# define BEAM_LOOSE_SHIFT 16\n";
print "# define BEAM_TIGHT_SHIFT 16\n";
@@ -734,7 +755,7 @@ sub init_item {
print "${sep}NULL";
} elsif (/^\{/) {
print "$sep$_";
- } elsif (/^-?\d/) {
+ } elsif (/^-?\d+$/) {
print "$sep$_";
} else {
print "$sep\"$_\"";
@@ -896,6 +917,7 @@ sub basic_generator {
my($var_decls) = '';
my($gen_dest_arg) = 'StoreSimpleDest';
my($i);
+ my($no_prefetch) = 0;
# The following argument types should be included as macro arguments.
my(%incl_arg) = ('c' => 1,
@@ -994,6 +1016,7 @@ sub basic_generator {
#
$flags =~ /-fail_action/ and do {
+ $no_prefetch = 1;
if (!defined $fail_type) {
my($i);
for ($i = 0; $i < @f_types; $i++) {
@@ -1040,6 +1063,12 @@ sub basic_generator {
"I += $size + 1;",
"goto $goto;",
"}");
+ } elsif ($no_prefetch) {
+ $code = join("\n",
+ "{ $var_decls",
+ $macro_code,
+ "Next($size);",
+ "}", "");
} else {
$code = join("\n",
"{ $var_decls",
@@ -1061,6 +1090,7 @@ sub do_pack {
my($packable_args) = 0;
my @is_packable; # Packability (boolean) for each argument.
my $wide_packing = 0;
+ my(@orig_args) = @args;
#
# Count the number of packable arguments. If we encounter any 's' or 'd'
@@ -1081,6 +1111,18 @@ sub do_pack {
}
} elsif ($arg =~ /^[sd]/) {
return ('', '', @args);
+ } elsif ($arg =~ /^[scq]/ and $packable_args > 0) {
+ # When packing, this operand will be picked up from the
+ # code array, put onto the packing stack, and later put
+ # back into a different location in the code. The problem
+ # is that if this operand is a literal, the original
+ # location in the code would have been remembered in a
+ # literal patch. For packing to work, we would have to
+ # adjust the position in the literal patch. For the
+ # moment, adding additional instructions to the packing
+ # engine to handle this does not seem worth it, so we will
+ # just turn off packing.
+ return ('', '', @args);
} else {
push @is_packable, 0;
}
@@ -1090,7 +1132,6 @@ sub do_pack {
# Get out of here if too few or too many arguments.
#
return ('', '', @args) if $packable_args < 2;
- &error("too many packable arguments") if $packable_args > 4;
my($size) = 0;
my($pack_prefix) = '';
@@ -1098,14 +1139,8 @@ sub do_pack {
# beginning).
my($up) = ''; # Pack commands (storing back while
# moving forward).
- my $args_per_word;
- if ($packable_args < 4 or $wordsize == 64) {
- $args_per_word = $packable_args;
- } else {
- # 4 packable argument, 32 bit wordsize. Need 2 words.
- $args_per_word = 2;
- }
+ my $args_per_word = $args_per_word[$packable_args];
my @shift;
my @mask;
my @instr;
@@ -1299,6 +1334,8 @@ sub tr_parse_op {
foreach (split('', $type)) {
&error("bad type in $op")
unless defined $type_bit{$_} or $type eq '*';
+ $_ eq 'r' and
+ error("$op: 'r' is not allowed in transformations")
}
}
@@ -1332,7 +1369,10 @@ sub tr_parse_op {
}
# Get an optional value. (In destination.)
+ $type_val = $type eq 'x' ? 1023 : 0;
if (/^=(.*)/) {
+ error("value not allowed in source: $op")
+ if $src;
$type_val = $1;
$_ = '';
}
@@ -1351,11 +1391,6 @@ sub tr_parse_op {
if $var && $type;
}
- # Test that source has no values.
- if ($src) {
- error("value not allowed in source: $op")
- if $type_val;
- }
($var,$type,$type_val,$cond,$cond_val);
}
diff --git a/erts/emulator/utils/make_alloc_types b/erts/emulator/utils/make_alloc_types
index 88f537ea09..925b9d5810 100755
--- a/erts/emulator/utils/make_alloc_types
+++ b/erts/emulator/utils/make_alloc_types
@@ -246,7 +246,7 @@ print DST "
print DST "#define ERTS_ALC_C_MIN ($c_no)\n\n";
-foreach my $c (keys(%c_tab)) {
+foreach my $c (sort keys(%c_tab)) {
push(@c_order, $c);
set_number($c_tab{$c}, $c_no);
print DST "#define ERTS_ALC_C_$c ($c_no)\n";
diff --git a/erts/emulator/utils/make_version b/erts/emulator/utils/make_version
index 3461dc1637..37bdff181a 100755
--- a/erts/emulator/utils/make_version
+++ b/erts/emulator/utils/make_version
@@ -59,7 +59,11 @@ print FILE <<EOF;
#define ERLANG_OTP_RELEASE "$release"
#define ERLANG_OTP_VERSION "$otp_version"
#define ERLANG_VERSION "$version"
-#define ERLANG_COMPILE_DATE "$time_str"
+#if ERTS_SAVED_COMPILE_TIME
+# define ERLANG_COMPILE_DATE "$time_str"
+#else
+# define ERLANG_COMPILE_DATE ""
+#endif
#define ERLANG_ARCHITECTURE "$architecture"
EOF
diff --git a/erts/emulator/utils/mkver.c b/erts/emulator/utils/mkver.c
index 96cd315a95..6641873712 100644
--- a/erts/emulator/utils/mkver.c
+++ b/erts/emulator/utils/mkver.c
@@ -35,8 +35,10 @@ int argc;
char** argv;
{
FILE *file;
+#if ERTS_SAVED_COMPILE_TIME
time_t now;
- char *cnow;
+#endif
+ char *cnow = "";
if (argc != 2) {
fprintf(stderr, "usage: mkver version\n");
@@ -48,9 +50,11 @@ char** argv;
exit(1);
}
+#if ERTS_SAVED_COMPILE_TIME
time(&now);
cnow = ctime(&now);
cnow[24] = '\0'; /* tidelipom */
+#endif
fprintf(file, "/* This file was created by mkver -- don't modify.*/\n");
fprintf(file, "#define ERLANG_VERSION \"%s\"\n", argv[1]);
fprintf(file, "#define ERLANG_COMPILE_DATE \"%s\"\n", cnow);
diff --git a/erts/emulator/valgrind/suppress.halfword b/erts/emulator/valgrind/suppress.halfword
deleted file mode 100644
index 8fe448d897..0000000000
--- a/erts/emulator/valgrind/suppress.halfword
+++ /dev/null
@@ -1,56 +0,0 @@
-# Extra suppressions specific for the halfword emulator.
-
-# --- Suppress all offheap binaries ---
-# Valgrinds leak check does not recognize pointers that are stored
-# at unaligned addresses. In halfword emulator we store 64-bit pointers
-# to offheap data on 32-bit aligned heaps.
-# We solve this by suppressing allocation of all offheap structures
-# that are not referenced by other tables (ie binaries).
-
-{
-Halfword erts_bin_nrml_alloc
-Memcheck:Leak
-...
-fun:erts_bin_nrml_alloc
-...
-}
-
-{
-Halfword erts_bin_realloc
-Memcheck:Leak
-...
-fun:erts_bin_realloc
-...
-}
-
-{
-Halfword erts_bin_realloc_fnf
-Memcheck:Leak
-...
-fun:erts_bin_realloc_fnf
-...
-}
-
-{
-Halfword erts_bin_drv_alloc
-Memcheck:Leak
-...
-fun:erts_bin_drv_alloc
-...
-}
-
-{
-Halfword erts_bin_drv_alloc_fnf
-Memcheck:Leak
-...
-fun:erts_bin_drv_alloc_fnf
-...
-}
-
-{
-Halfword erts_create_magic_binary
-Memcheck:Leak
-...
-fun:erts_create_magic_binary
-...
-}
diff --git a/erts/epmd/src/Makefile.in b/erts/epmd/src/Makefile.in
index b6e3ba7762..1266be44cb 100644
--- a/erts/epmd/src/Makefile.in
+++ b/erts/epmd/src/Makefile.in
@@ -19,10 +19,6 @@
#
include $(ERL_TOP)/make/target.mk
-ifeq ($(findstring ose,$(TARGET)),ose)
-include $(ERL_TOP)/make/$(TARGET)/ose_lm.mk
-endif
-
ifeq ($(TYPE),debug)
PURIFY =
TYPEMARKER = .debug
@@ -32,21 +28,13 @@ else
ifeq ($(TYPE),purify)
PURIFY = purify
TYPEMARKER =
-ifeq ($(findstring ose,$(TARGET)),ose)
- TYPE_FLAGS = -DPURIFY
-else
- TYPE_FLAGS = -O2 -DPURIFY
-endif
+TYPE_FLAGS = -O2 -DPURIFY
else
override TYPE = opt
PURIFY =
TYPEMARKER =
-ifeq ($(findstring ose,$(TARGET)),ose)
- TYPE_FLAGS =
-else
- TYPE_FLAGS = -O2
-endif
+TYPE_FLAGS = -O2
endif
endif
@@ -68,13 +56,9 @@ else
ifeq ($(findstring vxworks,$(TARGET)),vxworks)
ERTS_INTERNAL_LIBS=-L../../lib/internal/$(TARGET) -lerts_internal$(ERTS_LIB_TYPEMARKER) @ERTS_INTERNAL_X_LIBS@
else
-ifeq ($(findstring ose,$(TARGET)),ose)
-ERTS_INTERNAL_LIBS=-L../../lib/internal/$(TARGET) -lerts_internal$(ERTS_LIB_TYPEMARKER) @ERTS_INTERNAL_X_LIBS@
-else
ERTS_INTERNAL_LIBS=-L../../lib/internal/$(TARGET) -lerts_internal$(ERTS_LIB_TYPEMARKER) @ERTS_INTERNAL_X_LIBS@ -lm
endif
endif
-endif
ERTS_LIB = $(ERL_TOP)/erts/lib_src/obj/$(TARGET)/$(TYPE)/MADE
@@ -82,11 +66,7 @@ CC = @CC@
WFLAGS = @WFLAGS@
CFLAGS = @CFLAGS@ @DEFS@ $(TYPE_FLAGS) $(WFLAGS) $(ERTS_INCL)
LD = @LD@
-ifeq ($(findstring ose,$(TARGET)),ose)
-LIBS = $(ERTS_INTERNAL_LIBS) @LIBS@
-else
LIBS = @LIBS@ @SYSTEMD_DAEMON_LIBS@ $(ERTS_INTERNAL_LIBS)
-endif
LDFLAGS = @LDFLAGS@
@@ -135,25 +115,12 @@ clean:
rm -f *.o
rm -f *~ core
-ifeq ($(findstring ose,$(TARGET)),ose)
-$(OBJDIR)/ose_confd.o: $(OSE_CONFD)
- $(V_CC) $(CFLAGS) -o $@ -c $<
-$(OBJDIR)/crt0_lm.o: $(CRT0_LM)
- $(V_CC) $(CFLAGS) -o $@ -c $<
-OSE_LM_OBJS += $(OBJDIR)/ose_confd.o $(OBJDIR)/crt0_lm.o
-endif
-
#
# Objects & executables
#
-ifeq ($(findstring ose,$(TARGET)),ose)
-$(BINDIR)/$(EPMD): $(EPMD_OBJS) $(ERTS_LIB) $(OSE_LM_OBJS)
- $(call build-ose-load-module, $@, $(EPMD_OBJS) $(OSE_LM_OBJS), $(LIBS), $(EPMD_LMCONF))
-else
$(BINDIR)/$(EPMD): $(EPMD_OBJS) $(ERTS_LIB)
$(ld_verbose)$(PURIFY) $(LD) $(LDFLAGS) -o $@ $(EPMD_OBJS) $(LIBS)
-endif
$(OBJDIR)/%.o: %.c epmd.h epmd_int.h
$(V_CC) $(CFLAGS) $(EPMD_FLAGS) -o $@ -c $<
diff --git a/erts/epmd/src/epmd.c b/erts/epmd/src/epmd.c
index 132bda725c..7c373509be 100644
--- a/erts/epmd/src/epmd.c
+++ b/erts/epmd/src/epmd.c
@@ -397,7 +397,7 @@ static void run_daemon(EpmdVars *g)
}
#endif
-#if defined(VXWORKS) || defined(__OSE__)
+#if defined(VXWORKS)
static void run_daemon(EpmdVars *g)
{
run(g);
diff --git a/erts/epmd/src/epmd_int.h b/erts/epmd/src/epmd_int.h
index 26100afc93..e222abb4b7 100644
--- a/erts/epmd/src/epmd_int.h
+++ b/erts/epmd/src/epmd_int.h
@@ -37,13 +37,6 @@
#define DONT_USE_MAIN
#endif
-#ifdef __OSE__
-# define NO_DAEMON
-# define NO_SYSLOG
-# define NO_SYSCONF
-# define NO_FCNTL
-#endif
-
/* ************************************************************************ */
/* Standard includes */
@@ -100,12 +93,7 @@
#endif /* ! WIN32 */
#include <ctype.h>
-
-#if !defined(__OSE__)
-# include <signal.h>
-#endif
-
-
+#include <signal.h>
#include <errno.h>
#ifdef HAVE_SYSLOG_H
@@ -122,10 +110,6 @@
#include <stdarg.h>
-#ifdef __OSE__
-# include "sys/select.h"
-#endif
-
#ifdef HAVE_SYSTEMD_DAEMON
# include <systemd/sd-daemon.h>
#endif /* HAVE_SYSTEMD_DAEMON */
diff --git a/erts/epmd/src/epmd_srv.c b/erts/epmd/src/epmd_srv.c
index 8c8d7304f2..829eb4c74d 100644
--- a/erts/epmd/src/epmd_srv.c
+++ b/erts/epmd/src/epmd_srv.c
@@ -30,11 +30,6 @@
# define INADDR_NONE 0xffffffff
#endif
-#if defined(__OSE__)
-# include "sys/ioctl.h"
-# define sleep(x) delay(x*1000)
-#endif
-
/*
*
* This server is a local name server for Erlang nodes. Erlang nodes can
@@ -315,7 +310,7 @@ void run(EpmdVars *g)
}
#endif /* HAVE_SYSTEMD_DAEMON */
-#if !defined(__WIN32__) && !defined(__OSE__)
+#if !defined(__WIN32__)
/* We ignore the SIGPIPE signal that is raised when we call write
twice on a socket closed by the other end. */
signal(SIGPIPE, SIG_IGN);
diff --git a/erts/etc/common/Makefile.in b/erts/etc/common/Makefile.in
index 8e55fa78c9..05d925f19f 100644
--- a/erts/etc/common/Makefile.in
+++ b/erts/etc/common/Makefile.in
@@ -21,10 +21,6 @@
include $(ERL_TOP)/make/output.mk
include $(ERL_TOP)/make/target.mk
-ifeq ($(findstring ose,$(TARGET)),ose)
-include $(ERL_TOP)/make/$(TARGET)/ose_lm.mk
-endif
-
ERTS_LIB_TYPEMARKER=.$(TYPE)
USING_MINGW=@MIXED_CYGWIN_MINGW@
@@ -85,18 +81,13 @@ EMUOSDIR = $(ERL_TOP)/erts/emulator/@ERLANG_OSTYPE@
SYSDIR = $(ERL_TOP)/erts/emulator/sys/@ERLANG_OSTYPE@
DRVDIR = $(ERL_TOP)/erts/emulator/drivers/@ERLANG_OSTYPE@
UXETC = ../unix
-OSEETC = ../ose
WINETC = ../win32
ifeq ($(TARGET), win32)
ETC = $(WINETC)
else
-ifeq ($(findstring ose,$(TARGET)),ose)
-ETC = $(OSEETC)
-else
ETC = $(UXETC)
endif
-endif
ifeq ($(TARGET), win32)
ERLEXEC = erlexec.dll
@@ -180,25 +171,6 @@ PORT_ENTRY_POINT=erl_port_entry
ENTRY_LDFLAGS=-entry:$(PORT_ENTRY_POINT)
else
-ifeq ($(findstring ose,$(TARGET)),ose)
-ENTRY_LDFLAGS=
-ENTRY_OBJ=
-ERLSRV_OBJECTS=
-MC_OUTPUTS=
-INET_GETHOST =
-INSTALL_EMBEDDED_PROGS = $(BINDIR)/run_erl_lm
-INSTALL_EMBEDDED_DATA =
-INSTALL_TOP = Install
-INSTALL_TOP_BIN =
-INSTALL_MISC =
-INSTALL_SRC =
-ERLEXECDIR = .
-INSTALL_LIBS =
-INSTALL_OBJS =
-INSTALL_INCLUDES =
-TEXTFILES = Install erl.src
-INSTALL_PROGS = $(INSTALL_EMBEDDED_PROGS)
-else # UNIX (!win32 && !ose)
ENTRY_LDFLAGS=
ENTRY_OBJ=
ERLSRV_OBJECTS=
@@ -223,7 +195,6 @@ INSTALL_PROGS = \
$(BINDIR)/$(ERLEXEC) \
$(INSTALL_EMBEDDED_PROGS)
endif
-endif
.PHONY: etc
etc: $(ENTRY_OBJ) $(INSTALL_PROGS) $(INSTALL_LIBS) $(TEXTFILES) $(INSTALL_TOP_BIN)
@@ -269,8 +240,8 @@ endif
rm -f $(ERL_TOP)/erts/obj*/$(TARGET)/to_erl.o
rm -f $(ERL_TOP)/erts/obj*/$(TARGET)/dyn_erl.o
rm -f $(ERL_TOP)/erts/obj*/$(TARGET)/safe_string.o
- rm -f $(ERL_TOP)/erts/obj*/$(TARGET)/run_erl_common.o
- rm -f $(ERL_TOP)/erts/obj*/$(TARGET)/to_erl_common.o
+ rm -f $(ERL_TOP)/erts/obj*/$(TARGET)/run_erl.o
+ rm -f $(ERL_TOP)/erts/obj*/$(TARGET)/to_erl.o
rm -f $(ERL_TOP)/erts/obj*/$(TARGET)/typer.o
rm -f $(ERL_TOP)/erts/obj*/$(TARGET)/ct_run.o
rm -f $(ERL_TOP)/erts/obj*/$(TARGET)/vxcall.o
@@ -423,28 +394,24 @@ $(BINDIR)/inet_gethost@EXEEXT@: $(OBJDIR)/inet_gethost.o $(ENTRY_OBJ) $(ERTS_LIB
$(ld_verbose)$(PURIFY) $(LD) $(LDFLAGS) $(ENTRY_LDFLAGS) -o $@ $(OBJDIR)/inet_gethost.o $(ENTRY_OBJ) $(LIBS) $(ERTS_INTERNAL_LIBS)
# run_erl
-$(BINDIR)/run_erl: $(OBJDIR)/safe_string.o $(OBJDIR)/run_erl.o $(OBJDIR)/run_erl_common.o
- $(V_LD) $(LDFLAGS) -o $@ $^ $(LIBS)
-$(OBJDIR)/run_erl.o: $(ETC)/run_erl.c ../common/run_erl_common.h $(RC_GENERATED)
- $(V_CC) $(CFLAGS) -I ../common/ -o $@ -c $(ETC)/run_erl.c
-$(OBJDIR)/run_erl_common.o: ../common/run_erl_common.c ../common/run_erl_common.h $(RC_GENERATED)
- $(V_CC) $(CFLAGS) -o $@ -c $<
+$(BINDIR)/run_erl: $(OBJDIR)/safe_string.o $(OBJDIR)/run_erl.o
+ $(V_LD) $(LDFLAGS) -o $@ $(OBJDIR)/safe_string.o $(OBJDIR)/run_erl.o $(LIBS)
+$(OBJDIR)/run_erl.o: $(ETC)/run_erl.c $(RC_GENERATED)
+ $(V_CC) $(CFLAGS) -o $@ -c $(ETC)/run_erl.c
# to_erl
-$(BINDIR)/to_erl: $(OBJDIR)/safe_string.o $(OBJDIR)/to_erl.o $(OBJDIR)/to_erl_common.o
- $(V_LD) $(LDFLAGS) -o $@ $^
-$(OBJDIR)/to_erl.o: $(ETC)/to_erl.c ../common/safe_string.h $(RC_GENERATED)
- $(V_CC) $(CFLAGS) -I ../common/ -o $@ -c $(ETC)/to_erl.c
-$(OBJDIR)/to_erl_common.o: ../common/to_erl_common.c ../common/to_erl_common.h $(RC_GENERATED)
- $(V_CC) $(CFLAGS) -o $@ -c $<
+$(BINDIR)/to_erl: $(OBJDIR)/safe_string.o $(OBJDIR)/to_erl.o
+ $(V_LD) $(LDFLAGS) -o $@ $(OBJDIR)/safe_string.o $(OBJDIR)/to_erl.o
+$(OBJDIR)/to_erl.o: $(ETC)/to_erl.c $(RC_GENERATED)
+ $(V_CC) $(CFLAGS) -o $@ -c $(ETC)/to_erl.c
# dyn_erl
$(BINDIR)/dyn_erl: $(OBJDIR)/safe_string.o $(OBJDIR)/dyn_erl.o
$(V_LD) $(LDFLAGS) -o $@ $(OBJDIR)/safe_string.o $(OBJDIR)/dyn_erl.o
$(OBJDIR)/dyn_erl.o: $(UXETC)/dyn_erl.c $(RC_GENERATED)
$(V_CC) $(CFLAGS) -o $@ -c $(UXETC)/dyn_erl.c
-$(OBJDIR)/safe_string.o: ../common/safe_string.c $(RC_GENERATED)
- $(V_CC) $(CFLAGS) -o $@ -c ../common/safe_string.c
+$(OBJDIR)/safe_string.o: $(ETC)/safe_string.c $(RC_GENERATED)
+ $(V_CC) $(CFLAGS) -o $@ -c $(ETC)/safe_string.c
ifneq ($(TARGET),win32)
$(BINDIR)/$(ERLEXEC): $(OBJDIR)/$(ERLEXEC).o $(ERTS_LIB)
@@ -499,30 +466,6 @@ erl.src: $(UXETC)/erl.src.src ../../vsn.mk $(TARGET)/Makefile
-e 's;%VSN%;$(VSN);' \
$(UXETC)/erl.src.src > erl.src
-#---------------------------------------------------------
-# OSE specific targets
-#---------------------------------------------------------
-ifeq ($(findstring ose,$(TARGET)),ose)
-$(OBJDIR)/ose_confd.o: $(OSE_CONFD)
- $(V_CC) $(CFLAGS) -o $@ -c $<
-$(OBJDIR)/crt0_lm.o: $(CRT0_LM)
- $(V_CC) $(CFLAGS) -o $@ -c $<
-OSE_LM_OBJS += $(OBJDIR)/ose_confd.o $(OBJDIR)/crt0_lm.o
-
-$(BINDIR)/run_erl_lm: $(OBJDIR)/run_erl_main.o $(OBJDIR)/safe_string.o $(OBJDIR)/run_erl.o $(OBJDIR)/run_erl_common.o $(OBJDIR)/to_erl_common.o $(OSE_LM_OBJS)
- $(call build-ose-load-module, $@, $^, $(LIBS), $(RUN_ERL_LMCONF))
-
-
-$(OBJDIR)/run_erl_main.o: $(OSEETC)/run_erl_main.c $(OSEETC)/run_erl.h ../common/to_erl_common.h $(RC_GENERATED)
- $(V_CC) $(CFLAGS) -I ../common/ -o $@ -c $(OSEETC)/run_erl_main.c
-
-endif
-
-#---------------------------------------------------------
-# End of ose specific targets.
-#---------------------------------------------------------
-
-
# ----------------------------------------------------
# Release Target
# ----------------------------------------------------
@@ -537,11 +480,9 @@ endif
$(INSTALL_DIR) "$(RELEASE_PATH)/erts-$(VSN)/bin"
ifneq ($(TARGET), win32)
ifneq ($(findstring vxworks,$(TARGET)), vxworks)
-ifneq ($(findstring ose,$(TARGET)), ose)
$(INSTALL_SCRIPT) erl.src "$(RELEASE_PATH)/erts-$(VSN)/bin"
endif
endif
-endif
ifneq ($(INSTALL_PROGS),)
$(INSTALL_PROGRAM) $(INSTALL_PROGS) "$(RELEASE_PATH)/erts-$(VSN)/bin"
endif
diff --git a/erts/etc/common/run_erl_common.c b/erts/etc/common/run_erl_common.c
deleted file mode 100644
index c03d5e3ae2..0000000000
--- a/erts/etc/common/run_erl_common.c
+++ /dev/null
@@ -1,696 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 2014. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <dirent.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <time.h>
-#include <unistd.h>
-
-#ifdef __ANDROID__
-# include <termios.h>
-#endif
-
-#ifdef HAVE_SYSLOG_H
-# include <syslog.h>
-#endif
-
-#ifdef HAVE_SYS_IOCTL_H
-# include <sys/ioctl.h>
-#endif
-
-#ifdef __OSE__
-# include "ramlog.h"
-#endif
-
-#include "run_erl_common.h"
-#include "safe_string.h"
-
-#define DEFAULT_LOG_GENERATIONS 5
-#define LOG_MAX_GENERATIONS 1000 /* No more than 1000 log files */
-#define LOG_MIN_GENERATIONS 2 /* At least two to switch between */
-#define DEFAULT_LOG_MAXSIZE 100000
-#define LOG_MIN_MAXSIZE 1000 /* Smallast value for changing log file */
-#define LOG_STUBNAME "erlang.log."
-#define LOG_PERM 0664
-#define DEFAULT_LOG_ACTIVITY_MINUTES 5
-#define DEFAULT_LOG_ALIVE_MINUTES 15
-#define DEFAULT_LOG_ALIVE_FORMAT "%a %b %e %T %Z %Y"
-#define ALIVE_BUFFSIZ 1024
-
-#define STATUSFILENAME "/run_erl.log"
-
-#define PIPE_STUBNAME "erlang.pipe"
-#define PIPE_STUBLEN strlen(PIPE_STUBNAME)
-#define PERM (S_IWUSR | S_IRUSR | S_IWOTH | S_IROTH | S_IWGRP | S_IRGRP)
-
-/* OSE has defined O_SYNC but it is not recognized by open */
-#if !defined(O_SYNC) || defined(__OSE__)
-#undef O_SYNC
-#define O_SYNC 0
-#define USE_FSYNC 1
-#endif
-
-/* Global variable definitions
- * We need this complex way of handling global variables because of how
- * OSE works here. We want to make it possible to run the shell command
- * run_erl multiple times with different global variables without them
- * effecting eachother.
- */
-
-#define STATUSFILE (RE_DATA->statusfile)
-#define LOG_DIR (RE_DATA->log_dir)
-#define STDSTATUS (RE_DATA->stdstatus)
-#define LOG_GENERATIONS (RE_DATA->log_generations)
-#define LOG_MAXSIZE (RE_DATA->log_maxsize)
-#define LOG_ACTIVITY_MINUTES (RE_DATA->log_activity_minutes)
-#define LOG_ALIVE_IN_GMT (RE_DATA->log_alive_in_gmt)
-#define LOG_ALIVE_FORMAT (RE_DATA->log_alive_format)
-#define RUN_DAEMON (RE_DATA->run_daemon)
-#define LOG_ALIVE_MINUTES (RE_DATA->log_alive_minutes)
-#define LOG_NUM (RE_DATA->log_num)
-#define LFD (RE_DATA->lfd)
-#define PROTOCOL_VER (RE_DATA->protocol_ver)
-
-struct run_erl_ {
- /* constant config data */
- char statusfile[FILENAME_BUFSIZ];
- char log_dir[FILENAME_BUFSIZ];
- FILE *stdstatus;
- int log_generations;
- int log_maxsize;
- int log_activity_minutes;
- int log_alive_in_gmt;
- char log_alive_format[ALIVE_BUFFSIZ+1];
- int run_daemon;
- int log_alive_minutes;
- /* Current log number and log fd */
- int log_num;
- int lfd;
- unsigned protocol_ver;
-};
-
-typedef struct run_erl_ run_erl;
-
-#ifdef __OSE__
-static OSPPDKEY run_erl_pp_key;
-#define RE_DATA (*(run_erl**)ose_get_ppdata(run_erl_pp_key))
-#else
-static run_erl re;
-#define RE_DATA (&re)
-#endif
-
-/* prototypes */
-
-static int next_log(int log_num);
-static int prev_log(int log_num);
-static int find_next_log_num(void);
-static int open_log(int log_num, int flags);
-
-/*
- * getenv_int:
- */
-static char *getenv_int(const char *name) {
-#ifdef __OSE__
- return get_env(get_bid(current_process()),name);
-#else
- return getenv(name);
-#endif
-}
-
-/*
- * next_log:
- * Returns the index number that follows the given index number.
- * (Wrapping after log_generations)
- */
-static int next_log(int log_num) {
- return log_num>=LOG_GENERATIONS?1:log_num+1;
-}
-
-/*
- * prev_log:
- * Returns the index number that precedes the given index number.
- * (Wrapping after log_generations)
- */
-static int prev_log(int log_num) {
- return log_num<=1?LOG_GENERATIONS:log_num-1;
-}
-
-/*
- * find_next_log_num()
- * Searches through the log directory to check which logs that already
- * exist. It finds the "hole" in the sequence, and returns the index
- * number for the last log in the log sequence. If there is no hole, index
- * 1 is returned.
- */
-static int find_next_log_num(void) {
- int i, next_gen, log_gen;
- DIR *dirp;
- struct dirent *direntp;
- int log_exists[LOG_MAX_GENERATIONS+1];
- int stub_len = strlen(LOG_STUBNAME);
-
- /* Initialize exiting log table */
-
- for(i=LOG_GENERATIONS; i>=0; i--)
- log_exists[i] = 0;
- dirp = opendir(LOG_DIR);
- if(!dirp) {
- ERRNO_ERR1(LOG_ERR,"Can't access log directory '%s'", LOG_DIR);
- exit(1);
- }
-
- /* Check the directory for existing logs */
-
- while((direntp=readdir(dirp)) != NULL) {
- if(strncmp(direntp->d_name,LOG_STUBNAME,stub_len)==0) {
- int num = atoi(direntp->d_name+stub_len);
- if(num < 1 || num > LOG_GENERATIONS)
- continue;
- log_exists[num] = 1;
- }
- }
- closedir(dirp);
-
- /* Find out the next available log file number */
-
- next_gen = 0;
- for(i=LOG_GENERATIONS; i>=0; i--) {
- if(log_exists[i])
- if(next_gen)
- break;
- else
- ;
- else
- next_gen = i;
- }
-
- /* Find out the current log file number */
-
- if(next_gen)
- log_gen = prev_log(next_gen);
- else
- log_gen = 1;
-
- return log_gen;
-} /* find_next_log_num() */
-
-static int open_log(int log_num, int flags)
-{
- char buf[FILENAME_MAX];
- time_t now;
- struct tm *tmptr;
- char log_buffer[ALIVE_BUFFSIZ+1];
-
- /* Remove the next log (to keep a "hole" in the log sequence) */
- sn_printf(buf, sizeof(buf), "%s/%s%d",
- LOG_DIR, LOG_STUBNAME, next_log(log_num));
- unlink(buf);
-
- /* Create or continue on the current log file */
- sn_printf(buf, sizeof(buf), "%s/%s%d", LOG_DIR, LOG_STUBNAME, log_num);
-
- LFD = sf_open(buf, flags, LOG_PERM);
-
- if(LFD <0){
- ERRNO_ERR1(LOG_ERR,"Can't open log file '%s'.", buf);
- exit(1);
- }
-
- /* Write a LOGGING STARTED and time stamp into the log file */
- time(&now);
- if (LOG_ALIVE_IN_GMT) {
- tmptr = gmtime(&now);
- } else {
- tmptr = localtime(&now);
- }
- if (!strftime(log_buffer, ALIVE_BUFFSIZ, LOG_ALIVE_FORMAT,
- tmptr)) {
- strn_cpy(log_buffer, sizeof(log_buffer),
- "(could not format time in 256 positions "
- "with current format string.)");
- }
- log_buffer[ALIVE_BUFFSIZ] = '\0';
-
- sn_printf(buf, sizeof(buf), "\n=====\n===== LOGGING STARTED %s\n=====\n",
- log_buffer);
- if (erts_run_erl_write_all(LFD, buf, strlen(buf)) < 0)
- erts_run_erl_log_status("Error in writing to log.\n");
-
-#if USE_FSYNC
- fsync(LFD);
-#endif
-
- return LFD;
-}
-
-/* Instead of making sure basename exists, we do our own */
-char *simple_basename(char *path)
-{
- char *ptr;
- for (ptr = path; *ptr != '\0'; ++ptr) {
- if (*ptr == '/') {
- path = ptr + 1;
- }
- }
- return path;
-}
-
-ssize_t sf_read(int fd, void *buffer, size_t len) {
- ssize_t n = 0;
-
- do { n = read(fd, buffer, len); } while (n < 0 && errno == EINTR);
-
- return n;
-}
-
-ssize_t sf_write(int fd, const void *buffer, size_t len) {
- ssize_t n = 0;
-
- do { n = write(fd, buffer, len); } while (n < 0 && errno == EINTR);
-
- return n;
-}
-
-int sf_open(const char *path, int type, mode_t mode) {
- int fd = 0;
-
- do { fd = open(path, type, mode); } while(fd < 0 && errno == EINTR);
-
- return fd;
-}
-
-int sf_close(int fd) {
- int res = 0;
-
- do { res = close(fd); } while(res < 0 && errno == EINTR);
-
- return res;
-}
-
-/* Call write() until entire buffer has been written or error.
- * Return len or -1.
- */
-int erts_run_erl_write_all(int fd, const char* buf, int len)
-{
- int left = len;
- int written;
- for (;;) {
- do {
- written = write(fd,buf,left);
- } while (written < 0 && errno == EINTR);
- if (written == left) {
- return len;
- }
- if (written < 0) {
- return -1;
- }
- left -= written;
- buf += written;
- }
- return written;
-}
-
-/* erts_run_erl_log_status()
- * Prints the arguments to a status file
- * Works like printf (see vfrpintf)
- */
-void erts_run_erl_log_status(const char *format,...)
-{
- va_list args;
- time_t now;
-
- if (STDSTATUS == NULL)
- STDSTATUS = fopen(STATUSFILE, "w");
- if (STDSTATUS == NULL)
- return;
- now = time(NULL);
- fprintf(STDSTATUS, "run_erl [%d] %s",
-#ifdef __OSE__
- (int)current_process(),
-#else
- (int)getpid(),
-#endif
- ctime(&now));
- va_start(args, format);
- vfprintf(STDSTATUS, format, args);
- va_end(args);
- fflush(STDSTATUS);
- return;
-}
-
-/* Fetch the current log alive minutes */
-int erts_run_erl_log_alive_minutes() {
- return LOG_ALIVE_MINUTES;
-}
-
-/* error_logf()
- * Prints the arguments to stderr or syslog
- * Works like printf (see vfprintf)
- */
-void erts_run_erl_log_error(int priority, int line, const char *format, ...)
-{
- va_list args;
- va_start(args, format);
-
-#ifdef HAVE_SYSLOG_H
- if (RUN_DAEMON) {
- vsyslog(priority,format,args);
- }
- else
-#endif
-#ifdef __OSE__
- if (RUN_DAEMON) {
- char *buff = malloc(sizeof(char)*1024);
- vsnprintf(buff,1024,format, args);
- ramlog_printf(buff);
- }
- else
-#endif
- {
- time_t now = time(NULL);
- fprintf(stderr, "run_erl:%d [%d] %s", line,
-#ifdef __OSE__
- (int)current_process(),
-#else
- (int)getpid(),
-#endif
- ctime(&now));
- vfprintf(stderr, format, args);
- }
- va_end(args);
-}
-
-/* erts_run_erl_log_write()
- * Writes a message to lfd. If the current log file is full,
- * a new log file is opened.
- */
-int erts_run_erl_log_write(char* buf, size_t len)
-{
- int size;
- ssize_t res;
- /* Decide if new logfile needed, and open if so */
-
- size = lseek(LFD,0,SEEK_END);
- if(size+len > LOG_MAXSIZE) {
- int res;
- do {
- res = close(LFD);
- } while (res < 0 && errno == EINTR);
- LOG_NUM = next_log(LOG_NUM);
- LFD = open_log(LOG_NUM, O_RDWR|O_CREAT|O_TRUNC|O_SYNC);
- }
-
- /* Write to log file */
-
- if ((res = erts_run_erl_write_all(LFD, buf, len)) < 0) {
- erts_run_erl_log_status("Error in writing to log.\n");
- }
-
-#if USE_FSYNC
- fsync(LFD);
-#endif
- return res;
-}
-
-int erts_run_erl_log_activity(int timeout,time_t now,time_t last_activity) {
- char log_alive_buffer[ALIVE_BUFFSIZ+1];
- char buf[BUFSIZ];
-
- if (timeout || now - last_activity > LOG_ACTIVITY_MINUTES*60) {
- /* Either a time out: 15 minutes without action, */
- /* or something is coming in right now, but it's a long time */
- /* since last time, so let's write a time stamp this message */
- struct tm *tmptr;
- if (LOG_ALIVE_IN_GMT) {
- tmptr = gmtime(&now);
- } else {
- tmptr = localtime(&now);
- }
- if (!strftime(log_alive_buffer, ALIVE_BUFFSIZ, LOG_ALIVE_FORMAT,
- tmptr)) {
- strn_cpy(log_alive_buffer, sizeof(log_alive_buffer),
- "(could not format time in 256 positions "
- "with current format string.)");
- }
- log_alive_buffer[ALIVE_BUFFSIZ] = '\0';
-
- sn_printf(buf, sizeof(buf), "\n===== %s%s\n",
- timeout?"ALIVE ":"", log_alive_buffer);
- return erts_run_erl_log_write(buf, strlen(buf));
- }
- return 0;
-}
-
-int erts_run_erl_log_open() {
-
- LOG_NUM = find_next_log_num();
- LFD = open_log(LOG_NUM, O_RDWR|O_APPEND|O_CREAT|O_SYNC);
- return 0;
-}
-
-int erts_run_erl_log_init(int daemon, char* logdir) {
- char *p;
-
-#ifdef __OSE__
- run_erl **re_pp;
- if (!run_erl_pp_key)
- ose_create_ppdata("run_erl_ppdata",&run_erl_pp_key);
- re_pp = (run_erl **)ose_get_ppdata(run_erl_pp_key);
- *re_pp = malloc(sizeof(run_erl));
-#endif
-
- STDSTATUS = NULL;
- LOG_GENERATIONS = DEFAULT_LOG_GENERATIONS;
- LOG_MAXSIZE = DEFAULT_LOG_MAXSIZE;
- LOG_ACTIVITY_MINUTES = DEFAULT_LOG_ACTIVITY_MINUTES;
- LOG_ALIVE_IN_GMT = 0;
- RUN_DAEMON = 0;
- LOG_ALIVE_MINUTES = DEFAULT_LOG_ALIVE_MINUTES;
- LFD = 0;
- PROTOCOL_VER = RUN_ERL_LO_VER; /* assume lowest to begin with */
-
- /* Get values for LOG file handling from the environment */
- if ((p = getenv_int("RUN_ERL_LOG_ALIVE_MINUTES"))) {
- LOG_ALIVE_MINUTES = atoi(p);
- if (!LOG_ALIVE_MINUTES) {
- ERROR1(LOG_ERR,"Minimum value for RUN_ERL_LOG_ALIVE_MINUTES is 1 "
- "(current value is %s)",p);
- }
- LOG_ACTIVITY_MINUTES = LOG_ALIVE_MINUTES / 3;
- if (!LOG_ACTIVITY_MINUTES) {
- ++LOG_ACTIVITY_MINUTES;
- }
- }
- if ((p = getenv_int(
- "RUN_ERL_LOG_ACTIVITY_MINUTES"))) {
- LOG_ACTIVITY_MINUTES = atoi(p);
- if (!LOG_ACTIVITY_MINUTES) {
- ERROR1(LOG_ERR,"Minimum value for RUN_ERL_LOG_ACTIVITY_MINUTES is 1 "
- "(current value is %s)",p);
- }
- }
- if ((p = getenv_int("RUN_ERL_LOG_ALIVE_FORMAT"))) {
- if (strlen(p) > ALIVE_BUFFSIZ) {
- ERROR1(LOG_ERR, "RUN_ERL_LOG_ALIVE_FORMAT can contain a maximum of "
- "%d characters", ALIVE_BUFFSIZ);
- }
- strn_cpy(LOG_ALIVE_FORMAT, sizeof(LOG_ALIVE_FORMAT), p);
- } else {
- strn_cpy(LOG_ALIVE_FORMAT, sizeof(LOG_ALIVE_FORMAT),
- DEFAULT_LOG_ALIVE_FORMAT);
- }
- if ((p = getenv_int("RUN_ERL_LOG_ALIVE_IN_UTC"))
- && strcmp(p,"0")) {
- ++LOG_ALIVE_IN_GMT;
- }
- if ((p = getenv_int("RUN_ERL_LOG_GENERATIONS"))) {
- LOG_GENERATIONS = atoi(p);
- if (LOG_GENERATIONS < LOG_MIN_GENERATIONS)
- ERROR1(LOG_ERR,"Minimum RUN_ERL_LOG_GENERATIONS is %d",
- LOG_MIN_GENERATIONS);
- if (LOG_GENERATIONS > LOG_MAX_GENERATIONS)
- ERROR1(LOG_ERR,"Maximum RUN_ERL_LOG_GENERATIONS is %d",
- LOG_MAX_GENERATIONS);
- }
-
- if ((p = getenv_int("RUN_ERL_LOG_MAXSIZE"))) {
- LOG_MAXSIZE = atoi(p);
- if (LOG_MAXSIZE < LOG_MIN_MAXSIZE)
- ERROR1(LOG_ERR,"Minimum RUN_ERL_LOG_MAXSIZE is %d", LOG_MIN_MAXSIZE);
- }
-
- RUN_DAEMON = daemon;
-
- strn_cpy(LOG_DIR, sizeof(LOG_DIR), logdir);
- strn_cpy(STATUSFILE, sizeof(STATUSFILE), LOG_DIR);
- strn_cat(STATUSFILE, sizeof(STATUSFILE), STATUSFILENAME);
-
- return 0;
-}
-
-/* create_fifo()
- * Creates a new fifo with the given name and permission.
- */
-static int create_fifo(char *name, int perm)
-{
- if ((mkfifo(name, perm) < 0) && (errno != EEXIST))
- return -1;
- return 0;
-}
-
-/*
- * w- and r_pipename have to be pre-allocated of atleast FILENAME_MAX size
- */
-int erts_run_erl_open_fifo(char *pipename,char *w_pipename,char *r_pipename) {
- int calculated_pipename = 0;
- int highest_pipe_num = 0;
- int fd;
-
- /*
- * Create FIFOs and open them
- */
-
- if(*pipename && pipename[strlen(pipename)-1] == '/') {
- /* The user wishes us to find a unique pipe name in the specified */
- /* directory */
- DIR *dirp;
- struct dirent *direntp;
-
- calculated_pipename = 1;
- dirp = opendir(pipename);
- if(!dirp) {
- ERRNO_ERR1(LOG_ERR,"Can't access pipe directory '%s'.", pipename);
- return 1;
- }
-
- /* Check the directory for existing pipes */
-
- while((direntp=readdir(dirp)) != NULL) {
- if(strncmp(direntp->d_name,PIPE_STUBNAME,PIPE_STUBLEN)==0) {
- int num = atoi(direntp->d_name+PIPE_STUBLEN+1);
- if(num > highest_pipe_num)
- highest_pipe_num = num;
- }
- }
- closedir(dirp);
- strn_catf(pipename, BUFSIZ, "%s.%d",
- PIPE_STUBNAME, highest_pipe_num+1);
- } /* if */
-
- for(;;) {
- /* write FIFO - is read FIFO for `to_erl' program */
- strn_cpy(w_pipename, BUFSIZ, pipename);
- strn_cat(w_pipename, BUFSIZ, ".r");
- if (create_fifo(w_pipename, PERM) < 0) {
- ERRNO_ERR1(LOG_ERR,"Cannot create FIFO %s for writing.",
- w_pipename);
- return 1;
- }
-
- /* read FIFO - is write FIFO for `to_erl' program */
- strn_cpy(r_pipename, BUFSIZ, pipename);
- strn_cat(r_pipename, BUFSIZ, ".w");
-
- /* Check that nobody is running run_erl already */
- if ((fd = sf_open(r_pipename, O_WRONLY|DONT_BLOCK_PLEASE, 0)) >= 0) {
- /* Open as client succeeded -- run_erl is already running! */
- sf_close(fd);
- if (calculated_pipename) {
- ++highest_pipe_num;
- strn_catf(pipename, BUFSIZ, "%s.%d",
- PIPE_STUBNAME, highest_pipe_num+1);
- continue;
- }
- ERROR1(LOG_ERR, "Erlang already running on pipe %s.\n", pipename);
- unlink(w_pipename);
- return 1;
- }
- if (create_fifo(r_pipename, PERM) < 0) {
- unlink(w_pipename);
- ERRNO_ERR1(LOG_ERR,"Cannot create FIFO %s for reading.",
- r_pipename);
- return 1;
- }
- break;
- }
- return 0;
-}
-
-/* Extract any control sequences that are ment only for run_erl
- * and should not be forwarded to the pty.
- */
-int erts_run_erl_extract_ctrl_seq(char* buf, int len, int mfd)
-{
- static const char prefix[] = "\033_";
- static const char suffix[] = "\033\\";
- char* bufend = buf + len;
- char* start = buf;
- char* command;
- char* end;
-
- for (;;) {
- start = find_str(start, bufend-start, prefix);
- if (!start) break;
-
- command = start + strlen(prefix);
- end = find_str(command, bufend-command, suffix);
- if (end) {
- unsigned col, row;
- if (sscanf(command,"version=%u", &PROTOCOL_VER)==1) {
- /*fprintf(stderr,"to_erl v%u\n", protocol_ver);*/
- }
- else if (sscanf(command,"winsize=%u,%u", &col, &row)==2) {
-#ifdef TIOCSWINSZ
- struct winsize ws;
- ws.ws_col = col;
- ws.ws_row = row;
- if (ioctl(mfd, TIOCSWINSZ, &ws) < 0) {
- ERRNO_ERR0(LOG_ERR,"Failed to set window size");
- }
-#endif
- }
- else {
- ERROR2(LOG_ERR, "Ignoring unknown ctrl command '%.*s'\n",
- (int)(end-command), command);
- }
-
- /* Remove ctrl sequence from buf */
- end += strlen(suffix);
- memmove(start, end, bufend-end);
- bufend -= end - start;
- }
- else {
- ERROR2(LOG_ERR, "Missing suffix in ctrl sequence '%.*s'\n",
- (int)(bufend-start), start);
- break;
- }
- }
- return bufend - buf;
-}
diff --git a/erts/etc/common/run_erl_common.h b/erts/etc/common/run_erl_common.h
deleted file mode 100644
index cecf7521f9..0000000000
--- a/erts/etc/common/run_erl_common.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 2013. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- */
-/*
- * Functions that are common to both OSE and unix implementations of run_erl
- */
-#ifndef ERL_RUN_ERL_LOG_H
-#define ERL_RUN_ERL_LOG_H
-
-#include <stdio.h>
-#include <time.h>
-#include <unistd.h>
-
-#include "run_erl_vsn.h"
-
-/* Log handling */
-int erts_run_erl_log_init(int run_daemon, char* logdir);
-int erts_run_erl_log_open(void);
-int erts_run_erl_log_close(void);
-int erts_run_erl_log_write(char *buff, size_t len);
-int erts_run_erl_log_activity(int timeout, time_t now, time_t last_activity);
-
-void erts_run_erl_log_status(const char *format,...);
-void erts_run_erl_log_error(int priority, int line, const char *format,...);
-
-int erts_run_erl_open_fifo(char *pipename,char *w_pipename,char *r_pipename);
-int erts_run_erl_log_alive_minutes(void);
-int erts_run_erl_extract_ctrl_seq(char* buf, int len, int mfd);
-
-/* File operations */
-ssize_t sf_read(int fd, void *buffer, size_t len);
-ssize_t sf_write(int fd, const void *buffer, size_t len);
-int sf_open(const char *path, int type, mode_t mode);
-int sf_close(int fd);
-int erts_run_erl_write_all(int fd, const char* buf, int len);
-char *simple_basename(char *path);
-
-#ifndef LOG_ERR
-#ifdef __OSE__
-#define LOG_ERR 0
-#else
-#define LOG_ERR NULL
-#endif
-#endif
-
-#define ERROR0(Prio,Format) erts_run_erl_log_error(Prio,__LINE__,Format"\n")
-#define ERROR1(Prio,Format,A1) erts_run_erl_log_error(Prio,__LINE__,Format"\n",A1)
-#define ERROR2(Prio,Format,A1,A2) erts_run_erl_log_error(Prio,__LINE__,Format"\n",A1,A2)
-
-#ifdef HAVE_STRERROR
-# define ADD_ERRNO(Format) "errno=%d '%s'\n"Format"\n",errno,strerror(errno)
-#else
-# define ADD_ERRNO(Format) "errno=%d\n"Format"\n",errno
-#endif
-#define ERRNO_ERR0(Prio,Format) erts_run_erl_log_error(Prio,__LINE__,ADD_ERRNO(Format))
-#define ERRNO_ERR1(Prio,Format,A1) erts_run_erl_log_error(Prio,__LINE__,ADD_ERRNO(Format),A1)
-#define ERRNO_ERR2(Prio,Format,A1,A2) erts_run_erl_log_error(Prio,__LINE__,ADD_ERRNO(Format),A1,A2)
-
-#define RUN_ERL_USAGE \
- "%s (pipe_name|pipe_dir/) log_dir \"command [parameters ...]\"" \
- "\n\nDESCRIPTION:\n" \
- "You may also set the environment variables RUN_ERL_LOG_GENERATIONS\n" \
- "and RUN_ERL_LOG_MAXSIZE to the number of log files to use and the\n" \
- "size of the log file when to switch to the next log file\n"
-
-#ifndef FILENAME_MAX
-#define FILENAME_MAX 250
-#endif
-
-#define FILENAME_BUFSIZ FILENAME_MAX
-
-#ifdef O_NONBLOCK
-# define DONT_BLOCK_PLEASE O_NONBLOCK
-#else
-# define DONT_BLOCK_PLEASE O_NDELAY
-# ifndef EAGAIN
-# define EAGAIN -3898734
-# endif
-#endif
-
-#endif
diff --git a/erts/etc/common/to_erl_common.c b/erts/etc/common/to_erl_common.c
deleted file mode 100644
index 8aa94ccfa4..0000000000
--- a/erts/etc/common/to_erl_common.c
+++ /dev/null
@@ -1,717 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 1996-2013. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- */
-/*
- * Module: to_erl.c
- *
- * This module implements a process that opens two specified FIFOs, one
- * for reading and one for writing; reads from its stdin, and writes what
- * it has read to the write FIF0; reads from the read FIFO, and writes to
- * its stdout.
- *
- ________ _________
- | |--<-- pipe.r (fifo1) --<--| |
- | to_erl | | run_erl | (parent)
- |________|-->-- pipe.w (fifo2) -->--|_________|
- ^ master pty
- |
- | slave pty
- ____V____
- | |
- | "erl" | (child)
- |_________|
- */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <dirent.h>
-#include <errno.h>
-
-#ifdef __OSE__
-#include <aio.h>
-#include "ose.h"
-#include "efs.h"
-#include "ose_spi/fm.sig"
-#else /* __UNIX__ */
-#include <termios.h>
-#include <signal.h>
-#endif
-
-#ifdef HAVE_SYS_IOCTL_H
-# include <sys/ioctl.h>
-#endif
-
-#include "to_erl_common.h"
-#include "run_erl_vsn.h"
-#include "safe_string.h" /* strn_cpy, strn_catf, sn_printf, etc. */
-
-#if defined(O_NONBLOCK)
-# define DONT_BLOCK_PLEASE O_NONBLOCK
-#else
-# define DONT_BLOCK_PLEASE O_NDELAY
-# if !defined(EAGAIN)
-# define EAGAIN -3898734
-# endif
-#endif
-
-#ifdef HAVE_STRERROR
-# define STRERROR(x) strerror(x)
-#else
-# define STRERROR(x) ""
-#endif
-
-#define noDEBUG
-
-#ifdef __OSE__
-#define PIPE_DIR "/pipe/"
-#else
-#define PIPE_DIR "/tmp/"
-#endif
-#define PIPE_STUBNAME "erlang.pipe"
-#define PIPE_STUBLEN strlen(PIPE_STUBNAME)
-
-#ifdef DEBUG
-#define STATUS(s) { fprintf(stderr, (s)); fflush(stderr); }
-#else
-#define STATUS(s)
-#endif
-
-#ifndef FILENAME_MAX
-#define FILENAME_MAX 250
-#endif
-
-static int tty_eof = 0;
-static int protocol_ver = RUN_ERL_LO_VER; /* assume lowest to begin with */
-
-static int write_all(int fd, const char* buf, int len);
-static int version_handshake(char* buf, int len, int wfd);
-
-
-#ifdef __OSE__
-
-#define SET_AIO(REQ,FD,SIZE,BUFF) \
- /* Make sure to clean data structure of previous request */ \
- memset(&(REQ),0,sizeof(REQ)); \
- (REQ).aio_fildes = FD; \
- (REQ).aio_offset = FM_POSITION_CURRENT; \
- (REQ).aio_nbytes = SIZE; \
- (REQ).aio_buf = BUFF; \
- (REQ).aio_sigevent.sigev_notify = SIGEV_NONE
-
-#define READ_AIO(REQ,FD,SIZE,BUFF) \
- SET_AIO(REQ,FD,SIZE,BUFF); \
- if (aio_read(&(REQ)) != 0) \
- fprintf(stderr,"aio_read of child_read_req(%d) failed" \
- "with error %d\n",FD,errno)
-
-union SIGNAL {
- SIGSELECT signo;
- struct FmReadPtr fm_read_ptr;
-};
-
-#else /* __UNIX__ */
-static int recv_sig = 0;
-static struct termios tty_smode, tty_rmode;
-static int window_size_seq(char* buf, size_t bufsz);
-#ifdef DEBUG
-static void show_terminal_settings(struct termios *);
-#endif
-
-static void handle_ctrlc(int sig)
-{
- /* Reinstall the handler, and signal break flag */
- signal(SIGINT,handle_ctrlc);
- recv_sig = SIGINT;
-}
-
-static void handle_sigwinch(int sig)
-{
- recv_sig = SIGWINCH;
-}
-#endif
-
-static void usage(char *pname)
-{
- fprintf(stderr, "Usage: ");
- fprintf(stderr,TO_ERL_USAGE,pname);
-}
-
-int to_erl(int argc, char **argv)
-{
- char FIFO1[FILENAME_MAX], FIFO2[FILENAME_MAX];
- int i, len, wfd, rfd;
- char pipename[FILENAME_MAX];
- int pipeIx = 1;
- int force_lock = 0;
- int got_some = 0;
-
-#ifdef __OSE__
- struct aiocb stdin_read_req, pipe_read_req;
- FmHandle stdin_fh, pipe_fh;
- char *stdin_buf, *pipe_buf;
- char *buf;
- union SIGNAL *sig;
-#else /* __UNIX__ */
- char buf[BUFSIZ];
- fd_set readfds;
-#endif
-
- if (argc >= 2 && argv[1][0]=='-') {
- switch (argv[1][1]) {
- case 'h':
- usage(argv[0]);
- exit(1);
- case 'F':
- force_lock = 1;
- break;
- default:
- fprintf(stderr,"Invalid option '%s'\n",argv[1]);
- exit(1);
- }
- pipeIx = 2;
- }
-
-#ifdef DEBUG
- fprintf(stderr, "%s: pid is : %d\n", argv[0],(int)
-#ifdef __OSE__
- current_process()
-#else /* __UNIX__ */
- getpid()
-#endif
- );
-#endif
-
- strn_cpy(pipename, sizeof(pipename),
- (argv[pipeIx] ? argv[pipeIx] : PIPE_DIR));
-
- if(*pipename && pipename[strlen(pipename)-1] == '/') {
- /* The user wishes us to find a pipe name in the specified */
- /* directory */
- int highest_pipe_num = 0;
- DIR *dirp;
- struct dirent *direntp;
-
- dirp = opendir(pipename);
- if(!dirp) {
- fprintf(stderr, "Can't access pipe directory %s: %s\n", pipename, strerror(errno));
- exit(1);
- }
-
- /* Check the directory for existing pipes */
-
- while((direntp=readdir(dirp)) != NULL) {
- if(strncmp(direntp->d_name,PIPE_STUBNAME,PIPE_STUBLEN)==0) {
- int num = atoi(direntp->d_name+PIPE_STUBLEN+1);
- if(num > highest_pipe_num)
- highest_pipe_num = num;
- }
- }
- closedir(dirp);
- strn_catf(pipename, sizeof(pipename), (highest_pipe_num?"%s.%d":"%s"),
- PIPE_STUBNAME, highest_pipe_num);
- } /* if */
-
- /* read FIFO */
- sn_printf(FIFO1,sizeof(FIFO1),"%s.r",pipename);
- /* write FIFO */
- sn_printf(FIFO2,sizeof(FIFO2),"%s.w",pipename);
-
-#ifndef __OSE__
- /* Check that nobody is running to_erl on this pipe already */
- if ((wfd = open (FIFO1, O_WRONLY|DONT_BLOCK_PLEASE, 0)) >= 0) {
- /* Open as server succeeded -- to_erl is already running! */
- close(wfd);
- fprintf(stderr, "Another to_erl process already attached to pipe "
- "%s.\n", pipename);
- if (force_lock) {
- fprintf(stderr, "But we proceed anyway by force (-F).\n");
- }
- else {
- exit(1);
- }
- }
-#endif
-
- if ((rfd = open (FIFO1, O_RDONLY|DONT_BLOCK_PLEASE, 0)) < 0) {
-#ifdef DEBUG
- fprintf(stderr, "Could not open FIFO %s for reading.\n", FIFO1);
-#endif
- fprintf(stderr, "No running Erlang on pipe %s: %s\n", pipename, strerror(errno));
- exit(1);
- }
-#ifdef DEBUG
- fprintf(stderr, "to_erl: %s opened for reading\n", FIFO1);
-#endif
-
- if ((wfd = open (FIFO2, O_WRONLY|DONT_BLOCK_PLEASE, 0)) < 0) {
-#ifdef DEBUG
- fprintf(stderr, "Could not open FIFO %s for writing.\n", FIFO2);
-#endif
- fprintf(stderr, "No running Erlang on pipe %s: %s\n", pipename, strerror(errno));
- close(rfd);
- exit(1);
- }
-#ifdef DEBUG
- fprintf(stderr, "to_erl: %s opened for writing\n", FIFO2);
-#endif
-
-#ifndef __OSE__
- fprintf(stderr, "Attaching to %s (^D to exit)\n\n", pipename);
-#else
- fprintf(stderr, "Attaching to %s (^C to exit)\n\n", pipename);
-#endif
-
-#ifndef __OSE__
- /* Set break handler to our handler */
- signal(SIGINT,handle_ctrlc);
-
- /*
- * Save the current state of the terminal, and set raw mode.
- */
- if (tcgetattr(0, &tty_rmode) , 0) {
- fprintf(stderr, "Cannot get terminals current mode\n");
- exit(-1);
- }
- tty_smode = tty_rmode;
- tty_eof = '\004'; /* Ctrl+D to exit */
-#ifdef DEBUG
- show_terminal_settings(&tty_rmode);
-#endif
- tty_smode.c_iflag =
- 1*BRKINT |/*Signal interrupt on break.*/
- 1*IGNPAR |/*Ignore characters with parity errors.*/
- 1*ISTRIP |/*Strip character.*/
- 0;
-
-#if 0
-0*IGNBRK |/*Ignore break condition.*/
-0*PARMRK |/*Mark parity errors.*/
-0*INPCK |/*Enable input parity check.*/
-0*INLCR |/*Map NL to CR on input.*/
-0*IGNCR |/*Ignore CR.*/
-0*ICRNL |/*Map CR to NL on input.*/
-0*IUCLC |/*Map upper-case to lower-case on input.*/
-0*IXON |/*Enable start/stop output control.*/
-0*IXANY |/*Enable any character to restart output.*/
-0*IXOFF |/*Enable start/stop input control.*/
-0*IMAXBEL|/*Echo BEL on input line too long.*/
-#endif
-
- tty_smode.c_oflag =
- 1*OPOST |/*Post-process output.*/
- 1*ONLCR |/*Map NL to CR-NL on output.*/
-#ifdef XTABS
- 1*XTABS |/*Expand tabs to spaces. (Linux)*/
-#endif
-#ifdef OXTABS
- 1*OXTABS |/*Expand tabs to spaces. (FreeBSD)*/
-#endif
-#ifdef NL0
- 1*NL0 |/*Select newline delays*/
-#endif
-#ifdef CR0
- 1*CR0 |/*Select carriage-return delays*/
-#endif
-#ifdef TAB0
- 1*TAB0 |/*Select horizontal tab delays*/
-#endif
-#ifdef BS0
- 1*BS0 |/*Select backspace delays*/
-#endif
-#ifdef VT0
- 1*VT0 |/*Select vertical tab delays*/
-#endif
-#ifdef FF0
- 1*FF0 |/*Select form feed delays*/
-#endif
- 0;
-
-#if 0
-0*OLCUC |/*Map lower case to upper on output.*/
-0*OCRNL |/*Map CR to NL on output.*/
-0*ONOCR |/*No CR output at column 0.*/
-0*ONLRET |/*NL performs CR function.*/
-0*OFILL |/*Use fill characters for delay.*/
-0*OFDEL |/*Fill is DEL, else NULL.*/
-0*NL1 |
-0*CR1 |
-0*CR2 |
-0*CR3 |
-0*TAB1 |
-0*TAB2 |
-0*TAB3 |/*Expand tabs to spaces.*/
-0*BS1 |
-0*VT1 |
-0*FF1 |
-#endif
-
- /* JALI: removed setting the tty_smode.c_cflag flags, since this is not */
- /* advisable if this is a *real* terminal, such as the console. In fact */
- /* this may hang the entire machine, deep, deep down (signalling break */
- /* or toggling the abort switch doesn't help) */
-
- tty_smode.c_lflag =
- 0;
-
-#if 0
-0*ISIG |/*Enable signals.*/
-0*ICANON |/*Canonical input (erase and kill processing).*/
-0*XCASE |/*Canonical upper/lower presentation.*/
-0*ECHO |/*Enable echo.*/
-0*ECHOE |/*Echo erase character as BS-SP-BS.*/
-0*ECHOK |/*Echo NL after kill character.*/
-0*ECHONL |/*Echo NL.*/
-0*NOFLSH |/*Disable flush after interrupt or quit.*/
-0*TOSTOP |/*Send SIGTTOU for background output.*/
-0*ECHOCTL|/*Echo control characters as ^char, delete as ^?.*/
-0*ECHOPRT|/*Echo erase character as character erased.*/
-0*ECHOKE |/*BS-SP-BS erase entire line on line kill.*/
-0*FLUSHO |/*Output is being flushed.*/
-0*PENDIN |/*Retype pending input at next read or input character.*/
-0*IEXTEN |/*Enable extended (implementation-defined) functions.*/
-#endif
-
- tty_smode.c_cc[VMIN] =0;/* Note that VMIN is the same as VEOF! */
- tty_smode.c_cc[VTIME] =0;/* Note that VTIME is the same as VEOL! */
- tty_smode.c_cc[VINTR] =3;
-
- tcsetattr(0, TCSADRAIN, &tty_smode);
-
-#ifdef DEBUG
- show_terminal_settings(&tty_smode);
-#endif
-
-#endif /* !__OSE__ */
- /*
- * "Write a ^L to the FIFO which causes the other end to redisplay
- * the input line."
- * This does not seem to work as was intended in old comment above.
- * However, this control character is now (R12B-3) used by run_erl
- * to trigger the version handshaking between to_erl and run_erl
- * at the start of every new to_erl-session.
- */
-
- if (write(wfd, "\014", 1) < 0) {
- fprintf(stderr, "Error in writing ^L to FIFO.\n");
- }
-
-#ifdef __OSE__
- /* we have a tiny stack so we malloc the buffers */
- stdin_buf = malloc(sizeof(char) * BUFSIZ);
- pipe_buf = malloc(sizeof(char) * BUFSIZ);
-
- efs_examine_fd(rfd,FLIB_FD_HANDLE,&pipe_fh);
- efs_examine_fd(0,FLIB_FD_HANDLE,&stdin_fh);
- READ_AIO(stdin_read_req,0,BUFSIZ,stdin_buf);
- READ_AIO(pipe_read_req,rfd,BUFSIZ,pipe_buf);
-#endif
-
- /*
- * read and write
- */
- while (1) {
-#ifndef __OSE__
- FD_ZERO(&readfds);
- FD_SET(0, &readfds);
- FD_SET(rfd, &readfds);
- if (select(rfd + 1, &readfds, NULL, NULL, NULL) < 0) {
- if (recv_sig) {
- FD_ZERO(&readfds);
- }
- else {
- fprintf(stderr, "Error in select.\n");
- break;
- }
- }
- len = 0;
-
- /*
- * Read from terminal and write to FIFO
- */
- if (recv_sig) {
- switch (recv_sig) {
- case SIGINT:
- fprintf(stderr, "[Break]\n\r");
- buf[0] = '\003';
- len = 1;
- break;
- case SIGWINCH:
- len = window_size_seq(buf,sizeof(buf));
- break;
- default:
- fprintf(stderr,"Unexpected signal: %u\n",recv_sig);
- }
- recv_sig = 0;
- }
- else
-#else /* __OSE__ */
- SIGSELECT sigsel[] = {0};
- sig = receive(sigsel);
- len = 0;
-#endif
-#ifndef __OSE__
- if (FD_ISSET(0,&readfds)) {
- len = read(0, buf, sizeof(buf));
-#else /* __OSE__ */
- if (sig->signo == FM_READ_PTR_REPLY &&
- sig->fm_read_ptr.handle == stdin_fh) {
- len = sig->fm_read_ptr.status == EFS_SUCCESS ? sig->fm_read_ptr.actual : -1;
- buf = sig->fm_read_ptr.buffer;
-#endif
- if (len <= 0) {
- close(rfd);
- close(wfd);
- if (len < 0) {
- fprintf(stderr, "Error in reading from stdin.\n");
- } else {
- fprintf(stderr, "[EOF]\n\r");
- }
- break;
- }
- /* check if there is an eof character in input */
- for (i = 0; i < len-1 && buf[i] != tty_eof; i++);
- if (buf[i] == tty_eof) {
- fprintf(stderr, "[Quit]\n\r");
- break;
- }
- }
-
- if (len) {
-#ifdef DEBUG
- if(write(1, buf, len));
-#endif
- if (write_all(wfd, buf, len) != len) {
- fprintf(stderr, "Error in writing to FIFO.\n");
- close(rfd);
- close(wfd);
- break;
- }
- STATUS("\" OK\r\n");
-#ifdef __OSE__
- aio_dispatch(sig);
- READ_AIO(stdin_read_req, 0, BUFSIZ, stdin_buf);
-#endif
- }
-
- /*
- * Read from FIFO, write to terminal.
- */
-#ifndef __OSE__
- if (FD_ISSET(rfd, &readfds)) {
- STATUS("FIFO read: ");
- len = read(rfd, buf, BUFSIZ);
-#else /* __OSE__ */
- if (sig->signo == FM_READ_PTR_REPLY &&
- sig->fm_read_ptr.handle == pipe_fh) {
- len = sig->fm_read_ptr.status == EFS_SUCCESS ? sig->fm_read_ptr.actual : -1;
- buf = sig->fm_read_ptr.buffer;
-#endif
- if (len < 0 && errno == EAGAIN) {
- /*
- * No data this time, but the writing end of the FIFO is still open.
- * Do nothing.
- */
- ;
- } else if (len <= 0) {
- /*
- * Either an error or end of file. In either case, break out
- * of the loop.
- */
- close(rfd);
- close(wfd);
- if (len < 0) {
- fprintf(stderr, "Error in reading from FIFO.\n");
- } else
- fprintf(stderr, "[End]\n\r");
- break;
- } else {
- if (!got_some) {
- if ((len=version_handshake(buf,len,wfd)) < 0) {
- close(rfd);
- close(wfd);
- break;
- }
-#ifndef __OSE__
- if (protocol_ver >= 1) {
- /* Tell run_erl size of terminal window */
- signal(SIGWINCH, handle_sigwinch);
- raise(SIGWINCH);
- }
-#endif
- got_some = 1;
- }
-
- /*
- * We successfully read at least one character. Write what we got.
- */
- STATUS("Terminal write: \"");
- if (write_all(1, buf, len) != len) {
- fprintf(stderr, "Error in writing to terminal.\n");
- close(rfd);
- close(wfd);
- break;
- }
- STATUS("\" OK\r\n");
-#ifdef __OSE__
- aio_dispatch(sig);
- READ_AIO(pipe_read_req, rfd, BUFSIZ, pipe_buf);
-#endif
- }
- }
- }
-
-#ifndef __OSE__
- /*
- * Reset terminal characterstics
- * XXX
- */
- tcsetattr(0, TCSADRAIN, &tty_rmode);
-#endif
- return 0;
-}
-
-/* Call write() until entire buffer has been written or error.
- * Return len or -1.
- */
-static int write_all(int fd, const char* buf, int len)
-{
- int left = len;
- int written;
- while (left) {
- written = write(fd,buf,left);
- if (written < 0) {
- return -1;
- }
- left -= written;
- buf += written;
- }
- return len;
-}
-
-#ifndef __OSE__
-static int window_size_seq(char* buf, size_t bufsz)
-{
-#ifdef TIOCGWINSZ
- struct winsize ws;
- static const char prefix[] = "\033_";
- static const char suffix[] = "\033\\";
- /* This Esc sequence is called "Application Program Command"
- and seems suitable to use for our own customized stuff. */
-
- if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) == 0) {
- int len = sn_printf(buf, bufsz, "%swinsize=%u,%u%s",
- prefix, ws.ws_col, ws.ws_row, suffix);
- return len;
- }
-#endif /* TIOCGWINSZ */
- return 0;
-}
-#endif /* !__OSE__ */
-
-/* to_erl run_erl
- * | |
- * |---------- '\014' -------->| (session start)
- * | |
- * |<---- "[run_erl v1-0]" ----| (version interval)
- * | |
- * |--- Esc_"version=1"Esc\ -->| (common version)
- * | |
- */
-static int version_handshake(char* buf, int len, int wfd)
-{
- unsigned re_high=0, re_low;
- char *end = find_str(buf,len,"]\n");
-
- if (end && sscanf(buf,"[run_erl v%u-%u",&re_high,&re_low)==2) {
- char wbuf[30];
- int wlen;
-
- if (re_low > RUN_ERL_HI_VER || re_high < RUN_ERL_LO_VER) {
- fprintf(stderr,"Incompatible versions: to_erl=v%u-%u run_erl=v%u-%u\n",
- RUN_ERL_HI_VER, RUN_ERL_LO_VER, re_high, re_low);
- return -1;
- }
- /* Choose highest common version */
- protocol_ver = re_high < RUN_ERL_HI_VER ? re_high : RUN_ERL_HI_VER;
-
- wlen = sn_printf(wbuf, sizeof(wbuf), "\033_version=%u\033\\",
- protocol_ver);
- if (write_all(wfd, wbuf, wlen) < 0) {
- fprintf(stderr,"Failed to send version handshake\n");
- return -1;
- }
- end += 2;
- len -= (end-buf);
- memmove(buf,end,len);
-
- }
- else { /* we assume old run_erl without version handshake */
- protocol_ver = 0;
- }
-
- if (re_high != RUN_ERL_HI_VER) {
- fprintf(stderr,"run_erl has different version, "
- "using common protocol level %u\n", protocol_ver);
- }
-
- return len;
-}
-
-
-#if defined(DEBUG) && !defined(__OSE__)
-#define S(x) ((x) > 0 ? 1 : 0)
-
-static void show_terminal_settings(struct termios *t)
-{
- fprintf(stderr,"c_iflag:\n");
- fprintf(stderr,"Signal interrupt on break: BRKINT %d\n", S(t->c_iflag & BRKINT));
- fprintf(stderr,"Map CR to NL on input: ICRNL %d\n", S(t->c_iflag & ICRNL));
- fprintf(stderr,"Ignore break condition: IGNBRK %d\n", S(t->c_iflag & IGNBRK));
- fprintf(stderr,"Ignore CR: IGNCR %d\n", S(t->c_iflag & IGNCR));
- fprintf(stderr,"Ignore char with par. err's: IGNPAR %d\n", S(t->c_iflag & IGNPAR));
- fprintf(stderr,"Map NL to CR on input: INLCR %d\n", S(t->c_iflag & INLCR));
- fprintf(stderr,"Enable input parity check: INPCK %d\n", S(t->c_iflag & INPCK));
- fprintf(stderr,"Strip character ISTRIP %d\n", S(t->c_iflag & ISTRIP));
- fprintf(stderr,"Enable start/stop input ctrl IXOFF %d\n", S(t->c_iflag & IXOFF));
- fprintf(stderr,"ditto output ctrl IXON %d\n", S(t->c_iflag & IXON));
- fprintf(stderr,"Mark parity errors PARMRK %d\n", S(t->c_iflag & PARMRK));
- fprintf(stderr,"\n");
- fprintf(stderr,"c_oflag:\n");
- fprintf(stderr,"Perform output processing OPOST %d\n", S(t->c_oflag & OPOST));
- fprintf(stderr,"\n");
- fprintf(stderr,"c_cflag:\n");
- fprintf(stderr,"Ignore modem status lines CLOCAL %d\n", S(t->c_cflag & CLOCAL));
- fprintf(stderr,"\n");
- fprintf(stderr,"c_local:\n");
- fprintf(stderr,"Enable echo ECHO %d\n", S(t->c_lflag & ECHO));
- fprintf(stderr,"\n");
- fprintf(stderr,"c_cc:\n");
- fprintf(stderr,"c_cc[VEOF] %d\n", t->c_cc[VEOF]);
-}
-#endif /* DEBUG && !__OSE__ */
diff --git a/erts/etc/common/to_erl_common.h b/erts/etc/common/to_erl_common.h
deleted file mode 100644
index a139da418f..0000000000
--- a/erts/etc/common/to_erl_common.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 2013. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- */
-#ifndef ERL_TO_ERL_H
-#define ERL_TO_ERL_H
-
-#define TO_ERL_USAGE "to_erl [-h|-F] %s\n" \
- "\t-h\tThis help text.\n" \
- "\t-f\tForce connection even though pipe is locked by other to_erl process."
-
-int to_erl(int argc, char **argv);
-
-#endif
diff --git a/erts/etc/ose/etc.lmconf b/erts/etc/ose/etc.lmconf
deleted file mode 100644
index b402b325b1..0000000000
--- a/erts/etc/ose/etc.lmconf
+++ /dev/null
@@ -1,20 +0,0 @@
-OSE_LM_STACK_SIZES=256,512,1024,2048,4096,8192,16384,65536
-OSE_LM_SIGNAL_SIZES=31,63,127,255,1023,4095,16383,65535
-OSE_LM_POOL_SIZE=0x200000
-OSE_LM_MAIN_NAME=main
-OSE_LM_MAIN_STACK_SIZE=0xF000
-OSE_LM_MAIN_PRIORITY=20
-## Has to be of a type that allows MAM
-OSE_LM_PROGRAM_TYPE=APP_RAM
-OSE_LM_DATA_INIT=YES
-OSE_LM_BSS_INIT=YES
-OSE_LM_EXEC_MODEL=SHARED
-HEAP_MAX_SIZE=1000000000
-HEAP_SMALL_BUF_INIT_SIZE=64000000
-HEAP_LARGE_BUF_THRESHOLD=16000000
-HEAP_LOCK_TYPE=2
-
-# Setting the environment variable EFS_RESOLVE_TMO on the block to 0.
-# This will eliminiate delays when trying to open files on not mounted
-# volumes.
-EFS_RESOLVE_TMO=0
diff --git a/erts/etc/ose/run_erl.c b/erts/etc/ose/run_erl.c
deleted file mode 100644
index 6775525297..0000000000
--- a/erts/etc/ose/run_erl.c
+++ /dev/null
@@ -1,664 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 2013. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- */
-/*
- * Module: run_erl.c
- *
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-/* System includes */
-#include <aio.h>
-#include <errno.h>
-#include <dirent.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-/* OSE includes */
-#include "ose.h"
-#include "ose_spi/ose_spi.h"
-#include "efs.h"
-#include "pm.h"
-#include "ose_spi/fm.sig"
-
-/* erts includes */
-#include "run_erl.h"
-#include "run_erl_common.h"
-#include "safe_string.h" /* sn_printf, strn_cpy, strn_cat, etc */
-
-typedef struct RunErlSetup_ {
- SIGSELECT signo;
- int run_daemon;
- char *logdir;
- char *command;
- char *pipename;
- char *blockname;
-} RunErlSetup;
-
-typedef struct ProgramState_ {
- /* child process */
- int ifd, ofd;
- OSDOMAIN domain;
- PROCESS progpid, mainbid;
- struct PmProgramInfo *info;
- /* to_erl */
- char w_pipe[FILENAME_BUFSIZ],
- r_pipe[FILENAME_BUFSIZ];
-} ProgramState;
-
-union SIGNAL {
- SIGSELECT signo;
- RunErlSetup setup;
- struct FmReadPtr fm_read_ptr;
- struct FmWritePtr fm_write_ptr;
-};
-
-static OSBOOLEAN hunt_in_block(char *block_name,
- char *process_name,
- PROCESS *pid);
-static int create_child_process(char *command_string, char *blockname,
- ProgramState *state);
-
-
-static OSBOOLEAN hunt_in_block(char *block_name,
- char *process_name,
- PROCESS *pid) {
- struct OS_pid_list *list;
- PROCESS block_id = OSE_ILLEGAL_PROCESS;
- int i;
- char *name;
-
- *pid = OSE_ILLEGAL_PROCESS;
-
- list = get_bid_list(0);
-
- if (!list)
- return 0;
-
- for (i = 0; i < list->count; i++) {
-
- if (list->list[i] == get_bid(current_process()))
- continue;
-
- name = (char*)get_pid_info(list->list[i], OSE_PI_NAME);
- if (name) {
- if (strcmp(name,block_name) == 0) {
- block_id = list->list[i];
- free_buf((union SIGNAL**)&name);
- break;
- }
- free_buf((union SIGNAL**)&name);
- }
- }
-
- free_buf((union SIGNAL**)&list);
-
- if (block_id == OSE_ILLEGAL_PROCESS)
- return 0;
-
- list = get_pid_list(block_id);
-
- if (!list)
- return 0;
-
- for (i = 0; i < list->count; i++) {
- name = (char*)get_pid_info(list->list[i], OSE_PI_NAME);
- if (name) {
- if (strcmp(name,process_name) == 0) {
- *pid = list->list[i];
- free_buf((union SIGNAL**)&name);
- break;
- }
- free_buf((union SIGNAL**)&name);
- }
- }
-
- free_buf((union SIGNAL**)&list);
-
- if (*pid == OSE_ILLEGAL_PROCESS)
- return 0;
-
- return 1;
-
-}
-
-
-static int create_child_process(char *command_string, char *blockname,
- ProgramState *state) {
- char *command = command_string;
- char *argv;
- int i = 0;
- int ret_status;
- PmStatus pm_status;
- int tmp_io[2];
- int fd_arr[3];
- int ifd[2], ofd[2];
- char *handle;
- struct PmLoadModuleInfoReply *mod_info;
-
- /* Parse out cmd and argv from the command string */
- while (1) {
- if (command[i] == ' ' || command[i] == '\0') {
- if (command[i] == '\0')
- argv = NULL;
- else {
- command[i] = '\0';
- argv = command_string + i + 1;
- }
- break;
- }
- i++;
- }
-
- if (blockname)
- handle = blockname;
- else
- handle = simple_basename(command);
-
- if (ose_pm_load_module_info(handle,&mod_info) == PM_SUCCESS) {
- /* Already installed */
- free_buf((union SIGNAL**)&mod_info);
- } else if ((pm_status = ose_pm_install_load_module(0,"ELF",command,handle,0,0,NULL))
- != PM_SUCCESS) {
- ERROR1(LOG_ERR,"ose_pm_install_load_module failed - pmstatus: 0x%08x\n",
- pm_status);
- return 0;
- }
-
- state->domain = PM_NEW_DOMAIN;
-
- pm_status = ose_pm_create_program(&state->domain, handle, 0, 0 , NULL,
- &state->progpid, &state->mainbid);
-
- if (pm_status != PM_SUCCESS) {
- if (pm_status == PM_EINSTALL_HANDLE_IN_USE)
- ERROR1(LOG_ERR,"ose_pm_create_program failed - "
- "install handle \"%s\" is in use. You can specify another "
- "install handle by using the -block option to run_erl.\n",handle);
- else
- ERROR1(LOG_ERR,"ose_pm_create_program failed - pmstatus: 0x%08x\n",
- pm_status);
- return 0;
- }
-
- pm_status = ose_pm_program_info(state->progpid, &state->info);
- /* FIXME don't forget to free this ((union SIGNAL **)&info) */
- if (pm_status != PM_SUCCESS) {
- ERROR1(LOG_ERR,"ose_pm_program_info failed - pmstatus: 0x%08x\n",
- pm_status);
- return 0;
- }
-
- /* We only clone stdin+stdout, what about stderr? */
-
- /* create pipes */
- if (pipe(ifd) < 0) {
- if (errno == ENOENT)
- ERRNO_ERR0(LOG_ERR,"The /pipe file system is not available\n");
- else
- ERRNO_ERR0(LOG_ERR,"pipe ifd failed\n");
- return 0;
- }
-
- if (pipe(ofd) < 0) {
- ERRNO_ERR0(LOG_ERR,"pipe ofd failed\n");
- return 0;
- }
-
- /* FIXME Lock? */
-
- /* backup our stdin stdout */
- if ((tmp_io[0] = dup(0)) < 0) {
- ERRNO_ERR0(LOG_ERR,"dup 0 failed\n");
- return 0;
- }
-
- if ((tmp_io[1] = dup(1)) < 0) {
- ERRNO_ERR0(LOG_ERR,"dup 1 failed\n");
- return 0;
- }
-
- /* set new pipe to fd 0,1 */
- if (dup2(ifd[1], 1) < 0) {
- ERRNO_ERR0(LOG_ERR,"dup2 1 failed\n");
- return 0;
- }
-
- if (dup2(ofd[0], 0) < 0) {
- ERRNO_ERR0(LOG_ERR,"dup2 0 failed\n");
- return 0;
- }
-
- /* clone array to newly created */
- fd_arr[0] = 2; /* Number of fd's */
- fd_arr[1] = 0;
- fd_arr[2] = 1;
-
- if ((ret_status = efs_clone_array(state->info->main_process, fd_arr))
- != EFS_SUCCESS) {
- ERROR1(LOG_ERR,"efs_close_array filed, errcode: %d\n", ret_status);
- return 0;
- }
-
- if (dup2(tmp_io[1], 1) < 0) {
- ERRNO_ERR0(LOG_ERR,"restoring dup2 1 failed\n");
- return 0;
- }
-
- if (dup2(tmp_io[0], 0) < 0) {
- ERRNO_ERR0(LOG_ERR,"restoring dup2 1 failed\n");
- return 0;
- }
-
- /* close loose-ends */
- sf_close(tmp_io[0]);
- sf_close(tmp_io[1]);
- sf_close(ifd[1]);
- sf_close(ofd[0]);
- state->ifd = ifd[0];
- state->ofd = ofd[1];
-
- if (argv && set_env(state->progpid, "ARGV", argv)) {
- ERRNO_ERR0(LOG_ERR,"something went wrong with set_env\n");
- }
-
- /*
- * Start the program.
- */
- pm_status = ose_pm_start_program(state->progpid);
- if (pm_status != PM_SUCCESS) {
- ERROR1(LOG_ERR,"ose_pm_install_load_module failed - pmstatus: 0x%08x\n",
- pm_status);
- return 0;
- }
-
- return 1;
-}
-
-#define SET_AIO(REQ,FD,SIZE,BUFF) \
- /* Make sure to clean data structure of previous request */ \
- memset(&(REQ),0,sizeof(REQ)); \
- (REQ).aio_fildes = FD; \
- (REQ).aio_offset = FM_POSITION_CURRENT; \
- (REQ).aio_nbytes = SIZE; \
- (REQ).aio_buf = BUFF; \
- (REQ).aio_sigevent.sigev_notify = SIGEV_NONE
-
-#define READ_AIO(REQ,FD,SIZE,BUFF) do { \
- SET_AIO(REQ,FD,SIZE,BUFF); \
- if (aio_read(&(REQ)) != 0) \
- ERRNO_ERR1(LOG_ERR,"aio_read of child_read_req(%d) failed\n",FD); \
- } while (0)
-
-#define WRITE_AIO(FD,SIZE,BUFF) do { \
- struct aiocb *write_req = malloc(sizeof(struct aiocb)); \
- char *write_buff = malloc(sizeof(char)*SIZE); \
- memcpy(write_buff,BUFF,SIZE); \
- SET_AIO(*write_req,FD,SIZE,write_buff); \
- if (aio_write(write_req) != 0) \
- ERRNO_ERR1(LOG_ERR,"aio_write of write_req(%d) failed\n",FD); \
- } while(0)
-
-int pass_on(ProgramState *state);
-int pass_on(ProgramState *s) {
- SIGSELECT sigsel[] = {0,FM_READ_PTR_REPLY};
- union SIGNAL *sig;
- char child_read_buff[BUFSIZ], pipe_read_buff[BUFSIZ];
- struct aiocb child_read_req, pipe_read_req;
- int rfd, wfd = 0;
- FmHandle rfh, child_rfh;
- int outstanding_writes = 0, got_some = 0, child_done = 0;
-
- if ((rfd = sf_open(s->r_pipe, O_RDONLY, 0)) < 0) {
- ERRNO_ERR1(LOG_ERR,"Could not open FIFO '%s' for reading.\n", s->r_pipe);
- rfd = 0;
- return 1;
- }
-
- attach(NULL,s->progpid);
-
- /* Open the log file */
- erts_run_erl_log_open();
-
- efs_examine_fd(rfd,FLIB_FD_HANDLE,&rfh);
- efs_examine_fd(s->ifd,FLIB_FD_HANDLE,&child_rfh);
-
- READ_AIO(child_read_req,s->ifd,BUFSIZ,child_read_buff);
- READ_AIO(pipe_read_req,rfd,BUFSIZ,pipe_read_buff);
-
- while (1) {
- time_t now,last_activity;
-
- time(&last_activity);
- sig = receive_w_tmo(erts_run_erl_log_alive_minutes()*60000,sigsel);
-
- time(&now);
-
- if (sig) {
- erts_run_erl_log_activity(0,now,last_activity);
- } else {
- /* timeout */
- erts_run_erl_log_activity(1,now,last_activity);
- continue;
- }
-
- switch (sig->signo) {
- case OS_ATTACH_SIG: {
- if (rfd) { sf_close(rfd); rfd = 0; }
- free_buf(&sig);
- child_done = 1;
- /* Make sure to to let all outstanding write request finish */
- if (outstanding_writes)
- break;
- if (wfd) sf_close(wfd);
- return 0;
- }
- case FM_WRITE_PTR_REPLY: {
- if (sig->fm_write_ptr.status == EFS_SUCCESS) {
- if (sig->fm_write_ptr.actual < sig->fm_write_ptr.requested) {
- WRITE_AIO(wfd, sig->fm_write_ptr.requested-sig->fm_write_ptr.actual,
- sig->fm_write_ptr.buffer+sig->fm_write_ptr.actual);
- }
- } else {
- /* Assume to_erl has terminated. */
- sf_close(wfd);
- wfd = 0;
- }
- free((char*)sig->fm_write_ptr.buffer);
- aio_dispatch(sig);
- if ((--outstanding_writes == 0) && child_done) {
- if (wfd) sf_close(wfd);
- return 0;
- }
- break;
- }
- case FM_READ_PTR_REPLY: {
- /* Child fd */
- if (sig->fm_read_ptr.handle == child_rfh) {
-
- /* Child terminated */
- if (sig->fm_read_ptr.status != EFS_SUCCESS ||
- sig->fm_read_ptr.actual == 0) {
-
- if (rfd) { sf_close(rfd); rfd = 0; }
-
- if (sig->fm_read_ptr.status != EFS_SUCCESS) {
- ERROR0(LOG_ERR,"Erlang closed the connection.");
- aio_dispatch(sig);
- return 1;
- }
-
- /* child closed connection gracefully */
- aio_dispatch(sig);
- if (outstanding_writes) {
- child_done = 1;
- break;
- }
-
- if (wfd) sf_close(wfd);
-
- return 0;
- } else {
- erts_run_erl_log_write(sig->fm_read_ptr.buffer,
- sig->fm_read_ptr.actual);
- if (wfd) {
- WRITE_AIO(wfd, sig->fm_read_ptr.actual, sig->fm_read_ptr.buffer);
- outstanding_writes++;
- }
- aio_dispatch(sig);
- READ_AIO(child_read_req, s->ifd,BUFSIZ, child_read_buff);
- }
- /* pipe fd */
- } else if (sig->fm_read_ptr.handle == rfh) {
- if (sig->fm_read_ptr.status != EFS_SUCCESS) {
- if(rfd) sf_close(rfd);
- if(wfd) sf_close(wfd);
- aio_dispatch(sig);
- ERRNO_ERR0(LOG_ERR,"Error in reading from FIFO.");
- return 1;
- }
- if (sig->fm_read_ptr.actual == 0) {
- /* to_erl closed its end of the pipe */
- aio_dispatch(sig);
- sf_close(rfd);
- rfd = sf_open(s->r_pipe,O_RDONLY|DONT_BLOCK_PLEASE, 0);
- if (rfd < 0) {
- ERRNO_ERR1(LOG_ERR,"Could not open FIFO '%s' for reading.",
- s->r_pipe);
- rfd = 0;
- } else {
- READ_AIO(pipe_read_req,rfd,BUFSIZ,pipe_read_buff);
- }
- got_some = 0; /* reset for next session */
- } else {
- int len = sig->fm_read_ptr.actual;
- char *buffer = sig->fm_read_ptr.buffer;
- if (!wfd) {
- /* Try to open the write pipe to to_erl. Now that we got some data
- * from to_erl, to_erl should already be reading this pipe - open
- * should succeed. But in case of error, we just ignore it.
- */
- if ((wfd = sf_open(s->w_pipe, O_WRONLY|DONT_BLOCK_PLEASE, 0)) < 0) {
- erts_run_erl_log_status("Client expected on FIFO %s, "
- "but can't open (len=%d)\n",
- s->w_pipe, sig->fm_read_ptr.actual);
- sf_close(rfd);
- rfd = sf_open(s->r_pipe, O_RDONLY|DONT_BLOCK_PLEASE, 0);
- if (rfd < 0) {
- ERRNO_ERR1(LOG_ERR,"Could not open FIFO '%s' for reading.",
- s->r_pipe);
- return 1;
- }
- wfd = 0;
- } else {
-#ifdef DEBUG
- erts_run_erl_log_status("run_erl: %s opened for writing\n",
- s->w_pipe);
-#endif
- }
- }
-
- if (!got_some && wfd && buffer[0] == '\014') {
- char wbuf[30];
- int wlen = sn_printf(wbuf,sizeof(wbuf),"[run_erl v%u-%u]\n",
- RUN_ERL_HI_VER, RUN_ERL_LO_VER);
- /* For some reason this, the first write aio seems to
- not get an FM_WRITE_PTR_REPLY, so we do not do:
- outstanding_writes++;
- */
- WRITE_AIO(wfd, wlen, wbuf);
- }
- got_some = 1;
-
- /* Write the message */
-#ifdef DEBUG
- erts_run_erl_log_status("Pty master write; ");
-#endif
- len = erts_run_erl_extract_ctrl_seq(buffer,len, s->ofd);
-
- if (len > 0) {
- int wlen = erts_run_erl_write_all(s->ofd, buffer, len);
- if (wlen != len) {
- aio_dispatch(sig);
- ERRNO_ERR0(LOG_ERR,"Error in writing to terminal.");
- if(rfd) sf_close(rfd);
- if(wfd) sf_close(wfd);
- return 1;
- }
- }
-#ifdef DEBUG
- erts_run_erl_log_status("OK\n");
-#endif
- aio_dispatch(sig);
- READ_AIO(pipe_read_req,rfd,BUFSIZ,pipe_read_buff);
- }
- }
- break;
- }
- default: {
- free_buf(&sig);
- break;
- }
- }
- }
-}
-
-OS_PROCESS(run_erl_process) {
- char *logdir, *command, *blockname;
- SIGSELECT sigsel[] = {1,ERTS_SIGNAL_RUN_ERL_SETUP};
- union SIGNAL *sig = receive(sigsel);
- ProgramState state;
- char pipename[FILENAME_BUFSIZ];
-
- state.info = NULL;
-
- logdir = strdup(sig->setup.logdir);
- command = strdup(sig->setup.command);
- strn_cpy(pipename,sizeof(pipename),sig->setup.pipename);
-
- if (sig->setup.blockname)
- blockname = strdup(sig->setup.blockname);
- else
- blockname = NULL;
-
- erts_run_erl_log_init(sig->setup.run_daemon, logdir);
-
- free_buf(&sig);
-
- if (erts_run_erl_open_fifo(pipename,state.w_pipe,state.r_pipe))
- kill_proc(current_process());
-
- if (create_child_process(command,blockname,&state))
- pass_on(&state);
-
- free(logdir);
- free(command);
- if (blockname)
- free(blockname);
-
- if (state.info)
- free_buf(((union SIGNAL**)&state.info));
-
- sf_close(state.ifd);
- sf_close(state.ofd);
-
- unlink(state.w_pipe);
- unlink(state.r_pipe);
-
- kill_proc(current_process());
-}
-
-int run_erl(int argc,char **argv) {
- char *pipename, *logdir, *command, *blockname = NULL;
- int pipename_len, logdir_len, command_len, blockname_len = 0;
- int i = 1, run_daemon = 0;
- PROCESS pid;
- SIGSELECT sigsel[] = {0};
- union SIGNAL *sig;
-
- if(argc < 4) {
- fprintf(stderr,RUN_ERL_USAGE,"run_erl");
- return 1;
- }
-
- while (1) {
- if (argv[i][0] != '-')
- break;
- if (!strcmp(argv[i],"-daemon")) {
- run_daemon = 1;
- i++;
- continue;
- }
- if (!strcmp(argv[i],"-block")) {
- blockname = argv[i+1];
- blockname_len = strlen(argv[i+1]) + 1;
- i+=2;
- continue;
- }
- fprintf(stderr,RUN_ERL_USAGE,"run_erl");
- return 1;
- }
-
- pipename = argv[i++];
- logdir = argv[i++];
- command = argv[i++];
-
- /* + 1 to include NULL at end */
- logdir_len = strlen(logdir) + 1;
- command_len = strlen(command) + 1;
- pipename_len = strlen(pipename) + 1;
-
- if (run_daemon) {
- /* We request that the run_erl_process should be started from the
- main process so that it does not die when the shell command
- returns */
- PROCESS main_pid;
- hunt_in_block("run_erl","main",&main_pid);
- sig = alloc(sizeof(*sig),ERTS_SIGNAL_RUN_ERL_DAEMON);
- send(&sig,main_pid);
- sig = receive(sigsel);
- pid = sender(&sig);
- free_buf(&sig);
- } else {
- pid = create_process(OS_BG_PROC,"run_erl_process",
- run_erl_process, 0x800,
- 0, 0, 0, NULL, 0, 0);
- }
-
- sig = alloc(sizeof(RunErlSetup)+
- logdir_len+command_len+pipename_len+blockname_len,
- ERTS_SIGNAL_RUN_ERL_SETUP);
- sig->setup.run_daemon = run_daemon;
- sig->setup.logdir = ((char*)sig)+sizeof(RunErlSetup);
- sig->setup.command = ((char*)sig)+sizeof(RunErlSetup)+logdir_len;
- sig->setup.pipename = ((char*)sig)+sizeof(RunErlSetup)+logdir_len+command_len;
- if (blockname)
- sig->setup.blockname = ((char*)sig)+sizeof(RunErlSetup)+
- logdir_len+command_len+pipename_len;
- else
- sig->setup.blockname = NULL;
-
- strcpy(sig->setup.logdir,logdir);
- strcpy(sig->setup.command,command);
- strcpy(sig->setup.pipename,pipename);
- if (blockname) strcpy(sig->setup.blockname,blockname);
-
- send(&sig,pid);
-
- if (run_daemon) {
- /* We are a daemon, error msgs will be sent to ramlog */
- start(pid);
- return 1;
- }
-
- /* We are not daemon, error msgs will be sent to stderr and we block here */
- efs_clone(pid);
- start(pid);
-
- attach(NULL,pid);
- sig = receive(sigsel);
-
- return 1;
-}
diff --git a/erts/etc/ose/run_erl.h b/erts/etc/ose/run_erl.h
deleted file mode 100644
index bdc8b6c355..0000000000
--- a/erts/etc/ose/run_erl.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 2013. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- */
-#ifndef ERL_RUN_ERL_H
-#define ERL_RUN_ERL_H
-
-#include "ose.h"
-
-#include "erts.sig"
-
-int run_erl(int argc, char **argv);
-OS_PROCESS(run_erl_process);
-
-#endif
diff --git a/erts/etc/ose/run_erl_main.c b/erts/etc/ose/run_erl_main.c
deleted file mode 100644
index 8895c773a1..0000000000
--- a/erts/etc/ose/run_erl_main.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 2013. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- */
-/*
- * Module: run_erl_main.c
- *
- * Container for load module that installs both run_erl and to_erl command.
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <stdio.h>
-
-#include "ose.h"
-#include "shell.h"
-
-#include "run_erl_common.h"
-#include "run_erl.h"
-#include "to_erl_common.h"
-
-union SIGNAL {
- SIGSELECT signo;
-};
-
-int main(int argc, char **argv)
-{
-
- char run_erl_usage[320],
- to_erl_usage[120];
-
- (void)stdin;(void)stdout;(void)stderr;
-
- sprintf(run_erl_usage,RUN_ERL_USAGE,"run_erl [-daemon] [-block blockname]");
- sprintf(to_erl_usage,TO_ERL_USAGE,"pipename");
-
- shell_add_cmd_attrs(
- "run_erl",run_erl_usage,
- "Redirect Erlang input and output streams",
- run_erl,DEFAULT_PROC_TYPE,DEFAULT_PRIORITY,DEFAULT_STACK_SIZE);
-
- shell_add_cmd_attrs(
- "to_erl",to_erl_usage,
- "Attach to redirected Erlang input and output streams",
- to_erl,DEFAULT_PROC_TYPE,DEFAULT_PRIORITY,DEFAULT_STACK_SIZE);
-
- while (1) {
- static const SIGSELECT sigsel[] = {0};
- union SIGNAL *sig = receive(sigsel);
-
- if (sig->signo == ERTS_SIGNAL_RUN_ERL_DAEMON) {
- PROCESS pid = create_process(OS_BG_PROC,"run_erl_daemon",
- run_erl_process, 0x800,
- 0, 0, 0, NULL, 0, 0);
- send_w_s(&sig,pid,sender(&sig));
- } else {
- printf("Got unexpected signal!");
- free_buf(&sig);
- }
- }
-
- return 1;
-}
diff --git a/erts/etc/unix/etp-commands.in b/erts/etc/unix/etp-commands.in
index 19d67de92f..7b554e71f2 100644
--- a/erts/etc/unix/etp-commands.in
+++ b/erts/etc/unix/etp-commands.in
@@ -774,7 +774,7 @@ define etp-pid-1
#
set $etp_pid_1 = (Eterm)($arg0)
if ($etp_pid_1 & 0xF) == 0x3
- if (etp_arch_bits == 64 && etp_halfword == 0)
+ if (etp_arch_bits == 64)
if (etp_big_endian)
set $etp_pid_data = (unsigned) ((((Uint64) $etp_pid_1) >> 36) & 0x0fffffff)
else
@@ -834,7 +834,7 @@ define etp-port-1
#
set $etp_port_1 = (Eterm)($arg0)
if ($etp_port_1 & 0xF) == 0x7
- if (etp_arch_bits == 64 && etp_halfword == 0)
+ if (etp_arch_bits == 64)
if (etp_big_endian)
set $etp_port_data = (unsigned) ((((Uint64) $etp_port_1) >> 36) & 0x0fffffff)
else
@@ -1577,7 +1577,7 @@ define etp-term-dump-pid
#
set $etp_pid_1 = (Eterm)($arg0)
if ($etp_pid_1 & 0xF) == 0x3
- if (etp_arch_bits == 64 && etp_halfword == 0)
+ if (etp_arch_bits == 64)
if (etp_big_endian)
set $etp_pid_data = (unsigned) ((((Uint64) $etp_pid_1) >> 36) & 0x0fffffff)
else
@@ -1622,7 +1622,7 @@ end
define etp-pid2pix-1
# Args: Eterm
#
- if (etp_arch_bits == 64 && etp_halfword == 0)
+ if (etp_arch_bits == 64)
if (etp_big_endian)
set $etp_pix = (int) (((Uint64) $arg0) & 0x0fffffff)
else
@@ -1965,7 +1965,7 @@ end
define etp-port-id2pix-1
# Args: Eterm
#
- if (etp_arch_bits == 64 && etp_halfword == 0)
+ if (etp_arch_bits == 64)
if (etp_big_endian)
set $etp_pix = (int) (((Uint64) $arg0) & 0x0fffffff)
elser
@@ -2493,12 +2493,6 @@ define etp-system-info
printf "Little\n"
end
printf "Word size: %d-bit\n", etp_arch_bits
- printf "Halfword: "
- if (etp_halfword)
- printf "yes\n"
- else
- printf "no\n"
- end
printf "HiPE support: "
if (etp_hipe)
printf "yes\n"
diff --git a/erts/etc/unix/run_erl.c b/erts/etc/unix/run_erl.c
index c8414030ca..44efb975ba 100644
--- a/erts/etc/unix/run_erl.c
+++ b/erts/etc/unix/run_erl.c
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 1996-2013. All Rights Reserved.
+ * Copyright Ericsson AB 1996-2015. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,13 +41,11 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
-
#ifdef HAVE_WORKING_POSIX_OPENPT
#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE 600
#endif
#endif
-
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
@@ -65,6 +63,11 @@
#include <dirent.h>
#include <termios.h>
#include <time.h>
+
+#ifdef __ANDROID__
+# include <termios.h>
+#endif
+
#ifdef HAVE_SYSLOG_H
# include <syslog.h>
#endif
@@ -84,25 +87,81 @@
# include <stropts.h>
#endif
-#include "run_erl_common.h"
+#include "run_erl.h"
#include "safe_string.h" /* sn_printf, strn_cpy, strn_cat, etc */
+#ifdef O_NONBLOCK
+# define DONT_BLOCK_PLEASE O_NONBLOCK
+#else
+# define DONT_BLOCK_PLEASE O_NDELAY
+# ifndef EAGAIN
+# define EAGAIN -3898734
+# endif
+#endif
+
+#define noDEBUG
+
+#define DEFAULT_LOG_GENERATIONS 5
+#define LOG_MAX_GENERATIONS 1000 /* No more than 1000 log files */
+#define LOG_MIN_GENERATIONS 2 /* At least two to switch between */
+#define DEFAULT_LOG_MAXSIZE 100000
+#define LOG_MIN_MAXSIZE 1000 /* Smallast value for changing log file */
+#define LOG_STUBNAME "erlang.log."
+#define LOG_PERM 0664
+#define DEFAULT_LOG_ACTIVITY_MINUTES 5
+#define DEFAULT_LOG_ALIVE_MINUTES 15
+#define DEFAULT_LOG_ALIVE_FORMAT "%a %b %e %T %Z %Y"
+#define ALIVE_BUFFSIZ 256
+
+#define PERM 0600
+#define STATUSFILENAME "/run_erl.log"
+#define PIPE_STUBNAME "erlang.pipe"
+#define PIPE_STUBLEN strlen(PIPE_STUBNAME)
+
+#ifndef FILENAME_MAX
+#define FILENAME_MAX 250
+#endif
+
+#ifndef O_SYNC
+#define O_SYNC 0
+#define USE_FSYNC 1
+#endif
+
#define MAX(x,y) ((x) > (y) ? (x) : (y))
+#define FILENAME_BUFSIZ FILENAME_MAX
+
/* prototypes */
static void usage(char *);
+static int create_fifo(char *name, int perm);
static int open_pty_master(char **name, int *sfd);
static int open_pty_slave(char *name);
static void pass_on(pid_t);
static void exec_shell(char **);
+static void status(const char *format,...);
+static void error_logf(int priority, int line, const char *format,...);
static void catch_sigchild(int);
+static int next_log(int log_num);
+static int prev_log(int log_num);
+static int find_next_log_num(void);
+static int open_log(int log_num, int flags);
+static void write_to_log(int* lfd, int* log_num, char* buf, int len);
static void daemon_init(void);
+static char *simple_basename(char *path);
static void init_outbuf(void);
static int outbuf_size(void);
static void clear_outbuf(void);
static char* outbuf_first(void);
static void outbuf_delete(int bytes);
static void outbuf_append(const char* bytes, int n);
+static int write_all(int fd, const char* buf, int len);
+static int extract_ctrl_seq(char* buf, int len);
+static void set_window_size(unsigned col, unsigned row);
+
+static ssize_t sf_write(int fd, const void *buffer, size_t len);
+static ssize_t sf_read(int fd, void *buffer, size_t len);
+static int sf_open(const char *path, int flags, mode_t mode);
+static int sf_close(int fd);
#ifdef DEBUG
static void show_terminal_settings(struct termios *t);
@@ -110,11 +169,20 @@ static void show_terminal_settings(struct termios *t);
/* static data */
static char fifo1[FILENAME_BUFSIZ], fifo2[FILENAME_BUFSIZ];
+static char statusfile[FILENAME_BUFSIZ];
+static char log_dir[FILENAME_BUFSIZ];
static char pipename[FILENAME_BUFSIZ];
static FILE *stdstatus = NULL;
+static int log_generations = DEFAULT_LOG_GENERATIONS;
+static int log_maxsize = DEFAULT_LOG_MAXSIZE;
+static int log_alive_minutes = DEFAULT_LOG_ALIVE_MINUTES;
+static int log_activity_minutes = DEFAULT_LOG_ACTIVITY_MINUTES;
+static int log_alive_in_gmt = 0;
+static char log_alive_format[ALIVE_BUFFSIZ+1];
static int run_daemon = 0;
static char *program_name;
static int mfd; /* master pty fd */
+static unsigned protocol_ver = RUN_ERL_LO_VER; /* assume lowest to begin with */
/*
* Output buffer.
@@ -145,13 +213,29 @@ static char* outbuf_in;
LOG_PID|LOG_CONS|LOG_NOWAIT,LOG_USER)
#endif
+#define ERROR0(Prio,Format) error_logf(Prio,__LINE__,Format"\n")
+#define ERROR1(Prio,Format,A1) error_logf(Prio,__LINE__,Format"\n",A1)
+#define ERROR2(Prio,Format,A1,A2) error_logf(Prio,__LINE__,Format"\n",A1,A2)
+
+#ifdef HAVE_STRERROR
+# define ADD_ERRNO(Format) "errno=%d '%s'\n"Format"\n",errno,strerror(errno)
+#else
+# define ADD_ERRNO(Format) "errno=%d\n"Format"\n",errno
+#endif
+#define ERRNO_ERR0(Prio,Format) error_logf(Prio,__LINE__,ADD_ERRNO(Format))
+#define ERRNO_ERR1(Prio,Format,A1) error_logf(Prio,__LINE__,ADD_ERRNO(Format),A1)
+
+
int main(int argc, char **argv)
{
int childpid;
int sfd = -1;
- char *ptyslave=NULL;
+ int fd;
+ char *p, *ptyslave=NULL;
int i = 1;
int off_argv;
+ int calculated_pipename = 0;
+ int highest_pipe_num = 0;
program_name = argv[0];
@@ -169,16 +253,122 @@ int main(int argc, char **argv)
off_argv = i;
strn_cpy(pipename, sizeof(pipename), argv[i++]);
-
- erts_run_erl_log_init(run_daemon,argv[i]);
+ strn_cpy(log_dir, sizeof(log_dir), argv[i]);
+ strn_cpy(statusfile, sizeof(statusfile), log_dir);
+ strn_cat(statusfile, sizeof(statusfile), STATUSFILENAME);
#ifdef DEBUG
- erts_run_erl_log_status("%s: pid is : %d\n", argv[0], getpid());
+ status("%s: pid is : %d\n", argv[0], getpid());
#endif
- /* Open read and write fifo */
- if (erts_run_erl_open_fifo(pipename,fifo1,fifo2))
- exit(1);
+ /* Get values for LOG file handling from the environment */
+ if ((p = getenv("RUN_ERL_LOG_ALIVE_MINUTES"))) {
+ log_alive_minutes = atoi(p);
+ if (!log_alive_minutes) {
+ ERROR1(LOG_ERR,"Minimum value for RUN_ERL_LOG_ALIVE_MINUTES is 1 "
+ "(current value is %s)",p);
+ }
+ log_activity_minutes = log_alive_minutes / 3;
+ if (!log_activity_minutes) {
+ ++log_activity_minutes;
+ }
+ }
+ if ((p = getenv("RUN_ERL_LOG_ACTIVITY_MINUTES"))) {
+ log_activity_minutes = atoi(p);
+ if (!log_activity_minutes) {
+ ERROR1(LOG_ERR,"Minimum value for RUN_ERL_LOG_ACTIVITY_MINUTES is 1 "
+ "(current value is %s)",p);
+ }
+ }
+ if ((p = getenv("RUN_ERL_LOG_ALIVE_FORMAT"))) {
+ if (strlen(p) > ALIVE_BUFFSIZ) {
+ ERROR1(LOG_ERR, "RUN_ERL_LOG_ALIVE_FORMAT can contain a maximum of "
+ "%d characters", ALIVE_BUFFSIZ);
+ }
+ strn_cpy(log_alive_format, sizeof(log_alive_format), p);
+ } else {
+ strn_cpy(log_alive_format, sizeof(log_alive_format), DEFAULT_LOG_ALIVE_FORMAT);
+ }
+ if ((p = getenv("RUN_ERL_LOG_ALIVE_IN_UTC")) && strcmp(p,"0")) {
+ ++log_alive_in_gmt;
+ }
+ if ((p = getenv("RUN_ERL_LOG_GENERATIONS"))) {
+ log_generations = atoi(p);
+ if (log_generations < LOG_MIN_GENERATIONS)
+ ERROR1(LOG_ERR,"Minimum RUN_ERL_LOG_GENERATIONS is %d", LOG_MIN_GENERATIONS);
+ if (log_generations > LOG_MAX_GENERATIONS)
+ ERROR1(LOG_ERR,"Maximum RUN_ERL_LOG_GENERATIONS is %d", LOG_MAX_GENERATIONS);
+ }
+
+ if ((p = getenv("RUN_ERL_LOG_MAXSIZE"))) {
+ log_maxsize = atoi(p);
+ if (log_maxsize < LOG_MIN_MAXSIZE)
+ ERROR1(LOG_ERR,"Minimum RUN_ERL_LOG_MAXSIZE is %d", LOG_MIN_MAXSIZE);
+ }
+
+ /*
+ * Create FIFOs and open them
+ */
+
+ if(*pipename && pipename[strlen(pipename)-1] == '/') {
+ /* The user wishes us to find a unique pipe name in the specified */
+ /* directory */
+ DIR *dirp;
+ struct dirent *direntp;
+
+ calculated_pipename = 1;
+ dirp = opendir(pipename);
+ if(!dirp) {
+ ERRNO_ERR1(LOG_ERR,"Can't access pipe directory '%s'.", pipename);
+ exit(1);
+ }
+
+ /* Check the directory for existing pipes */
+
+ while((direntp=readdir(dirp)) != NULL) {
+ if(strncmp(direntp->d_name,PIPE_STUBNAME,PIPE_STUBLEN)==0) {
+ int num = atoi(direntp->d_name+PIPE_STUBLEN+1);
+ if(num > highest_pipe_num)
+ highest_pipe_num = num;
+ }
+ }
+ closedir(dirp);
+ strn_catf(pipename, sizeof(pipename), "%s.%d",
+ PIPE_STUBNAME, highest_pipe_num+1);
+ } /* if */
+
+ for(;;) {
+ /* write FIFO - is read FIFO for `to_erl' program */
+ strn_cpy(fifo1, sizeof(fifo1), pipename);
+ strn_cat(fifo1, sizeof(fifo1), ".r");
+ if (create_fifo(fifo1, PERM) < 0) {
+ ERRNO_ERR1(LOG_ERR,"Cannot create FIFO %s for writing.", fifo1);
+ exit(1);
+ }
+
+ /* read FIFO - is write FIFO for `to_erl' program */
+ strn_cpy(fifo2, sizeof(fifo2), pipename);
+ strn_cat(fifo2, sizeof(fifo2), ".w");
+
+ /* Check that nobody is running run_erl already */
+ if ((fd = sf_open(fifo2, O_WRONLY|DONT_BLOCK_PLEASE, 0)) >= 0) {
+ /* Open as client succeeded -- run_erl is already running! */
+ sf_close(fd);
+ if (calculated_pipename) {
+ ++highest_pipe_num;
+ strn_catf(pipename, sizeof(pipename), "%s.%d",
+ PIPE_STUBNAME, highest_pipe_num+1);
+ continue;
+ }
+ fprintf(stderr, "Erlang already running on pipe %s.\n", pipename);
+ exit(1);
+ }
+ if (create_fifo(fifo2, PERM) < 0) {
+ ERRNO_ERR1(LOG_ERR,"Cannot create FIFO %s for reading.", fifo2);
+ exit(1);
+ }
+ break;
+ }
/*
* Open master pseudo-terminal
@@ -250,7 +440,7 @@ int main(int argc, char **argv)
sf_close(2);
if (dup(sfd) != 0 || dup(sfd) != 1 || dup(sfd) != 2) {
- erts_run_erl_log_status("Cannot dup\n");
+ status("Cannot dup\n");
}
sf_close(sfd);
exec_shell(argv+off_argv); /* exec_shell expects argv[2] to be */
@@ -293,7 +483,9 @@ static void pass_on(pid_t childpid)
struct timeval timeout;
time_t last_activity;
char buf[BUFSIZ];
- int rfd, wfd=0;
+ char log_alive_buffer[ALIVE_BUFFSIZ+1];
+ int lognum;
+ int rfd, wfd=0, lfd=0;
int maxfd;
int ready;
int got_some = 0; /* from to_erl */
@@ -308,12 +500,13 @@ static void pass_on(pid_t childpid)
}
#ifdef DEBUG
- erts_run_erl_log_status("run_erl: %s opened for reading\n", fifo2);
+ status("run_erl: %s opened for reading\n", fifo2);
#endif
/* Open the log file */
- erts_run_erl_log_open();
+ lognum = find_next_log_num();
+ lfd = open_log(lognum, O_RDWR|O_APPEND|O_CREAT|O_SYNC);
/* Enter the work loop */
@@ -332,8 +525,7 @@ static void pass_on(pid_t childpid)
writefds_ptr = &writefds;
}
time(&last_activity);
- /* don't assume old BSD bug */
- timeout.tv_sec = erts_run_erl_log_alive_minutes()*60;
+ timeout.tv_sec = log_alive_minutes*60; /* don't assume old BSD bug */
timeout.tv_usec = 0;
ready = select(maxfd + 1, &readfds, writefds_ptr, NULL, &timeout);
if (ready < 0) {
@@ -363,7 +555,28 @@ static void pass_on(pid_t childpid)
/* Check how long time we've been inactive */
time(&now);
- erts_run_erl_log_activity(!ready,now,last_activity);
+ if(!ready || now - last_activity > log_activity_minutes*60) {
+ /* Either a time out: 15 minutes without action, */
+ /* or something is coming in right now, but it's a long time */
+ /* since last time, so let's write a time stamp this message */
+ struct tm *tmptr;
+ if (log_alive_in_gmt) {
+ tmptr = gmtime(&now);
+ } else {
+ tmptr = localtime(&now);
+ }
+ if (!strftime(log_alive_buffer, ALIVE_BUFFSIZ, log_alive_format,
+ tmptr)) {
+ strn_cpy(log_alive_buffer, sizeof(log_alive_buffer),
+ "(could not format time in 256 positions "
+ "with current format string.)");
+ }
+ log_alive_buffer[ALIVE_BUFFSIZ] = '\0';
+
+ sn_printf(buf, sizeof(buf), "\n===== %s%s\n",
+ ready?"":"ALIVE ", log_alive_buffer);
+ write_to_log(&lfd, &lognum, buf, strlen(buf));
+ }
}
/*
@@ -398,7 +611,7 @@ static void pass_on(pid_t childpid)
*/
if (FD_ISSET(mfd, &readfds)) {
#ifdef DEBUG
- erts_run_erl_log_status("Pty master read; ");
+ status("Pty master read; ");
#endif
if ((len = sf_read(mfd, buf, BUFSIZ)) <= 0) {
sf_close(rfd);
@@ -416,7 +629,7 @@ static void pass_on(pid_t childpid)
exit(0);
}
- erts_run_erl_log_write(buf, len);
+ write_to_log(&lfd, &lognum, buf, len);
/*
* Save in the output queue.
@@ -432,7 +645,7 @@ static void pass_on(pid_t childpid)
*/
if (FD_ISSET(rfd, &readfds)) {
#ifdef DEBUG
- erts_run_erl_log_status("FIFO read; ");
+ status("FIFO read; ");
#endif
if ((len = sf_read(rfd, buf, BUFSIZ)) < 0) {
sf_close(rfd);
@@ -461,7 +674,7 @@ static void pass_on(pid_t childpid)
* should succeed. But in case of error, we just ignore it.
*/
if ((wfd = sf_open(fifo1, O_WRONLY|DONT_BLOCK_PLEASE, 0)) < 0) {
- erts_run_erl_log_status("Client expected on FIFO %s, but can't open (len=%d)\n",
+ status("Client expected on FIFO %s, but can't open (len=%d)\n",
fifo1, len);
sf_close(rfd);
rfd = sf_open(fifo2, O_RDONLY|DONT_BLOCK_PLEASE, 0);
@@ -473,7 +686,7 @@ static void pass_on(pid_t childpid)
}
else {
#ifdef DEBUG
- erts_run_erl_log_status("run_erl: %s opened for writing\n", fifo1);
+ status("run_erl: %s opened for writing\n", fifo1);
#endif
}
}
@@ -489,15 +702,14 @@ static void pass_on(pid_t childpid)
/* Write the message */
#ifdef DEBUG
- erts_run_erl_log_status("Pty master write; ");
+ status("Pty master write; ");
#endif
- len = erts_run_erl_extract_ctrl_seq(buf, len, mfd);
+ len = extract_ctrl_seq(buf, len);
if(len==1 && buf[0] == '\003') {
kill(childpid,SIGINT);
- }
- else if (len>0 && erts_run_erl_write_all(mfd, buf, len) != len)
- {
+ }
+ else if (len>0 && write_all(mfd, buf, len) != len) {
ERRNO_ERR0(LOG_ERR,"Error in writing to terminal.");
sf_close(rfd);
if(wfd) sf_close(wfd);
@@ -506,7 +718,7 @@ static void pass_on(pid_t childpid)
}
}
#ifdef DEBUG
- erts_run_erl_log_status("OK\n");
+ status("OK\n");
#endif
}
}
@@ -516,6 +728,173 @@ static void catch_sigchild(int sig)
{
}
+/*
+ * next_log:
+ * Returns the index number that follows the given index number.
+ * (Wrapping after log_generations)
+ */
+static int next_log(int log_num) {
+ return log_num>=log_generations?1:log_num+1;
+}
+
+/*
+ * prev_log:
+ * Returns the index number that precedes the given index number.
+ * (Wrapping after log_generations)
+ */
+static int prev_log(int log_num) {
+ return log_num<=1?log_generations:log_num-1;
+}
+
+/*
+ * find_next_log_num()
+ * Searches through the log directory to check which logs that already
+ * exist. It finds the "hole" in the sequence, and returns the index
+ * number for the last log in the log sequence. If there is no hole, index
+ * 1 is returned.
+ */
+static int find_next_log_num(void) {
+ int i, next_gen, log_gen;
+ DIR *dirp;
+ struct dirent *direntp;
+ int log_exists[LOG_MAX_GENERATIONS+1];
+ int stub_len = strlen(LOG_STUBNAME);
+
+ /* Initialize exiting log table */
+
+ for(i=log_generations; i>=0; i--)
+ log_exists[i] = 0;
+ dirp = opendir(log_dir);
+ if(!dirp) {
+ ERRNO_ERR1(LOG_ERR,"Can't access log directory '%s'", log_dir);
+ exit(1);
+ }
+
+ /* Check the directory for existing logs */
+
+ while((direntp=readdir(dirp)) != NULL) {
+ if(strncmp(direntp->d_name,LOG_STUBNAME,stub_len)==0) {
+ int num = atoi(direntp->d_name+stub_len);
+ if(num < 1 || num > log_generations)
+ continue;
+ log_exists[num] = 1;
+ }
+ }
+ closedir(dirp);
+
+ /* Find out the next available log file number */
+
+ next_gen = 0;
+ for(i=log_generations; i>=0; i--) {
+ if(log_exists[i])
+ if(next_gen)
+ break;
+ else
+ ;
+ else
+ next_gen = i;
+ }
+
+ /* Find out the current log file number */
+
+ if(next_gen)
+ log_gen = prev_log(next_gen);
+ else
+ log_gen = 1;
+
+ return log_gen;
+} /* find_next_log_num() */
+
+/* open_log()
+ * Opens a log file (with given index) for writing. Writing may be
+ * at the end or a trucnating write, according to flags.
+ * A LOGGING STARTED and time stamp message is inserted into the log file
+ */
+static int open_log(int log_num, int flags)
+{
+ char buf[FILENAME_MAX];
+ time_t now;
+ struct tm *tmptr;
+ char log_buffer[ALIVE_BUFFSIZ+1];
+ int lfd;
+
+ /* Remove the next log (to keep a "hole" in the log sequence) */
+ sn_printf(buf, sizeof(buf), "%s/%s%d",
+ log_dir, LOG_STUBNAME, next_log(log_num));
+ unlink(buf);
+
+ /* Create or continue on the current log file */
+ sn_printf(buf, sizeof(buf), "%s/%s%d", log_dir, LOG_STUBNAME, log_num);
+ if((lfd = sf_open(buf, flags, LOG_PERM))<0){
+ ERRNO_ERR1(LOG_ERR,"Can't open log file '%s'.", buf);
+ exit(1);
+ }
+
+ /* Write a LOGGING STARTED and time stamp into the log file */
+ time(&now);
+ if (log_alive_in_gmt) {
+ tmptr = gmtime(&now);
+ } else {
+ tmptr = localtime(&now);
+ }
+ if (!strftime(log_buffer, ALIVE_BUFFSIZ, log_alive_format,
+ tmptr)) {
+ strn_cpy(log_buffer, sizeof(log_buffer),
+ "(could not format time in 256 positions "
+ "with current format string.)");
+ }
+ log_buffer[ALIVE_BUFFSIZ] = '\0';
+
+ sn_printf(buf, sizeof(buf), "\n=====\n===== LOGGING STARTED %s\n=====\n",
+ log_buffer);
+ if (write_all(lfd, buf, strlen(buf)) < 0)
+ status("Error in writing to log.\n");
+
+#if USE_FSYNC
+ fsync(lfd);
+#endif
+
+ return lfd;
+}
+
+/* write_to_log()
+ * Writes a message to a log file. If the current log file is full,
+ * a new log file is opened.
+ */
+static void write_to_log(int* lfd, int* log_num, char* buf, int len)
+{
+ int size;
+
+ /* Decide if new logfile needed, and open if so */
+
+ size = lseek(*lfd,0,SEEK_END);
+ if(size+len > log_maxsize) {
+ sf_close(*lfd);
+ *log_num = next_log(*log_num);
+ *lfd = open_log(*log_num, O_RDWR|O_CREAT|O_TRUNC|O_SYNC);
+ }
+
+ /* Write to log file */
+
+ if (write_all(*lfd, buf, len) < 0) {
+ status("Error in writing to log.\n");
+ }
+
+#if USE_FSYNC
+ fsync(*lfd);
+#endif
+}
+
+/* create_fifo()
+ * Creates a new fifo with the given name and permission.
+ */
+static int create_fifo(char *name, int perm)
+{
+ if ((mkfifo(name, perm) < 0) && (errno != EEXIST))
+ return -1;
+ return 0;
+}
+
/* open_pty_master()
* Find a master device, open and return fd and slave device name.
@@ -712,9 +1091,9 @@ static void exec_shell(char **argv)
else
argv[0] = sh;
argv[1] = "-c";
- erts_run_erl_log_status("Args before exec of shell:\n");
+ status("Args before exec of shell:\n");
for (vp = argv, i = 0; *vp; vp++, i++)
- erts_run_erl_log_status("argv[%d] = %s\n", i, *vp);
+ status("argv[%d] = %s\n", i, *vp);
if (stdstatus) {
fclose(stdstatus);
}
@@ -725,6 +1104,26 @@ static void exec_shell(char **argv)
ERRNO_ERR0(LOG_ERR,"Could not execv");
}
+/* status()
+ * Prints the arguments to a status file
+ * Works like printf (see vfrpintf)
+ */
+static void status(const char *format,...)
+{
+ va_list args;
+ time_t now;
+
+ if (stdstatus == NULL)
+ stdstatus = fopen(statusfile, "w");
+ if (stdstatus == NULL)
+ return;
+ now = time(NULL);
+ fprintf(stdstatus, "run_erl [%d] %s", (int)getpid(), ctime(&now));
+ va_start(args, format);
+ vfprintf(stdstatus, format, args);
+ va_end(args);
+ fflush(stdstatus);
+}
static void daemon_init(void)
/* As R Stevens wants it, to a certain extent anyway... */
@@ -764,10 +1163,47 @@ static void daemon_init(void)
run_daemon = 1;
}
+/* error_logf()
+ * Prints the arguments to stderr or syslog
+ * Works like printf (see vfprintf)
+ */
+static void error_logf(int priority, int line, const char *format, ...)
+{
+ va_list args;
+ va_start(args, format);
+
+#ifdef HAVE_SYSLOG_H
+ if (run_daemon) {
+ vsyslog(priority,format,args);
+ }
+ else
+#endif
+ {
+ time_t now = time(NULL);
+ fprintf(stderr, "run_erl:%d [%d] %s", line, (int)getpid(), ctime(&now));
+ vfprintf(stderr, format, args);
+ }
+ va_end(args);
+}
+
static void usage(char *pname)
{
- fprintf(stderr, "Usage: ");
- fprintf(stderr, RUN_ERL_USAGE, pname);
+ fprintf(stderr, "Usage: %s (pipe_name|pipe_dir/) log_dir \"command [parameters ...]\"\n", pname);
+ fprintf(stderr, "\nYou may also set the environment variables RUN_ERL_LOG_GENERATIONS\n");
+ fprintf(stderr, "and RUN_ERL_LOG_MAXSIZE to the number of log files to use and the\n");
+ fprintf(stderr, "size of the log file when to switch to the next log file\n");
+}
+
+/* Instead of making sure basename exists, we do our own */
+static char *simple_basename(char *path)
+{
+ char *ptr;
+ for (ptr = path; *ptr != '\0'; ++ptr) {
+ if (*ptr == '/') {
+ path = ptr + 1;
+ }
+ }
+ return path;
}
static void init_outbuf(void)
@@ -838,6 +1274,114 @@ static void outbuf_append(const char* buf, int n)
outbuf_in += n;
}
+/* Call write() until entire buffer has been written or error.
+ * Return len or -1.
+ */
+static int write_all(int fd, const char* buf, int len)
+{
+ int left = len;
+ int written;
+ for (;;) {
+ written = sf_write(fd,buf,left);
+ if (written == left) {
+ return len;
+ }
+ if (written < 0) {
+ return -1;
+ }
+ left -= written;
+ buf += written;
+ }
+}
+
+static ssize_t sf_read(int fd, void *buffer, size_t len) {
+ ssize_t n = 0;
+
+ do { n = read(fd, buffer, len); } while (n < 0 && errno == EINTR);
+
+ return n;
+}
+
+static ssize_t sf_write(int fd, const void *buffer, size_t len) {
+ ssize_t n = 0;
+
+ do { n = write(fd, buffer, len); } while (n < 0 && errno == EINTR);
+
+ return n;
+}
+
+static int sf_open(const char *path, int type, mode_t mode) {
+ int fd = 0;
+
+ do { fd = open(path, type, mode); } while(fd < 0 && errno == EINTR);
+
+ return fd;
+}
+static int sf_close(int fd) {
+ int res = 0;
+
+ do { res = close(fd); } while(fd < 0 && errno == EINTR);
+
+ return res;
+}
+/* Extract any control sequences that are ment only for run_erl
+ * and should not be forwarded to the pty.
+ */
+static int extract_ctrl_seq(char* buf, int len)
+{
+ static const char prefix[] = "\033_";
+ static const char suffix[] = "\033\\";
+ char* bufend = buf + len;
+ char* start = buf;
+ char* command;
+ char* end;
+
+ for (;;) {
+ start = find_str(start, bufend-start, prefix);
+ if (!start) break;
+
+ command = start + strlen(prefix);
+ end = find_str(command, bufend-command, suffix);
+ if (end) {
+ unsigned col, row;
+ if (sscanf(command,"version=%u", &protocol_ver)==1) {
+ /*fprintf(stderr,"to_erl v%u\n", protocol_ver);*/
+ }
+ else if (sscanf(command,"winsize=%u,%u", &col, &row)==2) {
+ set_window_size(col,row);
+ }
+ else {
+ ERROR2(LOG_ERR, "Ignoring unknown ctrl command '%.*s'\n",
+ (int)(end-command), command);
+ }
+
+ /* Remove ctrl sequence from buf */
+ end += strlen(suffix);
+ memmove(start, end, bufend-end);
+ bufend -= end - start;
+ }
+ else {
+ ERROR2(LOG_ERR, "Missing suffix in ctrl sequence '%.*s'\n",
+ (int)(bufend-start), start);
+ break;
+ }
+ }
+ return bufend - buf;
+}
+
+static void set_window_size(unsigned col, unsigned row)
+{
+#ifdef TIOCSWINSZ
+ struct winsize ws;
+ ws.ws_col = col;
+ ws.ws_row = row;
+ if (ioctl(mfd, TIOCSWINSZ, &ws) < 0) {
+ ERRNO_ERR0(LOG_ERR,"Failed to set window size");
+ }
+#endif
+}
+
+
#ifdef DEBUG
#define S(x) ((x) > 0 ? 1 : 0)
diff --git a/erts/etc/common/run_erl_vsn.h b/erts/etc/unix/run_erl.h
index 2c3e67e81c..cc70a98e52 100644
--- a/erts/etc/common/run_erl_vsn.h
+++ b/erts/etc/unix/run_erl.h
@@ -1,8 +1,8 @@
/*
* %CopyrightBegin%
- *
+ *
* Copyright Ericsson AB 2008-2009. All Rights Reserved.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -14,7 +14,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* %CopyrightEnd%
*/
@@ -28,3 +28,4 @@
* 0: Older, without version handshake
* 1: R12B-3, version handshake + window size ctrl
*/
+
diff --git a/erts/etc/common/safe_string.c b/erts/etc/unix/safe_string.c
index cdcdbf16f0..a5c11d41d8 100644
--- a/erts/etc/common/safe_string.c
+++ b/erts/etc/unix/safe_string.c
@@ -1,8 +1,8 @@
/*
* %CopyrightBegin%
- *
+ *
* Copyright Ericsson AB 2008-2009. All Rights Reserved.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -14,12 +14,12 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* %CopyrightEnd%
*/
-/*
+/*
* Module: safe_string.c
- *
+ *
* This is a bunch of generic string operation
* that are safe regarding buffer overflow.
*
@@ -121,3 +121,4 @@ void* memmove(void *dest, const void *src, size_t n)
return dest;
}
#endif /* HAVE_MEMMOVE */
+
diff --git a/erts/etc/common/safe_string.h b/erts/etc/unix/safe_string.h
index f9d2b2023a..5a471f10de 100644
--- a/erts/etc/common/safe_string.h
+++ b/erts/etc/unix/safe_string.h
@@ -1,8 +1,8 @@
/*
* %CopyrightBegin%
- *
+ *
* Copyright Ericsson AB 2008-2009. All Rights Reserved.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -14,12 +14,12 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* %CopyrightEnd%
*/
-/*
+/*
* Module: safe_string.h
- *
+ *
* This is an interface to a bunch of generic string operation
* that are safe regarding buffer overflow.
*
@@ -63,3 +63,4 @@ char* find_str(const char* haystack, int size, const char* needle);
#ifndef HAVE_MEMMOVE
void* memmove(void *dest, const void *src, size_t n);
#endif
+
diff --git a/erts/etc/unix/to_erl.c b/erts/etc/unix/to_erl.c
index 82d3218964..0bd469727c 100644
--- a/erts/etc/unix/to_erl.c
+++ b/erts/etc/unix/to_erl.c
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 1996-2013. All Rights Reserved.
+ * Copyright Ericsson AB 1996-2015. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,9 +17,592 @@
*
* %CopyrightEnd%
*/
+/*
+ * Module: to_erl.c
+ *
+ * This module implements a process that opens two specified FIFOs, one
+ * for reading and one for writing; reads from its stdin, and writes what
+ * it has read to the write FIF0; reads from the read FIFO, and writes to
+ * its stdout.
+ *
+ ________ _________
+ | |--<-- pipe.r (fifo1) --<--| |
+ | to_erl | | run_erl | (parent)
+ |________|-->-- pipe.w (fifo2) -->--|_________|
+ ^ master pty
+ |
+ | slave pty
+ ____V____
+ | |
+ | "erl" | (child)
+ |_________|
+ */
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <termios.h>
+#include <dirent.h>
+#include <signal.h>
+#include <errno.h>
+#ifdef HAVE_SYS_IOCTL_H
+# include <sys/ioctl.h>
+#endif
+
+#include "run_erl.h"
+#include "safe_string.h" /* strn_cpy, strn_catf, sn_printf, etc. */
+
+#if defined(O_NONBLOCK)
+# define DONT_BLOCK_PLEASE O_NONBLOCK
+#else
+# define DONT_BLOCK_PLEASE O_NDELAY
+# if !defined(EAGAIN)
+# define EAGAIN -3898734
+# endif
+#endif
+
+#ifdef HAVE_STRERROR
+# define STRERROR(x) strerror(x)
+#else
+# define STRERROR(x) ""
+#endif
+
+#define noDEBUG
+
+#define PIPE_DIR "/tmp/"
+#define PIPE_STUBNAME "erlang.pipe"
+#define PIPE_STUBLEN strlen(PIPE_STUBNAME)
+
+#ifdef DEBUG
+#define STATUS(s) { fprintf(stderr, (s)); fflush(stderr); }
+#else
+#define STATUS(s)
+#endif
+
+#ifndef FILENAME_MAX
+#define FILENAME_MAX 250
+#endif
+
+static struct termios tty_smode, tty_rmode;
+static int tty_eof = 0;
+static int recv_sig = 0;
+static int protocol_ver = RUN_ERL_LO_VER; /* assume lowest to begin with */
+
+static int write_all(int fd, const char* buf, int len);
+static int window_size_seq(char* buf, size_t bufsz);
+static int version_handshake(char* buf, int len, int wfd);
+#ifdef DEBUG
+static void show_terminal_settings(struct termios *);
+#endif
+
+static void handle_ctrlc(int sig)
+{
+ /* Reinstall the handler, and signal break flag */
+ signal(SIGINT,handle_ctrlc);
+ recv_sig = SIGINT;
+}
+
+static void handle_sigwinch(int sig)
+{
+ recv_sig = SIGWINCH;
+}
+
+static void usage(char *pname)
+{
+ fprintf(stderr, "Usage: %s [-h|-F] [pipe_name|pipe_dir/]\n", pname);
+ fprintf(stderr, "\t-h\tThis help text.\n");
+ fprintf(stderr, "\t-F\tForce connection even though pipe is locked by other to_erl process.\n");
+}
+
+int main(int argc, char **argv)
+{
+ char FIFO1[FILENAME_MAX], FIFO2[FILENAME_MAX];
+ int i, len, wfd, rfd;
+ fd_set readfds;
+ char buf[BUFSIZ];
+ char pipename[FILENAME_MAX];
+ int pipeIx = 1;
+ int force_lock = 0;
+ int got_some = 0;
+
+ if (argc >= 2 && argv[1][0]=='-') {
+ switch (argv[1][1]) {
+ case 'h':
+ usage(argv[0]);
+ exit(1);
+ case 'F':
+ force_lock = 1;
+ break;
+ default:
+ fprintf(stderr,"Invalid option '%s'\n",argv[1]);
+ exit(1);
+ }
+ pipeIx = 2;
+ }
+
+#ifdef DEBUG
+ fprintf(stderr, "%s: pid is : %d\n", argv[0], (int)getpid());
+#endif
+
+ strn_cpy(pipename, sizeof(pipename),
+ (argv[pipeIx] ? argv[pipeIx] : PIPE_DIR));
+
+ if(*pipename && pipename[strlen(pipename)-1] == '/') {
+ /* The user wishes us to find a pipe name in the specified */
+ /* directory */
+ int highest_pipe_num = 0;
+ DIR *dirp;
+ struct dirent *direntp;
+
+ dirp = opendir(pipename);
+ if(!dirp) {
+ fprintf(stderr, "Can't access pipe directory %s: %s\n", pipename, strerror(errno));
+ exit(1);
+ }
+
+ /* Check the directory for existing pipes */
+
+ while((direntp=readdir(dirp)) != NULL) {
+ if(strncmp(direntp->d_name,PIPE_STUBNAME,PIPE_STUBLEN)==0) {
+ int num = atoi(direntp->d_name+PIPE_STUBLEN+1);
+ if(num > highest_pipe_num)
+ highest_pipe_num = num;
+ }
+ }
+ closedir(dirp);
+ strn_catf(pipename, sizeof(pipename), (highest_pipe_num?"%s.%d":"%s"),
+ PIPE_STUBNAME, highest_pipe_num);
+ } /* if */
+
+ /* read FIFO */
+ sn_printf(FIFO1,sizeof(FIFO1),"%s.r",pipename);
+ /* write FIFO */
+ sn_printf(FIFO2,sizeof(FIFO2),"%s.w",pipename);
+
+ /* Check that nobody is running to_erl on this pipe already */
+ if ((wfd = open (FIFO1, O_WRONLY|DONT_BLOCK_PLEASE, 0)) >= 0) {
+ /* Open as server succeeded -- to_erl is already running! */
+ close(wfd);
+ fprintf(stderr, "Another to_erl process already attached to pipe "
+ "%s.\n", pipename);
+ if (force_lock) {
+ fprintf(stderr, "But we proceed anyway by force (-F).\n");
+ }
+ else {
+ exit(1);
+ }
+ }
+
+ if ((rfd = open (FIFO1, O_RDONLY|DONT_BLOCK_PLEASE, 0)) < 0) {
+#ifdef DEBUG
+ fprintf(stderr, "Could not open FIFO %s for reading.\n", FIFO1);
+#endif
+ fprintf(stderr, "No running Erlang on pipe %s: %s\n", pipename, strerror(errno));
+ exit(1);
+ }
+#ifdef DEBUG
+ fprintf(stderr, "to_erl: %s opened for reading\n", FIFO1);
+#endif
+
+ if ((wfd = open (FIFO2, O_WRONLY|DONT_BLOCK_PLEASE, 0)) < 0) {
+#ifdef DEBUG
+ fprintf(stderr, "Could not open FIFO %s for writing.\n", FIFO2);
+#endif
+ fprintf(stderr, "No running Erlang on pipe %s: %s\n", pipename, strerror(errno));
+ close(rfd);
+ exit(1);
+ }
+#ifdef DEBUG
+ fprintf(stderr, "to_erl: %s opened for writing\n", FIFO2);
+#endif
+
+ fprintf(stderr, "Attaching to %s (^D to exit)\n\n", pipename);
+
+ /* Set break handler to our handler */
+ signal(SIGINT,handle_ctrlc);
+
+ /*
+ * Save the current state of the terminal, and set raw mode.
+ */
+ if (tcgetattr(0, &tty_rmode) , 0) {
+ fprintf(stderr, "Cannot get terminals current mode\n");
+ exit(-1);
+ }
+ tty_smode = tty_rmode;
+ tty_eof = '\004'; /* Ctrl+D to exit */
+#ifdef DEBUG
+ show_terminal_settings(&tty_rmode);
+#endif
+ tty_smode.c_iflag =
+ 1*BRKINT |/*Signal interrupt on break.*/
+ 1*IGNPAR |/*Ignore characters with parity errors.*/
+ 1*ISTRIP |/*Strip character.*/
+ 0;
+
+#if 0
+0*IGNBRK |/*Ignore break condition.*/
+0*PARMRK |/*Mark parity errors.*/
+0*INPCK |/*Enable input parity check.*/
+0*INLCR |/*Map NL to CR on input.*/
+0*IGNCR |/*Ignore CR.*/
+0*ICRNL |/*Map CR to NL on input.*/
+0*IUCLC |/*Map upper-case to lower-case on input.*/
+0*IXON |/*Enable start/stop output control.*/
+0*IXANY |/*Enable any character to restart output.*/
+0*IXOFF |/*Enable start/stop input control.*/
+0*IMAXBEL|/*Echo BEL on input line too long.*/
+#endif
+
+ tty_smode.c_oflag =
+ 1*OPOST |/*Post-process output.*/
+ 1*ONLCR |/*Map NL to CR-NL on output.*/
+#ifdef XTABS
+ 1*XTABS |/*Expand tabs to spaces. (Linux)*/
+#endif
+#ifdef OXTABS
+ 1*OXTABS |/*Expand tabs to spaces. (FreeBSD)*/
+#endif
+#ifdef NL0
+ 1*NL0 |/*Select newline delays*/
+#endif
+#ifdef CR0
+ 1*CR0 |/*Select carriage-return delays*/
+#endif
+#ifdef TAB0
+ 1*TAB0 |/*Select horizontal tab delays*/
+#endif
+#ifdef BS0
+ 1*BS0 |/*Select backspace delays*/
+#endif
+#ifdef VT0
+ 1*VT0 |/*Select vertical tab delays*/
+#endif
+#ifdef FF0
+ 1*FF0 |/*Select form feed delays*/
+#endif
+ 0;
+
+#if 0
+0*OLCUC |/*Map lower case to upper on output.*/
+0*OCRNL |/*Map CR to NL on output.*/
+0*ONOCR |/*No CR output at column 0.*/
+0*ONLRET |/*NL performs CR function.*/
+0*OFILL |/*Use fill characters for delay.*/
+0*OFDEL |/*Fill is DEL, else NULL.*/
+0*NL1 |
+0*CR1 |
+0*CR2 |
+0*CR3 |
+0*TAB1 |
+0*TAB2 |
+0*TAB3 |/*Expand tabs to spaces.*/
+0*BS1 |
+0*VT1 |
+0*FF1 |
+#endif
+
+ /* JALI: removed setting the tty_smode.c_cflag flags, since this is not */
+ /* advisable if this is a *real* terminal, such as the console. In fact */
+ /* this may hang the entire machine, deep, deep down (signalling break */
+ /* or toggling the abort switch doesn't help) */
+
+ tty_smode.c_lflag =
+ 0;
+
+#if 0
+0*ISIG |/*Enable signals.*/
+0*ICANON |/*Canonical input (erase and kill processing).*/
+0*XCASE |/*Canonical upper/lower presentation.*/
+0*ECHO |/*Enable echo.*/
+0*ECHOE |/*Echo erase character as BS-SP-BS.*/
+0*ECHOK |/*Echo NL after kill character.*/
+0*ECHONL |/*Echo NL.*/
+0*NOFLSH |/*Disable flush after interrupt or quit.*/
+0*TOSTOP |/*Send SIGTTOU for background output.*/
+0*ECHOCTL|/*Echo control characters as ^char, delete as ^?.*/
+0*ECHOPRT|/*Echo erase character as character erased.*/
+0*ECHOKE |/*BS-SP-BS erase entire line on line kill.*/
+0*FLUSHO |/*Output is being flushed.*/
+0*PENDIN |/*Retype pending input at next read or input character.*/
+0*IEXTEN |/*Enable extended (implementation-defined) functions.*/
+#endif
+
+ tty_smode.c_cc[VMIN] =0;/* Note that VMIN is the same as VEOF! */
+ tty_smode.c_cc[VTIME] =0;/* Note that VTIME is the same as VEOL! */
+ tty_smode.c_cc[VINTR] =3;
+
+ tcsetattr(0, TCSADRAIN, &tty_smode);
+
+#ifdef DEBUG
+ show_terminal_settings(&tty_smode);
+#endif
+ /*
+ * "Write a ^L to the FIFO which causes the other end to redisplay
+ * the input line."
+ * This does not seem to work as was intended in old comment above.
+ * However, this control character is now (R12B-3) used by run_erl
+ * to trigger the version handshaking between to_erl and run_erl
+ * at the start of every new to_erl-session.
+ */
+
+ if (write(wfd, "\014", 1) < 0) {
+ fprintf(stderr, "Error in writing ^L to FIFO.\n");
+ }
+
+ /*
+ * read and write
+ */
+ while (1) {
+ FD_ZERO(&readfds);
+ FD_SET(0, &readfds);
+ FD_SET(rfd, &readfds);
+ if (select(rfd + 1, &readfds, NULL, NULL, NULL) < 0) {
+ if (recv_sig) {
+ FD_ZERO(&readfds);
+ }
+ else {
+ fprintf(stderr, "Error in select.\n");
+ break;
+ }
+ }
+ len = 0;
+
+ /*
+ * Read from terminal and write to FIFO
+ */
+ if (recv_sig) {
+ switch (recv_sig) {
+ case SIGINT:
+ fprintf(stderr, "[Break]\n\r");
+ buf[0] = '\003';
+ len = 1;
+ break;
+ case SIGWINCH:
+ len = window_size_seq(buf,sizeof(buf));
+ break;
+ default:
+ fprintf(stderr,"Unexpected signal: %u\n",recv_sig);
+ }
+ recv_sig = 0;
+ }
+ else if (FD_ISSET(0, &readfds)) {
+ len = read(0, buf, sizeof(buf));
+ if (len <= 0) {
+ close(rfd);
+ close(wfd);
+ if (len < 0) {
+ fprintf(stderr, "Error in reading from stdin.\n");
+ } else {
+ fprintf(stderr, "[EOF]\n\r");
+ }
+ break;
+ }
+ /* check if there is an eof character in input */
+ for (i = 0; i < len && buf[i] != tty_eof; i++);
+ if (buf[i] == tty_eof) {
+ fprintf(stderr, "[Quit]\n\r");
+ break;
+ }
+ }
+
+ if (len) {
+#ifdef DEBUG
+ if(write(1, buf, len));
+#endif
+ if (write_all(wfd, buf, len) != len) {
+ fprintf(stderr, "Error in writing to FIFO.\n");
+ close(rfd);
+ close(wfd);
+ break;
+ }
+ STATUS("\" OK\r\n");
+ }
+
+ /*
+ * Read from FIFO, write to terminal.
+ */
+ if (FD_ISSET(rfd, &readfds)) {
+ STATUS("FIFO read: ");
+ len = read(rfd, buf, BUFSIZ);
+ if (len < 0 && errno == EAGAIN) {
+ /*
+ * No data this time, but the writing end of the FIFO is still open.
+ * Do nothing.
+ */
+ ;
+ } else if (len <= 0) {
+ /*
+ * Either an error or end of file. In either case, break out
+ * of the loop.
+ */
+ close(rfd);
+ close(wfd);
+ if (len < 0) {
+ fprintf(stderr, "Error in reading from FIFO.\n");
+ } else
+ fprintf(stderr, "[End]\n\r");
+ break;
+ } else {
+ if (!got_some) {
+ if ((len=version_handshake(buf,len,wfd)) < 0) {
+ close(rfd);
+ close(wfd);
+ break;
+ }
+ if (protocol_ver >= 1) {
+ /* Tell run_erl size of terminal window */
+ signal(SIGWINCH, handle_sigwinch);
+ raise(SIGWINCH);
+ }
+ got_some = 1;
+ }
+
+ /*
+ * We successfully read at least one character. Write what we got.
+ */
+ STATUS("Terminal write: \"");
+ if (write_all(1, buf, len) != len) {
+ fprintf(stderr, "Error in writing to terminal.\n");
+ close(rfd);
+ close(wfd);
+ break;
+ }
+ STATUS("\" OK\r\n");
+ }
+ }
+ }
+
+ /*
+ * Reset terminal characterstics
+ * XXX
+ */
+ tcsetattr(0, TCSADRAIN, &tty_rmode);
+ return 0;
+}
+
+/* Call write() until entire buffer has been written or error.
+ * Return len or -1.
+ */
+static int write_all(int fd, const char* buf, int len)
+{
+ int left = len;
+ int written;
+ while (left) {
+ written = write(fd,buf,left);
+ if (written < 0) {
+ return -1;
+ }
+ left -= written;
+ buf += written;
+ }
+ return len;
+}
+
+static int window_size_seq(char* buf, size_t bufsz)
+{
+#ifdef TIOCGWINSZ
+ struct winsize ws;
+ static const char prefix[] = "\033_";
+ static const char suffix[] = "\033\\";
+ /* This Esc sequence is called "Application Program Command"
+ and seems suitable to use for our own customized stuff. */
+
+ if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) == 0) {
+ int len = sn_printf(buf, bufsz, "%swinsize=%u,%u%s",
+ prefix, ws.ws_col, ws.ws_row, suffix);
+ return len;
+ }
+#endif /* TIOCGWINSZ */
+ return 0;
+}
+
+/* to_erl run_erl
+ * | |
+ * |---------- '\014' -------->| (session start)
+ * | |
+ * |<---- "[run_erl v1-0]" ----| (version interval)
+ * | |
+ * |--- Esc_"version=1"Esc\ -->| (common version)
+ * | |
+ */
+static int version_handshake(char* buf, int len, int wfd)
+{
+ unsigned re_high=0, re_low;
+ char *end = find_str(buf,len,"]\n");
+
+ if (end && sscanf(buf,"[run_erl v%u-%u",&re_high,&re_low)==2) {
+ char wbuf[30];
+ int wlen;
+
+ if (re_low > RUN_ERL_HI_VER || re_high < RUN_ERL_LO_VER) {
+ fprintf(stderr,"Incompatible versions: to_erl=v%u-%u run_erl=v%u-%u\n",
+ RUN_ERL_HI_VER, RUN_ERL_LO_VER, re_high, re_low);
+ return -1;
+ }
+ /* Choose highest common version */
+ protocol_ver = re_high < RUN_ERL_HI_VER ? re_high : RUN_ERL_HI_VER;
+
+ wlen = sn_printf(wbuf, sizeof(wbuf), "\033_version=%u\033\\",
+ protocol_ver);
+ if (write_all(wfd, wbuf, wlen) < 0) {
+ fprintf(stderr,"Failed to send version handshake\n");
+ return -1;
+ }
+ end += 2;
+ len -= (end-buf);
+ memmove(buf,end,len);
+
+ }
+ else { /* we assume old run_erl without version handshake */
+ protocol_ver = 0;
+ }
+
+ if (re_high != RUN_ERL_HI_VER) {
+ fprintf(stderr,"run_erl has different version, "
+ "using common protocol level %u\n", protocol_ver);
+ }
+
+ return len;
+}
+
-#include "to_erl_common.h"
+#ifdef DEBUG
+#define S(x) ((x) > 0 ? 1 : 0)
-int main(int argc,char **argv) {
- return to_erl(argc,argv);
+static void show_terminal_settings(struct termios *t)
+{
+ fprintf(stderr,"c_iflag:\n");
+ fprintf(stderr,"Signal interrupt on break: BRKINT %d\n", S(t->c_iflag & BRKINT));
+ fprintf(stderr,"Map CR to NL on input: ICRNL %d\n", S(t->c_iflag & ICRNL));
+ fprintf(stderr,"Ignore break condition: IGNBRK %d\n", S(t->c_iflag & IGNBRK));
+ fprintf(stderr,"Ignore CR: IGNCR %d\n", S(t->c_iflag & IGNCR));
+ fprintf(stderr,"Ignore char with par. err's: IGNPAR %d\n", S(t->c_iflag & IGNPAR));
+ fprintf(stderr,"Map NL to CR on input: INLCR %d\n", S(t->c_iflag & INLCR));
+ fprintf(stderr,"Enable input parity check: INPCK %d\n", S(t->c_iflag & INPCK));
+ fprintf(stderr,"Strip character ISTRIP %d\n", S(t->c_iflag & ISTRIP));
+ fprintf(stderr,"Enable start/stop input ctrl IXOFF %d\n", S(t->c_iflag & IXOFF));
+ fprintf(stderr,"ditto output ctrl IXON %d\n", S(t->c_iflag & IXON));
+ fprintf(stderr,"Mark parity errors PARMRK %d\n", S(t->c_iflag & PARMRK));
+ fprintf(stderr,"\n");
+ fprintf(stderr,"c_oflag:\n");
+ fprintf(stderr,"Perform output processing OPOST %d\n", S(t->c_oflag & OPOST));
+ fprintf(stderr,"\n");
+ fprintf(stderr,"c_cflag:\n");
+ fprintf(stderr,"Ignore modem status lines CLOCAL %d\n", S(t->c_cflag & CLOCAL));
+ fprintf(stderr,"\n");
+ fprintf(stderr,"c_local:\n");
+ fprintf(stderr,"Enable echo ECHO %d\n", S(t->c_lflag & ECHO));
+ fprintf(stderr,"\n");
+ fprintf(stderr,"c_cc:\n");
+ fprintf(stderr,"c_cc[VEOF] %d\n", t->c_cc[VEOF]);
}
+#endif
diff --git a/erts/etc/win32/msys_tools/vc/cc.sh b/erts/etc/win32/msys_tools/vc/cc.sh
index ad05e5375b..ac89aac34e 100644
--- a/erts/etc/win32/msys_tools/vc/cc.sh
+++ b/erts/etc/win32/msys_tools/vc/cc.sh
@@ -242,7 +242,7 @@ for x in $SOURCES; do
if [ $PREPROCESSING = true ]; then
output_flag="-E"
else
- output_flag="-c -Fo`cmd //C echo ${output_filename}`"
+ output_flag="-FS -c -Fo`cmd //C echo ${output_filename}`"
fi
params="$COMMON_CFLAGS $MD $DEBUG_FLAGS $OPTIMIZE_FLAGS \
$CMD ${output_flag} $MPATH"
@@ -250,6 +250,8 @@ for x in $SOURCES; do
echo cc.sh "$SAVE" >>$CC_SH_DEBUG_LOG
echo cl.exe $params >>$CC_SH_DEBUG_LOG
fi
+ # MSYS2 (currently) converts the paths wrong, avoid it
+ export MSYS2_ARG_CONV_EXCL=-FoC
eval cl.exe $params >$MSG_FILE 2>$ERR_FILE
RES=$?
if test $PREPROCESSING = false; then
@@ -274,6 +276,7 @@ for x in $SOURCES; do
fi
rm -f $ERR_FILE $MSG_FILE
if [ $RES != 0 ]; then
+ echo Failed: cl.exe $params
rm -rf $TMPOBJDIR
exit $RES
fi
@@ -312,7 +315,10 @@ if [ $LINKING = true ]; then
stdlib="-lLIBMTD";;
esac
# And finally call the next script to do the linking...
- params="$out_spec $LINKCMD $stdlib"
+ params="$out_spec $LINKCMD $stdlib"
+ if [ "X$CC_SH_DEBUG_LOG" != "X" ]; then
+ echo ld.sh $ACCUM_OBJECTS $params
+ fi
eval ld.sh $ACCUM_OBJECTS $params
RES=$?
fi
diff --git a/erts/etc/win32/msys_tools/vc/emu_cc.sh b/erts/etc/win32/msys_tools/vc/emu_cc.sh
index 01f75b2468..10d59214ea 100644
--- a/erts/etc/win32/msys_tools/vc/emu_cc.sh
+++ b/erts/etc/win32/msys_tools/vc/emu_cc.sh
@@ -29,6 +29,7 @@ WTOOLDIR0=`win2msys_path.sh "$TOOLDIR"`
WTOOLDIR=`cmd //C echo $WTOOLDIR0`
# Do primitive 'make'
newer_exe=`find $TOOLDIR -newer $COFFIX.c -name coffix.exe -print`
+export MSYS2_ARG_CONV_EXCL="-FeC"
if [ -z $newer_exe ]; then
echo recompiling $COFFIX.exe
cl.exe -Fe${WTOOLDIR}/coffix.exe ${WTOOLDIR}/coffix.c
diff --git a/erts/etc/win32/msys_tools/vc/mc.sh b/erts/etc/win32/msys_tools/vc/mc.sh
index e9ea9ff9a9..14b5ebaa8f 100644
--- a/erts/etc/win32/msys_tools/vc/mc.sh
+++ b/erts/etc/win32/msys_tools/vc/mc.sh
@@ -80,9 +80,14 @@ if [ -n "$OUTPUT_DIRNAME" ]; then
exit $RES
fi
fi
+# MSYS2 (currently) converts the paths wrong, avoid it
+export MSYS2_ARG_CONV_EXCL=
eval $MCC "$CMD" >/tmp/mc.exe.${p}.1 2>/tmp/mc.exe.${p}.2
RES=$?
-tail +2 /tmp/mc.exe.${p}.2 >&2
+if [ $RES != 0 ]; then
+ echo Failed: $MCC "$CMD"
+fi
+tail -n +2 /tmp/mc.exe.${p}.2 >&2
cat /tmp/mc.exe.${p}.1
rm -f /tmp/mc.exe.${p}.2 /tmp/mc.exe.${p}.1
exit $RES
diff --git a/erts/etc/win32/msys_tools/vc/rc.sh b/erts/etc/win32/msys_tools/vc/rc.sh
index 1b3b1c85bd..1f8ade17cb 100644
--- a/erts/etc/win32/msys_tools/vc/rc.sh
+++ b/erts/etc/win32/msys_tools/vc/rc.sh
@@ -79,9 +79,14 @@ if [ "X$RC_SH_DEBUG_LOG" != "X" ]; then
echo rc.sh "$SAVE" >>$RC_SH_DEBUG_LOG
echo rc.exe $CMD >>$RC_SH_DEBUG_LOG
fi
+# MSYS2 (currently) converts the paths wrong, avoid it
+export MSYS2_ARG_CONV_EXCL=-Fo
eval $RCC "$CMD" >/tmp/rc.exe.${p}.1 2>/tmp/rc.exe.${p}.2
RES=$?
-tail +2 /tmp/rc.exe.${p}.2 >&2
+if [ $RES != 0 ]; then
+ echo Failed: $RCC "$CMD"
+fi
+tail -n +2 /tmp/rc.exe.${p}.2 >&2
cat /tmp/rc.exe.${p}.1
rm -f /tmp/rc.exe.${p}.2 /tmp/rc.exe.${p}.1
exit $RES
diff --git a/erts/etc/win32/nsis/Makefile b/erts/etc/win32/nsis/Makefile
index 49d835170a..64f44ff86d 100644
--- a/erts/etc/win32/nsis/Makefile
+++ b/erts/etc/win32/nsis/Makefile
@@ -42,7 +42,13 @@ include $(ERL_TOP)/make/otp_release_targets.mk
TARGET_DIR = $(RELEASE_PATH)
-ifeq ($(MSYSTEM),MINGW32)
+ifdef MSYSTEM
+ ifeq ($(MSYSTEM),$(filter $(MSYSTEM),MSYS MINGW32 MINGW64))
+ USEMSYS := true
+ endif
+endif
+
+ifeq ($(USEMSYS),true)
MAKENSISFLAGS = //V2
WTESTROOT=$(shell (msys2win_path.sh "$(RELEASE_PATH)"))
@@ -63,7 +69,7 @@ else
endif
REDIST_FILE=$(shell (sh ./find_redist.sh || echo ""))
-ifeq ($(MSYSTEM),MINGW32)
+ifeq ($(USEMSYS),true)
NICEREDISTFILE=$(shell (msys2win_path.sh -m "$(REDIST_FILE)" 2>/dev/null || echo ""))
else
NICEREDISTFILE=$(shell (cygpath -d -m "$(REDIST_FILE)" 2>/dev/null || echo ""))
diff --git a/erts/etc/win32/nsis/find_redist.sh b/erts/etc/win32/nsis/find_redist.sh
index c0895c9dd5..03e92b21c7 100755
--- a/erts/etc/win32/nsis/find_redist.sh
+++ b/erts/etc/win32/nsis/find_redist.sh
@@ -164,7 +164,7 @@ fi
#echo $BPATH_LIST
for BP in $BPATH_LIST; do
- for verdir in "sdk v2.0" "sdk v3.5" "v6.0A" "v7.0" "v7.0A" "v7.1"; do
+ for verdir in "sdk v2.0" "sdk v3.5" "v6.0A" "v7.0" "v7.0A" "v7.1" "VC redist 1033"; do
BPATH=$BP
fail=false
allow_fail=false
diff --git a/erts/include/erl_int_sizes_config.h.in b/erts/include/erl_int_sizes_config.h.in
index b18f5ebc00..88c74cdeff 100644
--- a/erts/include/erl_int_sizes_config.h.in
+++ b/erts/include/erl_int_sizes_config.h.in
@@ -35,6 +35,3 @@
/* The size of a pointer. */
#undef SIZEOF_VOID_P
-
-/* Define if building a halfword-heap 64bit emulator (needed for NIF's) */
-#undef HALFWORD_HEAP_EMULATOR
diff --git a/erts/include/internal/erl_printf_format.h b/erts/include/internal/erl_printf_format.h
index efd926be99..953022017a 100644
--- a/erts/include/internal/erl_printf_format.h
+++ b/erts/include/internal/erl_printf_format.h
@@ -44,7 +44,6 @@ typedef long long ErlPfSWord;
#error Found no appropriate type to use for 'Eterm', 'Uint' and 'Sint'
#endif
-
typedef int (*fmtfn_t)(void*, char*, size_t);
extern int erts_printf_format(fmtfn_t, void*, char*, va_list);
@@ -57,17 +56,9 @@ extern int erts_printf_uword(fmtfn_t, void*, char, int, int, ErlPfUWord);
extern int erts_printf_sword(fmtfn_t, void*, char, int, int, ErlPfSWord);
extern int erts_printf_double(fmtfn_t, void *, char, int, int, double);
-#ifdef HALFWORD_HEAP_EMULATOR
-# if SIZEOF_INT != 4
-# error Unsupported integer size for HALFWORD_HEAP_EMULATOR
-# endif
-typedef unsigned int ErlPfEterm;
-#else
typedef ErlPfUWord ErlPfEterm;
-#endif
-
-extern int (*erts_printf_eterm_func)(fmtfn_t, void*, ErlPfEterm, long, ErlPfEterm*);
+extern int (*erts_printf_eterm_func)(fmtfn_t, void*, ErlPfEterm, long);
#endif /* ERL_PRINTF_FORMAT_H__ */
diff --git a/erts/include/internal/ethr_mutex.h b/erts/include/internal/ethr_mutex.h
index f76c4262ca..b402a139f5 100644
--- a/erts/include/internal/ethr_mutex.h
+++ b/erts/include/internal/ethr_mutex.h
@@ -98,7 +98,7 @@ void LeaveCriticalSection(CRITICAL_SECTION *);
#if 0
# define ETHR_MTX_Q_LOCK_SPINLOCK__
# define ETHR_MTX_QLOCK_TYPE__ ethr_spinlock_t
-#elif defined(ETHR_PTHREADS) || defined(ETHR_OSE_THREADS)
+#elif defined(ETHR_PTHREADS)
# define ETHR_MTX_Q_LOCK_PTHREAD_MUTEX__
# define ETHR_MTX_QLOCK_TYPE__ pthread_mutex_t
#elif defined(ETHR_WIN32_THREADS)
@@ -211,7 +211,7 @@ struct ethr_cond_ {
#endif
};
-#elif (defined(ETHR_PTHREADS) || defined(ETHR_OSE_THREADS)) && !defined(ETHR_DBG_WIN_MTX_WITH_PTHREADS)
+#elif defined(ETHR_PTHREADS) && !defined(ETHR_DBG_WIN_MTX_WITH_PTHREADS)
typedef struct ethr_mutex_ ethr_mutex;
struct ethr_mutex_ {
@@ -355,7 +355,7 @@ void ethr_rwmutex_rwunlock(ethr_rwmutex *);
#ifdef ETHR_MTX_HARD_DEBUG
#define ETHR_MTX_HARD_ASSERT(A) \
- ((void) ((A) ? 1 : ethr_assert_failed(__FILE__, __LINE__, __func__,#A)))
+ ((void) ((A) ? 1 : ethr_assert_failed(__FILE__, __LINE__, __func__, #A)))
#else
#define ETHR_MTX_HARD_ASSERT(A) ((void) 1)
#endif
@@ -634,7 +634,7 @@ ETHR_INLINE_MTX_FUNC_NAME_(ethr_mutex_unlock)(ethr_mutex *mtx)
#endif /* ETHR_TRY_INLINE_FUNCS */
-#elif (defined(ETHR_PTHREADS) || defined(ETHR_OSE_THREADS)) && !defined(ETHR_DBG_WIN_MTX_WITH_PTHREADS)
+#elif defined(ETHR_PTHREADS) && !defined(ETHR_DBG_WIN_MTX_WITH_PTHREADS)
#if defined(ETHR_TRY_INLINE_FUNCS) || defined(ETHR_MUTEX_IMPL__)
diff --git a/erts/include/internal/ethread.h b/erts/include/internal/ethread.h
index f9c203e97c..899aa4ad3c 100644
--- a/erts/include/internal/ethread.h
+++ b/erts/include/internal/ethread.h
@@ -193,28 +193,6 @@ typedef DWORD ethr_tsd_key;
#define ETHR_YIELD() (Sleep(0), 0)
-#elif defined(ETHR_OSE_THREADS)
-
-#include "ose.h"
-#undef NIL
-
-#if defined(ETHR_HAVE_PTHREAD_H)
-#include <pthread.h>
-#endif
-
-typedef struct {
- PROCESS id;
- unsigned int tsd_key_index;
- void *res;
-} ethr_tid;
-
-typedef OSPPDKEY ethr_tsd_key;
-
-#undef ETHR_HAVE_ETHR_SIG_FUNCS
-
-/* Out own RW mutexes are probably faster, but use OSEs mutexes */
-#define ETHR_USE_OWN_RWMTX_IMPL__
-
#else /* No supported thread lib found */
#ifdef ETHR_NO_SUPP_THR_LIB_NOT_FATAL
@@ -382,19 +360,7 @@ extern ethr_runtime_t ethr_runtime__;
#include "ethr_atomics.h" /* The atomics API */
-#if defined (ETHR_OSE_THREADS)
-static ETHR_INLINE void
-ose_yield(void)
-{
- if (get_ptype(current_process()) == OS_PRI_PROC) {
- set_pri(get_pri(current_process()));
- } else {
- delay(1);
- }
-}
-#endif
-
-#if defined(__GNUC__) && !defined(ETHR_OSE_THREADS)
+#if defined(__GNUC__)
# ifndef ETHR_SPIN_BODY
# if defined(__i386__) || defined(__x86_64__)
# define ETHR_SPIN_BODY __asm__ __volatile__("rep;nop" : : : "memory")
@@ -410,20 +376,9 @@ ose_yield(void)
# ifndef ETHR_SPIN_BODY
# define ETHR_SPIN_BODY do {YieldProcessor();ETHR_COMPILER_BARRIER;} while(0)
# endif
-#elif defined(ETHR_OSE_THREADS)
-# ifndef ETHR_SPIN_BODY
-# define ETHR_SPIN_BODY ose_yield()
-# else
-# error "OSE should use ose_yield()"
-# endif
#endif
-#ifndef ETHR_OSE_THREADS
#define ETHR_YIELD_AFTER_BUSY_LOOPS 50
-#else
-#define ETHR_YIELD_AFTER_BUSY_LOOPS 0
-#endif
-
#ifndef ETHR_SPIN_BODY
# define ETHR_SPIN_BODY ETHR_COMPILER_BARRIER
@@ -446,18 +401,13 @@ ose_yield(void)
# else
# define ETHR_YIELD() (pthread_yield(), 0)
# endif
-# elif defined(ETHR_OSE_THREADS)
-# define ETHR_YIELD() (ose_yield(), 0)
# else
# define ETHR_YIELD() (ethr_compiler_barrier(), 0)
# endif
#endif
-#if defined(VALGRIND) || defined(ETHR_OSE_THREADS)
-/* mutex as fallback for spinlock for VALGRIND and OSE.
- OSE cannot use spinlocks as processes working on the
- same execution unit have a tendency to deadlock.
- */
+#if defined(VALGRIND)
+/* mutex as fallback for spinlock for VALGRIND. */
# undef ETHR_HAVE_NATIVE_SPINLOCKS
# undef ETHR_HAVE_NATIVE_RWSPINLOCKS
#else
@@ -504,16 +454,9 @@ typedef struct {
int detached; /* boolean (default false) */
int suggested_stack_size; /* kilo words (default sys dependent) */
char *name; /* max 14 char long (default no-name) */
-#ifdef ETHR_OSE_THREADS
- U32 coreNo;
-#endif
} ethr_thr_opts;
-#if defined(ETHR_OSE_THREADS)
-#define ETHR_THR_OPTS_DEFAULT_INITER {0, -1, NULL, 0}
-#else
#define ETHR_THR_OPTS_DEFAULT_INITER {0, -1, NULL}
-#endif
#if !defined(ETHR_TRY_INLINE_FUNCS) || defined(ETHR_AUX_IMPL__)
# define ETHR_NEED_SPINLOCK_PROTOTYPES__
@@ -627,8 +570,6 @@ typedef struct ethr_ts_event_ ethr_ts_event; /* Needed by ethr_mutex.h */
# include "win/ethr_event.h"
#elif defined(ETHR_PTHREADS)
# include "pthread/ethr_event.h"
-#elif defined(ETHR_OSE_THREADS)
-# include "ose/ethr_event.h"
#endif
int ethr_set_main_thr_status(int, int);
@@ -718,37 +659,6 @@ ETHR_INLINE_FUNC_NAME_(ethr_leave_ts_event)(ethr_ts_event *tsep)
#endif
-#elif defined (ETHR_OSE_THREADS)
-
-#if defined(ETHR_TRY_INLINE_FUNCS) || defined(ETHREAD_IMPL__)
-
-extern ethr_tsd_key ethr_ts_event_key__;
-
-static ETHR_INLINE ethr_ts_event *
-ETHR_INLINE_FUNC_NAME_(ethr_get_ts_event)(void)
-{
- ethr_ts_event *tsep = *(ethr_ts_event**)ose_get_ppdata(ethr_ts_event_key__);
- if (!tsep) {
- int res = ethr_get_tmp_ts_event__(&tsep);
- if (res != 0)
- ETHR_FATAL_ERROR__(res);
- ETHR_ASSERT(tsep);
- }
- return tsep;
-}
-
-static ETHR_INLINE void
-ETHR_INLINE_FUNC_NAME_(ethr_leave_ts_event)(ethr_ts_event *tsep)
-{
- if (tsep->iflgs & ETHR_TS_EV_TMP) {
- int res = ethr_free_ts_event__(tsep);
- if (res != 0)
- ETHR_FATAL_ERROR__(res);
- }
-}
-
-#endif
-
#endif
#include "ethr_mutex.h" /* Need atomic declarations and tse */
diff --git a/erts/include/internal/ose/ethr_event.h b/erts/include/internal/ose/ethr_event.h
deleted file mode 100644
index c18f30aa4a..0000000000
--- a/erts/include/internal/ose/ethr_event.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 2009-2011. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- */
-
-/*
- * Author: Rickard Green
- */
-
-//#define USE_PTHREAD_API
-
-#define ETHR_EVENT_OFF_WAITER__ -1L
-#define ETHR_EVENT_OFF__ 1L
-#define ETHR_EVENT_ON__ 0L
-
-#ifdef USE_PTHREAD_API
-
-typedef struct {
- ethr_atomic32_t state;
- pthread_mutex_t mtx;
- pthread_cond_t cnd;
-} ethr_event;
-
-#if defined(ETHR_TRY_INLINE_FUNCS) || defined(ETHR_EVENT_IMPL__)
-
-static void ETHR_INLINE
-ETHR_INLINE_FUNC_NAME_(ethr_event_set)(ethr_event *e)
-{
- ethr_sint32_t val;
- val = ethr_atomic32_xchg_mb(&e->state, ETHR_EVENT_ON__);
- if (val == ETHR_EVENT_OFF_WAITER__) {
- int res = pthread_mutex_lock(&e->mtx);
- if (res != 0)
- ETHR_FATAL_ERROR__(res);
- res = pthread_cond_signal(&e->cnd);
- if (res != 0)
- ETHR_FATAL_ERROR__(res);
- res = pthread_mutex_unlock(&e->mtx);
- if (res != 0)
- ETHR_FATAL_ERROR__(res);
- }
-}
-
-static void ETHR_INLINE
-ETHR_INLINE_FUNC_NAME_(ethr_event_reset)(ethr_event *e)
-{
- ethr_atomic32_set(&e->state, ETHR_EVENT_OFF__);
- ETHR_MEMORY_BARRIER;
-}
-
-#endif
-
-#else
-
-typedef struct {
- ethr_atomic32_t state;
- PROCESS proc;
-} ethr_event;
-
-#if defined(ETHR_TRY_INLINE_FUNCS) || defined(ETHR_EVENT_IMPL__)
-
-static void ETHR_INLINE
-ETHR_INLINE_FUNC_NAME_(ethr_event_set)(ethr_event *e)
-{
- ethr_sint32_t val = ethr_atomic32_xchg_mb(&e->state, ETHR_EVENT_ON__);
- if (val == ETHR_EVENT_OFF_WAITER__) {
-#ifdef DEBUG
- OSFSEMVAL fsem_val = get_fsem(e->proc);
-
- /* There is a race in this assert.
- This is because the state is set before the wait call in wait__.
- We hope that a delay of 10 ms is enough */
- if (fsem_val == 0)
- delay(10);
- ETHR_ASSERT(get_fsem(e->proc) == -1);
-#endif
- signal_fsem(e->proc);
- }
-}
-
-static void ETHR_INLINE
-ETHR_INLINE_FUNC_NAME_(ethr_event_reset)(ethr_event *e)
-{
- ethr_atomic32_set(&e->state, ETHR_EVENT_OFF__);
- ETHR_MEMORY_BARRIER;
-}
-
-#endif
-
-#endif
-
-int ethr_event_init(ethr_event *e);
-int ethr_event_destroy(ethr_event *e);
-int ethr_event_wait(ethr_event *e);
-int ethr_event_swait(ethr_event *e, int spincount);
-#if !defined(ETHR_TRY_INLINE_FUNCS) || defined(ETHR_EVENT_IMPL__)
-void ethr_event_set(ethr_event *e);
-void ethr_event_reset(ethr_event *e);
-#endif
diff --git a/erts/include/internal/pthread/ethr_event.h b/erts/include/internal/pthread/ethr_event.h
index 74cfa68e16..deb4b29686 100644
--- a/erts/include/internal/pthread/ethr_event.h
+++ b/erts/include/internal/pthread/ethr_event.h
@@ -83,12 +83,22 @@ ETHR_INLINE_FUNC_NAME_(ethr_event_reset)(ethr_event *e)
#elif defined(ETHR_PTHREADS)
/* --- Posix mutex/cond pipe/select implementation of events ---------------- */
+#if defined(__APPLE__) && defined(__MACH__) && !defined(__DARWIN__)
+# define __DARWIN__ 1
+#endif
+
+#ifdef __DARWIN__
+typedef struct ethr_event_fdsets___ ethr_event_fdsets__;
+#endif
typedef struct {
ethr_atomic32_t state;
pthread_mutex_t mtx;
pthread_cond_t cnd;
int fd[2];
+#ifdef __DARWIN__
+ ethr_event_fdsets__ *fdsets;
+#endif
} ethr_event;
#define ETHR_EVENT_OFF_WAITER_SELECT__ ((ethr_sint32_t) -2)
@@ -148,6 +158,7 @@ ETHR_INLINE_FUNC_NAME_(ethr_event_reset)(ethr_event *e)
#endif
int ethr_event_init(ethr_event *e);
+int ethr_event_prepare_timed(ethr_event *e);
int ethr_event_destroy(ethr_event *e);
int ethr_event_wait(ethr_event *e);
int ethr_event_swait(ethr_event *e, int spincount);
diff --git a/erts/include/internal/win/ethr_event.h b/erts/include/internal/win/ethr_event.h
index bf110e10f9..458565b9ea 100644
--- a/erts/include/internal/win/ethr_event.h
+++ b/erts/include/internal/win/ethr_event.h
@@ -56,6 +56,7 @@ ETHR_INLINE_FUNC_NAME_(ethr_event_reset)(ethr_event *e)
#endif
int ethr_event_init(ethr_event *e);
+int ethr_event_prepare_timed(ethr_event *e);
int ethr_event_destroy(ethr_event *e);
int ethr_event_wait(ethr_event *e);
int ethr_event_swait(ethr_event *e, int spincount);
diff --git a/erts/lib_src/common/erl_misc_utils.c b/erts/lib_src/common/erl_misc_utils.c
index 1262c50718..053217304b 100644
--- a/erts/lib_src/common/erl_misc_utils.c
+++ b/erts/lib_src/common/erl_misc_utils.c
@@ -160,8 +160,6 @@ erts_milli_sleep(long ms)
if (ms > 0) {
#ifdef __WIN32__
Sleep((DWORD) ms);
-#elif defined(__OSE__)
- delay(ms);
#else
struct timeval tv;
tv.tv_sec = ms / 1000;
@@ -320,10 +318,6 @@ erts_cpu_info_update(erts_cpu_info_t *cpuinfo)
online = 0;
#endif
}
-#elif defined(__OSE__)
- online = ose_num_cpus();
- configured = ose_num_cpus();
- available = ose_num_cpus();
#endif
if (online > configured)
diff --git a/erts/lib_src/common/erl_printf_format.c b/erts/lib_src/common/erl_printf_format.c
index 307680505c..e7d5d4413e 100644
--- a/erts/lib_src/common/erl_printf_format.c
+++ b/erts/lib_src/common/erl_printf_format.c
@@ -78,15 +78,7 @@
#endif
#ifndef ERTS_SIZEOF_ETERM
-# ifdef HALFWORD_HEAP_EMULATOR
-# if SIZEOF_VOID_P == 8
-# define ERTS_SIZEOF_ETERM 4
-# else
-# error "HALFWORD_HEAP_EMULATOR only allowed on 64-bit architecture"
-# endif
-# else
-# define ERTS_SIZEOF_ETERM SIZEOF_VOID_P
-# endif
+#define ERTS_SIZEOF_ETERM SIZEOF_VOID_P
#endif
#if defined(__GNUC__)
@@ -102,7 +94,7 @@
#endif
#define FMTC_d 0x0000
-#define FMTC_R 0x0001
+/*empty 0x0001 was RELATIVE */
#define FMTC_o 0x0002
#define FMTC_u 0x0003
#define FMTC_x 0x0004
@@ -166,7 +158,7 @@ static char heX[] = "0123456789ABCDEF";
#define SIGN(X) ((X) > 0 ? 1 : ((X) < 0 ? -1 : 0))
#define USIGN(X) ((X) == 0 ? 0 : 1)
-int (*erts_printf_eterm_func)(fmtfn_t, void*, ErlPfEterm, long, ErlPfEterm*) = NULL;
+int (*erts_printf_eterm_func)(fmtfn_t, void*, ErlPfEterm, long) = NULL;
static int
noop_fn(void *vfp, char* buf, size_t len)
@@ -645,7 +637,6 @@ int erts_printf_format(fmtfn_t fn, void* arg, char* fmt, va_list ap)
case 'p': ptr++; fmt |= FMTC_p; break;
case 'n': ptr++; fmt |= FMTC_n; break;
case 'T': ptr++; fmt |= FMTC_T; break;
- case 'R': ptr++; fmt |= FMTC_R; break;
case '%':
FMT(fn,arg,ptr,1,count);
ptr++;
@@ -820,11 +811,9 @@ int erts_printf_format(fmtfn_t fn, void* arg, char* fmt, va_list ap)
default: *va_arg(ap,int*) = count; break;
}
break;
- case FMTC_T: /* Eterm */
- case FMTC_R: { /* Eterm, Eterm* base (base ignored if !HALFWORD_HEAP) */
+ case FMTC_T: { /* Eterm */
long prec;
ErlPfEterm eterm;
- ErlPfEterm* eterm_base;
if (!erts_printf_eterm_func)
return -EINVAL;
@@ -835,16 +824,14 @@ int erts_printf_format(fmtfn_t fn, void* arg, char* fmt, va_list ap)
else
prec = (long) precision;
eterm = va_arg(ap, ErlPfEterm);
- eterm_base = ((fmt & FMTC_MASK) == FMTC_R) ?
- va_arg(ap, ErlPfEterm*) : NULL;
if (width > 0 && !(fmt & FMTF_adj)) {
- res = (*erts_printf_eterm_func)(noop_fn, NULL, eterm, prec, eterm_base);
+ res = (*erts_printf_eterm_func)(noop_fn, NULL, eterm, prec);
if (res < 0)
return res;
if (width > res)
BLANKS(fn, arg, width - res, count);
}
- res = (*erts_printf_eterm_func)(fn, arg, eterm, prec, eterm_base);
+ res = (*erts_printf_eterm_func)(fn, arg, eterm, prec);
if (res < 0)
return res;
count += res;
diff --git a/erts/lib_src/common/ethr_aux.c b/erts/lib_src/common/ethr_aux.c
index 0cbb1b2fb8..56fecf81b8 100644
--- a/erts/lib_src/common/ethr_aux.c
+++ b/erts/lib_src/common/ethr_aux.c
@@ -207,18 +207,7 @@ ethr_init_common__(ethr_init_data *id)
ethr_min_stack_size__ = ETHR_B2KW(ethr_min_stack_size__);
-#ifdef __OSE__
- /* For supervisor processes, OSE adds a number of bytes to the requested stack. With this
- * addition, the resulting size must not exceed the largest available stack size. The number
- * of bytes that will be added is configured in the monolith and can therefore not be
- * specified here. We simply assume that it is less than 0x1000. The available stack sizes
- * are configured in the .lmconf file and the largest one is usually 65536 bytes.
- * Consequently, the requested stack size is limited to 0xF000.
- */
- ethr_max_stack_size__ = 0xF000;
-#else
ethr_max_stack_size__ = 32*1024*1024;
-#endif
#if SIZEOF_VOID_P == 8
ethr_max_stack_size__ *= 2;
#endif
@@ -664,10 +653,6 @@ ETHR_IMPL_NORETURN__ ethr_fatal_error__(const char *file,
int ethr_assert_failed(const char *file, int line, const char *func, char *a)
{
fprintf(stderr, "%s:%d: %s(): Assertion failed: %s\n", file, line, func, a);
-#ifdef __OSE__
- ramlog_printf("%d: %s:%d: %s(): Assertion failed: %s\n",
- current_process(),file, line, func, a);
-#endif
ethr_abort__();
return 0;
}
diff --git a/erts/lib_src/common/ethr_mutex.c b/erts/lib_src/common/ethr_mutex.c
index 72aa34ec1c..a596e6c31c 100644
--- a/erts/lib_src/common/ethr_mutex.c
+++ b/erts/lib_src/common/ethr_mutex.c
@@ -1250,7 +1250,7 @@ ethr_cond_wait(ethr_cond *cnd, ethr_mutex *mtx)
return 0;
}
-#elif (defined(ETHR_PTHREADS) || defined(ETHR_OSE_THREADS)) && !defined(ETHR_DBG_WIN_MTX_WITH_PTHREADS)
+#elif defined(ETHR_PTHREADS) && !defined(ETHR_DBG_WIN_MTX_WITH_PTHREADS)
/* -- pthread mutex and condition variables -------------------------------- */
int
diff --git a/erts/lib_src/ose/ethr_event.c b/erts/lib_src/ose/ethr_event.c
deleted file mode 100644
index 24ea191c4b..0000000000
--- a/erts/lib_src/ose/ethr_event.c
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 2009-2010. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- */
-
-/*
- * Author: Rickard Green
- */
-
-#define ETHR_INLINE_FUNC_NAME_(X) X ## __
-#define ETHR_EVENT_IMPL__
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "ethread.h"
-
-#ifdef USE_PTHREAD_API
-
-int
-ethr_event_init(ethr_event *e)
-{
- int res;
- ethr_atomic32_init(&e->state, ETHR_EVENT_OFF__);
- res = pthread_mutex_init(&e->mtx, NULL);
- if (res != 0)
- return res;
- res = pthread_cond_init(&e->cnd, NULL);
- if (res != 0) {
- pthread_mutex_destroy(&e->mtx);
- return res;
- }
- return 0;
-}
-
-int
-ethr_event_destroy(ethr_event *e)
-{
- int res;
- res = pthread_mutex_destroy(&e->mtx);
- if (res != 0)
- return res;
- res = pthread_cond_destroy(&e->cnd);
- if (res != 0)
- return res;
- return 0;
-}
-
-static ETHR_INLINE int
-wait__(ethr_event *e, int spincount)
-{
- int sc = spincount;
- ethr_sint32_t val;
- int res, ulres;
- int until_yield = ETHR_YIELD_AFTER_BUSY_LOOPS;
-
- if (spincount < 0)
- ETHR_FATAL_ERROR__(EINVAL);
-
- while (1) {
- val = ethr_atomic32_read(&e->state);
- if (val == ETHR_EVENT_ON__)
- return 0;
- if (sc == 0)
- break;
- sc--;
- ETHR_SPIN_BODY;
- if (--until_yield == 0) {
- until_yield = ETHR_YIELD_AFTER_BUSY_LOOPS;
- res = ETHR_YIELD();
- if (res != 0)
- ETHR_FATAL_ERROR__(res);
- }
- }
-
- if (val != ETHR_EVENT_OFF_WAITER__) {
- val = ethr_atomic32_cmpxchg(&e->state,
- ETHR_EVENT_OFF_WAITER__,
- ETHR_EVENT_OFF__);
- if (val == ETHR_EVENT_ON__)
- return 0;
- ETHR_ASSERT(val == ETHR_EVENT_OFF__);
- }
-
- ETHR_ASSERT(val == ETHR_EVENT_OFF_WAITER__
- || val == ETHR_EVENT_OFF__);
-
- res = pthread_mutex_lock(&e->mtx);
- if (res != 0)
- ETHR_FATAL_ERROR__(res);
-
- while (1) {
-
- val = ethr_atomic32_read(&e->state);
- if (val == ETHR_EVENT_ON__)
- break;
-
- res = pthread_cond_wait(&e->cnd, &e->mtx);
- if (res == EINTR)
- break;
- if (res != 0)
- ETHR_FATAL_ERROR__(res);
- }
-
- ulres = pthread_mutex_unlock(&e->mtx);
- if (ulres != 0)
- ETHR_FATAL_ERROR__(ulres);
-
- return res; /* 0 || EINTR */
-}
-
-#else
-/* --- OSE implementation of events ---------------------------- */
-
-#ifdef DEBUG
-union SIGNAL {
- SIGSELECT signo;
-};
-#endif
-
-int
-ethr_event_init(ethr_event *e)
-{
- ethr_atomic32_init(&e->state, ETHR_EVENT_OFF__);
- e->proc = current_process();
- return 0;
-}
-
-int
-ethr_event_destroy(ethr_event *e)
-{
- return 0;
-}
-
-static ETHR_INLINE int
-wait__(ethr_event *e, int spincount)
-{
- int sc = spincount;
- int res;
- int until_yield = ETHR_YIELD_AFTER_BUSY_LOOPS;
-
- if (spincount < 0)
- ETHR_FATAL_ERROR__(EINVAL);
-
- ETHR_ASSERT(e->proc == current_process());
- ETHR_ASSERT(get_fsem(current_process()) == 0);
-
- while (1) {
- ethr_sint32_t val;
- while (1) {
- val = ethr_atomic32_read(&e->state);
- if (val == ETHR_EVENT_ON__)
- return 0;
- if (sc == 0)
- break;
- sc--;
- ETHR_SPIN_BODY;
- if (--until_yield == 0) {
- until_yield = ETHR_YIELD_AFTER_BUSY_LOOPS;
- res = ETHR_YIELD();
- if (res != 0)
- ETHR_FATAL_ERROR__(res);
- }
- }
- if (val != ETHR_EVENT_OFF_WAITER__) {
- val = ethr_atomic32_cmpxchg(&e->state,
- ETHR_EVENT_OFF_WAITER__,
- ETHR_EVENT_OFF__);
- if (val == ETHR_EVENT_ON__)
- return 0;
- ETHR_ASSERT(val == ETHR_EVENT_OFF__);
- }
-
- wait_fsem(1);
-
- ETHR_ASSERT(get_fsem(current_process()) == 0);
- }
-}
-
-#endif
-
-void
-ethr_event_reset(ethr_event *e)
-{
- ethr_event_reset__(e);
-}
-
-void
-ethr_event_set(ethr_event *e)
-{
- ethr_event_set__(e);
-}
-
-int
-ethr_event_wait(ethr_event *e)
-{
- return wait__(e, 0);
-}
-
-int
-ethr_event_swait(ethr_event *e, int spincount)
-{
- return wait__(e, spincount);
-}
diff --git a/erts/lib_src/ose/ethread.c b/erts/lib_src/ose/ethread.c
deleted file mode 100644
index dc16acdd08..0000000000
--- a/erts/lib_src/ose/ethread.c
+++ /dev/null
@@ -1,833 +0,0 @@
-/*
- * %CopyrightBegin%
- *
- * Copyright Ericsson AB 2010-2011. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * %CopyrightEnd%
- */
-
-/*
- * Description: OSE implementation of the ethread library
- * Author: Lukas Larsson
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "stdio.h"
-#ifdef ETHR_TIME_WITH_SYS_TIME
-# include "time.h"
-# include "sys/time.h"
-#else
-# ifdef ETHR_HAVE_SYS_TIME_H
-# include "sys/time.h"
-# else
-# include "time.h"
-# endif
-#endif
-#include "sys/types.h"
-#include "unistd.h"
-
-#include "limits.h"
-
-#define ETHR_INLINE_FUNC_NAME_(X) X ## __
-#define ETHREAD_IMPL__
-
-#include "ethread.h"
-#include "ethr_internal.h"
-
-#include "erl_printf.h"
-#include "efs.h"
-#include "ose.h"
-
-#include "ose_spi.h"
-
-#include "string.h"
-#include "ctype.h"
-#include "stdlib.h"
-
-#ifndef ETHR_HAVE_ETHREAD_DEFINES
-#error Missing configure defines
-#endif
-
-#define ETHR_INVALID_TID_ID -1
-
-#define DEFAULT_PRIO_NAME "ERTS_ETHR_DEFAULT_PRIO"
-
-/* Set the define to 1 to get some logging */
-#if 0
-#include "ramlog.h"
-#define LOG(output) ramlog_printf output
-#else
-#define LOG(output)
-#endif
-
-static ethr_tid main_thr_tid;
-static const char* own_tid_key = "ethread_own_tid";
-ethr_tsd_key ethr_ts_event_key__;
-
-#define ETHREADWRAPDATASIG 1
-
-/* Init data sent to thr_wrapper() */
-typedef struct {
- SIGSELECT sig_no;
- ethr_ts_event *tse;
- ethr_tid *tid;
- ethr_sint32_t result;
- void *(*thr_func)(void *);
- void *arg;
- void *prep_func_res;
- const char *name;
-} ethr_thr_wrap_data__;
-
-union SIGNAL {
- SIGSELECT sig_no;
- ethr_thr_wrap_data__ data;
-};
-
-#define ETHR_GET_OWN_TID__ ((ethr_tid *) get_envp(current_process(),\
- own_tid_key))
-
-/*
- * --------------------------------------------------------------------------
- * Static functions
- * --------------------------------------------------------------------------
- */
-
-/* Will retrive the instrinsic name by removing the 'prefix' and the
- * suffix from 'name'.
- * The 'prefix' is given as an inparameter. If NULL or an empty string no
- * prefix will be removed.
- * If 'strip_suffix' is 1 suffixes in the form of '_123' will be removed.
- * Will return a pointer to a newly allocated buffer containing the intrinsic
- * name in uppercase characters.
- * The caller must remember to free this buffer when no lnger needed.
- */
-static char *
-ethr_intrinsic_name(const char *name, const char *prefix, int strip_suffix)
-{
- const char *start = name;
- const char *end = name + strlen(name);
- char *intrinsic_name = NULL;
- int i;
-
- if (name == NULL) {
- LOG(("ERTS - ethr_intrinsic_namNo input name.\n"));
- return NULL;
- }
-
- /* take care of the prefix */
- if ((prefix != NULL) && (*prefix != '\0')) {
- const char *found = strstr(name, prefix);
-
- if (found == name) {
- /* found the prefix at the beginning */
- start += strlen(prefix);
- }
- }
-
- /* take care of the suffix */
- if (strip_suffix) {
- const char *suffix_start = strrchr(start, '_');
-
- if (suffix_start != NULL) {
- const char *ch;
- int only_numbers = 1;
-
- for (ch = suffix_start + 1; *ch != '\0'; ch++) {
- if (strchr("0123456789", *ch) == NULL) {
- only_numbers = 0;
- break;
- }
- }
-
- if (only_numbers) {
- end = suffix_start;
- }
- }
- }
-
- intrinsic_name = malloc(end - start + 1);
- for (i = 0; (start + i) < end; i++) {
- intrinsic_name[i] = toupper(start[i]);
- }
- intrinsic_name[i] = '\0';
-
- return intrinsic_name;
-}
-
-static char *
-ethr_get_amended_env(const char *name, const char *prefix, const char *suffix)
-{
- unsigned len;
- char *env_name = NULL;
- char *env_value = NULL;
-
- if (name == NULL) {
- return NULL;
- }
-
- len = strlen(name);
-
- if (prefix != NULL) {
- len += strlen(prefix);
- }
-
- if (suffix != NULL) {
- len += strlen(suffix);
- }
-
- env_name = malloc(len + 1);
- sprintf(env_name, "%s%s%s", (prefix != NULL) ? prefix : "",
- name,
- (suffix != NULL) ? suffix : "");
- env_value = get_env(get_bid(current_process()), env_name);
-
- if (env_value == NULL) {
- LOG(("ERTS - ethr_get_amended_env(): %s environment variable not present\n", env_name));
- } else {
- LOG(("ERTS - ethr_get_amended_env(): Found %s environment variable: %s.\n", env_name, env_value));
- }
- free(env_name);
-
- return env_value;
-}
-
-/* Reads the environment variable derived from 'name' and interprets it as as an
- * OSE priority. If successfull it will update 'out_prio'.
- * Returns: 0 if successfull
- * -1 orherwise.
- */
-static int
-ethr_get_prio(const char *name, OSPRIORITY *out_prio)
-{
- int rc = -1;
- char *intrinsic_name = NULL;
- char *prio_env = NULL;
- long prio;
- char *endptr = NULL;
-
- LOG(("ERTS - ethr_get_prio(): name: %s.\n", name));
-
- intrinsic_name = ethr_intrinsic_name(name, NULL, 1);
- LOG(("ERTS - ethr_get_prio(): Intrinsic name: %s.\n", intrinsic_name));
-
- prio_env = ethr_get_amended_env(intrinsic_name, "ERTS_", "_PRIO");
- if (prio_env == NULL) {
- goto fini;
- }
-
- prio = efs_str_to_long(prio_env, (const char **)&endptr);
- if (endptr != NULL) {
- LOG(("ERTS - ethr_get_prio(): Environment varible for '%s' includes "
- "non-numerical characters: '%s'.\n", intrinsic_name, prio_env));
- goto fini;
- }
-
- if ((prio < 0) || (prio > 32)) {
- LOG(("ERTS - ethr_get_prio(): prio for '%s' (%d) is out of bounds (0-32).\n",
- intrinsic_name, prio));
- goto fini;
- }
-
- /* Success */
- *out_prio = (OSPRIORITY)prio;
- rc = 0;
-
-fini:
- if (intrinsic_name != NULL) {
- free(intrinsic_name);
- }
- if (prio_env != NULL) {
- free_buf((union SIGNAL **) &prio_env);
- }
-
- return rc;
-}
-
-static PROCESS blockId(void) {
- static PROCESS bid = (PROCESS)0;
-
- /* For now we only use the same block. */
- /* if (bid == 0) {
- bid = create_block("Erlang-VM", 0, 0, 0, 0);
- }
- return bid; */
- return 0;
-}
-
-static void thr_exit_cleanup(ethr_tid *tid, void *res)
-{
-
- ETHR_ASSERT(tid == ETHR_GET_OWN_TID__);
-
- tid->res = res;
-
- ethr_run_exit_handlers__();
- ethr_ts_event_destructor__((void *) ethr_get_tse__());
-}
-
-//static OS_PROCESS(thr_wrapper);
-static OS_PROCESS(thr_wrapper)
-{
- ethr_tid my_tid;
- ethr_sint32_t result;
- void *res;
- void *(*thr_func)(void *);
- void *arg;
- ethr_ts_event *tsep = NULL;
-
-#ifdef DEBUG
- {
- PROCESS pid = current_process();
-
- const char *execMode;
-
- PROCESS bid = get_bid(pid);
-
- /* In the call below, 16 is a secret number provided by frbr that makes
- * the function return current domain. */
- OSADDRESS domain = get_pid_info(current_process(), 16);
-
-#ifdef HAVE_OSE_SPI_H
- execMode = get_pid_info(pid, OSE_PI_SUPERVISOR)
- ? "Supervisor"
- : "User";
-#else
- execMode = "unknown";
-#endif
-
- fprintf(stderr,"[0x%x] New process. Bid:0x%x, domain:%d, exec mode:%s\n",
- current_process(), bid, domain, execMode);
- }
-#endif
-
- {
- SIGSELECT sigsel[] = {1,ETHREADWRAPDATASIG};
- union SIGNAL *init_msg = receive(sigsel);
-
- thr_func = init_msg->data.thr_func;
- arg = init_msg->data.arg;
-
- result = (ethr_sint32_t) ethr_make_ts_event__(&tsep);
-
- if (result == 0) {
- tsep->iflgs |= ETHR_TS_EV_ETHREAD;
- my_tid = *init_msg->data.tid;
- set_envp(current_process(), own_tid_key, (OSADDRESS)&my_tid);
- if (ethr_thr_child_func__)
- ethr_thr_child_func__(init_msg->data.prep_func_res);
- }
-
- init_msg->data.result = result;
-
- send(&init_msg,sender(&init_msg));
- }
-
- /* pthread mutex api says we have to do this */
- signal_fsem(current_process());
- ETHR_ASSERT(get_fsem(current_process()) == 0);
-
- res = result == 0 ? (*thr_func)(arg) : NULL;
-
- ethr_thr_exit(&res);
-}
-
-/* internal exports */
-
-int ethr_set_tse__(ethr_ts_event *tsep)
-{
- return ethr_tsd_set(ethr_ts_event_key__,(void *) tsep);
-}
-
-ethr_ts_event *ethr_get_tse__(void)
-{
- return (ethr_ts_event *) ethr_tsd_get(ethr_ts_event_key__);
-}
-
-#if defined(ETHR_PPC_RUNTIME_CONF__)
-
-static int
-ppc_init__(void)
-{
- int pid;
-
-
- ethr_runtime__.conf.have_lwsync = 0;
-
- return 0;
-}
-
-#endif
-
-#if defined(ETHR_X86_RUNTIME_CONF__)
-
-void
-ethr_x86_cpuid__(int *eax, int *ebx, int *ecx, int *edx)
-{
-#if ETHR_SIZEOF_PTR == 4
- int have_cpuid;
- /*
- * If it is possible to toggle eflags bit 21,
- * we have the cpuid instruction.
- */
- __asm__ ("pushf\n\t"
- "popl %%eax\n\t"
- "movl %%eax, %%ecx\n\t"
- "xorl $0x200000, %%eax\n\t"
- "pushl %%eax\n\t"
- "popf\n\t"
- "pushf\n\t"
- "popl %%eax\n\t"
- "movl $0x0, %0\n\t"
- "xorl %%ecx, %%eax\n\t"
- "jz no_cpuid\n\t"
- "movl $0x1, %0\n\t"
- "no_cpuid:\n\t"
- : "=r"(have_cpuid)
- :
- : "%eax", "%ecx", "cc");
- if (!have_cpuid) {
- *eax = *ebx = *ecx = *edx = 0;
- return;
- }
-#endif
-#if ETHR_SIZEOF_PTR == 4 && defined(__PIC__) && __PIC__
- /*
- * When position independet code is used in 32-bit mode, the B register
- * is used for storage of global offset table address, and we may not
- * use it as input or output in an asm. We need to save and restore the
- * B register explicitly (for some reason gcc doesn't provide this
- * service to us).
- */
- __asm__ ("pushl %%ebx\n\t"
- "cpuid\n\t"
- "movl %%ebx, %1\n\t"
- "popl %%ebx\n\t"
- : "=a"(*eax), "=r"(*ebx), "=c"(*ecx), "=d"(*edx)
- : "0"(*eax)
- : "cc");
-#else
- __asm__ ("cpuid\n\t"
- : "=a"(*eax), "=b"(*ebx), "=c"(*ecx), "=d"(*edx)
- : "0"(*eax)
- : "cc");
-#endif
-}
-
-#endif /* ETHR_X86_RUNTIME_CONF__ */
-
-/*
- * --------------------------------------------------------------------------
- * Exported functions
- * --------------------------------------------------------------------------
- */
-
-int
-ethr_init(ethr_init_data *id)
-{
- int res;
-
- if (!ethr_not_inited__)
- return EINVAL;
-
-
-#if defined(ETHR_PPC_RUNTIME_CONF__)
- res = ppc_init__();
- if (res != 0)
- goto error;
-#endif
-
- res = ethr_init_common__(id);
- if (res != 0)
- goto error;
-
- main_thr_tid.id = current_process();
- main_thr_tid.tsd_key_index = 0;
-
- set_envp(current_process(),own_tid_key,(OSADDRESS)&main_thr_tid);
- signal_fsem(current_process());
-
-
- ETHR_ASSERT(&main_thr_tid == ETHR_GET_OWN_TID__);
-
- ethr_not_inited__ = 0;
-
- ethr_tsd_key_create(&ethr_ts_event_key__,"ethread_tse");
-
- return 0;
- error:
- ethr_not_inited__ = 1;
- return res;
-
-}
-
-int
-ethr_late_init(ethr_late_init_data *id)
-{
- int res = ethr_late_init_common__(id);
- if (res != 0)
- return res;
- ethr_not_completely_inited__ = 0;
- return res;
-}
-
-int
-ethr_thr_create(ethr_tid *tid, void * (*func)(void *), void *arg,
- ethr_thr_opts *opts)
-{
- int res;
- int use_stack_size = (opts && opts->suggested_stack_size >= 0
- ? opts->suggested_stack_size
- : 0x200 /* Use system default */);
- OSPRIORITY use_prio;
- char *use_name;
- char default_thr_name[20];
- static int no_of_thr = 0;
- cpuid_t use_core;
-
- union SIGNAL *init_msg;
- SIGSELECT sigsel[] = {1,ETHREADWRAPDATASIG};
- void *prep_func_res;
-
-
- if (opts != NULL) {
- LOG(("ERTS - ethr_thr_create(): opts supplied: name: %s, coreNo: %u.\n",
- opts->name, opts->coreNo));
- use_name = opts->name;
- use_core = opts->coreNo;
- if (0 != ethr_get_prio(use_name, &use_prio)) {
- if (0 != ethr_get_prio("DEFAULT", &use_prio)) {
- use_prio = get_pri(current_process());
- LOG(("ERTS - ethr_thr_create(): Using current process' prio: %d.\n", use_prio));
- } else {
- LOG(("ERTS - ethr_thr_create(): Using default prio: %d.\n", use_prio));
- }
- } else {
- LOG(("ERTS - ethr_thr_create(): Using configured prio: %d.\n", use_prio));
- }
- } else {
- LOG(("ERTS - ethr_thr_create(): opts not supplied. Using defaults.\n"));
- no_of_thr++;
- sprintf(default_thr_name, "ethread_%d", no_of_thr);
- use_name = default_thr_name;
- use_core = ose_cpu_id();
-
- if (0 != ethr_get_prio("DEFAULT", &use_prio)) {
- use_prio = get_pri(current_process());
- LOG(("ERTS - ethr_thr_create(): Using current process' prio: %d.\n", use_prio));
- }
- }
-
-#ifdef ETHR_MODIFIED_DEFAULT_STACK_SIZE
- if (use_stack_size < 0)
- use_stack_size = ETHR_MODIFIED_DEFAULT_STACK_SIZE;
-#endif
-
-#if ETHR_XCHK
- if (ethr_not_completely_inited__) {
- ETHR_ASSERT(0);
- return EACCES;
- }
- if (!tid || !func) {
- ETHR_ASSERT(0);
- return EINVAL;
- }
-#endif
-
- if (use_stack_size >= 0) {
- size_t suggested_stack_size = (size_t) use_stack_size;
- size_t stack_size;
-#ifdef ETHR_DEBUG
- suggested_stack_size /= 2; /* Make sure we got margin */
-#endif
-#ifdef ETHR_STACK_GUARD_SIZE
- /* The guard is at least on some platforms included in the stack size
- passed when creating threads */
- suggested_stack_size += ETHR_B2KW(ETHR_STACK_GUARD_SIZE);
-#endif
-
- if (suggested_stack_size < ethr_min_stack_size__)
- stack_size = ETHR_KW2B(ethr_min_stack_size__);
- else if (suggested_stack_size > ethr_max_stack_size__)
- stack_size = ETHR_KW2B(ethr_max_stack_size__);
- else
- stack_size = ETHR_PAGE_ALIGN(ETHR_KW2B(suggested_stack_size));
- use_stack_size = stack_size;
- }
-
- init_msg = alloc(sizeof(ethr_thr_wrap_data__), ETHREADWRAPDATASIG);
-
- /* Call prepare func if it exist */
- if (ethr_thr_prepare_func__)
- init_msg->data.prep_func_res = ethr_thr_prepare_func__();
- else
- init_msg->data.prep_func_res = NULL;
-
- LOG(("ERTS - ethr_thr_create(): Process [0x%x] is creating '%s', coreNo = %u, prio:%u\n",
- current_process(), use_name, use_core, use_prio));
-
- tid->id = create_process(OS_PRI_PROC, use_name, thr_wrapper,
- use_stack_size, use_prio, 0,
- get_bid(current_process()), NULL, 0, 0);
- if (ose_bind_process(tid->id, use_core)) {
- LOG(("ERTS - ethr_thr_create(): Bound pid 0x%x (%s) to core no %u.\n",
- tid->id, use_name, use_core));
- } else {
- LOG(("ERTS - ethr_thr_create(): Failed binding pid 0x%x (%s) to core no %u.\n",
- tid->id, use_name, use_core));
- }
-
- /*FIXME!!! Normally this shouldn't be used in shared mode. Still there is
- * a problem with stdin fd in fd_ processes which should be further
- * investigated */
- efs_clone(tid->id);
-
- tid->tsd_key_index = 0;
- tid->res = NULL;
-
- init_msg->data.tse = ethr_get_ts_event();
- init_msg->data.thr_func = func;
- init_msg->data.arg = arg;
- init_msg->data.tid = tid;
- init_msg->data.name = opts->name;
-
- send(&init_msg, tid->id);
-
- start(tid->id);
- init_msg = receive(sigsel);
-
- res = init_msg->data.result;
- prep_func_res = init_msg->data.prep_func_res;
-
- free_buf(&init_msg);
- /* Cleanup... */
-
- if (ethr_thr_parent_func__)
- ethr_thr_parent_func__(prep_func_res);
-
- LOG(("ERTS - ethr_thr_create(): Exiting.\n"));
- return res;
-}
-
-int
-ethr_thr_join(ethr_tid tid, void **res)
-{
- SIGSELECT sigsel[] = {1,OS_ATTACH_SIG};
-#if ETHR_XCHK
- if (ethr_not_inited__) {
- ETHR_ASSERT(0);
- return EACCES;
- }
-#endif
-
- if (tid.id == ETHR_INVALID_TID_ID)
- return EINVAL;
-
- attach(NULL,tid.id);
- receive(sigsel);
-
- if (res)
- *res = tid.res;
-
- return 0;
-}
-
-int
-ethr_thr_detach(ethr_tid tid)
-{
-#if ETHR_XCHK
- if (ethr_not_inited__) {
- ETHR_ASSERT(0);
- return EACCES;
- }
-#endif
- return 0;
-}
-
-void
-ethr_thr_exit(void *res)
-{
- ethr_tid *tid;
-#if ETHR_XCHK
- if (ethr_not_inited__) {
- ETHR_ASSERT(0);
- return;
- }
-#endif
- tid = ETHR_GET_OWN_TID__;
- if (!tid) {
- ETHR_ASSERT(0);
- kill_proc(current_process());
- }
- thr_exit_cleanup(tid, res);
- /* Harakiri possible? */
- kill_proc(current_process());
-}
-
-ethr_tid
-ethr_self(void)
-{
- ethr_tid *tid;
-#if ETHR_XCHK
- if (ethr_not_inited__) {
- ethr_tid dummy_tid = {ETHR_INVALID_TID_ID, 0, NULL};
- ETHR_ASSERT(0);
- return dummy_tid;
- }
-#endif
- tid = ETHR_GET_OWN_TID__;
- if (!tid) {
- ethr_tid dummy_tid = {ETHR_INVALID_TID_ID, 0, NULL};
- return dummy_tid;
- }
- return *tid;
-}
-
-int
-ethr_equal_tids(ethr_tid tid1, ethr_tid tid2)
-{
- return tid1.id == tid2.id && tid1.id != ETHR_INVALID_TID_ID;
-}
-
-
-/*
- * Thread specific events
- */
-
-ethr_ts_event *
-ethr_get_ts_event(void)
-{
- return ethr_get_ts_event__();
-}
-
-void
-ethr_leave_ts_event(ethr_ts_event *tsep)
-{
- ethr_leave_ts_event__(tsep);
-}
-
-/*
- * Thread specific data
- */
-
-int
-ethr_tsd_key_create(ethr_tsd_key *keyp, char *keyname)
-{
-
-#if ETHR_XCHK
- if (ethr_not_inited__) {
- ETHR_ASSERT(0);
- return EACCES;
- }
- if (!keyp) {
- ETHR_ASSERT(0);
- return EINVAL;
- }
-#endif
-
- ose_create_ppdata(keyname,keyp);
-
- return 0;
-}
-
-int
-ethr_tsd_key_delete(ethr_tsd_key key)
-{
-#if ETHR_XCHK
- if (ethr_not_inited__) {
- ETHR_ASSERT(0);
- return EACCES;
- }
-#endif
- /* Not possible to delete ppdata */
-
- return 0;
-}
-
-int
-ethr_tsd_set(ethr_tsd_key key, void *value)
-{
- void **ppdp;
-#if ETHR_XCHK
- if (ethr_not_inited__) {
- ETHR_ASSERT(0);
- return EACCES;
- }
-#endif
- ppdp = (void **)ose_get_ppdata(key);
- *ppdp = value;
- return 0;
-}
-
-void *
-ethr_tsd_get(ethr_tsd_key key)
-{
-#if ETHR_XCHK
- if (ethr_not_inited__) {
- ETHR_ASSERT(0);
- return NULL;
- }
-#endif
- return *(void**)ose_get_ppdata(key);
-}
-
-/*
- * Signal functions
- */
-
-#if ETHR_HAVE_ETHR_SIG_FUNCS
-
-int ethr_sigmask(int how, const sigset_t *set, sigset_t *oset)
-{
-#if ETHR_XCHK
- if (ethr_not_inited__) {
- ETHR_ASSERT(0);
- return EACCES;
- }
- if (!set && !oset) {
- ETHR_ASSERT(0);
- return EINVAL;
- }
-#endif
- return pthread_sigmask(how, set, oset);
-}
-
-int ethr_sigwait(const sigset_t *set, int *sig)
-{
-#if ETHR_XCHK
- if (ethr_not_inited__) {
- ETHR_ASSERT(0);
- return EACCES;
- }
- if (!set || !sig) {
- ETHR_ASSERT(0);
- return EINVAL;
- }
-#endif
- if (sigwait(set, sig) < 0)
- return errno;
- return 0;
-}
-
-#endif /* #if ETHR_HAVE_ETHR_SIG_FUNCS */
-
-ETHR_IMPL_NORETURN__
-ethr_abort__(void)
-{
- abort();
-}
diff --git a/erts/lib_src/pthread/ethr_event.c b/erts/lib_src/pthread/ethr_event.c
index ba664236f6..0629b4dfcd 100644
--- a/erts/lib_src/pthread/ethr_event.c
+++ b/erts/lib_src/pthread/ethr_event.c
@@ -29,6 +29,13 @@
#include "config.h"
#endif
+#if defined(__APPLE__) && defined(__MACH__) && !defined(__DARWIN__)
+# define __DARWIN__ 1
+#endif
+#ifdef __DARWIN__
+# define _DARWIN_UNLIMITED_SELECT
+#endif
+
#include "ethread.h"
#undef ETHR_INCLUDE_MONOTONIC_CLOCK__
#define ETHR_INCLUDE_MONOTONIC_CLOCK__
@@ -56,6 +63,12 @@ ethr_event_init(ethr_event *e)
}
int
+ethr_event_prepare_timed(ethr_event *e)
+{
+ return 0;
+}
+
+int
ethr_event_destroy(ethr_event *e)
{
return 0;
@@ -171,6 +184,17 @@ return_event_on:
#include <errno.h>
#include <string.h>
+#ifdef __DARWIN__
+
+struct ethr_event_fdsets___ {
+ fd_set *rsetp;
+ fd_set *esetp;
+ size_t mem_size;
+ fd_mask mem[1];
+};
+
+#endif
+
static void
setup_nonblocking_pipe(ethr_event *e)
{
@@ -188,6 +212,35 @@ setup_nonblocking_pipe(ethr_event *e)
flgs = fcntl(e->fd[1], F_GETFL, 0);
fcntl(e->fd[1], F_SETFL, flgs | O_NONBLOCK);
+
+#ifndef __DARWIN__
+ if (e->fd[0] >= FD_SETSIZE)
+ ETHR_FATAL_ERROR__(ENOTSUP);
+#else
+ {
+ int nmasks;
+ ethr_event_fdsets__ *fdsets;
+ size_t mem_size;
+
+ nmasks = (e->fd[0]+NFDBITS)/NFDBITS;
+ mem_size = 2*nmasks*sizeof(fd_mask);
+ if (mem_size < 2*sizeof(fd_set)) {
+ mem_size = 2*sizeof(fd_set);
+ nmasks = mem_size/(2*sizeof(fd_mask));
+ }
+
+ fdsets = malloc(sizeof(ethr_event_fdsets__)
+ + mem_size
+ - sizeof(fd_mask));
+ if (!fdsets)
+ ETHR_FATAL_ERROR__(ENOMEM);
+ fdsets->rsetp = (fd_set *) (char *) &fdsets->mem[0];
+ fdsets->esetp = (fd_set *) (char *) &fdsets->mem[nmasks];
+ fdsets->mem_size = mem_size;
+ e->fdsets = fdsets;
+ }
+#endif
+
ETHR_MEMBAR(ETHR_StoreStore);
}
@@ -252,6 +305,19 @@ ethr_event_init(ethr_event *e)
e->fd[0] = e->fd[1] = ETHR_EVENT_INVALID_FD__;
+#ifdef __DARWIN__
+ e->fdsets = NULL;
+#endif
+
+ return 0;
+}
+
+int
+ethr_event_prepare_timed(ethr_event *e)
+{
+ if (e->fd[0] == ETHR_EVENT_INVALID_FD__)
+ setup_nonblocking_pipe(e);
+
return 0;
}
@@ -263,13 +329,14 @@ ethr_event_destroy(ethr_event *e)
close(e->fd[0]);
close(e->fd[1]);
}
+#ifdef __DARWIN__
+ if (e->fdsets)
+ free(e->fdsets);
+#endif
res = pthread_mutex_destroy(&e->mtx);
if (res != 0)
return res;
- res = pthread_cond_destroy(&e->cnd);
- if (res != 0)
- return res;
- return 0;
+ return pthread_cond_destroy(&e->cnd);
}
static ETHR_INLINE int
@@ -403,8 +470,10 @@ wait__(ethr_event *e, int spincount, ethr_sint64_t timeout)
int fd;
int sres;
ssize_t rres;
- fd_set rset;
- fd_set eset;
+#ifndef __DARWIN__
+ fd_set rset, eset;
+#endif
+ fd_set *rsetp, *esetp;
struct timeval select_timeout;
#ifdef ETHR_HAVE_ETHR_GET_MONOTONIC_TIME
@@ -457,12 +526,22 @@ wait__(ethr_event *e, int spincount, ethr_sint64_t timeout)
ETHR_ASSERT(act == val);
}
+
+#ifdef __DARWIN__
+ rsetp = e->fdsets->rsetp;
+ esetp = e->fdsets->esetp;
+ memset((void *) &e->fdsets->mem[0], 0, e->fdsets->mem_size);
+#else
FD_ZERO(&rset);
- FD_SET(fd, &rset);
FD_ZERO(&eset);
- FD_SET(fd, &eset);
+ rsetp = &rset;
+ esetp = &eset;
+#endif
+
+ FD_SET(fd, rsetp);
+ FD_SET(fd, esetp);
- sres = select(fd + 1, &rset, NULL, &eset, &select_timeout);
+ sres = select(fd + 1, rsetp, NULL, esetp, &select_timeout);
if (sres == 0)
res = ETIMEDOUT;
else {
diff --git a/erts/lib_src/win/ethr_event.c b/erts/lib_src/win/ethr_event.c
index c88c8784a2..6951a216c5 100644
--- a/erts/lib_src/win/ethr_event.c
+++ b/erts/lib_src/win/ethr_event.c
@@ -47,6 +47,12 @@ ethr_event_init(ethr_event *e)
}
int
+ethr_event_prepare_timed(ethr_event *e)
+{
+ return 0;
+}
+
+int
ethr_event_destroy(ethr_event *e)
{
BOOL res = CloseHandle(e->handle);
diff --git a/erts/preloaded/ebin/prim_inet.beam b/erts/preloaded/ebin/prim_inet.beam
index 5a188be3ba..357bcd3d9a 100644
--- a/erts/preloaded/ebin/prim_inet.beam
+++ b/erts/preloaded/ebin/prim_inet.beam
Binary files differ
diff --git a/erts/preloaded/src/erlang.erl b/erts/preloaded/src/erlang.erl
index 291356c7b1..7280b43502 100644
--- a/erts/preloaded/src/erlang.erl
+++ b/erts/preloaded/src/erlang.erl
@@ -1974,6 +1974,7 @@ localtime_to_universaltime(_Localtime, _IsDst) ->
%% CHECK! Why the strange very thorough specification of the error
%% condition with disallowed arity in erl_bif_types?
%% Not documented
+%% Shadowed by erl_bif_types: erlang:make_fun/3
-spec erlang:make_fun(Module, Function, Arity) -> function() when
Module :: atom(),
Function :: atom(),
@@ -2423,7 +2424,7 @@ tuple_to_list(_Tuple) ->
MinBinVHeapSize :: pos_integer()};
(modified_timing_level) -> integer() | undefined;
(multi_scheduling) -> disabled | blocked | enabled;
- (multi_scheduling_blockers) -> [PID :: pid()];
+ (multi_scheduling_blockers) -> [Pid :: pid()];
(nif_version) -> string();
(otp_release) -> string();
(os_monotonic_time_source) -> [{atom(),term()}];
diff --git a/erts/preloaded/src/prim_inet.erl b/erts/preloaded/src/prim_inet.erl
index 4d04e1dacb..d5c8fd4268 100644
--- a/erts/preloaded/src/prim_inet.erl
+++ b/erts/preloaded/src/prim_inet.erl
@@ -1147,6 +1147,7 @@ enc_opt(packet_size) -> ?INET_LOPT_PACKET_SIZE;
enc_opt(read_packets) -> ?INET_LOPT_READ_PACKETS;
enc_opt(netns) -> ?INET_LOPT_NETNS;
enc_opt(show_econnreset) -> ?INET_LOPT_TCP_SHOW_ECONNRESET;
+enc_opt(line_delimiter) -> ?INET_LOPT_LINE_DELIM;
enc_opt(raw) -> ?INET_OPT_RAW;
% Names of SCTP opts:
enc_opt(sctp_rtoinfo) -> ?SCTP_OPT_RTOINFO;
@@ -1205,6 +1206,7 @@ dec_opt(?INET_LOPT_PACKET_SIZE) -> packet_size;
dec_opt(?INET_LOPT_READ_PACKETS) -> read_packets;
dec_opt(?INET_LOPT_NETNS) -> netns;
dec_opt(?INET_LOPT_TCP_SHOW_ECONNRESET) -> show_econnreset;
+dec_opt(?INET_LOPT_LINE_DELIM) -> line_delimiter;
dec_opt(?INET_OPT_RAW) -> raw;
dec_opt(I) when is_integer(I) -> undefined.
@@ -1287,6 +1289,7 @@ type_opt_1(packet) ->
{httph_bin,?TCP_PB_HTTPH_BIN},
{ssl, ?TCP_PB_SSL_TLS}, % obsolete
{ssl_tls, ?TCP_PB_SSL_TLS}]};
+type_opt_1(line_delimiter) -> int;
type_opt_1(mode) ->
{enum,[{list, ?INET_MODE_LIST},
{binary, ?INET_MODE_BINARY}]};
diff --git a/erts/test/otp_SUITE.erl b/erts/test/otp_SUITE.erl
index 69a0d19719..87d620b180 100644
--- a/erts/test/otp_SUITE.erl
+++ b/erts/test/otp_SUITE.erl
@@ -290,7 +290,7 @@ call_to_deprecated(Config) when is_list(Config) ->
call_to_size_1(Config) when is_list(Config) ->
%% Applications that do not call erlang:size/1:
Apps = [asn1,compiler,debugger,kernel,observer,parsetools,
- runtime_tools,stdlib,tools,webtool],
+ runtime_tools,stdlib,tools],
not_recommended_calls(Config, Apps, {erlang,size,1}).
call_to_now_0(Config) when is_list(Config) ->
@@ -298,12 +298,14 @@ call_to_now_0(Config) when is_list(Config) ->
Apps = [asn1,common_test,compiler,debugger,dialyzer,
gs,kernel,mnesia,observer,parsetools,reltool,
runtime_tools,sasl,stdlib,syntax_tools,
- test_server,tools,webtool],
+ test_server,tools],
not_recommended_calls(Config, Apps, {erlang,now,0}).
-not_recommended_calls(Config, Apps, MFA) ->
+not_recommended_calls(Config, Apps0, MFA) ->
Server = ?config(xref_server, Config),
+ Apps = [App || App <- Apps0, is_present_application(App, Server)],
+
Fs = [MFA],
Q1 = io_lib:format("E || ~p : Fun", [Fs]),
@@ -337,11 +339,28 @@ not_recommended_calls(Config, Apps, MFA) ->
end,
case CallsToMFA of
[] ->
- ok;
+ SkippedApps = ordsets:subtract(ordsets:from_list(Apps0),
+ ordsets:from_list(Apps)),
+ case SkippedApps of
+ [] ->
+ ok;
+ _ ->
+ AppStrings = [atom_to_list(A) || A <- SkippedApps],
+ Mess = io_lib:format("Application(s) not present: ~s\n",
+ [string:join(AppStrings, ", ")]),
+ {comment, Mess}
+ end;
_ ->
?t:fail({length(CallsToMFA),calls_to_size_1})
end.
+is_present_application(Name, Server) ->
+ Q = io_lib:format("~w : App", [Name]),
+ case xref:q(Server, lists:flatten(Q)) of
+ {ok,[Name]} -> true;
+ {error,_,_} -> false
+ end.
+
strong_components(Config) when is_list(Config) ->
Server = ?config(xref_server, Config),
?line {ok,Cs} = xref:q(Server, "components AE"),
diff --git a/erts/test/upgrade_SUITE.erl b/erts/test/upgrade_SUITE.erl
index 8a91cf5b7e..83cd2359d8 100644
--- a/erts/test/upgrade_SUITE.erl
+++ b/erts/test/upgrade_SUITE.erl
@@ -40,7 +40,7 @@
%% - typer requires hipe (in the .app file)
%% - erl_interface, jinterface support no upgrade
-define(appup_exclude,
- [dialyzer,hipe,typer,erl_interface,jinterface]).
+ [dialyzer,hipe,typer,erl_interface,jinterface,ose]).
init_per_suite(Config) ->
%% Check that a real release is running, not e.g. cerl
diff --git a/erts/vsn.mk b/erts/vsn.mk
index 38b9a13e63..9e4248a668 100644
--- a/erts/vsn.mk
+++ b/erts/vsn.mk
@@ -18,7 +18,7 @@
# %CopyrightEnd%
#
-VSN = 7.0.3
+VSN = 8.0
# Port number 4365 in 4.2
# Port number 4366 in 4.3
diff --git a/lib/Makefile b/lib/Makefile
index 34c2fe9a9e..863b9abac6 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -35,8 +35,8 @@ ALL_ERLANG_APPLICATIONS = xmerl edoc erl_docgen snmp otp_mibs erl_interface \
ic mnesia crypto orber os_mon syntax_tools \
public_key ssl observer odbc diameter \
cosTransactions cosEvent cosTime cosNotification \
- cosProperty cosFileTransfer cosEventDomain et megaco webtool \
- eunit ssh typer percept eldap dialyzer hipe ose
+ cosProperty cosFileTransfer cosEventDomain et megaco \
+ eunit ssh typer percept eldap dialyzer hipe
ifdef BUILD_ALL
ERLANG_APPLICATIONS += $(ALL_ERLANG_APPLICATIONS)
diff --git a/lib/asn1/c_src/Makefile b/lib/asn1/c_src/Makefile
index 2b72e1a214..e0d4f09a70 100644
--- a/lib/asn1/c_src/Makefile
+++ b/lib/asn1/c_src/Makefile
@@ -97,12 +97,7 @@ endif
_create_dirs := $(shell mkdir -p $(OBJDIR) $(LIBDIR))
-ifneq ($(findstring ose,$(TARGET)),ose)
opt: $(NIF_SHARED_OBJ_FILE)
-else
-# Do not build dynamic files on OSE
-opt:
-endif
debug: opt
@@ -140,9 +135,7 @@ include $(ERL_TOP)/make/otp_release_targets.mk
release_spec: opt
$(INSTALL_DIR) "$(RELSYSDIR)/priv/lib"
-ifneq ($(findstring ose,$(TARGET)),ose)
$(INSTALL_PROGRAM) $(NIF_SHARED_OBJ_FILE) "$(RELSYSDIR)/priv/lib"
-endif
$(INSTALL_DIR) "$(RELSYSDIR)/c_src"
$(INSTALL_DATA) *.c "$(RELSYSDIR)/c_src"
diff --git a/lib/compiler/doc/src/notes.xml b/lib/compiler/doc/src/notes.xml
index 6db8d19b5a..bd85f22462 100644
--- a/lib/compiler/doc/src/notes.xml
+++ b/lib/compiler/doc/src/notes.xml
@@ -32,6 +32,26 @@
<p>This document describes the changes made to the Compiler
application.</p>
+<section><title>Compiler 6.0.1</title>
+
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p>
+ Fix <c>get_map_elements</c> register corruption</p>
+ <p>
+ Instruction <c>get_map_elements</c> might destroy target
+ registers when the fail-label is taken. Only seen for
+ patterns with two, and only two, target registers.
+ Specifically if we copy one register and then jump.</p>
+ <p>
+ Own Id: OTP-12967</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
<section><title>Compiler 6.0</title>
<section><title>Fixed Bugs and Malfunctions</title>
diff --git a/lib/compiler/src/Makefile b/lib/compiler/src/Makefile
index 299b2892fc..f75beaba20 100644
--- a/lib/compiler/src/Makefile
+++ b/lib/compiler/src/Makefile
@@ -50,6 +50,7 @@ MODULES = \
beam_asm \
beam_block \
beam_bool \
+ beam_bs \
beam_bsm \
beam_clean \
beam_dead \
@@ -62,6 +63,7 @@ MODULES = \
beam_opcodes \
beam_peep \
beam_receive \
+ beam_reorder \
beam_split \
beam_trim \
beam_type \
diff --git a/lib/compiler/src/beam_block.erl b/lib/compiler/src/beam_block.erl
index 0321b1c07b..10dbaf462c 100644
--- a/lib/compiler/src/beam_block.erl
+++ b/lib/compiler/src/beam_block.erl
@@ -23,14 +23,13 @@
-module(beam_block).
-export([module/2]).
--import(lists, [mapfoldl/3,reverse/1,reverse/2,foldl/3,member/2]).
--define(MAXREG, 1024).
+-import(lists, [reverse/1,reverse/2,foldl/3,member/2]).
-module({Mod,Exp,Attr,Fs0,Lc0}, _Opt) ->
- {Fs,Lc} = mapfoldl(fun function/2, Lc0, Fs0),
+module({Mod,Exp,Attr,Fs0,Lc}, _Opt) ->
+ Fs = [function(F) || F <- Fs0],
{ok,{Mod,Exp,Attr,Fs,Lc}}.
-function({function,Name,Arity,CLabel,Is0}, Lc0) ->
+function({function,Name,Arity,CLabel,Is0}) ->
try
%% Collect basic blocks and optimize them.
Is1 = blockify(Is0),
@@ -40,11 +39,8 @@ function({function,Name,Arity,CLabel,Is0}, Lc0) ->
Is5 = opt_blocks(Is4),
Is6 = beam_utils:delete_live_annos(Is5),
- %% Optimize bit syntax.
- {Is,Lc} = bsm_opt(Is6, Lc0),
-
%% Done.
- {{function,Name,Arity,CLabel,Is},Lc}
+ {function,Name,Arity,CLabel,Is6}
catch
Class:Error ->
Stack = erlang:get_stacktrace(),
@@ -62,56 +58,15 @@ blockify(Is) ->
blockify([{loop_rec,{f,Fail},{x,0}},{loop_rec_end,_Lbl},{label,Fail}|Is], Acc) ->
%% Useless instruction sequence.
blockify(Is, Acc);
-blockify([{test,is_atom,{f,Fail},[Reg]}=I|
- [{select,select_val,Reg,{f,Fail},
- [{atom,false},{f,_}=BrFalse,
- {atom,true}=AtomTrue,{f,_}=BrTrue]}|Is]=Is0],
- [{block,Bl}|_]=Acc) ->
- case is_last_bool(Bl, Reg) of
- false ->
- blockify(Is0, [I|Acc]);
- true ->
- %% The last instruction is a boolean operator/guard BIF that can't fail.
- %% We can convert the three-way branch to a two-way branch (eliminating
- %% the reference to the failure label).
- blockify(Is, [{jump,BrTrue},
- {test,is_eq_exact,BrFalse,[Reg,AtomTrue]}|Acc])
- end;
-blockify([{test,is_atom,{f,Fail},[Reg]}=I|
- [{select,select_val,Reg,{f,Fail},
- [{atom,true}=AtomTrue,{f,_}=BrTrue,
- {atom,false},{f,_}=BrFalse]}|Is]=Is0],
- [{block,Bl}|_]=Acc) ->
- case is_last_bool(Bl, Reg) of
- false ->
- blockify(Is0, [I|Acc]);
- true ->
- blockify(Is, [{jump,BrTrue},
- {test,is_eq_exact,BrFalse,[Reg,AtomTrue]}|Acc])
- end;
blockify([I|Is0]=IsAll, Acc) ->
- case is_bs_put(I) of
- true ->
- {BsPuts0,Is} = collect_bs_puts(IsAll),
- BsPuts = opt_bs_puts(BsPuts0),
- blockify(Is, reverse(BsPuts, Acc));
- false ->
- case collect(I) of
- error -> blockify(Is0, [I|Acc]);
- Instr when is_tuple(Instr) ->
- {Block,Is} = collect_block(IsAll),
- blockify(Is, [{block,Block}|Acc])
- end
+ case collect(I) of
+ error -> blockify(Is0, [I|Acc]);
+ Instr when is_tuple(Instr) ->
+ {Block,Is} = collect_block(IsAll),
+ blockify(Is, [{block,Block}|Acc])
end;
blockify([], Acc) -> reverse(Acc).
-is_last_bool([{set,[Reg],As,{bif,N,_}}], Reg) ->
- Ar = length(As),
- erl_internal:new_type_test(N, Ar) orelse erl_internal:comp_op(N, Ar)
- orelse erl_internal:bool_op(N, Ar);
-is_last_bool([_|Is], Reg) -> is_last_bool(Is, Reg);
-is_last_bool([], _) -> false.
-
collect_block(Is) ->
collect_block(Is, []).
@@ -149,7 +104,10 @@ collect({put_map,F,Op,S,D,R,{list,Puts}}) ->
collect({get_map_elements,F,S,{list,Gets}}) ->
{Ss,Ds} = beam_utils:split_even(Gets),
{set,Ds,[S|Ss],{get_map_elements,F}};
-collect({'catch',R,L}) -> {set,[R],[],{'catch',L}};
+collect({'catch'=Op,R,L}) ->
+ {set,[R],[],{try_catch,Op,L}};
+collect({'try'=Op,R,L}) ->
+ {set,[R],[],{try_catch,Op,L}};
collect(fclearerror) -> {set,[],[],fclearerror};
collect({fcheckerror,{f,0}}) -> {set,[],[],fcheckerror};
collect({fmove,S,D}) -> {set,[D],[S],fmove};
@@ -183,7 +141,9 @@ opt_blocks([I|Is]) ->
opt_blocks([]) -> [].
opt_block(Is0) ->
- Is = find_fixpoint(fun opt/1, Is0),
+ Is = find_fixpoint(fun(Is) ->
+ opt_tuple_element(opt(Is))
+ end, Is0),
opt_alloc(Is).
find_fixpoint(OptFun, Is0) ->
@@ -279,76 +239,151 @@ opt_moves([X0,Y0], Is0) ->
not_possible -> {[X,Y0],Is2};
{X,_} -> {[X,Y0],Is2};
{Y,Is} -> {[X,Y],Is}
- end;
-opt_moves(Ds, Is) ->
- %% multiple destinations -> pass through
- {Ds,Is}.
-
+ end.
%% opt_move(Dest, [Instruction]) -> {UpdatedDest,[Instruction]} | not_possible
%% If there is a {move,Dest,FinalDest} instruction
%% in the instruction stream, remove the move instruction
%% and let FinalDest be the destination.
-%%
-%% For this optimization to be safe, we must be sure that
-%% Dest will not be referenced in any other by other instructions
-%% in the rest of the instruction stream. Not even the indirect
-%% reference by an instruction that may allocate (such as
-%% test_heap/2 or a GC Bif) is allowed.
opt_move(Dest, Is) ->
- opt_move_1(Dest, Is, ?MAXREG, []).
-
-opt_move_1(R, [{set,_,_,{alloc,Live,_}}|_]=Is, SafeRegs, Acc) when Live < SafeRegs ->
- %% Downgrade number of safe regs and rescan the instruction, as it most probably
- %% is a gc_bif instruction.
- opt_move_1(R, Is, Live, Acc);
-opt_move_1(R, [{set,[{x,X}=D],[R],move}|Is], SafeRegs, Acc) ->
- case X < SafeRegs andalso beam_utils:is_killed_block(R, Is) of
- true -> opt_move_2(D, Acc, Is);
- false -> not_possible
+ opt_move_1(Dest, Is, []).
+
+opt_move_1(R, [{set,[D],[R],move}|Is0], Acc) ->
+ %% Provided that the source register is killed by instructions
+ %% that follow, the optimization is safe.
+ case eliminate_use_of_from_reg(Is0, R, D, []) of
+ {yes,Is} -> opt_move_rev(D, Acc, Is);
+ no -> not_possible
end;
-opt_move_1(R, [{set,[D],[R],move}|Is], _SafeRegs, Acc) ->
- case beam_utils:is_killed_block(R, Is) of
- true -> opt_move_2(D, Acc, Is);
- false -> not_possible
+opt_move_1({x,_}, [{set,_,_,{alloc,_,_}}|_], _) ->
+ %% The optimization is not possible. If the X register is not
+ %% killed by allocation, the optimization would not be safe.
+ %% If the X register is killed, it means that there cannot
+ %% follow a 'move' instruction with this X register as the
+ %% source.
+ not_possible;
+opt_move_1(R, [{set,_,_,_}=I|Is], Acc) ->
+ %% If the source register is either killed or used by this
+ %% instruction, the optimimization is not possible.
+ case is_killed_or_used(R, I) of
+ true -> not_possible;
+ false -> opt_move_1(R, Is, [I|Acc])
end;
-opt_move_1(R, [I|Is], SafeRegs, Acc) ->
- case is_transparent(R, I) of
- false -> not_possible;
- true -> opt_move_1(R, Is, SafeRegs, [I|Acc])
- end.
+opt_move_1(_, _, _) ->
+ not_possible.
+
+%% opt_tuple_element([Instruction]) -> [Instruction]
+%% If possible, move get_tuple_element instructions forward
+%% in the instruction stream to a move instruction, eliminating
+%% the move instruction. Example:
+%%
+%% get_tuple_element Tuple Pos Dst1
+%% ...
+%% move Dst1 Dst2
+%%
+%% This code may be possible to rewrite to:
+%%
+%% %%(Moved get_tuple_element instruction)
+%% ...
+%% get_tuple_element Tuple Pos Dst2
+%%
-%% Reverse the instructions, while checking that there are no instructions that
-%% would interfere with using the new destination register chosen.
+opt_tuple_element([{set,[D],[S],{get_tuple_element,_}}=I|Is0]) ->
+ case opt_tuple_element_1(Is0, I, {S,D}, []) of
+ no ->
+ [I|opt_tuple_element(Is0)];
+ {yes,Is} ->
+ opt_tuple_element(Is)
+ end;
+opt_tuple_element([I|Is]) ->
+ [I|opt_tuple_element(Is)];
+opt_tuple_element([]) -> [].
+
+opt_tuple_element_1([{set,_,_,{alloc,_,_}}|_], _, _, _) ->
+ no;
+opt_tuple_element_1([{set,_,_,{try_catch,_,_}}|_], _, _, _) ->
+ no;
+opt_tuple_element_1([{set,[D],[S],move}|Is0], I0, {_,S}, Acc) ->
+ case eliminate_use_of_from_reg(Is0, S, D, []) of
+ no ->
+ no;
+ {yes,Is} ->
+ {set,[S],Ss,Op} = I0,
+ I = {set,[D],Ss,Op},
+ {yes,reverse(Acc, [I|Is])}
+ end;
+opt_tuple_element_1([{set,Ds,Ss,_}=I|Is], MovedI, {S,D}=Regs, Acc) ->
+ case member(S, Ds) orelse member(D, Ss) of
+ true ->
+ no;
+ false ->
+ opt_tuple_element_1(Is, MovedI, Regs, [I|Acc])
+ end;
+opt_tuple_element_1(_, _, _, _) -> no.
+
+%% Reverse the instructions, while checking that there are no
+%% instructions that would interfere with using the new destination
+%% register (D).
-opt_move_2(D, [I|Is], Acc) ->
- case is_transparent(D, I) of
- false -> not_possible;
- true -> opt_move_2(D, Is, [I|Acc])
+opt_move_rev(D, [I|Is], Acc) ->
+ case is_killed_or_used(D, I) of
+ true -> not_possible;
+ false -> opt_move_rev(D, Is, [I|Acc])
+ end;
+opt_move_rev(D, [], Acc) -> {D,Acc}.
+
+%% is_killed_or_used(Register, {set,_,_,_}) -> bool()
+%% Test whether the register is used by the instruction.
+
+is_killed_or_used(R, {set,Ss,Ds,_}) ->
+ member(R, Ds) orelse member(R, Ss).
+
+%% eliminate_use_of_from_reg([Instruction], FromRegister, ToRegister, Acc) ->
+%% {yes,Is} | no
+%% Eliminate any use of FromRegister in the instruction sequence
+%% by replacing uses of FromRegister with ToRegister. If FromRegister
+%% is referenced by an allocation instruction, return 'no' to indicate
+%% that FromRegister is still used and that the optimization is not
+%% possible.
+
+eliminate_use_of_from_reg([{set,_,_,{alloc,Live,_}}|_]=Is0, {x,X}, _, Acc) ->
+ if
+ X < Live ->
+ no;
+ true ->
+ {yes,reverse(Acc, Is0)}
end;
-opt_move_2(D, [], Acc) -> {D,Acc}.
-
-%% is_transparent(Register, Instruction) -> true | false
-%% Returns true if Instruction does not in any way references Register
-%% (even indirectly by an allocation instruction).
-%% Returns false if Instruction does reference Register, or we are
-%% not sure.
-
-is_transparent({x,X}, {set,_,_,{alloc,Live,_}}) when X < Live ->
- false;
-is_transparent(R, {set,Ds,Ss,_Op}) ->
- case member(R, Ds) of
- true -> false;
- false -> not member(R, Ss)
+eliminate_use_of_from_reg([{set,Ds,Ss0,Op}=I0|Is], From, To, Acc) ->
+ I = case member(From, Ss0) of
+ true ->
+ Ss = [case S of
+ From -> To;
+ _ -> S
+ end || S <- Ss0],
+ {set,Ds,Ss,Op};
+ false ->
+ I0
+ end,
+ case member(From, Ds) of
+ true ->
+ {yes,reverse(Acc, [I|Is])};
+ false ->
+ eliminate_use_of_from_reg(Is, From, To, [I|Acc])
end;
-is_transparent(_, _) -> false.
+eliminate_use_of_from_reg([I]=Is, From, _To, Acc) ->
+ case beam_utils:is_killed_block(From, [I]) of
+ true ->
+ {yes,reverse(Acc, Is)};
+ false ->
+ no
+ end.
%% opt_alloc(Instructions) -> Instructions'
%% Optimises all allocate instructions.
opt_alloc([{set,[],[],{alloc,R,{_,Ns,Nh,[]}}}|Is]) ->
- [{set,[],[],opt_alloc(Is, Ns, Nh, R)}|opt(Is)];
+ [{set,[],[],opt_alloc(Is, Ns, Nh, R)}|Is];
opt_alloc([I|Is]) -> [I|opt_alloc(Is)];
opt_alloc([]) -> [].
@@ -414,234 +449,3 @@ x_dead([], Regs) -> Regs.
x_live([{x,N}|Rs], Regs) -> x_live(Rs, Regs bor (1 bsl N));
x_live([_|Rs], Regs) -> x_live(Rs, Regs);
x_live([], Regs) -> Regs.
-
-%%%
-%%% Evaluation of constant bit fields.
-%%%
-
-is_bs_put({bs_put,_,{bs_put_integer,_,_},_}) -> true;
-is_bs_put({bs_put,_,{bs_put_float,_,_},_}) -> true;
-is_bs_put(_) -> false.
-
-collect_bs_puts(Is) ->
- collect_bs_puts_1(Is, []).
-
-collect_bs_puts_1([I|Is]=Is0, Acc) ->
- case is_bs_put(I) of
- false -> {reverse(Acc),Is0};
- true -> collect_bs_puts_1(Is, [I|Acc])
- end.
-
-opt_bs_puts(Is) ->
- opt_bs_1(Is, []).
-
-opt_bs_1([{bs_put,Fail,
- {bs_put_float,1,Flags0},[{integer,Sz},Src]}=I0|Is], Acc) ->
- try eval_put_float(Src, Sz, Flags0) of
- <<Int:Sz>> ->
- Flags = force_big(Flags0),
- I = {bs_put,Fail,{bs_put_integer,1,Flags},
- [{integer,Sz},{integer,Int}]},
- opt_bs_1([I|Is], Acc)
- catch
- error:_ ->
- opt_bs_1(Is, [I0|Acc])
- end;
-opt_bs_1([{bs_put,_,{bs_put_integer,1,_},[{integer,8},{integer,_}]}|_]=IsAll,
- Acc0) ->
- {Is,Acc} = bs_collect_string(IsAll, Acc0),
- opt_bs_1(Is, Acc);
-opt_bs_1([{bs_put,Fail,{bs_put_integer,1,F},[{integer,Sz},{integer,N}]}=I|Is0],
- Acc) when Sz > 8 ->
- case field_endian(F) of
- big ->
- %% We can do this optimization for any field size without risk
- %% for code explosion.
- case bs_split_int(N, Sz, Fail, Is0) of
- no_split -> opt_bs_1(Is0, [I|Acc]);
- Is -> opt_bs_1(Is, Acc)
- end;
- little when Sz < 128 ->
- %% We only try to optimize relatively small fields, to avoid
- %% an explosion in code size.
- <<Int:Sz>> = <<N:Sz/little>>,
- Flags = force_big(F),
- Is = [{bs_put,Fail,{bs_put_integer,1,Flags},
- [{integer,Sz},{integer,Int}]}|Is0],
- opt_bs_1(Is, Acc);
- _ -> %native or too wide little field
- opt_bs_1(Is0, [I|Acc])
- end;
-opt_bs_1([{bs_put,Fail,{Op,U,F},[{integer,Sz},Src]}|Is], Acc) when U > 1 ->
- opt_bs_1([{bs_put,Fail,{Op,1,F},[{integer,U*Sz},Src]}|Is], Acc);
-opt_bs_1([I|Is], Acc) ->
- opt_bs_1(Is, [I|Acc]);
-opt_bs_1([], Acc) -> reverse(Acc).
-
-eval_put_float(Src, Sz, Flags) when Sz =< 256 -> %Only evaluate if Sz is reasonable.
- Val = value(Src),
- case field_endian(Flags) of
- little -> <<Val:Sz/little-float-unit:1>>;
- big -> <<Val:Sz/big-float-unit:1>>
- %% native intentionally not handled here - we can't optimize it.
- end.
-
-value({integer,I}) -> I;
-value({float,F}) -> F.
-
-bs_collect_string(Is, [{bs_put,_,{bs_put_string,Len,{string,Str}},[]}|Acc]) ->
- bs_coll_str_1(Is, Len, reverse(Str), Acc);
-bs_collect_string(Is, Acc) ->
- bs_coll_str_1(Is, 0, [], Acc).
-
-bs_coll_str_1([{bs_put,_,{bs_put_integer,U,_},[{integer,Sz},{integer,V}]}|Is],
- Len, StrAcc, IsAcc) when U*Sz =:= 8 ->
- Byte = V band 16#FF,
- bs_coll_str_1(Is, Len+1, [Byte|StrAcc], IsAcc);
-bs_coll_str_1(Is, Len, StrAcc, IsAcc) ->
- {Is,[{bs_put,{f,0},{bs_put_string,Len,{string,reverse(StrAcc)}},[]}|IsAcc]}.
-
-field_endian({field_flags,F}) -> field_endian_1(F).
-
-field_endian_1([big=E|_]) -> E;
-field_endian_1([little=E|_]) -> E;
-field_endian_1([native=E|_]) -> E;
-field_endian_1([_|Fs]) -> field_endian_1(Fs).
-
-force_big({field_flags,F}) ->
- {field_flags,force_big_1(F)}.
-
-force_big_1([big|_]=Fs) -> Fs;
-force_big_1([little|Fs]) -> [big|Fs];
-force_big_1([F|Fs]) -> [F|force_big_1(Fs)].
-
-bs_split_int(0, Sz, _, _) when Sz > 64 ->
- %% We don't want to split in this case because the
- %% string will consist of only zeroes.
- no_split;
-bs_split_int(-1, Sz, _, _) when Sz > 64 ->
- %% We don't want to split in this case because the
- %% string will consist of only 255 bytes.
- no_split;
-bs_split_int(N, Sz, Fail, Acc) ->
- FirstByteSz = case Sz rem 8 of
- 0 -> 8;
- Rem -> Rem
- end,
- bs_split_int_1(N, FirstByteSz, Sz, Fail, Acc).
-
-bs_split_int_1(-1, _, Sz, Fail, Acc) when Sz > 64 ->
- I = {bs_put,Fail,{bs_put_integer,1,{field_flags,[big]}},
- [{integer,Sz},{integer,-1}]},
- [I|Acc];
-bs_split_int_1(0, _, Sz, Fail, Acc) when Sz > 64 ->
- I = {bs_put,Fail,{bs_put_integer,1,{field_flags,[big]}},
- [{integer,Sz},{integer,0}]},
- [I|Acc];
-bs_split_int_1(N, ByteSz, Sz, Fail, Acc) when Sz > 0 ->
- Mask = (1 bsl ByteSz) - 1,
- I = {bs_put,Fail,{bs_put_integer,1,{field_flags,[big]}},
- [{integer,ByteSz},{integer,N band Mask}]},
- bs_split_int_1(N bsr ByteSz, 8, Sz-ByteSz, Fail, [I|Acc]);
-bs_split_int_1(_, _, _, _, Acc) -> Acc.
-
-
-%%%
-%%% Optimization of new bit syntax matching: get rid
-%%% of redundant bs_restore2/2 instructions across select_val
-%%% instructions, as well as a few other simple peep-hole optimizations.
-%%%
-
-bsm_opt(Is0, Lc0) ->
- {Is1,D0,Lc} = bsm_scan(Is0, [], Lc0, []),
- Is2 = case D0 of
- [] ->
- Is1;
- _ ->
- D = gb_trees:from_orddict(orddict:from_list(D0)),
- bsm_reroute(Is1, D, none, [])
- end,
- Is = beam_clean:bs_clean_saves(Is2),
- {bsm_opt_2(Is, []),Lc}.
-
-bsm_scan([{label,L}=Lbl,{bs_restore2,_,Save}=R|Is], D0, Lc, Acc0) ->
- D = [{{L,Save},Lc}|D0],
- Acc = [{label,Lc},R,Lbl|Acc0],
- bsm_scan(Is, D, Lc+1, Acc);
-bsm_scan([I|Is], D, Lc, Acc) ->
- bsm_scan(Is, D, Lc, [I|Acc]);
-bsm_scan([], D, Lc, Acc) ->
- {reverse(Acc),D,Lc}.
-
-bsm_reroute([{bs_save2,Reg,Save}=I|Is], D, _, Acc) ->
- bsm_reroute(Is, D, {Reg,Save}, [I|Acc]);
-bsm_reroute([{bs_restore2,Reg,Save}=I|Is], D, _, Acc) ->
- bsm_reroute(Is, D, {Reg,Save}, [I|Acc]);
-bsm_reroute([{label,_}=I|Is], D, S, Acc) ->
- bsm_reroute(Is, D, S, [I|Acc]);
-bsm_reroute([{select,select_val,Reg,F0,Lbls0}|Is], D, {_,Save}=S, Acc0) ->
- [F|Lbls] = bsm_subst_labels([F0|Lbls0], Save, D),
- Acc = [{select,select_val,Reg,F,Lbls}|Acc0],
- bsm_reroute(Is, D, S, Acc);
-bsm_reroute([{test,TestOp,F0,TestArgs}=I|Is], D, {_,Save}=S, Acc0) ->
- F = bsm_subst_label(F0, Save, D),
- Acc = [{test,TestOp,F,TestArgs}|Acc0],
- case bsm_not_bs_test(I) of
- true ->
- %% The test instruction will not update the bit offset for the
- %% binary being matched. Therefore the save position can be kept.
- bsm_reroute(Is, D, S, Acc);
- false ->
- %% The test instruction might update the bit offset. Kill our
- %% remembered Save position.
- bsm_reroute(Is, D, none, Acc)
- end;
-bsm_reroute([{test,TestOp,F0,Live,TestArgs,Dst}|Is], D, {_,Save}, Acc0) ->
- F = bsm_subst_label(F0, Save, D),
- Acc = [{test,TestOp,F,Live,TestArgs,Dst}|Acc0],
- %% The test instruction will update the bit offset. Kill our
- %% remembered Save position.
- bsm_reroute(Is, D, none, Acc);
-bsm_reroute([{block,[{set,[],[],{alloc,_,_}}]}=Bl,
- {bs_context_to_binary,_}=I|Is], D, S, Acc) ->
- %% To help further bit syntax optimizations.
- bsm_reroute([I,Bl|Is], D, S, Acc);
-bsm_reroute([I|Is], D, _, Acc) ->
- bsm_reroute(Is, D, none, [I|Acc]);
-bsm_reroute([], _, _, Acc) -> reverse(Acc).
-
-bsm_opt_2([{test,bs_test_tail2,F,[Ctx,Bits]}|Is],
- [{test,bs_skip_bits2,F,[Ctx,{integer,I},Unit,_Flags]}|Acc]) ->
- bsm_opt_2(Is, [{test,bs_test_tail2,F,[Ctx,Bits+I*Unit]}|Acc]);
-bsm_opt_2([{test,bs_skip_bits2,F,[Ctx,{integer,I1},Unit1,_]}|Is],
- [{test,bs_skip_bits2,F,[Ctx,{integer,I2},Unit2,Flags]}|Acc]) ->
- bsm_opt_2(Is, [{test,bs_skip_bits2,F,
- [Ctx,{integer,I1*Unit1+I2*Unit2},1,Flags]}|Acc]);
-bsm_opt_2([I|Is], Acc) ->
- bsm_opt_2(Is, [I|Acc]);
-bsm_opt_2([], Acc) -> reverse(Acc).
-
-%% bsm_not_bs_test({test,Name,_,Operands}) -> true|false.
-%% Test whether is the test is a "safe", i.e. does not move the
-%% bit offset for a binary.
-%%
-%% 'true' means that the test is safe, 'false' that we don't know or
-%% that the test moves the offset (e.g. bs_get_integer2).
-
-bsm_not_bs_test({test,bs_test_tail2,_,[_,_]}) -> true;
-bsm_not_bs_test(Test) -> beam_utils:is_pure_test(Test).
-
-bsm_subst_labels(Fs, Save, D) ->
- bsm_subst_labels_1(Fs, Save, D, []).
-
-bsm_subst_labels_1([F|Fs], Save, D, Acc) ->
- bsm_subst_labels_1(Fs, Save, D, [bsm_subst_label(F, Save, D)|Acc]);
-bsm_subst_labels_1([], _, _, Acc) ->
- reverse(Acc).
-
-bsm_subst_label({f,Lbl0}=F, Save, D) ->
- case gb_trees:lookup({Lbl0,Save}, D) of
- {value,Lbl} -> {f,Lbl};
- none -> F
- end;
-bsm_subst_label(Other, _, _) -> Other.
diff --git a/lib/compiler/src/beam_bool.erl b/lib/compiler/src/beam_bool.erl
index 14b6381230..c9e103eae9 100644
--- a/lib/compiler/src/beam_bool.erl
+++ b/lib/compiler/src/beam_bool.erl
@@ -25,8 +25,6 @@
-import(lists, [reverse/1,reverse/2,foldl/3,mapfoldl/3,map/2]).
--define(MAXREG, 1024).
-
-record(st,
{next, %Next label number.
ll %Live regs at labels.
diff --git a/lib/compiler/src/beam_bs.erl b/lib/compiler/src/beam_bs.erl
new file mode 100644
index 0000000000..55fa7ce10c
--- /dev/null
+++ b/lib/compiler/src/beam_bs.erl
@@ -0,0 +1,278 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 1999-2013. All Rights Reserved.
+%%
+%% Licensed under the Apache License, Version 2.0 (the "License");
+%% you may not use this file except in compliance with the License.
+%% You may obtain a copy of the License at
+%%
+%% http://www.apache.org/licenses/LICENSE-2.0
+%%
+%% Unless required by applicable law or agreed to in writing, software
+%% distributed under the License is distributed on an "AS IS" BASIS,
+%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+%% See the License for the specific language governing permissions and
+%% limitations under the License.
+%%
+%% %CopyrightEnd%
+%%
+%% Purpose : Partitions assembly instructions into basic blocks and
+%% optimizes them.
+
+-module(beam_bs).
+
+-export([module/2]).
+-import(lists, [mapfoldl/3,reverse/1]).
+
+module({Mod,Exp,Attr,Fs0,Lc0}, _Opt) ->
+ {Fs,Lc} = mapfoldl(fun function/2, Lc0, Fs0),
+ {ok,{Mod,Exp,Attr,Fs,Lc}}.
+
+function({function,Name,Arity,CLabel,Is0}, Lc0) ->
+ try
+ Is1 = bs_put_opt(Is0),
+ {Is,Lc} = bsm_opt(Is1, Lc0),
+ {{function,Name,Arity,CLabel,Is},Lc}
+ catch
+ Class:Error ->
+ Stack = erlang:get_stacktrace(),
+ io:fwrite("Function: ~w/~w\n", [Name,Arity]),
+ erlang:raise(Class, Error, Stack)
+ end.
+
+%%%
+%%% Evaluation of constant bit fields.
+%%%
+
+bs_put_opt([{bs_put,_,_,_}=I|Is0]) ->
+ {BsPuts0,Is} = collect_bs_puts(Is0, [I]),
+ BsPuts = opt_bs_puts(BsPuts0),
+ BsPuts ++ bs_put_opt(Is);
+bs_put_opt([I|Is]) ->
+ [I|bs_put_opt(Is)];
+bs_put_opt([]) -> [].
+
+collect_bs_puts([{bs_put,_,_,_}=I|Is], Acc) ->
+ collect_bs_puts(Is, [I|Acc]);
+collect_bs_puts([_|_]=Is, Acc) ->
+ {reverse(Acc),Is}.
+
+opt_bs_puts(Is) ->
+ opt_bs_1(Is, []).
+
+opt_bs_1([{bs_put,Fail,
+ {bs_put_float,1,Flags0},[{integer,Sz},Src]}=I0|Is], Acc) ->
+ try eval_put_float(Src, Sz, Flags0) of
+ <<Int:Sz>> ->
+ Flags = force_big(Flags0),
+ I = {bs_put,Fail,{bs_put_integer,1,Flags},
+ [{integer,Sz},{integer,Int}]},
+ opt_bs_1([I|Is], Acc)
+ catch
+ error:_ ->
+ opt_bs_1(Is, [I0|Acc])
+ end;
+opt_bs_1([{bs_put,_,{bs_put_integer,1,_},[{integer,8},{integer,_}]}|_]=IsAll,
+ Acc0) ->
+ {Is,Acc} = bs_collect_string(IsAll, Acc0),
+ opt_bs_1(Is, Acc);
+opt_bs_1([{bs_put,Fail,{bs_put_integer,1,F},[{integer,Sz},{integer,N}]}=I|Is0],
+ Acc) when Sz > 8 ->
+ case field_endian(F) of
+ big ->
+ %% We can do this optimization for any field size without
+ %% risk for code explosion.
+ case bs_split_int(N, Sz, Fail, Is0) of
+ no_split -> opt_bs_1(Is0, [I|Acc]);
+ Is -> opt_bs_1(Is, Acc)
+ end;
+ little when Sz < 128 ->
+ %% We only try to optimize relatively small fields, to
+ %% avoid an explosion in code size.
+ <<Int:Sz>> = <<N:Sz/little>>,
+ Flags = force_big(F),
+ Is = [{bs_put,Fail,{bs_put_integer,1,Flags},
+ [{integer,Sz},{integer,Int}]}|Is0],
+ opt_bs_1(Is, Acc);
+ _ -> %native or too wide little field
+ opt_bs_1(Is0, [I|Acc])
+ end;
+opt_bs_1([{bs_put,Fail,{Op,U,F},[{integer,Sz},Src]}|Is], Acc) when U > 1 ->
+ opt_bs_1([{bs_put,Fail,{Op,1,F},[{integer,U*Sz},Src]}|Is], Acc);
+opt_bs_1([I|Is], Acc) ->
+ opt_bs_1(Is, [I|Acc]);
+opt_bs_1([], Acc) -> reverse(Acc).
+
+eval_put_float(Src, Sz, Flags) when Sz =< 256 ->
+ %%Only evaluate if Sz is reasonable.
+ Val = value(Src),
+ case field_endian(Flags) of
+ little -> <<Val:Sz/little-float-unit:1>>;
+ big -> <<Val:Sz/big-float-unit:1>>
+ %% native intentionally not handled here - we can't optimize
+ %% it.
+ end.
+
+value({integer,I}) -> I;
+value({float,F}) -> F.
+
+bs_collect_string(Is, [{bs_put,_,{bs_put_string,Len,{string,Str}},[]}|Acc]) ->
+ bs_coll_str_1(Is, Len, reverse(Str), Acc);
+bs_collect_string(Is, Acc) ->
+ bs_coll_str_1(Is, 0, [], Acc).
+
+bs_coll_str_1([{bs_put,_,{bs_put_integer,U,_},[{integer,Sz},{integer,V}]}|Is],
+ Len, StrAcc, IsAcc) when U*Sz =:= 8 ->
+ Byte = V band 16#FF,
+ bs_coll_str_1(Is, Len+1, [Byte|StrAcc], IsAcc);
+bs_coll_str_1(Is, Len, StrAcc, IsAcc) ->
+ {Is,[{bs_put,{f,0},{bs_put_string,Len,{string,reverse(StrAcc)}},[]}|IsAcc]}.
+
+field_endian({field_flags,F}) -> field_endian_1(F).
+
+field_endian_1([big=E|_]) -> E;
+field_endian_1([little=E|_]) -> E;
+field_endian_1([native=E|_]) -> E;
+field_endian_1([_|Fs]) -> field_endian_1(Fs).
+
+force_big({field_flags,F}) ->
+ {field_flags,force_big_1(F)}.
+
+force_big_1([big|_]=Fs) -> Fs;
+force_big_1([little|Fs]) -> [big|Fs];
+force_big_1([F|Fs]) -> [F|force_big_1(Fs)].
+
+bs_split_int(0, Sz, _, _) when Sz > 64 ->
+ %% We don't want to split in this case because the
+ %% string will consist of only zeroes.
+ no_split;
+bs_split_int(-1, Sz, _, _) when Sz > 64 ->
+ %% We don't want to split in this case because the
+ %% string will consist of only 255 bytes.
+ no_split;
+bs_split_int(N, Sz, Fail, Acc) ->
+ FirstByteSz = case Sz rem 8 of
+ 0 -> 8;
+ Rem -> Rem
+ end,
+ bs_split_int_1(N, FirstByteSz, Sz, Fail, Acc).
+
+bs_split_int_1(-1, _, Sz, Fail, Acc) when Sz > 64 ->
+ I = {bs_put,Fail,{bs_put_integer,1,{field_flags,[big]}},
+ [{integer,Sz},{integer,-1}]},
+ [I|Acc];
+bs_split_int_1(0, _, Sz, Fail, Acc) when Sz > 64 ->
+ I = {bs_put,Fail,{bs_put_integer,1,{field_flags,[big]}},
+ [{integer,Sz},{integer,0}]},
+ [I|Acc];
+bs_split_int_1(N, ByteSz, Sz, Fail, Acc) when Sz > 0 ->
+ Mask = (1 bsl ByteSz) - 1,
+ I = {bs_put,Fail,{bs_put_integer,1,{field_flags,[big]}},
+ [{integer,ByteSz},{integer,N band Mask}]},
+ bs_split_int_1(N bsr ByteSz, 8, Sz-ByteSz, Fail, [I|Acc]);
+bs_split_int_1(_, _, _, _, Acc) -> Acc.
+
+%%%
+%%% Optimization of bit syntax matching: get rid
+%%% of redundant bs_restore2/2 instructions across select_val
+%%% instructions, as well as a few other simple peep-hole
+%%% optimizations.
+%%%
+
+bsm_opt(Is0, Lc0) ->
+ {Is1,D0,Lc} = bsm_scan(Is0, [], Lc0, []),
+ Is2 = case D0 of
+ [] ->
+ %% No bit syntax matching in this function.
+ Is1;
+ [_|_] ->
+ %% Optimize the bit syntax matching.
+ D = gb_trees:from_orddict(orddict:from_list(D0)),
+ bsm_reroute(Is1, D, none, [])
+ end,
+ Is = beam_clean:bs_clean_saves(Is2),
+ {bsm_opt_2(Is, []),Lc}.
+
+bsm_scan([{label,L}=Lbl,{bs_restore2,_,Save}=R|Is], D0, Lc, Acc0) ->
+ D = [{{L,Save},Lc}|D0],
+ Acc = [{label,Lc},R,Lbl|Acc0],
+ bsm_scan(Is, D, Lc+1, Acc);
+bsm_scan([I|Is], D, Lc, Acc) ->
+ bsm_scan(Is, D, Lc, [I|Acc]);
+bsm_scan([], D, Lc, Acc) ->
+ {reverse(Acc),D,Lc}.
+
+bsm_reroute([{bs_save2,Reg,Save}=I|Is], D, _, Acc) ->
+ bsm_reroute(Is, D, {Reg,Save}, [I|Acc]);
+bsm_reroute([{bs_restore2,Reg,Save}=I|Is], D, _, Acc) ->
+ bsm_reroute(Is, D, {Reg,Save}, [I|Acc]);
+bsm_reroute([{label,_}=I|Is], D, S, Acc) ->
+ bsm_reroute(Is, D, S, [I|Acc]);
+bsm_reroute([{select,select_val,Reg,F0,Lbls0}|Is], D, {_,Save}=S, Acc0) ->
+ [F|Lbls] = bsm_subst_labels([F0|Lbls0], Save, D),
+ Acc = [{select,select_val,Reg,F,Lbls}|Acc0],
+ bsm_reroute(Is, D, S, Acc);
+bsm_reroute([{test,TestOp,F0,TestArgs}=I|Is], D, {_,Save}=S, Acc0) ->
+ F = bsm_subst_label(F0, Save, D),
+ Acc = [{test,TestOp,F,TestArgs}|Acc0],
+ case bsm_not_bs_test(I) of
+ true ->
+ %% The test instruction will not update the bit offset for
+ %% the binary being matched. Therefore the save position
+ %% can be kept.
+ bsm_reroute(Is, D, S, Acc);
+ false ->
+ %% The test instruction might update the bit offset. Kill
+ %% our remembered Save position.
+ bsm_reroute(Is, D, none, Acc)
+ end;
+bsm_reroute([{test,TestOp,F0,Live,TestArgs,Dst}|Is], D, {_,Save}, Acc0) ->
+ F = bsm_subst_label(F0, Save, D),
+ Acc = [{test,TestOp,F,Live,TestArgs,Dst}|Acc0],
+ %% The test instruction will update the bit offset. Kill our
+ %% remembered Save position.
+ bsm_reroute(Is, D, none, Acc);
+bsm_reroute([{block,[{set,[],[],{alloc,_,_}}]}=Bl,
+ {bs_context_to_binary,_}=I|Is], D, S, Acc) ->
+ %% To help further bit syntax optimizations.
+ bsm_reroute([I,Bl|Is], D, S, Acc);
+bsm_reroute([I|Is], D, _, Acc) ->
+ bsm_reroute(Is, D, none, [I|Acc]);
+bsm_reroute([], _, _, Acc) -> reverse(Acc).
+
+bsm_opt_2([{test,bs_test_tail2,F,[Ctx,Bits]}|Is],
+ [{test,bs_skip_bits2,F,[Ctx,{integer,I},Unit,_Flags]}|Acc]) ->
+ bsm_opt_2(Is, [{test,bs_test_tail2,F,[Ctx,Bits+I*Unit]}|Acc]);
+bsm_opt_2([{test,bs_skip_bits2,F,[Ctx,{integer,I1},Unit1,_]}|Is],
+ [{test,bs_skip_bits2,F,[Ctx,{integer,I2},Unit2,Flags]}|Acc]) ->
+ bsm_opt_2(Is, [{test,bs_skip_bits2,F,
+ [Ctx,{integer,I1*Unit1+I2*Unit2},1,Flags]}|Acc]);
+bsm_opt_2([I|Is], Acc) ->
+ bsm_opt_2(Is, [I|Acc]);
+bsm_opt_2([], Acc) -> reverse(Acc).
+
+%% bsm_not_bs_test({test,Name,_,Operands}) -> true|false.
+%% Test whether is the test is a "safe", i.e. does not move the
+%% bit offset for a binary.
+%%
+%% 'true' means that the test is safe, 'false' that we don't know or
+%% that the test moves the offset (e.g. bs_get_integer2).
+
+bsm_not_bs_test({test,bs_test_tail2,_,[_,_]}) -> true;
+bsm_not_bs_test(Test) -> beam_utils:is_pure_test(Test).
+
+bsm_subst_labels(Fs, Save, D) ->
+ bsm_subst_labels_1(Fs, Save, D, []).
+
+bsm_subst_labels_1([F|Fs], Save, D, Acc) ->
+ bsm_subst_labels_1(Fs, Save, D, [bsm_subst_label(F, Save, D)|Acc]);
+bsm_subst_labels_1([], _, _, Acc) ->
+ reverse(Acc).
+
+bsm_subst_label({f,Lbl0}=F, Save, D) ->
+ case gb_trees:lookup({Lbl0,Save}, D) of
+ {value,Lbl} -> {f,Lbl};
+ none -> F
+ end;
+bsm_subst_label(Other, _, _) -> Other.
diff --git a/lib/compiler/src/beam_clean.erl b/lib/compiler/src/beam_clean.erl
index 919ee3ee7d..d9108c383d 100644
--- a/lib/compiler/src/beam_clean.erl
+++ b/lib/compiler/src/beam_clean.erl
@@ -141,7 +141,7 @@ renumber_labels([{bif,is_record,{f,_},
renumber_labels(Is, Acc, St);
renumber_labels([{test,is_record,{f,_}=Fail,
[Term,{atom,Tag}=TagAtom,{integer,Arity}]}|Is0], Acc, St) ->
- Tmp = {x,1023},
+ Tmp = {x,1022},
Is = case is_record_tuple(Term, Tag, Arity) of
yes ->
Is0;
@@ -190,17 +190,11 @@ replace([{test,Test,{f,Lbl},Ops}|Is], Acc, D) ->
replace([{test,Test,{f,Lbl},Live,Ops,Dst}|Is], Acc, D) ->
replace(Is, [{test,Test,{f,label(Lbl, D)},Live,Ops,Dst}|Acc], D);
replace([{select,I,R,{f,Fail0},Vls0}|Is], Acc, D) ->
- Vls1 = map(fun ({f,L}) -> {f,label(L, D)};
- (Other) -> Other end, Vls0),
+ Vls = map(fun ({f,L}) -> {f,label(L, D)};
+ (Other) -> Other
+ end, Vls0),
Fail = label(Fail0, D),
- case redundant_values(Vls1, Fail, []) of
- [] ->
- %% Oops, no choices left. The loader will not accept that.
- %% Convert to a plain jump.
- replace(Is, [{jump,{f,Fail}}|Acc], D);
- Vls ->
- replace(Is, [{select,I,R,{f,Fail},Vls}|Acc], D)
- end;
+ replace(Is, [{select,I,R,{f,Fail},Vls}|Acc], D);
replace([{'try',R,{f,Lbl}}|Is], Acc, D) ->
replace(Is, [{'try',R,{f,label(Lbl, D)}}|Acc], D);
replace([{'catch',R,{f,Lbl}}|Is], Acc, D) ->
@@ -241,12 +235,6 @@ label(Old, D) ->
{value,Val} -> Val;
none -> throw({error,{undefined_label,Old}})
end.
-
-redundant_values([_,{f,Fail}|Vls], Fail, Acc) ->
- redundant_values(Vls, Fail, Acc);
-redundant_values([Val,Lbl|Vls], Fail, Acc) ->
- redundant_values(Vls, Fail, [Lbl,Val|Acc]);
-redundant_values([], _, Acc) -> reverse(Acc).
%%%
%%% Final fixup of bs_start_match2/5,bs_save2/bs_restore2 instructions for
diff --git a/lib/compiler/src/beam_dead.erl b/lib/compiler/src/beam_dead.erl
index ead88b57e9..11129c39bc 100644
--- a/lib/compiler/src/beam_dead.erl
+++ b/lib/compiler/src/beam_dead.erl
@@ -239,11 +239,26 @@ backward([{test,is_eq_exact,Fail,[Dst,{integer,Arity}]}=I|
backward([{label,Lbl}=L|Is], D, Acc) ->
backward(Is, beam_utils:index_label(Lbl, Acc, D), [L|Acc]);
backward([{select,select_val,Reg,{f,Fail0},List0}|Is], D, Acc) ->
- List = shortcut_select_list(List0, Reg, D, []),
+ List1 = shortcut_select_list(List0, Reg, D, []),
Fail1 = shortcut_label(Fail0, D),
Fail = shortcut_bs_test(Fail1, Is, D),
- Sel = {select,select_val,Reg,{f,Fail},List},
- backward(Is, D, [Sel|Acc]);
+ List = prune_redundant(List1, Fail),
+ case List of
+ [] ->
+ Jump = {jump,{f,Fail}},
+ backward([Jump|Is], D, Acc);
+ [V,F] ->
+ Test = {test,is_eq_exact,{f,Fail},[Reg,V]},
+ Jump = {jump,F},
+ backward([Jump,Test|Is], D, Acc);
+ [{atom,B1},F,{atom,B2},F] when B1 =:= not B2 ->
+ Test = {test,is_boolean,{f,Fail},[Reg]},
+ Jump = {jump,F},
+ backward([Jump,Test|Is], D, Acc);
+ [_|_] ->
+ Sel = {select,select_val,Reg,{f,Fail},List},
+ backward(Is, D, [Sel|Acc])
+ end;
backward([{jump,{f,To0}},{move,Src,Reg}=Move|Is], D, Acc) ->
To = shortcut_select_label(To0, Reg, Src, D),
Jump = {jump,{f,To}},
@@ -257,14 +272,17 @@ backward([{jump,{f,To}}=J|[{bif,Op,_,Ops,Reg}|Is]=Is0], D, Acc) ->
catch
throw:not_possible -> backward(Is0, D, [J|Acc])
end;
-backward([{test,bs_start_match2,F,_,[R,_],Ctxt}=I|Is], D,
+backward([{test,bs_start_match2,F,Live,[R,_]=Args,Ctxt}|Is], D,
[{test,bs_match_string,F,[Ctxt,Bs]},
{test,bs_test_tail2,F,[Ctxt,0]}|Acc0]=Acc) ->
+ {f,To0} = F,
+ To = shortcut_bs_start_match(To0, R, D),
case beam_utils:is_killed(Ctxt, Acc0, D) of
true ->
- Eq = {test,is_eq_exact,F,[R,{literal,Bs}]},
+ Eq = {test,is_eq_exact,{f,To},[R,{literal,Bs}]},
backward(Is, D, [Eq|Acc0]);
false ->
+ I = {test,bs_start_match2,{f,To},Live,Args,Ctxt},
backward(Is, D, [I|Acc])
end;
backward([{test,bs_start_match2,{f,To0},Live,[Src|_]=Info,Dst}|Is], D, Acc) ->
@@ -295,7 +313,28 @@ backward([{test,Op,{f,To0},Ops0}|Is], D, Acc) ->
is_eq_exact -> combine_eqs(To, Ops0, D, Acc);
_ -> {test,Op,{f,To},Ops0}
end,
- backward(Is, D, [I|Acc]);
+ case {I,Acc} of
+ {{test,is_atom,Fail,Ops0},[{test,is_boolean,Fail,Ops0}|_]} ->
+ %% An is_atom test before an is_boolean test (with the
+ %% same failure label) is redundant.
+ backward(Is, D, Acc);
+ {{test,is_atom,Fail,[R]},
+ [{test,is_eq_exact,Fail,[R,{atom,_}]}|_]} ->
+ %% An is_atom test before a comparison with an atom (with
+ %% the same failure label) is redundant.
+ backward(Is, D, Acc);
+ {{test,is_integer,Fail,[R]},
+ [{test,is_eq_exact,Fail,[R,{integer,_}]}|_]} ->
+ %% An is_integer test before a comparison with an integer
+ %% (with the same failure label) is redundant.
+ backward(Is, D, Acc);
+ {{test,_,_,_},_} ->
+ %% Still a test instruction. Done.
+ backward(Is, D, [I|Acc]);
+ {_,_} ->
+ %% Rewritten to a select_val. Rescan.
+ backward([I|Is], D, Acc)
+ end;
backward([{test,Op,{f,To0},Live,Ops0,Dst}|Is], D, Acc) ->
To1 = shortcut_bs_test(To0, Is, D),
To2 = shortcut_label(To1, D),
@@ -348,6 +387,12 @@ shortcut_label(To0, D) ->
shortcut_select_label(To, Reg, Lit, D) ->
shortcut_rel_op(To, is_ne_exact, [Reg,Lit], D).
+prune_redundant([_,{f,Fail}|T], Fail) ->
+ prune_redundant(T, Fail);
+prune_redundant([V,F|T], Fail) ->
+ [V,F|prune_redundant(T, Fail)];
+prune_redundant([], _) -> [].
+
%% Replace a comparison operator with a test instruction and a jump.
%% For example, if we have this code:
%%
diff --git a/lib/compiler/src/beam_jump.erl b/lib/compiler/src/beam_jump.erl
index 5e58e0f6ac..3b6eb19fe8 100644
--- a/lib/compiler/src/beam_jump.erl
+++ b/lib/compiler/src/beam_jump.erl
@@ -495,7 +495,7 @@ is_label_used_in_block({set,_,_,Info}, Lbl) ->
{alloc,_,{gc_bif,_,{f,F}}} -> F =:= Lbl;
{alloc,_,{put_map,_,{f,F}}} -> F =:= Lbl;
{get_map_elements,{f,F}} -> F =:= Lbl;
- {'catch',{f,F}} -> F =:= Lbl;
+ {try_catch,_,{f,F}} -> F =:= Lbl;
{alloc,_,_} -> false;
{put_tuple,_} -> false;
{get_tuple_element,_} -> false;
diff --git a/lib/compiler/src/beam_peep.erl b/lib/compiler/src/beam_peep.erl
index 17fd2e502a..0c1abfe6a0 100644
--- a/lib/compiler/src/beam_peep.erl
+++ b/lib/compiler/src/beam_peep.erl
@@ -65,18 +65,6 @@ function({function,Name,Arity,CLabel,Is0}) ->
%% InEncoding =:= latin1, OutEncoding =:= unicode;
%% InEncoding =:= latin1, OutEncoding =:= utf8 ->
%%
-%% (2) A select_val/4 instruction that only verifies that
-%% its argument is either 'true' or 'false' can be
-%% be replaced with an is_boolean/2 instruction. That is:
-%%
-%% select_val Reg Fail [ true Next false Next ]
-%% Next: ...
-%%
-%% can be rewritten to
-%%
-%% is_boolean Fail Reg
-%% Next: ...
-%%
peep(Is) ->
peep(Is, gb_sets:empty(), []).
@@ -95,12 +83,16 @@ peep([{gc_bif,_,_,_,_,Dst}=I|Is], SeenTests0, Acc) ->
%% Kill all remembered tests that depend on the destination register.
SeenTests = kill_seen(Dst, SeenTests0),
peep(Is, SeenTests, [I|Acc]);
-peep([{test,is_boolean,{f,Fail},Ops}|_]=Is, SeenTests,
- [{test,is_atom,{f,Fail},Ops}|Acc]) ->
- %% The previous is_atom/2 test (with the same failure label) is redundant.
- %% (If is_boolean(Src) is true, is_atom(Src) is also true, so it is
- %% OK to still remember that we have seen is_atom/1.)
- peep(Is, SeenTests, Acc);
+peep([{select,Op,R,F,Vls0}|Is], _, Acc) ->
+ case prune_redundant_values(Vls0, F) of
+ [] ->
+ %% No values left. Must convert to plain jump.
+ I = {jump,F},
+ peep(Is, gb_sets:empty(), [I|Acc]);
+ [_|_]=Vls ->
+ I = {select,Op,R,F,Vls},
+ peep(Is, gb_sets:empty(), [I|Acc])
+ end;
peep([{test,Op,_,Ops}=I|Is], SeenTests0, Acc) ->
case beam_utils:is_pure_test(I) of
false ->
@@ -121,16 +113,6 @@ peep([{test,Op,_,Ops}=I|Is], SeenTests0, Acc) ->
peep(Is, SeenTests, [I|Acc])
end
end;
-peep([{select,select_val,Src,Fail,
- [{atom,false},{f,L},{atom,true},{f,L}]}|
- [{label,L}|_]=Is], SeenTests, Acc) ->
- I = {test,is_boolean,Fail,[Src]},
- peep([I|Is], SeenTests, Acc);
-peep([{select,select_val,Src,Fail,
- [{atom,true},{f,L},{atom,false},{f,L}]}|
- [{label,L}|_]=Is], SeenTests, Acc) ->
- I = {test,is_boolean,Fail,[Src]},
- peep([I|Is], SeenTests, Acc);
peep([I|Is], _, Acc) ->
%% An unknown instruction. Throw away all information we
%% have collected about test instructions.
@@ -155,3 +137,9 @@ kill_seen_1([{_,Ops}=Test|T], Dst) ->
false -> [Test|kill_seen_1(T, Dst)]
end;
kill_seen_1([], _) -> [].
+
+prune_redundant_values([_Val,F|Vls], F) ->
+ prune_redundant_values(Vls, F);
+prune_redundant_values([Val,Lbl|Vls], F) ->
+ [Val,Lbl|prune_redundant_values(Vls, F)];
+prune_redundant_values([], _) -> [].
diff --git a/lib/compiler/src/beam_reorder.erl b/lib/compiler/src/beam_reorder.erl
new file mode 100644
index 0000000000..41586a7bf2
--- /dev/null
+++ b/lib/compiler/src/beam_reorder.erl
@@ -0,0 +1,139 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 1999-2013. All Rights Reserved.
+%%
+%% Licensed under the Apache License, Version 2.0 (the "License");
+%% you may not use this file except in compliance with the License.
+%% You may obtain a copy of the License at
+%%
+%% http://www.apache.org/licenses/LICENSE-2.0
+%%
+%% Unless required by applicable law or agreed to in writing, software
+%% distributed under the License is distributed on an "AS IS" BASIS,
+%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+%% See the License for the specific language governing permissions and
+%% limitations under the License.
+%%
+%% %CopyrightEnd%
+%%
+
+-module(beam_reorder).
+
+-export([module/2]).
+-import(lists, [member/2,reverse/1]).
+
+module({Mod,Exp,Attr,Fs0,Lc}, _Opt) ->
+ Fs = [function(F) || F <- Fs0],
+ {ok,{Mod,Exp,Attr,Fs,Lc}}.
+
+function({function,Name,Arity,CLabel,Is0}) ->
+ try
+ Is = reorder(Is0),
+ {function,Name,Arity,CLabel,Is}
+ catch
+ Class:Error ->
+ Stack = erlang:get_stacktrace(),
+ io:fwrite("Function: ~w/~w\n", [Name,Arity]),
+ erlang:raise(Class, Error, Stack)
+ end.
+
+%% reorder(Instructions0) -> Instructions
+%% Reorder instructions before the beam_block pass, because reordering
+%% will be more cumbersome when the blocks are in place.
+%%
+%% Execution of get_tuple_element instructions can be delayed until
+%% they are actually needed. Consider the sequence:
+%%
+%% get_tuple_element Tuple Pos Dst
+%% test Test Fail Operands
+%%
+%% If Dst is killed at label Fail (and not referenced in Operands),
+%% we can can swap the instructions:
+%%
+%% test Test Fail Operands
+%% get_tuple_element Tuple Pos Dst
+%%
+%% That can be beneficial in two ways: Firstly, if the branch is taken
+%% we have avoided execution of the get_tuple_element instruction.
+%% Secondly, even if the branch is not taken, subsequent optimization
+%% (opt_blocks/1) may be able to change Dst to the final destination
+%% register and eliminate a 'move' instruction.
+
+reorder(Is) ->
+ D = beam_utils:index_labels(Is),
+ reorder_1(Is, D, []).
+
+reorder_1([{Op,_,_}=TryCatch|[I|Is]=Is0], D, Acc)
+ when Op =:= 'catch'; Op =:= 'try' ->
+ %% Don't allow 'try' or 'catch' instructions to split blocks if
+ %% it can be avoided.
+ case is_safe(I) of
+ false ->
+ reorder_1(Is0, D, [TryCatch|Acc]);
+ true ->
+ reorder_1([TryCatch|Is], D, [I|Acc])
+ end;
+reorder_1([{label,L}=I|_], D, Acc) ->
+ Is = beam_utils:code_at(L, D),
+ reorder_1(Is, D, [I|Acc]);
+reorder_1([{test,is_nonempty_list,_,_}=I|Is], D, Acc) ->
+ %% The run-time system may combine the is_nonempty_list test with
+ %% the following get_list instruction.
+ reorder_1(Is, D, [I|Acc]);
+reorder_1([{test,_,_,_}=I,
+ {select,_,_,_,_}=S|Is], D, Acc) ->
+ %% There is nothing to gain by inserting a get_tuple_element
+ %% instruction between the test instruction and the select
+ %% instruction.
+ reorder_1(Is, D, [S,I|Acc]);
+reorder_1([{test,_,{f,L},Ss}=I|Is0], D0,
+ [{get_tuple_element,_,_,El}=G|Acc0]=Acc) ->
+ case member(El, Ss) of
+ true ->
+ reorder_1(Is0, D0, [I|Acc]);
+ false ->
+ case beam_utils:is_killed_at(El, L, D0) of
+ true ->
+ Is = [I,G|Is0],
+ reorder_1(Is, D0, Acc0);
+ false ->
+ case beam_utils:is_killed(El, Is0, D0) of
+ true ->
+ Code0 = beam_utils:code_at(L, D0),
+ Code = [G|Code0],
+ D = beam_utils:index_label(L, Code, D0),
+ Is = [I|Is0],
+ reorder_1(Is, D, Acc0);
+ false ->
+ reorder_1(Is0, D0, [I|Acc])
+ end
+ end
+ end;
+reorder_1([{allocate_zero,N,Live}=I0|Is], D,
+ [{get_tuple_element,{x,Tup},_,{x,Dst}}=G|Acc]=Acc0) ->
+ case Tup < Dst andalso Dst+1 =:= Live of
+ true ->
+ %% Move allocation instruction upwards past
+ %% get_tuple_element instructions to create more
+ %% opportunities for moving get_tuple_element
+ %% instructions.
+ I = {allocate_zero,N,Dst},
+ reorder_1([I,G|Is], D, Acc);
+ false ->
+ reorder_1(Is, D, [I0|Acc0])
+ end;
+reorder_1([I|Is], D, Acc) ->
+ reorder_1(Is, D, [I|Acc]);
+reorder_1([], _, Acc) -> reverse(Acc).
+
+%% is_safe(Instruction) -> true|false
+%% Test whether an instruction is safe (cannot cause an exception).
+
+is_safe({kill,_}) -> true;
+is_safe({move,_,_}) -> true;
+is_safe({put,_}) -> true;
+is_safe({put_list,_,_,_}) -> true;
+is_safe({put_tuple,_,_}) -> true;
+is_safe({test_heap,_,_}) -> true;
+is_safe(_) -> false.
diff --git a/lib/compiler/src/beam_split.erl b/lib/compiler/src/beam_split.erl
index 3be9311080..bb1c0e23a9 100644
--- a/lib/compiler/src/beam_split.erl
+++ b/lib/compiler/src/beam_split.erl
@@ -57,8 +57,8 @@ split_block([{set,[D],[S|Puts],{alloc,R,{put_map,Op,{f,Lbl}=Fail}}}|Is],
split_block([{set,Ds,[S|Ss],{get_map_elements,Fail}}|Is], Bl, Acc) ->
Gets = beam_utils:join_even(Ss,Ds),
split_block(Is, [], [{get_map_elements,Fail,S,{list,Gets}}|make_block(Bl, Acc)]);
-split_block([{set,[R],[],{'catch',L}}|Is], Bl, Acc) ->
- split_block(Is, [], [{'catch',R,L}|make_block(Bl, Acc)]);
+split_block([{set,[R],[],{try_catch,Op,L}}|Is], Bl, Acc) ->
+ split_block(Is, [], [{Op,R,L}|make_block(Bl, Acc)]);
split_block([{set,[],[],{line,_}=Line}|Is], Bl, Acc) ->
split_block(Is, [], [Line|make_block(Bl, Acc)]);
split_block([I|Is], Bl, Acc) ->
diff --git a/lib/compiler/src/beam_type.erl b/lib/compiler/src/beam_type.erl
index 5298589f83..4b45c28623 100644
--- a/lib/compiler/src/beam_type.erl
+++ b/lib/compiler/src/beam_type.erl
@@ -23,7 +23,8 @@
-export([module/2]).
--import(lists, [foldl/3,reverse/1,filter/2]).
+-import(lists, [filter/2,foldl/3,keyfind/3,member/2,
+ reverse/1,reverse/2,sort/1]).
module({Mod,Exp,Attr,Fs0,Lc}, _Opts) ->
Fs = [function(F) || F <- Fs0],
@@ -92,8 +93,19 @@ simplify_basic_1([{set,[D],[TupleReg],{get_tuple_element,0}}=I|Is0], Ts0, Acc) -
Ts = update(I, Ts0),
simplify_basic_1(Is0, Ts, [I|Acc])
end;
-simplify_basic_1([{set,_,_,{'catch',_}}=I|Is], _Ts, Acc) ->
+simplify_basic_1([{set,_,_,{try_catch,_,_}}=I|Is], _Ts, Acc) ->
simplify_basic_1(Is, tdb_new(), [I|Acc]);
+simplify_basic_1([{test,is_atom,_,[R]}=I|Is], Ts, Acc) ->
+ case tdb_find(R, Ts) of
+ boolean -> simplify_basic_1(Is, Ts, Acc);
+ _ -> simplify_basic_1(Is, Ts, [I|Acc])
+ end;
+simplify_basic_1([{test,is_integer,_,[R]}=I|Is], Ts, Acc) ->
+ case tdb_find(R, Ts) of
+ integer -> simplify_basic_1(Is, Ts, Acc);
+ {integer,_} -> simplify_basic_1(Is, Ts, Acc);
+ _ -> simplify_basic_1(Is, Ts, [I|Acc])
+ end;
simplify_basic_1([{test,is_tuple,_,[R]}=I|Is], Ts, Acc) ->
case tdb_find(R, Ts) of
{tuple,_,_} -> simplify_basic_1(Is, Ts, Acc);
@@ -137,6 +149,16 @@ simplify_basic_1([{test,is_record,_,[R,{atom,_}=Tag,{integer,Arity}]}=I|Is], Ts0
Ts = update(I, Ts0),
simplify_basic_1(Is, Ts, [I|Acc])
end;
+simplify_basic_1([{select,select_val,Reg,_,_}=I0|Is], Ts, Acc) ->
+ I = case tdb_find(Reg, Ts) of
+ {integer,Range} ->
+ simplify_select_val_int(I0, Range);
+ boolean ->
+ simplify_select_val_bool(I0);
+ _ ->
+ I0
+ end,
+ simplify_basic_1(Is, tdb_new(), [I|Acc]);
simplify_basic_1([I|Is], Ts0, Acc) ->
Ts = update(I, Ts0),
simplify_basic_1(Is, Ts, [I|Acc]);
@@ -144,6 +166,32 @@ simplify_basic_1([], Ts, Acc) ->
Is = reverse(Acc),
{Is,Ts}.
+simplify_select_val_int({select,select_val,R,_,L0}=I, {Min,Max}) ->
+ Vs = sort([V || {integer,V} <- L0]),
+ case eq_ranges(Vs, Min, Max) of
+ false -> I;
+ true -> simplify_select_val_1(L0, {integer,Max}, R, [])
+ end.
+
+simplify_select_val_bool({select,select_val,R,_,L}=I) ->
+ Vs = sort([V || {atom,V} <- L]),
+ case Vs of
+ [false,true] ->
+ simplify_select_val_1(L, {atom,false}, R, []);
+ _ ->
+ I
+ end.
+
+simplify_select_val_1([Val,F|T], Val, R, Acc) ->
+ L = reverse(Acc, T),
+ {select,select_val,R,F,L};
+simplify_select_val_1([V,F|T], Val, R, Acc) ->
+ simplify_select_val_1(T, Val, R, [F,V|Acc]).
+
+eq_ranges([H], H, H) -> true;
+eq_ranges([H|T], H, Max) -> eq_ranges(T, H+1, Max);
+eq_ranges(_, _, _) -> false.
+
%% simplify_float([Instruction], TypeDatabase) ->
%% {[Instruction],TypeDatabase'} | not_possible
%% Simplify floating point operations in blocks.
@@ -199,7 +247,7 @@ simplify_float_1([{set,[D0],[A0,B0],{alloc,_,{gc_bif,Op0,{f,0}}}}=I|Is]=Is0,
Ts = tdb_update([{D0,float}], Ts0),
simplify_float_1(Is, Ts, Rs, Acc)
end;
-simplify_float_1([{set,_,_,{'catch',_}}=I|Is]=Is0, _Ts, Rs0, Acc0) ->
+simplify_float_1([{set,_,_,{try_catch,_,_}}=I|Is]=Is0, _Ts, Rs0, Acc0) ->
Acc = flush_all(Rs0, Is0, Acc0),
simplify_float_1(Is, tdb_new(), Rs0, [I|Acc]);
simplify_float_1([{set,_,_,{line,_}}=I|Is], Ts, Rs, Acc) ->
@@ -311,7 +359,7 @@ flt_need_heap_2({set,_,_,{get_tuple_element,_}}, H, Fl) ->
{[],H,Fl};
flt_need_heap_2({set,_,_,get_list}, H, Fl) ->
{[],H,Fl};
-flt_need_heap_2({set,_,_,{'catch',_}}, H, Fl) ->
+flt_need_heap_2({set,_,_,{try_catch,_,_}}, H, Fl) ->
{[],H,Fl};
%% All other instructions should cause the insertion of an allocation
%% instruction if needed.
@@ -382,6 +430,17 @@ update({set,[D],[{integer,I},Reg],{bif,element,_}}, Ts0) ->
tdb_update([{Reg,{tuple,I,[]}},{D,kill}], Ts0);
update({set,[D],[_Index,Reg],{bif,element,_}}, Ts0) ->
tdb_update([{Reg,{tuple,0,[]}},{D,kill}], Ts0);
+update({set,[D],Args,{bif,N,_}}, Ts0) ->
+ Ar = length(Args),
+ BoolOp = erl_internal:new_type_test(N, Ar) orelse
+ erl_internal:comp_op(N, Ar) orelse
+ erl_internal:bool_op(N, Ar),
+ case BoolOp of
+ true ->
+ tdb_update([{D,boolean}], Ts0);
+ false ->
+ tdb_update([{D,kill}], Ts0)
+ end;
update({set,[D],[S],{get_tuple_element,0}}, Ts) ->
tdb_update([{D,{tuple_element,S,0}}], Ts);
update({set,[D],[S],{alloc,_,{gc_bif,float,{f,0}}}}, Ts0) ->
@@ -390,6 +449,13 @@ update({set,[D],[S],{alloc,_,{gc_bif,float,{f,0}}}}, Ts0) ->
true -> tdb_update([{D,float}], Ts0);
false -> Ts0
end;
+update({set,[D],[S1,S2],{alloc,_,{gc_bif,'band',{f,0}}}}, Ts) ->
+ case keyfind(integer, 1, [S1,S2]) of
+ {integer,N} ->
+ update_band(N, D, Ts);
+ false ->
+ tdb_update([{D,integer}], Ts)
+ end;
update({set,[D],[S1,S2],{alloc,_,{gc_bif,'/',{f,0}}}}, Ts0) ->
%% Make sure we reject non-numeric literals.
case possibly_numeric(S1) andalso possibly_numeric(S2) of
@@ -397,15 +463,17 @@ update({set,[D],[S1,S2],{alloc,_,{gc_bif,'/',{f,0}}}}, Ts0) ->
false -> Ts0
end;
update({set,[D],[S1,S2],{alloc,_,{gc_bif,Op,{f,0}}}}, Ts0) ->
- case arith_op(Op) of
- no ->
- tdb_update([{D,kill}], Ts0);
- {yes,_} ->
+ case op_type(Op) of
+ integer ->
+ tdb_update([{D,integer}], Ts0);
+ {float,_} ->
case {tdb_find(S1, Ts0),tdb_find(S2, Ts0)} of
{float,_} -> tdb_update([{D,float}], Ts0);
{_,float} -> tdb_update([{D,float}], Ts0);
{_,_} -> tdb_update([{D,kill}], Ts0)
- end
+ end;
+ unknown ->
+ tdb_update([{D,kill}], Ts0)
end;
update({set,[],_Src,_Op}, Ts0) -> Ts0;
update({set,[D],_Src,_Op}, Ts0) ->
@@ -437,6 +505,8 @@ update({test,is_record,_Fail,[Src,Tag,{integer,Arity}]}, Ts) ->
tdb_update([{Src,{tuple,Arity,[Tag]}}], Ts);
update({test,_Test,_Fail,_Other}, Ts) ->
Ts;
+update({test,bs_get_integer2,_,_,Args,Dst}, Ts) ->
+ tdb_update([{Dst,get_bs_integer_type(Args)}], Ts);
update({call_ext,Ar,{extfunc,math,Math,Ar}}, Ts) ->
case is_math_bif(Math, Ar) of
true -> tdb_update([{{x,0},float}], Ts);
@@ -453,10 +523,43 @@ update({call,_Arity,_Func}, Ts) -> tdb_kill_xregs(Ts);
update({call_ext,_Arity,_Func}, Ts) -> tdb_kill_xregs(Ts);
update({make_fun2,_,_,_,_}, Ts) -> tdb_kill_xregs(Ts);
update({line,_}, Ts) -> Ts;
+update({bs_save2,_,_}, Ts) -> Ts;
+update({bs_restore2,_,_}, Ts) -> Ts;
%% The instruction is unknown. Kill all information.
update(_I, _Ts) -> tdb_new().
+update_band(N, Reg, Ts) ->
+ Type = update_band_1(N, 0),
+ tdb_update([{Reg,Type}], Ts).
+
+update_band_1(N, Bits) when Bits < 64 ->
+ case 1 bsl Bits of
+ P when P =:= N + 1 ->
+ {integer,{0,N}};
+ P when P > N + 1 ->
+ integer;
+ _ ->
+ update_band_1(N, Bits+1)
+ end;
+update_band_1(_, _) ->
+ %% Negative or large positive number. Give up.
+ integer.
+
+get_bs_integer_type([_,{integer,N},U,{field_flags,Fl}])
+ when N*U < 64 ->
+ NumBits = N*U,
+ case member(unsigned, Fl) of
+ true ->
+ {integer,{0,(1 bsl NumBits)-1}};
+ false ->
+ %% Signed integer. Don't bother.
+ integer
+ end;
+get_bs_integer_type(_) ->
+ %% Avoid creating ranges with a huge upper limit.
+ integer.
+
is_math_bif(cos, 1) -> true;
is_math_bif(cosh, 1) -> true;
is_math_bif(sin, 1) -> true;
@@ -545,11 +648,22 @@ load_reg(V, Ts, Rs0, Is0) ->
{Rs,Is}
end.
-arith_op('+') -> {yes,fadd};
-arith_op('-') -> {yes,fsub};
-arith_op('*') -> {yes,fmul};
-arith_op('/') -> {yes,fdiv};
-arith_op(_) -> no.
+arith_op(Op) ->
+ case op_type(Op) of
+ {float,Instr} -> {yes,Instr};
+ _ -> no
+ end.
+
+op_type('+') -> {float,fadd};
+op_type('-') -> {float,fsub};
+op_type('*') -> {float,fmul};
+%% '/' and 'band' are specially handled.
+op_type('bor') -> integer;
+op_type('bxor') -> integer;
+op_type('bsl') -> integer;
+op_type('bsr') -> integer;
+op_type('div') -> integer;
+op_type(_) -> unknown.
flush(Rs, [{set,[_],[],{put_tuple,_}}|_]=Is0, Acc0) ->
Acc = flush_all(Rs, Is0, Acc0),
@@ -618,7 +732,6 @@ checkerror(Is) ->
checkerror_1(Is, Is).
checkerror_1([{set,[],[],fcheckerror}|_], OrigIs) -> OrigIs;
-checkerror_1([{set,[],[],fclearerror}|_], OrigIs) -> OrigIs;
checkerror_1([{set,_,_,{bif,fadd,_}}|_], OrigIs) -> checkerror_2(OrigIs);
checkerror_1([{set,_,_,{bif,fsub,_}}|_], OrigIs) -> checkerror_2(OrigIs);
checkerror_1([{set,_,_,{bif,fmul,_}}|_], OrigIs) -> checkerror_2(OrigIs);
@@ -640,6 +753,9 @@ checkerror_2(OrigIs) -> [{set,[],[],fcheckerror}|OrigIs].
%%% of the first element).
%%%
%%% 'float' means that the register contains a float.
+%%%
+%%% 'integer' or {integer,{Min,Max}} that the register contains an
+%%% integer.
%% tdb_new() -> EmptyDataBase
%% Creates a new, empty type database.
@@ -729,10 +845,20 @@ merge_type_info({tuple,Sz1,[]}, {tuple,_Sz2,First}=Tuple2) ->
merge_type_info({tuple,Sz1,First}, Tuple2);
merge_type_info({tuple,_Sz1,First}=Tuple1, {tuple,Sz2,_}) ->
merge_type_info(Tuple1, {tuple,Sz2,First});
+merge_type_info(integer, {integer,_}=Int) ->
+ Int;
+merge_type_info({integer,_}=Int, integer) ->
+ Int;
+merge_type_info({integer,{Min1,Max1}}, {integer,{Min2,Max2}}) ->
+ {integer,{max(Min1, Min2),min(Max1, Max2)}};
merge_type_info(NewType, _) ->
verify_type(NewType),
NewType.
+verify_type(boolean) -> ok;
+verify_type(integer) -> ok;
+verify_type({integer,{Min,Max}})
+ when is_integer(Min), is_integer(Max) -> ok;
verify_type(map) -> ok;
verify_type(nonempty_list) -> ok;
verify_type({tuple,Sz,[]}) when is_integer(Sz) -> ok;
diff --git a/lib/compiler/src/beam_utils.erl b/lib/compiler/src/beam_utils.erl
index fbcd5de1bb..68d6105cfa 100644
--- a/lib/compiler/src/beam_utils.erl
+++ b/lib/compiler/src/beam_utils.erl
@@ -484,6 +484,15 @@ check_liveness(R, [{get_map_elements,{f,Fail},S,{list,L}}|Is], St0) ->
Other
end
end;
+check_liveness(R, [{test_heap,N,Live}|Is], St) ->
+ I = {block,[{set,[],[],{alloc,Live,{nozero,nostack,N,[]}}}]},
+ check_liveness(R, [I|Is], St);
+check_liveness(R, [{allocate_zero,N,Live}|Is], St) ->
+ I = {block,[{set,[],[],{alloc,Live,{zero,N,0,[]}}}]},
+ check_liveness(R, [I|Is], St);
+check_liveness(R, [{get_list,S,D1,D2}|Is], St) ->
+ I = {block,[{set,[D1,D2],[S],get_list}]},
+ check_liveness(R, [I|Is], St);
check_liveness(_R, Is, St) when is_list(Is) ->
%% case Is of
%% [I|_] ->
diff --git a/lib/compiler/src/beam_validator.erl b/lib/compiler/src/beam_validator.erl
index 6004f1974e..cdace42a68 100644
--- a/lib/compiler/src/beam_validator.erl
+++ b/lib/compiler/src/beam_validator.erl
@@ -31,8 +31,6 @@
-import(lists, [reverse/1,foldl/3,foreach/2,dropwhile/2]).
--define(MAXREG, 1024).
-
%%-define(DEBUG, 1).
-ifdef(DEBUG).
-define(DBG_FORMAT(F, D), (io:format((F), (D)))).
@@ -980,9 +978,9 @@ get_fls(#vst{current=#st{fls=Fls}}) when is_atom(Fls) -> Fls.
init_fregs() -> 0.
-set_freg({fr,Fr}, #vst{current=#st{f=Fregs0}=St}=Vst)
+set_freg({fr,Fr}=Freg, #vst{current=#st{f=Fregs0}=St}=Vst)
when is_integer(Fr), 0 =< Fr ->
- limit_check(Fr),
+ check_limit(Freg),
Bit = 1 bsl Fr,
if
Fregs0 band Bit =:= 0 ->
@@ -995,9 +993,10 @@ set_freg(Fr, _) -> error({bad_target,Fr}).
assert_freg_set({fr,Fr}=Freg, #vst{current=#st{f=Fregs}})
when is_integer(Fr), 0 =< Fr ->
if
- Fregs band (1 bsl Fr) =/= 0 ->
- limit_check(Fr);
- true -> error({uninitialized_reg,Freg})
+ (Fregs bsr Fr) band 1 =:= 0 ->
+ error({uninitialized_reg,Freg});
+ true ->
+ ok
end;
assert_freg_set(Fr, _) -> error({bad_source,Fr}).
@@ -1076,16 +1075,16 @@ set_type(Type, {x,_}=Reg, Vst) -> set_type_reg(Type, Reg, Vst);
set_type(Type, {y,_}=Reg, Vst) -> set_type_y(Type, Reg, Vst);
set_type(_, _, #vst{}=Vst) -> Vst.
-set_type_reg(Type, {x,X}, #vst{current=#st{x=Xs}=St}=Vst)
+set_type_reg(Type, {x,X}=Reg, #vst{current=#st{x=Xs}=St}=Vst)
when is_integer(X), 0 =< X ->
- limit_check(X),
+ check_limit(Reg),
Vst#vst{current=St#st{x=gb_trees:enter(X, Type, Xs)}};
set_type_reg(Type, Reg, Vst) ->
set_type_y(Type, Reg, Vst).
set_type_y(Type, {y,Y}=Reg, #vst{current=#st{y=Ys0}=St}=Vst)
when is_integer(Y), 0 =< Y ->
- limit_check(Y),
+ check_limit(Reg),
Ys = case gb_trees:lookup(Y, Ys0) of
none ->
error({invalid_store,Reg,Type});
@@ -1612,9 +1611,15 @@ return_type_math(pow, 2) -> {float,[]};
return_type_math(pi, 0) -> {float,[]};
return_type_math(F, A) when is_atom(F), is_integer(A), A >= 0 -> term.
-limit_check(Num) when is_integer(Num), Num >= ?MAXREG ->
- error(limit);
-limit_check(_) -> ok.
+check_limit({x,X}) when is_integer(X), X < 1023 ->
+ %% Note: x(1023) is reserved for use by the BEAM loader.
+ ok;
+check_limit({y,Y}) when is_integer(Y), Y < 1024 ->
+ ok;
+check_limit({fr,Fr}) when is_integer(Fr), Fr < 1024 ->
+ ok;
+check_limit(_) ->
+ error(limit).
min(A, B) when is_integer(A), is_integer(B), A < B -> A;
min(A, B) when is_integer(A), is_integer(B) -> B.
diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl
index e0a29fe9b1..a2a23a2b90 100644
--- a/lib/compiler/src/compile.erl
+++ b/lib/compiler/src/compile.erl
@@ -671,11 +671,16 @@ asm_passes() ->
%% Assembly level optimisations.
[{delay,
[{pass,beam_a},
+ {iff,da,{listing,"a"}},
{unless,no_postopt,
- [{pass,beam_block},
+ [{unless,no_reorder,{pass,beam_reorder}},
+ {iff,dre,{listing,"reorder"}},
+ {pass,beam_block},
{iff,dblk,{listing,"block"}},
{unless,no_except,{pass,beam_except}},
{iff,dexcept,{listing,"except"}},
+ {unless,no_bs_opt,{pass,beam_bs}},
+ {iff,dbs,{listing,"bs"}},
{unless,no_bopt,{pass,beam_bool}},
{iff,dbool,{listing,"bool"}},
{unless,no_topt,{pass,beam_type}},
@@ -703,6 +708,7 @@ asm_passes() ->
{iff,no_postopt,[{pass,beam_clean}]},
{pass,beam_z},
+ {iff,dz,{listing,"z"}},
{iff,dopt,{listing,"optimize"}},
{iff,'S',{listing,"S"}},
{iff,'to_asm',{done,"S"}}]},
diff --git a/lib/compiler/src/compiler.app.src b/lib/compiler/src/compiler.app.src
index afb85f4710..a2b2a1d277 100644
--- a/lib/compiler/src/compiler.app.src
+++ b/lib/compiler/src/compiler.app.src
@@ -25,6 +25,7 @@
beam_asm,
beam_block,
beam_bool,
+ beam_bs,
beam_bsm,
beam_clean,
beam_dead,
@@ -37,6 +38,7 @@
beam_opcodes,
beam_peep,
beam_receive,
+ beam_reorder,
beam_split,
beam_trim,
beam_type,
diff --git a/lib/compiler/src/core_lib.erl b/lib/compiler/src/core_lib.erl
index 3abb520485..839c736ff2 100644
--- a/lib/compiler/src/core_lib.erl
+++ b/lib/compiler/src/core_lib.erl
@@ -21,52 +21,16 @@
-module(core_lib).
--deprecated({get_anno,1,next_major_release}).
--deprecated({set_anno,2,next_major_release}).
--deprecated({is_literal,1,next_major_release}).
--deprecated({is_literal_list,1,next_major_release}).
--deprecated({literal_value,1,next_major_release}).
-
--export([get_anno/1,set_anno/2]).
--export([is_literal/1,is_literal_list/1]).
--export([literal_value/1]).
-export([make_values/1]).
-export([is_var_used/2]).
-include("core_parse.hrl").
-%%
-%% Generic get/set annotation that should be used only with cerl() structures.
-%%
--spec get_anno(cerl:cerl()) -> term().
-
-get_anno(C) -> cerl:get_ann(C).
-
--spec set_anno(cerl:cerl(), term()) -> cerl:cerl().
-
-set_anno(C, A) -> cerl:set_ann(C, A).
-
--spec is_literal(cerl:cerl()) -> boolean().
-
-is_literal(Cerl) ->
- cerl:is_literal(cerl:fold_literal(Cerl)).
-
--spec is_literal_list([cerl:cerl()]) -> boolean().
-
-is_literal_list(Es) -> lists:all(fun is_literal/1, Es).
-
-%% Return the value of LitExpr.
--spec literal_value(cerl:c_literal() | cerl:c_binary() |
- cerl:c_map() | cerl:c_cons() | cerl:c_tuple()) -> term().
-
-literal_value(Cerl) ->
- cerl:concrete(cerl:fold_literal(Cerl)).
-
%% Make a suitable values structure, expr or values, depending on Expr.
-spec make_values([cerl:cerl()] | cerl:cerl()) -> cerl:cerl().
make_values([E]) -> E;
-make_values([H|_]=Es) -> #c_values{anno=get_anno(H),es=Es};
+make_values([H|_]=Es) -> #c_values{anno=cerl:get_ann(H),es=Es};
make_values([]) -> #c_values{es=[]};
make_values(E) -> E.
diff --git a/lib/compiler/src/core_lint.erl b/lib/compiler/src/core_lint.erl
index cc54f6e411..7d3513c0ba 100644
--- a/lib/compiler/src/core_lint.erl
+++ b/lib/compiler/src/core_lint.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1999-2013. All Rights Reserved.
+%% Copyright Ericsson AB 1999-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -73,7 +73,7 @@
%% Define the lint state record.
-record(lint, {module :: module(), % Current module
- func :: fa(), % Current function
+ func :: fa() | 'undefined', % Current function
errors = [] :: [error()], % Errors
warnings= [] :: [warning()]}). % Warnings
diff --git a/lib/compiler/src/genop.tab b/lib/compiler/src/genop.tab
index 8124729b35..3a877f2403 100755
--- a/lib/compiler/src/genop.tab
+++ b/lib/compiler/src/genop.tab
@@ -45,7 +45,7 @@ BEAM_FORMAT_NUMBER=0
## Save the next instruction as the return address in the CP register.
4: call/2
-## @spec call_last Arity Label Dellocate
+## @spec call_last Arity Label Deallocate
## @doc Deallocate and do a tail recursive call to the function at Label.
## Do not update the CP register.
## Before the call deallocate Deallocate words of stack.
@@ -137,7 +137,7 @@ BEAM_FORMAT_NUMBER=0
# Sending & receiving.
#
## @spec send
-## @doc Send argument in x(0) as a message to the destination process in x(0).
+## @doc Send argument in x(1) as a message to the destination process in x(0).
## The message in x(1) ends up as the result of the send in x(0).
20: send/0
@@ -164,12 +164,12 @@ BEAM_FORMAT_NUMBER=0
25: wait/1
## @spec wait_timeout Lable Time
-## @doc Sets up a timeout of Time milllisecons and saves the address of the
+## @doc Sets up a timeout of Time milliseconds and saves the address of the
## following instruction as the entry point if the timeout triggers.
26: wait_timeout/2
#
-# Arithmethic opcodes.
+# Arithmetic opcodes.
#
27: -m_plus/4
28: -m_minus/4
@@ -316,7 +316,7 @@ BEAM_FORMAT_NUMBER=0
66: get_tuple_element/3
## @spec set_tuple_element NewElement Tuple Position
-## @doc Update the element at postition Position of the tuple Tuple
+## @doc Update the element at position Position of the tuple Tuple
## with the new element NewElement.
67: set_tuple_element/3
diff --git a/lib/compiler/src/sys_core_fold.erl b/lib/compiler/src/sys_core_fold.erl
index 27d023d067..0a16776bd4 100644
--- a/lib/compiler/src/sys_core_fold.erl
+++ b/lib/compiler/src/sys_core_fold.erl
@@ -2793,12 +2793,18 @@ extract_type_1(Expr, Sub) ->
true -> bool
end.
+returns_integer('band', [_,_]) -> true;
+returns_integer('bnot', [_]) -> true;
+returns_integer('bor', [_,_]) -> true;
+returns_integer('bxor', [_,_]) -> true;
returns_integer(bit_size, [_]) -> true;
returns_integer('bsl', [_,_]) -> true;
returns_integer('bsr', [_,_]) -> true;
returns_integer(byte_size, [_]) -> true;
+returns_integer('div', [_,_]) -> true;
returns_integer(length, [_]) -> true;
returns_integer('rem', [_,_]) -> true;
+returns_integer('round', [_]) -> true;
returns_integer(size, [_]) -> true;
returns_integer(tuple_size, [_]) -> true;
returns_integer(trunc, [_]) -> true;
diff --git a/lib/compiler/src/v3_codegen.erl b/lib/compiler/src/v3_codegen.erl
index 34c67b16ca..5083995f30 100644
--- a/lib/compiler/src/v3_codegen.erl
+++ b/lib/compiler/src/v3_codegen.erl
@@ -827,21 +827,24 @@ select_extract_bin([{var,Hd},{var,Tl}], Size0, Unit, Type, Flags, Vf,
{bs_save2,CtxReg,{Ctx,Tl}}],Int1}
end,
{Es,clear_dead(Aft, I, Vdb),St};
-select_extract_bin([{var,Hd}], Size0, Unit, binary, Flags, Vf,
+select_extract_bin([{var,Hd}], Size, Unit, binary, Flags, Vf,
I, Vdb, Bef, Ctx, Body, St) ->
- SizeReg = get_bin_size_reg(Size0, Bef),
+ %% Match the last segment of a binary. We KNOW that the size
+ %% must be 'all'.
+ Size = {atom,all}, %Assertion.
{Es,Aft} =
case vdb_find(Hd, Vdb) of
{_,_,Lhd} when Lhd =< I ->
+ %% The result will not be used. Furthermore, since we
+ %% we are at the end of the binary, the position will
+ %% not be used again; thus, it is safe to do a cheaper
+ %% test of the unit.
CtxReg = fetch_var(Ctx, Bef),
- {case SizeReg =:= {atom,all} andalso is_context_unused(Body) of
- true when Unit =:= 1 ->
+ {case Unit of
+ 1 ->
[];
- true ->
- [{test,bs_test_unit,{f,Vf},[CtxReg,Unit]}];
- false ->
- [{test,bs_skip_bits2,{f,Vf},
- [CtxReg,SizeReg,Unit,{field_flags,Flags}]}]
+ _ ->
+ [{test,bs_test_unit,{f,Vf},[CtxReg,Unit]}]
end,Bef};
{_,_,_} ->
case is_context_unused(Body) of
@@ -853,7 +856,7 @@ select_extract_bin([{var,Hd}], Size0, Unit, binary, Flags, Vf,
Name = bs_get_binary2,
Live = max_reg(Bef#sr.reg),
{[{test,Name,{f,Vf},Live,
- [CtxReg,SizeReg,Unit,{field_flags,Flags}],Rhd}],
+ [CtxReg,Size,Unit,{field_flags,Flags}],Rhd}],
Int1};
true ->
%% Since the matching context will not be used again,
@@ -868,7 +871,7 @@ select_extract_bin([{var,Hd}], Size0, Unit, binary, Flags, Vf,
Name = bs_get_binary2,
Live = max_reg(Int1#sr.reg),
{[{test,Name,{f,Vf},Live,
- [CtxReg,SizeReg,Unit,{field_flags,Flags}],CtxReg}],
+ [CtxReg,Size,Unit,{field_flags,Flags}],CtxReg}],
Int1}
end
end,
diff --git a/lib/compiler/src/v3_core.erl b/lib/compiler/src/v3_core.erl
index 0941ad5dd5..7c229210a0 100644
--- a/lib/compiler/src/v3_core.erl
+++ b/lib/compiler/src/v3_core.erl
@@ -469,7 +469,8 @@ unforce_tree([#iset{var=#c_var{name=V},arg=Arg0}|Es], D0) ->
unforce_tree(Es, D);
unforce_tree([#icall{}=Call], D) ->
unforce_tree_subst(Call, D);
-unforce_tree([Top], _) -> Top.
+unforce_tree([#c_var{name=V}], D) ->
+ gb_trees:get(V, D).
unforce_tree_subst(#icall{module=#c_literal{val=erlang},
name=#c_literal{val='=:='},
diff --git a/lib/compiler/test/Makefile b/lib/compiler/test/Makefile
index 6553d10077..400565100f 100644
--- a/lib/compiler/test/Makefile
+++ b/lib/compiler/test/Makefile
@@ -11,6 +11,8 @@ MODULES= \
beam_validator_SUITE \
beam_disasm_SUITE \
beam_except_SUITE \
+ beam_reorder_SUITE \
+ beam_type_SUITE \
beam_utils_SUITE \
bs_bincomp_SUITE \
bs_bit_binaries_SUITE \
@@ -43,6 +45,8 @@ NO_OPT= \
andor \
apply \
beam_except \
+ beam_reorder \
+ beam_type \
beam_utils \
bs_construct \
bs_match \
diff --git a/lib/compiler/test/beam_reorder_SUITE.erl b/lib/compiler/test/beam_reorder_SUITE.erl
new file mode 100644
index 0000000000..4b2262f65b
--- /dev/null
+++ b/lib/compiler/test/beam_reorder_SUITE.erl
@@ -0,0 +1,69 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2015. All Rights Reserved.
+%%
+%% Licensed under the Apache License, Version 2.0 (the "License");
+%% you may not use this file except in compliance with the License.
+%% You may obtain a copy of the License at
+%%
+%% http://www.apache.org/licenses/LICENSE-2.0
+%%
+%% Unless required by applicable law or agreed to in writing, software
+%% distributed under the License is distributed on an "AS IS" BASIS,
+%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+%% See the License for the specific language governing permissions and
+%% limitations under the License.
+%%
+%% %CopyrightEnd%
+%%
+-module(beam_reorder_SUITE).
+
+-export([all/0,suite/0,groups/0,init_per_suite/1,end_per_suite/1,
+ init_per_group/2,end_per_group/2,
+ alloc/1]).
+
+suite() -> [{ct_hooks,[ts_install_cth]}].
+
+all() ->
+ test_lib:recompile(?MODULE),
+ [{group,p}].
+
+groups() ->
+ [{p,[parallel],
+ [alloc
+ ]}].
+
+init_per_suite(Config) ->
+ Config.
+
+end_per_suite(_Config) ->
+ ok.
+
+init_per_group(_GroupName, Config) ->
+ Config.
+
+end_per_group(_GroupName, Config) ->
+ Config.
+
+-record(alloc, {version}).
+
+alloc(_Config) ->
+ {ok,42} = alloc_a(1, 2, #alloc{version=42}),
+ {a,b,c} = alloc_b(1, 2, #alloc{version={a,b,c}}),
+ ok.
+
+alloc_a(_U1, _U2, R) ->
+ V = R#alloc.version,
+ Res = id({ok,V}),
+ _ = id(0),
+ Res.
+
+alloc_b(_U1, _U2, R) ->
+ V = R#alloc.version,
+ Res = id(V),
+ _ = id(0),
+ Res.
+
+id(I) ->
+ I.
diff --git a/lib/compiler/test/beam_type_SUITE.erl b/lib/compiler/test/beam_type_SUITE.erl
new file mode 100644
index 0000000000..8d5c0190ed
--- /dev/null
+++ b/lib/compiler/test/beam_type_SUITE.erl
@@ -0,0 +1,98 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2015. All Rights Reserved.
+%%
+%% Licensed under the Apache License, Version 2.0 (the "License");
+%% you may not use this file except in compliance with the License.
+%% You may obtain a copy of the License at
+%%
+%% http://www.apache.org/licenses/LICENSE-2.0
+%%
+%% Unless required by applicable law or agreed to in writing, software
+%% distributed under the License is distributed on an "AS IS" BASIS,
+%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+%% See the License for the specific language governing permissions and
+%% limitations under the License.
+%%
+%% %CopyrightEnd%
+%%
+-module(beam_type_SUITE).
+
+-export([all/0,suite/0,groups/0,init_per_suite/1,end_per_suite/1,
+ init_per_group/2,end_per_group/2,
+ integers/1,coverage/1,booleans/1]).
+
+suite() -> [{ct_hooks,[ts_install_cth]}].
+
+all() ->
+ test_lib:recompile(?MODULE),
+ [{group,p}].
+
+groups() ->
+ [{p,[parallel],
+ [integers,
+ coverage,
+ booleans
+ ]}].
+
+init_per_suite(Config) ->
+ Config.
+
+end_per_suite(_Config) ->
+ ok.
+
+init_per_group(_GroupName, Config) ->
+ Config.
+
+end_per_group(_GroupName, Config) ->
+ Config.
+
+integers(_Config) ->
+ a = do_integers_1(2#11000),
+ b = do_integers_1(2#11001),
+
+ a = do_integers_2(<<0:1>>),
+ {'EXIT',{{case_clause,-1},_}} = (catch do_integers_2(<<1:1>>)),
+
+ ok.
+
+do_integers_1(B0) ->
+ B = B0 band 1,
+ case B band 15 of
+ 0 -> a;
+ 1 -> b
+ end.
+
+do_integers_2(Bin) ->
+ <<B:1/signed>> = Bin,
+ case B of
+ 0 -> a;
+ 1 -> b
+ end.
+
+coverage(_Config) ->
+ {'EXIT',{badarith,_}} = (catch id(1) bsl 0.5),
+ {'EXIT',{badarith,_}} = (catch id(2.0) bsl 2),
+ {'EXIT',{badarith,_}} = (catch a + 0.5),
+ {'EXIT',{badarith,_}} = (catch 2.0 * b),
+
+ {'EXIT',{badarith,_}} = (catch id(42.0) / (1 bsl 2000)),
+
+ id(id(42) band 387439739874298734983787934283479243879),
+ id(-1 band id(13)),
+
+ ok.
+
+booleans(_Config) ->
+ {'EXIT',{{case_clause,_},_}} = (catch do_booleans(42)),
+ ok.
+
+do_booleans(B) ->
+ case is_integer(B) of
+ yes -> yes;
+ no -> no
+ end.
+
+id(I) ->
+ I.
diff --git a/lib/compiler/test/beam_validator_SUITE.erl b/lib/compiler/test/beam_validator_SUITE.erl
index 69391b15eb..d6deb4a730 100644
--- a/lib/compiler/test/beam_validator_SUITE.erl
+++ b/lib/compiler/test/beam_validator_SUITE.erl
@@ -107,13 +107,13 @@ xrange(Config) when is_list(Config) ->
{{bif,'+',{f,0},[{x,-1},{x,1}],{x,0}},4,
{uninitialized_reg,{x,-1}}}},
{{t,sum_2,2},
- {{bif,'+',{f,0},[{x,0},{x,1024}],{x,0}},4,
- {uninitialized_reg,{x,1024}}}},
+ {{bif,'+',{f,0},[{x,0},{x,1023}],{x,0}},4,
+ {uninitialized_reg,{x,1023}}}},
{{t,sum_3,2},
{{bif,'+',{f,0},[{x,0},{x,1}],{x,-1}},4,
{invalid_store,{x,-1},number}}},
{{t,sum_4,2},
- {{bif,'+',{f,0},[{x,0},{x,1}],{x,1024}},4,limit}}] = Errors,
+ {{bif,'+',{f,0},[{x,0},{x,1}],{x,1023}},4,limit}}] = Errors,
ok.
yrange(Config) when is_list(Config) ->
diff --git a/lib/compiler/test/beam_validator_SUITE_data/xrange.S b/lib/compiler/test/beam_validator_SUITE_data/xrange.S
index c6f20288f7..a76408dde3 100644
--- a/lib/compiler/test/beam_validator_SUITE_data/xrange.S
+++ b/lib/compiler/test/beam_validator_SUITE_data/xrange.S
@@ -20,7 +20,7 @@
{label,3}.
{func_info,{atom,t},{atom,sum_2},2}.
{label,4}.
- {bif,'+',{f,0},[{x,0},{x,1024}],{x,0}}.
+ {bif,'+',{f,0},[{x,0},{x,1023}],{x,0}}.
{'%live',1}.
return.
@@ -38,7 +38,7 @@
{label,7}.
{func_info,{atom,t},{atom,sum_4},2}.
{label,8}.
- {bif,'+',{f,0},[{x,0},{x,1}],{x,1024}}.
+ {bif,'+',{f,0},[{x,0},{x,1}],{x,1023}}.
{'%live',1}.
return.
diff --git a/lib/compiler/test/bs_match_SUITE.erl b/lib/compiler/test/bs_match_SUITE.erl
index 6e138b0a43..a19b152bc5 100644
--- a/lib/compiler/test/bs_match_SUITE.erl
+++ b/lib/compiler/test/bs_match_SUITE.erl
@@ -36,7 +36,7 @@
match_string/1,zero_width/1,bad_size/1,haystack/1,
cover_beam_bool/1,matched_out_size/1,follow_fail_branch/1,
no_partition/1,calling_a_binary/1,binary_in_map/1,
- match_string_opt/1]).
+ match_string_opt/1,select_on_integer/1]).
-export([coverage_id/1,coverage_external_ignore/2]).
@@ -62,7 +62,7 @@ groups() ->
otp_7498,match_string,zero_width,bad_size,haystack,
cover_beam_bool,matched_out_size,follow_fail_branch,
no_partition,calling_a_binary,binary_in_map,
- match_string_opt]}].
+ match_string_opt,select_on_integer]}].
init_per_suite(Config) ->
@@ -1225,6 +1225,20 @@ match_string_opt(Config) when is_list(Config) ->
do_match_string_opt({<<1>>,{v,V}}=T) ->
{x,V,T}.
+select_on_integer(Config) when is_list(Config) ->
+ 42 = do_select_on_integer(<<42>>),
+ <<"abc">> = do_select_on_integer(<<128,"abc">>),
+
+ {'EXIT',_} = (catch do_select_on_integer(<<0:1>>)),
+ {'EXIT',_} = (catch do_select_on_integer(<<1:1>>)),
+ {'EXIT',_} = (catch do_select_on_integer(<<0:1,0:15>>)),
+ ok.
+
+%% The ASN.1 compiler frequently generates code like this.
+do_select_on_integer(<<0:1,I:7>>) ->
+ I;
+do_select_on_integer(<<1:1,_:7,Bin/binary>>) ->
+ Bin.
check(F, R) ->
R = F().
diff --git a/lib/compiler/test/compile_SUITE.erl b/lib/compiler/test/compile_SUITE.erl
index df401ccc2b..806cb58bab 100644
--- a/lib/compiler/test/compile_SUITE.erl
+++ b/lib/compiler/test/compile_SUITE.erl
@@ -31,7 +31,9 @@
other_output/1, encrypted_abstr/1,
bad_record_use1/1, bad_record_use2/1, strict_record/1,
missing_testheap/1, cover/1, env/1, core/1, asm/1,
- sys_pre_attributes/1, dialyzer/1]).
+ sys_pre_attributes/1, dialyzer/1,
+ warnings/1
+ ]).
-export([init/3]).
@@ -48,7 +50,7 @@ all() ->
other_output, encrypted_abstr,
{group, bad_record_use}, strict_record,
missing_testheap, cover, env, core, asm,
- sys_pre_attributes, dialyzer].
+ sys_pre_attributes, dialyzer, warnings].
groups() ->
[{bad_record_use, [],
@@ -328,6 +330,8 @@ do_file_listings(DataDir, PrivDir, [File|Files]) ->
do_listing(Simple, TargetDir, dlife, ".life"),
do_listing(Simple, TargetDir, dcg, ".codegen"),
do_listing(Simple, TargetDir, dblk, ".block"),
+ do_listing(Simple, TargetDir, dexcept, ".except"),
+ do_listing(Simple, TargetDir, dbs, ".bs"),
do_listing(Simple, TargetDir, dbool, ".bool"),
do_listing(Simple, TargetDir, dtype, ".type"),
do_listing(Simple, TargetDir, ddead, ".dead"),
@@ -895,6 +899,44 @@ dialyzer(Config) ->
[{a,b,c}] = M:M(),
ok.
+
+%% Test that warnings contain filenames and line numbers.
+warnings(_Config) ->
+ TestDir = filename:dirname(code:which(?MODULE)),
+ Files = filelib:wildcard(filename:join(TestDir, "*.erl")),
+ test_lib:p_run(fun do_warnings/1, Files).
+
+do_warnings(F) ->
+ {ok,_,_,Ws} = compile:file(F, [binary,bin_opt_info,return]),
+ do_warnings_1(Ws, F).
+
+do_warnings_1([{"no_file",Ws}|_], F) ->
+ io:format("~s:\nMissing file for warnings: ~p\n",
+ [F,Ws]),
+ error;
+do_warnings_1([{Name,Ws}|T], F) ->
+ case filename:extension(Name) of
+ ".erl" ->
+ do_warnings_2(Ws, T, F);
+ _ ->
+ io:format("~s:\nNo .erl extension\n", [F]),
+ error
+ end;
+do_warnings_1([], _) -> ok.
+
+do_warnings_2([{Int,_,_}=W|T], Next, F) ->
+ if
+ is_integer(Int) ->
+ do_warnings_2(T, Next, F);
+ true ->
+ io:format("~s:\nMissing line number: ~p\n",
+ [F,W]),
+ error
+ end;
+do_warnings_2([], Next, F) ->
+ do_warnings_1(Next, F).
+
+
%%%
%%% Utilities.
%%%
diff --git a/lib/compiler/test/misc_SUITE.erl b/lib/compiler/test/misc_SUITE.erl
index 8606935504..b88abaf62d 100644
--- a/lib/compiler/test/misc_SUITE.erl
+++ b/lib/compiler/test/misc_SUITE.erl
@@ -192,6 +192,14 @@ silly_coverage(Config) when is_list(Config) ->
{label,2}|non_proper_list]}],99},
expect_error(fun() -> beam_a:module(BeamAInput, []) end),
+ %% beam_reorder
+ BlockInput = {?MODULE,[{foo,0}],[],
+ [{function,foo,0,2,
+ [{label,1},
+ {func_info,{atom,?MODULE},{atom,foo},0},
+ {label,2}|non_proper_list]}],99},
+ expect_error(fun() -> beam_reorder:module(BlockInput, []) end),
+
%% beam_block
BlockInput = {?MODULE,[{foo,0}],[],
[{function,foo,0,2,
@@ -200,6 +208,10 @@ silly_coverage(Config) when is_list(Config) ->
{label,2}|non_proper_list]}],99},
?line expect_error(fun() -> beam_block:module(BlockInput, []) end),
+ %% beam_bs
+ BsInput = BlockInput,
+ expect_error(fun() -> beam_bs:module(BsInput, []) end),
+
%% beam_type
TypeInput = {?MODULE,[{foo,0}],[],
[{function,foo,0,2,
diff --git a/lib/compiler/vsn.mk b/lib/compiler/vsn.mk
index 69f71ba5dd..357b35e47b 100644
--- a/lib/compiler/vsn.mk
+++ b/lib/compiler/vsn.mk
@@ -1 +1 @@
-COMPILER_VSN = 6.0
+COMPILER_VSN = 6.0.1
diff --git a/lib/crypto/Makefile b/lib/crypto/Makefile
index 24db75bf91..fbf108c410 100644
--- a/lib/crypto/Makefile
+++ b/lib/crypto/Makefile
@@ -24,11 +24,7 @@ include $(ERL_TOP)/make/$(TARGET)/otp.mk
# Macros
#
-ifneq ($(findstring ose,$(TARGET)),ose)
SUB_DIRECTORIES = src c_src doc/src
-else
-SUB_DIRECTORIES = src doc/src
-endif
static_lib: SUB_DIRECTORIES = c_src
include vsn.mk
diff --git a/lib/crypto/c_src/Makefile.in b/lib/crypto/c_src/Makefile.in
index e66c0ca916..e7f750b60a 100644
--- a/lib/crypto/c_src/Makefile.in
+++ b/lib/crypto/c_src/Makefile.in
@@ -127,12 +127,7 @@ ALL_STATIC_CFLAGS = $(DED_STATIC_CFLAGS) $(INCLUDES)
_create_dirs := $(shell mkdir -p $(OBJDIR) $(LIBDIR))
-ifneq ($(findstring ose,$(TARGET)),ose)
debug opt valgrind: $(NIF_LIB) $(CALLBACK_LIB)
-else
-# Do not build dynamic files on OSE
-debug opt valgrind:
-endif
static_lib: $(NIF_ARCHIVE)
@@ -203,14 +198,12 @@ release_spec: opt
$(INSTALL_DIR) "$(RELSYSDIR)/priv/obj"
$(INSTALL_DIR) "$(RELSYSDIR)/priv/lib"
$(INSTALL_DATA) $(NIF_MAKEFILE) "$(RELSYSDIR)/priv/obj"
-ifneq ($(findstring ose,$(TARGET)),ose)
$(INSTALL_PROGRAM) $(CRYPTO_OBJS) "$(RELSYSDIR)/priv/obj"
$(INSTALL_PROGRAM) $(NIF_LIB) "$(RELSYSDIR)/priv/lib"
ifeq ($(DYNAMIC_CRYPTO_LIB),yes)
$(INSTALL_PROGRAM) $(CALLBACK_OBJS) "$(RELSYSDIR)/priv/obj"
$(INSTALL_PROGRAM) $(CALLBACK_LIB) "$(RELSYSDIR)/priv/lib"
endif
-endif
release_docs_spec:
diff --git a/lib/crypto/c_src/crypto.c b/lib/crypto/c_src/crypto.c
index 9de8dc74c2..e9cac30c9c 100644
--- a/lib/crypto/c_src/crypto.c
+++ b/lib/crypto/c_src/crypto.c
@@ -507,47 +507,6 @@ static void hmac_context_dtor(ErlNifEnv* env, struct hmac_context*);
#define PRINTF_ERR1(FMT,A1)
#define PRINTF_ERR2(FMT,A1,A2)
-#ifdef __OSE__
-
-/* For crypto on OSE we have to initialize the crypto library on each
- process that uses it. So since we do not know which scheduler is going
- to execute the nif we have to check before each nif call that we have
- initialized crypto in that process. */
-
-#include "ose.h"
-#include "openssl/osessl.h"
-
-static ErlNifTSDKey crypto_init_key;
-static int check_ose_crypto(void);
-static int init_ose_crypto(void);
-
-static int check_ose_crypto() {
- int key = (int)enif_tsd_get(crypto_init_key);
- if (!key) {
- if (!CRYPTO_OSE5_init()) {
- PRINTF_ERR0("CRYPTO: Call to CRYPTO_OSE5_init failed");
- return 0;
- }
- enif_tsd_set(crypto_init_key,1);
- }
- return 1;
-}
-
-static int init_ose_crypto() {
- /* Crypto nif upgrade does not work on OSE so no need to
- destroy this key */
- enif_tsd_key_create("crypto_init_key", &crypto_init_key);
- return check_ose_crypto();
-}
-
-#define INIT_OSE_CRYPTO() init_ose_crypto()
-#define CHECK_OSE_CRYPTO() check_ose_crypto()
-#else
-#define INIT_OSE_CRYPTO() 1
-#define CHECK_OSE_CRYPTO()
-#endif
-
-
static int verify_lib_version(void)
{
const unsigned long libv = SSLeay();
@@ -609,9 +568,6 @@ static int init(ErlNifEnv* env, ERL_NIF_TERM load_info)
ErlNifBinary lib_bin;
char lib_buf[1000];
- if (!INIT_OSE_CRYPTO())
- return 0;
-
if (!verify_lib_version())
return 0;
@@ -853,7 +809,6 @@ static ERL_NIF_TERM md5(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{/* (Data) */
ErlNifBinary ibin;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env, argv[0], &ibin)) {
return enif_make_badarg(env);
}
@@ -865,7 +820,6 @@ static ERL_NIF_TERM md5(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
static ERL_NIF_TERM md5_init(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{/* () */
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
MD5_Init((MD5_CTX *) enif_make_new_binary(env, MD5_CTX_LEN, &ret));
return ret;
}
@@ -874,7 +828,6 @@ static ERL_NIF_TERM md5_update(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv
MD5_CTX* new_ctx;
ErlNifBinary ctx_bin, data_bin;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_binary(env, argv[0], &ctx_bin)
|| ctx_bin.size != MD5_CTX_LEN
|| !enif_inspect_iolist_as_binary(env, argv[1], &data_bin)) {
@@ -891,7 +844,6 @@ static ERL_NIF_TERM md5_final(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[
ErlNifBinary ctx_bin;
MD5_CTX ctx_clone;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_binary(env, argv[0], &ctx_bin) || ctx_bin.size != MD5_CTX_LEN) {
return enif_make_badarg(env);
}
@@ -904,7 +856,6 @@ static ERL_NIF_TERM ripemd160(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[
{/* (Data) */
ErlNifBinary ibin;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env, argv[0], &ibin)) {
return enif_make_badarg(env);
}
@@ -916,7 +867,6 @@ static ERL_NIF_TERM ripemd160(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[
static ERL_NIF_TERM ripemd160_init(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{/* () */
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
RIPEMD160_Init((RIPEMD160_CTX *) enif_make_new_binary(env, RIPEMD160_CTX_LEN, &ret));
return ret;
}
@@ -925,7 +875,6 @@ static ERL_NIF_TERM ripemd160_update(ErlNifEnv* env, int argc, const ERL_NIF_TER
RIPEMD160_CTX* new_ctx;
ErlNifBinary ctx_bin, data_bin;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_binary(env, argv[0], &ctx_bin)
|| ctx_bin.size != RIPEMD160_CTX_LEN
|| !enif_inspect_iolist_as_binary(env, argv[1], &data_bin)) {
@@ -942,7 +891,6 @@ static ERL_NIF_TERM ripemd160_final(ErlNifEnv* env, int argc, const ERL_NIF_TERM
ErlNifBinary ctx_bin;
RIPEMD160_CTX ctx_clone;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_binary(env, argv[0], &ctx_bin) || ctx_bin.size != RIPEMD160_CTX_LEN) {
return enif_make_badarg(env);
}
@@ -956,7 +904,6 @@ static ERL_NIF_TERM sha(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{/* (Data) */
ErlNifBinary ibin;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env, argv[0], &ibin)) {
return enif_make_badarg(env);
}
@@ -968,7 +915,6 @@ static ERL_NIF_TERM sha(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
static ERL_NIF_TERM sha_init(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{/* () */
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
SHA1_Init((SHA_CTX *) enif_make_new_binary(env, SHA_CTX_LEN, &ret));
return ret;
}
@@ -977,7 +923,6 @@ static ERL_NIF_TERM sha_update(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv
SHA_CTX* new_ctx;
ErlNifBinary ctx_bin, data_bin;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_binary(env, argv[0], &ctx_bin) || ctx_bin.size != SHA_CTX_LEN
|| !enif_inspect_iolist_as_binary(env, argv[1], &data_bin)) {
return enif_make_badarg(env);
@@ -993,7 +938,6 @@ static ERL_NIF_TERM sha_final(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[
ErlNifBinary ctx_bin;
SHA_CTX ctx_clone;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_binary(env, argv[0], &ctx_bin) || ctx_bin.size != SHA_CTX_LEN) {
return enif_make_badarg(env);
}
@@ -1007,7 +951,6 @@ static ERL_NIF_TERM sha224_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv
#ifdef HAVE_SHA224
ErlNifBinary ibin;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env, argv[0], &ibin)) {
return enif_make_badarg(env);
}
@@ -1023,7 +966,6 @@ static ERL_NIF_TERM sha224_init_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM
{/* () */
#ifdef HAVE_SHA224
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
SHA224_Init((SHA256_CTX *) enif_make_new_binary(env, sizeof(SHA256_CTX), &ret));
return ret;
#else
@@ -1036,7 +978,6 @@ static ERL_NIF_TERM sha224_update_nif(ErlNifEnv* env, int argc, const ERL_NIF_TE
SHA256_CTX* new_ctx;
ErlNifBinary ctx_bin, data_bin;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_binary(env, argv[0], &ctx_bin) || ctx_bin.size != sizeof(SHA256_CTX)
|| !enif_inspect_iolist_as_binary(env, argv[1], &data_bin)) {
return enif_make_badarg(env);
@@ -1056,7 +997,6 @@ static ERL_NIF_TERM sha224_final_nif(ErlNifEnv* env, int argc, const ERL_NIF_TER
ErlNifBinary ctx_bin;
SHA256_CTX ctx_clone;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_binary(env, argv[0], &ctx_bin) || ctx_bin.size != sizeof(SHA256_CTX)) {
return enif_make_badarg(env);
}
@@ -1073,7 +1013,6 @@ static ERL_NIF_TERM sha256_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv
#ifdef HAVE_SHA256
ErlNifBinary ibin;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env, argv[0], &ibin)) {
return enif_make_badarg(env);
}
@@ -1089,7 +1028,6 @@ static ERL_NIF_TERM sha256_init_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM
{/* () */
#ifdef HAVE_SHA256
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
SHA256_Init((SHA256_CTX *) enif_make_new_binary(env, sizeof(SHA256_CTX), &ret));
return ret;
#else
@@ -1102,7 +1040,6 @@ static ERL_NIF_TERM sha256_update_nif(ErlNifEnv* env, int argc, const ERL_NIF_TE
SHA256_CTX* new_ctx;
ErlNifBinary ctx_bin, data_bin;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_binary(env, argv[0], &ctx_bin) || ctx_bin.size != sizeof(SHA256_CTX)
|| !enif_inspect_iolist_as_binary(env, argv[1], &data_bin)) {
return enif_make_badarg(env);
@@ -1122,7 +1059,6 @@ static ERL_NIF_TERM sha256_final_nif(ErlNifEnv* env, int argc, const ERL_NIF_TER
ErlNifBinary ctx_bin;
SHA256_CTX ctx_clone;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_binary(env, argv[0], &ctx_bin) || ctx_bin.size != sizeof(SHA256_CTX)) {
return enif_make_badarg(env);
}
@@ -1139,7 +1075,6 @@ static ERL_NIF_TERM sha384_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv
#ifdef HAVE_SHA384
ErlNifBinary ibin;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env, argv[0], &ibin)) {
return enif_make_badarg(env);
}
@@ -1155,7 +1090,6 @@ static ERL_NIF_TERM sha384_init_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM
{/* () */
#ifdef HAVE_SHA384
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
SHA384_Init((SHA512_CTX *) enif_make_new_binary(env, sizeof(SHA512_CTX), &ret));
return ret;
#else
@@ -1168,7 +1102,6 @@ static ERL_NIF_TERM sha384_update_nif(ErlNifEnv* env, int argc, const ERL_NIF_TE
SHA512_CTX* new_ctx;
ErlNifBinary ctx_bin, data_bin;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_binary(env, argv[0], &ctx_bin) || ctx_bin.size != sizeof(SHA512_CTX)
|| !enif_inspect_iolist_as_binary(env, argv[1], &data_bin)) {
return enif_make_badarg(env);
@@ -1188,7 +1121,6 @@ static ERL_NIF_TERM sha384_final_nif(ErlNifEnv* env, int argc, const ERL_NIF_TER
ErlNifBinary ctx_bin;
SHA512_CTX ctx_clone;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_binary(env, argv[0], &ctx_bin) || ctx_bin.size != sizeof(SHA512_CTX)) {
return enif_make_badarg(env);
}
@@ -1205,7 +1137,6 @@ static ERL_NIF_TERM sha512_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv
#ifdef HAVE_SHA512
ErlNifBinary ibin;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env, argv[0], &ibin)) {
return enif_make_badarg(env);
}
@@ -1233,7 +1164,6 @@ static ERL_NIF_TERM sha512_update_nif(ErlNifEnv* env, int argc, const ERL_NIF_TE
SHA512_CTX* new_ctx;
ErlNifBinary ctx_bin, data_bin;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_binary(env, argv[0], &ctx_bin) || ctx_bin.size != sizeof(SHA512_CTX)
|| !enif_inspect_iolist_as_binary(env, argv[1], &data_bin)) {
return enif_make_badarg(env);
@@ -1253,7 +1183,6 @@ static ERL_NIF_TERM sha512_final_nif(ErlNifEnv* env, int argc, const ERL_NIF_TER
ErlNifBinary ctx_bin;
SHA512_CTX ctx_clone;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_binary(env, argv[0], &ctx_bin) || ctx_bin.size != sizeof(SHA512_CTX)) {
return enif_make_badarg(env);
}
@@ -1270,7 +1199,6 @@ static ERL_NIF_TERM md4(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{/* (Data) */
ErlNifBinary ibin;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env, argv[0], &ibin)) {
return enif_make_badarg(env);
}
@@ -1282,7 +1210,6 @@ static ERL_NIF_TERM md4(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
static ERL_NIF_TERM md4_init(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{/* () */
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
MD4_Init((MD4_CTX *) enif_make_new_binary(env, MD4_CTX_LEN, &ret));
return ret;
}
@@ -1291,7 +1218,6 @@ static ERL_NIF_TERM md4_update(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv
MD4_CTX* new_ctx;
ErlNifBinary ctx_bin, data_bin;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_binary(env, argv[0], &ctx_bin) || ctx_bin.size != MD4_CTX_LEN
|| !enif_inspect_iolist_as_binary(env, argv[1], &data_bin)) {
return enif_make_badarg(env);
@@ -1307,7 +1233,6 @@ static ERL_NIF_TERM md4_final(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[
ErlNifBinary ctx_bin;
MD4_CTX ctx_clone;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_binary(env, argv[0], &ctx_bin) || ctx_bin.size != MD4_CTX_LEN) {
return enif_make_badarg(env);
}
@@ -1322,7 +1247,6 @@ static ERL_NIF_TERM md5_mac_n(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[
ErlNifBinary key, data;
unsigned mac_sz;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env, argv[0], &key)
|| !enif_inspect_iolist_as_binary(env, argv[1], &data)
|| !enif_get_uint(env,argv[2],&mac_sz) || mac_sz > MD5_LEN) {
@@ -1340,7 +1264,6 @@ static ERL_NIF_TERM sha_mac_n(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[
ErlNifBinary key, data;
unsigned mac_sz;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env, argv[0], &key)
|| !enif_inspect_iolist_as_binary(env, argv[1], &data)
|| !enif_get_uint(env,argv[2],&mac_sz) || mac_sz > SHA_LEN) {
@@ -1360,7 +1283,6 @@ static ERL_NIF_TERM sha224_mac_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM
ErlNifBinary key, data;
unsigned mac_sz;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env, argv[0], &key)
|| !enif_inspect_iolist_as_binary(env, argv[1], &data)
|| !enif_get_uint(env,argv[2],&mac_sz) || mac_sz > SHA224_DIGEST_LENGTH) {
@@ -1383,7 +1305,6 @@ static ERL_NIF_TERM sha256_mac_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM
ErlNifBinary key, data;
unsigned mac_sz;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env, argv[0], &key)
|| !enif_inspect_iolist_as_binary(env, argv[1], &data)
|| !enif_get_uint(env,argv[2],&mac_sz) || mac_sz > SHA256_DIGEST_LENGTH) {
@@ -1406,7 +1327,6 @@ static ERL_NIF_TERM sha384_mac_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM
ErlNifBinary key, data;
unsigned mac_sz;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env, argv[0], &key)
|| !enif_inspect_iolist_as_binary(env, argv[1], &data)
|| !enif_get_uint(env,argv[2],&mac_sz) || mac_sz > SHA384_DIGEST_LENGTH) {
@@ -1430,7 +1350,6 @@ static ERL_NIF_TERM sha512_mac_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM
ErlNifBinary key, data;
unsigned mac_sz;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env, argv[0], &key)
|| !enif_inspect_iolist_as_binary(env, argv[1], &data)
|| !enif_get_uint(env,argv[2],&mac_sz) || mac_sz > SHA512_DIGEST_LENGTH) {
@@ -1462,7 +1381,6 @@ static ERL_NIF_TERM hmac_init(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[
const EVP_MD *md;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (argv[0] == atom_sha) md = EVP_sha1();
#ifdef HAVE_SHA224
@@ -1502,7 +1420,6 @@ static ERL_NIF_TERM hmac_update(ErlNifEnv* env, int argc, const ERL_NIF_TERM arg
ErlNifBinary data;
struct hmac_context* obj;
- CHECK_OSE_CRYPTO();
if (!enif_get_resource(env, argv[0], hmac_context_rtype, (void**)&obj)
|| !enif_inspect_iolist_as_binary(env, argv[1], &data)) {
@@ -1529,7 +1446,6 @@ static ERL_NIF_TERM hmac_final(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv
unsigned int req_len = 0;
unsigned int mac_len;
- CHECK_OSE_CRYPTO();
if (!enif_get_resource(env,argv[0],hmac_context_rtype, (void**)&obj)
|| (argc == 2 && !enif_get_uint(env, argv[1], &req_len))) {
@@ -1564,7 +1480,6 @@ static ERL_NIF_TERM des_cbc_crypt(ErlNifEnv* env, int argc, const ERL_NIF_TERM a
DES_cblock ivec_clone; /* writable copy */
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env, argv[0], &key) || key.size != 8
|| !enif_inspect_binary(env, argv[1], &ivec) || ivec.size != 8
@@ -1587,7 +1502,6 @@ static ERL_NIF_TERM des_cfb_crypt(ErlNifEnv* env, int argc, const ERL_NIF_TERM a
DES_cblock ivec_clone; /* writable copy */
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env, argv[0], &key) || key.size != 8
|| !enif_inspect_binary(env, argv[1], &ivec) || ivec.size != 8
@@ -1607,7 +1521,6 @@ static ERL_NIF_TERM des_ecb_crypt(ErlNifEnv* env, int argc, const ERL_NIF_TERM a
ErlNifBinary key, text;
DES_key_schedule schedule;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env, argv[0], &key) || key.size != 8 ||
!enif_inspect_iolist_as_binary(env, argv[1], &text) || text.size != 8) {
return enif_make_badarg(env);
@@ -1627,7 +1540,6 @@ static ERL_NIF_TERM des_ede3_cbc_crypt(ErlNifEnv* env, int argc, const ERL_NIF_T
DES_cblock ivec_clone; /* writable copy */
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env, argv[0], &key1) || key1.size != 8
|| !enif_inspect_iolist_as_binary(env, argv[1], &key2) || key2.size != 8
@@ -1657,7 +1569,6 @@ static ERL_NIF_TERM des_ede3_cfb_crypt_nif(ErlNifEnv* env, int argc, const ERL_N
DES_cblock ivec_clone; /* writable copy */
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env, argv[0], &key1) || key1.size != 8
|| !enif_inspect_iolist_as_binary(env, argv[1], &key2) || key2.size != 8
@@ -1714,7 +1625,6 @@ static ERL_NIF_TERM aes_cfb_128_crypt(ErlNifEnv* env, int argc, const ERL_NIF_TE
int new_ivlen = 0;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env, argv[0], &key)
|| !(key.size == 16 || key.size == 24 || key.size == 32)
@@ -1744,7 +1654,6 @@ static ERL_NIF_TERM aes_ctr_encrypt(ErlNifEnv* env, int argc, const ERL_NIF_TERM
unsigned int num = 0;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env, argv[0], &key)
|| AES_set_encrypt_key(key.data, key.size*8, &aes_key) != 0
@@ -1777,7 +1686,6 @@ static ERL_NIF_TERM aes_ctr_stream_encrypt(ErlNifEnv* env, int argc, const ERL_N
unsigned char * ivec2_buf;
unsigned char * ecount2_buf;
- CHECK_OSE_CRYPTO();
if (!enif_get_tuple(env, argv[0], &state_arity, &state_term)
|| state_arity != 4
@@ -1816,7 +1724,6 @@ static ERL_NIF_TERM aes_gcm_encrypt(ErlNifEnv* env, int argc, const ERL_NIF_TERM
unsigned char *outp;
ERL_NIF_TERM out, out_tag;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env, argv[0], &key)
|| AES_set_encrypt_key(key.data, key.size*8, &aes_key) != 0
@@ -1866,7 +1773,6 @@ static ERL_NIF_TERM aes_gcm_decrypt(ErlNifEnv* env, int argc, const ERL_NIF_TERM
unsigned char *outp;
ERL_NIF_TERM out;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env, argv[0], &key)
|| AES_set_encrypt_key(key.data, key.size*8, &aes_key) != 0
@@ -1937,7 +1843,6 @@ static ERL_NIF_TERM chacha20_poly1305_encrypt(ErlNifEnv* env, int argc, const ER
unsigned char poly1305_key[32];
poly1305_state poly1305;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env, argv[0], &key) || key.size != 32
|| !enif_inspect_binary(env, argv[1], &iv) || iv.size != CHACHA20_NONCE_LEN
@@ -1991,7 +1896,6 @@ static ERL_NIF_TERM chacha20_poly1305_decrypt(ErlNifEnv* env, int argc, const ER
unsigned char mac[POLY1305_TAG_LEN];
poly1305_state poly1305;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env, argv[0], &key) || key.size != 32
|| !enif_inspect_binary(env, argv[1], &iv) || iv.size != CHACHA20_NONCE_LEN
@@ -2045,7 +1949,6 @@ static ERL_NIF_TERM aes_ecb_crypt(ErlNifEnv* env, int argc, const ERL_NIF_TERM a
unsigned char* ret_ptr;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env, argv[0], &key_bin)
|| (key_bin.size != 16 && key_bin.size != 32)
@@ -2074,7 +1977,6 @@ static ERL_NIF_TERM rand_bytes_1(ErlNifEnv* env, int argc, const ERL_NIF_TERM ar
unsigned bytes;
unsigned char* data;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_get_uint(env, argv[0], &bytes)) {
return enif_make_badarg(env);
}
@@ -2088,7 +1990,6 @@ static ERL_NIF_TERM strong_rand_bytes_nif(ErlNifEnv* env, int argc, const ERL_NI
unsigned bytes;
unsigned char* data;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_get_uint(env, argv[0], &bytes)) {
return enif_make_badarg(env);
}
@@ -2106,7 +2007,6 @@ static ERL_NIF_TERM rand_bytes_3(ErlNifEnv* env, int argc, const ERL_NIF_TERM ar
unsigned char* data;
unsigned top_mask, bot_mask;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_get_uint(env, argv[0], &bytes)
|| !enif_get_uint(env, argv[1], &top_mask)
|| !enif_get_uint(env, argv[2], &bot_mask)) {
@@ -2130,7 +2030,6 @@ static ERL_NIF_TERM strong_rand_mpint_nif(ErlNifEnv* env, int argc, const ERL_NI
unsigned dlen;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_get_uint(env, argv[0], &bits)
|| !enif_get_int(env, argv[1], &top)
@@ -2200,7 +2099,6 @@ static ERL_NIF_TERM rand_uniform_nif(ErlNifEnv* env, int argc, const ERL_NIF_TER
unsigned dlen;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!get_bn_from_mpint(env, argv[0], &bn_from)
|| !get_bn_from_mpint(env, argv[1], &bn_rand)) {
@@ -2233,7 +2131,6 @@ static ERL_NIF_TERM mod_exp_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM arg
unsigned extra_byte;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!get_bn_from_bin(env, argv[0], &bn_base)
|| !get_bn_from_bin(env, argv[1], &bn_exponent)
@@ -2277,7 +2174,6 @@ static ERL_NIF_TERM dss_verify_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM
DSA *dsa;
int i;
- CHECK_OSE_CRYPTO();
if (argv[0] == atom_sha) {
if (enif_get_tuple(env, argv[1], &tpl_arity, &tpl_terms)) {
@@ -2446,7 +2342,6 @@ static ERL_NIF_TERM rsa_verify_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM
struct digest_type_t* digp = NULL;
unsigned char* digest = NULL;
- CHECK_OSE_CRYPTO();
digp = get_digest_type(type);
if (!digp) {
@@ -2508,7 +2403,6 @@ static ERL_NIF_TERM aes_cbc_crypt(ErlNifEnv* env, int argc, const ERL_NIF_TERM a
unsigned char* ret_ptr;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env, argv[0], &key_bin)
|| (key_bin.size != 16 && key_bin.size != 32)
@@ -2569,7 +2463,6 @@ static ERL_NIF_TERM aes_ige_crypt_nif(ErlNifEnv* env, int argc, const ERL_NIF_TE
unsigned char* ret_ptr;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env, argv[0], &key_bin)
|| (key_bin.size != 16 && key_bin.size != 32)
@@ -2607,7 +2500,6 @@ static ERL_NIF_TERM do_exor(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
int i;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env,argv[0], &d1)
|| !enif_inspect_iolist_as_binary(env,argv[1], &d2)
@@ -2629,7 +2521,6 @@ static ERL_NIF_TERM rc4_encrypt(ErlNifEnv* env, int argc, const ERL_NIF_TERM arg
RC4_KEY rc4_key;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env,argv[0], &key)
|| !enif_inspect_iolist_as_binary(env,argv[1], &data)) {
@@ -2647,7 +2538,6 @@ static ERL_NIF_TERM rc4_set_key(ErlNifEnv* env, int argc, const ERL_NIF_TERM arg
ErlNifBinary key;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env,argv[0], &key)) {
return enif_make_badarg(env);
@@ -2664,7 +2554,6 @@ static ERL_NIF_TERM rc4_encrypt_with_state(ErlNifEnv* env, int argc, const ERL_N
RC4_KEY* rc4_key;
ERL_NIF_TERM new_state, new_data;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env,argv[0], &state)
|| state.size != sizeof(RC4_KEY)
@@ -2686,7 +2575,6 @@ static ERL_NIF_TERM rc2_cbc_crypt(ErlNifEnv* env, int argc, const ERL_NIF_TERM a
ERL_NIF_TERM ret;
unsigned char iv_copy[8];
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env, argv[0], &key_bin)
|| (key_bin.size != 5 && key_bin.size != 8 && key_bin.size != 16)
@@ -2748,7 +2636,6 @@ static ERL_NIF_TERM rsa_sign_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM ar
struct digest_type_t *digp;
unsigned char* digest;
- CHECK_OSE_CRYPTO();
digp = get_digest_type(argv[0]);
if (!digp) {
@@ -2816,7 +2703,6 @@ static ERL_NIF_TERM dss_sign_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM ar
DSA* dsa;
int i;
- CHECK_OSE_CRYPTO();
if (argv[0] == atom_sha) {
if (enif_get_tuple(env, argv[1], &tpl_arity, &tpl_terms)) {
@@ -2903,7 +2789,6 @@ static ERL_NIF_TERM rsa_public_crypt(ErlNifEnv* env, int argc, const ERL_NIF_TER
int padding, i;
RSA* rsa;
- CHECK_OSE_CRYPTO();
rsa = RSA_new();
@@ -2953,7 +2838,6 @@ static ERL_NIF_TERM rsa_private_crypt(ErlNifEnv* env, int argc, const ERL_NIF_TE
int padding, i;
RSA* rsa;
- CHECK_OSE_CRYPTO();
rsa = RSA_new();
@@ -3001,7 +2885,6 @@ static ERL_NIF_TERM dh_generate_parameters_nif(ErlNifEnv* env, int argc, const E
unsigned char *p_ptr, *g_ptr;
ERL_NIF_TERM ret_p, ret_g;
- CHECK_OSE_CRYPTO();
if (!enif_get_int(env, argv[0], &prime_len)
|| !enif_get_int(env, argv[1], &generator)) {
@@ -3030,7 +2913,6 @@ static ERL_NIF_TERM dh_check(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]
int i;
ERL_NIF_TERM ret, head, tail;
- CHECK_OSE_CRYPTO();
dh_params = DH_new();
@@ -3066,7 +2948,6 @@ static ERL_NIF_TERM dh_generate_key_nif(ErlNifEnv* env, int argc, const ERL_NIF_
ERL_NIF_TERM ret, ret_pub, ret_prv, head, tail;
int mpint; /* 0 or 4 */
- CHECK_OSE_CRYPTO();
dh_params = DH_new();
@@ -3112,7 +2993,6 @@ static ERL_NIF_TERM dh_compute_key_nif(ErlNifEnv* env, int argc, const ERL_NIF_T
ErlNifBinary ret_bin;
ERL_NIF_TERM ret, head, tail;
- CHECK_OSE_CRYPTO();
dh_params = DH_new();
@@ -3154,7 +3034,6 @@ static ERL_NIF_TERM srp_value_B_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM
unsigned dlen;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!get_bn_from_bin(env, argv[0], &bn_multiplier)
|| !get_bn_from_bin(env, argv[1], &bn_verifier)
@@ -3216,7 +3095,6 @@ static ERL_NIF_TERM srp_user_secret_nif(ErlNifEnv* env, int argc, const ERL_NIF_
unsigned dlen;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!get_bn_from_bin(env, argv[0], &bn_a)
|| !get_bn_from_bin(env, argv[1], &bn_u)
@@ -3297,7 +3175,6 @@ static ERL_NIF_TERM srp_host_secret_nif(ErlNifEnv* env, int argc, const ERL_NIF_
unsigned dlen;
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!get_bn_from_bin(env, argv[0], &bn_verifier)
|| !get_bn_from_bin(env, argv[1], &bn_b)
@@ -3359,7 +3236,6 @@ static ERL_NIF_TERM bf_cfb64_crypt(ErlNifEnv* env, int argc, const ERL_NIF_TERM
int bf_n = 0; /* blowfish ivec pos */
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env, argv[0], &key_bin)
|| !enif_inspect_binary(env, argv[1], &ivec_bin)
@@ -3384,7 +3260,6 @@ static ERL_NIF_TERM bf_cbc_crypt(ErlNifEnv* env, int argc, const ERL_NIF_TERM ar
unsigned char bf_tkey[8]; /* blowfish ivec */
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env, argv[0], &key_bin)
|| !enif_inspect_binary(env, argv[1], &ivec_bin)
@@ -3409,7 +3284,6 @@ static ERL_NIF_TERM bf_ecb_crypt(ErlNifEnv* env, int argc, const ERL_NIF_TERM ar
BF_KEY bf_key; /* blowfish key 8 */
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env, argv[0], &key_bin)
|| !enif_inspect_iolist_as_binary(env, argv[1], &data_bin)
@@ -3431,7 +3305,6 @@ static ERL_NIF_TERM blowfish_ofb64_encrypt(ErlNifEnv* env, int argc, const ERL_N
int bf_n = 0; /* blowfish ivec pos */
ERL_NIF_TERM ret;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_iolist_as_binary(env, argv[0], &key_bin)
|| !enif_inspect_binary(env, argv[1], &ivec_bin)
@@ -3756,7 +3629,6 @@ static ERL_NIF_TERM ec_key_generate(ErlNifEnv* env, int argc, const ERL_NIF_TERM
ERL_NIF_TERM priv_key;
ERL_NIF_TERM pub_key = atom_undefined;
- CHECK_OSE_CRYPTO();
if (!get_ec_key(env, argv[0], argv[1], atom_undefined, &key))
goto badarg;
@@ -3799,7 +3671,6 @@ static ERL_NIF_TERM ecdsa_sign_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM
struct digest_type_t *digp;
unsigned char* digest;
- CHECK_OSE_CRYPTO();
digp = get_digest_type(argv[0]);
if (!digp) {
@@ -3868,7 +3739,6 @@ static ERL_NIF_TERM ecdsa_verify_nif(ErlNifEnv* env, int argc, const ERL_NIF_TER
struct digest_type_t* digp = NULL;
unsigned char* digest = NULL;
- CHECK_OSE_CRYPTO();
digp = get_digest_type(type);
if (!digp) {
@@ -3933,7 +3803,6 @@ static ERL_NIF_TERM ecdh_compute_key_nif(ErlNifEnv* env, int argc, const ERL_NIF
EC_POINT *my_ecpoint;
EC_KEY *other_ecdh = NULL;
- CHECK_OSE_CRYPTO();
if (!get_ec_key(env, argv[1], argv[2], atom_undefined, &key))
return enif_make_badarg(env);
@@ -3978,7 +3847,6 @@ out_err:
static ERL_NIF_TERM rand_seed_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{
ErlNifBinary seed_bin;
- CHECK_OSE_CRYPTO();
if (!enif_inspect_binary(env, argv[0], &seed_bin))
return enif_make_badarg(env);
RAND_seed(seed_bin.data,seed_bin.size);
diff --git a/lib/crypto/doc/src/crypto.xml b/lib/crypto/doc/src/crypto.xml
index 385a583883..291a5145e4 100644
--- a/lib/crypto/doc/src/crypto.xml
+++ b/lib/crypto/doc/src/crypto.xml
@@ -617,7 +617,7 @@
RAND_seed function from openssl. Only use this if the system
you are running on does not have enough "randomness" built in.
Normally this is when <seealso marker="#strong_rand_bytes/1">
- stong_rand_bytes/1</seealso> returns <c>low_entropy</c></p>
+ strong_rand_bytes/1</seealso> returns <c>low_entropy</c></p>
</desc>
</func>
@@ -710,7 +710,7 @@
</type>
<desc>
<p>Initializes the state for use in streaming AES encryption using Counter mode (CTR).
- <c>Key</c> is the AES key and must be either 128, 192, or 256 bts long. <c>IVec</c> is
+ <c>Key</c> is the AES key and must be either 128, 192, or 256 bits long. <c>IVec</c> is
an arbitrary initializing vector of 128 bits (16 bytes). This state is for use with
<seealso marker="#stream_encrypt-2">stream_encrypt</seealso> and
<seealso marker="#stream_decrypt-2">stream_decrypt</seealso>.</p>
diff --git a/lib/crypto/doc/src/notes.xml b/lib/crypto/doc/src/notes.xml
index e2b90eca75..54dd8872eb 100644
--- a/lib/crypto/doc/src/notes.xml
+++ b/lib/crypto/doc/src/notes.xml
@@ -31,6 +31,22 @@
</header>
<p>This document describes the changes made to the Crypto application.</p>
+<section><title>Crypto 3.6.1</title>
+
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p>
+ Make <c>crypto:ec_curves/0</c> return empty list if
+ elliptic curve is not supported at all.</p>
+ <p>
+ Own Id: OTP-12944</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
<section><title>Crypto 3.6</title>
<section><title>Fixed Bugs and Malfunctions</title>
diff --git a/lib/crypto/test/crypto_SUITE.erl b/lib/crypto/test/crypto_SUITE.erl
index e84f5e1075..0b955c0965 100644
--- a/lib/crypto/test/crypto_SUITE.erl
+++ b/lib/crypto/test/crypto_SUITE.erl
@@ -118,10 +118,10 @@ init_per_suite(Config) ->
_ ->
Config
catch error:low_entropy ->
- %% Make sure we are on OSE, otherwise we want to crash
- {ose,_} = os:type(),
+ %% We are testing on an OS with low entropy in its random
+ %% seed. So we have to seed it with a binary to get started.
- %% This is NOT how you want to seed this, it is just here
+ %% This is NOT how you want to do seeding, it is just here
%% to make the tests pass. Check your OS manual for how you
%% really want to seed.
{H,M,L} = erlang:now(),
diff --git a/lib/crypto/vsn.mk b/lib/crypto/vsn.mk
index 55b1b3e8c4..c2166a8e75 100644
--- a/lib/crypto/vsn.mk
+++ b/lib/crypto/vsn.mk
@@ -1 +1 @@
-CRYPTO_VSN = 3.6
+CRYPTO_VSN = 3.6.1
diff --git a/lib/debugger/doc/src/notes.xml b/lib/debugger/doc/src/notes.xml
index 67cfe20d83..3eaecf86b2 100644
--- a/lib/debugger/doc/src/notes.xml
+++ b/lib/debugger/doc/src/notes.xml
@@ -33,6 +33,22 @@
<p>This document describes the changes made to the Debugger
application.</p>
+<section><title>Debugger 4.1.1</title>
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p>
+ Fix crash when starting a quick debugging session. Thanks
+ Alan Duffield.</p>
+ <p>
+ Own Id: OTP-12911 Aux Id: seq12906 </p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
+
<section><title>Debugger 4.1</title>
<section><title>Improvements and New Features</title>
diff --git a/lib/debugger/src/dbg_iload.erl b/lib/debugger/src/dbg_iload.erl
index 2a8bcd32d8..7746a06fcb 100644
--- a/lib/debugger/src/dbg_iload.erl
+++ b/lib/debugger/src/dbg_iload.erl
@@ -541,7 +541,7 @@ fun_clauses([]) -> [].
new_map(Fs0, Anno, F) ->
Line = ln(Anno),
Fs1 = map_fields(Fs0, F),
- Fs2 = [{ln(A),K,V} || {map_field_assoc,A,K,V} <- Fs1],
+ Fs2 = [{L,K,V} || {map_field_assoc,L,K,V} <- Fs1],
try
{value,Line,map_literal(Fs2, #{})}
catch
diff --git a/lib/debugger/src/dbg_wx_win.erl b/lib/debugger/src/dbg_wx_win.erl
index 63f74392b5..1ff8818bbe 100644
--- a/lib/debugger/src/dbg_wx_win.erl
+++ b/lib/debugger/src/dbg_wx_win.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -95,10 +95,9 @@ create_menu_item(Menu, [{Name, _N, cascade, Items}|Is], Win, Id0,Connect) ->
false -> Acc
end
end,
- Filter = fun(_,_) ->
+ Filter = fun(Ev,_) ->
Enabled = lists:foldl(IsChecked, [], Butts),
- Self ! #wx{userData={Name, Enabled},
- event=#wxCommand{type=command_menu_selected}}
+ Self ! Ev#wx{userData={Name, Enabled}}
end,
wxMenu:connect(Win, command_menu_selected,
[{id,Id0},{lastId, Id-1},{callback,Filter}]),
diff --git a/lib/debugger/vsn.mk b/lib/debugger/vsn.mk
index b6fd4e8e44..e47ed98128 100644
--- a/lib/debugger/vsn.mk
+++ b/lib/debugger/vsn.mk
@@ -1 +1 @@
-DEBUGGER_VSN = 4.1
+DEBUGGER_VSN = 4.1.1
diff --git a/lib/dialyzer/doc/src/notes.xml b/lib/dialyzer/doc/src/notes.xml
index 93d3b09f07..aa29684697 100644
--- a/lib/dialyzer/doc/src/notes.xml
+++ b/lib/dialyzer/doc/src/notes.xml
@@ -32,6 +32,48 @@
<p>This document describes the changes made to the Dialyzer
application.</p>
+<section><title>Dialyzer 2.8.1</title>
+
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p>Improve the translation of forms to types. </p>
+ <p>
+ Own Id: OTP-12865</p>
+ </item>
+ <item>
+ <p> Fix a bug concerning parameterized opaque types. </p>
+ <p>
+ Own Id: OTP-12866</p>
+ </item>
+ <item>
+ <p> Fix a bug concerning parameterized opaque types. </p>
+ <p>
+ Own Id: OTP-12940</p>
+ </item>
+ <item>
+ <p> Fix bugs concerning <c>erlang:abs/1</c>. </p>
+ <p>
+ Own Id: OTP-12948</p>
+ </item>
+ <item>
+ <p> Fix a bug concerning <c>lists:keydelete/3</c> with
+ union and opaque types. </p>
+ <p>
+ Own Id: OTP-12949</p>
+ </item>
+ <item>
+ <p>
+ Use new function <c>hipe:erts_checksum</c> to get correct
+ runtime checksum for cached beam files.</p>
+ <p>
+ Own Id: OTP-12964 Aux Id: OTP-12963, OTP-12962 </p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
<section><title>Dialyzer 2.8</title>
<section><title>Fixed Bugs and Malfunctions</title>
@@ -405,22 +447,28 @@
<p>
EEP43: New data type - Maps</p>
<p>
- With Maps you may for instance: <taglist> <item><c>M0 =
- #{ a =&gt; 1, b =&gt; 2}, % create
- associations</c></item> <item><c>M1 = M0#{ a := 10 }, %
- update values</c></item> <item><c>M2 = M1#{ "hi" =&gt;
- "hello"}, % add new associations</c></item> <item><c>#{
- "hi" := V1, a := V2, b := V3} = M2. % match keys with
- values</c></item> </taglist></p>
+ With Maps you may for instance:</p>
+ <taglist>
+ <tag/> <item><c>M0 = #{ a =&gt; 1, b =&gt; 2}, % create
+ associations</c></item>
+ <tag/><item><c>M1 = M0#{ a := 10 }, % update values</c></item>
+ <tag/><item><c>M2 = M1#{ "hi" =&gt;
+ "hello"}, % add new associations</c></item>
+ <tag/><item><c>#{ "hi" := V1, a := V2, b := V3} = M2.
+ % match keys with values</c></item>
+ </taglist>
<p>
For information on how to use Maps please see Map Expressions in the
<seealso marker="doc/reference_manual:expressions#map_expressions">
Reference Manual</seealso>.</p>
<p>
The current implementation is without the following
- features: <taglist> <item>No variable keys</item>
- <item>No single value access</item> <item>No map
- comprehensions</item> </taglist></p>
+ features:</p>
+ <taglist>
+ <tag/><item>No variable keys</item>
+ <tag/><item>No single value access</item>
+ <tag/><item>No map comprehensions</item>
+ </taglist>
<p>
Note that Maps is <em>experimental</em> during OTP 17.0.</p>
<p>
@@ -734,19 +782,17 @@
Own Id: OTP-9731</p>
</item>
<item>
- <p>
<list> <item><p>No warnings for underspecs with remote
types</p></item> <item><p> Fix crash in Typer</p></item>
<item><p>Fix Dialyzer's warning for its own
code</p></item> <item><p>Fix Dialyzer's warnings in
HiPE</p></item> <item><p>Add file/line info in a
particular Dialyzer crash</p></item> <item><p>Update
- inets test results</p></item> </list></p>
+ inets test results</p></item> </list>
<p>
Own Id: OTP-9758</p>
</item>
<item>
- <p>
<list> <item><p>Correct callback spec in application
module</p></item> <item><p>Refine warning about callback
specs with extra ranges</p></item> <item><p>Cleanup
@@ -757,7 +803,7 @@
analysis</p></item> <item><p>Fix crash in
Dialyzer</p></item> <item><p>Variable substitution was
not generalizing any unknown variables.</p></item>
- </list></p>
+ </list>
<p>
Own Id: OTP-9776</p>
</item>
diff --git a/lib/dialyzer/src/dialyzer.app.src b/lib/dialyzer/src/dialyzer.app.src
index 8ac6dc1367..7794cb46c6 100644
--- a/lib/dialyzer/src/dialyzer.app.src
+++ b/lib/dialyzer/src/dialyzer.app.src
@@ -44,7 +44,7 @@
dialyzer_timing,
dialyzer_worker]},
{registered, []},
- {applications, [compiler, gs, hipe, kernel, stdlib, wx]},
+ {applications, [compiler, hipe, kernel, stdlib, wx]},
{env, []},
{runtime_dependencies, ["wx-1.2","syntax_tools-1.6.14","stdlib-2.5",
"kernel-3.0","hipe-3.13","erts-7.0",
diff --git a/lib/dialyzer/src/dialyzer.hrl b/lib/dialyzer/src/dialyzer.hrl
index de236f91ab..601e2e954b 100644
--- a/lib/dialyzer/src/dialyzer.hrl
+++ b/lib/dialyzer/src/dialyzer.hrl
@@ -2,7 +2,7 @@
%%%
%%% %CopyrightBegin%
%%%
-%%% Copyright Ericsson AB 2006-2014. All Rights Reserved.
+%%% Copyright Ericsson AB 2006-2015. All Rights Reserved.
%%%
%%% Licensed under the Apache License, Version 2.0 (the "License");
%%% you may not use this file except in compliance with the License.
@@ -123,10 +123,12 @@
%% Record declarations used by various files
%%--------------------------------------------------------------------
--record(analysis, {analysis_pid :: pid(),
+-type doc_plt() :: 'undefined' | dialyzer_plt:plt().
+
+-record(analysis, {analysis_pid :: pid() | 'undefined',
type = succ_typings :: anal_type(),
defines = [] :: [dial_define()],
- doc_plt :: dialyzer_plt:plt(),
+ doc_plt :: doc_plt(),
files = [] :: [file:filename()],
include_dirs = [] :: [file:filename()],
start_from = byte_code :: start_from(),
@@ -135,7 +137,7 @@
race_detection = false :: boolean(),
behaviours_chk = false :: boolean(),
timing = false :: boolean() | 'debug',
- timing_server :: dialyzer_timing:timing_server(),
+ timing_server = none :: dialyzer_timing:timing_server(),
callgraph_file = "" :: file:filename(),
solvers :: [solver()]}).
diff --git a/lib/dialyzer/src/dialyzer_callgraph.erl b/lib/dialyzer/src/dialyzer_callgraph.erl
index a1cd2015ca..069c02fa65 100644
--- a/lib/dialyzer/src/dialyzer_callgraph.erl
+++ b/lib/dialyzer/src/dialyzer_callgraph.erl
@@ -2,7 +2,7 @@
%%-----------------------------------------------------------------------
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2006-2014. All Rights Reserved.
+%% Copyright Ericsson AB 2006-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -96,15 +96,22 @@
%% whenever applicable.
%%-----------------------------------------------------------------------------
+%% Types with comment 'race' are due to dialyzer_races.erl.
-record(callgraph, {digraph = digraph:new() :: digraph:graph(),
- active_digraph :: active_digraph(),
- esc :: ets:tid(),
- letrec_map :: ets:tid(),
+ active_digraph :: active_digraph()
+ | 'undefined', % race
+ esc :: ets:tid()
+ | 'undefined', % race
+ letrec_map :: ets:tid()
+ | 'undefined', % race
name_map :: ets:tid(),
rev_name_map :: ets:tid(),
- rec_var_map :: ets:tid(),
- self_rec :: ets:tid(),
- calls :: ets:tid(),
+ rec_var_map :: ets:tid()
+ | 'undefined', % race
+ self_rec :: ets:tid()
+ | 'undefined', % race
+ calls :: ets:tid()
+ | 'undefined', % race
race_detection = false :: boolean(),
race_data_server = new_race_data_server() :: pid()}).
diff --git a/lib/dialyzer/src/dialyzer_cl.erl b/lib/dialyzer/src/dialyzer_cl.erl
index 4116866916..92134b7b81 100644
--- a/lib/dialyzer/src/dialyzer_cl.erl
+++ b/lib/dialyzer/src/dialyzer_cl.erl
@@ -36,7 +36,7 @@
-include_lib("kernel/include/file.hrl"). % needed for #file_info{}
-record(cl_state,
- {backend_pid :: pid(),
+ {backend_pid :: pid() | 'undefined',
erlang_mode = false :: boolean(),
external_calls = [] :: [mfa()],
external_types = [] :: [mfa()],
diff --git a/lib/dialyzer/src/dialyzer_codeserver.erl b/lib/dialyzer/src/dialyzer_codeserver.erl
index 978ecd3843..03cd9671af 100644
--- a/lib/dialyzer/src/dialyzer_codeserver.erl
+++ b/lib/dialyzer/src/dialyzer_codeserver.erl
@@ -2,7 +2,7 @@
%%-----------------------------------------------------------------------
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2006-2014. All Rights Reserved.
+%% Copyright Ericsson AB 2006-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -81,10 +81,10 @@
-record(codeserver, {next_core_label = 0 :: label(),
code :: dict_ets(),
- exported_types :: set_ets(), % set(mfa())
- records :: dict_ets(),
- contracts :: dict_ets(),
- callbacks :: dict_ets(),
+ exported_types :: set_ets() | 'undefined', % set(mfa())
+ records :: dict_ets() | 'undefined',
+ contracts :: dict_ets() | 'undefined',
+ callbacks :: dict_ets() | 'undefined',
fun_meta_info :: dict_ets(), % {mfa(), meta_info()}
exports :: 'clean' | set_ets(), % set(mfa())
temp_exported_types :: 'clean' | set_ets(), % set(mfa())
diff --git a/lib/dialyzer/src/dialyzer_coordinator.erl b/lib/dialyzer/src/dialyzer_coordinator.erl
index 612f379d32..3290161ca1 100644
--- a/lib/dialyzer/src/dialyzer_coordinator.erl
+++ b/lib/dialyzer/src/dialyzer_coordinator.erl
@@ -38,7 +38,7 @@
%%% Exports for the compilation workers
-export([get_next_label/2]).
--export_type([coordinator/0, mode/0, init_data/0, result/0]).
+-export_type([coordinator/0, mode/0, init_data/0, result/0, job/0]).
%%--------------------------------------------------------------------
@@ -52,10 +52,12 @@
-type scc() :: [mfa_or_funlbl()].
-type mode() :: 'typesig' | 'dataflow' | 'compile' | 'warnings'.
--type compile_jobs() :: [file:filename()].
--type typesig_jobs() :: [scc()].
--type dataflow_jobs() :: [module()].
--type warnings_jobs() :: [module()].
+-type compile_job() :: file:filename().
+-type typesig_job() :: scc().
+-type dataflow_job() :: module().
+-type warnings_job() :: module().
+
+-type job() :: compile_job() | typesig_job() | dataflow_job() | warnings_job().
-type compile_init_data() :: dialyzer_analysis_callgraph:compile_init_data().
-type typesig_init_data() :: dialyzer_succ_typings:typesig_init_data().
@@ -73,7 +75,6 @@
-type result() :: compile_result() | typesig_result() |
dataflow_result() | warnings_result().
--type job() :: scc() | module() | file:filename().
-type job_result() :: dialyzer_analysis_callgraph:one_file_result() |
typesig_result() | dataflow_result() | warnings_result().
@@ -90,13 +91,13 @@
%%--------------------------------------------------------------------
--spec parallel_job('compile', compile_jobs(), compile_init_data(), timing()) ->
+-spec parallel_job('compile', [compile_job()], compile_init_data(), timing()) ->
{compile_result(), integer()};
- ('typesig', typesig_jobs(), typesig_init_data(), timing()) ->
+ ('typesig', [typesig_job()], typesig_init_data(), timing()) ->
typesig_result();
- ('dataflow', dataflow_jobs(), dataflow_init_data(),
+ ('dataflow', [dataflow_job()], dataflow_init_data(),
timing()) -> dataflow_result();
- ('warnings', warnings_jobs(), warnings_init_data(),
+ ('warnings', [warnings_job()], warnings_init_data(),
timing()) -> warnings_result().
parallel_job(Mode, Jobs, InitData, Timing) ->
diff --git a/lib/dialyzer/src/dialyzer_dataflow.erl b/lib/dialyzer/src/dialyzer_dataflow.erl
index cabc5e9e0d..6e49043551 100644
--- a/lib/dialyzer/src/dialyzer_dataflow.erl
+++ b/lib/dialyzer/src/dialyzer_dataflow.erl
@@ -99,19 +99,29 @@
-define(BITS, 128).
--record(state, {callgraph :: dialyzer_callgraph:callgraph(),
- codeserver :: dialyzer_codeserver:codeserver(),
- envs :: env_tab(),
- fun_tab :: fun_tab(),
- fun_homes :: dict:dict(label(), mfa()),
- plt :: dialyzer_plt:plt(),
- opaques :: [type()],
+%% Types with comment 'race' are due to dialyzer_races.erl.
+-record(state, {callgraph :: dialyzer_callgraph:callgraph()
+ | 'undefined', % race
+ codeserver :: dialyzer_codeserver:codeserver()
+ | 'undefined', % race
+ envs :: env_tab()
+ | 'undefined', % race
+ fun_tab :: fun_tab()
+ | 'undefined', % race
+ fun_homes :: dict:dict(label(), mfa())
+ | 'undefined', % race
+ plt :: dialyzer_plt:plt()
+ | 'undefined', % race
+ opaques :: [type()]
+ | 'undefined', % race
races = dialyzer_races:new() :: dialyzer_races:races(),
records = dict:new() :: types(),
- tree_map :: dict:dict(label(), cerl:cerl()),
+ tree_map :: dict:dict(label(), cerl:cerl())
+ | 'undefined', % race
warning_mode = false :: boolean(),
warnings = [] :: [raw_warning()],
- work :: {[_], [_], sets:set()},
+ work :: {[_], [_], sets:set()}
+ | 'undefined', % race
module :: module(),
curr_fun :: curr_fun()
}).
diff --git a/lib/dialyzer/src/dialyzer_gui_wx.erl b/lib/dialyzer/src/dialyzer_gui_wx.erl
index ff54a91ce1..9f344d87ff 100644
--- a/lib/dialyzer/src/dialyzer_gui_wx.erl
+++ b/lib/dialyzer/src/dialyzer_gui_wx.erl
@@ -2,7 +2,7 @@
%%------------------------------------------------------------------------
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2009-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2009-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -52,7 +52,6 @@
add_dir :: wx:wx_object(),
add_rec :: wx:wx_object(),
chosen_box :: wx:wx_object(),
- analysis_pid :: pid(),
del_file :: wx:wx_object(),
doc_plt :: dialyzer_plt:plt(),
clear_chosen :: wx:wx_object(),
@@ -72,11 +71,11 @@
stop :: wx:wx_object(),
frame :: wx:wx_object(),
warnings_box :: wx:wx_object(),
- explanation_box :: wx:wx_object(),
+ explanation_box :: wx:wx_object() | 'undefined',
wantedWarnings :: list(),
rawWarnings :: list(),
- backend_pid :: pid(),
- expl_pid :: pid()}).
+ backend_pid :: pid() | 'undefined',
+ expl_pid :: pid() | 'undefined'}).
%%------------------------------------------------------------------------
diff --git a/lib/dialyzer/src/dialyzer_races.erl b/lib/dialyzer/src/dialyzer_races.erl
index 39de071bde..bb43d1dcb8 100644
--- a/lib/dialyzer/src/dialyzer_races.erl
+++ b/lib/dialyzer/src/dialyzer_races.erl
@@ -2,7 +2,7 @@
%%-----------------------------------------------------------------------
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2014. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -92,27 +92,28 @@
-type race_warn_tag() :: ?WARN_WHEREIS_REGISTER | ?WARN_WHEREIS_UNREGISTER
| ?WARN_ETS_LOOKUP_INSERT | ?WARN_MNESIA_DIRTY_READ_WRITE.
--record(beg_clause, {arg :: var_to_map1(),
- pats :: var_to_map1(),
- guard :: cerl:cerl()}).
--record(end_clause, {arg :: var_to_map1(),
- pats :: var_to_map1(),
- guard :: cerl:cerl()}).
+-record(beg_clause, {arg :: var_to_map1() | 'undefined',
+ pats :: var_to_map1() | 'undefined',
+ guard :: cerl:cerl() | 'undefined'}).
+-record(end_clause, {arg :: var_to_map1() | 'undefined',
+ pats :: var_to_map1() | 'undefined',
+ guard :: cerl:cerl() | 'undefined'}).
-record(end_case, {clauses :: [#end_clause{}]}).
--record(curr_fun, {status :: 'in' | 'out',
- mfa :: dialyzer_callgraph:mfa_or_funlbl(),
- label :: label(),
- def_vars :: [core_vars()],
- arg_types :: [erl_types:erl_type()],
- call_vars :: [core_vars()],
- var_map :: dict:dict()}).
+-record(curr_fun, {status :: 'in' | 'out' | 'undefined',
+ mfa :: dialyzer_callgraph:mfa_or_funlbl()
+ | 'undefined',
+ label :: label() | 'undefined',
+ def_vars :: [core_vars()] | 'undefined',
+ arg_types :: [erl_types:erl_type()] | 'undefined',
+ call_vars :: [core_vars()] | 'undefined',
+ var_map :: dict:dict() | 'undefined'}).
-record(dep_call, {call_name :: dep_calls(),
- args :: args(),
+ args :: args() | 'undefined',
arg_types :: [erl_types:erl_type()],
vars :: [core_vars()],
state :: dialyzer_dataflow:state(),
file_line :: file_line(),
- var_map :: dict:dict()}).
+ var_map :: dict:dict() | 'undefined'}).
-record(fun_call, {caller :: dialyzer_callgraph:mfa_or_funlbl(),
callee :: dialyzer_callgraph:mfa_or_funlbl(),
arg_types :: [erl_types:erl_type()],
@@ -121,7 +122,7 @@
arg :: var_to_map1()}).
-record(warn_call, {call_name :: warn_calls(),
args :: args(),
- var_map :: dict:dict()}).
+ var_map :: dict:dict() | 'undefined'}).
-type case_tags() :: 'beg_case' | #beg_clause{} | #end_clause{} | #end_case{}.
-type code() :: [#dep_call{} | #fun_call{} | #warn_call{} |
@@ -139,8 +140,9 @@
fun_mfa :: dialyzer_callgraph:mfa_or_funlbl(),
fun_label :: label()}).
--record(races, {curr_fun :: dialyzer_callgraph:mfa_or_funlbl(),
- curr_fun_label :: label(),
+-record(races, {curr_fun :: dialyzer_callgraph:mfa_or_funlbl()
+ | 'undefined',
+ curr_fun_label :: label() | 'undefined',
curr_fun_args = 'empty' :: core_args(),
new_table = 'no_t' :: table(),
race_list = [] :: code(),
diff --git a/lib/dialyzer/src/dialyzer_succ_typings.erl b/lib/dialyzer/src/dialyzer_succ_typings.erl
index 18f02e6742..987da3aecf 100644
--- a/lib/dialyzer/src/dialyzer_succ_typings.erl
+++ b/lib/dialyzer/src/dialyzer_succ_typings.erl
@@ -2,7 +2,7 @@
%%-----------------------------------------------------------------------
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2006-2014. All Rights Reserved.
+%% Copyright Ericsson AB 2006-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -134,7 +134,6 @@ get_refined_success_typings(SCCs, #st{callgraph = Callgraph,
end
end.
--type doc_plt() :: 'undefined' | dialyzer_plt:plt().
-spec get_warnings(dialyzer_callgraph:callgraph(), dialyzer_plt:plt(),
doc_plt(), dialyzer_codeserver:codeserver(),
dialyzer_timing:timing_server(), [solver()], pid()) ->
diff --git a/lib/dialyzer/src/dialyzer_typesig.erl b/lib/dialyzer/src/dialyzer_typesig.erl
index 0b8b244cc9..5f0881bbcd 100644
--- a/lib/dialyzer/src/dialyzer_typesig.erl
+++ b/lib/dialyzer/src/dialyzer_typesig.erl
@@ -68,7 +68,7 @@
-type type_var() :: erl_types:erl_type(). %% actually: {'c','var',_,_}
-record(fun_var, {'fun' :: fun((_) -> erl_types:erl_type()), deps :: [dep()],
- origin :: integer()}).
+ origin :: integer() | 'undefined'}).
-type constr_op() :: 'eq' | 'sub'.
-type fvar_or_type() :: #fun_var{} | erl_types:erl_type().
@@ -83,9 +83,9 @@
-record(constraint_list, {type :: 'conj' | 'disj',
list :: [constr()],
deps :: [dep()],
- masks :: [{dep(),[non_neg_integer()]}] |
- {'d',dict:dict(dep(), [non_neg_integer()])},
- id :: {'list', dep()}}).
+ masks = [] :: [{dep(),[non_neg_integer()]}] |
+ {'d',dict:dict(dep(), [non_neg_integer()])},
+ id :: {'list', dep()} | 'undefined'}).
-type constraint_list() :: #constraint_list{}.
@@ -104,7 +104,8 @@
-type dict_or_ets() :: {'d', prop_types()} | {'e', ets:tid()}.
--record(state, {callgraph :: dialyzer_callgraph:callgraph(),
+-record(state, {callgraph :: dialyzer_callgraph:callgraph()
+ | 'undefined',
cs = [] :: [constr()],
cmap = {'d', dict:new()} :: dict_or_ets(),
fun_map = [] :: typesig_funmap(),
@@ -116,7 +117,8 @@
cerl:c_fun()),
next_label = 0 :: label(),
self_rec :: 'false' | erl_types:erl_type(),
- plt :: dialyzer_plt:plt(),
+ plt :: dialyzer_plt:plt()
+ | 'undefined',
prop_types = {'d', dict:new()} :: dict_or_ets(),
records = dict:new() :: types(),
scc = [] :: [type_var()],
@@ -1746,7 +1748,10 @@ minimize_state(#state{
fun_arities = FunArities,
self_rec = SelfRec,
prop_types = {e, ETSPropTypes},
- solvers = Solvers
+ solvers = Solvers,
+ callgraph = undefined,
+ plt = undefined,
+ mfas = []
}.
dispose_state(#state{cmap = {e, ETSCMap},
@@ -2884,8 +2889,7 @@ mk_constraint(Lhs, Op, Rhs) ->
case t_is_any(Lhs) orelse constraint_opnd_is_any(Rhs) of
false ->
Deps = find_constraint_deps([Lhs, Rhs]),
- C0 = mk_constraint_1(Lhs, Op, Rhs),
- C = C0#constraint{deps = Deps},
+ C = mk_constraint_1(Lhs, Op, Rhs, Deps),
case Deps =:= [] of
true ->
%% This constraint is constant. Solve it immediately.
@@ -2903,8 +2907,7 @@ mk_constraint(Lhs, Op, Rhs) ->
end.
mk_constraint_any(Op) ->
- C = mk_constraint_1(t_any(), Op, t_any()),
- C#constraint{deps = []}.
+ mk_constraint_1(t_any(), Op, t_any(), []).
%% the following function is used so that we do not call
%% erl_types:t_is_any/1 with a term other than an erl_type()
@@ -2952,12 +2955,12 @@ find_constraint_deps([Type|Tail], Acc) ->
find_constraint_deps([], Acc) ->
lists:flatten(Acc).
-mk_constraint_1(Lhs, eq, Rhs) when Lhs < Rhs ->
- #constraint{lhs = Lhs, op = eq, rhs = Rhs};
-mk_constraint_1(Lhs, eq, Rhs) ->
- #constraint{lhs = Rhs, op = eq, rhs = Lhs};
-mk_constraint_1(Lhs, Op, Rhs) ->
- #constraint{lhs = Lhs, op = Op, rhs = Rhs}.
+mk_constraint_1(Lhs, eq, Rhs, Deps) when Lhs < Rhs ->
+ #constraint{lhs = Lhs, op = eq, rhs = Rhs, deps = Deps};
+mk_constraint_1(Lhs, eq, Rhs, Deps) ->
+ #constraint{lhs = Rhs, op = eq, rhs = Lhs, deps = Deps};
+mk_constraint_1(Lhs, Op, Rhs, Deps) ->
+ #constraint{lhs = Lhs, op = Op, rhs = Rhs, deps = Deps}.
mk_constraints([Lhs|LhsTail], Op, [Rhs|RhsTail]) ->
[mk_constraint(Lhs, Op, Rhs) |
diff --git a/lib/dialyzer/src/dialyzer_worker.erl b/lib/dialyzer/src/dialyzer_worker.erl
index 4be93c75bf..979e3a621d 100644
--- a/lib/dialyzer/src/dialyzer_worker.erl
+++ b/lib/dialyzer/src/dialyzer_worker.erl
@@ -31,10 +31,11 @@
-type coordinator() :: dialyzer_coordinator:coordinator().
-type init_data() :: dialyzer_coordinator:init_data().
-type result() :: dialyzer_coordinator:result().
+-type job() :: dialyzer_coordinator:job().
-record(state, {
mode :: mode(),
- job :: mfa_or_funlbl() | file:filename(),
+ job :: job(),
coordinator :: coordinator(),
init_data :: init_data(),
depends_on = [] :: list()
@@ -52,7 +53,7 @@
%%--------------------------------------------------------------------
--spec launch(mode(), [mfa_or_funlbl()], init_data(), coordinator()) -> worker().
+-spec launch(mode(), job(), init_data(), coordinator()) -> worker().
launch(Mode, Job, InitData, Coordinator) ->
State = #state{mode = Mode,
@@ -174,7 +175,7 @@ collect_warnings(#state{job = Job, init_data = InitData}) ->
-type extra() :: label() | 'unused'.
--spec sequential(mode(), [mfa_or_funlbl()], init_data(), extra()) -> result().
+-spec sequential(mode(), job(), init_data(), extra()) -> result().
sequential('compile', Job, InitData, Extra) ->
case dialyzer_analysis_callgraph:start_compilation(Job, InitData) of
diff --git a/lib/dialyzer/test/behaviour_SUITE_data/results/callbacks_and_specs b/lib/dialyzer/test/behaviour_SUITE_data/results/callbacks_and_specs
index 33d135048e..38999e8919 100644
--- a/lib/dialyzer/test/behaviour_SUITE_data/results/callbacks_and_specs
+++ b/lib/dialyzer/test/behaviour_SUITE_data/results/callbacks_and_specs
@@ -1,5 +1,5 @@
-my_callbacks_wrong.erl:26: The return type #state{parent::'undefined' | pid(),status::'closed' | 'init' | 'open',subscribe::[{pid(),integer()}],counter::integer()} in the specification of callback_init/1 is not a subtype of {'ok',_}, which is the expected return type for the callback of my_behaviour behaviour
-my_callbacks_wrong.erl:28: The inferred return type of callback_init/1 (#state{parent::'undefined' | pid(),status::'init',subscribe::[],counter::1}) has nothing in common with {'ok',_}, which is the expected return type for the callback of my_behaviour behaviour
-my_callbacks_wrong.erl:30: The return type {'reply',#state{parent::'undefined' | pid(),status::'closed' | 'init' | 'open',subscribe::[{pid(),integer()}],counter::integer()}} in the specification of callback_cast/3 is not a subtype of {'noreply',_}, which is the expected return type for the callback of my_behaviour behaviour
+my_callbacks_wrong.erl:26: The return type #state{parent::pid(),status::'closed' | 'init' | 'open',subscribe::[{pid(),integer()}],counter::integer()} in the specification of callback_init/1 is not a subtype of {'ok',_}, which is the expected return type for the callback of my_behaviour behaviour
+my_callbacks_wrong.erl:28: The inferred return type of callback_init/1 (#state{parent::pid(),status::'init',subscribe::[],counter::1}) has nothing in common with {'ok',_}, which is the expected return type for the callback of my_behaviour behaviour
+my_callbacks_wrong.erl:30: The return type {'reply',#state{parent::pid(),status::'closed' | 'init' | 'open',subscribe::[{pid(),integer()}],counter::integer()}} in the specification of callback_cast/3 is not a subtype of {'noreply',_}, which is the expected return type for the callback of my_behaviour behaviour
my_callbacks_wrong.erl:39: The specified type for the 2nd argument of callback_call/3 (atom()) is not a supertype of pid(), which is expected type for this argument in the callback of the my_behaviour behaviour
diff --git a/lib/dialyzer/test/opaque_SUITE_data/results/crash b/lib/dialyzer/test/opaque_SUITE_data/results/crash
index 69bdc00257..d63389f79c 100644
--- a/lib/dialyzer/test/opaque_SUITE_data/results/crash
+++ b/lib/dialyzer/test/opaque_SUITE_data/results/crash
@@ -1,6 +1,6 @@
-crash_1.erl:45: Record construction #targetlist{list::[]} violates the declared type of field list::'undefined' | crash_1:target()
-crash_1.erl:48: The call crash_1:get_using_branch2(Branch::maybe_improper_list(),L::'undefined' | crash_1:target()) will never return since it differs in the 2nd argument from the success typing arguments: (any(),maybe_improper_list())
-crash_1.erl:50: The pattern <_Branch, []> can never match the type <maybe_improper_list(),'undefined' | crash_1:target()>
-crash_1.erl:52: The pattern <Branch, [H = {'target', _, _} | _T]> can never match the type <maybe_improper_list(),'undefined' | crash_1:target()>
-crash_1.erl:54: The pattern <Branch, [{'target', _, _} | T]> can never match the type <maybe_improper_list(),'undefined' | crash_1:target()>
+crash_1.erl:45: Record construction #targetlist{list::[]} violates the declared type of field list::crash_1:target()
+crash_1.erl:48: The call crash_1:get_using_branch2(Branch::maybe_improper_list(),L::crash_1:target()) will never return since it differs in the 2nd argument from the success typing arguments: (any(),maybe_improper_list())
+crash_1.erl:50: The pattern <_Branch, []> can never match the type <maybe_improper_list(),crash_1:target()>
+crash_1.erl:52: The pattern <Branch, [H = {'target', _, _} | _T]> can never match the type <maybe_improper_list(),crash_1:target()>
+crash_1.erl:54: The pattern <Branch, [{'target', _, _} | T]> can never match the type <maybe_improper_list(),crash_1:target()>
diff --git a/lib/dialyzer/test/opaque_SUITE_data/results/simple b/lib/dialyzer/test/opaque_SUITE_data/results/simple
index 1a7a139d6e..5f58f69730 100644
--- a/lib/dialyzer/test/opaque_SUITE_data/results/simple
+++ b/lib/dialyzer/test/opaque_SUITE_data/results/simple
@@ -18,7 +18,7 @@ rec_api.erl:104: Matching of pattern {'r2', 10} tagged with a record name violat
rec_api.erl:113: The attempt to match a term of type #r3{f1::queue:queue(_)} against the pattern {'r3', 'a'} breaks the opaqueness of queue:queue(_)
rec_api.erl:118: Record construction #r3{f1::10} violates the declared type of field f1::queue:queue(_)
rec_api.erl:123: The attempt to match a term of type #r3{f1::10} against the pattern {'r3', 10} breaks the opaqueness of queue:queue(_)
-rec_api.erl:24: Record construction #r1{f1::10} violates the declared type of field f1::'undefined' | rec_api:a()
+rec_api.erl:24: Record construction #r1{f1::10} violates the declared type of field f1::rec_api:a()
rec_api.erl:29: Matching of pattern {'r1', 10} tagged with a record name violates the declared type of #r1{f1::10}
rec_api.erl:33: The attempt to match a term of type rec_adt:r1() against the pattern {'r1', 'a'} breaks the opaqueness of the term
rec_api.erl:35: Invalid type specification for function rec_api:adt_t1/1. The success typing is (#r1{f1::'a'}) -> #r1{f1::'a'}
diff --git a/lib/dialyzer/test/r9c_SUITE_data/results/mnesia b/lib/dialyzer/test/r9c_SUITE_data/results/mnesia
index b73943422a..1dc5a105bf 100644
--- a/lib/dialyzer/test/r9c_SUITE_data/results/mnesia
+++ b/lib/dialyzer/test/r9c_SUITE_data/results/mnesia
@@ -35,6 +35,6 @@ mnesia_schema.erl:1258: Guard test FromS::'disc_copies' | 'disc_only_copies' | '
mnesia_schema.erl:1639: The pattern {'false', 'mandatory'} can never match the type {'false','optional'}
mnesia_schema.erl:2434: The variable Reason can never match since previous clauses completely covered the type {'error',_} | {'ok',_}
mnesia_schema.erl:451: Guard test UseDirAnyway::'false' == 'true' can never succeed
-mnesia_text.erl:180: The variable T can never match since previous clauses completely covered the type {'error',{integer(),atom() | tuple(),_}} | {'ok',_}
+mnesia_text.erl:180: The variable T can never match since previous clauses completely covered the type {'error',{non_neg_integer(),atom() | tuple(),_}} | {'ok',_}
mnesia_tm.erl:1522: Function commit_participant/5 has no local return
mnesia_tm.erl:2169: Function system_terminate/4 has no local return
diff --git a/lib/dialyzer/test/small_SUITE_data/results/bif1 b/lib/dialyzer/test/small_SUITE_data/results/bif1
new file mode 100644
index 0000000000..289b6f821f
--- /dev/null
+++ b/lib/dialyzer/test/small_SUITE_data/results/bif1
@@ -0,0 +1,3 @@
+
+bif1.erl:13: Function string_chars/0 has no local return
+bif1.erl:16: The call string:chars(S::65,10,L2::bif1_adt:s()) contains an opaque term as 3rd argument when terms of different types are expected in these positions
diff --git a/lib/dialyzer/test/small_SUITE_data/results/fun_arity b/lib/dialyzer/test/small_SUITE_data/results/fun_arity
new file mode 100644
index 0000000000..280f5490d0
--- /dev/null
+++ b/lib/dialyzer/test/small_SUITE_data/results/fun_arity
@@ -0,0 +1,35 @@
+
+fun_arity.erl:100: Fun application will fail since _cor1 :: fun(() -> any()) is not a function of arity 1
+fun_arity.erl:100: Function 'Mfa_0_ko'/1 has no local return
+fun_arity.erl:104: Fun application will fail since _cor1 :: fun((_) -> any()) is not a function of arity 0
+fun_arity.erl:104: Function 'Mfa_1_ko'/1 has no local return
+fun_arity.erl:111: Fun application will fail since _cor1 :: fun(() -> any()) is not a function of arity 1
+fun_arity.erl:111: Function mFa_0_ko/1 has no local return
+fun_arity.erl:115: Fun application will fail since _cor1 :: fun((_) -> any()) is not a function of arity 0
+fun_arity.erl:115: Function mFa_1_ko/1 has no local return
+fun_arity.erl:122: Fun application will fail since _cor2 :: fun(() -> any()) is not a function of arity 1
+fun_arity.erl:122: Function 'MFa_0_ko'/2 has no local return
+fun_arity.erl:126: Fun application will fail since _cor2 :: fun((_) -> any()) is not a function of arity 0
+fun_arity.erl:126: Function 'MFa_1_ko'/2 has no local return
+fun_arity.erl:35: Fun application will fail since _cor0 :: fun(() -> 'ok') is not a function of arity 1
+fun_arity.erl:35: Function f_0_ko/0 has no local return
+fun_arity.erl:39: Fun application will fail since _cor0 :: fun((_) -> 'ok') is not a function of arity 0
+fun_arity.erl:39: Function f_1_ko/0 has no local return
+fun_arity.erl:48: Fun application will fail since _cor0 :: fun(() -> 'ok') is not a function of arity 1
+fun_arity.erl:48: Function fa_0_ko/0 has no local return
+fun_arity.erl:53: Fun application will fail since _cor0 :: fun((_) -> 'ok') is not a function of arity 0
+fun_arity.erl:53: Function fa_1_ko/0 has no local return
+fun_arity.erl:63: Fun application will fail since _cor0 :: fun(() -> any()) is not a function of arity 1
+fun_arity.erl:63: Function mfa_0_ko/0 has no local return
+fun_arity.erl:68: Fun application will fail since _cor0 :: fun((_) -> any()) is not a function of arity 0
+fun_arity.erl:68: Function mfa_1_ko/0 has no local return
+fun_arity.erl:76: Fun application will fail since _cor0 :: fun(() -> any()) is not a function of arity 1
+fun_arity.erl:76: Function mfa_ne_0_ko/0 has no local return
+fun_arity.erl:78: Function mf_ne/0 will never be called
+fun_arity.erl:81: Fun application will fail since _cor0 :: fun((_) -> any()) is not a function of arity 0
+fun_arity.erl:81: Function mfa_ne_1_ko/0 has no local return
+fun_arity.erl:83: Function mf_ne/1 will never be called
+fun_arity.erl:89: Fun application will fail since _cor0 :: fun(() -> any()) is not a function of arity 1
+fun_arity.erl:89: Function mfa_nd_0_ko/0 has no local return
+fun_arity.erl:93: Fun application will fail since _cor0 :: fun((_) -> any()) is not a function of arity 0
+fun_arity.erl:93: Function mfa_nd_1_ko/0 has no local return
diff --git a/lib/dialyzer/test/small_SUITE_data/results/literals b/lib/dialyzer/test/small_SUITE_data/results/literals
index 03e161ca71..222d2c0cdb 100644
--- a/lib/dialyzer/test/small_SUITE_data/results/literals
+++ b/lib/dialyzer/test/small_SUITE_data/results/literals
@@ -1,14 +1,14 @@
literals.erl:11: Function t1/0 has no local return
-literals.erl:12: Record construction #r{id::'a'} violates the declared type of field id::'integer' | 'undefined'
+literals.erl:12: Record construction #r{id::'a'} violates the declared type of field id::'integer'
literals.erl:14: Function t2/0 has no local return
-literals.erl:15: Record construction #r{id::'a'} violates the declared type of field id::'integer' | 'undefined'
+literals.erl:15: Record construction #r{id::'a'} violates the declared type of field id::'integer'
literals.erl:17: Function t3/0 has no local return
-literals.erl:18: Record construction #r{id::'a'} violates the declared type of field id::'integer' | 'undefined'
-literals.erl:21: Record construction #r{id::'a'} violates the declared type of field id::'integer' | 'undefined'
+literals.erl:18: Record construction #r{id::'a'} violates the declared type of field id::'integer'
+literals.erl:21: Record construction #r{id::'a'} violates the declared type of field id::'integer'
literals.erl:23: Function m1/1 has no local return
-literals.erl:23: Matching of pattern {'r', 'a'} tagged with a record name violates the declared type of #r{id::'integer' | 'undefined'}
+literals.erl:23: Matching of pattern {'r', 'a'} tagged with a record name violates the declared type of #r{id::'integer'}
literals.erl:26: Function m2/1 has no local return
-literals.erl:26: Matching of pattern {'r', 'a'} tagged with a record name violates the declared type of #r{id::'integer' | 'undefined'}
+literals.erl:26: Matching of pattern {'r', 'a'} tagged with a record name violates the declared type of #r{id::'integer'}
literals.erl:29: Function m3/1 has no local return
literals.erl:29: The pattern {{'r', 'a'}} can never match the type any()
diff --git a/lib/dialyzer/test/small_SUITE_data/results/record_creation_diffs b/lib/dialyzer/test/small_SUITE_data/results/record_creation_diffs
index f00c4b10ff..c971935bbf 100644
--- a/lib/dialyzer/test/small_SUITE_data/results/record_creation_diffs
+++ b/lib/dialyzer/test/small_SUITE_data/results/record_creation_diffs
@@ -1,3 +1,3 @@
record_creation_diffs.erl:10: Function foo/1 has no local return
-record_creation_diffs.erl:11: Record construction #bar{some_list::{'this','is','a','tuple'}} violates the declared type of field some_list::'undefined' | [any()]
+record_creation_diffs.erl:11: Record construction #bar{some_list::{'this','is','a','tuple'}} violates the declared type of field some_list::[any()]
diff --git a/lib/dialyzer/test/small_SUITE_data/results/record_pat b/lib/dialyzer/test/small_SUITE_data/results/record_pat
index a46be6c451..8317ea041a 100644
--- a/lib/dialyzer/test/small_SUITE_data/results/record_pat
+++ b/lib/dialyzer/test/small_SUITE_data/results/record_pat
@@ -1,2 +1,2 @@
-record_pat.erl:14: Matching of pattern {'foo', 'baz'} tagged with a record name violates the declared type of #foo{bar::'undefined' | integer()}
+record_pat.erl:14: Matching of pattern {'foo', 'baz'} tagged with a record name violates the declared type of #foo{bar::integer()}
diff --git a/lib/dialyzer/test/small_SUITE_data/results/relevant_record_warning b/lib/dialyzer/test/small_SUITE_data/results/relevant_record_warning
index 2e417e1b2a..ea3ac92d96 100644
--- a/lib/dialyzer/test/small_SUITE_data/results/relevant_record_warning
+++ b/lib/dialyzer/test/small_SUITE_data/results/relevant_record_warning
@@ -1,3 +1,3 @@
relevant_record_warning.erl:22: Function test/1 has no local return
-relevant_record_warning.erl:23: Record construction #r{field::<<_:8>>} violates the declared type of field field::'binary' | 'undefined'
+relevant_record_warning.erl:23: Record construction #r{field::<<_:8>>} violates the declared type of field field::'binary'
diff --git a/lib/dialyzer/test/small_SUITE_data/results/undefined b/lib/dialyzer/test/small_SUITE_data/results/undefined
new file mode 100644
index 0000000000..9daa8640d3
--- /dev/null
+++ b/lib/dialyzer/test/small_SUITE_data/results/undefined
@@ -0,0 +1,2 @@
+
+r.erl:16: Record construction #r{a::{'fi'},b::{'a','b'},c::[],d::'undefined',e::[],f::'undefined'} violates the declared type of field b::[any()] and d::[any()] and f::[any()]
diff --git a/lib/dialyzer/test/small_SUITE_data/src/bif1/bif1.erl b/lib/dialyzer/test/small_SUITE_data/src/bif1/bif1.erl
new file mode 100644
index 0000000000..bc746538d3
--- /dev/null
+++ b/lib/dialyzer/test/small_SUITE_data/src/bif1/bif1.erl
@@ -0,0 +1,16 @@
+-module(bif1).
+
+%% Other set of warnings due to removed of functions from
+%% erl_bif_types.
+
+-export([ets_rename/0, string_chars/0]).
+
+ets_rename() ->
+ A = ets:new(fipp, []),
+ true = not is_atom(A),
+ ets:rename(A, fopp). % No warning
+
+string_chars() ->
+ L2 = bif1_adt:opaque_string(),
+ S = $A,
+ string:chars(S, 10, L2). % Warning
diff --git a/lib/dialyzer/test/small_SUITE_data/src/bif1/bif1_adt.erl b/lib/dialyzer/test/small_SUITE_data/src/bif1/bif1_adt.erl
new file mode 100644
index 0000000000..01b0bccc68
--- /dev/null
+++ b/lib/dialyzer/test/small_SUITE_data/src/bif1/bif1_adt.erl
@@ -0,0 +1,12 @@
+-module(bif1_adt).
+
+-export([opaque_string/0]).
+
+-export_type([s/0]).
+
+-opaque s() :: string().
+
+-spec opaque_string() -> s().
+
+opaque_string() ->
+ "string".
diff --git a/lib/dialyzer/test/small_SUITE_data/src/big_external_type.erl b/lib/dialyzer/test/small_SUITE_data/src/big_external_type.erl
index ab84e94106..9ad4810a5e 100644
--- a/lib/dialyzer/test/small_SUITE_data/src/big_external_type.erl
+++ b/lib/dialyzer/test/small_SUITE_data/src/big_external_type.erl
@@ -36,7 +36,7 @@
%% Start of Abstract Format
--type line() :: erl_scan:line().
+-type line() :: erl_anno:line().
-export_type([af_record_index/0, af_record_field/1, af_record_name/0,
af_field_name/0, af_function_decl/0]).
@@ -332,8 +332,8 @@
%% End of Abstract Format
-type error_description() :: term().
--type error_info() :: {erl_scan:line(), module(), error_description()}.
--type token() :: {Tag :: atom(), Line :: erl_scan:line()}.
+-type error_info() :: {erl_anno:line(), module(), error_description()}.
+-type token() :: {Tag :: atom(), Line :: erl_scan:anno()}.
%% mkop(Op, Arg) -> {op,Line,Op,Arg}.
%% mkop(Left, Op, Right) -> {op,Line,Op,Left,Right}.
diff --git a/lib/dialyzer/test/small_SUITE_data/src/big_local_type.erl b/lib/dialyzer/test/small_SUITE_data/src/big_local_type.erl
index fc7c5241a8..fe567ff10d 100644
--- a/lib/dialyzer/test/small_SUITE_data/src/big_local_type.erl
+++ b/lib/dialyzer/test/small_SUITE_data/src/big_local_type.erl
@@ -36,7 +36,7 @@
%% Start of Abstract Format
--type line() :: erl_scan:line().
+-type line() :: erl_anno:line().
-export_type([af_module/0, af_export/0, af_import/0, af_fa_list/0,
af_compile/0, af_file/0, af_record_decl/0,
@@ -329,8 +329,8 @@
%% End of Abstract Format
-type error_description() :: term().
--type error_info() :: {erl_scan:line(), module(), error_description()}.
--type token() :: {Tag :: atom(), Line :: erl_scan:line()}.
+-type error_info() :: {erl_anno:line(), module(), error_description()}.
+-type token() :: {Tag :: atom(), Line :: erl_anno:line()}.
%% mkop(Op, Arg) -> {op,Line,Op,Arg}.
%% mkop(Left, Op, Right) -> {op,Line,Op,Left,Right}.
diff --git a/lib/dialyzer/test/small_SUITE_data/src/fun_arity.erl b/lib/dialyzer/test/small_SUITE_data/src/fun_arity.erl
new file mode 100644
index 0000000000..850d2fd331
--- /dev/null
+++ b/lib/dialyzer/test/small_SUITE_data/src/fun_arity.erl
@@ -0,0 +1,127 @@
+%%--------------------------------------------------------------------------
+%% Module which contains calls to funs of different arity.
+%%--------------------------------------------------------------------------
+-module(fun_arity).
+
+-export([f_0_ok/0, f_0_ko/0]).
+-export([f_1_ok/0, f_1_ko/0]).
+
+-export([fa_0_ok/0, fa_0_ko/0]).
+-export([fa_1_ok/0, fa_1_ko/0]).
+
+-export([mfa_0_ok/0, mfa_0_ko/0, mf/0]).
+-export([mfa_1_ok/0, mfa_1_ko/0, mf/1]).
+
+-export([mfa_ne_0_ok/0, mfa_ne_0_ko/0]).
+-export([mfa_ne_1_ok/0, mfa_ne_1_ko/0]).
+
+-export([mfa_nd_0_ok/0, mfa_nd_0_ko/0]).
+-export([mfa_nd_1_ok/0, mfa_nd_1_ko/0]).
+
+-export(['Mfa_0_ok'/1, 'Mfa_0_ko'/1]).
+-export(['Mfa_1_ok'/1, 'Mfa_1_ko'/1]).
+
+-export(['mFa_0_ok'/1, 'mFa_0_ko'/1]).
+-export(['mFa_1_ok'/1, 'mFa_1_ko'/1]).
+
+-export(['MFa_0_ok'/2, 'MFa_0_ko'/2]).
+-export(['MFa_1_ok'/2, 'MFa_1_ko'/2]).
+
+%%--------------------------------------------------------------------------
+
+%% Funs like "fun(...) -> ... end".
+
+f_0_ok() -> (fun_f_0())().
+f_0_ko() -> (fun_f_0())(1).
+fun_f_0() -> fun() -> ok end.
+
+f_1_ok() -> (fun_f_1())(1).
+f_1_ko() -> (fun_f_1())().
+fun_f_1() -> fun(_) -> ok end .
+
+%%--------------------------------------------------------------------------
+
+%% Funs like "fun F/A" when F is literal atom and A is literal
+%% non-negative integer.
+
+fa_0_ok() -> (fun_fa_0())().
+fa_0_ko() -> (fun_fa_0())(1).
+fun_fa_0() -> fun f/0.
+f() -> ok.
+
+fa_1_ok() -> (fun_fa_1())(1).
+fa_1_ko() -> (fun_fa_1())().
+fun_fa_1() -> fun f/1.
+f(_) -> ok.
+
+%%--------------------------------------------------------------------------
+
+%% Funs like "fun M:F/A" when M and F are literal atoms, A is literal
+%% non-negative integer and function is (defined and) exported.
+
+mfa_0_ok() -> (fun_mfa_0())().
+mfa_0_ko() -> (fun_mfa_0())(1).
+fun_mfa_0() -> fun ?MODULE:mf/0.
+mf() -> ok.
+
+mfa_1_ok() -> (fun_mfa_1())(1).
+mfa_1_ko() -> (fun_mfa_1())().
+fun_mfa_1() -> fun ?MODULE:mf/1.
+mf(_) -> ok.
+
+%% Funs like "fun M:F/A" when M and F are literal atoms, A is literal
+%% non-negative integer and function is defined but not exported.
+
+mfa_ne_0_ok() -> (fun_mfa_ne_0())().
+mfa_ne_0_ko() -> (fun_mfa_ne_0())(1).
+fun_mfa_ne_0() -> fun ?MODULE:mf_ne/0.
+mf_ne() -> ok.
+
+mfa_ne_1_ok() -> (fun_mfa_ne_1())(1).
+mfa_ne_1_ko() -> (fun_mfa_ne_1())().
+fun_mfa_ne_1() -> fun ?MODULE:mf_ne/1.
+mf_ne(_) -> ok.
+
+%% Funs like "fun M:F/A" when M and F are literal atoms, A is literal
+%% non-negative integer and function is not defined.
+
+mfa_nd_0_ok() -> (fun_mfa_nd_0())().
+mfa_nd_0_ko() -> (fun_mfa_nd_0())(1).
+fun_mfa_nd_0() -> fun ?MODULE:mf_nd/0.
+
+mfa_nd_1_ok() -> (fun_mfa_nd_1())(1).
+mfa_nd_1_ko() -> (fun_mfa_nd_1())().
+fun_mfa_nd_1() -> fun ?MODULE:mf_nd/1.
+
+%% Funs like "fun M:F/A" when M is variable, F is literal atoms and A
+%% is literal non-negative integer.
+
+'Mfa_0_ok'(M) -> ('fun_Mfa_0'(M))().
+'Mfa_0_ko'(M) -> ('fun_Mfa_0'(M))(1).
+'fun_Mfa_0'(M) -> fun M:f/0.
+
+'Mfa_1_ok'(M) -> ('fun_Mfa_1'(M))(1).
+'Mfa_1_ko'(M) -> ('fun_Mfa_1'(M))().
+'fun_Mfa_1'(M) -> fun M:f/1.
+
+%% Funs like "fun M:F/A" when M is literal atom, F is variable and A
+%% is literal non-negative integer.
+
+'mFa_0_ok'(F) -> ('fun_mFa_0'(F))().
+'mFa_0_ko'(F) -> ('fun_mFa_0'(F))(1).
+'fun_mFa_0'(F) -> fun ?MODULE:F/0.
+
+'mFa_1_ok'(F) -> ('fun_mFa_1'(F))(1).
+'mFa_1_ko'(F) -> ('fun_mFa_1'(F))().
+'fun_mFa_1'(F) -> fun ?MODULE:F/1.
+
+%% Funs like "fun M:F/A" when M and F are variables and A is literal
+%% non-negative integer.
+
+'MFa_0_ok'(M, F) -> ('fun_MFa_0'(M, F))().
+'MFa_0_ko'(M, F) -> ('fun_MFa_0'(M, F))(1).
+'fun_MFa_0'(M, F) -> fun M:F/0.
+
+'MFa_1_ok'(M, F) -> ('fun_MFa_1'(M, F))(1).
+'MFa_1_ko'(M, F) -> ('fun_MFa_1'(M, F))().
+'fun_MFa_1'(M, F) -> fun M:F/1.
diff --git a/lib/dialyzer/test/small_SUITE_data/src/trec.erl b/lib/dialyzer/test/small_SUITE_data/src/trec.erl
index 06706162c1..516358f7c6 100644
--- a/lib/dialyzer/test/small_SUITE_data/src/trec.erl
+++ b/lib/dialyzer/test/small_SUITE_data/src/trec.erl
@@ -8,7 +8,7 @@
-module(trec).
-export([test/0, mk_foo_exp/2]).
--record(foo, {a :: integer(), b :: [atom()]}).
+-record(foo, {a :: integer() | 'undefined', b :: [atom()]}).
%%
%% For these functions we currently get the following warnings:
diff --git a/lib/dialyzer/test/small_SUITE_data/undefined.erl b/lib/dialyzer/test/small_SUITE_data/undefined.erl
new file mode 100644
index 0000000000..8549f2e161
--- /dev/null
+++ b/lib/dialyzer/test/small_SUITE_data/undefined.erl
@@ -0,0 +1,29 @@
+-module(undefined).
+
+-export([t/0]).
+
+%% As of OTP 19.0 'undefined' is no longer added to fields with a type
+%% declaration but without an initializer. The pretty printing of
+%% records (erl_types:t_to_string()) is updated to reflect this: if a
+%% field is of type 'undefined', it is output if 'undefined' is not in
+%% the declared type of the field. (It used to be the case that the
+%% singleton type 'undefined' was never output.)
+%%
+%% One consequence is shown by the example below: the warning about
+%% the record construction violating the the declared type shows
+%% #r{..., d::'undefined', ...} which is meant to be of help to the
+%% user, who could otherwise get confused the first time (s)he gets
+%% confronted by the warning.
+
+-record(r,
+ {
+ a = {fi},
+ b = {a,b} :: list(), % violation
+ c = {a,b} :: list(),
+ d :: list(), % violation
+ e = [] :: list(),
+ f = undefined :: list() % violation
+ }).
+
+t() ->
+ #r{c = []}.
diff --git a/lib/dialyzer/vsn.mk b/lib/dialyzer/vsn.mk
index 48e0830109..9480f17f51 100644
--- a/lib/dialyzer/vsn.mk
+++ b/lib/dialyzer/vsn.mk
@@ -1 +1 @@
-DIALYZER_VSN = 2.8
+DIALYZER_VSN = 2.8.2
diff --git a/lib/diameter/doc/src/diameter.xml b/lib/diameter/doc/src/diameter.xml
index 47247bc2ff..61b7fd1337 100644
--- a/lib/diameter/doc/src/diameter.xml
+++ b/lib/diameter/doc/src/diameter.xml
@@ -913,6 +913,49 @@ Options <c>monitor</c> and <c>link</c> are ignored.</p>
Defaults to the empty list.</p>
</item>
+<marker id="strict_mbit"/>
+<tag><c>{strict_mbit, boolean()}</c></tag>
+<item>
+<p>
+Whether or not to regard an AVP setting the M-bit as erroneous when
+the command grammar in question does not explicitly allow the AVP.
+If <c>true</c> then such AVPs are regarded as 5001 errors,
+DIAMETER_AVP_UNSUPPORTED.
+If <c>false</c> then the M-bit is ignored and policing
+it becomes the receiver's responsibility.</p>
+
+<p>
+Defaults to <c>true</c>.</p>
+
+<warning>
+<p>
+RFC 6733 is unclear about the semantics of the M-bit.
+One the one hand, the CCF specification in section 3.2 documents AVP
+in a command grammar as meaning <b>any</b> arbitrary AVP; on the
+other hand, 1.3.4 states that AVPs setting the M-bit cannot be added
+to an existing command: the modified command must instead be
+placed in a new Diameter application.</p>
+<p>
+The reason for the latter is presumably interoperability:
+allowing arbitrary AVPs setting the M-bit in a command makes its
+interpretation implementation-dependent, since there's no
+guarantee that all implementations will understand the same set of
+arbitrary AVPs in the context of a given command.
+However, interpreting <c>AVP</c> in a command grammar as <b>any</b>
+AVP, regardless of M-bit, renders 1.3.4 meaningless, since the receiver
+can simply ignore any AVP it thinks isn't relevant, regardless of the
+sender's intent.</p>
+<p>
+Beware of confusing mandatory in the sense of the M-bit with mandatory
+in the sense of the command grammar.
+The former is a semantic requirement: that the receiver understand the
+semantics of the AVP in the context in question.
+The latter is a syntactic requirement: whether or not the AVP must
+occur in the message in question.</p>
+</warning>
+
+</item>
+
<marker id="string_decode"/>
<tag><c>{string_decode, boolean()}</c></tag>
<item>
diff --git a/lib/diameter/doc/src/notes.xml b/lib/diameter/doc/src/notes.xml
index c5f0d66f10..61bed37682 100644
--- a/lib/diameter/doc/src/notes.xml
+++ b/lib/diameter/doc/src/notes.xml
@@ -49,6 +49,41 @@ first.</p>
<list>
<item>
<p>
+ Fix relay encode of nested, Grouped AVPs.</p>
+ <p>
+ A fault in OTP-12475 caused encode to fail if the first
+ AVP in a Grouped AVP was itself Grouped.</p>
+ <p>
+ Own Id: OTP-12879 Aux Id: OTP-12475 </p>
+ </item>
+ <item>
+ <p>
+ Match acceptable peer addresses case insensitively.</p>
+ <p>
+ Regular expressions passed in an 'accept' tuple to
+ diameter_tcp or diameter_sctp inappropriately matched
+ case.</p>
+ <p>
+ Own Id: OTP-12902</p>
+ </item>
+ <item>
+ <p>
+ Fix diameter_watchdog function clause.</p>
+ <p>
+ OTP-12912 introduced an error with accepting transports
+ setting <c>{restrict_connections, false}</c>, causing
+ processes to fail when peer connections were terminated.</p>
+ <p>
+ Own Id: OTP-12969</p>
+ </item>
+ </list>
+ </section>
+
+
+ <section><title>Improvements and New Features</title>
+ <list>
+ <item>
+ <p>
Don't report 5005 (DIAMETER_AVP_MISSING) errors
unnecessarily.</p>
<p>
@@ -60,15 +95,6 @@ first.</p>
</item>
<item>
<p>
- Fix relay encode of nested, Grouped AVPs.</p>
- <p>
- A fault in OTP-12475 caused encode to fail if the first
- AVP in a Grouped AVP was itself Grouped.</p>
- <p>
- Own Id: OTP-12879 Aux Id: OTP-12475 </p>
- </item>
- <item>
- <p>
Improve decode performance.</p>
<p>
The time required to decode a message increased
@@ -79,16 +105,6 @@ first.</p>
</item>
<item>
<p>
- Match acceptable peer addresses case insensitively.</p>
- <p>
- Regular expressions passed in an 'accept' tuple to
- diameter_tcp or diameter_sctp inappropriately matched
- case.</p>
- <p>
- Own Id: OTP-12902</p>
- </item>
- <item>
- <p>
Improve watchdog and statistics performance.</p>
<p>
Inefficient use of timers contributed to poor performance
@@ -97,13 +113,24 @@ first.</p>
<p>
Own Id: OTP-12912</p>
</item>
+ <item>
+ <p>
+ Add service_opt() strict_mbit.</p>
+ <p>
+ There are differing opinions on whether or not reception
+ of an arbitrary AVP setting the M-bit is an error. The
+ default interpretation is strict: if a command grammar
+ doesn't explicitly allow an AVP setting the M-bit then
+ reception of such an AVP is regarded as an error. Setting
+ <c>{strict_mbit, false}</c> disables this check.</p>
+ <p>
+ Own Id: OTP-12947</p>
+ </item>
</list>
</section>
</section>
-<!-- ===================================================================== -->
-
<section><title>diameter 1.10</title>
<section><title>Fixed Bugs and Malfunctions</title>
diff --git a/lib/diameter/include/diameter_gen.hrl b/lib/diameter/include/diameter_gen.hrl
index 5624ee6626..611ad796a9 100644
--- a/lib/diameter/include/diameter_gen.hrl
+++ b/lib/diameter/include/diameter_gen.hrl
@@ -31,7 +31,10 @@
%% Key to a value in the process dictionary that determines whether or
%% not an unrecognized AVP setting the M-bit should be regarded as an
-%% error or not. See is_strict/0.
+%% error or not. See is_strict/0. This is only used to relax M-bit
+%% interpretation inside Grouped AVPs not setting the M-bit. The
+%% service_opt() strict_mbit can be used to disable the check
+%% globally.
-define(STRICT_KEY, strict).
%% Key that says whether or not we should do a best-effort decode
@@ -448,7 +451,8 @@ relax(_, _) ->
false.
is_strict() ->
- false /= getr(?STRICT_KEY).
+ diameter_codec:getopt(strict_mbit)
+ andalso false /= getr(?STRICT_KEY).
%% relax/1
%%
diff --git a/lib/diameter/src/base/diameter.erl b/lib/diameter/src/base/diameter.erl
index e82c2c168c..de88f6befd 100644
--- a/lib/diameter/src/base/diameter.erl
+++ b/lib/diameter/src/base/diameter.erl
@@ -312,6 +312,7 @@ call(SvcName, App, Message) ->
| {sequence, sequence() | evaluable()}
| {share_peers, remotes()}
| {string_decode, boolean()}
+ | {strict_mbit, boolean()}
| {incoming_maxlen, message_length()}
| {use_shared_peers, remotes()}
| {spawn_opt, list()}.
diff --git a/lib/diameter/src/base/diameter_codec.erl b/lib/diameter/src/base/diameter_codec.erl
index bcdc5b3005..1ea5357924 100644
--- a/lib/diameter/src/base/diameter_codec.erl
+++ b/lib/diameter/src/base/diameter_codec.erl
@@ -77,9 +77,10 @@ setopts(Opts)
when is_list(Opts) ->
lists:foreach(fun setopt/1, Opts).
-%% Decode stringish types to string()? The default true is for
-%% backwards compatibility.
-setopt({string_decode = K, false = B}) ->
+%% The default string_decode true is for backwards compatibility.
+setopt({K, false = B})
+ when K == string_decode;
+ K == strict_mbit ->
setopt(K, B);
%% Regard anything but the generated RFC 3588 dictionary as modern.
@@ -97,7 +98,8 @@ setopt(Key, Value) ->
getopt(Key) ->
case get({diameter, Key}) of
- undefined when Key == string_decode ->
+ undefined when Key == string_decode;
+ Key == strict_mbit ->
true;
undefined when Key == rfc ->
6733;
diff --git a/lib/diameter/src/base/diameter_config.erl b/lib/diameter/src/base/diameter_config.erl
index b7d8345b6c..702f11593a 100644
--- a/lib/diameter/src/base/diameter_config.erl
+++ b/lib/diameter/src/base/diameter_config.erl
@@ -647,6 +647,7 @@ make_config(SvcName, Opts) ->
{?NOMASK, sequence},
{nodes, restrict_connections},
{16#FFFFFF, incoming_maxlen},
+ {true, strict_mbit},
{true, string_decode},
{[], spawn_opt}]),
@@ -685,12 +686,14 @@ opt(K, false = B)
K == use_shared_peers;
K == monitor;
K == restrict_connections;
+ K == strict_mbit;
K == string_decode ->
B;
opt(K, true = B)
when K == share_peers;
K == use_shared_peers;
+ K == strict_mbit;
K == string_decode ->
B;
diff --git a/lib/diameter/src/base/diameter_peer_fsm.erl b/lib/diameter/src/base/diameter_peer_fsm.erl
index 2b23183d18..fb874013a3 100644
--- a/lib/diameter/src/base/diameter_peer_fsm.erl
+++ b/lib/diameter/src/base/diameter_peer_fsm.erl
@@ -117,7 +117,7 @@
parent :: pid(), %% watchdog process
transport :: pid(), %% transport process
dictionary :: module(), %% common dictionary
- service :: #diameter_service{},
+ service :: #diameter_service{} | undefined,
dpr = false :: false
| true %% DPR received, DPA sent
| {boolean(), uint32(), uint32()},
diff --git a/lib/diameter/src/base/diameter_service.erl b/lib/diameter/src/base/diameter_service.erl
index e47b975768..86781c02bf 100644
--- a/lib/diameter/src/base/diameter_service.erl
+++ b/lib/diameter/src/base/diameter_service.erl
@@ -129,6 +129,7 @@
| {share_peers, diameter:remotes()} %% broadcast to
| {use_shared_peers, diameter:remotes()} %% use from
| {restrict_connections, diameter:restriction()}
+ | {strict_mbit, boolean()}
| {string_decode, boolean()}
| {incoming_maxlen, diameter:message_length()}]}).
%% shared_peers reflects the peers broadcast from remote nodes.
@@ -136,7 +137,7 @@
%% Record representing an RFC 3539 watchdog process implemented by
%% diameter_watchdog.
-record(watchdog,
- {pid :: match(pid()),
+ {pid :: match(pid()) | undefined,
type :: match(connect | accept),
ref :: match(reference()), %% key into diameter_config
options :: match([diameter:transport_opt()]),%% from start_transport
@@ -698,7 +699,8 @@ service_options(Opts) ->
?RESTRICT)},
{spawn_opt, proplists:get_value(spawn_opt, Opts, [])},
{string_decode, proplists:get_value(string_decode, Opts, true)},
- {incoming_maxlen, proplists:get_value(incoming_maxlen, Opts, 16#FFFFFF)}].
+ {incoming_maxlen, proplists:get_value(incoming_maxlen, Opts, 16#FFFFFF)},
+ {strict_mbit, proplists:get_value(strict_mbit, Opts, true)}].
%% The order of options is significant since we match against the list.
mref(false = No) ->
diff --git a/lib/diameter/src/base/diameter_traffic.erl b/lib/diameter/src/base/diameter_traffic.erl
index 692a01e651..9e14860693 100644
--- a/lib/diameter/src/base/diameter_traffic.erl
+++ b/lib/diameter/src/base/diameter_traffic.erl
@@ -80,6 +80,7 @@
apps :: [#diameter_app{}],
sequence :: diameter:sequence(),
codec :: [{string_decode, boolean()}
+ | {strict_mbit, boolean()}
| {incoming_maxlen, diameter:message_length()}]}).
%% Note that incoming_maxlen is currently handled in diameter_peer_fsm,
%% so that any message exceeding the maximum is discarded. Retain the
@@ -106,7 +107,8 @@ make_recvdata([SvcName, PeerT, Apps, SvcOpts | _]) ->
sequence = Mask,
codec = [T || {K,_} = T <- SvcOpts,
lists:member(K, [string_decode,
- incoming_maxlen])]}.
+ incoming_maxlen,
+ strict_mbit])]}.
%% ---------------------------------------------------------------------------
%% peer_up/1
diff --git a/lib/diameter/src/base/diameter_watchdog.erl b/lib/diameter/src/base/diameter_watchdog.erl
index 3c0d8f6f6e..ea8b2fdb0e 100644
--- a/lib/diameter/src/base/diameter_watchdog.erl
+++ b/lib/diameter/src/base/diameter_watchdog.erl
@@ -541,13 +541,13 @@ set_watchdog(#watchdog{tref = undefined} = S) ->
%% Timer already set: start at new one only at expiry.
set_watchdog(#watchdog{} = S) ->
- S#watchdog{tref = diameter_lib:now()};
-
-set_watchdog(stop = No) ->
- No.
+ S#watchdog{tref = diameter_lib:now()}.
%% set_watchdog/2
+set_watchdog(_, stop = No) ->
+ No;
+
set_watchdog(Ms, #watchdog{tw = TwInit} = S) ->
S#watchdog{tref = erlang:start_timer(tw(TwInit, Ms), self(), tw)}.
diff --git a/lib/diameter/src/diameter.appup.src b/lib/diameter/src/diameter.appup.src
index 788ea790fa..b77043d983 100644
--- a/lib/diameter/src/diameter.appup.src
+++ b/lib/diameter/src/diameter.appup.src
@@ -52,8 +52,10 @@
{load_module, diameter_lib},
{load_module, diameter_peer},
{load_module, diameter_reg},
+ {load_module, diameter_traffic},
{load_module, diameter_service},
{load_module, diameter_sync},
+ {load_module, diameter},
{load_module, diameter_gen_base_rfc6733},
{load_module, diameter_gen_acct_rfc6733},
{load_module, diameter_gen_base_rfc3588},
@@ -89,8 +91,10 @@
{load_module, diameter_gen_base_rfc3588},
{load_module, diameter_gen_acct_rfc6733},
{load_module, diameter_gen_base_rfc6733},
+ {load_module, diameter},
{load_module, diameter_sync},
{load_module, diameter_service},
+ {load_module, diameter_traffic},
{load_module, diameter_reg},
{load_module, diameter_peer},
{load_module, diameter_lib},
diff --git a/lib/diameter/src/transport/diameter_sctp.erl b/lib/diameter/src/transport/diameter_sctp.erl
index 678dc9b5d6..8a80ce630a 100644
--- a/lib/diameter/src/transport/diameter_sctp.erl
+++ b/lib/diameter/src/transport/diameter_sctp.erl
@@ -84,16 +84,18 @@
%% Accepting/connecting transport process state.
-record(transport,
- {parent :: pid(),
+ {parent :: pid() | undefined,
mode :: {accept, pid()}
| accept
| {connect, {[inet:ip_address()], uint(), list()}}
%% {RAs, RP, Errors}
| connect,
- socket :: gen_sctp:sctp_socket(),
+ socket :: gen_sctp:sctp_socket() | undefined,
assoc_id :: gen_sctp:assoc_id(), %% association identifier
- peer :: {[inet:ip_address()], uint()}, %% {RAs, RP}
- streams :: {uint(), uint()}, %% {InStream, OutStream} counts
+ peer :: {[inet:ip_address()], uint()} %% {RAs, RP}
+ | undefined,
+ streams :: {uint(), uint()} %% {InStream, OutStream} counts
+ | undefined,
os = 0 :: uint()}). %% next output stream
%% Listener process state.
@@ -102,7 +104,7 @@
socket :: gen_sctp:sctp_socket(),
count = 0 :: uint(), %% attached transport processes
pending = {0, queue:new()},
- tref :: reference(),
+ tref :: reference() | undefined,
accept :: [match()]}).
%% Field pending implements two queues: the first of transport-to-be
%% processes to which an association has been assigned but for which
diff --git a/lib/diameter/src/transport/diameter_tcp.erl b/lib/diameter/src/transport/diameter_tcp.erl
index 005b2442c0..c79d85820b 100644
--- a/lib/diameter/src/transport/diameter_tcp.erl
+++ b/lib/diameter/src/transport/diameter_tcp.erl
@@ -73,7 +73,7 @@
%% Listener process state.
-record(listener, {socket :: inet:socket(),
count = 1 :: non_neg_integer(),
- tref :: reference()}).
+ tref :: reference() | undefined}).
%% Monitor process state.
-record(monitor,
diff --git a/lib/eldap/src/eldap.erl b/lib/eldap/src/eldap.erl
index ae47c815c9..df87ddde08 100644
--- a/lib/eldap/src/eldap.erl
+++ b/lib/eldap/src/eldap.erl
@@ -242,7 +242,7 @@ modify_dn(Handle, Entry, NewRDN, DelOldRDN, NewSup)
%%% Sanity checks !
-bool_p(Bool) when Bool==true;Bool==false -> Bool.
+bool_p(Bool) when is_boolean(Bool) -> Bool.
optional([]) -> asn1_NOVALUE;
optional(Value) -> Value.
@@ -1022,10 +1022,13 @@ log(_, _, _, _) ->
%%% Misc. routines
%%% --------------------------------------------------------------------
-send(To,Msg) -> To ! {self(),Msg}.
+send(To,Msg) ->
+ To ! {self(), Msg},
+ ok.
+
recv(From) ->
receive
- {From,Msg} -> Msg;
+ {From, Msg} -> Msg;
{'EXIT', From, Reason} ->
{error, {internal_error, Reason}}
end.
diff --git a/lib/erl_docgen/doc/src/erl_docgen_app.xml b/lib/erl_docgen/doc/src/erl_docgen_app.xml
index c2c65a0592..58c2a24f4b 100644
--- a/lib/erl_docgen/doc/src/erl_docgen_app.xml
+++ b/lib/erl_docgen/doc/src/erl_docgen_app.xml
@@ -32,7 +32,7 @@
<description>
<p>
- The application consists of the following parts
+ The application consists of the following parts:</p>
<taglist>
<tag>XSL</tag>
<item>
@@ -59,7 +59,6 @@
</p>
</item>
</taglist>
- </p>
</description>
</appref>
diff --git a/lib/erl_docgen/priv/css/otp_doc.css b/lib/erl_docgen/priv/css/otp_doc.css
index 0b531db701..347782eb1e 100644
--- a/lib/erl_docgen/priv/css/otp_doc.css
+++ b/lib/erl_docgen/priv/css/otp_doc.css
@@ -37,7 +37,7 @@ a:visited { color: blue; text-decoration: none }
top: 0;
bottom: 0;
left: 0;
- width: 200px;
+ width: 300px;
overflow:auto;
margin: 0;
padding: 1px;
@@ -45,7 +45,7 @@ a:visited { color: blue; text-decoration: none }
}
#content {
- margin-left: 240px; /* set left value to WidthOfFrameDiv */
+ margin-left: 340px; /* set left value to WidthOfFrameDiv */
}
.frontpage
diff --git a/lib/erl_interface/src/Makefile.in b/lib/erl_interface/src/Makefile.in
index 777d709b1e..d6176ec053 100644
--- a/lib/erl_interface/src/Makefile.in
+++ b/lib/erl_interface/src/Makefile.in
@@ -126,11 +126,7 @@ else
WARNFLAGS = @WFLAGS@
endif
-ifneq ($(findstring ose,$(TARGET)),ose)
CFLAGS = @LIB_CFLAGS@ $(WARNFLAGS) $(INCFLAGS) $(TYPE_FLAGS)
-else
-CFLAGS = @CFLAGS@ $(INCFLAGS)
-endif
PROG_CFLAGS = @CFLAGS@ $(WARNFLAGS) $(INCFLAGS) $(TYPE_FLAGS) -Ilegacy
ifeq ($(findstring vxworks,$(TARGET)),vxworks)
@@ -210,12 +206,8 @@ MDD_ERLLIB = $(OBJDIR)/$(LIBPRE)erl_interface_mdd$(LIBEXT)
# Specify targets to build
###########################################################################
-ifneq ($(findstring ose,$(TARGET)),ose)
EXE_TARGETS = \
$(ERL_CALL)
-else
-EXE_TARGETS =
-endif
ifeq ($(USING_VC),yes)
@@ -480,44 +472,6 @@ ERLSOURCES = \
SOURCES = $(EISOURCES) $(ERLSOURCES)
-OSE_EISOURCES = \
- $(DECODESRC) \
- $(ENCODESRC) \
- misc/ei_decode_term.c \
- misc/ei_format.c \
- misc/ei_locking.c \
- misc/ei_malloc.c \
- misc/ei_printterm.c \
- misc/ei_pthreads.c \
- misc/ei_trace.c \
- misc/ei_x_encode.c \
- misc/eimd5.c \
- misc/get_type.c \
- misc/show_msg.c \
- misc/ei_compat.c \
- registry/hash_dohash.c \
- registry/hash_foreach.c \
- registry/hash_freetab.c \
- registry/hash_insert.c \
- registry/hash_isprime.c \
- registry/hash_lookup.c \
- registry/hash_newtab.c \
- registry/hash_remove.c \
- registry/hash_resize.c \
- registry/hash_rlookup.c
-
-OSE_ERLSOURCES = \
- legacy/decode_term.c \
- legacy/encode_term.c \
- legacy/erl_error.c \
- legacy/erl_eterm.c \
- legacy/erl_fix_alloc.c \
- legacy/erl_format.c \
- legacy/erl_malloc.c \
- legacy/erl_marshal.c
-
-OSE_SOURCES = $(OSE_EISOURCES) $(OSE_ERLSOURCES)
-
NEVERUSED = \
whereis.c \
ei_send.c \
@@ -532,13 +486,8 @@ ERLCALL = \
# Note that encode/decode_term.c defines ei functions that is
# located in the erl_interface library, not ei library.
-ifneq ($(findstring ose,$(TARGET)),ose)
ST_EIOBJECTS = $(addprefix $(ST_OBJDIR)/,$(notdir $(EISOURCES:.c=.o)))
ST_ERLOBJECTS = $(addprefix $(ST_OBJDIR)/,$(notdir $(ERLSOURCES:.c=.o)))
-else
-ST_EIOBJECTS = $(addprefix $(ST_OBJDIR)/,$(notdir $(OSE_EISOURCES:.c=.o)))
-ST_ERLOBJECTS = $(addprefix $(ST_OBJDIR)/,$(notdir $(OSE_ERLSOURCES:.c=.o)))
-endif
MT_EIOBJECTS = $(addprefix $(MT_OBJDIR)/,$(notdir $(EISOURCES:.c=.o)))
MT_ERLOBJECTS = $(addprefix $(MT_OBJDIR)/,$(notdir $(ERLSOURCES:.c=.o)))
MD_EIOBJECTS = $(addprefix $(MD_OBJDIR)/,$(notdir $(EISOURCES:.c=.o)))
@@ -587,14 +536,6 @@ $(TARGET)/config.h:
$(V_at)echo "#define HAVE_SOCKLEN_T 1" >> $@
endif
-ifeq ($(findstring ose,$(TARGET)),ose)
-$(TARGET)/config.h:
- $(gen_verbose)
- $(V_at)echo "/* Generated by Makefile */" > $@
- $(V_at)echo "#define HAVE_STRERROR 1" >> $@
- $(V_at)echo "#define HAVE_SOCKLEN_T 1" >> $@
-endif
-
###########################################################################
# Default rules, normal and threaded
###########################################################################
@@ -719,9 +660,6 @@ $(ST_OBJDIR)/erl_start.o: prog/erl_start.c
$(V_CC) $(CFLAGS) -c $< -o $@
else
-ifeq ($(findstring ose,$(TARGET)),ose)
-$(ERL_CALL):
-else
ifdef THR_DEFS
$(ERL_CALL): $(ERLCALL) ../include/ei.h $(MT_EILIB)
$(ld_verbose)$(PURIFY) $(CC) $(PROG_CFLAGS) $(THR_DEFS) $(LDFLAGS) -o $@ $(ERLCALL) \
@@ -733,7 +671,6 @@ $(ERL_CALL): $(ERLCALL) ../include/ei.h $(ST_EILIB)
endif
endif
endif
-endif
###########################################################################
# Fake application targets used to test header files and linking
diff --git a/lib/eunit/doc/overview.edoc b/lib/eunit/doc/overview.edoc
index df716cdeea..2789a05792 100644
--- a/lib/eunit/doc/overview.edoc
+++ b/lib/eunit/doc/overview.edoc
@@ -885,7 +885,7 @@ the timeout is exceeded, the unfinished tests will be forced to
terminate. Note that if a timeout is set around a fixture, it includes
the time for setup and cleanup, and if the timeout is triggered, the
entire fixture is abruptly terminated (without running the
-cleanup).</dd>
+cleanup). The default timeout for an individual test is 5 seconds.</dd>
<dt>`{inorder, Tests}'</dt>
<dd>Runs the specified tests in strict order. Also see `{inparallel,
Tests}'. By default, tests are neither marked as `inorder' or
diff --git a/lib/eunit/doc/src/notes.xml b/lib/eunit/doc/src/notes.xml
index d4ffb30967..3760e396ee 100644
--- a/lib/eunit/doc/src/notes.xml
+++ b/lib/eunit/doc/src/notes.xml
@@ -33,6 +33,21 @@
</header>
<p>This document describes the changes made to the EUnit application.</p>
+<section><title>Eunit 2.2.11</title>
+
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p>
+ Improve success message when 2 tests have passed</p>
+ <p>
+ Own Id: OTP-12952</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
<section><title>Eunit 2.2.10</title>
<section><title>Fixed Bugs and Malfunctions</title>
diff --git a/lib/eunit/src/eunit_surefire.erl b/lib/eunit/src/eunit_surefire.erl
index f3e58a3d1c..1b468551d8 100644
--- a/lib/eunit/src/eunit_surefire.erl
+++ b/lib/eunit/src/eunit_surefire.erl
@@ -56,7 +56,11 @@
{
name :: chars(),
description :: chars(),
- result :: ok | {failed, tuple()} | {aborted, tuple()} | {skipped, term()},
+ result :: ok
+ | {failed, tuple()}
+ | {aborted, tuple()}
+ | {skipped, term()}
+ | undefined,
time :: integer(),
output :: binary()
}).
diff --git a/lib/eunit/vsn.mk b/lib/eunit/vsn.mk
index 8b489bdc04..079520def2 100644
--- a/lib/eunit/vsn.mk
+++ b/lib/eunit/vsn.mk
@@ -1 +1 @@
-EUNIT_VSN = 2.2.10
+EUNIT_VSN = 2.2.11
diff --git a/lib/hipe/cerl/cerl_cconv.erl b/lib/hipe/cerl/cerl_cconv.erl
index 0fc28be5f3..ac9d01ab0e 100644
--- a/lib/hipe/cerl/cerl_cconv.erl
+++ b/lib/hipe/cerl/cerl_cconv.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2004-2009. All Rights Reserved.
+%% Copyright Ericsson AB 2004-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -710,7 +710,7 @@ ren__new() ->
ren__add(Key, Value, Ren) ->
dict:store(Key, Value, Ren).
-ren__map(Key, Ren) ->
+ren__map(Key, Ren) ->
case dict:find(Key, Ren) of
{ok, Value} ->
Value;
@@ -722,11 +722,14 @@ ren__map(Key, Ren) ->
%% ---------------------------------------------------------------------
%% State
--record(state, {module :: module(), function :: {atom(), arity()},
- names, refs, defs = []}).
+-record(state, {module :: module(),
+ function :: {atom(), arity()} | 'undefined',
+ names = sets:new() :: sets:set(), %% XXX: refine
+ refs = dict:new() :: dict:dict(), %% XXX: refine
+ defs = []}).
s__new(Module) ->
- #state{module = Module, names = sets:new(), refs = dict:new()}.
+ #state{module = Module}.
s__add_function_name(Name, S) ->
S#state{names = sets:add_element(Name, S#state.names)}.
diff --git a/lib/hipe/cerl/cerl_hipeify.erl b/lib/hipe/cerl/cerl_hipeify.erl
index 8691e80cac..6611abd204 100644
--- a/lib/hipe/cerl/cerl_hipeify.erl
+++ b/lib/hipe/cerl/cerl_hipeify.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2003-2012. All Rights Reserved.
+%% Copyright Ericsson AB 2003-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -623,12 +623,12 @@ ren__map(Key, Ren) ->
%% ---------------------------------------------------------------------
%% State
-%% pmatch = 'true' | 'false' | 'no_duplicates' | 'duplicate_all'
+-type pmatch() :: 'true' | 'false' | 'no_duplicates' | 'duplicate_all'.
--record(state, {module::atom(),
- function::{atom(), 0..256},
- pmatch=true,
- revisit = false}).
+-record(state, {module :: module(),
+ function :: {atom(), arity()} | 'undefined',
+ pmatch = true :: pmatch(),
+ revisit = false :: boolean()}).
s__new(Module) ->
#state{module = Module}.
diff --git a/lib/hipe/cerl/erl_bif_types.erl b/lib/hipe/cerl/erl_bif_types.erl
index 5387edfb47..622c235638 100644
--- a/lib/hipe/cerl/erl_bif_types.erl
+++ b/lib/hipe/cerl/erl_bif_types.erl
@@ -46,7 +46,6 @@
t_bitstr/0,
t_boolean/0,
t_byte/0,
- t_char/0,
t_cons/0,
t_cons/2,
t_cons_hd/1,
@@ -87,7 +86,6 @@
t_is_port/2,
t_is_maybe_improper_list/2,
t_is_reference/2,
- t_is_string/1,
t_is_subtype/2,
t_is_tuple/2,
t_list/0,
@@ -552,9 +550,6 @@ type(erlang, bit_size, 1, Xs, Opaques) ->
type(erlang, byte_size, 1, Xs, Opaques) ->
strict(erlang, byte_size, 1, Xs,
fun (_) -> t_non_neg_integer() end, Opaques);
-type(erlang, disconnect_node, 1, Xs, Opaques) ->
- strict(erlang, disconnect_node, 1, Xs,
- fun (_) -> t_sup([t_boolean(), t_atom('ignored')]) end, Opaques);
%% Guard bif, needs to be here.
%% Also much more expressive than anything you could write in a spec...
type(erlang, element, 2, Xs, Opaques) ->
@@ -583,16 +578,9 @@ type(erlang, element, 2, Xs, Opaques) ->
%% Guard bif, needs to be here.
type(erlang, float, 1, Xs, Opaques) ->
strict(erlang, float, 1, Xs, fun (_) -> t_float() end, Opaques);
-type(erlang, fun_info, 1, Xs, Opaques) ->
- strict(erlang, fun_info, 1, Xs,
- fun (_) -> t_list(t_tuple([t_atom(), t_any()])) end, Opaques);
-type(erlang, get_cookie, 0, _, _Opaques) -> t_atom(); % | t_atom('nocookie')
%% Guard bif, needs to be here.
type(erlang, hd, 1, Xs, Opaques) ->
strict(erlang, hd, 1, Xs, fun ([X]) -> t_cons_hd(X) end, Opaques);
-type(erlang, integer_to_list, 2, Xs, Opaques) ->
- strict(erlang, integer_to_list, 2, Xs,
- fun (_) -> t_string() end, Opaques);
type(erlang, info, 1, Xs, _) -> type(erlang, system_info, 1, Xs); % alias
%% All type tests are guard BIF's and may be implemented in ways that
%% cannot be expressed in a type spec, why they are kept in erl_bif_types.
@@ -768,6 +756,18 @@ type(erlang, length, 1, Xs, Opaques) ->
%% Guard bif, needs to be here.
type(erlang, map_size, 1, Xs, Opaques) ->
strict(erlang, map_size, 1, Xs, fun (_) -> t_non_neg_integer() end, Opaques);
+type(erlang, make_fun, 3, Xs, Opaques) ->
+ strict(erlang, make_fun, 3, Xs,
+ fun ([_, _, Arity]) ->
+ case t_number_vals(Arity, Opaques) of
+ [N] ->
+ case is_integer(N) andalso 0 =< N andalso N =< 255 of
+ true -> t_fun(N, t_any());
+ false -> t_none()
+ end;
+ _Other -> t_fun()
+ end
+ end, Opaques);
type(erlang, make_tuple, 2, Xs, Opaques) ->
strict(erlang, make_tuple, 2, Xs,
fun ([Int, _]) ->
@@ -784,8 +784,6 @@ type(erlang, make_tuple, 3, Xs, Opaques) ->
_Other -> t_tuple()
end
end, Opaques);
-type(erlang, memory, 0, _, _Opaques) ->
- t_list(t_tuple([t_atom(), t_non_neg_fixnum()]));
type(erlang, nif_error, 1, Xs, Opaques) ->
%% this BIF and the next one are stubs for NIFs and never return
strict(erlang, nif_error, 1, Xs, fun (_) -> t_any() end, Opaques);
@@ -801,8 +799,6 @@ type(erlang, round, 1, Xs, Opaques) ->
strict(erlang, round, 1, Xs, fun (_) -> t_integer() end, Opaques);
%% Guard bif, needs to be here.
type(erlang, self, 0, _, _Opaques) -> t_pid();
-type(erlang, set_cookie, 2, Xs, Opaques) ->
- strict(erlang, set_cookie, 2, Xs, fun (_) -> t_atom('true') end, Opaques);
type(erlang, setelement, 3, Xs, Opaques) ->
strict(erlang, setelement, 3, Xs,
fun ([X1, X2, X3]) ->
@@ -837,19 +833,7 @@ type(erlang, setelement, 3, Xs, Opaques) ->
%% Guard bif, needs to be here.
type(erlang, size, 1, Xs, Opaques) ->
strict(erlang, size, 1, Xs, fun (_) -> t_non_neg_integer() end, Opaques);
-type(erlang, spawn, 1, Xs, Opaques) ->
- strict(erlang, spawn, 1, Xs, fun (_) -> t_pid() end, Opaques);
-type(erlang, spawn, 2, Xs, Opaques) ->
- strict(erlang, spawn, 2, Xs, fun (_) -> t_pid() end, Opaques);
-type(erlang, spawn, 4, Xs, Opaques) ->
- strict(erlang, spawn, 4, Xs, fun (_) -> t_pid() end, Opaques);
-type(erlang, spawn_link, 1, Xs, _) -> type(erlang, spawn, 1, Xs); % same
-type(erlang, spawn_link, 2, Xs, _) -> type(erlang, spawn, 2, Xs); % same
-type(erlang, spawn_link, 4, Xs, _) -> type(erlang, spawn, 4, Xs); % same
type(erlang, subtract, 2, Xs, _Opaques) -> type(erlang, '--', 2, Xs); % alias
-type(erlang, suspend_process, 1, Xs, Opaques) ->
- strict(erlang, suspend_process, 1, Xs,
- fun (_) -> t_atom('true') end, Opaques);
type(erlang, system_info, 1, Xs, Opaques) ->
strict(erlang, system_info, 1, Xs,
fun ([Type]) ->
@@ -914,8 +898,7 @@ type(erlang, system_info, 1, Xs, Opaques) ->
t_list(t_pid());
['os_type'] ->
t_tuple([t_sup([t_atom('unix'),
- t_atom('win32'),
- t_atom('ose')]),
+ t_atom('win32')]),
t_atom()]);
['os_version'] ->
t_sup(t_tuple([t_non_neg_fixnum(),
@@ -1003,10 +986,6 @@ type(erlang, tuple_to_list, 1, Xs, Opaques) ->
end
end
end, Opaques);
-type(erlang, yield, 0, _, _Opaques) -> t_atom('true');
-%%-- ets ----------------------------------------------------------------------
-type(ets, rename, 2, Xs, Opaques) ->
- strict(ets, rename, 2, Xs, fun ([_, Name]) -> Name end, Opaques);
%%-- hipe_bifs ----------------------------------------------------------------
type(hipe_bifs, add_ref, 2, Xs, Opaques) ->
strict(hipe_bifs, add_ref, 2, Xs, fun (_) -> t_nil() end, Opaques);
@@ -1666,25 +1645,6 @@ type(lists, zipwith3, 4, Xs, Opaques) ->
fun ([F,_As,_Bs,_Cs]) -> t_sup(t_list(t_fun_range(F, Opaques)),
t_nil()) end, Opaques);
-%%-- string -------------------------------------------------------------------
-type(string, chars, 2, Xs, Opaques) -> % NOTE: added to avoid loss of info
- strict(string, chars, 2, Xs, fun (_) -> t_string() end, Opaques);
-type(string, chars, 3, Xs, Opaques) -> % NOTE: added to avoid loss of info
- strict(string, chars, 3, Xs,
- fun ([Char, N, Tail]) ->
- case t_is_nil(Tail) of
- true ->
- type(string, chars, 2, [Char, N]);
- false ->
- case t_is_string(Tail) of
- true ->
- t_string();
- false ->
- t_sup(t_sup(t_string(), Tail), t_cons(Char, Tail))
- end
- end
- end, Opaques);
-
%%-----------------------------------------------------------------------------
type(M, F, A, Xs, _O) when is_atom(M), is_atom(F),
is_integer(A), 0 =< A, A =< 255 ->
@@ -2289,8 +2249,6 @@ arg_types(erlang, bit_size, 1) ->
%% Guard bif, needs to be here.
arg_types(erlang, byte_size, 1) ->
[t_binary()];
-arg_types(erlang, disconnect_node, 1) ->
- [t_node()];
arg_types(erlang, halt, 0) ->
[];
arg_types(erlang, halt, 1) ->
@@ -2310,17 +2268,11 @@ arg_types(erlang, element, 2) ->
%% Guard bif, needs to be here.
arg_types(erlang, float, 1) ->
[t_number()];
-arg_types(erlang, fun_info, 1) ->
- [t_fun()];
-arg_types(erlang, get_cookie, 0) ->
- [];
%% Guard bif, needs to be here.
arg_types(erlang, hd, 1) ->
[t_cons()];
arg_types(erlang, info, 1) ->
arg_types(erlang, system_info, 1); % alias
-arg_types(erlang, integer_to_list, 2) ->
- [t_integer(), t_from_range(2, 36)];
arg_types(erlang, is_atom, 1) ->
[t_any()];
arg_types(erlang, is_binary, 1) ->
@@ -2361,12 +2313,12 @@ arg_types(erlang, length, 1) ->
%% Guard bif, needs to be here.
arg_types(erlang, map_size, 1) ->
[t_map()];
+arg_types(erlang, make_fun, 3) ->
+ [t_atom(), t_atom(), t_arity()];
arg_types(erlang, make_tuple, 2) ->
[t_non_neg_fixnum(), t_any()]; % the value 0 is OK as first argument
arg_types(erlang, make_tuple, 3) ->
[t_non_neg_fixnum(), t_any(), t_list(t_tuple([t_pos_integer(), t_any()]))];
-arg_types(erlang, memory, 0) ->
- [];
arg_types(erlang, nif_error, 1) ->
[t_any()];
arg_types(erlang, nif_error, 2) ->
@@ -2383,29 +2335,13 @@ arg_types(erlang, round, 1) ->
%% Guard bif, needs to be here.
arg_types(erlang, self, 0) ->
[];
-arg_types(erlang, set_cookie, 2) ->
- [t_node(), t_atom()];
arg_types(erlang, setelement, 3) ->
[t_pos_integer(), t_tuple(), t_any()];
%% Guard bif, needs to be here.
arg_types(erlang, size, 1) ->
[t_sup(t_tuple(), t_binary())];
-arg_types(erlang, spawn, 1) -> %% TODO: Tuple?
- [t_fun()];
-arg_types(erlang, spawn, 2) -> %% TODO: Tuple?
- [t_node(), t_fun()];
-arg_types(erlang, spawn, 4) -> %% TODO: Tuple?
- [t_node(), t_atom(), t_atom(), t_list()];
-arg_types(erlang, spawn_link, 1) ->
- arg_types(erlang, spawn, 1); % same
-arg_types(erlang, spawn_link, 2) ->
- arg_types(erlang, spawn, 2); % same
-arg_types(erlang, spawn_link, 4) ->
- arg_types(erlang, spawn, 4); % same
arg_types(erlang, subtract, 2) ->
arg_types(erlang, '--', 2);
-arg_types(erlang, suspend_process, 1) ->
- [t_pid()];
arg_types(erlang, system_info, 1) ->
[t_sup([t_atom(), % documented
t_tuple([t_atom(), t_any()]), % documented
@@ -2424,11 +2360,6 @@ arg_types(erlang, tuple_size, 1) ->
[t_tuple()];
arg_types(erlang, tuple_to_list, 1) ->
[t_tuple()];
-arg_types(erlang, yield, 0) ->
- [];
-%%------- ets -----------------------------------------------------------------
-arg_types(ets, rename, 2) ->
- [t_atom(), t_atom()];
%%------- hipe_bifs -----------------------------------------------------------
arg_types(hipe_bifs, add_ref, 2) ->
[t_mfa(), t_tuple([t_mfa(),
@@ -2625,13 +2556,6 @@ arg_types(lists, zipwith, 3) ->
[t_fun([t_any(), t_any()], t_any()), t_list(), t_list()];
arg_types(lists, zipwith3, 4) ->
[t_fun([t_any(), t_any(), t_any()], t_any()), t_list(), t_list(), t_list()];
-
-%%------- string --------------------------------------------------------------
-arg_types(string, chars, 2) ->
- [t_char(), t_non_neg_integer()];
-arg_types(string, chars, 3) ->
- [t_char(), t_non_neg_integer(), t_any()];
-%%-----------------------------------------------------------------------------
arg_types(M, F, A) when is_atom(M), is_atom(F),
is_integer(A), 0 =< A, A =< 255 ->
unknown. % safe approximation for all functions.
diff --git a/lib/hipe/cerl/erl_types.erl b/lib/hipe/cerl/erl_types.erl
index cd2d2fe207..420d7e2a8f 100644
--- a/lib/hipe/cerl/erl_types.erl
+++ b/lib/hipe/cerl/erl_types.erl
@@ -3974,18 +3974,17 @@ record_to_string(Tag, [_|Fields], FieldNames, RecDict) ->
FieldStrings = record_fields_to_string(Fields, FieldNames, RecDict, []),
"#" ++ atom_to_string(Tag) ++ "{" ++ string:join(FieldStrings, ",") ++ "}".
-record_fields_to_string([F|Fs], [{FName, _Abstr, _DefType}|FDefs],
+record_fields_to_string([F|Fs], [{FName, _Abstr, DefType}|FDefs],
RecDict, Acc) ->
NewAcc =
- case t_is_equal(F, t_any()) orelse t_is_any_atom('undefined', F) of
+ case
+ t_is_equal(F, t_any()) orelse
+ (t_is_any_atom('undefined', F) andalso
+ not t_is_none(t_inf(F, DefType)))
+ of
true -> Acc;
false ->
StrFV = atom_to_string(FName) ++ "::" ++ t_to_string(F, RecDict),
- %% ActualDefType = t_subtract(DefType, t_atom('undefined')),
- %% Str = case t_is_any(ActualDefType) of
- %% true -> StrFV;
- %% false -> StrFV ++ "::" ++ t_to_string(ActualDefType, RecDict)
- %% end,
[StrFV|Acc]
end,
record_fields_to_string(Fs, FDefs, RecDict, NewAcc);
diff --git a/lib/hipe/doc/src/hipe_app.xml b/lib/hipe/doc/src/hipe_app.xml
index 98fec900af..bf4bdbb3b3 100644
--- a/lib/hipe/doc/src/hipe_app.xml
+++ b/lib/hipe/doc/src/hipe_app.xml
@@ -37,15 +37,14 @@
<description>
<p>
The normal way to native-compile an Erlang module using HiPE is to include the atom native
- in the Erlang compiler options, as in:
- <code>
- 1> <input>c(my_module, [native]).</input></code>
- Options to the HiPE compiler are then passed as follows:
- <code>
- 1> <input>c(my_module, [native,{hipe,Options}]).</input></code>
- For on-line help in the Erlang shell, call <c>hipe:help()</c>.
- Details on HiPE compiler options are given by <c>hipe:help_options()</c>.
- </p>
+ in the Erlang compiler options, as in:</p>
+ <pre>
+ 1> <input>c(my_module, [native]).</input></pre>
+ <p>Options to the HiPE compiler are then passed as follows:</p>
+ <pre>
+ 1> <input>c(my_module, [native,{hipe,Options}]).</input></pre>
+ <p>For on-line help in the Erlang shell, call <c>hipe:help()</c>.
+ Details on HiPE compiler options are given by <c>hipe:help_options()</c>.</p>
</description>
<section>
<title>SEE ALSO</title>
diff --git a/lib/hipe/doc/src/notes.xml b/lib/hipe/doc/src/notes.xml
index 33a18ff7ef..e1aec698e4 100644
--- a/lib/hipe/doc/src/notes.xml
+++ b/lib/hipe/doc/src/notes.xml
@@ -31,6 +31,50 @@
</header>
<p>This document describes the changes made to HiPE.</p>
+<section><title>Hipe 3.13</title>
+
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p> Fix bugs concerning <c>erlang:abs/1</c>. </p>
+ <p>
+ Own Id: OTP-12948</p>
+ </item>
+ <item>
+ <p> Fix a bug concerning <c>lists:keydelete/3</c> with
+ union and opaque types. </p>
+ <p>
+ Own Id: OTP-12949</p>
+ </item>
+ <item>
+ <p>
+ A beam file compiled by hipe for an incompatible runtime
+ system was sometimes not rejected by the loader, which
+ could lead to vm crash. This fix will also allow the same
+ hipe compiler to be used by both normal and debug-built
+ vm.</p>
+ <p>
+ Own Id: OTP-12962</p>
+ </item>
+ </list>
+ </section>
+
+
+ <section><title>Improvements and New Features</title>
+ <list>
+ <item>
+ <p>
+ New function <c>hipe:erts_checksum/0</c> which returns a
+ value identifying the target runtime system for the
+ compiler. Used by dialyzer for its beam cache directory.</p>
+ <p>
+ Own Id: OTP-12963 Aux Id: OTP-12962, OTP-12964 </p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
<section><title>Hipe 3.12</title>
<section><title>Fixed Bugs and Malfunctions</title>
@@ -275,22 +319,28 @@
<p>
EEP43: New data type - Maps</p>
<p>
- With Maps you may for instance: <taglist> <item><c>M0 =
- #{ a =&gt; 1, b =&gt; 2}, % create
- associations</c></item> <item><c>M1 = M0#{ a := 10 }, %
- update values</c></item> <item><c>M2 = M1#{ "hi" =&gt;
- "hello"}, % add new associations</c></item> <item><c>#{
- "hi" := V1, a := V2, b := V3} = M2. % match keys with
- values</c></item> </taglist></p>
+ With Maps you may for instance:</p>
+ <taglist>
+ <tag/> <item><c>M0 = #{ a =&gt; 1, b =&gt; 2}, % create
+ associations</c></item>
+ <tag/><item><c>M1 = M0#{ a := 10 }, % update values</c></item>
+ <tag/><item><c>M2 = M1#{ "hi" =&gt;
+ "hello"}, % add new associations</c></item>
+ <tag/><item><c>#{ "hi" := V1, a := V2, b := V3} = M2.
+ % match keys with values</c></item>
+ </taglist>
<p>
For information on how to use Maps please see Map Expressions in the
<seealso marker="doc/reference_manual:expressions#map_expressions">
Reference Manual</seealso>.</p>
<p>
The current implementation is without the following
- features: <taglist> <item>No variable keys</item>
- <item>No single value access</item> <item>No map
- comprehensions</item> </taglist></p>
+ features:</p>
+ <taglist>
+ <tag/><item>No variable keys</item>
+ <tag/><item>No single value access</item>
+ <tag/><item>No map comprehensions</item>
+ </taglist>
<p>
Note that Maps is <em>experimental</em> during OTP 17.0.</p>
<p>
@@ -558,19 +608,17 @@
<section><title>Fixed Bugs and Malfunctions</title>
<list>
<item>
- <p>
<list> <item><p>No warnings for underspecs with remote
types</p></item> <item><p> Fix crash in Typer</p></item>
<item><p>Fix Dialyzer's warning for its own
code</p></item> <item><p>Fix Dialyzer's warnings in
HiPE</p></item> <item><p>Add file/line info in a
particular Dialyzer crash</p></item> <item><p>Update
- inets test results</p></item> </list></p>
+ inets test results</p></item> </list>
<p>
Own Id: OTP-9758</p>
</item>
<item>
- <p>
<list> <item><p>Correct callback spec in application
module</p></item> <item><p>Refine warning about callback
specs with extra ranges</p></item> <item><p>Cleanup
@@ -581,7 +629,7 @@
analysis</p></item> <item><p>Fix crash in
Dialyzer</p></item> <item><p>Variable substitution was
not generalizing any unknown variables.</p></item>
- </list></p>
+ </list>
<p>
Own Id: OTP-9776</p>
</item>
diff --git a/lib/hipe/flow/cfg.hrl b/lib/hipe/flow/cfg.hrl
index f79fff4efe..641ec102db 100644
--- a/lib/hipe/flow/cfg.hrl
+++ b/lib/hipe/flow/cfg.hrl
@@ -2,7 +2,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2007-2014. All Rights Reserved.
+%% Copyright Ericsson AB 2007-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -34,11 +34,13 @@
%%
-record(cfg_info, {'fun' :: mfa(),
start_label :: cfg_lbl(),
+ %% TODO: merge is_closure and closure_arity into one field
is_closure :: boolean(),
- closure_arity :: arity(),
+ closure_arity = none :: 'none' | arity(),
is_leaf :: boolean(),
params, % :: list()
info = []}). %% this field seems not needed; take out??
+-type cfg_info() :: #cfg_info{}.
%%
%% Data is a triple with a dict of constants, a list of labels and an integer
@@ -49,6 +51,6 @@
%% The following is to be used by other modules
%%
-record(cfg, {table = gb_trees:empty() :: gb_trees:tree(),
- info :: #cfg_info{},
+ info :: cfg_info(),
data :: cfg_data()}).
-type cfg() :: #cfg{}.
diff --git a/lib/hipe/icode/hipe_icode.erl b/lib/hipe/icode/hipe_icode.erl
index 5c7003b0ed..9692eebb10 100644
--- a/lib/hipe/icode/hipe_icode.erl
+++ b/lib/hipe/icode/hipe_icode.erl
@@ -2,7 +2,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2001-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2001-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -631,59 +631,59 @@ mk_icode(Fun, Params, IsClosure, IsLeaf, Code, VarRange, LabelRange) ->
-spec mk_icode(mfa(), [icode_var()], boolean(), boolean(), [icode_instr()],
hipe_consttab(), {non_neg_integer(),non_neg_integer()},
- {icode_lbl(),icode_lbl()}) -> #icode{}.
+ {icode_lbl(),icode_lbl()}) -> icode().
mk_icode(Fun, Params, IsClosure, IsLeaf, Code, Data, VarRange, LabelRange) ->
#icode{'fun'=Fun, params=Params, code=Code,
data=Data, is_closure=IsClosure, is_leaf=IsLeaf,
var_range=VarRange, label_range=LabelRange}.
--spec icode_fun(#icode{}) -> mfa().
+-spec icode_fun(icode()) -> mfa().
icode_fun(#icode{'fun' = MFA}) -> MFA.
--spec icode_params(#icode{}) -> [icode_var()].
+-spec icode_params(icode()) -> [icode_var()].
icode_params(#icode{params = Params}) -> Params.
--spec icode_params_update(#icode{}, [icode_var()]) -> #icode{}.
+-spec icode_params_update(icode(), [icode_var()]) -> icode().
icode_params_update(Icode, Params) ->
Icode#icode{params = Params}.
--spec icode_is_closure(#icode{}) -> boolean().
+-spec icode_is_closure(icode()) -> boolean().
icode_is_closure(#icode{is_closure = Closure}) -> Closure.
--spec icode_is_leaf(#icode{}) -> boolean().
+-spec icode_is_leaf(icode()) -> boolean().
icode_is_leaf(#icode{is_leaf = Leaf}) -> Leaf.
--spec icode_code(#icode{}) -> icode_instrs().
+-spec icode_code(icode()) -> icode_instrs().
icode_code(#icode{code = Code}) -> Code.
--spec icode_code_update(#icode{}, icode_instrs()) -> #icode{}.
+-spec icode_code_update(icode(), icode_instrs()) -> icode().
icode_code_update(Icode, NewCode) ->
Vmax = highest_var(NewCode),
Lmax = highest_label(NewCode),
Icode#icode{code = NewCode, var_range = {0,Vmax}, label_range = {0,Lmax}}.
--spec icode_data(#icode{}) -> hipe_consttab().
+-spec icode_data(icode()) -> hipe_consttab().
icode_data(#icode{data=Data}) -> Data.
-%% %% -spec icode_data_update(#icode{}, hipe_consttab()) -> #icode{}.
+%% %% -spec icode_data_update(icode(), hipe_consttab()) -> icode().
%% icode_data_update(Icode, NewData) -> Icode#icode{data=NewData}.
--spec icode_var_range(#icode{}) -> {non_neg_integer(), non_neg_integer()}.
+-spec icode_var_range(icode()) -> {non_neg_integer(), non_neg_integer()}.
icode_var_range(#icode{var_range = VarRange}) -> VarRange.
--spec icode_label_range(#icode{}) -> {non_neg_integer(), non_neg_integer()}.
+-spec icode_label_range(icode()) -> {non_neg_integer(), non_neg_integer()}.
icode_label_range(#icode{label_range = LabelRange}) -> LabelRange.
--spec icode_info(#icode{}) -> icode_info().
+-spec icode_info(icode()) -> icode_info().
icode_info(#icode{info = Info}) -> Info.
--spec icode_info_update(#icode{}, icode_info()) -> #icode{}.
+-spec icode_info_update(icode(), icode_info()) -> icode().
icode_info_update(Icode, Info) -> Icode#icode{info = Info}.
--spec icode_closure_arity(#icode{}) -> arity().
+-spec icode_closure_arity(icode()) -> arity().
icode_closure_arity(#icode{closure_arity = Arity}) -> Arity.
--spec icode_closure_arity_update(#icode{}, arity()) -> #icode{}.
+-spec icode_closure_arity_update(icode(), arity()) -> icode().
icode_closure_arity_update(Icode, Arity) -> Icode#icode{closure_arity = Arity}.
@@ -1709,7 +1709,7 @@ mk_new_label() ->
%% @doc Removes comments from Icode.
%%
--spec strip_comments(#icode{}) -> #icode{}.
+-spec strip_comments(icode()) -> icode().
strip_comments(ICode) ->
icode_code_update(ICode, no_comments(icode_code(ICode))).
diff --git a/lib/hipe/icode/hipe_icode.hrl b/lib/hipe/icode/hipe_icode.hrl
index 9b24c4914e..3bb7bae019 100644
--- a/lib/hipe/icode/hipe_icode.hrl
+++ b/lib/hipe/icode/hipe_icode.hrl
@@ -170,8 +170,9 @@
-record(icode, {'fun' :: mfa(),
params :: [icode_var()],
+ %% TODO: merge is_closure and closure_arity into one field
is_closure :: boolean(),
- closure_arity :: arity(),
+ closure_arity = none :: 'none' | arity(),
is_leaf :: boolean(),
code = [] :: icode_instrs(),
data :: hipe_consttab(),
diff --git a/lib/hipe/icode/hipe_icode_exceptions.erl b/lib/hipe/icode/hipe_icode_exceptions.erl
index 41556ab80f..f03ce2faaa 100644
--- a/lib/hipe/icode/hipe_icode_exceptions.erl
+++ b/lib/hipe/icode/hipe_icode_exceptions.erl
@@ -2,7 +2,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2004-2014. All Rights Reserved.
+%% Copyright Ericsson AB 2004-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -85,7 +85,7 @@
%%----------------------------------------------------------------------------
--spec fix_catches(#cfg{}) -> #cfg{}.
+-spec fix_catches(cfg()) -> cfg().
fix_catches(CFG) ->
{Map, State} = build_mapping(find_catches(init_state(CFG))),
@@ -393,10 +393,10 @@ get_renaming(C, Map) ->
%%---------------------------------------------------------------------
%% State abstraction
--record(state, {cfg :: #cfg{},
+-record(state, {cfg :: cfg(),
changed = false :: boolean(),
- succ :: #cfg{},
- pred :: #cfg{},
+ succ :: cfg(),
+ pred :: cfg(),
start_labels :: [icode_lbl(),...],
visited = hipe_icode_cfg:none_visited() :: gb_sets:set(),
out = gb_trees:empty() :: gb_trees:tree(),
@@ -404,13 +404,8 @@ get_renaming(C, Map) ->
}).
init_state(CFG) ->
- State = #state{cfg = CFG},
- refresh_state_cache(State).
-
-refresh_state_cache(State) ->
- CFG = State#state.cfg,
SLs = [hipe_icode_cfg:start_label(CFG)],
- State#state{succ = CFG, pred = CFG, start_labels = SLs}.
+ #state{cfg = CFG, succ = CFG, pred = CFG, start_labels = SLs}.
get_cfg(State) ->
State#state.cfg.
@@ -466,7 +461,8 @@ get_bb_code(L, State) ->
set_bb_code(L, Code, State) ->
CFG = State#state.cfg,
CFG1 = hipe_icode_cfg:bb_add(CFG, L, hipe_bb:mk_bb(Code)),
- refresh_state_cache(State#state{cfg = CFG1}).
+ SLs = [hipe_icode_cfg:start_label(CFG1)],
+ State#state{cfg = CFG1, succ = CFG1, pred = CFG1, start_labels = SLs}.
get_new_catches_in(L, State) ->
Ps = get_pred(L, State),
diff --git a/lib/hipe/icode/hipe_icode_ssa_struct_reuse.erl b/lib/hipe/icode/hipe_icode_ssa_struct_reuse.erl
index e350a6ff18..7613024787 100644
--- a/lib/hipe/icode/hipe_icode_ssa_struct_reuse.erl
+++ b/lib/hipe/icode/hipe_icode_ssa_struct_reuse.erl
@@ -2,7 +2,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2007-2014. All Rights Reserved.
+%% Copyright Ericsson AB 2007-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -314,7 +314,7 @@ node_create(Label, Pred, Succ) ->
%% tree - the tree of nodes, with labels as keys and node records as values
-record(nodes, {
- domtree :: hipe_dominators:domTree(),
+ domtree = none :: 'none' | hipe_dominators:domTree(),
labels = none :: 'none' | [icode_lbl()],
postorder = none :: 'none' | [icode_lbl()],
start_label = none :: 'none' | icode_lbl(),
@@ -390,7 +390,7 @@ update_del_red_test_set(Update) ->
%%-----------------------------------------------------------------------------
%% Main function called from the hipe_main module
--spec struct_reuse(#cfg{}) -> #cfg{}.
+-spec struct_reuse(cfg()) -> cfg().
struct_reuse(CFG) ->
%% debug_init_case_count(?SR_INSTR_TYPE),
diff --git a/lib/hipe/main/hipe.erl b/lib/hipe/main/hipe.erl
index 1a4bbf179f..0e32da1d36 100644
--- a/lib/hipe/main/hipe.erl
+++ b/lib/hipe/main/hipe.erl
@@ -2,7 +2,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2001-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2001-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -764,7 +764,8 @@ finalize(OrigList, Mod, Exports, WholeModule, Opts) ->
finalize_fun(MfaIcodeList, Exports, Opts) ->
case proplists:get_value(concurrent_comp, Opts) of
FalseVal when (FalseVal =:= undefined) orelse (FalseVal =:= false) ->
- [finalize_fun_sequential(MFAIcode, Opts, #comp_servers{})
+ NoServers = #comp_servers{pp_server = none, range = none, type = none},
+ [finalize_fun_sequential(MFAIcode, Opts, NoServers)
|| {_MFA, _Icode} = MFAIcode <- MfaIcodeList];
TrueVal when (TrueVal =:= true) orelse (TrueVal =:= debug) ->
finalize_fun_concurrent(MfaIcodeList, Exports, Opts)
diff --git a/lib/hipe/main/hipe.hrl.src b/lib/hipe/main/hipe.hrl.src
index ba27878a84..3be824ac34 100644
--- a/lib/hipe/main/hipe.hrl.src
+++ b/lib/hipe/main/hipe.hrl.src
@@ -2,7 +2,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2001-2011. All Rights Reserved.
+%% Copyright Ericsson AB 2001-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -299,7 +299,8 @@
%% Records defined in the hipe module used in other parts of the compiler
%%----------------------------------------------------------------------------
--record(comp_servers, {pp_server :: pid(), range :: pid(), type :: pid()}).
+-type mpid() :: 'none' | pid().
+-record(comp_servers, {pp_server :: mpid(), range :: mpid(), type :: mpid()}).
%%----------------------------------------------------------------------------
%% Basic types of the 'hipe' application used in other parts of the system
diff --git a/lib/hipe/main/hipe_main.erl b/lib/hipe/main/hipe_main.erl
index 5753169961..be5050e155 100644
--- a/lib/hipe/main/hipe_main.erl
+++ b/lib/hipe/main/hipe_main.erl
@@ -2,7 +2,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2001-2011. All Rights Reserved.
+%% Copyright Ericsson AB 2001-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -55,7 +55,7 @@
%%=====================================================================
%% @spec compile_icode(MFA::mfa(),
-%% LinearIcode::#icode{},
+%% LinearIcode::icode(),
%% CompilerOptions::comp_options(),
%% CompServers::#comp_servers()) ->
%% {native,Platform,{unprofiled,NativeCode}} | {rtl,RTLCode}
@@ -69,7 +69,7 @@
%% generated). The compiler options must have already been expanded
%% (cf. `<a href="hipe.html">hipe:expand_options</a>'). </p>
--spec compile_icode(mfa(), #icode{}, comp_options(), #comp_servers{}) ->
+-spec compile_icode(mfa(), icode(), comp_options(), #comp_servers{}) ->
comp_icode_ret().
compile_icode(MFA, LinearIcode, Options, Servers) ->
@@ -230,10 +230,12 @@ get_pp_module(icode_liveness) -> hipe_icode_liveness;
get_pp_module(rtl_liveness) -> hipe_rtl_liveness.
perform_io(no_fun, _) -> ok;
-perform_io(Fun,PPServer) when is_pid(PPServer) ->
- PPServer ! {print,Fun};
-perform_io(Fun, undefined) ->
- Fun().
+perform_io(Fun, PPServer) when is_pid(PPServer) ->
+ PPServer ! {print, Fun},
+ ok;
+perform_io(Fun, none) ->
+ Fun(),
+ ok.
%%--------------------------------------------------------------------
diff --git a/lib/hipe/rtl/hipe_rtl_binary_construct.erl b/lib/hipe/rtl/hipe_rtl_binary_construct.erl
index 40bd22aa8e..692bad7d96 100644
--- a/lib/hipe/rtl/hipe_rtl_binary_construct.erl
+++ b/lib/hipe/rtl/hipe_rtl_binary_construct.erl
@@ -2,7 +2,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2007-2009. All Rights Reserved.
+%% Copyright Ericsson AB 2007-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -1192,7 +1192,10 @@ copy_little_word(Base, Offset, NewOffset, Word) ->
hipe_rtl:mk_store(Base, TmpOffset, Word, byte),
hipe_rtl:mk_alu(NewOffset, Offset, 'add', hipe_rtl:mk_imm(32))].
-copy_offset_int_big(Base, Offset, NewOffset, Size, Tmp1) when is_integer(Size) ->
+copy_offset_int_big(_Base, Offset, NewOffset, 0, _Tmp1) ->
+ [hipe_rtl:mk_move(NewOffset, Offset)];
+copy_offset_int_big(Base, Offset, NewOffset, Size, Tmp1)
+ when is_integer(Size), Size > 0 ->
Tmp2 = hipe_rtl:mk_new_reg(),
Tmp3 = hipe_rtl:mk_new_reg(),
Tmp4 = hipe_rtl:mk_new_reg(),
@@ -1203,7 +1206,7 @@ copy_offset_int_big(Base, Offset, NewOffset, Size, Tmp1) when is_integer(Size) -
Tmp9 = hipe_rtl:mk_new_reg(),
OldByte = hipe_rtl:mk_new_reg(),
TmpOffset = hipe_rtl:mk_new_reg(),
- BranchLbl = hipe_rtl:mk_new_label(),
+ BranchLbl = hipe_rtl:mk_new_label(),
BodyLbl = hipe_rtl:mk_new_label(),
EndLbl = hipe_rtl:mk_new_label(),
NextLbl = hipe_rtl:mk_new_label(),
diff --git a/lib/hipe/test/bs_SUITE_data/bs_construct.erl b/lib/hipe/test/bs_SUITE_data/bs_construct.erl
index 9cc9ac848c..37a54c1981 100644
--- a/lib/hipe/test/bs_SUITE_data/bs_construct.erl
+++ b/lib/hipe/test/bs_SUITE_data/bs_construct.erl
@@ -13,6 +13,7 @@ test() ->
ok = bs5(),
16#10000008 = bit_size(large_bin(1, 2, 3, 4)),
ok = bad_ones(),
+ ok = zero_width(),
ok.
%%--------------------------------------------------------------------
@@ -126,3 +127,18 @@ bad_ones() ->
Bin123 = <<1,2,3>>,
?FAIL(<<Bin123/float>>),
ok.
+
+%%--------------------------------------------------------------------
+%% Taken from the emulator bs_construct_SUITE - seg faulted till 18.1
+
+zero_width() ->
+ Z = id(0),
+ Small = id(42),
+ Big = id(1 bsl 128), % puts stuff on the heap
+ <<>> = <<Small:Z>>,
+ <<>> = <<Small:0>>,
+ <<>> = <<Big:Z>>,
+ <<>> = <<Big:0>>,
+ ok.
+
+id(X) -> X.
diff --git a/lib/hipe/vsn.mk b/lib/hipe/vsn.mk
index e507ae933f..3ec9d7ee45 100644
--- a/lib/hipe/vsn.mk
+++ b/lib/hipe/vsn.mk
@@ -1 +1 @@
-HIPE_VSN = 3.12
+HIPE_VSN = 3.13
diff --git a/lib/inets/doc/src/Makefile b/lib/inets/doc/src/Makefile
index a0a3472c4a..cb71fbeb9c 100644
--- a/lib/inets/doc/src/Makefile
+++ b/lib/inets/doc/src/Makefile
@@ -52,7 +52,6 @@ XML_REF3_FILES = \
http_uri.xml\
httpc.xml\
httpd.xml \
- httpd_conf.xml \
httpd_custom_api.xml \
httpd_socket.xml \
httpd_util.xml \
diff --git a/lib/inets/doc/src/ftp.xml b/lib/inets/doc/src/ftp.xml
index f3d4a5c45d..f64bc0e18b 100644
--- a/lib/inets/doc/src/ftp.xml
+++ b/lib/inets/doc/src/ftp.xml
@@ -30,95 +30,94 @@
<file>ftp.xml</file>
</header>
<module>ftp</module>
- <modulesummary>A File Transfer Protocol client</modulesummary>
+ <modulesummary>A File Transfer Protocol client.</modulesummary>
<description>
- <p>The <c>ftp</c> module implements a client for file transfer
- according to a subset of the File Transfer Protocol (see <term
- id="RFC"></term>959). </p>
+ <p>This module implements a client for file transfer
+ according to a subset of the File Transfer Protocol (FTP), see
+ <url href="http://www.ietf.org/rfc/rfc959.txt">RFC 959</url>.</p>
- <p>Starting from inets version 4.4.1 the ftp
- client will always try to use passive ftp mode and only resort
- to active ftp mode if this fails. There is a start option
- <seealso marker="#mode">mode</seealso> where this default behavior
- may be changed. </p>
+ <p>As from <c>Inets</c> 4.4.1, the FTP
+ client always tries to use passive FTP mode and only resort
+ to active FTP mode if this fails. This default behavior can be
+ changed by start option <seealso marker="#mode">mode</seealso>.</p>
<marker id="two_start"></marker>
- <p>There are two ways to start an ftp client. One is using the
- <seealso marker="#service_start">Inets service framework</seealso>
- and the other is to start it directy as a standalone process
- using the <seealso marker="#open">open</seealso> function. </p>
+ <p>An FTP client can be started in two ways. One is using the
+ <seealso marker="#service_start">Inets service framework</seealso>,
+ the other is to start it directly as a standalone process
+ using function <seealso marker="#open">open</seealso>.</p>
- <p>For a simple example of an ftp session see
- <seealso marker="ftp_client">Inets User's Guide.</seealso></p>
+ <p>For a simple example of an FTP session, see
+ <seealso marker="ftp_client">Inets User's Guide</seealso>.</p>
<p>In addition to the ordinary functions for receiving and sending
- files (see <c>recv/2</c>, <c>recv/3</c>, <c>send/2</c> and
+ files (see <c>recv/2</c>, <c>recv/3</c>, <c>send/2</c>, and
<c>send/3</c>) there are functions for receiving remote files as
- binaries (see <c>recv_bin/2</c>) and for sending binaries to to be
+ binaries (see <c>recv_bin/2</c>) and for sending binaries to be
stored as remote files (see <c>send_bin/3</c>).</p>
- <p>There is also a set of functions for sending and receiving
- contiguous parts of a file to be stored in a remote file (for send
- see <c>send_chunk_start/2</c>, <c>send_chunk/2</c> and
- <c>send_chunk_end/1</c> and for receive see
+ <p>A set of functions is provvided for sending and receiving
+ contiguous parts of a file to be stored in a remote file. For send,
+ see <c>send_chunk_start/2</c>, <c>send_chunk/2</c>, and
+ <c>send_chunk_end/1</c>. For receive, see
<c>recv_chunk_start/2</c> and <c>recv_chunk/</c>).</p>
- <p>The particular return values of the functions below depend very
+ <p>The return values of the following functions depend
much on the implementation of the FTP server at the remote
- host. In particular the results from <c>ls</c> and <c>nlist</c>
+ host. In particular, the results from <c>ls</c> and <c>nlist</c>
varies. Often real errors are not reported as errors by <c>ls</c>,
- even if for instance a file or directory does not
+ even if, for example, a file or directory does not
exist. <c>nlist</c> is usually more strict, but some
implementations have the peculiar behaviour of responding with an
- error, if the request is a listing of the contents of directory
- which exists but is empty.</p>
+ error if the request is a listing of the contents of a directory
+ that exists but is empty.</p>
<marker id="service_start"></marker>
</description>
<section>
- <title>FTP CLIENT SERVICE START/STOP </title>
+ <title>FTP CLIENT SERVICE START/STOP</title>
<p>The FTP client can be started and stopped dynamically in runtime by
- calling the Inets application API
+ calling the <c>Inets</c> application API
<c>inets:start(ftpc, ServiceConfig)</c>,
or <c>inets:start(ftpc, ServiceConfig, How)</c>, and
<c>inets:stop(ftpc, Pid)</c>.
- See <seealso marker="inets">inets(3)</seealso> for more info. </p>
- <p>Below follows a description of
- the available configuration options.</p>
+ For details, see <seealso marker="inets">inets(3)</seealso>.</p>
+
+ <p>The available configuration options are as follows:</p>
<taglist>
<tag>{host, Host}</tag>
<item>
<marker id="host"></marker>
- <p>Host = <c>string() | ip_address()</c> </p>
+ <p>Host = <c>string() | ip_address()</c></p>
</item>
<tag>{port, Port}</tag>
<item>
<marker id="port"></marker>
- <p>Port = <c>integer() > 0</c> </p>
- <p>Default is 21.</p>
+ <p>Port = <c>integer() > 0</c></p>
+ <p>Default is <c>21</c>.</p>
</item>
<tag>{mode, Mode}</tag>
<item>
<marker id="mode"></marker>
- <p>Mode = <c>active | passive</c> </p>
- <p>Default is <c>passive</c>. </p>
+ <p>Mode = <c>active | passive</c></p>
+ <p>Default is <c>passive</c>.</p>
</item>
<tag>{verbose, Verbose}</tag>
<item>
<marker id="verbose"></marker>
<p>Verbose = <c>boolean()</c> </p>
- <p>This determines if the FTP communication should be
- verbose or not. </p>
- <p>Default is <c>false</c>. </p>
+ <p>Determines if the FTP communication is to be
+ verbose or not.</p>
+ <p>Default is <c>false</c>.</p>
</item>
<tag>{debug, Debug}</tag>
@@ -126,93 +125,90 @@
<marker id="debug"></marker>
<p>Debug = <c>trace | debug | disable</c> </p>
<p>Debugging using the dbg toolkit. </p>
- <p>Default is <c>disable</c>. </p>
+ <p>Default is <c>disable</c>.</p>
</item>
<tag>{ipfamily, IpFamily}</tag>
<item>
<marker id="ipfamily"></marker>
<p>IpFamily = <c>inet | inet6 | inet6fb4</c> </p>
- <p>With <c>inet6fb4</c> the client behaves as before
- (it tries to use IPv6 and only if that does not work, it
- uses IPv4). </p>
- <p>Default is <c>inet</c> (IPv4). </p>
+ <p>With <c>inet6fb4</c> the client behaves as before, that is,
+ tries to use IPv6, and only if that does not work it
+ uses IPv4).</p>
+ <p>Default is <c>inet</c> (IPv4).</p>
</item>
<tag>{timeout, Timeout}</tag>
<item>
<marker id="timeout"></marker>
- <p>Timeout = <c>non_neg_integer()</c> </p>
- <p>Connection timeout. </p>
- <p>Default is 60000 (milliseconds). </p>
+ <p>Timeout = <c>non_neg_integer()</c></p>
+ <p>Connection time-out.</p>
+ <p>Default is <c>60000</c> (milliseconds).</p>
</item>
<tag>{dtimeout, DTimeout}</tag>
<item>
<marker id="dtimeout"></marker>
<p>DTimeout = <c>non_neg_integer() | infinity</c> </p>
- <p>Data Connect timeout.
- The time the client will wait for the server to connect to the
- data socket. </p>
- <p>Default is infinity. </p>
+ <p>Data connect time-out.
+ The time the client waits for the server to connect to the
+ data socket.</p>
+ <p>Default is <c>infinity</c>. </p>
</item>
<tag>{progress, Progress}</tag>
<item>
<marker id="progress"></marker>
<p>Progress = <c>ignore | {CBModule, CBFunction, InitProgress}</c></p>
- <p>CBModule = <c>atom()</c>, CBFunction = <c>atom()</c> </p>
- <p>InitProgress = <c>term()</c> </p>
- <p>Default is <c>ignore</c>. </p>
+ <p><c>CBModule = atom()</c>, <c>CBFunction = atom()</c></p>
+ <p><c>InitProgress = term()</c></p>
+ <p>Default is <c>ignore</c>.</p>
</item>
</taglist>
- <p>The progress option is intended to be used by applications that
- want to create some type of progress report such as a progress bar in
- a GUI. The default value for the progress option is ignore
- e.i. the option is not used. When the progress option is
- specified the following will happen when ftp:send/[3,4] or
- ftp:recv/[3,4] are called.</p>
+ <p>Option <c>progress</c> is intended to be used by applications that
+ want to create some type of progress report, such as a progress bar in
+ a GUI. Default for the progress option is <c>ignore</c>,
+ that is, the option is not used. When the progress option is
+ specified, the following happens when <c>ftp:send/[3,4]</c> or
+ <c>ftp:recv/[3,4]</c> are called:</p>
<list type="bulleted">
<item>
- <p>Before a file is transfered the following call will
- be made to indicate the start of the file transfer and how big
+ <p>Before a file is transferred, the following call is
+ made to indicate the start of the file transfer and how large
the file is. The return value of the callback function
- should be a new value for the UserProgressTerm that will
- bu used as input next time the callback function is
+ is to be a new value for the <c>UserProgressTerm</c> that will
+ be used as input the next time the callback function is
called.</p>
- <br></br>
<p><c>
CBModule:CBFunction(InitProgress, File, {file_size, FileSize})
</c></p>
- <br></br>
</item>
<item>
- <p>Every time a chunk of bytes is transfered the
- following call will be made:</p>
- <br></br>
+ <p>Every time a chunk of bytes is transferred the
+ following call is made:</p>
<p><c>
- CBModule:CBFunction(UserProgressTerm, File, {transfer_size, TransferSize}) </c></p>
- <br></br>
+ CBModule:CBFunction(UserProgressTerm, File, {transfer_size, TransferSize})
+ </c></p>
</item>
<item>
- <p>At the end of the file the following call will be
- made to indicate the end of the transfer.</p>
- <br></br>
+ <p>At the end of the file the following call is
+ made to indicate the end of the transfer:</p>
<p><c>
- CBModule:CBFunction(UserProgressTerm, File, {transfer_size, 0}) </c></p>
- <br></br>
+ CBModule:CBFunction(UserProgressTerm, File, {transfer_size, 0})
+ </c></p>
</item>
</list>
- <p>The callback function should be defined as </p>
+ <p>The callback function is to be defined as follows:</p>
<p><c>
- CBModule:CBFunction(UserProgressTerm, File, Size) -> UserProgressTerm </c></p>
+ CBModule:CBFunction(UserProgressTerm, File, Size) -> UserProgressTerm
+ </c></p>
<p><c>
CBModule = CBFunction = atom()
@@ -227,50 +223,51 @@
</c></p>
<p><c>
- Size = {transfer_size, integer()} | {file_size, integer()} | {file_size, unknown} </c></p>
+ Size = {transfer_size, integer()} | {file_size, integer()} | {file_size, unknown}
+ </c></p>
- <p>Alas for remote files it is not possible for ftp to determine the
+ <p>For remote files, <c>ftp</c> cannot determine the
file size in a platform independent way. In this case the size
- will be <c>unknown</c> and it is left to the application to find
- out the size. </p>
+ becomes <c>unknown</c> and it is left to the application to
+ determine the size.</p>
<note>
<p>The callback is made by a middleman process, hence the
- file transfer will not be affected by the code in the progress
- callback function. If the callback should crash this will be
- detected by the ftp connection process that will print an
- info-report and then go one as if the progress option was set
- to ignore. </p>
+ file transfer is not affected by the code in the progress
+ callback function. If the callback crashes, this is
+ detected by the FTP connection process, which then prints an
+ info-report and goes on as if the progress option was set
+ to <c>ignore</c>.</p>
</note>
<p>The file transfer type is set to the default of the FTP server
- when the session is opened. This is usually ASCCI-mode.
+ when the session is opened. This is usually ASCCI mode.
</p>
- <p>The current local working directory (cf. <c>lpwd/1</c>) is set to
- the value reported by <c>file:get_cwd/1</c>. the wanted
+ <p>The current local working directory (compare <c>lpwd/1</c>) is set
+ to the value reported by <c>file:get_cwd/1</c>, the wanted
local directory.
</p>
<p>The return value <c>Pid</c> is used as a reference to the
- newly created ftp client in all other functions, and they should
- be called by the process that created the connection. The ftp
+ newly created FTP client in all other functions, and they are to
+ be called by the process that created the connection. The FTP
client process monitors the process that created it and
- will terminate if that process terminates.</p>
+ terminates if that process terminates.</p>
</section>
<section>
- <title>COMMON DATA TYPES </title>
- <p>Here follows type definitions that are used by more than one
- function in the FTP client API. </p>
- <p><c> pid() - identifier of an ftp connection.</c></p>
- <p><c> string() = list of ASCII characters.</c></p>
- <p><c> shortage_reason() = etnospc | epnospc</c></p>
- <p><c> restriction_reason() = epath | efnamena | elogin | enotbinary
- - note not all restrictions may always relevant to all functions
- </c></p>
- <p><c>common_reason() = econn | eclosed | term() - some kind of
- explanation of what went wrong.</c></p>
+ <title>DATA TYPES</title>
+ <p>The following type definitions are used by more than one
+ function in the FTP client API:</p>
+ <p><c>pid()</c> = identifier of an FTP connection</p>
+ <p><c>string()</c> = list of ASCII characters</p>
+ <p><c>shortage_reason()</c> = <c>etnospc | epnospc</c></p>
+ <p><c>restriction_reason()</c> = <c>epath | efnamena | elogin | enotbinary</c>
+ - all restrictions are not always relevant to all functions
+ </p>
+ <p><c>common_reason()</c> = <c>econn | eclosed | term()</c>
+ - some explanation of what went wrong</p>
<marker id="account"></marker>
</section>
@@ -278,15 +275,14 @@
<funcs>
<func>
<name>account(Pid, Account) -> ok | {error, Reason}</name>
- <fsummary>Specify which account to use.</fsummary>
+ <fsummary>Specifies which account to use.</fsummary>
<type>
<v>Pid = pid()</v>
<v>Account = string()</v>
<v>Reason = eacct | common_reason()</v>
</type>
<desc>
- <p>If an account is needed for an operation set the account
- with this operation.</p>
+ <p>Sets the account for an operation, if needed.</p>
<marker id="append"></marker>
<marker id="append2"></marker>
@@ -297,7 +293,8 @@
<func>
<name>append(Pid, LocalFile) -> </name>
<name>append(Pid, LocalFile, RemoteFile) -> ok | {error, Reason}</name>
- <fsummary>Transfer file to remote server, and append it to Remotefile.</fsummary>
+ <fsummary>Transfers a file to remote server, and appends it to
+ <c>Remotefile</c>.</fsummary>
<type>
<v>Pid = pid()</v>
<v>LocalFile = RemoteFile = string()</v>
@@ -306,9 +303,9 @@
<desc>
<p>Transfers the file <c>LocalFile</c> to the remote server. If
<c>RemoteFile</c> is specified, the name of the remote file that the
- file will be appended to is set to <c>RemoteFile</c>; otherwise
- the name is set to <c>LocalFile</c> If the file does not exists the
- file will be created.</p>
+ file is appended to is set to <c>RemoteFile</c>, otherwise
+ to <c>LocalFile</c>. If the file does not exists,
+ it is created.</p>
<marker id="append_bin"></marker>
</desc>
@@ -316,17 +313,17 @@
<func>
<name>append_bin(Pid, Bin, RemoteFile) -> ok | {error, Reason}</name>
- <fsummary>Transfer a binary into a remote file.</fsummary>
+ <fsummary>Transfers a binary into a remote file.</fsummary>
<type>
<v>Pid = pid()</v>
<v>Bin = binary()()</v>
<v>RemoteFile = string()</v>
- <v>Reason = restriction_reason()| shortage_reason() | common_reason()</v>
+ <v>Reason = restriction_reason()| shortage_reason() | common_reason()</v>
</type>
<desc>
- <p>Transfers the binary <c>Bin</c> to the remote server and append
- it to the file <c>RemoteFile</c>. If the file does not exists it
- will be created.</p>
+ <p>Transfers the binary <c>Bin</c> to the remote server and appends
+ it to the file <c>RemoteFile</c>. If the file does not exist, it
+ is created.</p>
<marker id="append_chunk"></marker>
</desc>
@@ -334,18 +331,18 @@
<func>
<name>append_chunk(Pid, Bin) -> ok | {error, Reason}</name>
- <fsummary>append a chunk to the remote file.</fsummary>
+ <fsummary>Appends a chunk to the remote file.</fsummary>
<type>
<v>Pid = pid()</v>
<v>Bin = binary()</v>
<v>Reason = echunk | restriction_reason() | common_reason()</v>
</type>
<desc>
- <p>Transfer the chunk <c>Bin</c> to the remote server, which
- append it into the file specified in the call to
- <c>append_chunk_start/2</c>. </p>
- <p>Note that for some errors, e.g. file system full, it is
- necessary to to call <c>append_chunk_end</c> to get the
+ <p>Transfers the chunk <c>Bin</c> to the remote server, which
+ appends it to the file specified in the call to
+ <c>append_chunk_start/2</c>.</p>
+ <p>For some errors, for example, file system full, it is
+ necessary to call <c>append_chunk_end</c> to get the
proper reason.</p>
<marker id="append_chunk_start"></marker>
@@ -354,16 +351,16 @@
<func>
<name>append_chunk_start(Pid, File) -> ok | {error, Reason}</name>
- <fsummary>Start transfer of file chunks for appending to File.</fsummary>
+ <fsummary>Starts transfer of file chunks for appending to <c>File</c>.</fsummary>
<type>
<v>Pid = pid()</v>
<v>File = string()</v>
<v>Reason = restriction_reason() | common_reason()</v>
</type>
<desc>
- <p>Start the transfer of chunks for appending to the file
- <c>File</c> at the remote server. If the file does not exists
- it will be created.</p>
+ <p>Starts the transfer of chunks for appending to the file
+ <c>File</c> at the remote server. If the file does not exist,
+ it is created.</p>
<marker id="append_chunk_end"></marker>
</desc>
@@ -371,7 +368,7 @@
<func>
<name>append_chunk_end(Pid) -> ok | {error, Reason}</name>
- <fsummary>Stop transfer of chunks for appending.</fsummary>
+ <fsummary>Stops transfer of chunks for appending.</fsummary>
<type>
<v>Pid = pid()</v>
<v>Reason = echunk | restriction_reason() | shortage_reason() </v>
@@ -379,7 +376,7 @@
<desc>
<p>Stops transfer of chunks for appending to the remote server.
The file at the remote server, specified in the call to
- <c>append_chunk_start/2</c> is closed by the server.</p>
+ <c>append_chunk_start/2</c>, is closed by the server.</p>
<marker id="cd"></marker>
</desc>
@@ -387,7 +384,7 @@
<func>
<name>cd(Pid, Dir) -> ok | {error, Reason}</name>
- <fsummary>Change remote working directory.</fsummary>
+ <fsummary>Changes remote working directory.</fsummary>
<type>
<v>Pid = pid()</v>
<v>Dir = string()</v>
@@ -403,13 +400,13 @@
<func>
<name>close(Pid) -> ok</name>
- <fsummary>End the ftp session.</fsummary>
+ <fsummary>Ends the FTP session.</fsummary>
<type>
<v>Pid = pid()</v>
</type>
<desc>
- <p>Ends an ftp session, created using the
- <seealso marker="#open">open</seealso> function. </p>
+ <p>Ends an FTP session, created using function
+ <seealso marker="#open">open</seealso>.</p>
<marker id="delete"></marker>
</desc>
@@ -417,7 +414,7 @@
<func>
<name>delete(Pid, File) -> ok | {error, Reason}</name>
- <fsummary>Delete a file at the remote server..</fsummary>
+ <fsummary>Deletes a file at the remote server.</fsummary>
<type>
<v>Pid = pid()</v>
<v>File = string()</v>
@@ -432,7 +429,7 @@
<func>
<name>formaterror(Tag) -> string()</name>
- <fsummary>Return error diagnostics.</fsummary>
+ <fsummary>Returns error diagnostics.</fsummary>
<type>
<v>Tag = {error, atom()} | atom()</v>
</type>
@@ -446,14 +443,14 @@
<func>
<name>lcd(Pid, Dir) -> ok | {error, Reason}</name>
- <fsummary>Change local working directory.</fsummary>
+ <fsummary>Changes local working directory.</fsummary>
<type>
<v>Pid = pid()</v>
<v>Dir = string()</v>
<v>Reason = restriction_reason()</v>
</type>
<desc>
- <p>Changes the working directory to <c>Dir</c> for the local client. </p>
+ <p>Changes the working directory to <c>Dir</c> for the local client.</p>
<marker id="lpwd"></marker>
</desc>
@@ -461,7 +458,7 @@
<func>
<name>lpwd(Pid) -> {ok, Dir}</name>
- <fsummary>Get local current working directory.</fsummary>
+ <fsummary>Gets local current working directory.</fsummary>
<type>
<v>Pid = pid()</v>
</type>
@@ -485,13 +482,13 @@
<v>Reason = restriction_reason() | common_reason()</v>
</type>
<desc>
- <p>Returns a list of files in long format. </p>
- <p><c>Pathname</c> can be a directory, a group of files or
- even a file. The <c>Pathname</c> string can contain wildcard(s). </p>
- <p><c>ls/1</c> implies the user's current remote directory. </p>
- <p>The format of <c>Listing</c> is operating system dependent
- (on UNIX it is typically produced from the output of the
- <c>ls -l</c> shell command).</p>
+ <p>Returns a list of files in long format.</p>
+ <p><c>Pathname</c> can be a directory, a group of files, or
+ a file. The <c>Pathname</c> string can contain wildcards.</p>
+ <p><c>ls/1</c> implies the current remote directory of the user.</p>
+ <p>The format of <c>Listing</c> depends on the operating system.
+ On UNIX, it is typically produced from the output of the
+ <c>ls -l</c> shell command.</p>
<marker id="mkdir"></marker>
</desc>
@@ -499,7 +496,7 @@
<func>
<name>mkdir(Pid, Dir) -> ok | {error, Reason}</name>
- <fsummary>Create remote directory.</fsummary>
+ <fsummary>Creates a remote directory.</fsummary>
<type>
<v>Pid = pid()</v>
<v>Dir = string()</v>
@@ -525,15 +522,15 @@
<v>Reason = restriction_reason() | common_reason()</v>
</type>
<desc>
- <p>Returns a list of files in short format. </p>
- <p><c>Pathname</c> can be a directory, a group of files or
- even a file. The <c>Pathname</c> string can contain wildcard(s). </p>
- <p><c>nlist/1</c> implies the user's current remote directory. </p>
+ <p>Returns a list of files in short format.</p>
+ <p><c>Pathname</c> can be a directory, a group of files, or
+ a file. The <c>Pathname</c> string can contain wildcards.</p>
+ <p><c>nlist/1</c> implies the current remote directory of the user.</p>
<p>The format of <c>Listing</c> is a stream of
- file names, where each name is separated by &lt;CRLF&gt; or
- &lt;NL&gt;. Contrary to the <c>ls</c> function, the purpose of
- <c>nlist</c> is to make it possible for a program to
- automatically process file name information.</p>
+ filenames where each filename is separated by &lt;CRLF&gt; or
+ &lt;NL&gt;. Contrary to function <c>ls</c>, the purpose of
+ <c>nlist</c> is to enable a program to
+ process filename information automatically.</p>
<marker id="open"></marker>
</desc>
@@ -542,23 +539,23 @@
<func>
<name>open(Host) -> {ok, Pid} | {error, Reason}</name>
<name>open(Host, Opts) -> {ok, Pid} | {error, Reason}</name>
- <fsummary>Start an standalone ftp client.</fsummary>
+ <fsummary>Starts a standalone FTP client.</fsummary>
<type>
<v>Host = string() | ip_address()</v>
<v>Opts = options()</v>
<v>options() = [option()]</v>
<v>option() = start_option() | open_option()</v>
<v>start_option() = {verbose, verbose()} | {debug, debug()}</v>
- <v>verbose() = boolean() (defaults to false)</v>
- <v>debug() = disable | debug | trace (defaults to disable)</v>
+ <v>verbose() = boolean() (default is false)</v>
+ <v>debug() = disable | debug | trace (default is disable)</v>
<v>open_option() = {ipfamily, ipfamily()} | {port, port()} | {mode, mode()} | {tls, tls_options()} | {timeout, timeout()} | {dtimeout, dtimeout()} | {progress, progress()}</v>
- <v>ipfamily() = inet | inet6 | inet6fb4 (defaults to inet)</v>
- <v>port() = integer() > 0 (defaults to 21)</v>
- <v>mode() = active | passive (defaults to passive)</v>
+ <v>ipfamily() = inet | inet6 | inet6fb4 (default is inet)</v>
+ <v>port() = integer() > 0 (default is 21)</v>
+ <v>mode() = active | passive (default is passive)</v>
<v>tls_options() = [<seealso marker="ssl:ssl#type-ssloption">ssl:ssloption()</seealso>]</v>
- <v>timeout() = integer() > 0 (defaults to 60000 milliseconds)</v>
- <v>dtimeout() = integer() > 0 | infinity (defaults to infinity)</v>
- <v>pogress() = ignore | {module(), function(), initial_data()} (defaults to ignore)</v>
+ <v>timeout() = integer() > 0 (default is 60000 milliseconds)</v>
+ <v>dtimeout() = integer() > 0 | infinity (default is infinity)</v>
+ <v>pogress() = ignore | {module(), function(), initial_data()} (default is ignore)</v>
<v>module() = atom()</v>
<v>function() = atom()</v>
<v>initial_data() = term()</v>
@@ -566,16 +563,20 @@
</type>
<desc>
- <p>This function is used to start a standalone ftp client process
- (without the inets service framework) and
- open a session with the FTP server at <c>Host</c>. </p>
+ <p>Starts a standalone FTP client process
+ (without the <c>Inets</c> service framework) and
+ opens a session with the FTP server at <c>Host</c>. </p>
- <p>If the option <c>{tls, tls_options()}</c> is present, the ftp session will be transported over tls (ftps, see
-<url href="http://www.ietf.org/rfc/rfc4217.txt">RFC 4217</url>). The list <c>tls_options()</c> may be empty. The function <seealso marker="ssl:ssl#connect/3"><c>ssl:connect/3</c></seealso> is used for securing both the control connection and the data sessions.
+ <p>If option <c>{tls, tls_options()}</c> is present, the FTP session
+ is transported over <c>tls</c> (<c>ftps</c>, see
+ <url href="http://www.ietf.org/rfc/rfc4217.txt">RFC 4217</url>).
+ The list <c>tls_options()</c> can be empty. The function
+ <seealso marker="ssl:ssl#connect/3"><c>ssl:connect/3</c></seealso>
+ is used for securing both the control connection and the data sessions.
</p>
- <p>A session opened in this way, is closed using the
- <seealso marker="#close">close</seealso> function. </p>
+ <p>A session opened in this way is closed using function
+ <seealso marker="#close">close</seealso>.</p>
<marker id="pwd"></marker>
</desc>
@@ -583,22 +584,10 @@
<func>
<name>pwd(Pid) -> {ok, Dir} | {error, Reason}</name>
- <fsummary>Get remote current working directory.</fsummary>
- <type>
- <v>Pid = pid()</v>
- <v>Reason = restriction_reason() | common_reason() </v>
- </type>
- <desc>
- <p>Returns the current working directory at the remote server. </p>
- </desc>
- </func>
-
- <func>
- <name>pwd(Pid) -> {ok, Dir} | {error, Reason}</name>
- <fsummary>Get remote current working directory.</fsummary>
+ <fsummary>Gets the remote current working directory.</fsummary>
<type>
<v>Pid = pid()</v>
- <v>Reason = restriction_reason() | common_reason() </v>
+ <v>Reason = restriction_reason() | common_reason()</v>
</type>
<desc>
<p>Returns the current working directory at the remote server.</p>
@@ -612,7 +601,7 @@
<func>
<name>recv(Pid, RemoteFile) -> </name>
<name>recv(Pid, RemoteFile, LocalFile) -> ok | {error, Reason}</name>
- <fsummary>Transfer file from remote server.</fsummary>
+ <fsummary>Transfers a file from remote server.</fsummary>
<type>
<v>Pid = pid()</v>
<v>RemoteFile = LocalFile = string()</v>
@@ -620,14 +609,14 @@
<v>file_write_error_reason() = see file:write/2</v>
</type>
<desc>
- <p>Transfer the file <c>RemoteFile</c> from the remote server
- to the the file system of the local client. If
+ <p>Transfers the file <c>RemoteFile</c> from the remote server
+ to the file system of the local client. If
<c>LocalFile</c> is specified, the local file will be
- <c>LocalFile</c>; otherwise it will be
+ <c>LocalFile</c>, otherwise
<c>RemoteFile</c>.</p>
- <p>If the file write fails
- (e.g. enospc), then the command is aborted and <c>{error, file_write_error_reason()}</c> is returned. The file is
- however <em>not</em> removed.</p>
+ <p>If the file write fails (for example, <c>enospc</c>), the command is
+ aborted and <c>{error, file_write_error_reason()}</c> is returned.
+ However, the file is <em>not</em> removed.</p>
<marker id="recv_bin"></marker>
</desc>
@@ -635,7 +624,7 @@
<func>
<name>recv_bin(Pid, RemoteFile) -> {ok, Bin} | {error, Reason}</name>
- <fsummary>Transfer file from remote server as a binary.</fsummary>
+ <fsummary>Transfers a file from remote server as a binary.</fsummary>
<type>
<v>Pid = pid()</v>
<v>Bin = binary()</v>
@@ -652,14 +641,14 @@
<func>
<name>recv_chunk_start(Pid, RemoteFile) -> ok | {error, Reason}</name>
- <fsummary>Start chunk-reading of the remote file.</fsummary>
+ <fsummary>Starts chunk-reading of the remote file.</fsummary>
<type>
<v>Pid = pid()</v>
<v>RemoteFile = string()</v>
<v>Reason = restriction_reason() | common_reason()</v>
</type>
<desc>
- <p>Start transfer of the file <c>RemoteFile</c> from the
+ <p>Starts transfer of the file <c>RemoteFile</c> from the
remote server.</p>
<marker id="recv_chunk"></marker>
@@ -668,20 +657,20 @@
<func>
<name>recv_chunk(Pid) -> ok | {ok, Bin} | {error, Reason}</name>
- <fsummary>Receive a chunk of the remote file.</fsummary>
+ <fsummary>Receives a chunk of the remote file.</fsummary>
<type>
<v>Pid = pid()</v>
<v>Bin = binary()</v>
<v>Reason = restriction_reason() | common_reason()</v>
</type>
<desc>
- <p>Receive a chunk of the remote file (<c>RemoteFile</c> of
- <c>recv_chunk_start</c>). The return values has the following
+ <p>Receives a chunk of the remote file (<c>RemoteFile</c> of
+ <c>recv_chunk_start</c>). The return values have the following
meaning:</p>
<list type="bulleted">
- <item><c>ok</c> the transfer is complete.</item>
- <item><c>{ok, Bin}</c> just another chunk of the file.</item>
- <item><c>{error, Reason}</c> transfer failed.</item>
+ <item><c>ok</c> = the transfer is complete.</item>
+ <item><c>{ok, Bin}</c> = just another chunk of the file.</item>
+ <item><c>{error, Reason}</c> = transfer failed.</item>
</list>
<marker id="rename"></marker>
@@ -690,7 +679,7 @@
<func>
<name>rename(Pid, Old, New) -> ok | {error, Reason}</name>
- <fsummary>Rename a file at the remote server..</fsummary>
+ <fsummary>Renames a file at the remote server.</fsummary>
<type>
<v>Pid = pid()</v>
<v>CurrFile = NewFile = string()</v>
@@ -705,7 +694,7 @@
<func>
<name>rmdir(Pid, Dir) -> ok | {error, Reason}</name>
- <fsummary>Remove a remote directory.</fsummary>
+ <fsummary>Removes a remote directory.</fsummary>
<type>
<v>Pid = pid()</v>
<v>Dir = string()</v>
@@ -723,7 +712,7 @@
<func>
<name>send(Pid, LocalFile) -></name>
<name>send(Pid, LocalFile, RemoteFile) -> ok | {error, Reason}</name>
- <fsummary>Transfer file to remote server.</fsummary>
+ <fsummary>Transfers a file to the remote server.</fsummary>
<type>
<v>Pid = pid()</v>
<v>LocalFile = RemoteFile = string()</v>
@@ -732,7 +721,7 @@
<desc>
<p>Transfers the file <c>LocalFile</c> to the remote server. If
<c>RemoteFile</c> is specified, the name of the remote file is set
- to <c>RemoteFile</c>; otherwise the name is set to <c>LocalFile</c>.</p>
+ to <c>RemoteFile</c>, otherwise to <c>LocalFile</c>.</p>
<marker id="send_bin"></marker>
</desc>
@@ -740,7 +729,7 @@
<func>
<name>send_bin(Pid, Bin, RemoteFile) -> ok | {error, Reason}</name>
- <fsummary>Transfer a binary into a remote file.</fsummary>
+ <fsummary>Transfers a binary into a remote file.</fsummary>
<type>
<v>Pid = pid()</v>
<v>Bin = binary()()</v>
@@ -757,17 +746,17 @@
<func>
<name>send_chunk(Pid, Bin) -> ok | {error, Reason}</name>
- <fsummary>Write a chunk to the remote file.</fsummary>
+ <fsummary>Writes a chunk to the remote file.</fsummary>
<type>
<v>Pid = pid()</v>
<v>Bin = binary()</v>
<v>Reason = echunk | restriction_reason() | common_reason()</v>
</type>
<desc>
- <p>Transfer the chunk <c>Bin</c> to the remote server, which
+ <p>Transfers the chunk <c>Bin</c> to the remote server, which
writes it into the file specified in the call to
- <c>send_chunk_start/2</c>. </p>
- <p>Note that for some errors, e.g. file system full, it is
+ <c>send_chunk_start/2</c>.</p>
+ <p>For some errors, for example, file system full, it is
necessary to to call <c>send_chunk_end</c> to get the
proper reason.</p>
@@ -777,14 +766,14 @@
<func>
<name>send_chunk_start(Pid, File) -> ok | {error, Reason}</name>
- <fsummary>Start transfer of file chunks.</fsummary>
+ <fsummary>Starts transfer of file chunks.</fsummary>
<type>
<v>Pid = pid()</v>
<v>File = string()</v>
<v>Reason = restriction_reason() | common_reason()</v>
</type>
<desc>
- <p>Start transfer of chunks into the file <c>File</c> at the
+ <p>Starts transfer of chunks into the file <c>File</c> at the
remote server.</p>
<marker id="send_chunk_end"></marker>
@@ -793,7 +782,7 @@
<func>
<name>send_chunk_end(Pid) -> ok | {error, Reason}</name>
- <fsummary>Stop transfer of chunks.</fsummary>
+ <fsummary>Stops transfer of chunks.</fsummary>
<type>
<v>Pid = pid()</v>
<v>Reason = restriction_reason() | common_reason() | shortage_reason()</v>
@@ -809,7 +798,7 @@
<func>
<name>type(Pid, Type) -> ok | {error, Reason}</name>
- <fsummary>Set transfer type to <c>ascii</c>or <c>binary</c>.</fsummary>
+ <fsummary>Sets transfer type to <c>ascii</c>or <c>binary</c>.</fsummary>
<type>
<v>Pid = pid()</v>
<v>Type = ascii | binary</v>
@@ -817,8 +806,8 @@
</type>
<desc>
<p>Sets the file transfer type to <c>ascii</c> or <c>binary</c>. When
- an ftp session is opened, the default transfer type of the
- server is used, most often <c>ascii</c>, which is the default
+ an FTP session is opened, the default transfer type of the
+ server is used, most often <c>ascii</c>, which is default
according to <url href="http://www.ietf.org/rfc/rfc959.txt">RFC 959</url>.</p>
<marker id="user3"></marker>
</desc>
@@ -857,21 +846,22 @@
<func>
<name>quote(Pid, Command) -> [FTPLine]</name>
- <fsummary>Sends an arbitrary FTP command. </fsummary>
+ <fsummary>Sends an arbitrary FTP command.</fsummary>
<type>
<v>Pid = pid()</v>
<v>Command = string()</v>
- <v>FTPLine = string() - Note the telnet end of line characters, from the ftp protocol definition, CRLF e.g. "\\r\\n" has been removed.</v>
- </type>
- <desc>
- <p>Sends an arbitrary FTP command and returns verbatimly a list
- of the lines sent back by the FTP server. This functions is
- intended to give an application accesses to FTP commands
- that are server specific or that may not be provided by
- this FTP client. </p>
+ <v>FTPLine = string(</v>
+ </type>
+ <desc><note><p>The telnet end of line characters, from the FTP
+ protocol definition, CRLF, for example, "\\r\\n" has been removed.</p></note>
+ <p>Sends an arbitrary FTP command and returns verbatim a list
+ of the lines sent back by the FTP server. This function is
+ intended to give application accesses to FTP commands
+ that are server-specific or that cannot be provided by
+ this FTP client.</p>
<note>
- <p>FTP commands that require a data connection can not be
- successfully issued with this function. </p>
+ <p>FTP commands requiring a data connection cannot be
+ successfully issued with this function.</p>
</note>
</desc>
</func>
@@ -885,30 +875,31 @@
<taglist>
<tag><c>echunk</c></tag>
<item>
- <p>Synchronisation error during chunk sending.
- </p>
- <p>A call has been made to <c>send_chunk/2</c> or
- <c>send_chunk_end/1</c>, before a call to
- <c>send_chunk_start/2</c>; or a call has been made to another
- transfer function during chunk sending, i.e. before a call
- to <c>send_chunk_end/1</c>.</p>
+ <p>Synchronization error during chunk sending according to one
+ of the following:
+ </p><list type="bulleted">
+ <item>A call is made to <c>send_chunk/2</c> or <c>send_chunk_end/1</c>
+ before a call to <c>send_chunk_start/2</c>.</item>
+ <item>A call has been made to another transfer function during chunk
+ sending, that is, before a call to <c>send_chunk_end/1</c>.</item>
+ </list>
</item>
<tag><c>eclosed</c></tag>
<item>
- <p>The session has been closed.</p>
+ <p>The session is closed.</p>
</item>
<tag><c>econn</c></tag>
<item>
- <p>Connection to remote server prematurely closed.</p>
+ <p>Connection to the remote server is prematurely closed.</p>
</item>
<tag><c>ehost</c></tag>
<item>
- <p>Host not found, FTP server not found, or connection rejected
+ <p>Host is not found, FTP server is not found, or connection is rejected
by FTP server.</p>
</item>
<tag><c>elogin</c></tag>
<item>
- <p>User not logged in.</p>
+ <p>User is not logged in.</p>
</item>
<tag><c>enotbinary</c></tag>
<item>
@@ -925,7 +916,7 @@
</item>
<tag><c>euser</c></tag>
<item>
- <p>User name or password not valid.</p>
+ <p>Invalid username or password.</p>
</item>
<tag><c>etnospc</c></tag>
<item>
@@ -938,14 +929,16 @@
</item>
<tag><c>efnamena</c></tag>
<item>
- <p>File name not allowed [553].</p>
+ <p>Filename not allowed [553].</p>
</item>
</taglist>
</section>
<section>
<title>SEE ALSO</title>
- <p>file, filename, J. Postel and J. Reynolds: File Transfer Protocol
+ <p><seealso marker="kernel:file">file(3)</seealso>
+ <seealso marker="stdlib:filename">filename(3)</seealso>
+ and J. Postel and J. Reynolds: File Transfer Protocol
(<url href="http://www.ietf.org/rfc/rfc959.txt">RFC 959</url>).
</p>
</section>
diff --git a/lib/inets/doc/src/ftp_client.xml b/lib/inets/doc/src/ftp_client.xml
index 2f5b8abb5f..89e66db814 100644
--- a/lib/inets/doc/src/ftp_client.xml
+++ b/lib/inets/doc/src/ftp_client.xml
@@ -34,38 +34,24 @@
</header>
<section>
- <title>Introduction</title>
+ <title>Getting Started</title>
- <p>Ftp clients are consider to be rather temporary and are
- for that reason only started and stopped during
- runtime and can not be started at application startup.
- Due to the design of FTP client API, letting some
- functions return intermediate results, only the process
- that started the ftp client will be able to access it in
- order to preserve sane semantics. (This could be solved
- by changing the API and using the concept of a controlling
- process more in line with other OTP applications, but
- that is perhaps something for the future.)
- If the process that started the ftp session
- dies the ftp client process will terminate.</p>
+ <p>FTP clients are considered to be rather temporary. Thus,
+ they are only started and stopped during runtime and cannot
+ be started at application startup.
+ The FTP client API is designed to allow some functions to
+ return intermediate results. This implies that only the process
+ that started the FTP client can access it with
+ preserved sane semantics.
+ If the process that started the FTP session
+ dies, the FTP client process terminates.</p>
- <p>The client supports ipv6 as long as the underlying mechanisms
- also do so. </p>
+ <p>The client supports IPv6 as long as the underlying mechanisms
+ also do so.</p>
- </section>
-
- <section>
- <title>Using the FTP Client API</title>
- <p>The following is a simple example of an ftp session, where
+ <p>The following is a simple example of an FTP session, where
the user <c>guest</c> with password <c>password</c> logs on to
- the remote host <c>erlang.org</c>, and where the file
- <c>appl.erl</c> is transferred from the remote to the local
- host. When the session is opened, the current directory at
- the remote host is <c>/home/guest</c>, and <c>/home/fred</c>
- at the local host. Before transferring the file, the current
- local directory is changed to <c>/home/eproj/examples</c>, and
- the remote directory is set to
- <c>/home/guest/appl/examples</c>.</p>
+ the remote host <c>erlang.org</c>:</p>
<code type="erl"><![CDATA[
1> inets:start().
ok
@@ -86,6 +72,14 @@
9> inets:stop(ftpc, Pid).
ok
]]></code>
+ <p> The file
+ <c>appl.erl</c> is transferred from the remote to the local
+ host. When the session is opened, the current directory at
+ the remote host is <c>/home/guest</c>, and <c>/home/fred</c>
+ at the local host. Before transferring the file, the current
+ local directory is changed to <c>/home/eproj/examples</c>, and
+ the remote directory is set to
+ <c>/home/guest/appl/examples</c>.</p>
</section>
</chapter>
diff --git a/lib/inets/doc/src/http_client.xml b/lib/inets/doc/src/http_client.xml
index 5c42f72cec..f4d7b751ac 100644
--- a/lib/inets/doc/src/http_client.xml
+++ b/lib/inets/doc/src/http_client.xml
@@ -34,103 +34,91 @@
</header>
<section>
- <title>Introduction</title>
+ <title>Configuration</title>
- <p>The HTTP client default profile will be started when the inets
+ <p>The HTTP client default profile is started when the <c>Inets</c>
application is started and is then available to all processes on
- that erlang node. Other profiles may also be started at
+ that Erlang node. Other profiles can also be started at
application startup, or profiles can be started and stopped
- dynamically in runtime. Each client profile will spawn a new
- process to handle each request unless there is a possibility to use
- a persistent connection with or without pipelining.
- The client will add a <c>host</c> header and an empty
+ dynamically in runtime. Each client profile spawns a new
+ process to handle each request, unless a persistent connection
+ can be used with or without pipelining.
+ The client adds a <c>host</c> header and an empty
<c>te</c> header if there are no such headers present in the request.</p>
- <p>The client supports ipv6 as long as the underlying mechanisms also do
+ <p>The client supports IPv6 as long as the underlying mechanisms also do
so.</p>
- </section>
- <section>
- <title>Configuration</title>
- <p> What to put in the erlang node application configuration file
- in order to start a profile at application startup.</p>
+ <p>The following is to be put in the Erlang node application configuration file
+ to start a profile at application startup:</p>
<pre>
- [{inets, [{services, [{httpc, PropertyList}]}]}]
- </pre>
- <p>For valid properties see
+ [{inets, [{services, [{httpc, PropertyList}]}]}]</pre>
+ <p>For valid properties, see
<seealso marker="httpc">httpc(3)</seealso>. </p>
</section>
<section>
- <title>Using the HTTP Client API</title>
+ <title>Getting Started</title>
+ <p>Start <c>Inets</c>:</p>
<code type="erl">
1 > inets:start().
- ok
- </code>
- <p> The following calls uses the default client profile.
- Use the proxy "www-proxy.mycompany.com:8000",
- but not for requests to localhost. This will apply to all subsequent
- requests</p>
+ ok</code>
+ <p>The following calls use the default client profile.
+ Use the proxy <c>"www-proxy.mycompany.com:8000"</c>,
+ except from requests to localhost. This applies to all the
+ following requests.</p>
+ <p>Example:</p>
<code type="erl">
2 > httpc:set_options([{proxy, {{"www-proxy.mycompany.com", 8000},
["localhost"]}}]).
- ok
- </code>
- <p>An ordinary synchronous request. </p>
+ ok</code>
+ <p>The following is an ordinary synchronous request:</p>
<code type="erl">
3 > {ok, {{Version, 200, ReasonPhrase}, Headers, Body}} =
- httpc:request(get, {"http://www.erlang.org", []}, [], []).
- </code>
- <p>With all default values, as above, a get request can also be written
- like this.</p>
+ httpc:request(get, {"http://www.erlang.org", []}, [], []).</code>
+ <p>With all the default values presented, a get request can also be written
+ as follows:</p>
<code type="erl">
4 > {ok, {{Version, 200, ReasonPhrase}, Headers, Body}} =
- httpc:request("http://www.erlang.org").
- </code>
- <p>An ordinary asynchronous request. The result will be sent
- to the calling process in the form <c>{http, {ReqestId, Result}}</c></p>
+ httpc:request("http://www.erlang.org").</code>
+ <p>The following is an ordinary asynchronous request:</p>
<code type="erl">
5 > {ok, RequestId} =
- httpc:request(get, {"http://www.erlang.org", []}, [], [{sync, false}]).
- </code>
- <p>In this case the calling process is the shell, so we receive the
- result.</p>
+ httpc:request(get, {"http://www.erlang.org", []}, [], [{sync, false}]).</code>
+ <p>The result is sent to the calling process as
+ <c>{http, {ReqestId, Result}}</c>.</p>
+ <p>In this case, the calling process is the shell, so the following
+ result is received:</p>
<code type="erl">
6 > receive {http, {RequestId, Result}} -> ok after 500 -> error end.
- ok
- </code>
- <p>Send a request with a specified connection header. </p>
+ ok</code>
+ <p>This sends a request with a specified connection header:</p>
<code type="erl">
7 > {ok, {{NewVersion, 200, NewReasonPhrase}, NewHeaders, NewBody}} =
httpc:request(get, {"http://www.erlang.org", [{"connection", "close"}]},
- [], []).
- </code>
+ [], []).</code>
- <p>Start a HTTP client profile. </p>
+ <p>Start an HTTP client profile:</p>
<code><![CDATA[
8 > {ok, Pid} = inets:start(httpc, [{profile, foo}]).
{ok, <0.45.0>}
]]></code>
- <p>The new profile has no proxy settings so the connection will
- be refused</p>
+ <p>The new profile has no proxy settings, so the connection is refused:</p>
<code type="erl">
9 > httpc:request("http://www.erlang.org", foo).
- {error, econnrefused}
- </code>
+ {error, econnrefused}</code>
- <p>Stop a HTTP client profile. </p>
+ <p>Stop the HTTP client profile:</p>
<code type="erl">
10 > inets:stop(httpc, foo).
- ok
- </code>
+ ok</code>
- <p>Alternatively:</p>
+ <p>Alternative way to stop the HTTP client profile:</p>
<code type="erl">
10 > inets:stop(httpc, Pid).
- ok
- </code>
+ ok</code>
</section>
</chapter>
diff --git a/lib/inets/doc/src/http_server.xml b/lib/inets/doc/src/http_server.xml
index 51ed826c7c..4b6d64fc8f 100644
--- a/lib/inets/doc/src/http_server.xml
+++ b/lib/inets/doc/src/http_server.xml
@@ -22,7 +22,7 @@
</legalnotice>
- <title>HTTP server </title>
+ <title>HTTP server</title>
<prepared>Ingela Anderton Andin</prepared>
<responsible></responsible>
<docno></docno>
@@ -36,62 +36,65 @@
</header>
<section>
- <title>Introduction</title>
-
+ <title>Configuration</title>
+ <marker id="config"></marker>
<p>The HTTP server, also referred to as httpd, handles HTTP requests
- as described in RFC 2616 with a few exceptions such as gateway
- and proxy functionality. The server supports ipv6 as long as the
- underlying mechanisms also do so. </p>
-
- <p>The server implements numerous features such as SSL (Secure Sockets
- Layer), ESI (Erlang Scripting Interface), CGI (Common Gateway
- Interface), User Authentication(using Mnesia, dets or plain text
- database), Common Logfile Format (with or without disk_log(3)
- support), URL Aliasing, Action Mappings, and Directory Listings</p>
-
- <p>The configuration of the server is provided as an erlang
- property list, and for backwards compatibility also a configuration
+ as described in
+ <url href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</url>
+ with a few exceptions, such as gateway
+ and proxy functionality. The server supports IPv6 as long as the
+ underlying mechanisms also do so.</p>
+
+ <p>The server implements numerous features, such as:</p>
+ <list type="bulleted">
+ <item>Secure Sockets Layer (SSL)</item>
+ <item>Erlang Scripting Interface (ESI)</item>
+ <item>Common Gateway Interface (CGI)</item>
+ <item>User Authentication (using <c>Mnesia</c>,
+ <c>Dets</c> or plain text database)</item>
+ <item>Common Logfile Format (with or without disk_log(3) support)</item>
+ <item>URL Aliasing</item>
+ <item>Action Mappings</item>
+ <item>Directory Listings</item>
+ </list>
+
+ <p>The configuration of the server is provided as an Erlang
+ property list. For backwards compatibility, a configuration
file using apache-style configuration directives is
supported.</p>
- <p>As of inets version 5.0 the HTTP server is an easy to
- start/stop and customize web server that provides the most basic
- web server functionality. Depending on your needs there
- are also other erlang based web servers that may be of interest
- such as Yaws, http://yaws.hyber.org, that for instance has its own
- markup support to generate html, and supports certain buzzword
- technologies such as SOAP.</p>
+ <p>As of <c>Inets</c> 5.0 the HTTP server is an easy to
+ start/stop and customize web server providing the most basic
+ web server functionality. Depending on your needs, there
+ are also other Erlang-based web servers that can be of interest
+ such as <url href=" http://yaws.hyber.org ">Yaws</url>, which,
+ for example, has its own
+ markup support to generate HTML and supports certain buzzword
+ technologies, such as SOAP.</p>
- <p>Allmost all server functionality has been implemented using an
- especially crafted server API which is described in the Erlang Web
- Server API. This API can be used to advantage by all who wish
+ <p>Almost all server functionality has been implemented using an
+ especially crafted server API, which is described in the Erlang Web
+ Server API. This API can be used
to enhance the core server functionality, for example with custom
logging and authentication.</p>
- <marker id="config"></marker>
- </section>
-
- <section>
- <title>Configuration</title>
-
- <p> What to put in the erlang node application configuration file
- in order to start a http server at application startup.</p>
+ <p>The following is to be put in the Erlang node application configuration
+ file to start an HTTP server at application startup:</p>
<code type="erl">
[{inets, [{services, [{httpd, [{proplist_file,
"/var/tmp/server_root/conf/8888_props.conf"}]},
{httpd, [{proplist_file,
- "/var/tmp/server_root/conf/8080_props.conf"}]}]}]}].
- </code>
-
- <p>The server is configured using an erlang property list.
- For the available properties see
- <seealso marker="httpd">httpd(3)</seealso>
- For backwards compatibility also apache-like config files
- are supported.
+ "/var/tmp/server_root/conf/8080_props.conf"}]}]}]}].</code>
+
+ <p>The server is configured using an Erlang property list.
+ For the available properties, see
+ <seealso marker="httpd">httpd(3)</seealso>.
+ For backwards compatibility, apache-like configuration files
+ are also supported.
</p>
- <p>All possible config properties are as follows </p>
+ <p>The available configuration properties are as follows:</p>
<code type="none">
httpd_service() -> {httpd, httpd()}
httpd() -> [httpd_config()]
@@ -103,40 +106,43 @@
debug_options() -> {all_functions, modules()} |
{exported_functions, modules()} |
{disable, modules()}
- modules() -> [atom()]
- </code>
- <p>{proplist_file, file()} File containing an erlang property
+ modules() -> [atom()]</code>
+ <p>Here:</p>
+ <taglist>
+ <tag><c>{file, file()}</c></tag>
+ <item><p>If you use an old apace-like configuration file.</p></item>
+ <tag><c>{proplist_file, file()}</c></tag>
+ <item><p>File containing an Erlang property
list, followed by a full stop, describing the HTTP server
- configuration.</p>
- <p>{file, file()} If you use an old apace-like configuration file.</p>
- <p>{debug, debug()} - Can enable trace on all
- functions or only exported functions on chosen modules.</p>
- <p>{accept_timeout, integer()} sets the wanted timeout value for
- the server to set up a request connection.</p>
-
- <marker id="using_http_server_api"></marker>
+ configuration.</p></item>
+ <tag><c>{debug, debug()}</c></tag>
+ <item><p>Can enable trace on all functions or only exported functions
+ on chosen modules.</p></item>
+ <tag><c>{accept_timeout, integer()}</c></tag>
+ <item><p>Sets the wanted time-out value for
+ the server to set up a request connection.</p></item>
+ </taglist>
</section>
<section>
- <title>Using the HTTP Server API</title>
+ <title>Getting Started</title>
+ <marker id="using_http_server_api"></marker>
+ <p>Start <c>Inets</c>:</p>
<code type="none">
1 > inets:start().
- ok
- </code>
- <p> Start a HTTP server with minimal
- required configuration. Note that if you
- specify port 0 an arbitrary available port will be
- used and you can use the info function to find out
- which port number that was picked.
- </p>
+ ok</code>
+ <p>Start an HTTP server with minimal required configuration.
+ If you specify port <c>0</c>, an arbitrary available port is
+ used, and you can use function <c>info</c> to find which port
+ number that was picked:</p>
<code type="none">
2 > {ok, Pid} = inets:start(httpd, [{port, 0},
{server_name,"httpd_test"}, {server_root,"/tmp"},
{document_root,"/tmp/htdocs"}, {bind_address, "localhost"}]).
- {ok, 0.79.0}
- </code>
+ {ok, 0.79.0} </code>
+ <p>Call <c>info</c>:</p>
<code type="none">
3 > httpd:info(Pid).
[{mime_types,[{"html","text/html"},{"htm","text/html"}]},
@@ -144,336 +150,324 @@
{bind_address, {127,0,0,1}},
{server_root,"/tmp"},
{port,59408},
- {document_root,"/tmp/htdocs"}]
- </code>
+ {document_root,"/tmp/htdocs"}]</code>
- <p> Reload the configuration without restarting the server.
- Note port and bind_address can not be changed. Clients
- trying to access the server during the reload will
- get a service temporary unavailable answer.
+ <p>Reload the configuration without restarting the server:
+
</p>
<code type="none">
4 > httpd:reload_config([{port, 59408},
{server_name,"httpd_test"}, {server_root,"/tmp/www_test"},
{document_root,"/tmp/www_test/htdocs"},
{bind_address, "localhost"}], non_disturbing).
- ok.
- </code>
+ ok.</code>
+
+ <note><p><c>port</c> and <c>bind_address</c> cannot be changed.
+ Clients trying to access the server during the reload
+ get a service temporary unavailable answer.</p></note>
<code type="none">
5 > httpd:info(Pid, [server_root, document_root]).
- [{server_root,"/tmp/www_test"},{document_root,"/tmp/www_test/htdocs"}]
- </code>
+ [{server_root,"/tmp/www_test"},{document_root,"/tmp/www_test/htdocs"}] </code>
<code type="none">
- 6 > ok = inets:stop(httpd, Pid).
- </code>
+ 6 > ok = inets:stop(httpd, Pid).</code>
- <p> Alternative:</p>
+ <p>Alternative:</p>
<code type="none">
- 6 > ok = inets:stop(httpd, {{127,0,0,1}, 59408}).
- </code>
+ 6 > ok = inets:stop(httpd, {{127,0,0,1}, 59408}).</code>
- <p>Note that bind_address has to be
- the ip address reported by the info function and can
- not be the hostname that is allowed when inputting bind_address.</p>
-
- <marker id="htaccess"></marker>
+ <p>Notice that <c>bind_address</c> must be the IP address reported
+ by function <c>info</c> and cannot be the hostname that is allowed
+ when putting in <c>bind_address</c>.</p>
</section>
<section>
- <title>Htaccess - User Configurable Authentication.</title>
- <p>If users of the web server needs to manage authentication of
- web pages that are local to their user and do not have
- server administrative privileges. They can use the
- per-directory runtime configurable user-authentication scheme
- that Inets calls htaccess. It works the following way: </p>
+ <title>Htaccess - User Configurable Authentication</title>
+ <marker id="htaccess"></marker>
+ <p>Web server users without server administrative privileges
+ that need to manage authentication of web pages that are local
+ to their user can use the per-directory runtime configurable
+ user-authentication scheme <c>htaccess</c>.
+ It works as follows:</p>
<list type="bulleted">
<item>Each directory in the path to the requested asset is
- searched for an access-file (default .htaccess), that restricts
- the web servers rights to respond to a request. If an access-file
- is found the rules in that file is applied to the
- request. </item>
- <item>The rules in an access-file applies both to files in the same
- directories and in subdirectories. If there exists more than one
- access-file in the path to an asset, the rules in the
- access-file nearest the requested asset will be applied.</item>
- <item>To change the rules that restricts the use of
- an asset. The user only needs to have write access
- to the directory where the asset exists.</item>
- <item>All the access-files in the path to a requested asset is read
- once per request, this means that the load on the server will
- increase when this scheme is used.</item>
- <item>If a directory is
- limited both by auth directives in the HTTP server configuration
- file and by the htaccess files. The user must be allowed to get
- access the file by both methods for the request to succeed.</item>
+ searched for an access file (default is <c>.htaccess</c>), which
+ restricts the web servers rights to respond to a request.
+ If an access file is found, the rules in that file is applied to the
+ request.</item>
+ <item>The rules in an access file apply to files in the same
+ directory and in subdirectories. If there exists more than one
+ access file in the path to an asset, the rules in the
+ access file nearest the requested asset is applied.</item>
+ <item>To change the rules that restrict the use of
+ an asset, the user only needs write access
+ to the directory where the asset is.</item>
+ <item>All access files in the path to a requested asset are read
+ once per request. This means that the load on the server
+ increases when <c>htaccess</c> is used.</item>
+ <item>If a directory is limited both by authentication directives
+ in the HTTP server configuration file and by the <c>htaccess</c>
+ files, the user must be allowed to get access to the file by both
+ methods for the request to succeed.</item>
</list>
<section>
<title>Access Files Directives</title>
- <p>In every directory under the <c>DocumentRoot</c> or under an
- <c>Alias</c> a user can place an access-file. An access-file
- is a plain text file that specify the restrictions that
- shall be considered before the web server answer to a
- request. If there are more than one access-file in the path
- to the requested asset, the directives in the access-file in
- the directory nearest the asset will be used.</p>
- <list type="bulleted">
+ <p>In every directory under <c>DocumentRoot</c> or under an
+ <c>Alias</c> a user can place an access file. An access file
+ is a plain text file that specifies the restrictions to
+ consider before the web server answers to a
+ request. If there are more than one access file in the path
+ to the requested asset, the directives in the access file in
+ the directory nearest the asset is used.</p>
+ <taglist>
+ <tag><em>"allow"</em></tag>
<item>
- <p><em>DIRECTIVE: "allow"</em></p>
- <p><em>Syntax:</em><c>Allow</c> from subnet subnet|from all <br></br>
-<em>Default:</em><c>from all </c> <br></br>
-</p>
- <p>Same as the directive allow for the server config file. </p>
+ <p><em>Syntax:</em> <c>Allow</c> from subnet <c>subnet | from all</c></p>
+ <p><em>Default:</em> <c>from all</c></p>
+ <p>Same as directive <c>allow</c> for the server configuration file.</p>
</item>
- <item>
- <p><em>DIRECTIVE: "AllowOverRide"</em></p>
- <p><em>Syntax:</em><c>AllowOverRide</c> all | none |
- Directives <br></br>
-<em>Default:</em><c>- None -</c> <br></br>
-<c>AllowOverRide</c> Specify which parameters that not
- access-files in subdirectories are allowed to alter the value
- for. If the parameter is set to none no more
- access-files will be parsed.
+ <tag><em>"AllowOverRide"</em></tag>
+ <item>
+ <p><em>Syntax:</em> <c>AllowOverRide</c> <c>all | none | Directives</c></p>
+ <p><em>Default:</em> <c>none</c></p>
+ <p><c>AllowOverRide</c> specifies the parameters that
+ access files in subdirectories are not allowed to alter the value
+ for. If the parameter is set to <c>none</c>, no further
+ access files is parsed.
</p>
- <p>If only one access-file exists setting this parameter to
- none can lessen the burden on the server since the server
- will stop looking for access-files.</p>
+ <p>If only one access file exists, setting this parameter to
+ <c>none</c> can ease the burden on the server as the server
+ then stops looking for access files.</p>
</item>
+ <tag><em>"AuthGroupfile"</em></tag>
<item>
- <p><em>DIRECTIVE: "AuthGroupfile"</em></p>
- <p><em>Syntax:</em><c>AuthGroupFile</c> Filename <br></br>
-<em>Default:</em><c>- None -</c> <br></br>
-</p>
- <p>AuthGroupFile indicates which file that contains the list
- of groups. Filename must contain the absolute path to the
- file. The format of the file is one group per row and
+ <p><em>Syntax:</em> <c>AuthGroupFile</c> Filename</p>
+ <p><em>Default:</em> <c>none</c></p>
+ <p><c>AuthGroupFile</c> indicates which file that contains the list
+ of groups. The filename must contain the absolute path to the
+ file. The format of the file is one group per row and
every row contains the name of the group and the members
- of the group separated by a space, for example:</p>
+ of the group, separated by a space, for example:</p>
<pre>
-GroupName: Member1 Member2 .... MemberN
- </pre>
+GroupName: Member1 Member2 .... MemberN</pre>
</item>
+ <tag><em>"AuthName"</em></tag>
<item>
- <p><em>DIRECTIVE: "AuthName"</em></p>
- <p><em>Syntax:</em><c>AuthName</c> auth-domain <br></br>
-<em>Default:</em><c>- None -</c> <br></br>
-</p>
- <p>Same as the directive AuthName for the server config file. </p>
+ <p><em>Syntax:</em> <c>AuthName</c> auth-domain</p>
+ <p><em>Default:</em> <c>none</c></p>
+ <p>Same as directive <c>AuthName</c> for the server
+ configuration file.</p>
</item>
+ <tag><em>"AuthType"</em></tag>
<item>
- <p><em>DIRECTIVE: "AuthType"</em></p>
- <p><em>Syntax:</em><c>AuthType</c> Basic <br></br>
-<em>Default:</em><c>Basic</c> <br></br>
-</p>
- <p><c>AuthType</c> Specify which authentication scheme that shall
- be used. Today only Basic Authenticating using UUEncoding of
- the password and user ID is implemented. </p>
+ <p><em>Syntax:</em> <c>AuthType</c> <c>Basic</c></p>
+ <p><em>Default:</em> <c>Basic</c></p>
+ <p><c>AuthType</c> specifies which authentication scheme to
+ be used. Only Basic Authenticating using UUEncoding of
+ the password and user ID is implemented.</p>
</item>
+ <tag><em>"AuthUserFile"</em></tag>
<item>
- <p><em>DIRECTIVE: "AuthUserFile"</em></p>
- <p><em>Syntax:</em><c>AuthUserFile</c> Filename <br></br>
-<em>Default:</em><c>- None -</c> <br></br>
-</p>
- <p><c>AuthUserFile</c> indicate which file that contains the list
- of users. Filename must contain the absolute path to the
- file. The users name and password are not encrypted so do not
+ <p><em>Syntax:</em> <c>AuthUserFile</c> Filename</p>
+ <p><em>Default:</em><c>none</c></p>
+ <p><c>AuthUserFile</c> indicates which file that contains the list
+ of users. The filename must contain the absolute path to the
+ file. The username and password are not encrypted so do not
place the file with users in a directory that is accessible
- via the web server. The format of the file is one user per row
- and every row contains User Name and Password separated by a
- colon, for example:</p>
+ through the web server. The format of the file is one user per row.
+ Every row contains <c>UserName</c> and <c>Password</c> separated
+ by a colon, for example:</p>
<pre>
UserName:Password
-UserName:Password
- </pre>
+UserName:Password</pre>
</item>
+ <tag><em>"deny"</em></tag>
<item>
- <p><em>DIRECTIVE: "deny"</em></p>
- <p><em>Syntax:</em><c>deny</c> from subnet subnet|from all <br></br>
-<em>Context:</em> Limit</p>
- <p>Same as the directive deny for the server config file. </p>
+ <p><em>Syntax:</em> <c>deny</c> from subnet <c>subnet | from all</c></p>
+ <p><em>Context:</em> Limit</p>
+ <p>Same as directive <c>deny</c> for the server configuration file.</p>
</item>
- <item>
- <p><em>DIRECTIVE: "Limit"</em> <br></br>
-</p>
- <p><em>Syntax:</em><c><![CDATA[<Limit]]></c> RequestMethods<c>></c> <br></br>
-<em>Default:</em> - None - <br></br>
-</p>
- <p><c><![CDATA[<Limit>]]></c> and &lt;/Limit&gt; are used to enclose
- a group of directives which applies only to requests using
- the specified methods. If no request method is specified
+ <tag><em>"Limit"</em></tag>
+ <item>
+ <p><em>Syntax:</em> <c><![CDATA[<Limit]]></c> RequestMethods<c>></c></p>
+ <p><em>Default:</em> <c>none</c></p>
+ <p><c><![CDATA[<Limit>]]></c> and <c>&lt;/Limit&gt;</c> are used to enclose
+ a group of directives applying only to requests using
+ the specified methods. If no request method is specified,
all request methods are verified against the restrictions.</p>
+ <p>Example:</p>
<pre>
&lt;Limit POST GET HEAD&gt;
order allow deny
require group group1
allow from 123.145.244.5
-&lt;/Limit&gt;
- </pre>
+&lt;/Limit&gt;</pre>
</item>
- <item>
- <p><em>DIRECTIVE: "order"</em> <br></br>
-<em>Syntax:</em><c>order</c> allow deny | deny allow <br></br>
-<em>Default:</em> allow deny <br></br>
-</p>
- <p><c>order</c>, defines if the deny or allow control shall
- be preformed first.</p>
- <p>If the order is set to allow deny, then first the users
- network address is controlled to be in the allow subset. If
- the users network address is not in the allowed subset he will
- be denied to get the asset. If the network-address is in the
- allowed subset then a second control will be preformed, that
- the users network address is not in the subset of network
- addresses that shall be denied as specified by the deny
- parameter.</p>
- <p>If the order is set to deny allow then only users from networks
- specified to be in the allowed subset will succeed to request
+ <tag><em>"order"</em></tag>
+ <item>
+ <p><em>Syntax:</em> <c>order</c> <c>allow deny | deny allow</c></p>
+ <p><em>Default:</em> <c>allow deny</c></p>
+ <p><c>order</c> defines if the deny or allow control is to
+ be performed first.</p>
+ <p>If the order is set to <c>allow deny</c>, the users
+ network address is first controlled to be in the allow subset.
+ If the user network address is not in the allowed subset, the user
+ is denied to get the asset. If the network address is in the
+ allowed subset, a second control is performed. That is,
+ the user network address is not in the subset of network
+ addresses to be denied as specified by parameter <c>deny</c>.</p>
+ <p>If the order is set to <c>deny allow</c>, only users from networks
+ specified to be in the allowed subset succeeds to request
assets in the limited area.</p>
</item>
- <item>
- <p><em>DIRECTIVE: "require"</em></p>
- <p><em>Syntax:</em><c>require</c>
- group group1 group2...|user user1 user2... <br></br>
-<em>Default:</em><c>- None -</c> <br></br>
-<em>Context:</em> Limit <br></br>
-</p>
- <p>See the require directive in the documentation of mod_auth(3)
- for more information.</p>
+ <tag><em>"require"</em></tag>
+ <item>
+ <p><em>Syntax:</em> <c>require</c>
+ <c>group group1 group2... | user user1 user2...</c></p>
+ <p><em>Default:</em> <c>none</c></p>
+ <p><em>Context:</em> Limit</p>
+ <p>For more information, see directive <c>require</c> in
+ <seealso marker="mod_auth">mod_auth(3)</seealso>.</p>
</item>
- </list>
+ </taglist>
</section>
-
- <marker id="dynamic_we_pages"></marker>
</section>
<section>
<title>Dynamic Web Pages</title>
- <p>The Inets HTTP server provides two ways of creating dynamic web
- pages, each with its own advantages and disadvantages. </p>
- <p>First there are CGI-scripts that can be written in any programming
- language. CGI-scripts are standardized and supported by most
- web servers. The drawback with CGI-scripts is that they are resource
- intensive because of their design. CGI requires the server to fork a
- new OS process for each executable it needs to start. </p>
- <p>Second there are ESI-functions that provide a tight and efficient
- interface to the execution of Erlang functions, this interface
- on the other hand is Inets specific. </p>
-
+ <marker id="dynamic_we_pages"></marker>
+ <p><c>Inets</c> HTTP server provides two ways of creating dynamic web
+ pages, each with its own advantages and disadvantages:</p>
+ <taglist>
+ <tag><em>CGI scripts</em></tag>
+ <item><p>Common Gateway Interface (CGI) scripts can be written
+ in any programming language. CGI scripts are standardized and
+ supported by most web servers. The drawback with CGI scripts is that
+ they are resource-intensive because of their design. CGI requires the
+ server to fork a new OS process for each executable it needs to start.
+ </p></item>
+ <tag><em>ESI-functions</em></tag>
+ <item><p>Erlang Server Interface (ESI) functions provide a tight and efficient
+ interface to the execution of Erlang functions. This interface,
+ on the other hand, is <c>Inets</c> specific.</p></item>
+ </taglist>
+
<section>
- <title>The Common Gateway Interface (CGI) Version 1.1, RFC 3875.</title>
- <p>The mod_cgi module makes it possible to execute CGI scripts
- in the server. A file that matches the definition of a
- ScriptAlias config directive is treated as a CGI script. A CGI
+ <title>CGI Version 1.1,
+ <url href="http://www.ietf.org/rfc/rfc3875.txt">RFC 3875</url></title>
+ <p>The module <c>mod_cgi</c> enables execution of CGI scripts
+ on the server. A file matching the definition of a
+ ScriptAlias config directive is treated as a CGI script. A CGI
script is executed by the server and its output is returned to
- the client. </p>
- <p>The CGI Script response comprises a message-header and a
- message-body, separated by a blank line. The message-header
- contains one or more header fields. The body may be
- empty. Example: </p>
+ the client.</p>
+ <p>The CGI script response comprises a message header and a
+ message body, separated by a blank line. The message header
+ contains one or more header fields. The body can be
+ empty.</p>
+ <p>Example:</p>
<code>"Content-Type:text/plain\nAccept-Ranges:none\n\nsome very
- plain text" </code>
+ plain text"</code>
- <p>The server will interpret the cgi-headers and most of them
- will be transformed into HTTP headers and sent back to the
- client together with the body.</p>
- <p>Support for CGI-1.1 is implemented in accordance with the RFC
- 3875. </p>
+ <p>The server interprets the message headers and most of them
+ are transformed into HTTP headers and sent back to the
+ client together with the message-body.</p>
+ <p>Support for CGI-1.1 is implemented in accordance with
+ <url href="http://www.ietf.org/rfc/rfc3875.txt">RFC 3875</url>.</p>
</section>
<section>
- <title>Erlang Server Interface (ESI)</title>
- <p>The erlang server interface is implemented by the
- module mod_esi.</p>
+ <title>ESI</title>
+ <p>The Erlang server interface is implemented by
+ module <c>mod_esi</c>.</p>
<section>
- <title>ERL Scheme </title>
+ <title>ERL Scheme</title>
<p>The erl scheme is designed to mimic plain CGI, but without
- the extra overhead. An URL which calls an Erlang erl function
+ the extra overhead. An URL that calls an Erlang <c>erl</c> function
has the following syntax (regular expression): </p>
<code type="none">
-http://your.server.org/***/Module[:/]Function(?QueryString|/PathInfo)
- </code>
- <p>*** above depends on how the ErlScriptAlias config
- directive has been used</p>
- <p>The module (Module) referred to must be found in the code
- path, and it must define a function (Function) with an arity
- of two or three. It is preferable to implement a funtion
- with arity three as it permits you to send chunks of the
- webpage beeing generated to the client during the generation
+http://your.server.org/***/Module[:/]Function(?QueryString|/PathInfo)</code>
+ <p>*** depends on how the ErlScriptAlias config
+ directive has been used.</p>
+ <p>The module <c>Module</c> referred to must be found in the code
+ path, and it must define a function <c>Function</c> with an arity
+ of two or three. It is preferable to implement a function
+ with arity three, as it permits to send chunks of the
+ web page to the client during the generation
phase instead of first generating the whole web page and
then sending it to the client. The option to implement a
function with arity two is only kept for
backwards compatibility reasons.
- See <seealso marker="mod_esi">mod_esi(3)</seealso> for
- implementation details of the esi callback function.</p>
+ For implementation details of the ESI callback function,
+ see <seealso marker="mod_esi">mod_esi(3)</seealso>.</p>
</section>
<section>
- <title>EVAL Scheme </title>
+ <title>EVAL Scheme</title>
<p>The eval scheme is straight-forward and does not mimic the
- behavior of plain CGI. An URL which calls an Erlang eval
+ behavior of plain CGI. An URL that calls an Erlang <c>eval</c>
function has the following syntax:</p>
<code type="none">
-http://your.server.org/***/Mod:Func(Arg1,...,ArgN)
- </code>
- <p>*** above depends on how the ErlScriptAlias config
- directive has been used</p>
- <p>The module (Mod) referred to must be found in the code
- path, and data returned by the function (Func) is passed
+http://your.server.org/***/Mod:Func(Arg1,...,ArgN)</code>
+ <p>*** depends on how the ErlScriptAlias config
+ directive has been used.</p>
+ <p>The module <c>Mod</c> referred to must be found in the code
+ path and data returned by the function <c>Func</c> is passed
back to the client. Data returned from the
- function must furthermore take the form as specified in
- the CGI specification. See <seealso marker="mod_esi">mod_esi(3)</seealso> for implementation details of the esi
- callback function.</p>
+ function must take the form as specified in
+ the CGI specification. For implementation details of the ESI
+ callback function,
+ see <seealso marker="mod_esi">mod_esi(3)</seealso>.</p>
<note>
<p>The eval scheme can seriously threaten the
- integrity of the Erlang node housing a Web server, for
- example: </p>
+ integrity of the Erlang node housing a web server, for
+ example:</p>
<code type="none">
-http://your.server.org/eval?httpd_example:print(atom_to_list(apply(erlang,halt,[])))
- </code>
- <p>which effectively will close down the Erlang node,
- therefor, use the erl scheme instead, until this
- security breach has been fixed.</p>
- <p>Today there are no good way of solving this problem
- and therefore Eval Scheme may be removed in future
- release of Inets. </p>
+http://your.server.org/eval?httpd_example:print(atom_to_list(apply(erlang,halt,[])))</code>
+ <p>This effectively closes down the Erlang node.
+ Therefore, use the erl scheme instead, until this
+ security breach is fixed.</p>
+ <p>Today there are no good ways of solving this problem
+ and therefore the eval scheme can be removed in future
+ release of <c>Inets</c>.</p>
</note>
</section>
</section>
-
- <marker id="logging"></marker>
</section>
<section>
- <title>Logging </title>
- <p>There are three types of logs supported. Transfer logs,
- security logs and error logs. The de-facto standard Common
+ <title>Logging</title>
+ <marker id="logging"></marker>
+ <p>Three types of logs are supported: transfer logs,
+ security logs, and error logs. The de-facto standard Common
Logfile Format is used for the transfer and security logging.
There are numerous statistics programs available to analyze Common
Logfile Format. The Common Logfile Format looks as follows:
</p>
<p><em>remotehost rfc931 authuser [date] "request" status bytes</em></p>
+ <p>Here:</p>
<taglist>
<tag><em>remotehost</em></tag>
- <item>Remote hostname</item>
+ <item>Remote hostname.</item>
<tag><em>rfc931</em></tag>
- <item>The client's remote username (RFC 931).</item>
+ <item>The client remote username (<url href="http://www.ietf.org/rfc/rfc931.txt">RFC 931</url>).</item>
<tag><em>authuser</em></tag>
- <item>The username with which the user authenticated himself.</item>
+ <item>The username used for authentication.</item>
<tag><em>[date]</em></tag>
- <item>Date and time of the request (RFC 1123).</item>
+ <item>Date and time of the request (<url href="http://www.ietf.org/rfc/rfc1123.txt">RFC 1123</url>).</item>
<tag><em>"request"</em></tag>
- <item>The request line exactly as it came from the client (RFC 1945).</item>
+ <item>The request line exactly as it came from the client (<url href="http://www.ietf.org/rfc/rfc1945.txt">RFC 1945</url>).</item>
<tag><em>status</em></tag>
- <item>The HTTP status code returned to the client (RFC 1945).</item>
+ <item>The HTTP status code returned to the client (<url href="http://www.ietf.org/rfc/rfc1945.txt">RFC 1945</url>).</item>
<tag><em>bytes</em></tag>
<item>The content-length of the document transferred. </item>
</taglist>
<p>Internal server errors are recorded in the error log file. The
- format of this file is a more ad hoc format than the logs using
+ format of this file is a more unplanned format than the logs using
Common Logfile Format, but conforms to the following syntax:
</p>
<p><em>[date]</em> access to <em>path</em> failed for
@@ -481,73 +475,79 @@ http://your.server.org/eval?httpd_example:print(atom_to_list(apply(erlang,halt,[
</section>
<section>
- <title>The Erlang Web Server API</title>
- <p>The process of handling a HTTP request involves several steps
+ <title>Erlang Web Server API</title>
+ <p>The process of handling an HTTP request involves several steps,
such as:</p>
<list type="bulleted">
- <item>Seting up connections, sending and receiving data.</item>
- <item>URI to filename translation</item>
- <item>Authenication/access checks.</item>
- <item>Retriving/generating the response.</item>
- <item>Logging</item>
+ <item>Setting up connections, sending and receiving data.</item>
+ <item>URI to filename translation.</item>
+ <item>Authentication/access checks.</item>
+ <item>Retrieving/generating the response.</item>
+ <item>Logging.</item>
</list>
- <p>To provide customization and extensibility of the HTTP servers
- request handling most of these steps are handled by one or more
- modules that may be replaced or removed at runtime, and of course
- new ones can be added. For each request all modules will be
- traversed in the order specified by the modules directive in the
- server configuration file. Some parts mainly the communication
- related steps are considered server core functionality and are
- not implemented using the Erlang Web Server API. A description of
- functionality implemented by the Erlang Webserver API is described
- in the section Inets Webserver Modules.</p>
+ <p>To provide customization and extensibility of the request
+ handling of the HTTP servers, most of these steps are handled by
+ one or more modules. These modules can be replaced or removed at
+ runtime and new ones can be added. For each request, all modules are
+ traversed in the order specified by the module directive in the
+ server configuration file. Some parts, mainly the communication-
+ related steps, are considered server core functionality and are
+ not implemented using the Erlang web server API. A description of
+ functionality implemented by the Erlang webserver API is described
+ in <seealso marker="#Inets_Web_Server_Modules">Section
+ Inets Web Server Modules</seealso>.</p>
+
<p>A module can use data generated by previous modules in the
- Erlang Webserver API module sequence or generate data to be used
- by consecutive Erlang Web Server API modules. This is made
- possible due to an internal list of key-value tuples, also referred to
- as interaction data. </p>
+ Erlang webserver API module sequence or generate data to be used
+ by consecutive Erlang Web Server API modules. This is
+ possible owing to an internal list of key-value tuples, referred to
+ as interaction data.</p>
<note>
<p>Interaction data enforces module dependencies and
- should be avoided if possible. This means the order
- of modules in the Modules property is significant.</p>
+ is to be avoided if possible. This means that the order
+ of modules in the modules property is significant.</p>
</note>
<section>
<title>API Description</title>
- <p>Each module implements server functionality
- using the Erlang Web Server API should implement the following
+ <p>Each module that implements server functionality
+ using the Erlang web server API is to implement the following
call back functions:</p>
<list type="bulleted">
- <item>do/1 (mandatory) - the function called when
- a request should be handled.</item>
- <item>load/2</item>
- <item>store/2</item>
- <item>remove/1</item>
+ <item><c>do/1</c> (mandatory) - the function called when
+ a request is to be handled</item>
+ <item><c>load/2</c></item>
+ <item><c>store/2</c></item>
+ <item><c>remove/1</c></item>
</list>
<p>The latter functions are needed only when new config
- directives are to be introduced. For details see
- <seealso marker="httpd">httpd(3)</seealso></p>
+ directives are to be introduced. For details, see
+ <seealso marker="httpd">httpd(3)</seealso>.</p>
</section>
</section>
<section>
- <title>Inets Web Server Modules</title> <p>The convention is that
- all modules implementing some webserver functionality has the
- name mod_*. When configuring the web server an appropriate
- selection of these modules should be present in the Module
- directive. Please note that there are some interaction dependencies
- to take into account so the order of the modules can not be
- totally random.</p>
+ <title>Inets Web Server Modules</title>
+ <marker id="Inets_Web_Server_Modules"></marker>
+ <p>The convention is that
+ all modules implementing some web server functionality has the
+ name <c>mod_*</c>. When configuring the web server, an appropriate
+ selection of these modules is to be present in the module
+ directive. Notice that there are some interaction dependencies
+ to take into account, so the order of the modules cannot be
+ random.</p>
<section>
- <title>mod_action - Filetype/Method-Based Script Execution.</title>
- <p>Runs CGI scripts whenever a file of a
- certain type or HTTP method (See RFC 1945) is requested.
+ <title>mod_action - Filetype/Method-Based Script Execution</title>
+ <p>This module runs CGI scripts whenever a file of a
+ certain type or HTTP method (see
+ <url href="http://tools.ietf.org/html/rfc1945">RFC 1945</url>RFC 1945)
+ is requested.
</p>
<p>Uses the following Erlang Web Server API interaction data:
</p>
<list type="bulleted">
- <item>real_name - from mod_alias</item>
+ <item><c>real_name</c> - from <seealso marker="mod_alias">mod_alias</seealso>.</item>
</list>
<p>Exports the following Erlang Web Server API interaction data, if possible:
</p>
@@ -559,48 +559,51 @@ http://your.server.org/eval?httpd_example:print(atom_to_list(apply(erlang,halt,[
<section>
<title>mod_alias - URL Aliasing</title>
- <p>This module makes it possible to map different parts of the
- host file system into the document tree e.i. creates aliases and
+ <p>The <seealso marker="mod_alias">mod_alias</seealso>
+ module makes it possible to map different parts of the
+ host file system into the document tree, that is, creates aliases and
redirections.</p>
<p>Exports the following Erlang Web Server API interaction data, if possible:
</p>
<taglist>
<tag><c>{real_name, PathData}</c></tag>
- <item>PathData is the argument used for API function mod_alias:path/3.</item>
+ <item><c>PathData</c> is the argument used for API function
+ <seealso marker="mod_alias:path/3">mod_alias:path/3</seealso>.</item>
</taglist>
</section>
<section>
- <title>mod_auth - User Authentication </title>
- <p>This module provides for basic user authentication using
- textual files, dets databases as well as mnesia databases.</p>
+ <title>mod_auth - User Authentication</title>
+ <p>The <seealso marker="mod_auth">mod_auth(3)</seealso>
+ module provides for basic user authentication using
+ textual files, <c>Dets</c> databases as well as <c>Mnesia</c> databases.</p>
<p>Uses the following Erlang Web Server API interaction data:
</p>
<list type="bulleted">
- <item>real_name - from mod_alias</item>
+ <item><c>real_name</c> - from <seealso marker="mod_alias">mod_alias</seealso></item>
</list>
<p>Exports the following Erlang Web Server API interaction data:
</p>
<taglist>
<tag><c>{remote_user, User}</c></tag>
- <item>The user name with which the user has authenticated himself.</item>
+ <item>The username used for authentication.</item>
</taglist>
<section>
- <title>Mnesia as Authentication Database</title>
+ <title>Mnesia As Authentication Database</title>
- <p> If Mnesia is used as storage method, Mnesia must be
- started prio to the HTTP server. The first time Mnesia is
- started the schema and the tables must be created before
- Mnesia is started. A naive example of a module with two
- functions that creates and start mnesia is provided
- here. The function shall be used the first
- time. first_start/0 creates the schema and the tables. The
- second function start/0 shall be used in consecutive
- startups. start/0 Starts Mnesia and wait for the tables to
+ <p>If <c>Mnesia</c> is used as storage method, <c>Mnesia</c> must be
+ started before the HTTP server. The first time <c>Mnesia</c> is
+ started, the schema and the tables must be created before
+ <c>Mnesia</c> is started. A simple example of a module with two
+ functions that creates and start <c>Mnesia</c> is provided
+ here. Function <c>first_start/0</c> is to be used the first
+ time. It creates the schema and the tables.
+ <c>start/0</c> is to be used in consecutive startups.
+ <c>start/0</c> starts <c>Mnesia</c> and waits for the tables to
be initiated. This function must only be used when the
- schema and the tables already is created. </p>
+ schema and the tables are already created.</p>
<code>
-module(mnesia_test).
@@ -624,28 +627,28 @@ first_start() ->
start() ->
mnesia:start(),
- mnesia:wait_for_tables([httpd_user, httpd_group], 60000).
- </code>
+ mnesia:wait_for_tables([httpd_user, httpd_group], 60000). </code>
- <p>To create the Mnesia tables we use two records defined in
- mod_auth.hrl so the file must be included. The first
- function first_start/0 creates a schema that specify on
- which nodes the database shall reside. Then it starts Mnesia
- and creates the tables. The first argument is the name of
- the tables, the second argument is a list of options how the
- table will be created, see Mnesia documentation for more
- information. Since the current implementation of the
- mod_auth_mnesia saves one row for each user the type must be
- bag. When the schema and the tables is created the second
- function start/0 shall be used to start Mensia. It starts
- Mnesia and wait for the tables to be loaded. Mnesia use the
- directory specified as mnesia_dir at startup if specified,
- otherwise Mnesia use the current directory. For security
- reasons, make sure that the Mnesia tables are stored outside
- the document tree of the HTTP server. If it is placed in the
- directory which it protects, clients will be able to
- download the tables. Only the dets and mnesia storage
- methods allow writing of dynamic user data to disk. plain is
+ <p>To create the <c>Mnesia</c> tables, we use two records defined in
+ <c>mod_auth.hrl</c>, so that file must be included. <c>first_start/0</c>
+ creates a schema that specifies on which nodes the database is to reside.
+ Then it starts <c>Mnesia</c> and creates the tables. The first argument
+ is the name of the tables, the second argument is a list of options of
+ how to create the table, see
+ <seealso marker="mnesia:mnesia"><c>mnesia</c></seealso>, documentation for
+ more information. As the implementation of the <c>mod_auth_mnesia</c>
+ saves one row for each user, the type must be <c>bag</c>.
+ When the schema and the tables are created, function
+ <seealso marker="mnesia:mnesia#start-0">mnesia:start/0</seealso>
+ is used to start <c>Mnesia</c> and
+ waits for the tables to be loaded. <c>Mnesia</c> uses the
+ directory specified as <c>mnesia_dir</c> at startup if specified,
+ otherwise <c>Mnesia</c> uses the current directory. For security
+ reasons, ensure that the <c>Mnesia</c> tables are stored outside
+ the document tree of the HTTP server. If they are placed in the
+ directory which it protects, clients can download the tables.
+ Only the <c>Dets</c> and <c>Mnesia</c> storage
+ methods allow writing of dynamic user data to disk. <c>plain</c> is
a read only method.</p>
</section>
@@ -653,19 +656,19 @@ start() ->
<section>
<title>mod_cgi - CGI Scripts</title>
- <p>This module handles invoking of CGI scripts</p>
+ <p>This module handles invoking of CGI scripts.</p>
</section>
<section>
<title>mod_dir - Directories</title>
<p>This module generates an HTML directory listing
(Apache-style) if a client sends a request for a directory
- instead of a file. This module needs to be removed from the
+ instead of a file. This module must be removed from the
Modules config directive if directory listings is unwanted.</p>
<p>Uses the following Erlang Web Server API interaction data:
</p>
<list type="bulleted">
- <item>real_name - from mod_alias</item>
+ <item><c>real_name</c> - from <seealso marker="mod_alias">mod_alias</seealso></item>
</list>
<p>Exports the following Erlang Web Server API interaction data:
</p>
@@ -677,27 +680,27 @@ start() ->
</section>
<section>
- <title>mod_disk_log - Logging Using disk_log.</title>
+ <title>mod_disk_log - Logging Using Disk_Log.</title>
<p>Standard logging using the "Common Logfile Format" and
- disk_log(3).</p>
+ <seealso marker="kernel:disk_log">kernel:disk_log(3)</seealso>.</p>
<p>Uses the following Erlang Web Server API interaction data:
</p>
<list type="bulleted">
- <item>remote_user - from mod_auth</item>
+ <item><c>remote_user</c> - from <c>mod_auth</c></item>
</list>
</section>
<section>
<title>mod_esi - Erlang Server Interface</title>
- <p>This module implements
- the Erlang Server Interface (ESI) that provides a tight and
- efficient interface to the execution of Erlang functions. </p>
- <p>Uses the following Erlang Web Server API interaction data:
+ <p>The <seealso marker="mod_esi">mod_esi(3)</seealso>
+ module implements the Erlang Server Interface (ESI) providing a
+ tight and efficient interface to the execution of Erlang functions.</p>
+ <p>Uses the following Erlang web server API interaction data:
</p>
<list type="bulleted">
- <item>remote_user - from mod_auth</item>
+ <item><c>remote_user</c> - from <c>mod_auth</c></item>
</list>
- <p>Exports the following Erlang Web Server API interaction data:
+ <p>Exports the following Erlang web server API interaction data:
</p>
<taglist>
<tag><c>{mime_type, MimeType}</c></tag>
@@ -709,11 +712,11 @@ start() ->
<section>
<title>mod_get - Regular GET Requests</title>
<p>This module is responsible for handling GET requests to regular
- files. GET requests for parts of files is handled by mod_range.</p>
- <p>Uses the following Erlang Web Server API interaction data:
+ files. GET requests for parts of files is handled by <c>mod_range</c>.</p>
+ <p>Uses the following Erlang web server API interaction data:
</p>
<list type="bulleted">
- <item>real_name - from mod_alias</item>
+ <item><c>real_name</c> - from <seealso marker="mod_alias">mod_alias</seealso></item>
</list>
</section>
@@ -725,7 +728,7 @@ start() ->
<p>Uses the following Erlang Web Server API interaction data:
</p>
<list type="bulleted">
- <item>real_name - from mod_alias</item>
+ <item><c>real_name</c> - from <seealso marker="mod_alias">mod_alias</seealso></item>
</list>
</section>
@@ -736,13 +739,13 @@ start() ->
<p>Uses the following Erlang Web Server API interaction data:
</p>
<list type="bulleted">
- <item>real_name - from mod_alias</item>
+ <item><c>real_name</c> - from <seealso marker="mod_alias">mod_alias</seealso></item>
</list>
<p>Exports the following Erlang Web Server API interaction data:
</p>
<taglist>
<tag><c>{remote_user_name, User}</c></tag>
- <item>The user name with which the user has authenticated himself.</item>
+ <item>The username used for authentication.</item>
</taglist>
</section>
@@ -750,84 +753,83 @@ start() ->
<title>mod_log - Logging Using Text Files.</title>
<p>Standard logging using the "Common Logfile Format" and text
files.</p>
- <p>Uses the following Erlang Webserver API interaction data:
+ <p>Uses the following Erlang Web Server API interaction data:
</p>
<list type="bulleted">
- <item>remote_user - from mod_auth</item>
+ <item><c>remote_user</c> - from <c>mod_auth</c></item>
</list>
</section>
<section>
<title>mod_range - Requests with Range Headers</title>
- <p>This module response to requests for one or many ranges of a
- file. This is especially useful when downloading large files,
- since a broken download may be resumed.</p>
- <p>Note that request for multiple parts of a document will report a
+ <p>This module responses to requests for one or many ranges of a
+ file. This is especially useful when downloading large files,
+ as a broken download can be resumed.</p>
+ <p>Notice that request for multiple parts of a document report a
size of zero to the log file.</p>
- <p>Uses the following Erlang Webserver API interaction data:
+ <p>Uses the following Erlang Web Server API interaction data:
</p>
<list type="bulleted">
- <item>real_name - from mod_alias</item>
+ <item><c>real_name</c> - from <seealso marker="mod_alias">mod_alias</seealso></item>
</list>
</section>
<section>
<title>mod_response_control - Requests with If* Headers</title>
- <p>This module controls that the conditions in the requests is
- fulfilled. For example a request may specify that the answer
- only is of interest if the content is unchanged since last
- retrieval. Or if the content is changed the range-request shall
- be converted to a request for the whole file instead.</p> <p>If
- a client sends more then one of the header fields that restricts
- the servers right to respond, the standard does not specify how
- this shall be handled. httpd will control each field in the
- following order and if one of the fields not match the current
- state the request will be rejected with a proper response.
- <br></br>
+ <p>This module controls that the conditions in the requests are
+ fulfilled. For example, a request can specify that the answer
+ only is of interest if the content is unchanged since the last
+ retrieval. If the content is changed, the range request is to
+ be converted to a request for the whole file instead.</p>
+ <p>If a client sends more than one of the header fields that
+ restricts the servers right to respond, the standard does not
+ specify how this is to be handled.
+ <seealso marker="httpd">httpd(3)</seealso> controls each
+ field in the following order and if one of the fields does not
+ match the current state, the request is rejected with a proper
+ response:</p>
+ <p><c>If-modified</c></p>
+ <p><c>If-Unmodified</c></p>
+ <p><c>If-Match</c></p>
+ <p><c>If-Nomatch</c></p>
- 1.If-modified <br></br>
-
- 2.If-Unmodified <br></br>
-
- 3.If-Match <br></br>
-
- 4.If-Nomatch <br></br>
-</p>
- <p>Uses the following Erlang Webserver API interaction data:
+ <p>Uses the following Erlang Web Server API interaction data:
</p>
<list type="bulleted">
- <item>real_name - from mod_alias</item>
+ <item><c>real_name</c> - from <seealso marker="mod_alias">mod_alias</seealso></item>
</list>
- <p>Exports the following Erlang Webserver API interaction data:
+ <p>Exports the following Erlang Web Server API interaction data:
</p>
<taglist>
<tag><c>{if_range, send_file}</c></tag>
- <item>The conditions for the range request was not fulfilled.
+ <item>The conditions for the range request are not fulfilled.
The response must not be treated as a range request, instead it
- must be treated as a ordinary get request. </item>
+ must be treated as an ordinary get request.</item>
</taglist>
</section>
<section>
<title>mod_security - Security Filter</title>
- <p>This module serves as a filter for authenticated requests
- handled in mod_auth. It provides possibility to restrict users
- from access for a specified amount of time if they fail to
+ <p>The <seealso marker="mod_security">mod_security</seealso>
+ module serves as a filter for authenticated requests
+ handled in <seealso marker="mod_auth">mod_auth(3)</seealso>.
+ It provides a possibility to restrict users from
+ access for a specified amount of time if they fail to
authenticate several times. It logs failed authentication as
- well as blocking of users, and it also calls a configurable
- call-back module when the events occur. </p>
+ well as blocking of users, and it calls a configurable
+ callback module when the events occur.</p>
<p>There is also an
- API to manually block, unblock and list blocked users or users,
- who have been authenticated within a configurable amount of
- time.</p>
+ API to block or unblock users manually. This API can also list
+ blocked users or users who have been authenticated within a
+ configurable amount of time.</p>
</section>
<section>
<title>mod_trace - TRACE Request</title>
- <p>mod_trace is responsible for handling of TRACE requests.
+ <p><c>mod_trace</c> is responsible for handling of TRACE requests.
Trace is a new request method in HTTP/1.1. The intended use of
trace requests is for testing. The body of the trace response is
- the request message that the responding Web server or proxy
+ the request message that the responding web server or proxy
received.</p>
</section>
</section>
diff --git a/lib/inets/doc/src/http_uri.xml b/lib/inets/doc/src/http_uri.xml
index 4b59c0c7a2..64e6c7a6cc 100644
--- a/lib/inets/doc/src/http_uri.xml
+++ b/lib/inets/doc/src/http_uri.xml
@@ -35,67 +35,90 @@
<description>
<p>This module provides utility functions for working with URIs,
- according to RFC 3986. </p>
-
+ according to
+ <url href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986</url>.</p>
</description>
<section>
- <title>COMMON DATA TYPES </title>
+ <title>DATA TYPES</title>
<p>Type definitions that are used more than once in
this module:</p>
- <code type="none"><![CDATA[
-boolean() = true | false
-string() = list of ASCII characters
- ]]></code>
+ <p><c>boolean() = true | false</c></p>
+ <p><c>string()</c> = list of ASCII characters</p>
</section>
<section>
- <title>URI DATA TYPES </title>
+ <title>URI DATA TYPES</title>
<p>Type definitions that are related to URI:</p>
- <p>For more information about URI, see RFC 3986. </p>
-
- <code type="none"><![CDATA[
-uri() = string() - Syntax according to the URI definition in rfc 3986,
- e.g.: "http://www.erlang.org/"
-user_info() = string()
-scheme() = atom() - Example: http, https
-host() = string()
-port() = pos_integer()
-path() = string() - Representing a file path or directory path
-query() = string()
-fragment() = string()
- ]]></code>
-
+
+<taglist>
+ <tag><c>uri() = string()</c></tag>
+ <item><p>Syntax according to the URI definition in RFC 3986,
+ for example, "http://www.erlang.org/"</p></item>
+ <tag><c>user_info() = string()</c></tag>
+ <item><p></p></item>
+ <tag><c>scheme() = atom()</c></tag>
+ <item><p>Example: http, https</p></item>
+ <tag><c>host() = string()</c></tag>
+ <item><p></p></item>
+ <tag><c>port() = pos_integer()</c></tag>
+ <item><p></p></item>
+ <tag><c>path() = string()</c></tag>
+ <item><p>Represents a file path or directory path</p></item>
+ <tag><c>query() = string()</c></tag>
+ <item><p></p></item>
+ <tag><c>fragment() = string()</c></tag>
+ <item><p></p></item>
+ </taglist>
+
+ <p>For more information about URI, see
+ <url href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986</url>.</p>
<marker id="scheme_defaults"></marker>
</section>
<funcs>
<func>
- <name>scheme_defaults() -> SchemeDefaults</name>
- <fsummary>A list of scheme and their default ports</fsummary>
+ <name>decode(HexEncodedURI) -> URI</name>
+
+ <fsummary>Decodes a hexadecimal encoded URI.</fsummary>
<type>
- <v>SchemeDefaults = [{scheme(), default_scheme_port_number()}] </v>
- <v>default_scheme_port_number() = pos_integer()</v>
+ <v>HexEncodedURI = string() - A possibly hexadecimal encoded URI</v>
+ <v>URI = uri()</v>
</type>
+
<desc>
- <p>This function provides a list of the scheme and their default
- port numbers currently supported (by default) by this utility. </p>
+ <p>Decodes a possibly hexadecimal encoded URI.</p>
- <marker id="parse"></marker>
+ </desc>
+ </func>
+ <func>
+ <name>encode(URI) -> HexEncodedURI</name>
+
+ <fsummary>Encodes a hexadecimal encoded URI.</fsummary>
+ <type>
+ <v>URI = uri()</v>
+ <v>HexEncodedURI = string() - Hexadecimal encoded URI</v>
+ </type>
+
+ <desc>
+ <p>Encodes a hexadecimal encoded URI.</p>
+
+ <marker id="decode"></marker>
</desc>
</func>
<func>
<name>parse(URI) -> {ok, Result} | {error, Reason}</name>
<name>parse(URI, Options) -> {ok, Result} | {error, Reason}</name>
- <fsummary>Parse an URI</fsummary>
+ <fsummary>Parses a URI.</fsummary>
<type>
- <v>URI = uri() </v>
- <v>Options = [Option] </v>
+ <v>URI = uri()</v>
+ <v>Options = [Option]</v>
<v>Option = {ipv6_host_with_brackets, boolean()} |
{scheme_defaults, scheme_defaults()} |
- {fragment, boolean()}]</v>
+ {fragment, boolean()} |
+ {schema_validation_fun, fun()}]</v>
<v>Result = {Scheme, UserInfo, Host, Port, Path, Query} |
{Scheme, UserInfo, Host, Port, Path, Query, Fragment}</v>
<v>UserInfo = user_info()</v>
@@ -104,62 +127,59 @@ fragment() = string()
<v>Path = path()</v>
<v>Query = query()</v>
<v>Fragment = fragment()</v>
- <v>Reason = term() </v>
+ <v>Reason = term()</v>
</type>
<desc>
- <p>This function is used to parse an URI. If no scheme defaults
- are provided, the value of
+ <p>Parses a URI. If no scheme defaults
+ are provided, the value of the
<seealso marker="#scheme_defaults">scheme_defaults</seealso>
- function will be used. </p>
+ function is used.</p>
- <p>Note that when parsing an URI with an unknown scheme (that is,
- a scheme not found in the scheme defaults) a port number must be
- provided or else the parsing will fail. </p>
+ <p>When parsing a URI with an unknown scheme (that is,
+ a scheme not found in the scheme defaults), a port number must be
+ provided, otherwise the parsing fails.</p>
- <p>If the fragment option is true, the URI fragment will be returned as
- part of the parsing result, otherwise it is completely ignored.</p>
+ <p>If the fragment option is <c>true</c>, the URI fragment is returned as
+ part of the parsing result, otherwise it is ignored.</p>
- <marker id="encode"></marker>
- </desc>
- </func>
+ <p>Scheme validation fun is to be defined as follows:
- <func>
- <name>encode(URI) -> HexEncodedURI</name>
-
- <fsummary>Hex encode an URI</fsummary>
- <type>
- <v>URI = uri()</v>
- <v>HexEncodedURI = string() - Hex encoded uri</v>
- </type>
+ <code>
+fun(SchemeStr :: string()) ->
+ valid | {error, Reason :: term()}.
+ </code>
- <desc>
- <p>Hex encode an URI. </p>
+ It is called before scheme string gets converted into scheme atom and
+ thus possible atom leak could be prevented</p>
- <marker id="decode"></marker>
+ <marker id="encode"></marker>
</desc>
</func>
<func>
- <name>decode(HexEncodedURI) -> URI</name>
-
- <fsummary>Decode a hex encoded URI</fsummary>
+ <name>scheme_defaults() -> SchemeDefaults</name>
+ <fsummary>A list of the scheme and their default ports.</fsummary>
<type>
- <v>HexEncodedURI = string() - A possibly hex encoded uri</v>
- <v>URI = uri()</v>
+ <v>SchemeDefaults = [{scheme(), default_scheme_port_number()}] </v>
+ <v>default_scheme_port_number() = pos_integer()</v>
</type>
-
<desc>
- <p>Decode a possibly hex encoded URI. </p>
+ <p>Provides a list of the scheme and their default
+ port numbers supported (by default) by this utility.</p>
+ <marker id="parse"></marker>
</desc>
</func>
+
+
</funcs>
<!--
<section>
<title>SEE ALSO</title>
- <p>RFC 2616, <seealso marker="inets">inets(3)</seealso>,
+ <p><url href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</url>,
+ <seealso marker="inets">inets(3)</seealso>,
<seealso marker="kernel:gen_tcp">gen_tcp(3)</seealso>,
<seealso marker="ssl:ssl">ssl(3)</seealso>
</p>
diff --git a/lib/inets/doc/src/httpc.xml b/lib/inets/doc/src/httpc.xml
index 05eec9cfd3..31e44f405c 100644
--- a/lib/inets/doc/src/httpc.xml
+++ b/lib/inets/doc/src/httpc.xml
@@ -31,143 +31,252 @@
</header>
<module>httpc</module>
- <modulesummary>An HTTP/1.1 client </modulesummary>
+ <modulesummary>An HTTP/1.1 client</modulesummary>
<description>
- <p>This module provides the API to a HTTP/1.1 compatible client according
- to RFC 2616, caching is currently not supported.</p>
+ <p>This module provides the API to an HTTP/1.1 compatible client according
+ to <url href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</url>.
+ Caching is not supported.</p>
<note>
- <p>When starting the Inets application a manager process for the
- default profile will be started. The functions in this API
- that do not explicitly use a profile will access the
+ <p>When starting the <c>Inets</c> application, a manager process for the
+ default profile is started. The functions in this API
+ that do not explicitly use a profile accesses the
default profile. A profile keeps track of proxy options,
- cookies and other options that can be applied to more than one
- request. </p>
+ cookies, and other options that can be applied to more than one
+ request.</p>
- <p>If the scheme https is used the ssl application needs to be
- started. When https links needs to go through a proxy the
+ <p>If the scheme <c>https</c> is used, the <c>SSL</c> application must
+ be started. When <c>https</c> links need to go through a proxy, the
CONNECT method extension to HTTP-1.1 is used to establish a
- tunnel and then the connection is upgraded to TLS,
- however "TLS upgrade" according to RFC 2817 is not
+ tunnel and then the connection is upgraded to TLS.
+ However, "TLS upgrade" according to <url href="http://www.ietf.org/rfc/rfc2817.txt">RFC 2817</url>is not
supported.</p>
- <p>Also note that pipelining will only be used if the pipeline
- timeout is set, otherwise persistent connections without
- pipelining will be used e.i. the client always waits for
+ <p>Pipelining is only used if the pipeline
+ time-out is set, otherwise persistent connections without
+ pipelining are used. That is, the client always waits for
the previous response before sending the next request.</p>
</note>
- <p>There are some usage examples in the <seealso
- marker="http_client">Inets User's Guide.</seealso></p>
+ <p>Some examples are provided in the <seealso
+ marker="http_client">Inets User's Guide</seealso>.</p>
</description>
<section>
- <title>COMMON DATA TYPES </title>
+ <title>DATA TYPES</title>
+ <marker id="DATA_TYPES"></marker>
<p>Type definitions that are used more than once in
this module:</p>
- <code type="none"><![CDATA[
-boolean() = true | false
-string() = list of ASCII characters
-request_id() = ref()
-profile() = atom()
-path() = string() representing a file path or directory path
-ip_address() = See inet(3)
-socket_opt() = See the Options used by gen_tcp(3) and
- ssl(3) connect(s)
- ]]></code>
-
+ <p><c>boolean() = true | false</c></p>
+ <p><c>string()</c> = list of ASCII characters</p>
+ <p><c>request_id() = ref()</c></p>
+ <p><c>profile() = atom()</c></p>
+ <p><c>path() = string()</c> representing a file path or directory path</p>
+ <p><c>ip_address()</c> = See the
+ <seealso marker="kernel:inet">inet(3)</seealso> manual page in <c>Kernel</c>.</p>
+ <p><c>socket_opt()</c> = See the options used by
+ <seealso marker="kernel:gen_tcp">gen_tcp(3)</seealso> <c>gen_tcp(3)</c> and
+ <seealso marker="ssl:ssl">ssl(3)</seealso> connect(s)</p>
+
</section>
<section>
- <title>HTTP DATA TYPES </title>
- <p>Type definitions that are related to HTTP:</p>
- <p>For more information about HTTP see rfc 2616</p>
-
- <code type="none"><![CDATA[
-method() = head | get | put | post | trace | options | delete
-request() = {url(), headers()} |
- {url(), headers(), content_type(), body()}
-url() = string() - Syntax according to the URI definition in rfc 2396, ex: "http://www.erlang.org"
-status_line() = {http_version(), status_code(), reason_phrase()}
-http_version() = string() ex: "HTTP/1.1"
-status_code() = integer()
-reason_phrase() = string()
-content_type() = string()
-headers() = [header()]
-header() = {field(), value()}
-field() = string()
-value() = string()
-body() = string() |
- binary() |
- {fun(accumulator()) -> body_processing_result(),
- accumulator()} |
- {chunkify,
- fun(accumulator()) -> body_processing_result(),
- accumulator()}
-body_processing_result() = eof | {ok, iolist(), accumulator()}
-accumulator() = term()
-filename() = string()
- ]]></code>
+ <title>HTTP DATA TYPES</title>
+ <p>Type definitions related to HTTP:</p>
- </section>
+ <p><c>method() = head | get | put | post | trace | options | delete</c></p>
+ <taglist>
+ <tag><c>request()</c></tag>
+ <item><p>= <c>{url(), headers()}</c></p>
+ <p>| <c>{url(), headers(), content_type(), body()}</c></p>
+ </item>
+ </taglist>
+ <p><c>url() = string()</c> syntax according to the URI definition in
+ <url href="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396</url>,
+ for example <c>"http://www.erlang.org"</c></p>
+ <p><c>status_line() = {http_version(), status_code(), reason_phrase()}</c></p>
+ <p><c>http_version() = string()</c>, for example, <c>"HTTP/1.1"</c></p>
+ <p><c>status_code() = integer()</c></p>
+ <p><c>reason_phrase() = string()</c></p>
+ <p><c>content_type() = string()</c></p>
+ <p><c>headers() = [header()]</c></p>
+ <p><c>header() = {field(), value()}</c></p>
+ <p><c>field() = string()</c></p>
+ <p><c>value() = string()</c></p>
+ <taglist>
+ <tag><c>body()</c></tag>
+ <item><p>= <c>string() | binary()</c></p>
+ <p>| <c>{fun(accumulator())</c></p>
+ <p><c> -> body_processing_result(), accumulator()}</c></p>
+ <p>| <c>{chunkify, fun(accumulator())</c></p>
+ <p><c> -> body_processing_result(), accumulator()}</c></p>
+ </item>
+ </taglist>
+ <p><c>body_processing_result() = eof | {ok, iolist(), accumulator()}</c></p>
+ <p><c>accumulator() = term()</c></p>
+ <p><c>filename() = string()</c></p>
+ <p>For more information about HTTP, see
+ <url href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</url>.</p>
+</section>
<section>
- <title>SSL DATA TYPES </title>
+ <title>SSL DATA TYPES</title>
<p>See <seealso marker="ssl:ssl">ssl(3)</seealso> for information
- about ssl options (<c>ssloptions()</c>). </p>
+ about <c>SSL</c> options (<c>ssloptions()</c>). </p>
</section>
<section>
- <title>HTTP CLIENT SERVICE START/STOP </title>
+ <title>HTTP CLIENT SERVICE START/STOP</title>
- <p>A HTTP client can be configured to start when starting the inets
+ <p>An HTTP client can be configured to start when starting the <c>Inets</c>
application or started dynamically in runtime by calling the
- inets application API <c>inets:start(httpc, ServiceConfig)</c>, or
- <c>inets:start(httpc, ServiceConfig, How)</c>
- see <seealso marker="inets">inets(3)</seealso>. Below follows a
- description of the available configuration options.</p>
+ <c>Inets</c> application API <c>inets:start(httpc, ServiceConfig)</c>
+ or <c>inets:start(httpc, ServiceConfig, How)</c>,
+ see <seealso marker="inets">inets(3)</seealso>.
+ The configuration options are as follows:</p>
<taglist>
<tag>{profile, profile()}</tag>
- <item>Name of the profile, see
- common data types below, this option is mandatory.</item>
+ <item><p>Name of the profile, see
+ <seealso marker="#DATA_TYPES">DATA TYPES</seealso>.
+ This option is mandatory.</p></item>
<tag>{data_dir, path()}</tag>
- <item>Directory where the profile
- may save persistent data, if omitted all cookies will be treated
- as session cookies.</item>
+ <item><p>Directory where the profile
+ can save persistent data. If omitted, all cookies are treated
+ as session cookies.</p></item>
</taglist>
<p>The client can be stopped using <c>inets:stop(httpc, Pid)</c> or
<c>inets:stop(httpc, Profile)</c>.</p>
-
- <marker id="request1"></marker>
</section>
<funcs>
+
+ <func>
+ <name>cancel_request(RequestId) -></name>
+ <name>cancel_request(RequestId, Profile) -> ok</name>
+ <fsummary>Cancels an asynchronous HTTP request.</fsummary>
+ <type>
+ <v>RequestId = request_id() - A unique identifier as returned
+ by request/4</v>
+ <v>Profile = profile() | pid()</v>
+ <d>When started <c>stand_alone</c> only the pid can be used.</d>
+ </type>
+ <desc>
+ <p>Cancels an asynchronous HTTP request. Notice that this does not guarantee
+ that the request response is not delivered. Because it is asynchronous,
+ the request can already have been completed when the cancellation arrives.
+ </p>
+ </desc>
+ </func>
+
+ <func>
+ <name>cookie_header(Url) -> </name>
+ <name>cookie_header(Url, Profile | Opts) -> header() | {error, Reason}</name>
+ <name>cookie_header(Url, Opts, Profile) -> header() | {error, Reason}</name>
+ <fsummary>Returns the cookie header that would have been sent when
+ making a request to URL using the profile <c>Profile</c>.</fsummary>
+ <type>
+ <v>Url = url()</v>
+ <v>Opts = [cookie_header_opt()]</v>
+ <v>Profile = profile() | pid()</v>
+ <d>When started <c>stand_alone</c>.</d>
+ <v>cookie_header_opt() = {ipv6_host_with_brackets, boolean()}</v>
+ </type>
+ <desc>
+ <p>Returns the cookie header that would have been sent
+ when making a request to <c>Url</c> using profile <c>Profile</c>.
+ If no profile is specified, the default profile is used.</p>
+ <p>Option <c>ipv6_host_with_bracket</c> deals with how to
+ parse IPv6 addresses. For details,
+ see argument <c>Options</c> of
+ <seealso marker="#request-4">request/[4,5]</seealso>.</p>
+ </desc>
+ </func>
+
+ <func>
+ <name>get_options(OptionItems) -> {ok, Values} | {error, Reason}</name>
+ <name>get_options(OptionItems, Profile) -> {ok, Values} | {error, Reason}</name>
+ <fsummary>Gets the currently used options.</fsummary>
+ <type>
+ <v>OptionItems = all | [option_item()]</v>
+ <v>option_item() = proxy |
+ https_proxy |
+ max_sessions |
+ keep_alive_timeout |
+ max_keep_alive_length |
+ pipeline_timeout |
+ max_pipeline_length |
+ cookies |
+ ipfamily |
+ ip |
+ port |
+ socket_opts |
+ verbose</v>
+ <v>Profile = profile() | pid()</v>
+ <d>When started <c>stand_alone</c> only the pid can used.</d>
+ <v>Values = [{option_item(), term()}]</v>
+ <v>Reason = term()</v>
+ </type>
+ <desc>
+ <p>Retrieves the options currently used by the client.</p>
+ </desc>
+ </func>
+
+ <func>
+ <name>info() -> list()</name>
+ <name>info(Profile) -> list()</name>
+ <fsummary>Produces a list of miscellaneous information.</fsummary>
+ <type>
+ <v>Profile = profile() | pid()</v>
+ <d>When started <c>stand_alone</c> only the pid can be used.</d>
+ </type>
+ <desc>
+ <p>Produces a list of miscellaneous information.
+ Intended for debugging.
+ If no profile is specified, the default profile is used.</p>
+ </desc>
+ </func>
+
+
+ <func>
+ <name>reset_cookies() -> void()</name>
+ <name>reset_cookies(Profile) -> void()</name>
+ <fsummary>Resets the cookie database.</fsummary>
+ <type>
+ <v>Profile = profile() | pid()</v>
+ <d>When started <c>stand_alone</c> only the pid can be used.</d>
+ </type>
+ <desc>
+ <p>Resets (clears) the cookie database for the specified
+ <c>Profile</c>. If no profile is specified the default profile
+ is used.</p>
+ </desc>
+ </func>
+
<func>
<name>request(Url) -> </name>
<name>request(Url, Profile) -> {ok, Result} | {error, Reason}</name>
- <fsummary>Sends a get HTTP-request</fsummary>
+ <fsummary>Sends a get HTTP request.</fsummary>
<type>
- <v>Url = url() </v>
+ <v>Url = url()</v>
<v>Result = {status_line(), headers(), Body} |
- {status_code(), Body} | request_id() </v>
+ {status_code(), Body} | request_id()</v>
<v>Body = string() | binary()</v>
- <v>Profile = profile() | pid() (when started <c>stand_alone</c>)</v>
- <v>Reason = term() </v>
+ <v>Profile = profile() | pid()</v>
+ <d>When started <c>stand_alone</c> only the pid can be used.</d>
+ <v>Reason = term()</v>
</type>
<desc>
<p>Equivalent to <c>httpc:request(get, {Url, []}, [], [])</c>.</p>
-
- <marker id="request2"></marker>
</desc>
</func>
<func>
- <name>request(Method, Request, HTTPOptions, Options) -> </name>
+ <name>request(Method, Request, HTTPOptions, Options) -></name>
<name>request(Method, Request, HTTPOptions, Options, Profile) -> {ok, Result} | {ok, saved_to_file} | {error, Reason}</name>
- <fsummary>Sends a HTTP-request</fsummary>
+ <fsummary>Sends an HTTP request.</fsummary>
<type>
- <v>Method = method() </v>
+ <v>Method = method()</v>
<v>Request = request()</v>
<v>HTTPOptions = http_options()</v>
<v>http_options() = [http_option()]</v>
@@ -191,215 +300,200 @@ filename() = string()
{socket_opts, socket_opts()} |
{receiver, receiver()},
{ipv6_host_with_brackets, boolean()}}</v>
- <v>stream_to() = none | self | {self, once} | filename() </v>
+ <v>stream_to() = none | self | {self, once} | filename()</v>
<v>socket_opts() = [socket_opt()]</v>
- <v>receiver() = pid() | function()/1 | {Module, Function, Args} </v>
- <v>Module = atom() </v>
- <v>Function = atom() </v>
- <v>Args = list() </v>
- <v>body_format() = string | binary </v>
+ <v>receiver() = pid() | function()/1 | {Module, Function, Args}</v>
+ <v>Module = atom()</v>
+ <v>Function = atom()</v>
+ <v>Args = list()</v>
+ <v>body_format() = string | binary</v>
<v>Result = {status_line(), headers(), Body} |
- {status_code(), Body} | request_id() </v>
+ {status_code(), Body} | request_id()</v>
<v>Body = string() | binary()</v>
- <v>Profile = profile() | pid() (when started <c>stand_alone</c>)</v>
+ <v>Profile = profile() | pid()</v>
+ <d>When started <c>stand_alone</c> only the pid can be used.</d>
<v>Reason = {connect_failed, term()} |
- {send_failed, term()} | term() </v>
+ {send_failed, term()} | term()</v>
</type>
<desc>
- <p>Sends a HTTP-request. The function can be both synchronous
- and asynchronous. In the later case the function will return
- <c>{ok, RequestId}</c> and later on the information will be delivered
- to the <c>receiver</c> depending on that value. </p>
+ <p>Sends an HTTP request. The function can be both synchronous
+ and asynchronous. In the latter case, the function returns
+ <c>{ok, RequestId}</c> and then the information is delivered
+ to the <c>receiver</c> depending on that value.</p>
- <p>Http option (<c>http_option()</c>) details: </p>
+ <p>HTTP option (<c>http_option()</c>) details:</p>
<marker id="request2_http_options"></marker>
<taglist>
<tag><c><![CDATA[timeout]]></c></tag>
<item>
- <p>Timeout time for the request. </p>
- <p>The clock starts ticking as soon as the request has been
- sent. </p>
- <p>Time is in milliseconds. </p>
- <p>Defaults to <c>infinity</c>. </p>
+ <p>Time-out time for the request.</p>
+ <p>The clock starts ticking when the request is sent.</p>
+ <p>Time is in milliseconds.</p>
+ <p>Default is <c>infinity</c>.</p>
</item>
<tag><c><![CDATA[connect_timeout]]></c></tag>
<item>
- <p>Connection timeout time, used during the initial request,
- when the client is <em>connecting</em> to the server. </p>
- <p>Time is in milliseconds. </p>
- <p>Defaults to the value of the <c>timeout</c> option. </p>
+ <p>Connection time-out time, used during the initial request,
+ when the client is <em>connecting</em> to the server.</p>
+ <p>Time is in milliseconds.</p>
+ <p>Default is the value of option <c>timeout</c>.</p>
</item>
<tag><c><![CDATA[ssl]]></c></tag>
<item>
- <p>This is the default ssl config option, currently defaults to
- <c>essl</c>, see below. </p>
- <p>Defaults to <c>[]</c>. </p>
- </item>
-
- <tag><c><![CDATA[essl]]></c></tag>
- <item>
- <p>If using the Erlang based implementation of SSL,
- these SSL-specific options are used. </p>
- <p>Defaults to <c>[]</c>. </p>
+ <p>This is the <c>SSL/TLS</c> connectin configuration option.</p>
+ <p>Defaults to <c>[]</c>. See <seealso marker="ssl:ssl">ssl:connect/[2, 3,4]</seealso> for availble options.</p>
</item>
<tag><c><![CDATA[autoredirect]]></c></tag>
<item>
- <p>Should the client automatically retrieve the information
- from the new URI and return that as the result instead
- of a 30X-result code. </p>
- <p>Note that for some 30X-result codes automatic redirect
- is not allowed. In these cases the 30X-result will always
- be returned. </p>
- <p>Defaults to <c>true</c>. </p>
+ <p>The client automatically retrieves the information
+ from the new URI and returns that as the result, instead
+ of a 30X-result code.</p>
+ <p>For some 30X-result codes, automatic redirect
+ is not allowed. In these cases the 30X-result is always
+ returned.</p>
+ <p>Default is <c>true</c>.</p>
</item>
<tag><c><![CDATA[proxy_auth]]></c></tag>
<item>
- <p>A proxy-authorization header using the provided user name and
- password will be added to the request. </p>
+ <p>A proxy-authorization header using the provided username and
+ password is added to the request.</p>
</item>
<tag><c><![CDATA[version]]></c></tag>
<item>
<p>Can be used to make the client act as an <c>HTTP/1.0</c> or
<c>HTTP/0.9</c> client. By default this is an <c>HTTP/1.1</c>
- client. When using <c>HTTP/1.0</c> persistent connections will
- not be used. </p>
- <p>Defaults to the string <c>"HTTP/1.1"</c>. </p>
+ client. When using <c>HTTP/1.0</c> persistent connections are
+ not used.</p>
+ <p>Default is the string <c>"HTTP/1.1"</c>.</p>
</item>
<tag><c><![CDATA[relaxed]]></c></tag>
<item>
- <p>If set to <c>true</c> workarounds for known server deviations
- from the HTTP-standard are enabled. </p>
- <p>Defaults to <c>false</c>. </p>
+ <p>If set to <c>true</c>, workarounds for known server deviations
+ from the HTTP-standard are enabled.</p>
+ <p>Default is <c>false</c>.</p>
</item>
<tag><c><![CDATA[url_encode]]></c></tag>
<item>
- <p>Will apply Percent-encoding, also known as URL encoding on the
+ <p>Applies Percent-encoding, also known as URL encoding on the
URL.</p>
- <p>Defaults to <c>false</c>. </p>
+ <p>Default is <c>false</c>.</p>
</item>
</taglist>
- <p>Option (<c>option()</c>) details: </p>
+ <p>Option (<c>option()</c>) details:</p>
<taglist>
<tag><c><![CDATA[sync]]></c></tag>
<item>
- <p>Shall the request be synchronous or asynchronous. </p>
- <p>Defaults to <c>true</c>. </p>
+ <p>Option for the request to be synchronous or asynchronous.</p>
+ <p>Default is <c>true</c>.</p>
</item>
<tag><c><![CDATA[stream]]></c></tag>
<item>
<p>Streams the body of a 200 or 206 response to the calling
process or to a file. When streaming to the calling process
- using the option <c>self</c> the following stream messages
- will be sent to that process: <c>{http, {RequestId,
+ using option <c>self</c>, the following stream messages
+ are sent to that process: <c>{http, {RequestId,
stream_start, Headers}}, {http, {RequestId, stream,
- BinBodyPart}}, {http, {RequestId, stream_end, Headers}}</c>. When
- streaming to the calling processes using the option
- <c>{self, once}</c> the first message will have an additional
- element e.i. <c>{http, {RequestId, stream_start, Headers, Pid}}</c>,
- this is the process id that should be used as an argument to
+ BinBodyPart}}, and {http, {RequestId, stream_end, Headers}}</c>.</p>
+ <p>When streaming to the calling processes using option
+ <c>{self, once}</c>, the first message has an extra
+ element, that is, <c>{http, {RequestId, stream_start, Headers, Pid}}</c>.
+ This is the process id to be used as an argument to
<c>http:stream_next/1</c> to trigger the next message to be sent to
- the calling process. </p>
- <p>Note that it is possible that chunked encoding will add
+ the calling process.</p>
+ <p>Notice that chunked encoding can add
headers so that there are more headers in the <c>stream_end</c>
- message than in the <c>stream_start</c>.
- When streaming to a file and the request is asynchronous the
- message <c>{http, {RequestId, saved_to_file}}</c> will be sent. </p>
- <p>Defaults to <c>none</c>. </p>
+ message than in <c>stream_start</c>.
+ When streaming to a file and the request is asynchronous, the
+ message <c>{http, {RequestId, saved_to_file}}</c> is sent.</p>
+ <p>Default is <c>none</c>.</p>
</item>
<tag><c><![CDATA[body_format]]></c></tag>
<item>
- <p>Defines if the body shall be delivered as a string or as a
+ <p>Defines if the body is to be delivered as a string or
binary. This option is only valid for the synchronous
- request. </p>
- <p>Defaults to <c>string</c>. </p>
+ request.</p>
+ <p>Default is <c>string</c>.</p>
</item>
<tag><c><![CDATA[full_result]]></c></tag>
<item>
- <p>Should a "full result" be returned to the caller (that is,
- the body, the headers and the entire status-line) or not
- (the body and the status code). </p>
- <p>Defaults to <c>true</c>. </p>
+ <p>Defines if a "full result" is to be returned to the caller (that is,
+ the body, the headers, and the entire status line) or not
+ (the body and the status code).</p>
+ <p>Default is <c>true</c>.</p>
</item>
<tag><c><![CDATA[headers_as_is]]></c></tag>
<item>
- <p>Shall the headers provided by the user be made
- lower case or be regarded as case sensitive. </p>
- <p>Note that the http standard requires them to be
- case insenstive. This feature should only be used if there is
+ <p>Defines if the headers provided by the user are to be made
+ lower case or to be regarded as case sensitive.</p>
+ <p>The HTTP standard requires them to be
+ case insensitive. Use this feature only if there is
no other way to communicate with the server or for testing
- purpose. Also note that when this option is used no headers
- will be automatically added, all necessary headers have to be
- provided by the user. </p>
- <p>Defaults to <c>false</c>. </p>
+ purpose. When this option is used, no headers
+ are automatically added. All necessary headers must be
+ provided by the user.</p>
+ <p>Default is <c>false</c>.</p>
</item>
<tag><c><![CDATA[socket_opts]]></c></tag>
<item>
<p>Socket options to be used for this and subsequent
- request(s). </p>
- <p>Overrides any value set by the
- <seealso marker="#set_options">set_options</seealso>
- function. </p>
- <p>Note that the validity of the options are <em>not</em>
- checked in any way. </p>
- <p>Note that this may change the socket behaviour
- (see <seealso marker="kernel:inet#setopts/2">inet:setopts/2</seealso>)
- for an already existing one, and therefore an already connected
- request handler. </p>
- <p>By default the socket options set by the
- <seealso marker="#set_options">set_options/1,2</seealso>
- function are used when establishing a connection. </p>
+ requests.</p>
+ <p>Overrides any value set by function
+ <seealso marker="#set_options-1">set_options</seealso>.</p>
+ <p>The validity of the options is <em>not</em> checked by
+ the HTTP client they are assumed to be correct and passed
+ on to ssl application and inet driver, which may reject
+ them if they are not correct. Note that the current
+ implementation assumes the requests to the same host, port
+ combination will use the same socket options.
+ </p>
+
+ <p>By default the socket options set by function
+ <seealso marker="#set_options-1">set_options/[1,2]</seealso>
+ are used when establishing a connection.</p>
</item>
<tag><c><![CDATA[receiver]]></c></tag>
<item>
- <p>Defines how the client will deliver the result of an
- asynchronous request (<c>sync</c> has the value
- <c>false</c>). </p>
+ <p>Defines how the client delivers the result of an
+ asynchronous request (<c>sync</c> has the value
+ <c>false</c>).</p>
<taglist>
<tag><c><![CDATA[pid()]]></c></tag>
<item>
- <p>Message(s) will be sent to this process in the format: </p>
-<pre>
-{http, ReplyInfo}
-</pre>
+ <p>Messages are sent to this process in the format
+ <c>{http, ReplyInfo}</c>.</p>
</item>
<tag><c><![CDATA[function/1]]></c></tag>
<item>
- <p>Information will be delivered to the receiver via calls
- to the provided fun: </p>
-<pre>
-Receiver(ReplyInfo)
-</pre>
+ <p>Information is delivered to the receiver through calls
+ to the provided fun <c>Receiver(ReplyInfo)</c>.</p>
</item>
<tag><c><![CDATA[{Module, Function, Args}]]></c></tag>
<item>
- <p>Information will be delivered to the receiver via calls
- to the callback function: </p>
-<pre>
-apply(Module, Function, [ReplyInfo | Args])
-</pre>
+ <p>Information is delivered to the receiver through calls
+ to the callback function
+ <c>apply(Module, Function, [ReplyInfo | Args])</c>.</p>
</item>
-
</taglist>
- <p>In all of the above cases, <c>ReplyInfo</c> has the following
- structure: </p>
+ <p>In all of these cases, <c>ReplyInfo</c> has the following
+ structure:</p>
<pre>
{RequestId, saved_to_file}
@@ -407,11 +501,10 @@ apply(Module, Function, [ReplyInfo | Args])
{RequestId, Result}
{RequestId, stream_start, Headers}
{RequestId, stream_start, Headers, HandlerPid}
-{RequestId, stream, BinBodyPart}
-{RequestId, stream_end, Headers}
-</pre>
+{RequestId, stream, BinBodyPart}
+{RequestId, stream_end, Headers}</pre>
- <p>Defaults to the <c>pid()</c> of the process calling the request
+ <p>Default is the <c>pid</c> of the process calling the request
function (<c>self()</c>). </p>
<marker id="ipv6_host_with_brackets"></marker>
@@ -419,276 +512,178 @@ apply(Module, Function, [ReplyInfo | Args])
<tag><c><![CDATA[ipv6_host_with_brackets]]></c></tag>
<item>
- <p>When parsing the Host-Port part of an URI with a IPv6 address
- with brackets, shall we retain those brackets (<c>true</c>) or
- strip them (<c>false</c>). </p>
- <p>Defaults to <c>false</c>. </p>
+ <p>Defines when parsing the Host-Port part of an URI with an IPv6 address
+ with brackets, if those brackets are to be retained (<c>true</c>)
+ or stripped (<c>false</c>).</p>
+ <p>Default is <c>false</c>.</p>
</item>
</taglist>
-
- <marker id="cancel_request"></marker>
- </desc>
- </func>
-
- <func>
- <name>cancel_request(RequestId) -> </name>
- <name>cancel_request(RequestId, Profile) -> ok</name>
- <fsummary>Cancels an asynchronous HTTP-request.</fsummary>
- <type>
- <v>RequestId = request_id() - A unique identifier as returned
- by request/4</v>
- <v>Profile = profile() | pid() (when started <c>stand_alone</c>)</v>
- </type>
- <desc>
- <p>Cancels an asynchronous HTTP-request. Note this does not guarantee
- that the request response will not be delivered, as it is asynchronous the
- the request may already have been completed when the cancellation arrives.
- </p>
-
- <marker id="set_options"></marker>
</desc>
</func>
+
<func>
<name>set_options(Options) -> </name>
<name>set_options(Options, Profile) -> ok | {error, Reason}</name>
<fsummary>Sets options to be used for subsequent requests.</fsummary>
<type>
<v>Options = [Option]</v>
- <v>Option = {proxy, {Proxy, NoProxy}} |
- {https_proxy, {Proxy, NoProxy}} |
- {max_sessions, MaxSessions} |
- {max_keep_alive_length, MaxKeepAlive} |
- {keep_alive_timeout, KeepAliveTimeout} |
- {max_pipeline_length, MaxPipeline} |
- {pipeline_timeout, PipelineTimeout} |
- {cookies, CookieMode} |
- {ipfamily, IpFamily} |
- {ip, IpAddress} |
- {port, Port} |
- {socket_opts, socket_opts()} |
- {verbose, VerboseMode} </v>
-
+ <v>Option = {proxy, {Proxy, NoProxy}}</v>
+ <v>| {https_proxy, {Proxy, NoProxy}}</v>
+ <v>| {max_sessions, MaxSessions}</v>
+ <v>| {max_keep_alive_length, MaxKeepAlive}</v>
+ <v>| {keep_alive_timeout, KeepAliveTimeout}</v>
+ <v>| {max_pipeline_length, MaxPipeline}</v>
+ <v>| {pipeline_timeout, PipelineTimeout}</v>
+ <v>| {cookies, CookieMode}</v>
+ <v>| {ipfamily, IpFamily}</v>
+ <v>| {ip, IpAddress}</v>
+ <v>| {port, Port}</v>
+ <v>| {socket_opts, socket_opts()}</v>
+ <v>| {verbose, VerboseMode}</v>
<v>Proxy = {Hostname, Port}</v>
- <v>Hostname = string() </v>
- <d>ex: "localhost" or "foo.bar.se"</d>
+ <v>Hostname = string()</v>
+ <d>Example: "localhost" or "foo.bar.se"</d>
<v>Port = integer()</v>
- <d>ex: 8080 </d>
+ <d>Example: 8080</d>
<v>NoProxy = [NoProxyDesc]</v>
<v>NoProxyDesc = DomainDesc | HostName | IPDesc</v>
<v>DomainDesc = "*.Domain"</v>
- <d>ex: "*.ericsson.se"</d>
+ <d>Example: "*.ericsson.se"</d>
<v>IpDesc = string()</v>
- <d>ex: "134.138" or "[FEDC:BA98" (all IP-addresses starting with 134.138 or FEDC:BA98), "66.35.250.150" or "[2010:836B:4179::836B:4179]" (a complete IP-address).</d>
-
- <d>proxy defaults to {undefined, []} e.i. no proxy is configured and https_proxy defaults to
- the value of proxy.</d>
-
- <v>MaxSessions = integer() </v>
- <d>Default is <c>2</c>.
- Maximum number of persistent connections to a host.</d>
- <v>MaxKeepAlive = integer() </v>
- <d>Default is <c>5</c>.
- Maximum number of outstanding requests on the same connection to
- a host.</d>
- <v>KeepAliveTimeout = integer() </v>
- <d>Default is <c>120000</c> (= 2 min).
- If a persistent connection is idle longer than the
+ <d>Example: "134.138" or "[FEDC:BA98"
+ (all IP addresses starting with 134.138 or FEDC:BA98),
+ "66.35.250.150" or "[2010:836B:4179::836B:4179]" (a complete IP address).</d>
+ <d><c>proxy</c> defaults to <c>{undefined, []}</c>,
+ that is, no proxy is configured and
+ <c>https_proxy</c> defaults to the value of <c>proxy</c>.</d>
+ <v>MaxSessions = integer()</v>
+ <d>Maximum number of persistent connections to a host.
+ Default is <c>2</c>.</d>
+ <v>MaxKeepAlive = integer()</v>
+ <d>Maximum number of outstanding requests on the same connection to
+ a host. Default is <c>5</c>.</d>
+ <v>KeepAliveTimeout = integer()</v>
+ <d>If a persistent connection is idle longer than the
<c>keep_alive_timeout</c> in milliseconds,
- the client will close the connection.
- The server may also have such a time out but you should
- not count on it!</d>
- <v>MaxPipeline = integer() </v>
- <d>Default is <c>2</c>.
- Maximum number of outstanding requests on a pipelined connection
- to a host.</d>
- <v>PipelineTimeout = integer() </v>
- <d>Default is <c>0</c>,
- which will result in pipelining not being used.
- If a persistent connection is idle longer than the
+ the client closes the connection.
+ The server can also have such a time-out but do not take that for granted.
+ Default is <c>120000</c> (= 2 min).</d>
+ <v>MaxPipeline = integer()</v>
+ <d>Maximum number of outstanding requests on a pipelined connection
+ to a host. Default is <c>2</c>.</d>
+ <v>PipelineTimeout = integer()</v>
+ <d>If a persistent connection is idle longer than the
<c>pipeline_timeout</c> in milliseconds,
- the client will close the connection. </d>
- <v>CookieMode = enabled | disabled | verify </v>
- <d>Default is <c>disabled</c>.
- If Cookies are enabled all valid cookies will automatically be
- saved in the client manager's cookie database.
- If the option <c>verify</c> is used the function <c>store_cookies/2</c>
- has to be called for the cookies to be saved.</d>
- <v>IpFamily = inet | inet6 | inet6fb4 </v>
- <d>By default <c>inet</c>.
- When it is set to <c>inet6fb4</c> you can use both ipv4 and ipv6.
- It first tries <c>inet6</c> and if that does not works falls back to <c>inet</c>.
- The option is here to provide a workaround for buggy ipv6 stacks to ensure that
- ipv4 will always work.</d>
- <v>IpAddress = ip_address() </v>
- <d>If the host has several network interfaces, this option specifies which one to use.
- See <seealso marker="kernel:gen_tcp#connect">gen_tcp:connect/3,4</seealso> for more info. </d>
- <v>Port = integer() </v>
- <d>Specify which local port number to use.
- See <seealso marker="kernel:gen_tcp#connect">gen_tcp:connect/3,4</seealso> for more info. </d>
+ the client closes the connection. Default is <c>0</c>,
+ which results in pipelining not being used.</d>
+ <v>CookieMode = enabled | disabled | verify</v>
+ <d>If cookies are enabled, all valid cookies are automatically
+ saved in the cookie database of the client manager.
+ If option <c>verify</c> is used, function <c>store_cookies/2</c>
+ has to be called for the cookies to be saved.
+ Default is <c>disabled</c>.</d>
+ <v>IpFamily = inet | inet6 </v>
+ <d>Default is <c>inet</c>.</d>
+ <v>IpAddress = ip_address()</v>
+ <d>If the host has several network interfaces, this option specifies
+ which one to use.
+ See <seealso marker="kernel:gen_tcp#connect">gen_tcp:connect/3,4</seealso>
+ for details.</d>
+ <v>Port = integer()</v>
+ <d>Local port number to use.
+ See <seealso marker="kernel:gen_tcp#connect">gen_tcp:connect/3,4</seealso>
+ for details.</d>
<v>socket_opts() = [socket_opt()]</v>
<d>The options are appended to the socket options used by the
- client. </d>
+ client.</d>
<d>These are the default values when a new request handler
is started (for the initial connect). They are passed directly
- to the underlying transport (gen_tcp or ssl) <em>without</em>
- verification! </d>
- <v>VerboseMode = false | verbose | debug | trace </v>
+ to the underlying transport (<c>gen_tcp</c> or <c>SSL</c>)
+ <em>without</em> verification.</d>
+ <v>VerboseMode = false | verbose | debug | trace</v>
<d>Default is <c>false</c>.
This option is used to switch on (or off)
- different levels of erlang trace on the client.
+ different levels of Erlang trace on the client.
It is a debug feature.</d>
- <v>Profile = profile() | pid() (when started <c>stand_alone</c>)</v>
+ <v>Profile = profile() | pid()</v>
+ <d>When started <c>stand_alone</c> only the pid can be used.</d>
</type>
<desc>
<p>Sets options to be used for subsequent requests.</p>
<note>
- <p>If possible the client will keep its connections
- alive and use persistent connections
- with or without pipeline depending on configuration
+ <p>If possible, the client keeps its connections
+ alive and uses persistent connections
+ with or without pipeline depending on configuration
and current circumstances. The HTTP/1.1 specification does not
- provide a guideline for how many requests would be
- ideal to be sent on a persistent connection,
- this very much depends on the
- application. Note that a very long queue of requests may cause a
- user perceived delay as earlier requests may take a long time
- to complete. The HTTP/1.1 specification does suggest a
- limit of 2 persistent connections per server, which is the
- default value of the <c>max_sessions</c> option. </p>
+ provide a guideline for how many requests that are
+ ideal to be sent on a persistent connection.
+ This depends much on the application.</p>
+ <p>A long queue of requests can cause a
+ user-perceived delay, as earlier requests can take a long time
+ to complete. The HTTP/1.1 specification suggests a
+ limit of two persistent connections per server, which is the
+ default value of option <c>max_sessions</c>.</p>
</note>
<marker id="get_options"></marker>
</desc>
</func>
-
- <func>
- <name>get_options(OptionItems) -> {ok, Values} | {error, Reason}</name>
- <name>get_options(OptionItems, Profile) -> {ok, Values} | {error, Reason}</name>
- <fsummary>Gets the currently used options.</fsummary>
- <type>
- <v>OptionItems = all | [option_item()]</v>
- <v>option_item() = proxy |
- https_proxy
- max_sessions |
- keep_alive_timeout |
- max_keep_alive_length |
- pipeline_timeout |
- max_pipeline_length |
- cookies |
- ipfamily |
- ip |
- port |
- socket_opts |
- verbose</v>
- <v>Profile = profile() | pid() (when started <c>stand_alone</c>)</v>
- <v>Values = [{option_item(), term()}]</v>
- <v>Reason = term() </v>
- </type>
- <desc>
- <p>Retrieves the options currently used by the client.</p>
-
- <marker id="stream_next"></marker>
- </desc>
- </func>
-
- <func>
- <name>stream_next(Pid) -> ok</name>
- <fsummary> Triggers the next message to be streamed, e.i.
- same behavior as active once for sockets.
- </fsummary>
- <type>
- <v>Pid = pid() - as received in the stream_start message</v>
- </type>
- <desc>
- <p>Triggers the next message to be streamed, e.i.
- same behavior as active once for sockets. </p>
-
- <marker id="verify_cookies"></marker>
- <marker id="store_cookies"></marker>
- </desc>
- </func>
-
+
<func>
<name>store_cookies(SetCookieHeaders, Url) -> </name>
<name>store_cookies(SetCookieHeaders, Url, Profile) -> ok | {error, Reason}</name>
- <fsummary>Saves the cookies defined in SetCookieHeaders in the client profile's cookie database.</fsummary>
+ <fsummary>Saves the cookies defined in <c>SetCookieHeaders</c> in the
+ client profile cookie database.</fsummary>
<type>
<v>SetCookieHeaders = headers() - where field = "set-cookie"</v>
<v>Url = url()</v>
- <v>Profile = profile() | pid() (when started <c>stand_alone</c>)</v>
- </type>
- <desc>
- <p>Saves the cookies defined in SetCookieHeaders
- in the client profile's cookie database. You need to
- call this function if you have set the option <c>cookies</c>
- to <c>verify</c>.
- If no profile is specified the default profile will be used. </p>
-
- <marker id="cookie_header"></marker>
- </desc>
- </func>
-
- <func>
- <name>cookie_header(Url) -> </name>
- <name>cookie_header(Url, Profile | Opts) -> header() | {error, Reason}</name>
- <name>cookie_header(Url, Opts, Profile) -> header() | {error, Reason}</name>
- <fsummary>Returns the cookie header that would be sent when
- making a request to Url using the profile <c>Profile</c>.</fsummary>
- <type>
- <v>Url = url()</v>
- <v>Opts = [cookie_header_opt()]</v>
- <v>Profile = profile() | pid() (when started <c>stand_alone</c>)</v>
- <v>cookie_header_opt() = {ipv6_host_with_brackets, boolean()}</v>
+ <v>Profile = profile() | pid()</v>
+ <d>When started <c>stand_alone</c> only the pid can be used.</d>
</type>
<desc>
- <p>Returns the cookie header that would be sent
- when making a request to <c>Url</c> using the profile <c>Profile</c>.
- If no profile is specified the default profile will be used. </p>
- <p>The option <c>ipv6_host_with_bracket</c> deals with how to
- parse IPv6 addresses.
- See the <c>Options</c> argument of the
- <seealso marker="#request2">request/4,5</seealso> for more info. </p>
-
- <marker id="reset_cookies"></marker>
+ <p>Saves the cookies defined in <c>SetCookieHeaders</c>
+ in the client profile cookie database.
+ Call this function if option <c>cookies</c> is set to <c>verify</c>.
+ If no profile is specified, the default profile is used.</p>
</desc>
</func>
-
<func>
- <name>reset_cookies() -> void()</name>
- <name>reset_cookies(Profile) -> void()</name>
- <fsummary>Reset the cookie database.</fsummary>
+ <name>stream_next(Pid) -> ok</name>
+ <fsummary>Triggers the next message to be streamed, that is,
+ the same behavior as active one for sockets.
+ </fsummary>
<type>
- <v>Profile = profile() | pid() (when started <c>stand_alone</c>)</v>
+ <v>Pid = pid()</v>
+ <d>As received in the <c>stream_start message</c></d>
</type>
<desc>
- <p>Resets (clears) the cookie database for the specified
- <c>Profile</c>. If no profile is specified the default profile
- will be used. </p>
+ <p>Triggers the next message to be streamed, that is,
+ the same behavior as active ones for sockets.</p>
- <marker id="which_cookies"></marker>
+ <marker id="verify_cookies"></marker>
+ <marker id="store_cookies"></marker>
</desc>
</func>
-
-
+
<func>
<name>which_cookies() -> cookies()</name>
<name>which_cookies(Profile) -> cookies()</name>
- <fsummary>Dumps out the entire cookie database.</fsummary>
+ <fsummary>Dumps the entire cookie database.</fsummary>
<type>
- <v>Profile = profile() | pid() (when started <c>stand_alone</c>)</v>
+ <v>Profile = profile() | pid()</v>
+ <d>When started <c>stand_alone</c> only the pid can be used.</d>
<v>cookies() = [cookie_stores()]</v>
<v>cookie_stores() = {cookies, cookies()} | {session_cookies, cookies()}</v>
<v>cookies() = [cookie()]</v>
<v>cookie() = term()</v>
</type>
<desc>
- <p>This function produces a list of the entire cookie database.
- It is intended for debugging/testing purposes.
- If no profile is specified the default profile will be used. </p>
-
- <marker id="which_sessions"></marker>
+ <p>Produces a list of the entire cookie database.
+ Intended for debugging/testing purposes.
+ If no profile is specified, the default profile is used.</p>
</desc>
</func>
@@ -697,41 +692,29 @@ apply(Module, Function, [ReplyInfo | Args])
<name>which_sessions(Profile) -> session_info()</name>
<fsummary>Produces a slightly processed dump of the sessions database.</fsummary>
<type>
- <v>Profile = profile() | pid() (when started <c>stand_alone</c>)</v>
+ <v>Profile = profile() | pid()</v>
+ <d>When started <c>stand_alone</c> only the pid can be used.</d>
<v>session_info() = {GoodSessions, BadSessions, NonSessions}</v>
<v>GoodSessions = session()</v>
<v>BadSessions = tuple()</v>
<v>NonSessions = term()</v>
</type>
<desc>
- <p>This function produces a slightly processed dump of the session
+ <p>Produces a slightly processed dump of the session
database. It is intended for debugging.
- If no profile is specified the default profile will be used. </p>
-
- <marker id="info"></marker>
+ If no profile is specified, the default profile is used.</p>
</desc>
</func>
- <func>
- <name>info() -> list()</name>
- <name>info(Profile) -> list()</name>
- <fsummary>Produces a list of miscelleneous info</fsummary>
- <type>
- <v>Profile = profile() | pid() (when started <c>stand_alone</c>)</v>
- </type>
- <desc>
- <p>This function produces a list of miscelleneous info.
- It is intended for debugging.
- If no profile is specified the default profile will be used. </p>
- </desc>
- </func>
+
</funcs>
<section>
<title>SEE ALSO</title>
- <p>RFC 2616, <seealso marker="inets">inets(3)</seealso>,
- <seealso marker="kernel:gen_tcp">gen_tcp(3)</seealso>,
- <seealso marker="ssl:ssl">ssl(3)</seealso>
+ <p><url href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</url>,
+ <seealso marker="inets">inets(3)</seealso>,
+ <seealso marker="kernel:gen_tcp">gen_tcp(3)</seealso>,
+ <seealso marker="ssl:ssl">ssl(3)</seealso>
</p>
</section>
diff --git a/lib/inets/doc/src/httpd.xml b/lib/inets/doc/src/httpd.xml
index 7ea9b9318f..2a4aea41c2 100644
--- a/lib/inets/doc/src/httpd.xml
+++ b/lib/inets/doc/src/httpd.xml
@@ -31,191 +31,191 @@
</header>
<module>httpd</module>
<modulesummary>An implementation of an HTTP
- 1.1 compliant Web server, as defined in RFC 2616.
+ 1.1 compliant web server, as defined in <url href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</url>
</modulesummary>
<description>
- <p>Documents the HTTP server start options, some administrative
- functions and also specifies the Erlang Web server callback
- API</p>
+ <p>This module provides the HTTP server start options, some administrative
+ functions, and specifies the Erlang web server callback
+ API.</p>
</description>
<section>
- <title>COMMON DATA TYPES </title>
+ <title>DATA TYPES</title>
<p>Type definitions that are used more than once in
this module:</p>
- <p><c>boolean() = true | false </c></p>
- <p><c>string() = list of ASCII characters</c></p>
- <p><c>path() = string() - representing a file or directory path.</c></p>
- <p><c> ip_address() = {N1,N2,N3,N4} % IPv4
+ <p><c>boolean() = true | false</c></p>
+ <p><c>string()</c> = list of ASCII characters</p>
+ <p><c>path() = string()</c> representing a file or a directory path</p>
+ <p><c> ip_address() = {N1,N2,N3,N4} % IPv4
| {K1,K2,K3,K4,K5,K6,K7,K8} % IPv6</c></p>
- <p><c>hostname() = string() - representing a host ex "foo.bar.com"</c></p>
+ <p><c>hostname() = string()</c> representing a host, for example,
+ "foo.bar.com"</p>
<p><c>property() = atom()</c></p>
</section>
<section>
- <title>ERLANG HTTP SERVER SERVICE START/STOP </title>
- <p>A web server can be configured to start when starting the inets
- application or started dynamically in runtime by calling the
- Inets application API <c>inets:start(httpd, ServiceConfig)</c>, or
+ <title>ERLANG HTTP SERVER SERVICE START/STOP</title>
+ <p>A web server can be configured to start when starting the <c>Inets</c>
+ application, or dynamically in runtime by calling the
+ <c>Inets</c> application API <c>inets:start(httpd, ServiceConfig)</c> or
<c>inets:start(httpd, ServiceConfig, How)</c>,
- see <seealso marker="inets">inets(3)</seealso> Below follows a
- description of the available configuration options, also called
- properties.</p>
+ see <seealso marker="inets">inets(3)</seealso>.
+ The configuration options, also called
+ properties, are as follows:</p>
<marker id="props_file"></marker>
- <p><em>File properties</em></p>
+ <p><em>File Properties</em></p>
<p>When the web server is started
- at application start time the properties should be fetched from a
- configuration file that could consist of a regular erlang property
- list, e.i. <c>[{Option, Value}] </c> where <c> Option = property()
+ at application start time, the properties are to be fetched from a
+ configuration file that can consist of a regular Erlang property
+ list, that is, <c>[{Option, Value}]</c>, where <c> Option = property()
</c> and <c>Value = term()</c>, followed by a full stop, or for
- backwards compatibility an Apache like configuration file. If the
- web server is started dynamically at runtime you may still specify
- a file but you could also just specify the complete property
+ backwards compatibility, an Apache-like configuration file. If the
+ web server is started dynamically at runtime,
+ a file can still be specified but also the complete property
list.</p>
<taglist>
<marker id="prop_proplist_file"></marker>
<tag>{proplist_file, path()}</tag>
<item>
- <p>If this property is defined inets will expect to find
- all other properties defined in this file. Note that the
+ <p>If this property is defined, <c>Inets</c> expects to find
+ all other properties defined in this file. The
file must include all properties listed under mandatory
- properties. </p>
+ properties.</p>
</item>
<marker id="prop_file"></marker>
<tag>{file, path()}</tag>
<item>
- <p>If this property is defined inets will expect to find all
- other properties defined in this file, that uses Apache like
- syntax. Note that the file must include all properties listed
- under mandatory properties. The Apache like syntax is the property,
+ <p>If this property is defined, <c>Inets</c> expects to find all
+ other properties defined in this file, which uses Apache-like
+ syntax. The file must include all properties listed
+ under mandatory properties. The Apache-like syntax is the property,
written as one word where each new word begins with a capital,
- followed by a white-space followed by the value followed by a
- new line. Ex: </p>
-
+ followed by a white-space, followed by the value, followed by a
+ new line.</p>
+ <p>Example:</p>
<code>
-{server_root, "/urs/local/www"} -> ServerRoot /usr/local/www
- </code>
+{server_root, "/urs/local/www"} -> ServerRoot /usr/local/www</code>
- <p>With a few exceptions, that are documented
+ <p>A few exceptions are documented
for each property that behaves differently,
- and the special case {directory, {path(), PropertyList}} and
- {security_directory, {Dir, PropertyList}} that are represented
+ and the special cases <c>{directory, {path(), PropertyList}}</c>
+ and <c>{security_directory, {Dir, PropertyList}}</c>, are represented
as:</p>
<pre>
<![CDATA[
<Directory Dir>
<Properties handled as described above>
</Directory>
- ]]>
- </pre>
+ ]]></pre>
</item>
</taglist>
<note>
- <p>The properties proplist_file and file are mutually exclusive.</p>
+ <p>The properties <c>proplist_file</c> and <c>file</c> are mutually exclusive. Also newer properties may not be supported as Apache-like options, this is a legacy feature.</p>
</note>
<marker id="props_mand"></marker>
- <p><em>Mandatory properties</em></p>
+ <p><em>Mandatory Properties</em></p>
<taglist>
<marker id="prop_port"></marker>
<tag>{port, integer()} </tag>
<item>
- <p>The port that the HTTP server shall listen on.
+ <p>The port that the HTTP server listen to.
If zero is specified as port, an arbitrary available port
- will be picked and you can use the httpd:info/2 function to find
- out which port was picked. </p>
+ is picked and function <c>httpd:info/2</c> can be used to
+ determine which port was picked.</p>
</item>
<marker id="prop_server_name"></marker>
- <tag>{server_name, string()} </tag>
+ <tag>{server_name, string()}</tag>
<item>
- <p>The name of your server, normally a fully qualified domain name. </p>
+ <p>The name of your server, normally a fully qualified domain name.</p>
</item>
<marker id="prop_server_root"></marker>
- <tag>{server_root, path()} </tag>
+ <tag>{server_root, path()}</tag>
<item>
- <p>Defines the server's home directory where log files etc can
- be stored. Relative paths specified in other properties refer
- to this directory. </p>
+ <p>Defines the home directory of the server, where log files, and so on,
+ can be stored. Relative paths specified in other properties refer
+ to this directory.</p>
</item>
<marker id="prop_doc_root"></marker>
<tag>{document_root, path()}</tag>
<item>
- Defines the top directory for the documents that
- are available on the HTTP server.
+ <p>Defines the top directory for the documents that
+ are available on the HTTP server.</p>
</item>
</taglist>
<marker id="props_comm"></marker>
- <p><em>Communication properties</em> </p>
+ <p><em>Communication Properties</em></p>
<taglist>
<marker id="prop_bind_address"></marker>
- <tag>{bind_address, ip_address() | hostname() | any} </tag>
+ <tag>{bind_address, ip_address() | hostname() | any}</tag>
<item>
- <p>Defaults to <c>any</c>. Note that <c>any</c> is denoted <em>*</em>
- in the apache like configuration file. </p>
+ <p>Default is <c>any</c>. <c>any</c> is denoted <em>*</em>
+ in the Apache-like configuration file.</p>
</item>
<marker id="profile"></marker>
<tag>{profile, atom()}</tag>
<item>
- <p>Used together with <seealso marker="prop_bind_address"><c>bind_address</c></seealso>
- and <seealso marker="prop_port"><c>port</c></seealso> to uniquely identify
+ <p>Used together with <seealso marker="#prop_bind_address"><c>bind_address</c></seealso>
+ and <seealso marker="#prop_port"><c>port</c></seealso> to uniquely identify
a HTTP server. This can be useful in a virtualized environment,
where there can
be more that one server that has the same bind_address and port.
If this property is not explicitly set, it is assumed that the
- <seealso marker="prop_bind_address"><c>bind_address</c></seealso> and
- <seealso marker="prop_port"><c>port</c></seealso>uniquely identifies the HTTP server.
+ <seealso marker="#prop_bind_address"><c>bind_address</c></seealso> and
+ <seealso marker="#prop_port"><c>port</c></seealso>uniquely identifies the HTTP server.
</p>
</item>
<marker id="prop_socket_type"></marker>
<tag>{socket_type, ip_comm | {essl, Config::proplist()}}</tag>
<item>
- <p> For ssl configuration options see <seealso marker="ssl:ssl#listen-2">ssl:listen/2</seealso> </p>
- <p>Defaults to <c>ip_comm</c>. </p>
+ <p>For <c>SSL</c> configuration options, see
+ <seealso marker="ssl:ssl#listen-2">ssl:listen/2</seealso>.</p>
+ <p>Default is <c>ip_comm</c>.</p>
</item>
<marker id="prop_ipfamily"></marker>
<tag>{ipfamily, inet | inet6 | inet6fb4}</tag>
<item>
- <p>Defaults to <c>inet6fb4. </c> </p>
- <p>Note that this option is only used when the option
- <c>socket_type</c> has the value <c>ip_comm</c>. </p>
+ <p>This option is only used when option
+ <c>socket_type</c> has value <c>ip_comm</c>.</p>
+ <p>Default is <c>inet6fb4</c>.</p>
</item>
<marker id="prop_minimum_bytes_per_second"></marker>
<tag>{minimum_bytes_per_second, integer()}</tag>
<item>
- <p>If given, sets a minimum bytes per second value for connections.</p>
- <p>If the value is not reached, the socket will close for that connection.</p>
- <p>The option is good for reducing the risk of "slow dos" attacks.</p>
+ <p>If given, sets a minimum of bytes per second value for connections.</p>
+ <p>If the value is unreached, the socket closes for that connection.</p>
+ <p>The option is good for reducing the risk of "slow DoS" attacks.</p>
</item>
</taglist>
<marker id="props_api_modules"></marker>
- <p><em>Erlang Web server API modules</em> </p>
+ <p><em>Erlang Web Server API Modules</em> </p>
<taglist>
<marker id="prop_modules"></marker>
<tag>{modules, [atom()]} </tag>
<item>
- <p>Defines which modules the HTTP server will use to handle
- requests. Defaults to: <c>[mod_alias, mod_auth, mod_esi,
+ <p>Defines which modules the HTTP server uses when handling
+ requests. Default is <c>[mod_alias, mod_auth, mod_esi,
mod_actions, mod_cgi, mod_dir, mod_get, mod_head, mod_log,
- mod_disk_log] </c>
- Note that some mod-modules are dependent on
- others, so the order can not be entirely arbitrary. See the
- <seealso marker="http_server"> Inets Web server Modules in the
- Users guide</seealso> for more information. </p>
+ mod_disk_log]</c>.
+ Notice that some <c>mod</c>-modules are dependent on
+ others, so the order cannot be entirely arbitrary. See the
+ <seealso marker="http_server">Inets Web Server Modules</seealso> in the
+ User's Guide for details.</p>
</item>
</taglist>
@@ -227,412 +227,413 @@
<tag>{customize, atom()}</tag>
<item>
<p>A callback module to customize the inets HTTP servers behaviour
- see <seealso marker="http_custom_api"> httpd_custom_api</seealso> </p>
+ see <seealso marker="httpd_custom_api"> httpd_custom_api</seealso> </p>
</item>
<marker id="prop_disable_chunked_encoding"></marker>
<tag>{disable_chunked_transfer_encoding_send, boolean()}</tag>
<item>
- <p>This property allows you to disable chunked
- transfer-encoding when sending a response to a HTTP/1.1
- client, by default this is false. </p>
+ <p>Allows you to disable chunked
+ transfer-encoding when sending a response to an HTTP/1.1
+ client. Default is <c>false</c>.</p>
</item>
<marker id="prop_keep_alive"></marker>
<tag>{keep_alive, boolean()}</tag>
<item>
- <p>Instructs the server whether or not to use persistent
+ <p>Instructs the server whether to use persistent
connections when the client claims to be HTTP/1.1
- compliant, default is true. </p>
+ compliant. Default is <c>true</c>.</p>
</item>
<marker id="prop_keep_alive_timeout"></marker>
<tag>{keep_alive_timeout, integer()}</tag>
<item>
- <p>The number of seconds the server will wait for a
+ <p>The number of seconds the server waits for a
subsequent request from the client before closing the
- connection. Default is 150. </p>
+ connection. Default is <c>150</c>.</p>
</item>
<marker id="prop_max_body_size"></marker>
<tag>{max_body_size, integer()}</tag>
<item>
- <p>Limits the size of the message body of HTTP request.
- By the default there is no limit. </p>
+ <p>Limits the size of the message body of an HTTP request.
+ Default is no limit.</p>
</item>
<marker id="prop_max_clients"></marker>
<tag>{max_clients, integer()}</tag>
<item>
<p>Limits the number of simultaneous requests that can be
- supported. Defaults to 150. </p>
+ supported. Default is <c>150</c>.</p>
</item>
<marker id="prop_max_header_size"></marker>
<tag>{max_header_size, integer()}</tag>
<item>
- <p>Limits the size of the message header of HTTP request.
- Defaults to 10240. </p>
+ <p>Limits the size of the message header of an HTTP request.
+ Default is <c>10240</c>.</p>
</item>
<marker id="prop_max_content_length"></marker>
<tag>{max_content_length, integer()}</tag>
<item>
- <p>Maximum Content-Length in an incoming request, in bytes. Requests
- with content larger than this are answered with Status 413.
- Defaults to 100000000 (100 MB).
+ <p>Maximum content-length in an incoming request, in bytes. Requests
+ with content larger than this are answered with status 413.
+ Default is <c>100000000</c> (100 MB).
</p>
</item>
<marker id="prop_max_uri"></marker>
<tag>{max_uri_size, integer()}</tag>
<item>
- <p>Limits the size of the HTTP request URI. By
- default there is no limit. </p>
+ <p>Limits the size of the HTTP request URI.
+ Default is no limit.</p>
</item>
<marker id="prop_max_keep_alive_req"></marker>
<tag>{max_keep_alive_request, integer()}</tag>
<item>
- <p>The number of request that a client can do on one
+ <p>The number of requests that a client can do on one
connection. When the server has responded to the number of
- requests defined by max_keep_alive_requests the server close the
- connection. The server will close it even if there are queued
- request. Defaults to no limit. </p>
+ requests defined by <c>max_keep_alive_requests</c>, the server
+ closes the connection. The server closes it even if there are
+ queued request. Default is no limit.</p>
</item>
</taglist>
<marker id="props_admin"></marker>
- <p><em>Administrative properties</em></p>
+ <p><em>Administrative Properties</em></p>
<taglist>
<marker id="prop_mime_types"></marker>
<tag>{mime_types, [{MimeType, Extension}] | path()}</tag>
<item>
- <p>Where MimeType = string() and Extension = string().
+ <p><c>MimeType = string()</c> and <c>Extension = string()</c>.
Files delivered to the client are MIME typed according to RFC
1590. File suffixes are mapped to MIME types before file delivery.
The mapping between file suffixes and MIME types can be specified
- as an Apache like file as well as directly in the property list. Such
- a file may look like:</p>
+ as an Apache-like file or directly in the property list. Such
+ a file can look like the follwoing:</p>
<pre>
# MIME type Extension
text/html html htm
-text/plain asc txt
- </pre>
+text/plain asc txt</pre>
- <p>Defaults to [{"html","text/html"},{"htm","text/html"}]</p>
+ <p>Default is [{"html","text/html"},{"htm","text/html"}].</p>
</item>
<marker id="prop_mime_type"></marker>
<tag>{mime_type, string()}</tag>
<item>
- <p>When the server is asked to provide a document type which
- cannot be determined by the MIME Type Settings, the server will
- use this default type. </p>
+ <p>When the server is asked to provide a document type that
+ cannot be determined by the MIME Type Settings, the server
+ uses this default type.</p>
</item>
<marker id="prop_server_admin"></marker>
<tag>{server_admin, string()}</tag>
<item>
- <p>ServerAdmin defines the email-address of the server
- administrator, to be included in any error messages returned by
- the server. </p>
+ <p>Defines the email-address of the server
+ administrator to be included in any error messages returned by
+ the server.</p>
</item>
<marker id="prop_server_tokens"></marker>
<tag>{server_tokens, none|prod|major|minor|minimal|os|full|{private, string()}}</tag>
<item>
- <p>ServerTokens defines how the value of the server header
- should look. </p>
- <p>Example: Assuming the version of inets is 5.8.1,
- here is what the server header string could look like for
- the different values of server-tokens: </p>
- <pre>
-none "" % A Server: header will not be generated
-prod "inets"
-major "inets/5"
-minor "inets/5.8"
-minimal "inets/5.8.1"
-os "inets/5.8.1 (unix)"
-full "inets/5.8.1 (unix/linux) OTP/R15B"
-{private, "foo/bar"} "foo/bar"
- </pre>
- <p>By default, the value is as before, which is <c>minimal</c>. </p>
+ <p>Defines the look of the value of the server header.</p>
+ <p>Example: Assuming the version of <c>Inets</c> is 5.8.1,
+ the server header string can look as follows for
+ the different values of server-tokens:</p>
+ <taglist>
+ <tag><c>none</c></tag>
+ <item><p>"" % A Server: header will not be generated</p></item>
+ <tag><c>prod</c></tag>
+ <item><p>"inets"</p></item>
+ <tag><c>major</c></tag>
+ <item><p>"inets/5"</p></item>
+ <tag><c>minor</c></tag>
+ <item><p>"inets/5.8"</p></item>
+ <tag><c>minimal</c></tag>
+ <item><p>"inets/5.8.1"</p></item>
+ <tag><c>os</c></tag>
+ <item><p>"inets/5.8.1 (unix)"</p></item>
+ <tag><c>full</c></tag>
+ <item><p>"inets/5.8.1 (unix/linux) OTP/R15B"</p></item>
+ <tag><c>{private, "foo/bar"}</c></tag>
+ <item><p>"foo/bar"</p></item>
+ </taglist>
+ <p>By default, the value is as before, that is, <c>minimal</c>.</p>
</item>
<marker id="prop_log_format"></marker>
<tag>{log_format, common | combined}</tag>
<item>
- <p>Defines if access logs should be written according to the common
- log format or to the extended common log format.
- The <c>common</c> format is one line that looks like this:
- <c>remotehost rfc931 authuser [date] "request" status bytes</c></p>
-
- <pre>
-remotehost
- Remote
-rfc931
- The client's remote username (RFC 931).
-authuser
- The username with which the user authenticated
- himself.
-[date]
- Date and time of the request (RFC 1123).
-"request"
- The request line exactly as it came from the client
- (RFC 1945).
-status
- The HTTP status code returned to the client
- (RFC 1945).
-bytes
- The content-length of the document transferred.
- </pre>
-
- <p>The <c>combined</c> format is on line that look like this:
+ <p>Defines if access logs are to be written according to the <c>common</c>
+ log format or the extended common log format.
+ The <c>common</c> format is one line looking like this:
+ <c>remotehost rfc931 authuser [date] "request" status bytes</c>.</p>
+ <p>Here:</p>
+ <taglist>
+ <tag><c>remotehost</c></tag>
+ <item>Remote.</item>
+ <tag><c>rfc931</c></tag>
+ <item>The remote username of the client (<url href="http://www.ietf.org/rfc/rfc931.txt">RFC 931</url>).</item>
+ <tag><c>authuser</c></tag>
+ <item>The username used for authentication.</item>
+ <tag><c>[date]</c></tag>
+ <item>Date and time of the request (<url href="http://www.ietf.org/rfc/rfc1123.txt">RFC 1123</url>).</item>
+ <tag><c>"request"</c></tag>
+ <item>The request line as it came from the client (<url href="http://www.ietf.org/rfc/rfc1945.txt">RFC 1945</url>).</item>
+ <tag><c>status</c></tag>
+ <item>The HTTP status code returned to the client (<url href="http://www.ietf.org/rfc/rfc1945.txt">RFC 1945</url>).</item>
+ <tag><c>bytes</c></tag>
+ <item>The content-length of the document transferred.</item>
+ </taglist>
+
+ <p>The <c>combined</c> format is one line looking like this:
<c>remotehost rfc931 authuser [date] "request" status bytes "referer" "user_agent" </c></p>
+ <p>In addition to the earlier:</p>
+ <taglist>
+ <tag><c>"referer"</c></tag>
+ <item>The URL the client was on before
+ requesting the URL (if it could not be determined,
+ a minus sign is placed in this field).</item>
+ <tag><c>"user_agent"</c></tag>
+ <item>The software the client claims to be using (if it
+ could not be determined, a minus sign is placed in
+ this field).</item>
+ </taglist>
- <pre>
-"referer"
- The url the client was on before
- requesting your url. (If it could not be determined
- a minus sign will be placed in this field)
-"user_agent"
- The software the client claims to be using. (If it
- could not be determined a minus sign will be placed in
- this field)
- </pre>
-
- <p>This affects the access logs written by mod_log and mod_disk_log.
- </p>
-
+ <p>This affects the access logs written by <c>mod_log</c> and
+ <c>mod_disk_log</c>.
+ </p>
</item>
<marker id="prop_elog_format"></marker>
<tag>{error_log_format, pretty | compact}</tag>
<item>
- <p>Defaults to pretty. If the error log is meant to be read
- directly by a human <c>pretty</c> will be the best
- option. <c>pretty</c> has the format corresponding to:
- </p>
+ <p>Default is <c>pretty</c>. If the error log is meant to be read
+ directly by a human, <c>pretty</c> is the best option.</p>
+ <p><c>pretty</c> has a format corresponding to:</p>
- <code>io:format("[~s] ~s, reason: ~n ~p ~n~n", [Date, Msg, Reason]).
- </code>
+ <code>io:format("[~s] ~s, reason: ~n ~p ~n~n", [Date, Msg, Reason]).</code>
- <p><c>compact</c> has the format corresponding to:</p>
+ <p><c>compact</c> has a format corresponding to:</p>
- <code>io:format("[~s] ~s, reason: ~w ~n", [Date, Msg, Reason]).
- </code>
+ <code>io:format("[~s] ~s, reason: ~w ~n", [Date, Msg, Reason]).</code>
- <p>This affects the error logs written by mod_log and mod_disk_log.
+ <p>This affects the error logs written by <c>mod_log</c> and
+ <c>mod_disk_log</c>.
</p>
</item>
</taglist>
<marker id="props_alias"></marker>
- <p><em>URL aliasing properties - requires mod_alias</em></p>
+ <p><em>URL Aliasing Properties - Requires mod_alias</em></p>
<taglist>
<marker id="prop_alias"></marker>
<tag>{alias, {Alias, RealName}}</tag>
<item>
- <p>Where Alias = string() and RealName = string().
- The Alias property allows documents to be stored in the local file
- system instead of the document_root location. URLs with a path that
- begins with url-path is mapped to local files that begins with
+ <p><c>Alias = string()</c> and <c>RealName = string()</c>.
+ <c>alias</c> allows documents to be stored in the local file
+ system instead of the <c>document_root</c> location. URLs with a path
+ beginning with url-path is mapped to local files beginning with
directory-filename, for example:
<code>{alias, {"/image", "/ftp/pub/image"}}</code>
- and an access to http://your.server.org/image/foo.gif would refer to
- the file /ftp/pub/image/foo.gif. </p>
+ Access to http://your.server.org/image/foo.gif would refer to
+ the file /ftp/pub/image/foo.gif.</p>
</item>
<marker id="prop_re_write"></marker>
<tag>{re_write, {Re, Replacement}}</tag>
<item>
- <p>Where Re = string() and Replacement = string().
- The ReWrite property allows documents to be stored in the local file
- system instead of the document_root location. URLs are rewritten
- by re:replace/3 to produce a path in the local filesystem.
- For example:
+ <p><c>Re = string()</c> and <c>Replacement = string()</c>.
+ <c>re_write</c> allows documents to be stored in the local file
+ system instead of the <c>document_root</c> location. URLs are rewritten
+ by <c>re:replace/3</c> to produce a path in the local file-system,
+ for example:
<code>{re_write, {"^/[~]([^/]+)(.*)$", "/home/\\1/public\\2"}}</code>
- and an access to http://your.server.org/~bob/foo.gif would refer to
+ Access to http://your.server.org/~bob/foo.gif would refer to
the file /home/bob/public/foo.gif.
- In an Apache like configuration file the Re is separated
- from Replacement with one single space, and as expected
- backslashes do not need to be backslash escaped so the
+ In an Apache-like configuration file, <c>Re</c> is separated
+ from <c>Replacement</c> with one single space, and as expected
+ backslashes do not need to be backslash escaped, the
same example would become:
<code>ReWrite ^/[~]([^/]+)(.*)$ /home/\1/public\2</code>
- Beware of trailing space in Replacement that will be used.
- If you must have a space in Re use e.g the character encoding
- <code>\040</code> see <seealso marker="stdlib:re">re(3)</seealso>. </p>
+ Beware of trailing space in <c>Replacement</c> to be used.
+ If you must have a space in <c>Re</c>, use, for example, the character
+ encoding <c>\040</c>, see
+ <seealso marker="stdlib:re">re(3)</seealso>.</p>
</item>
<marker id="prop_dir_idx"></marker>
<tag>{directory_index, [string()]}</tag>
<item>
- <p>DirectoryIndex specifies a list of resources to look for
- if a client requests a directory using a / at the end of the
- directory name. file depicts the name of a file in the
- directory. Several files may be given, in which case the server
- will return the first it finds, for example:
+ <p><c>directory_index</c> specifies a list of resources to look for
+ if a client requests a directory using a <c>/</c> at the end of the
+ directory name. <c>file</c> depicts the name of a file in the
+ directory. Several files can be given, in which case the server
+ returns the first it finds, for example:
<code>{directory_index, ["index.hml", "welcome.html"]}</code>
- and access to http://your.server.org/docs/ would return
+ Access to http://your.server.org/docs/ would return
http://your.server.org/docs/index.html or
- http://your.server.org/docs/welcome.html if index.html do not
- exist. </p>
+ http://your.server.org/docs/welcome.html if index.html does not
+ exist.</p>
</item>
</taglist>
<marker id="props_cgi"></marker>
- <p><em>CGI properties - requires mod_cgi</em></p>
+ <p><em>CGI Properties - Requires mod_cgi</em></p>
<taglist>
<marker id="prop_script_alias"></marker>
<tag>{script_alias, {Alias, RealName}}</tag>
<item>
- <p>Where Alias = string() and RealName = string().
- Has the same behavior as the Alias property, except that
- it also marks the target directory as containing CGI
+ <p><c>Alias = string()</c> and <c>RealName = string()</c>.
+ Have the same behavior as property <c>alias</c>, except that
+ they also mark the target directory as containing CGI
scripts. URLs with a path beginning with url-path are mapped to
scripts beginning with directory-filename, for example:
<code>{script_alias, {"/cgi-bin/", "/web/cgi-bin/"}}</code>
- and an access to http://your.server.org/cgi-bin/foo would cause
- the server to run the script /web/cgi-bin/foo. </p>
+ Access to http://your.server.org/cgi-bin/foo would cause
+ the server to run the script /web/cgi-bin/foo.</p>
</item>
<marker id="prop_script_re_write"></marker>
<tag>{script_re_write, {Re, Replacement}}</tag>
<item>
- <p>Where Re = string() and Replacement = string().
- Has the same behavior as the ReWrite property, except that
- it also marks the target directory as containing CGI
+ <p><c>Re = string()</c> and <c>Replacement = string()</c>.
+ Have the same behavior as property <c>re_write</c>, except that
+ they also mark the target directory as containing CGI
scripts. URLs with a path beginning with url-path are mapped to
scripts beginning with directory-filename, for example:
<code>{script_re_write, {"^/cgi-bin/(\\d+)/", "/web/\\1/cgi-bin/"}}</code>
- and an access to http://your.server.org/cgi-bin/17/foo would cause
- the server to run the script /web/17/cgi-bin/foo. </p>
+ Access to http://your.server.org/cgi-bin/17/foo would cause
+ the server to run the script /web/17/cgi-bin/foo.</p>
</item>
<marker id="prop_script_nocache"></marker>
<tag>{script_nocache, boolean()}</tag>
<item>
- <p>If ScriptNoCache is set to true the HTTP server will by
- default add the header fields necessary to prevent proxies from
- caching the page. Generally this is something you want. Defaults
- to false. </p>
+ <p>If <c>script_nocache</c> is set to <c>true</c>, the HTTP server by
+ default adds the header fields necessary to prevent proxies from
+ caching the page. Generally this is preferred.
+ Default to <c>false</c>.</p>
</item>
<marker id="prop_script_timeout"></marker>
<tag>{script_timeout, integer()}</tag>
<item>
- <p>The time in seconds the web server will wait between each
- chunk of data from the script. If the CGI-script not delivers
- any data before the timeout the connection to the client will be
- closed. Defaults to 15. </p>
+ <p>The time in seconds the web server waits between each
+ chunk of data from the script. If the CGI script does not deliver
+ any data before the timeout, the connection to the client is
+ closed. Default is <c>15</c>.</p>
</item>
<marker id="prop_action"></marker>
<tag>{action, {MimeType, CgiScript}} - requires mod_action</tag>
<item>
- <p>Where MimeType = string() and CgiScript = string().
- Action adds an action, which will activate a cgi-script
- whenever a file of a certain mime-type is requested. It
+ <p><c>MimeType = string()</c> and <c>CgiScript = string()</c>.
+ <c>action</c> adds an action activating a CGI script
+ whenever a file of a certain MIME type is requested. It
propagates the URL and file path of the requested document using
the standard CGI PATH_INFO and PATH_TRANSLATED environment
- variables.
+ variables.</p>
+ <p>Example:</p>
<code>{action, {"text/plain", "/cgi-bin/log_and_deliver_text"}}</code>
- </p>
</item>
<marker id="prop_script"></marker>
<tag>{script, {Method, CgiScript}} - requires mod_action</tag>
<item>
- <p>Where Method = string() and CgiScript = string().
- Script adds an action, which will activate a cgi-script
+ <p><c>Method = string()</c> and <c>CgiScript = string()</c>.
+ <c>script</c> adds an action activating a CGI script
whenever a file is requested using a certain HTTP method. The
- method is either GET or POST as defined in RFC 1945. It
+ method is either GET or POST, as defined in <url href="http://www.ietf.org/rfc/rfc1945.txt">RFC 1945</url>. It
propagates the URL and file path of the requested document using
the standard CGI PATH_INFO and PATH_TRANSLATED environment
- variables.
+ variables.</p>
+ <p>Example:</p>
<code>{script, {"PUT", "/cgi-bin/put"}}</code>
- </p>
</item>
</taglist>
<marker id="props_esi"></marker>
- <p><em>ESI properties - requires mod_esi</em></p>
+ <p><em>ESI Properties - Requires mod_esi</em></p>
<taglist>
<marker id="prop_esi_alias"></marker>
<tag>{erl_script_alias, {URLPath, [AllowedModule]}}</tag>
<item>
- <p>Where URLPath = string() and AllowedModule = atom().
- erl_script_alias marks all URLs matching url-path as erl
+ <p><c>URLPath = string()</c> and <c>AllowedModule = atom()</c>.
+ <c>erl_script_alias</c> marks all URLs matching url-path as erl
scheme scripts. A matching URL is mapped into a specific module
- and function. For example:
+ and function, for example:
- <code>{erl_script_alias, {"/cgi-bin/example", [httpd_example]}}
- </code>
+ <code>{erl_script_alias, {"/cgi-bin/example", [httpd_example]}}</code>
- and a request to
+ A request to
http://your.server.org/cgi-bin/example/httpd_example:yahoo
- would refer to httpd_example:yahoo/3 or, if that did not exist,
+ would refer to httpd_example:yahoo/3 or, if that does not exist,
httpd_example:yahoo/2 and
http://your.server.org/cgi-bin/example/other:yahoo would
- not be allowed to execute. </p>
+ not be allowed to execute.</p>
</item>
<marker id="prop_esi_nocache"></marker>
<tag>{erl_script_nocache, boolean()}</tag>
<item>
- <p>If erl_script_nocache is set to true the server will add
- http header fields that prevents proxies from caching the
- page. This is generally a good idea for dynamic content, since
- the content often vary between each request.
- Defaults to false. </p>
+ <p>If <c>erl_script_nocache</c> is set to <c>true</c>, the server adds
+ HTTP header fields preventing proxies from caching the
+ page. This is generally a good idea for dynamic content, as
+ the content often varies between each request.
+ Default is <c>false</c>.</p>
</item>
<marker id="prop_esi_timeout"></marker>
<tag>{erl_script_timeout, integer()}</tag>
<item>
- <p>If erl_script_timeout sets the time in seconds the server will
- wait between each chunk of data to be delivered through
- mod_esi:deliver/2. Defaults to 15. This is only relevant
- for scripts that uses the erl scheme. </p>
+ <p>If <c>erl_script_timeout</c> sets the time in seconds the server
+ waits between each chunk of data to be delivered through
+ <c>mod_esi:deliver/2</c>. Default is <c>15</c>. This is only relevant
+ for scripts that use the erl scheme.</p>
</item>
<marker id="prop_esi_timeout"></marker>
<tag>{eval_script_alias, {URLPath, [AllowedModule]}}</tag>
<item>
- <p>Where URLPath = string() and AllowedModule = atom().
- Same as erl_script_alias but for scripts
- using the eval scheme. Note that this is only supported
- for backwards compatibility. The eval scheme is deprecated. </p>
+ <p><c>URLPath = string()</c> and <c>AllowedModule = atom()</c>.
+ Same as <c>erl_script_alias</c> but for scripts
+ using the eval scheme. This is only supported
+ for backwards compatibility. The eval scheme is deprecated.</p>
</item>
</taglist>
<marker id="props_log"></marker>
- <p><em>Log properties - requires mod_log</em></p>
+ <p><em>Log Properties - Requires mod_log</em></p>
<taglist>
<marker id="prop_elog"></marker>
<tag>{error_log, path()}</tag>
<item>
<p>Defines the filename of the error log file to be used to log
- server errors. If the filename does not begin with a slash (/)
- it is assumed to be relative to the server_root. </p>
+ server errors. If the filename does not begin with a slash (/),
+ it is assumed to be relative to the <c>server_root</c>.</p>
</item>
<marker id="prop_slog"></marker>
@@ -640,7 +641,7 @@ bytes
<item>
<p>Defines the filename of the access log file to be used to
log security events. If the filename does not begin with a slash
- (/) it is assumed to be relative to the server_root. </p>
+ (/), it is assumed to be relative to the <c>server_root</c>.</p>
</item>
<marker id="prop_tlog"></marker>
@@ -648,270 +649,270 @@ bytes
<item>
<p>Defines the filename of the access log file to be used to
log incoming requests. If the filename does not begin with a
- slash (/) it is assumed to be relative to the server_root. </p>
+ slash (/), it is assumed to be relative to the <c>server_root</c>.</p>
</item>
</taglist>
<marker id="props_dlog"></marker>
- <p><em>Disk Log properties - requires mod_disk_log</em></p>
+ <p><em>Disk Log Properties - Requires mod_disk_log</em></p>
<taglist>
<marker id="prop_dlog_format"></marker>
<tag>{disk_log_format, internal | external}</tag>
<item>
- <p>Defines the file-format of the log files see disk_log for
- more information. If the internal file-format is used, the
- logfile will be repaired after a crash. When a log file is
- repaired data might get lost. When the external file-format is
- used httpd will not start if the log file is broken. Defaults to
- external. </p>
+ <p>Defines the file format of the log files. See <c>disk_log</c> for
+ details. If the internal file format is used, the
+ log file is repaired after a crash. When a log file is
+ repaired, data can disappear. When the external file format is
+ used, <c>httpd</c> does not start if the log file is broken. Default is
+ <c>external</c>.</p>
</item>
<marker id="prop_edlog"></marker>
<tag>{error_disk_log, path()}</tag>
<item>
- <p>Defines the filename of the (disk_log(3)) error log file
+ <p>Defines the filename of the (<c>disk_log(3)</c>) error log file
to be used to log server errors. If the filename does not begin
- with a slash (/) it is assumed to be relative to the server_root. </p>
+ with a slash (/), it is assumed to be relative to the <c>server_root</c>.</p>
</item>
<marker id="prop_edlog_size"></marker>
<tag>{error_disk_log_size, {MaxBytes, MaxFiles}}</tag>
<item>
- <p>Where MaxBytes = integer() and MaxFiles = integer().
- Defines the properties of the (disk_log(3)) error log
- file. The disk_log(3) error log file is of type wrap log and
- max-bytes will be written to each file and max-files will be
- used before the first file is truncated and reused. </p>
+ <p><c>MaxBytes = integer()</c> and <c>MaxFiles = integer()</c>.
+ Defines the properties of the (<c>disk_log(3)</c>) error log
+ file. This file is of type wrap log and
+ max bytes is written to each file and max files is
+ used before the first file is truncated and reused.</p>
</item>
<marker id="prop_sdlog"></marker>
<tag>{security_disk_log, path()}</tag>
<item>
- <p>Defines the filename of the (disk_log(3)) access log file
- which logs incoming security events i.e authenticated
- requests. If the filename does not begin with a slash (/) it
- is assumed to be relative to the server_root. </p>
+ <p>Defines the filename of the (<c>disk_log(3)</c>) access log file
+ logging incoming security events, that is, authenticated
+ requests. If the filename does not begin with a slash (/), it
+ is assumed to be relative to the <c>server_root</c>.</p>
</item>
<marker id="prop_sdlog_size"></marker>
<tag>{security_disk_log_size, {MaxBytes, MaxFiles}}</tag>
<item>
- <p>Where MaxBytes = integer() and MaxFiles = integer().
- Defines the properties of the disk_log(3) access log
- file. The disk_log(3) access log file is of type wrap log and
- max-bytes will be written to each file and max-files will be
- used before the first file is truncated and reused. </p>
+ <p><c>MaxBytes = integer()</c> and <c>MaxFiles = integer()</c>.
+ Defines the properties of the <c>disk_log(3)</c> access log
+ file. This file is of type wrap log and
+ max bytes is written to each file and max files is
+ used before the first file is truncated and reused.</p>
</item>
<marker id="prop_tdlog"></marker>
<tag>{transfer_disk_log, path()}</tag>
<item>
- <p>Defines the filename of the (disk_log(3)) access log file
- which logs incoming requests. If the filename does not begin
- with a slash (/) it is assumed to be relative to the
- server_root. </p>
+ <p>Defines the filename of the (<c>disk_log(3)</c>) access log file
+ logging incoming requests. If the filename does not begin
+ with a slash (/), it is assumed to be relative to the
+ <c>server_root</c>.</p>
</item>
<marker id="prop_tdlog_size"></marker>
<tag>{transfer_disk_log_size, {MaxBytes, MaxFiles}}</tag>
<item>
- <p>Where MaxBytes = integer() and MaxFiles = integer().
- Defines the properties of the disk_log(3) access log
- file. The disk_log(3) access log file is of type wrap log and
- max-bytes will be written to each file and max-files will be
- used before the first file is truncated and reused. </p>
+ <p><c>MaxBytes = integer()</c> and <c>MaxFiles = integer()</c>.
+ Defines the properties of the <c>disk_log(3)</c> access log
+ file. This file is of type wrap log and
+ max bytes is written to each file and max files is
+ used before the first file is truncated and reused.</p>
</item>
</taglist>
<marker id="props_auth"></marker>
- <p><em>Authentication properties - requires mod_auth</em></p>
+ <p><em>Authentication Properties - Requires mod_auth</em></p>
<marker id="prop_dri"></marker>
<p><em>{directory, {path(), [{property(), term()}]}}</em></p>
<marker id="props_dir"></marker>
- <p>Here follows the valid properties for directories </p>
+ <p>The properties for directories are as follows:</p>
<taglist>
<marker id="prop_allow_from"></marker>
- <tag>{allow_from, all | [RegxpHostString]}</tag>
+ <tag>{allow_from, all | [RegxpHostString]}</tag>
<item>
- <p>Defines a set of hosts which should be granted access to a
- given directory.
-
- For example:
+ <p>Defines a set of hosts to be granted access to a
+ given directory, for example:
<code>{allow_from, ["123.34.56.11", "150.100.23"]}</code>
- The host 123.34.56.11 and all machines on the 150.100.23
- subnet are allowed access. </p>
+ The host <c>123.34.56.11</c> and all machines on the <c>150.100.23</c>
+ subnet are allowed access.</p>
</item>
<marker id="prop_deny_from"></marker>
- <tag>{deny_from, all | [RegxpHostString]}</tag>
+ <tag>{deny_from, all | [RegxpHostString]}</tag>
<item>
<p>Defines a set of hosts
- which should be denied access to a given directory.
- For example:
+ to be denied access to a given directory, for example:
<code>{deny_from, ["123.34.56.11", "150.100.23"]}</code>
- The host 123.34.56.11 and all machines on the 150.100.23
- subnet are not allowed access. </p>
+ The host <c>123.34.56.11</c> and all machines on the <c>150.100.23</c>
+ subnet are not allowed access.</p>
</item>
<marker id="prop_auth_type"></marker>
- <tag>{auth_type, plain | dets | mnesia}</tag>
+ <tag>{auth_type, plain | dets | mnesia}</tag>
<item>
<p>Sets the type of authentication database that is used for the
- directory.The key difference between the different methods is
- that dynamic data can be saved when Mnesia and Dets is used.
- This property is called AuthDbType in the Apache like
- configuration files. </p>
+ directory. The key difference between the different methods is
+ that dynamic data can be saved when <c>Mnesia</c> and <c>Dets</c>
+ are used.
+ This property is called <c>AuthDbType</c> in the Apache-like
+ configuration files.</p>
</item>
<marker id="prop_auth_user_file"></marker>
<tag>{auth_user_file, path()}</tag>
<item>
- <p>Sets the name of a file which contains the list of users and
- passwords for user authentication. filename can be either
+ <p>Sets the name of a file containing the list of users and
+ passwords for user authentication. The filename can be either
absolute or relative to the <c>server_root</c>. If using the
- plain storage method, this file is a plain text file, where
- each line contains a user name followed by a colon, followed
- by the non-encrypted password. If user names are duplicated,
- the behavior is undefined. For example:
+ plain storage method, this file is a plain text file where
+ each line contains a username followed by a colon, followed
+ by the non-encrypted password. If usernames are duplicated,
+ the behavior is undefined.</p>
+ <p>Example:</p>
<code> ragnar:s7Xxv7
edward:wwjau8 </code>
- If using the dets storage method, the user database is
- maintained by dets and should not be edited by hand. Use the
- API functions in mod_auth module to create / edit the user
- database. This directive is ignored if using the mnesia
- storage method. For security reasons, make sure that the
- <c>auth_user_file</c> is stored outside the document tree of the Web
- server. If it is placed in the directory which it protects,
- clients will be able to download it. </p>
+ <p>If the <c>Dets</c> storage method is used, the user database is
+ maintained by <c>Dets</c> and must not be edited by hand. Use the
+ API functions in module <c>mod_auth</c> to create/edit the user
+ database. This directive is ignored if the <c>Mnesia</c>
+ storage method is used. For security reasons, ensure that
+ <c>auth_user_file</c> is stored outside the document tree of the web
+ server. If it is placed in the directory that it protects,
+ clients can download it.</p>
</item>
<marker id="prop_auth_group_file"></marker>
<tag>{auth_group_file, path()}</tag>
<item>
- <p>Sets the name of a file which contains the list of user
- groups for user authentication. Filename can be either
- absolute or relative to the <c>server_root</c>. If you use the plain
- storage method, the group file is a plain text file, where
+ <p>Sets the name of a file containing the list of user
+ groups for user authentication. The filename can be either
+ absolute or relative to the <c>server_root</c>. If the plain
+ storage method is used, the group file is a plain text file, where
each line contains a group name followed by a colon, followed
- by the member user names separated by spaces. For example:
+ by the members usernames separated by spaces.</p>
+ <p>Example:</p>
<code>group1: bob joe ante</code>
- If using the dets storage method, the group database is
- maintained by dets and should not be edited by hand. Use the
- API for mod_auth module to create / edit the group database.
- This directive is ignored if using the mnesia storage method.
- For security reasons, make sure that the <c>auth_group_file</c> is
- stored outside the document tree of the Web server. If it is
- placed in the directory which it protects, clients will be
- able to download it. </p>
+ <p>If the <c>Dets</c> storage method is used, the group database is
+ maintained by <c>Dets</c> and must not be edited by hand. Use the
+ API for module <c>mod_auth</c> to create/edit the group database.
+ This directive is ignored if the <c>Mnesia</c> storage method is used.
+ For security reasons, ensure that the <c>auth_group_file</c> is
+ stored outside the document tree of the web server. If it is
+ placed in the directory that it protects, clients
+ can download it.</p>
</item>
<marker id="prop_auth_name"></marker>
<tag>{auth_name, string()}</tag>
<item>
<p>Sets the name of the authorization realm (auth-domain) for
- a directory. This string informs the client about which user
- name and password to use. </p>
+ a directory. This string informs the client about which
+ username and password to use.</p>
</item>
<marker id="prop_auth_access_passwd"></marker>
<tag>{auth_access_password, string()}</tag>
<item>
- <p>If set to other than "NoPassword" the password is required
- for all API calls. If the password is set to "DummyPassword" the
+ <p>If set to other than "NoPassword", the password is required
+ for all API calls. If the password is set to "DummyPassword", the
password must be changed before any other API calls. To secure
- the authenticating data the password must be changed after the
- web server is started since it otherwise is written in clear
- text in the configuration file. </p>
+ the authenticating data, the password must be changed after the
+ web server is started. Otherwise it is written in clear
+ text in the configuration file.</p>
</item>
<marker id="prop_req_user"></marker>
<tag>{require_user, [string()]}</tag>
<item>
- <p>Defines users which should be granted access to a given
- directory using a secret password. </p>
+ <p>Defines users to grant access to a given
+ directory using a secret password.</p>
</item>
<marker id="prop_req_grp"></marker>
<tag>{require_group, [string()]}</tag>
<item>
- <p>Defines users which should be granted access to a given
- directory using a secret password. </p>
+ <p>Defines users to grant access to a given
+ directory using a secret password.</p>
</item>
</taglist>
<marker id="props_htaccess"></marker>
- <p><em>Htaccess authentication properties - requires mod_htaccess</em></p>
+ <p><em>Htaccess Authentication Properties - Requires mod_htaccess</em></p>
<taglist>
<marker id="prop_access_files"></marker>
<tag>{access_files, [path()]}</tag>
<item>
- <p>Specify which filenames that are used for
- access-files. When a request comes every directory in the path
- to the requested asset will be searched after files with the
- names specified by this parameter. If such a file is found the
- file will be parsed and the restrictions specified in it will
- be applied to the request. </p>
+ <p>Specifies the filenames that are used for
+ access files. When a request comes, every directory in the path
+ to the requested asset are searched after files with the
+ names specified by this parameter. If such a file is found, the
+ file is parsed and the restrictions specified in it are
+ applied to the request.</p>
</item>
</taglist>
<marker id="props_sec"></marker>
- <p><em>Security properties - requires mod_security </em></p>
+ <p><em>Security Properties - Requires mod_security</em></p>
<marker id="prop_sec_dir"></marker>
<p><em>{security_directory, {path(), [{property(), term()}]}}</em></p>
<marker id="props_sdir"></marker>
- <p>Here follows the valid properties for security directories</p>
+ <p>The properties for the security directories are as follows:</p>
<taglist>
<marker id="prop_data_file"></marker>
<tag>{data_file, path()}</tag>
<item>
- <p>Name of the security data file. The filename can either
- absolute or relative to the server_root. This file is used to
- store persistent data for the mod_security module. </p>
+ <p>Name of the security data file. The filename can either be
+ absolute or relative to the <c>server_root</c>. This file is used to
+ store persistent data for module <c>mod_security</c>.</p>
</item>
<marker id="prop_max_retries"></marker>
<tag>{max_retries, integer()}</tag>
<item>
- <p>Specifies the maximum number of tries to authenticate a
- user has before the user is blocked out. If a user
- successfully authenticates when the user has been blocked, the
- user will receive a 403 (Forbidden) response from the
- server. If the user makes a failed attempt while blocked the
- server will return 401 (Unauthorized), for security
+ <p>Specifies the maximum number of attempts to authenticate a
+ user before the user is blocked out. If a user
+ successfully authenticates while blocked, the
+ user receives a 403 (Forbidden) response from the
+ server. If the user makes a failed attempt while blocked, the
+ server returns 401 (Unauthorized), for security
reasons.
- Defaults to 3 may also be set to infinity. </p>
+ Default is <c>3</c>. Can be set to infinity.</p>
</item>
<marker id="prop_block_time"></marker>
<tag>{block_time, integer()}</tag>
<item>
<p>Specifies the number of minutes a user is blocked. After
- this amount of time, he automatically regains access.
- Defaults to 60. </p>
+ this timehas passed, the user automatically regains access.
+ Default is <c>60</c>.</p>
</item>
<marker id="prop_fail_exp_time"></marker>
<tag>{fail_expire_time, integer()}</tag>
<item>
<p>Specifies the number of minutes a failed user authentication
- is remembered. If a user authenticates after this amount of
- time, his previous failed authentications are
+ is remembered. If a user authenticates after this
+ time has passed, the previous failed authentications are
forgotten.
- Defaults to 30. </p>
+ Default is <c>30</c>.</p>
</item>
<marker id="prop_auth_timeout"></marker>
@@ -919,43 +920,43 @@ bytes
<item>
Specifies the number of seconds a successful user
authentication is remembered. After this time has passed, the
- authentication will no longer be reported. Defaults to 30.
+ authentication is no longer reported. Default is <c>30</c>.
</item>
</taglist>
</section>
<funcs>
<func>
- <marker id="info1"></marker>
<name>info(Pid) -></name>
<name>info(Pid, Properties) -> [{Option, Value}]</name>
- <fsummary>Fetches information about the HTTP server</fsummary>
+ <fsummary>Fetches information about the HTTP server.</fsummary>
<type>
<v>Properties = [property()]</v>
- <v>Option = property()</v>
+ <v>Option = property()</v>
<v>Value = term()</v>
</type>
<desc>
<p>Fetches information about the HTTP server. When called
- with only the pid all properties are fetched, when called
- with a list of specific properties they are fetched.
- Available properties are the same as the server's start options.
+ with only the pid, all properties are fetched. When called
+ with a list of specific properties, they are fetched.
+ The available properties are the same as the start options
+ of the server.
</p>
- <note><p>Pid is the pid returned from inets:start/[2,3].
- Can also be retrieved form inets:services/0, inets:services_info/0
- see <seealso marker="inets">inets(3)</seealso>
+ <note><p>Pid is the pid returned from <c>inets:start/[2,3]</c>.
+ Can also be retrieved form <c>inets:services/0</c> and
+ <c>inets:services_info/0</c>,
+ see <seealso marker="inets">inets(3)</seealso>.
</p></note>
</desc>
</func>
<func>
- <marker id="info2"></marker>
<name>info(Address, Port) -> </name>
<name>info(Address, Port, Profile) -> </name>
<name>info(Address, Port, Profile, Properties) -> [{Option, Value}] </name>
<name>info(Address, Port, Properties) -> [{Option, Value}] </name>
- <fsummary>Fetches information about the HTTP server</fsummary>
+ <fsummary>Fetches information about the HTTP server.</fsummary>
<type>
<v>Address = ip_address()</v>
<v>Port = integer()</v>
@@ -966,20 +967,19 @@ bytes
</type>
<desc>
<p>Fetches information about the HTTP server. When called with
- only the Address, Port and Profile, if relevant, all properties are fetched.
- When called with a list of specific properties they are fetched.
- Available properties are the same as the server's start
- options.
+ only <c>Address</c> and <c>Port</c>, all properties are
+ fetched. When called with a list of specific properties, they
+ are fetched. The available properties are the same as the
+ start options of the server.
</p>
- <note><p> Address has to be the ip-address and can not be
+ <note><p>The address must be the IP address and cannot be
the hostname.
</p></note>
</desc>
</func>
<func>
- <marker id="reload_config"></marker>
<name>reload_config(Config, Mode) -> ok | {error, Reason}</name>
<fsummary>Reloads the HTTP server configuration without
restarting the server.</fsummary>
@@ -991,24 +991,26 @@ bytes
</type>
<desc>
<p>Reloads the HTTP server configuration without restarting the
- server. Incoming requests will be answered with a temporary
- down message during the time the it takes to reload.</p>
+ server. Incoming requests are answered with a temporary
+ down message during the reload time.</p>
- <note><p>Available properties are the same as the server's
- start options, although the properties bind_address and
- port can not be changed.</p></note>
+ <note><p>Available properties are the same as the
+ start options of the server, but the properties
+ <c>bind_address</c> and <c>port</c>
+ cannot be changed.</p></note>
- <p>If mode is disturbing, the server is blocked forcefully and
- all ongoing requests are terminated and the reload will
- start immediately. If mode is non-disturbing, no new
- connections are accepted, but the ongoing requests are
+ <p>If mode is disturbing, the server is blocked forcefully,
+ all ongoing requests terminates, and the reload
+ starts immediately. If mode is non-disturbing, no new
+ connections are accepted, but ongoing requests are
allowed to complete before the reload is done.</p>
</desc>
</func>
</funcs>
<section>
- <title>ERLANG WEB SERVER API DATA TYPES </title>
+ <title>ERLANG WEB SERVER API DATA TYPES</title>
+ <p>The Erlang web server API data types are as follows:</p>
<code type="none">
ModData = #mod{}
@@ -1025,73 +1027,75 @@ bytes
parsed_header = [],
entity_body,
connection
- }).
- </code>
+ }).</code>
- <p>To acess the record in your callback-module use </p>
- <code> -include_lib("inets/include/httpd.hrl"). </code>
+ <p>To acess the record in your callback-module use:</p>
+ <code> -include_lib("inets/include/httpd.hrl").</code>
- <p>The fields of the <c>mod</c> record has the following meaning:
+ <p>The fields of record <c>mod</c> have the following meaning:
</p>
<taglist>
<tag><c>data</c></tag>
- <item>Type <c>[{InteractionKey,InteractionValue}]</c> is used to
+ <item><p>Type <c>[{InteractionKey,InteractionValue}]</c> is used to
propagate data between modules. Depicted
- <c>interaction_data()</c> in function type declarations.
+ <c>interaction_data()</c> in function type declarations.</p>
</item>
<tag><c>socket_type</c></tag>
- <item><c>socket_type()</c>,
- Indicates whether it is an ip socket or a ssl socket.
+ <item><p><c>socket_type()</c>
+ indicates whether it is an IP socket or an <c>ssl</c> socket.</p>
</item>
<tag><c>socket</c></tag>
- <item>The actual socket in <c>ip_comm</c> or <c>ssl</c> format
- depending on the <c>socket_type</c>.
+ <item><p>The socket, in format <c>ip_comm</c> or <c>ssl</c>,
+ depending on <c>socket_type</c>.</p>
</item>
<tag><c>config_db</c></tag>
- <item>The config file directives stored as key-value tuples in
- an ETS-table. Depicted <c>config_db()</c> in function type
- declarations.
+ <item><p>The config file directives stored as key-value tuples in
+ an ETS table. Depicted <c>config_db()</c> in function type
+ declarations.</p>
</item>
<tag><c>method</c></tag>
- <item>Type <c>"GET" | "POST" | "HEAD" | "TRACE"</c>, that is the
- HTTP method.
+ <item><p>Type <c>"GET" | "POST" | "HEAD" | "TRACE"</c>, that is, the
+ HTTP method.</p>
</item>
<tag><c>absolute_uri</c></tag>
- <item>If the request is a HTTP/1.1
- request the URI might be in the absolute URI format. In that
- case httpd will save the absolute URI in this field. An Example
- of an absolute URI could
- be<c>"http://ServerName:Part/cgi-bin/find.pl?person=jocke"</c></item>
+ <item><p>If the request is an HTTP/1.1
+ request, the URI can be in the absolute URI format. In that
+ case, <c>httpd</c> saves the absolute URI in this field. An Example
+ of an absolute URI is
+ <c>"http://ServerName:Part/cgi-bin/find.pl?person=jocke"</c></p></item>
<tag><c>request_uri</c></tag>
- <item>The <c>Request-URI</c> as defined
- in RFC 1945, for example <c>"/cgi-bin/find.pl?person=jocke"</c></item>
+ <item><p>The <c>Request-URI</c> as defined
+ in <url href="http://www.ietf.org/rfc/rfc1945.txt">RFC 1945</url>, for example, <c>"/cgi-bin/find.pl?person=jocke"</c>.</p>
+ </item>
<tag><c>http_version</c></tag>
- <item>The <c>HTTP</c> version of the
- request, that is "HTTP/0.9", "HTTP/1.0", or "HTTP/1.1".
+ <item><p>The <c>HTTP</c> version of the
+ request, that is, "HTTP/0.9", "HTTP/1.0", or "HTTP/1.1".</p>
</item>
<tag><c>request_line</c></tag>
- <item>The <c>Request-Line</c> as
- defined in RFC 1945, for example <c>"GET /cgi-bin/find.pl?person=jocke HTTP/1.0"</c>.
+ <item><p>The <c>Request-Line</c> as
+ defined in<url href="http://www.ietf.org/rfc/rfc1945.txt">RFC 1945</url>, for example,
+ <c>"GET /cgi-bin/find.pl?person=jocke HTTP/1.0"</c>.</p>
</item>
<tag><c>parsed_header</c></tag>
- <item>Type <c>[{HeaderKey,HeaderValue}]</c>,
+ <item>Type <c>[{HeaderKey,HeaderValue}]</c>.
<c>parsed_header</c> contains all HTTP header fields from the
- HTTP-request stored in a list as key-value tuples. See RFC 2616
- for a listing of all header fields. For example the date field
- would be stored as: <c>{"date","Wed, 15 Oct 1997 14:35:17 GMT"} </c>.
- RFC 2616 defines that HTTP is a case insensitive protocol and
- the header fields may be in lower case or upper case. Httpd will
- ensure that all header field names are in lower case.
+ HTTP request stored in a list as key-value tuples. See
+ <url href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</url>
+ for a listing of all header fields. For example, the date field
+ is stored as <c>{"date","Wed, 15 Oct 1997 14:35:17 GMT"}</c>.
+ RFC 2616 defines that HTTP is a case-insensitive protocol and
+ the header fields can be in lower case or upper case. <c>httpd</c>
+ ensures that all header field names are in lower case.
</item>
<tag><c>entity_body</c></tag>
- <item>The <c>Entity-Body</c> as defined
- in RFC 2616, for example data sent from a CGI-script using the
- POST method.
+ <item><p>The <c>entity-Body</c> as defined
+ in <url href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</url>, for example, data sent from a CGI script using the
+ POST method.</p>
</item>
<tag><c>connection</c></tag>
- <item><c>true | false</c> If set to true the connection to the
- client is a persistent connection and will not be closed when
- the request is served.</item>
+ <item><p><c>true | false</c>. If set to <c>true</c>, the connection to the
+ client is a persistent connection and is not closed when
+ the request is served.</p></item>
</taglist>
</section>
@@ -1100,56 +1104,63 @@ bytes
</section>
<funcs>
<func>
- <marker id="module_do"></marker>
<name>Module:do(ModData)-> {proceed, OldData} | {proceed, NewData} | {break, NewData} | done</name>
- <fsummary>Called for each request to the Web server.</fsummary>
+ <fsummary>Called for each request to the web server.</fsummary>
<type>
<v>OldData = list()</v>
- <v>NewData = [{response,{StatusCode,Body}}] | [{response,{response,Head,Body}}] | [{response,{already_sent,Statuscode,Size}}] </v>
+ <v>NewData = [{response,{StatusCode,Body}}]</v>
+ <v>| [{response,{response,Head,Body}}]</v>
+ <v>| [{response,{already_sent,Statuscode,Size}}]</v>
<v>StatusCode = integer()</v>
<v>Body = io_list() | nobody | {Fun, Arg}</v>
<v>Head = [HeaderOption]</v>
<v>HeaderOption = {Option, Value} | {code, StatusCode}</v>
- <v>Option = accept_ranges | allow | cache_control | content_MD5 | content_encoding | content_language | content_length | content_location | content_range | content_type | date | etag | expires | last_modified | location | pragma | retry_after | server | trailer | transfer_encoding</v>
+ <v>Option = accept_ranges | allow</v>
+ <v>| cache_control | content_MD5</v>
+ <v>| content_encoding | content_language</v>
+ <v>| content_length | content_location</v>
+ <v>| content_range | content_type | date</v>
+ <v>| etag | expires | last_modified</v>
+ <v>| location | pragma | retry_after</v>
+ <v>| server | trailer | transfer_encoding</v>
<v>Value = string()</v>
<v>Fun = fun( Arg ) -> sent| close | Body </v>
<v>Arg = [term()]</v>
</type>
<desc>
- <p>When a valid request reaches httpd it calls <c>do/1</c> in
- each module defined by the Modules configuration
- option. The function may generate data for other modules
- or a response that can be sent back to the client.</p>
- <p>The field <c>data</c> in ModData is a list. This list will be
+ <p>When a valid request reaches <c>httpd</c>, it calls <c>do/1</c> in
+ each module, defined by the configuration
+ option of <c>Module</c>. The function can generate data for other
+ modules or a response that can be sent back to the client.</p>
+ <p>The field <c>data</c> in <c>ModData</c> is a list. This list is
the list returned from the last call to
<c>do/1</c>.</p>
- <p><c>Body</c> is the body of the http-response that will be
- sent back to the client an appropriate header will be
- appended to the message. <c>StatusCode</c> will be the
- status code of the response see RFC2616 for the appropriate
- values.</p>
+ <p><c>Body</c> is the body of the HTTP response that is
+ sent back to the client. An appropriate header is
+ appended to the message. <c>StatusCode</c> is the
+ status code of the response, see
+ <url href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</url>
+ for the appropriate values.</p>
<p><c>Head</c> is a key value list of HTTP header fields. The
- server will construct a HTTP header from this data. See RFC
- 2616 for the appropriate value for each header field. If the
- client is a HTTP/1.0 client then the server will filter the
- list so that only HTTP/1.0 header fields will be sent back
- to the client.</p>
+ server constructs an HTTP header from this data. See <url href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</url> for the appropriate value for each header field. If the
+ client is an HTTP/1.0 client, the server filters the
+ list so that only HTTP/1.0 header fields are sent back
+ to the client.</p>
<p>If <c>Body</c> is returned and equal to <c>{Fun,Arg}</c>,
- the Web server will try <c>apply/2</c> on <c>Fun</c> with
- <c>Arg</c> as argument and expect that the fun either
- returns a list <c>(Body)</c> that is a HTTP-repsonse or the
- atom sent if the HTTP-response is sent back to the
- client. If close is returned from the fun something has gone
- wrong and the server will signal this to the client by
+ the web server tries <c>apply/2</c> on <c>Fun</c> with
+ <c>Arg</c> as argument. The web server expects that the fun either
+ returns a list <c>(Body)</c> that is an HTTP repsonse, or the
+ atom <c>sent</c> if the HTTP response is sent back to the
+ client. If <c>close</c> is returned from the fun, something has gone
+ wrong and the server signals this to the client by
closing the connection.</p>
</desc>
</func>
<func>
- <marker id="module_load"></marker>
- <name>Module:load(Line, AccIn)-> eof | ok | {ok, AccOut} | {ok, AccOut, {Option, Value}} | {ok, AccOut, [{Option, Value}]} | {error, Reason} </name>
- <fsummary>Load is used to convert a line in a Apache like config
- file to a <c>{Option, Value}</c> tuple.</fsummary>
+ <name>Module:load(Line, AccIn)-> eof | ok | {ok, AccOut} | {ok, AccOut, {Option, Value}} | {ok, AccOut, [{Option, Value}]} | {error, Reason}</name>
+ <fsummary>Converts a line in an Apache-like config
+ file to an <c>{Option, Value}</c> tuple.</fsummary>
<type>
<v>Line = string()</v>
<v>AccIn = [{Option, Value}]</v>
@@ -1159,55 +1170,53 @@ bytes
<v>Reason = term()</v>
</type>
<desc>
- <p>Load is used to convert a line in a Apache like
- configuration file to a <c>{Option, Value}</c> tuple. Some
- more complex configuration options such as <c>directory</c>
- and <c>security_directory</c> will create an
- accumulator.This function does only need clauses for the
+ <p>Converts a line in an Apache-like
+ configuration file to an <c>{Option, Value}</c> tuple. Some
+ more complex configuration options, such as <c>directory</c>
+ and <c>security_directory</c>, create an
+ accumulator. This function only needs clauses for the
options implemented by this particular callback module.
</p>
</desc>
</func>
-
+
<func>
- <marker id="module_store"></marker>
- <name>Module:store({Option, Value}, Config)-> {ok, {Option, NewValue}} | {error, Reason} </name>
- <fsummary></fsummary>
+ <name>Module:remove(ConfigDB) -> ok | {error, Reason} </name>
+ <fsummary>Callback function that is called when the web server is closed.</fsummary>
+ <type>
+ <v>ConfigDB = ets_table()</v>
+ <v>Reason = term()</v>
+ </type>
+ <desc>
+ <p>When <c>httpd</c> is shut down, it tries to execute
+ <c>remove/1</c> in each Erlang web server callback module. The
+ programmer can use this function to clean up resources
+ created in the store function.</p>
+ </desc>
+ </func>
+
+ <func>
+ <name>Module:store({Option, Value}, Config)-> {ok, {Option, NewValue}} | {error, Reason}</name>
+ <fsummary>Checks the validity of the configuration options.</fsummary>
<type>
<v>Line = string()</v>
<v>Option = property()</v>
<v>Config = [{Option, Value}]</v>
- <v>Value = term() </v>
+ <v>Value = term()</v>
<v>Reason = term()</v>
</type>
<desc>
- <p>This function is used to check the validity of the
+ <p>Checks the validity of the
configuration options before saving them in the internal
- database. This function may also have a side effect
- e.i. setup necessary extra resources implied by the
+ database. This function can also have a side effect,
+ that is, setup of necessary extra resources implied by the
configuration option. It can also
resolve possible dependencies among
configuration options by changing the value of the option.
- This function does only need clauses for the options
+ This function only needs clauses for the options
implemented by this particular callback module.</p>
</desc>
</func>
-
- <func>
- <marker id="module_remove"></marker>
- <name>Module:remove(ConfigDB) -> ok | {error, Reason} </name>
- <fsummary>Callback function that is called when the Web server is closed.</fsummary>
- <type>
- <v>ConfigDB = ets_table()</v>
- <v>Reason = term()</v>
- </type>
- <desc>
- <p>When httpd is shutdown it will try to execute
- <c>remove/1</c> in each Erlang web server callback module. The
- programmer may use this function to clean up resources
- that may have been created in the store function.</p>
- </desc>
- </func>
</funcs>
<section>
@@ -1215,9 +1224,8 @@ bytes
</section>
<funcs>
<func>
- <marker id="parse_query"></marker>
- <name>parse_query(QueryString) -> [{Key,Value}]</name>
- <fsummary>Parse incoming data to <c>erl </c>and <c>eval </c>scripts.</fsummary>
+ <name>parse_query(QueryString) -> [{Key,Value}]</name>
+ <fsummary>Parses incoming data to <c>erl</c> and <c>eval</c> scripts.</fsummary>
<type>
<v>QueryString = string()</v>
<v>Key = string()</v>
@@ -1225,8 +1233,9 @@ bytes
</type>
<desc>
<p><c>parse_query/1</c> parses incoming data to <c>erl</c> and
- <c>eval</c> scripts (See <seealso marker="mod_esi">mod_esi(3)</seealso>) as defined in the standard
- URL format, that is '+' becomes 'space' and decoding of
+ <c>eval</c> scripts (see <seealso marker="mod_esi">mod_esi(3)</seealso>)
+ as defined in the standard
+ URL format, that is, '+' becomes 'space' and decoding of
hexadecimal characters (<c>%xx</c>).</p>
</desc>
</func>
@@ -1234,8 +1243,9 @@ bytes
<section>
<title>SEE ALSO</title>
- <p>RFC 2616, <seealso marker="inets">inets(3)</seealso>,
- <seealso marker="ssl:ssl">ssl(3)</seealso>
+ <p><url href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</url>,
+ <seealso marker="inets">inets(3)</seealso>,
+ <seealso marker="ssl:ssl">ssl(3)</seealso>
</p>
</section>
diff --git a/lib/inets/doc/src/httpd_conf.xml b/lib/inets/doc/src/httpd_conf.xml
deleted file mode 100644
index 54a5885eb4..0000000000
--- a/lib/inets/doc/src/httpd_conf.xml
+++ /dev/null
@@ -1,163 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE erlref SYSTEM "erlref.dtd">
-
-<erlref>
- <header>
- <copyright>
- <year>1997</year><year>2013</year>
- <holder>Ericsson AB. All Rights Reserved.</holder>
- </copyright>
- <legalnotice>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- </legalnotice>
-
- <title>httpd_conf</title>
- <prepared>Joakim Greben&ouml;</prepared>
- <docno></docno>
- <date>1997-10-14</date>
- <rev>2.2</rev>
- <file>httpd_conf.sgml</file>
- </header>
- <module>httpd_conf</module>
- <modulesummary>Configuration utility functions to be used by the Erlang
- Web server API programmer.</modulesummary>
- <description>
- <p>This module provides the Erlang Webserver API programmer with
- utility functions for adding run-time configuration directives.</p>
-
- <marker id="check_enum"></marker>
- </description>
-
- <funcs>
- <func>
- <name>check_enum(EnumString, ValidEnumStrings) -> Result</name>
- <fsummary>Check if string is a valid enumeration.</fsummary>
- <type>
- <v>EnumString = string()</v>
- <v>ValidEnumStrings = [string()]</v>
- <v>Result = {ok,atom()} | {error,not_valid}</v>
- </type>
- <desc>
- <marker id="check_enum"></marker>
- <p><c>check_enum/2</c> checks if <c>EnumString</c> is a valid
- enumeration of <c>ValidEnumStrings</c> in which case it is
- returned as an atom.</p>
-
- <marker id="clean"></marker>
- </desc>
- </func>
-
- <func>
- <name>clean(String) -> Stripped</name>
- <fsummary>Remove leading and/or trailing white spaces.</fsummary>
- <type>
- <v>String = Stripped = string()</v>
- </type>
- <desc>
- <marker id="clean"></marker>
- <p><c>clean/1</c> removes leading and/or trailing white spaces
- from <c>String</c>.</p>
-
- <marker id="custom_clean"></marker>
- </desc>
- </func>
-
- <func>
- <name>custom_clean(String,Before,After) -> Stripped</name>
- <fsummary>Remove leading and/or trailing white spaces and custom characters.</fsummary>
- <type>
- <v>Before = After = regexp()</v>
- <v>String = Stripped = string()</v>
- </type>
- <desc>
- <marker id="custom_clean"></marker>
- <p><c>custom_clean/3</c> removes leading and/or trailing white
- spaces and custom characters from <c>String</c>. <c>Before</c>
- and <c>After</c> are regular expressions, as defined in
- <c>regexp(3)</c>, describing the custom characters.</p>
-
- <marker id="is_directory"></marker>
- </desc>
- </func>
-
- <func>
- <name>is_directory(FilePath) -> Result</name>
- <fsummary>Check if a file path is a directory.</fsummary>
- <type>
- <v>FilePath = string()</v>
- <v>Result = {ok,Directory} | {error,Reason}</v>
- <v>Directory = string()</v>
- <v>Reason = string() | enoent | eacces | enotdir | FileInfo</v>
- <v>FileInfo = File info record</v>
- </type>
- <desc>
- <marker id="is_directory"></marker>
- <p><c>is_directory/1</c> checks if <c>FilePath</c> is a
- directory in which case it is returned. Please read
- <c>file(3)</c> for a description of <c>enoent</c>,
- <c>eacces</c> and <c>enotdir</c>. The definition of
- the file info record can be found by including <c>file.hrl</c>
- from the kernel application, see file(3).</p>
-
- <marker id="is_file"></marker>
- </desc>
- </func>
-
- <func>
- <name>is_file(FilePath) -> Result</name>
- <fsummary>Check if a file path is a regular file.</fsummary>
- <type>
- <v>FilePath = string()</v>
- <v>Result = {ok,File} | {error,Reason}</v>
- <v>File = string()</v>
- <v>Reason = string() | enoent | eacces | enotdir | FileInfo</v>
- <v>FileInfo = File info record</v>
- </type>
- <desc>
- <marker id="is_file"></marker>
- <p><c>is_file/1</c> checks if <c>FilePath</c> is a regular
- file in which case it is returned. Read <c>file(3)</c> for a
- description of <c>enoent</c>, <c>eacces</c> and
- <c>enotdir</c>. The definition of the file info record can be
- found by including <c>file.hrl</c> from the kernel application,
- see file(3).</p>
-
- <marker id="make_integer"></marker>
- </desc>
- </func>
-
- <func>
- <name>make_integer(String) -> Result</name>
- <fsummary>Return an integer representation of a string.</fsummary>
- <type>
- <v>String = string()</v>
- <v>Result = {ok,integer()} | {error,nomatch}</v>
- </type>
- <desc>
- <marker id="make_integer"></marker>
- <p><c>make_integer/1</c> returns an integer representation of
- <c>String</c>.</p>
- </desc>
- </func>
- </funcs>
-
- <section>
- <marker id="see_also"></marker>
- <title>SEE ALSO</title>
- <p><seealso marker="httpd">httpd(3)</seealso></p>
- </section>
-
-</erlref>
-
-
diff --git a/lib/inets/doc/src/httpd_custom_api.xml b/lib/inets/doc/src/httpd_custom_api.xml
index 5840641b37..d2e5441895 100644
--- a/lib/inets/doc/src/httpd_custom_api.xml
+++ b/lib/inets/doc/src/httpd_custom_api.xml
@@ -29,10 +29,24 @@
<modulesummary>Behaviour with optional callbacks to customize the inets HTTP server.</modulesummary>
<description>
<p> The module implementing this behaviour shall be supplied to to the servers
- configuration with the option <seealso marker="httpd:prop_customize"> customize</seealso></p>
+ configuration with the option <seealso marker="httpd#prop_customize"> customize</seealso></p>
</description>
<funcs>
+ <func>
+ <name>response_default_headers() -> [Header] </name>
+ <fsummary>Provide default headers for the HTTP servers responses.</fsummary>
+ <type>
+ <v>Header = {HeaderName :: string(), HeaderValue::string()}</v>
+ <d>string:to_lower/1 will be performed on the HeaderName</d>
+ </type>
+ <desc>
+ <p>Provide default headers for the HTTP servers responses. Note that this
+ option may override built-in defaults.
+ </p>
+ </desc>
+ </func>
+
<func>
<name>response_header({HeaderName, HeaderValue}) -> {true, Header} | false </name>
<fsummary>Filter and possible alter HTTP response headers.</fsummary>
diff --git a/lib/inets/doc/src/httpd_socket.xml b/lib/inets/doc/src/httpd_socket.xml
index c0368c2b39..f71dac90b2 100644
--- a/lib/inets/doc/src/httpd_socket.xml
+++ b/lib/inets/doc/src/httpd_socket.xml
@@ -31,12 +31,12 @@
</header>
<module>httpd_socket</module>
<modulesummary>Communication utility functions to be used by the Erlang
- Web server API programmer.</modulesummary>
+ web server API programmer.</modulesummary>
<description>
- <p>This module provides the Erlang Web server API module programmer
+ <p>This module provides the Erlang web server API module programmer
with utility functions for generic sockets communication. The
appropriate communication mechanism is transparently used, that
- is <c>ip_comm</c> or <c>ssl</c>.</p>
+ is, <c>ip_comm</c> or <c>ssl</c>.</p>
<marker id="deliver"></marker>
</description>
@@ -44,7 +44,7 @@
<funcs>
<func>
<name>deliver(SocketType, Socket, Data) -> Result</name>
- <fsummary>Send binary data over socket.</fsummary>
+ <fsummary>Sends binary data over socket.</fsummary>
<type>
<v>SocketType = socket_type()</v>
<v>Socket = socket()</v>
@@ -53,10 +53,10 @@
</type>
<desc>
<marker id="deliver"></marker>
- <p><c>deliver/3</c> sends the <c>Binary</c> over the
- <c>Socket</c> using the specified <c>SocketType</c>. Socket
- and SocketType should be the socket and the socket_type form
- the mod record as defined in httpd.hrl</p>
+ <p><c>deliver/3</c> sends <c>Data</c> over
+ <c>Socket</c> using the specified <c>SocketType</c>. <c>Socket</c>
+ and <c>SocketType</c> is to be the socket and the <c>socket_type</c>
+ form the <c>mod</c> record as defined in <c>httpd.hrl</c></p>
<marker id="peername"></marker>
</desc>
@@ -64,7 +64,7 @@
<func>
<name>peername(SocketType,Socket) -> {Port,IPAddress}</name>
- <fsummary>Return the port and IP-address of the remote socket.</fsummary>
+ <fsummary>Returns the port and IP address of the remote socket.</fsummary>
<type>
<v>SocketType = socket_type()</v>
<v>Socket = socket()</v>
@@ -73,8 +73,8 @@
</type>
<desc>
<marker id="peername"></marker>
- <p><c>peername/3</c> returns the <c>Port</c> and
- <c>IPAddress</c> of the remote <c>Socket</c>. </p>
+ <p><c>peername/2</c> returns the <c>Port</c> and
+ <c>IPAddress</c> of the remote <c>Socket</c>.</p>
<marker id="resolve"></marker>
</desc>
@@ -82,7 +82,7 @@
<func>
<name>resolve() -> HostName</name>
- <fsummary>Return the official name of the current host.</fsummary>
+ <fsummary>Returns the official name of the current host.</fsummary>
<type>
<v>HostName = string()</v>
</type>
diff --git a/lib/inets/doc/src/httpd_util.xml b/lib/inets/doc/src/httpd_util.xml
index a48e141368..0f498ba2fc 100644
--- a/lib/inets/doc/src/httpd_util.xml
+++ b/lib/inets/doc/src/httpd_util.xml
@@ -30,9 +30,10 @@
<file>httpd_util.sgml</file>
</header>
<module>httpd_util</module>
- <modulesummary>Miscellaneous utility functions to be used when implementing Erlang Web server API modules.</modulesummary>
+ <modulesummary>Miscellaneous utility functions to be used when implementing
+ Erlang web server API modules.</modulesummary>
<description>
- <p>This module provides the Erlang Web Server API module
+ <p>This module provides the Erlang web server API module
programmer with miscellaneous utility functions.</p>
<marker id="convert_request_date"></marker>
@@ -41,7 +42,7 @@
<funcs>
<func>
<name>convert_request_date(DateString) -> ErlDate|bad_date</name>
- <fsummary>Convert The the date to the Erlang date format.</fsummary>
+ <fsummary>Converts the date to the Erlang date format.</fsummary>
<type>
<v>DateString = string()</v>
<v>ErlDate = {{Year,Month,Date},{Hour,Min,Sec}}</v>
@@ -49,10 +50,9 @@
</type>
<desc>
<p><c>convert_request_date/1</c> converts <c>DateString</c> to
- the Erlang date format. DateString must be in one of the three
- date formats that is defined in the RFC 2616.</p>
-
- <marker id="create_etag"></marker>
+ the Erlang date format. <c>DateString</c> must be in one of the
+ three date formats defined in
+ <url href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</url>.</p>
</desc>
</func>
@@ -64,128 +64,84 @@
<v>Etag = string()</v>
</type>
<desc>
- <p><c>create_etag/1</c> calculates the Etag for a file, from its
- size and time for last modification. fileinfo is a record defined
- in <c>kernel/include/file.hrl</c></p>
-
- <marker id="decode_hex"></marker>
+ <p><c>create_etag/1</c> calculates the Etag for a file from its
+ size and time for last modification. <c>FileInfo</c> is a record defined
+ in <c>kernel/include/file.hrl</c>.</p>
</desc>
</func>
-
- <func>
- <name>decode_hex(HexValue) -> DecValue</name>
- <fsummary>Convert a hex value into its decimal equivalent.</fsummary>
- <type>
- <v>HexValue = DecValue = string()</v>
- </type>
- <desc>
- <p>Converts the hexadecimal value <c>HexValue</c> into its
- decimal equivalent (<c>DecValue</c>).</p>
-
- <marker id="day"></marker>
- </desc>
- </func>
-
+
<func>
<name>day(NthDayOfWeek) -> DayOfWeek</name>
- <fsummary>Convert the day of the week (integer [1-7]) to an abbreviated string.</fsummary>
+ <fsummary>Converts the day of the week
+ (integer [1-7]) to an abbreviated string.</fsummary>
<type>
<v>NthDayOfWeek = 1-7</v>
<v>DayOfWeek = string()</v>
</type>
<desc>
- <marker id="day"></marker>
<p><c>day/1</c> converts the day of the week
- (<c>NthDayOfWeek</c>) as an integer (1-7) to an abbreviated
- string, that is: </p>
+ (<c>NthDayOfWeek</c>) from an integer (1-7) to an abbreviated
+ string, that is:</p>
<p>1 = "Mon", 2 = "Tue", ..., 7 = "Sat".</p>
-
- <marker id="flatlength"></marker>
</desc>
</func>
<func>
- <name>flatlength(NestedList) -> Size</name>
- <fsummary>Compute the size of a possibly nested list.</fsummary>
+ <name>decode_hex(HexValue) -> DecValue</name>
+ <fsummary>Converts a hexadecimal value into its decimal equivalent.</fsummary>
<type>
- <v>NestedList = list()</v>
- <v>Size = integer()</v>
+ <v>HexValue = DecValue = string()</v>
</type>
<desc>
- <marker id="flatlength"></marker>
- <p><c>flatlength/1</c> computes the size of the possibly nested
- list <c>NestedList</c>. Which may contain binaries.</p>
-
- <marker id="hexlist_to_integer"></marker>
+ <p>Converts the hexadecimal value <c>HexValue</c> into its
+ decimal equivalent (<c>DecValue</c>).</p>
</desc>
</func>
-
-<!--
+
<func>
- <name>header(StatusCode,PersistentConn)</name>
- <name>header(StatusCode,Date)</name>
- <name>header(StatusCode,MimeType,Date)</name>
- <name>header(StatusCode,MimeType,PersistentConn,Date) -> HTTPHeader</name>
- <fsummary>Generate a HTTP 1.1 header.</fsummary>
+ <name>flatlength(NestedList) -> Size</name>
+ <fsummary>Computes the size of a possibly nested list.</fsummary>
<type>
- <v>StatusCode = integer()</v>
- <v>Date = rfc1123_date()</v>
- <v>MimeType = string()</v>
- <v>PersistentConn = true | false</v>
+ <v>NestedList = list()</v>
+ <v>Size = integer()</v>
</type>
<desc>
- <marker id="header"></marker>
- <p><c>header</c> returns a HTTP 1.1 header string. The
- <c>StatusCode</c> is one of the status codes defined in RFC
- 2616 and the <c>Date</c> string is RFC 1123
- compliant. (See <seealso marker="#rfc1123_date">rfc1123_date/0</seealso>).
- </p>
- <p>Note that the two version of <c>header/n</c> that does not
- has a <c>PersistentConn</c> argument is there only for
- backward compatibility, and must not be used in new Erlang
- Webserver API modules. that will support persistent
- connections.</p>
-
- <marker id="hexlist_to_integer"></marker>
+ <p><c>flatlength/1</c> computes the size of the possibly nested
+ list <c>NestedList</c>, which can contain binaries.</p>
</desc>
</func>
--->
<func>
<name>hexlist_to_integer(HexString) -> Number</name>
- <fsummary>Convert a hexadecimal string to an integer.</fsummary>
+ <fsummary>Converts a hexadecimal string to an integer.</fsummary>
<type>
<v>Number = integer()</v>
<v>HexString = string()</v>
</type>
<desc>
- <p><c>hexlist_to_integer</c> Convert the Hexadecimal value of
- HexString to an integer.</p>
-
- <marker id="integer_to_hexlist"></marker>
+ <p><c>hexlist_to_integer</c> converts the hexadecimal value of
+ <c>HexString</c> to an integer.</p>
</desc>
</func>
<func>
<name>integer_to_hexlist(Number) -> HexString</name>
- <fsummary>Convert an integer to a hexadecimal string.</fsummary>
+ <fsummary>Converts an integer to a hexadecimal string.</fsummary>
<type>
<v>Number = integer()</v>
<v>HexString = string()</v>
</type>
<desc>
- <marker id="integer_to_hexlist"></marker>
- <p><c>integer_to_hexlist/1</c> Returns a string that represents
- the Number in a Hexadecimal form.</p>
-
- <marker id="lookup"></marker>
+ <p><c>integer_to_hexlist/1</c> returns a string representing
+ <c>Number</c> in a hexadecimal form.</p>
</desc>
</func>
<func>
<name>lookup(ETSTable,Key) -> Result</name>
<name>lookup(ETSTable,Key,Undefined) -> Result</name>
- <fsummary>Extract the first value associated with a key in an ETS table.</fsummary>
+ <fsummary>Extracts the first value associated with a <c>Key</c>
+ in an ETS table.</fsummary>
<type>
<v>ETSTable = ets_table()</v>
<v>Key = term()</v>
@@ -195,20 +151,18 @@
<desc>
<p><c>lookup</c> extracts <c>{Key,Value}</c> tuples from
<c>ETSTable</c> and returns the <c>Value</c> associated
- with <c>Key</c>. If <c>ETSTable</c> is of type <c>bag</c>
+ with <c>Key</c>. If <c>ETSTable</c> is of type <c>bag</c>,
only the first <c>Value</c> associated with <c>Key</c> is
returned. <c>lookup/2</c> returns <c>undefined</c> and
<c>lookup/3</c> returns <c>Undefined</c> if no <c>Value</c>
is found.</p>
-
- <marker id="lookup_mime"></marker>
</desc>
</func>
<func>
<name>lookup_mime(ConfigDB,Suffix)</name>
<name>lookup_mime(ConfigDB,Suffix,Undefined) -> MimeType</name>
- <fsummary>Return the mime type associated with a specific file suffix. </fsummary>
+ <fsummary>Returns the MIME type associated with a specific file suffix.</fsummary>
<type>
<v>ConfigDB = ets_table()</v>
<v>Suffix = string()</v>
@@ -216,20 +170,19 @@
<v>Undefined = term()</v>
</type>
<desc>
- <marker id="lookup_mime"></marker>
- <p><c>lookup_mime</c> returns the mime type associated with a
- specific file suffix as specified in the <c>mime.types</c>
- file (located in the
- <path unix="$SERVER_ROOT/conf/mime.types" windows="%SERVER_ROOT%\conf\mime.types">config directory</path>).</p>
-
- <marker id="lookup_mime_default"></marker>
+ <p><c>lookup_mime</c> returns the MIME type associated with a
+ specific file suffix as specified in the file <c>mime.types</c>
+ (located in the
+ <path unix="$SERVER_ROOT/conf/mime.types" windows="%SERVER_ROOT%\conf\mime.types">
+ config directory</path>).</p>
</desc>
</func>
<func>
<name>lookup_mime_default(ConfigDB,Suffix)</name>
<name>lookup_mime_default(ConfigDB,Suffix,Undefined) -> MimeType</name>
- <fsummary>Return the mime type associated with a specific file suffix or the value of the DefaultType.</fsummary>
+ <fsummary>Returns the MIME type associated with a specific file suffix
+ or the value of the DefaultType.</fsummary>
<type>
<v>ConfigDB = ets_table()</v>
<v>Suffix = string()</v>
@@ -237,22 +190,19 @@
<v>Undefined = term()</v>
</type>
<desc>
- <marker id="lookup_mime_default"></marker>
- <p><c>lookup_mime_default</c> returns the mime type associated
+ <p><c>lookup_mime_default</c> returns the MIME type associated
with a specific file suffix as specified in the
<c>mime.types</c> file (located in the
- <path unix="$SERVER_ROOT/conf/mime.types" windows="%SERVER_ROOT%\conf\mime.types">config directory</path>).
- If no appropriate association can be found
- the value of DefaultType is
+ <path unix="$SERVER_ROOT/conf/mime.types" windows="%SERVER_ROOT%\conf\mime.types">
+ config directory</path>).
+ If no appropriate association is found, the value of <c>DefaultType</c> is
returned.</p>
-
- <marker id="message"></marker>
</desc>
</func>
<func>
<name>message(StatusCode,PhraseArgs,ConfigDB) -> Message</name>
- <fsummary>Return an informative HTTP 1.1 status string in HTML.</fsummary>
+ <fsummary>Returns an informative HTTP 1.1 status string in HTML.</fsummary>
<type>
<v>StatusCode = 301 | 400 | 403 | 404 | 500 | 501 | 504</v>
<v>PhraseArgs = term()</v>
@@ -260,53 +210,48 @@
<v>Message = string()</v>
</type>
<desc>
- <marker id="message"></marker>
<p><c>message/3</c> returns an informative HTTP 1.1 status
string in HTML. Each <c>StatusCode</c> requires a specific
<c>PhraseArgs</c>:
</p>
<taglist>
<tag><c>301</c></tag>
- <item><c>string()</c>: A URL pointing at the new document
- position.</item>
+ <item><p><c>string()</c>: A URL pointing at the new document
+ position.</p></item>
<tag><c>400 | 401 | 500</c></tag>
- <item><c>none</c> (No <c>PhraseArgs</c>)</item>
+ <item><p><c>none</c> (no <c>PhraseArgs</c>).</p></item>
<tag><c>403 | 404</c></tag>
- <item><c>string()</c>: A <c>Request-URI</c> as described in
- RFC 2616.</item>
+ <item><p><c>string()</c>: A <c>Request-URI</c> as described in
+ <url href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</url>.</p>
+ </item>
<tag><c>501</c></tag>
- <item><c>{Method,RequestURI,HTTPVersion}</c>: The HTTP
- <c>Method</c>, <c>Request-URI</c> and <c>HTTP-Version</c>
- as defined in RFC 2616.</item>
+ <item><p><c>{Method,RequestURI,HTTPVersion}</c>: The HTTP
+ <c>Method</c>, <c>Request-URI</c>, and <c>HTTP-Version</c>
+ as defined in RFC 2616.</p></item>
<tag><c>504</c></tag>
- <item><c>string()</c>: A string describing why the service
- was unavailable.</item>
+ <item><p><c>string()</c>: A string describing why the service
+ was unavailable.</p></item>
</taglist>
-
- <marker id="month"></marker>
</desc>
</func>
<func>
<name>month(NthMonth) -> Month</name>
- <fsummary>Convert the month as an integer (1-12) to an abbreviated string.</fsummary>
+ <fsummary>Converts the month as an integer (1-12) to an abbreviated string.</fsummary>
<type>
<v>NthMonth = 1-12</v>
<v>Month = string()</v>
</type>
<desc>
- <marker id="month"></marker>
<p><c>month/1</c> converts the month <c>NthMonth</c> as an
integer (1-12) to an abbreviated string, that is: </p>
<p>1 = "Jan", 2 = "Feb", ..., 12 = "Dec".</p>
-
- <marker id="multi_lookup"></marker>
</desc>
</func>
<func>
<name>multi_lookup(ETSTable,Key) -> Result</name>
- <fsummary>Extract the values associated with a key in a ETS table.</fsummary>
+ <fsummary>Extracts the values associated with a key in an ETS table.</fsummary>
<type>
<v>ETSTable = ets_table()</v>
<v>Key = term()</v>
@@ -314,49 +259,44 @@
</type>
<desc>
<p><c>multi_lookup</c> extracts all <c>{Key,Value}</c> tuples
- from an <c>ETSTable</c> and returns <em>all</em><c>Values</c> associated with the <c>Key</c> in a list.</p>
-
- <marker id="reason phrase"></marker>
+ from an <c>ETSTable</c> and returns <em>all</em> <c>Values</c>
+ associated with <c>Key</c> in a list.</p>
</desc>
</func>
<func>
<name>reason_phrase(StatusCode) -> Description</name>
- <fsummary>Return the description of an HTTP 1.1 status code.</fsummary>
+ <fsummary>Returns the description of an HTTP 1.1 status code.</fsummary>
<type>
- <v>StatusCode = 100| 200 | 201 | 202 | 204 | 205 | 206 | 300 | 301 | 302 | 303 | 304 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 410 411 | 412 | 413 | 414 415 | 416 | 417 | 500 | 501 | 502 | 503 | 504 | 505</v>
+ <v>StatusCode = 100| 200 | 201 | 202 | 204 | 205 | 206 | 300 | 301 | 302 | 303 | 304 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 410 411 | 412 | 413 | 414 415 | 416 | 417 | 500 | 501 | 502 | 503 | 504 | 505</v>
<v>Description = string()</v>
</type>
<desc>
- <p><c>reason_phrase</c> returns the <c>Description</c> of an
- HTTP 1.1 <c>StatusCode</c>, for example 200 is "OK" and 201
- is "Created". Read RFC 2616 for further information.</p>
-
- <marker id="rfc1123_date"></marker>
+ <p><c>reason_phrase</c> returns <c>Description</c> of an
+ HTTP 1.1 <c>StatusCode</c>, for example, 200 is "OK" and 201
+ is "Created". For more information, see
+ <url href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</url>.</p>
</desc>
</func>
<func>
<name>rfc1123_date() -> RFC1123Date</name>
<name>rfc1123_date({{YYYY,MM,DD},{Hour,Min,Sec}}) -> RFC1123Date</name>
- <fsummary>Return the current date in RFC 1123 format.</fsummary>
+ <fsummary>Returns the current date in RFC 1123 format.</fsummary>
<type>
<v>YYYY = MM = DD = Hour = Min = Sec = integer()</v>
<v>RFC1123Date = string()</v>
</type>
<desc>
- <marker id="rfc1123_date"></marker>
<p><c>rfc1123_date/0</c> returns the current date in RFC 1123
format. <c>rfc_date/1</c> converts the date in the Erlang format
to the RFC 1123 date format.</p>
-
- <marker id="split"></marker>
</desc>
</func>
<func>
<name>split(String,RegExp,N) -> SplitRes</name>
- <fsummary>Split a string in N chunks using a regular expression.</fsummary>
+ <fsummary>Splits a string in N chunks using a regular expression.</fsummary>
<type>
<v>String = RegExp = string()</v>
<v>SplitRes = {ok, FieldList} | {error, errordesc()}</v>
@@ -364,96 +304,86 @@
<v>N = integer</v>
</type>
<desc>
- <marker id="split"></marker>
- <p><c>split/3</c> splits the <c>String</c> in <c>N</c> chunks
- using the <c>RegExp</c>. <c>split/3</c> is is equivalent to
- <c>regexp:split/2</c> with one exception, that is <c>N</c>
- defines the number of maximum number of fields in the
+ <p><c>split/3</c> splits <c>String</c> in <c>N</c> chunks
+ using <c>RegExp</c>. <c>split/3</c> is equivalent to
+ <c>regexp:split/2</c> with the exception that <c>N</c>
+ defines the maximum number of fields in
<c>FieldList</c>.</p>
-
- <marker id="split_script_path"></marker>
</desc>
</func>
<func>
<name>split_script_path(RequestLine) -> Splitted</name>
- <fsummary>Split a <c>RequestLine</c>in a file reference to an executable and a<c>QueryString</c>or a <c>PathInfo</c>string.</fsummary>
+ <fsummary>Splits a <c>RequestLine</c> in a file reference to an executable,
+ and a <c>QueryString</c> or a <c>PathInfo</c>string.</fsummary>
<type>
<v>RequestLine = string()</v>
<v>Splitted = not_a_script | {Path, PathInfo, QueryString}</v>
<v>Path = QueryString = PathInfo = string()</v>
</type>
<desc>
- <marker id="split_script_path"></marker>
<p><c>split_script_path/1</c> is equivalent to
<c>split_path/1</c> with one exception. If the longest
- possible path is not a regular, accessible and executable
- file <c>not_a_script</c> is returned.</p>
-
- <marker id="split_path"></marker>
+ possible path is not a regular, accessible, and executable
+ file, then <c>not_a_script</c> is returned.</p>
</desc>
</func>
<func>
<name>split_path(RequestLine) -> {Path,QueryStringOrPathInfo}</name>
- <fsummary>Split a <c>RequestLine</c>in a file reference and a <c>QueryString</c>or a<c>PathInfo</c>string.</fsummary>
+ <fsummary>Splits a <c>RequestLine</c> in a file reference, and a
+ <c>QueryString</c> or a <c>PathInfo</c> string.</fsummary>
<type>
<v>RequestLine = Path = QueryStringOrPathInfo = string()</v>
</type>
<desc>
- <marker id="split_path"></marker>
- <p><c>split_path/1</c> splits the <c>RequestLine</c> in a file
- reference (<c>Path</c>) and a <c>QueryString</c> or a
- <c>PathInfo</c> string as specified in RFC 2616. A
- <c>QueryString</c> is isolated from the <c>Path</c> with a
+ <p><c>split_path/1</c> splits <c>RequestLine</c> in a file
+ reference (<c>Path</c>), and a <c>QueryString</c> or a
+ <c>PathInfo</c> string as specified in
+ <url href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</url>.
+ A <c>QueryString</c> is isolated from <c>Path</c> with a
question mark (<c>?</c>) and <c>PathInfo</c> with a slash
(/). In the case of a <c>QueryString</c>, everything before
- the <c>?</c> is a <c>Path</c> and everything after a
- <c>QueryString</c>. In the case of a <c>PathInfo</c> the
+ <c>?</c> is a <c>Path</c> and everything after <c>?</c> is a
+ <c>QueryString</c>. In the case of a <c>PathInfo</c>,
<c>RequestLine</c> is scanned from left-to-right on the hunt
for longest possible <c>Path</c> being a file or a
directory. Everything after the longest possible
<c>Path</c>, isolated with a <c>/</c>, is regarded as
<c>PathInfo</c>. The resulting <c>Path</c> is decoded using
<c>decode_hex/1</c> before delivery.</p>
-
- <marker id="strip"></marker>
</desc>
</func>
<func>
<name>strip(String) -> Stripped</name>
- <fsummary>Returns String where the leading and trailing space and tabs has been removed.</fsummary>
+ <fsummary>Returns <c>String</c> where the leading and trailing space
+ tabs are removed.</fsummary>
<type>
<v>String = Stripped = string()</v>
</type>
<desc>
- <marker id="strip"></marker>
<p><c>strip/1</c> removes any leading or trailing linear white
- space from the string. Linear white space should be read as
+ space from the string. Linear white space is to be read as
horizontal tab or space.</p>
-
- <marker id="suffix"></marker>
</desc>
</func>
<func>
<name>suffix(FileName) -> Suffix</name>
- <fsummary>Extract the file suffix from a given filename.</fsummary>
+ <fsummary>Extracts the file suffix from a given filename.</fsummary>
<type>
<v>FileName = Suffix = string()</v>
</type>
<desc>
- <marker id="suffix"></marker>
<p><c>suffix/1</c> is equivalent to
- <c>filename:extension/1</c> with one exception, that is
- <c>Suffix</c> is returned without a leading dot (<c>.</c>). </p>
+ <c>filename:extension/1</c> with the exception that
+ <c>Suffix</c> is returned without a leading dot (<c>.</c>).</p>
</desc>
</func>
</funcs>
<section>
- <marker id="see_also"></marker>
<title>SEE ALSO</title>
<p><seealso marker="httpd">httpd(3)</seealso></p>
</section>
diff --git a/lib/inets/doc/src/inets.xml b/lib/inets/doc/src/inets.xml
index f96ff5f8fb..5d071c9a48 100644
--- a/lib/inets/doc/src/inets.xml
+++ b/lib/inets/doc/src/inets.xml
@@ -30,21 +30,21 @@
<rev></rev>
</header>
<module>inets</module>
- <modulesummary>The inets services API</modulesummary>
+ <modulesummary>The Inets services API.</modulesummary>
<description>
<p>This module provides the most basic API to the
- clients and servers, that are part of the Inets application,
- such as start and stop. </p>
+ clients and servers that are part of the <c>Inets</c> application,
+ such as start and stop.</p>
<marker id="common_data_types"></marker>
</description>
<section>
- <title>COMMON DATA TYPES </title>
+ <title>DATA TYPES</title>
<p>Type definitions that are used more than once in
- this module: </p>
- <p><c> service() = ftpc | tftp | httpc | httpd</c></p>
- <p><c> property() = atom() </c></p>
+ this module:</p>
+ <p><c>service() = ftpc | tftp | httpc | httpd</c></p>
+ <p><c>property() = atom()</c></p>
<marker id="functions"></marker>
<marker id="services"></marker>
</section>
@@ -52,7 +52,7 @@
<funcs>
<func>
<name>services() -> [{Service, Pid}]</name>
- <fsummary>Returns a list of currently running services. </fsummary>
+ <fsummary>Returns a list of currently running services.</fsummary>
<type>
<v>Service = service()</v>
<v>Pid = pid()</v>
@@ -60,7 +60,7 @@
<desc>
<p>Returns a list of currently running services.</p>
<note>
- <p>Services started as <c>stand_alone</c> will not be listed.</p>
+ <p>Services started as <c>stand_alone</c> are not listed.</p>
</note>
<marker id="services_info"></marker>
@@ -70,8 +70,8 @@
<func>
<name>services_info() -> [{Service, Pid, Info}]</name>
<fsummary>Returns a list of currently running services where
- each service is described by a [{Option, Value}]
- list. </fsummary>
+ each service is described by an <c>[{Option, Value}]</c>
+ list.</fsummary>
<type>
<v>Service = service()</v>
<v>Pid = pid()</v>
@@ -81,11 +81,10 @@
</type>
<desc>
<p>Returns a list of currently running services where each
- service is described by a [{Option, Value}] list. The
- information given in the list is specific for each service
- and it is probable that each service will have its own info
- function that gives you even more details about the
- service.</p>
+ service is described by an <c>[{Option, Value}]</c> list. The
+ information in the list is specific for each service
+ and each service has probably its own info
+ function that gives more details about the service.</p>
<marker id="service_names"></marker>
</desc>
@@ -107,59 +106,48 @@
<func>
<name>start() -> </name>
<name>start(Type) -> ok | {error, Reason}</name>
- <fsummary>Starts the Inets application. </fsummary>
+ <fsummary>Starts the <c>Inets</c> application.</fsummary>
<type>
<v>Type = permanent | transient | temporary</v>
</type>
<desc>
- <p>Starts the Inets application. Default type
- is temporary. See also
- <seealso marker="kernel:application">application(3)</seealso>. </p>
+ <p>Starts the <c>Inets</c> application. Default type
+ is <c>temporary</c>. See also
+ <seealso marker="kernel:application">application(3)</seealso>.</p>
<marker id="stop"></marker>
</desc>
</func>
<func>
- <name>stop() -> ok </name>
- <fsummary>Stops the inets application.</fsummary>
- <desc>
- <p>Stops the inets application. See also
- <seealso marker="kernel:application">application(3)</seealso>. </p>
-
- <marker id="start2"></marker>
- </desc>
- </func>
-
- <func>
<name>start(Service, ServiceConfig) -> {ok, Pid} | {error, Reason}</name>
<name>start(Service, ServiceConfig, How) -> {ok, Pid} | {error, Reason}</name>
- <fsummary>Dynamically starts an inets
- service after the inets application has been started. </fsummary>
+ <fsummary>Dynamically starts an <c>Inets</c>
+ service after the <c>Inets</c> application has been started.</fsummary>
<type>
<v>Service = service()</v>
<v>ServiceConfig = [{Option, Value}]</v>
<v>Option = property()</v>
<v>Value = term()</v>
- <v>How = inets | stand_alone - default is inets</v>
+ <v>How = inets | stand_alone - default is inets.</v>
</type>
<desc>
- <p>Dynamically starts an inets service after the inets
- application has been started. </p>
+ <p>Dynamically starts an <c>Inets</c> service after the <c>Inets</c>
+ application has been started.</p>
<note>
- <p>Dynamically started services will not be handled by
- application takeover and failover behavior when inets is
- run as a distributed application. Nor will they be
- automatically restarted when the inets application is
- restarted, but as long as the inets application is up and
- running they will be supervised and may be soft code
- upgraded. Services started as <c>stand_alone</c>,
- e.i. the service is not started as part of the inets
- application, will lose all OTP application benefits such
- as soft upgrade. The "stand_alone-service" will be linked to
- the process that started it. In most cases some of the
- supervision functionality will still be in place and in
- some sense the calling process has now become the top
+ <p>Dynamically started services are not handled by
+ application takeover and failover behavior when <c>Inets</c> is
+ run as a distributed application. Nor are they
+ automatically restarted when the <c>Inets</c> application is
+ restarted. As long as the <c>Inets</c> application is operational,
+ they are supervised and can be soft code upgraded.</p>
+ <p>A service started as <c>stand_alone</c>, that is, the service
+ is not started as part of the <c>Inets</c> application,
+ lose all OTP application benefits, such as soft upgrade.
+ The <c>stand_alone</c>-service is linked to
+ the process that started it. Usually some
+ supervision functionality is still in place and in
+ some sense the calling process becomes the top
supervisor.</p>
</note>
@@ -167,19 +155,30 @@
</desc>
</func>
+ <func>
+ <name>stop() -> ok </name>
+ <fsummary>Stops the <c>Inets</c> application.</fsummary>
+ <desc>
+ <p>Stops the <c>Inets</c> application. See also
+ <seealso marker="kernel:application">application(3)</seealso>.</p>
+
+ <marker id="start2"></marker>
+ </desc>
+ </func>
+
<func>
<name>stop(Service, Reference) -> ok | {error, Reason} </name>
- <fsummary>Stops a started service of the inets application or takes
- down a "stand_alone-service" gracefully.</fsummary>
+ <fsummary>Stops a started service of the <c>Inets</c> application or takes
+ down a <c>stand_alone </c>service gracefully.</fsummary>
<type>
<v>Service = service() | stand_alone</v>
- <v>Reference = pid() | term() - service specified reference</v>
+ <v>Reference = pid() | term() - service-specified reference</v>
<v>Reason = term()</v>
</type>
<desc>
- <p>Stops a started service of the inets application or takes
- down a "stand_alone-service" gracefully. When the
- <c>stand_alone</c> option is used in start,
+ <p>Stops a started service of the <c>Inets</c> application or takes
+ down a <c>stand_alone</c>-service gracefully. When option
+ <c>stand_alone</c> is used in start,
only the pid is a valid argument to stop.</p>
<marker id="see_also"></marker>
diff --git a/lib/inets/doc/src/inets_services.xml b/lib/inets/doc/src/inets_services.xml
index f78485cb64..d100216ebb 100644
--- a/lib/inets/doc/src/inets_services.xml
+++ b/lib/inets/doc/src/inets_services.xml
@@ -22,7 +22,7 @@
</legalnotice>
- <title>Introduction</title>
+ <title>Inets</title>
<prepared>Ingela Anderton Andin</prepared>
<responsible></responsible>
<docno></docno>
@@ -34,45 +34,26 @@
</header>
<section>
- <title>Purpose</title>
- <p>Inets is a container for Internet clients and
- servers. Currently, an <term id="HTTP"></term>client and server, a
- TFPT client and server, and a FTP client has been incorporated
- into Inets. The HTTP server and client is HTTP 1.1 compliant as
- defined in <term id="RFC"></term>2616.</p>
- </section>
-
- <section>
- <title>Prerequisites</title>
- <p>It is assumed that the reader is familiar with the Erlang
- programming language, concepts of OTP and has a basic
- understanding of the HTTP, TFTP and FTP protocols.</p>
- </section>
-
- <section>
- <title>The Service Concept</title>
- <p>Each client and server in inets is viewed as service. Services
- may be configured to be started at application startup or
- started dynamically in runtime. If you want to run inets as an
- distributed application that should handle application failover
- and takeover, services should be configured to be started at
- application startup. When starting the inets application
- the inets top supervisor will start a number of subsupervisors
- and worker processes for handling the different services
- provided. When starting services dynamically new children will
- be added to the supervision tree, unless the service is started
- with the stand alone option, in which case the service is linked
- to the calling process and all OTP application features such as
- soft upgrade are lost.</p>
- <p>Services that should be configured for startup at application
- startup time should be put into the erlang node configuration file
- on the form: </p>
+ <title>Service Concept</title>
+ <p>Each client and server in <c>Inets</c> is viewed as a service.
+ Services can be configured to be started at application startup or
+ dynamically in runtime. To run <c>Inets</c> as a distributed
+ application that handles application failover and takeover,
+ configure the services to be started at application startup.
+ When starting the <c>Inets</c> application, the <c>Inets</c>
+ top supervisor starts a number of subsupervisors and worker
+ processes for handling the provided services.
+ When starting services dynamically, new children are added to the
+ supervision tree, unless the service is started with the standalone
+ option. In this case the service is linked to the calling process
+ and all OTP application features, such as soft upgrade, are lost.</p>
+ <p>Services to be configured for startup at application startup are to
+ be put into the Erlang node configuration file
+ on the following form:</p>
<pre>
- [{inets, [{services, ListofConfiguredServices}]}].
- </pre>
- <p>For details of exactly what to put in the list of configured
- services see the documentation for the services that should be
- configured.</p>
+ [{inets, [{services, ListofConfiguredServices}]}].</pre>
+ <p>For details of what to put in the list of configured services,
+ see the documentation for the services to be configured.</p>
</section>
</chapter>
diff --git a/lib/inets/doc/src/introduction.xml b/lib/inets/doc/src/introduction.xml
new file mode 100644
index 0000000000..491835f852
--- /dev/null
+++ b/lib/inets/doc/src/introduction.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!DOCTYPE chapter SYSTEM "chapter.dtd">
+
+<chapter>
+ <header>
+ <copyright>
+ <year>1997</year><year>2013</year>
+ <holder>Ericsson AB. All Rights Reserved.</holder>
+ </copyright>
+ <legalnotice>
+ The contents of this file are subject to the Erlang Public License,
+ Version 1.1, (the "License"); you may not use this file except in
+ compliance with the License. You should have received a copy of the
+ Erlang Public License along with this software. If not, it can be
+ retrieved online at http://www.erlang.org/.
+
+ Software distributed under the License is distributed on an "AS IS"
+ basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ the License for the specific language governing rights and limitations
+ under the License.
+
+ </legalnotice>
+
+ <title>Introduction</title>
+ <prepared>Ingela Anderton Andin</prepared>
+ <responsible></responsible>
+ <docno></docno>
+ <approved></approved>
+ <checked></checked>
+ <date>2004-09-28</date>
+ <rev>A</rev>
+ <file>introduction.xml</file>
+ </header>
+
+ <section>
+ <title>Purpose</title>
+ <p><c>Inets</c> is a container for Internet clients and servers
+ including the following:</p>
+ <list type="bulleted">
+ <item>An FTP client</item>
+ <item>A TFTP client and server</item>
+ <item>An <term id="HTTP"></term> client and server</item>
+ </list>
+ <p>The HTTP client and server are HTTP 1.1 compliant as
+ defined in
+ <url href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</url>.</p>
+ </section>
+
+ <section>
+ <title>Prerequisites</title>
+ <p>It is assumed that the reader is familiar with the Erlang
+ programming language, concepts of OTP, and has a basic
+ understanding of the FTP, TFTP, and HTTP protocols.</p>
+ </section>
+</chapter>
+
+
diff --git a/lib/inets/doc/src/mod_alias.xml b/lib/inets/doc/src/mod_alias.xml
index d073b5c5b8..87c950cc6b 100644
--- a/lib/inets/doc/src/mod_alias.xml
+++ b/lib/inets/doc/src/mod_alias.xml
@@ -32,8 +32,8 @@
<module>mod_alias</module>
<modulesummary>URL aliasing.</modulesummary>
<description>
- <p>Erlang Webserver Server internal API for handling of things
- such as interaction data exported by the mod_alias module.</p>
+ <p>Erlang web server internal API for handling of, for example,
+ interaction data exported by module <c>mod_alias</c>.</p>
<marker id="default_index"></marker>
</description>
@@ -41,7 +41,7 @@
<funcs>
<func>
<name>default_index(ConfigDB, Path) -> NewPath</name>
- <fsummary>Return a new path with the default resource or file appended.</fsummary>
+ <fsummary>Returns a new path with the default resource or file appended.</fsummary>
<type>
<v>ConfigDB = config_db()</v>
<v>Path = NewPath = string()</v>
@@ -50,14 +50,14 @@
<marker id="default_index"></marker>
<p>If <c>Path</c> is a directory, <c>default_index/2</c>, it starts
searching for resources or files that are specified in the config
- directive DirectoryIndex.
+ directive <c>DirectoryIndex</c>.
If an appropriate resource or file is found, it is appended to
the end of <c>Path</c> and then returned. <c>Path</c> is
- returned unaltered, if no appropriate
- file is found, or if <c>Path</c> is not a directory.
+ returned unaltered if no appropriate
+ file is found or if <c>Path</c> is not a directory.
<c>config_db()</c> is the server config file in ETS table format
as described in
- <seealso marker="http_server">Inets Users Guide.</seealso>.</p>
+ <seealso marker="http_server">Inets User's Guide</seealso>.</p>
<marker id="path"></marker>
</desc>
@@ -65,7 +65,7 @@
<func>
<name>path(PathData, ConfigDB, RequestURI) -> Path</name>
- <fsummary>Return the actual file path to a URL.</fsummary>
+ <fsummary>Returns the file path to a URL.</fsummary>
<type>
<v>PathData = interaction_data()</v>
<v>ConfigDB = config_db()</v>
@@ -73,15 +73,16 @@
</type>
<desc>
<marker id="path"></marker>
- <p><c>path/3</c> returns the actual file <c>Path</c> in the
- <c>RequestURI</c> (See RFC 1945). If the interaction data
- <c>{real_name,{Path,AfterPath}}</c> has been exported by
- mod_alias;
+ <p><c>path/3</c> returns the file <c>Path</c> in the
+ <c>RequestURI</c> (see
+ <url href="http://www.rfc-base.org/rfc-1945.html">RFC 1945</url>).
+ If the interaction data <c>{real_name,{Path,AfterPath}}</c>
+ has been exported by <c>mod_alias</c>,
<c>Path</c> is returned. If no interaction data has been
- exported, ServerRoot is used to
+ exported, <c>ServerRoot</c> is used to
generate a file <c>Path</c>. <c>config_db()</c> and
<c>interaction_data()</c> are as defined in
- <seealso marker="http_server">Inets Users Guide</seealso>.</p>
+ <seealso marker="http_server">Inets User's Guide</seealso>.</p>
<marker id="real_name"></marker>
</desc>
@@ -89,7 +90,7 @@
<func>
<name>real_name(ConfigDB, RequestURI, Aliases) -> Ret</name>
- <fsummary>Expand a request uri using Alias config directives.</fsummary>
+ <fsummary>Expands a request URI using <c>Aliases</c> config directives.</fsummary>
<type>
<v>ConfigDB = config_db()</v>
<v>RequestURI = string()</v>
@@ -101,18 +102,18 @@
<marker id="real_name"></marker>
<p><c>real_name/3</c> traverses <c>Aliases</c>, typically
extracted from <c>ConfigDB</c>, and matches each
- <c>FakeName</c> with <c>RequestURI</c>. If a match is found
+ <c>FakeName</c> with <c>RequestURI</c>. If a match is found,
<c>FakeName</c> is replaced with <c>RealName</c> in the
- match. The resulting path is split into two parts, that
- is <c>ShortPath</c> and <c>AfterPath</c> as defined in
- <seealso marker="httpd_util#split_path">httpd_util:split_path/1</seealso>.
- <c>Path</c> is generated from <c>ShortPath</c>, that is
+ match. The resulting path is split into two parts,
+ <c>ShortPath</c> and <c>AfterPath</c>, as defined in
+ <seealso marker="httpd_util#split_path-1">httpd_util:split_path/1</seealso>.
+ <c>Path</c> is generated from <c>ShortPath</c>, that is,
the result from
<seealso marker="#default_index">default_index/2</seealso> with
<c>ShortPath</c> as an argument.
<c>config_db()</c> is the server config file in ETS table
format as described in
- <seealso marker="http_server">Inets User Guide.</seealso>. </p>
+ <seealso marker="http_server">Inets User's Guide</seealso>.</p>
<marker id="real_script_name"></marker>
</desc>
@@ -120,7 +121,8 @@
<func>
<name>real_script_name(ConfigDB, RequestURI, ScriptAliases) -> Ret</name>
- <fsummary>Expand a request uri using ScriptAlias config directives.</fsummary>
+ <fsummary>Expands a request URI using <c>ScriptAliases</c>
+ config directives.</fsummary>
<type>
<v>ConfigDB = config_db()</v>
<v>RequestURI = string()</v>
@@ -132,14 +134,16 @@
<marker id="real_script_name"></marker>
<p><c>real_script_name/3</c> traverses <c>ScriptAliases</c>,
typically extracted from <c>ConfigDB</c>, and matches each
- <c>FakeName</c> with <c>RequestURI</c>. If a match is found
+ <c>FakeName</c> with <c>RequestURI</c>. If a match is found,
<c>FakeName</c> is replaced with <c>RealName</c> in the
- match. If the resulting match is not an executable script
- <c>not_a_script</c> is returned. If it is a script the
- resulting script path is in two parts, that is
- <c>ShortPath</c> and <c>AfterPath</c> as defined in <seealso marker="httpd_util#split_script_path">httpd_util:split_script_path/1</seealso>.
+ match. If the resulting match is not an executable script,
+ <c>not_a_script</c> is returned. If it is a script, the
+ resulting script path is in two parts,
+ <c>ShortPath</c> and <c>AfterPath</c>, as defined in
+ <seealso marker="httpd_util#split_script_path-1">httpd_util:split_script_path/1</seealso>.
<c>config_db()</c> is the server config file in ETS table
- format as described in <seealso marker="http_server">Inets Users Guide.</seealso>.</p>
+ format as described in
+ <seealso marker="http_server">Inets User's Guide</seealso>.</p>
</desc>
</func>
</funcs>
diff --git a/lib/inets/doc/src/mod_auth.xml b/lib/inets/doc/src/mod_auth.xml
index fda945cf73..2da2be37ed 100644
--- a/lib/inets/doc/src/mod_auth.xml
+++ b/lib/inets/doc/src/mod_auth.xml
@@ -30,299 +30,267 @@
<file>mod_auth.sgml</file>
</header>
<module>mod_auth</module>
- <modulesummary>User authentication using text files, dets or mnesia database.</modulesummary>
+ <modulesummary>User authentication using text files, Dets, or Mnesia database.</modulesummary>
<description>
<p>This module provides for basic user authentication using
- textual files, dets databases as well as mnesia databases. </p>
-
- <marker id="add_user"></marker>
+ textual files, <c>Dets</c> databases, or <c>Mnesia</c> databases.</p>
</description>
<funcs>
+ <func>
+ <name>add_group_member(GroupName, UserName, Options) -> true | {error, Reason}</name>
+ <name>add_group_member(GroupName, UserName, Port, Dir) -> true | {error, Reason}</name>
+ <name>add_group_member(GroupName, UserName, Address, Port, Dir) -> true | {error, Reason}</name>
+ <fsummary>Adds a user to a group.</fsummary>
+ <type>
+ <v>GroupName = string()</v>
+ <v>UserName = string()</v>
+ <v>Options = [Option]</v>
+ <v>Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}</v>
+ <v>Port = integer()</v>
+ <v>Address = {A,B,C,D} | string() | undefined</v>
+ <v>Dir = string()</v>
+ <v>AuthPassword = string()</v>
+ <v>Reason = term()</v>
+ </type>
+ <desc>
+ <p><c>add_group_member/3, add_group_member/4</c>, and
+ <c>add_group_member/5</c> each
+ adds a user to a group. If the group does not exist, it
+ is created and the user is added to the group. Upon successful
+ operation, this function returns <c>true</c>.
+ When <c>add_group_members/3</c>
+ is called, options <c>Port</c> and <c>Dir</c> are mandatory.</p>
+ </desc>
+ </func>
+
<func>
- <name>add_user(UserName, Options) -> true| {error, Reason}</name>
+ <name>add_user(UserName, Options) -> true| {error, Reason}</name>
<name>add_user(UserName, Password, UserData, Port, Dir) -> true | {error, Reason}</name>
<name>add_user(UserName, Password, UserData, Address, Port, Dir) -> true | {error, Reason}</name>
- <fsummary>Add a user to the user database.</fsummary>
+ <fsummary>Adds a user to the user database.</fsummary>
<type>
- <v>UserName = string()</v>
- <v>Options = [Option]</v>
- <v>Option = {password,Password} | {userData,UserData} | {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}</v>
- <v>Password = string()</v>
- <v>UserData = term()</v>
- <v>Port = integer()</v>
- <v>Address = {A,B,C,D} | string() | undefined</v>
- <v>Dir = string()</v>
+ <v>UserName = string()</v>
+ <v>Options = [Option]</v>
+ <v>Option = {password,Password} | {userData,UserData} | {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}</v>
+ <v>Password = string()</v>
+ <v>UserData = term()</v>
+ <v>Port = integer()</v>
+ <v>Address = {A,B,C,D} | string() | undefined</v>
+ <v>Dir = string()</v>
<v>AuthPassword =string()</v>
- <v>Reason = term()</v>
+ <v>Reason = term()</v>
</type>
<desc>
- <marker id="user_api"></marker>
- <marker id="add_user"></marker>
- <p><c>add_user/2, add_user/5</c> and <c>add_user/6</c> adds a
- user to the user
- database. If the operation is successful, this function returns
- <c>true</c>. If an error occurs, <c>{error,Reason}</c> is returned.
- When <c>add_user/2</c> is called the Password,
- UserData Port and Dir options is mandatory.</p>
-
- <marker id="delete_user"></marker>
+ <p><c>add_user/2, add_user/5</c>, and <c>add_user/6</c> each adds a
+ user to the user database. If the operation is successful,
+ this function returns <c>true</c>. If an error occurs,
+ <c>{error,Reason}</c> is returned.
+ When <c>add_user/2</c> is called, options <c>Password</c>,
+ <c>UserData</c>, <c>Port</c>, and <c>Dir</c> are mandatory.</p>
</desc>
</func>
- <func>
- <name>delete_user(UserName,Options) -> true | {error, Reason}</name>
- <name>delete_user(UserName, Port, Dir) -> true | {error, Reason}</name>
- <name>delete_user(UserName, Address, Port, Dir) -> true | {error, Reason}</name>
- <fsummary>Delete a user from the user database.</fsummary>
+ <func>
+ <name>delete_group(GroupName, Options) -> true | {error,Reason} &lt;name>delete_group(GroupName, Port, Dir) -> true | {error, Reason}</name>
+ <name>delete_group(GroupName, Address, Port, Dir) -> true | {error, Reason}</name>
+ <fsummary>Deletes a group.</fsummary>
<type>
- <v>UserName = string()</v>
- <v>Options = [Option]</v>
- <v>Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}</v>
- <v>Port = integer()</v>
- <v>Address = {A,B,C,D} | string() | undefined</v>
- <v>Dir = string()</v>
+ <v>Options = [Option]</v>
+ <v>Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}</v>
+ <v>Port = integer()</v>
+ <v>Address = {A,B,C,D} | string() | undefined</v>
+ <v>Dir = string()</v>
+ <v>GroupName = string()</v>
<v>AuthPassword = string()</v>
- <v>Reason = term()</v>
+ <v>Reason = term()</v>
</type>
<desc>
- <marker id="delete_user"></marker>
- <p><c>delete_user/2, delete_user/3</c> and <c>delete_user/4</c>
- deletes a user from the user database.
- If the operation is successful, this function returns <c>true</c>.
- If an error occurs, <c>{error,Reason}</c> is returned.
- When <c>delete_user/2</c> is called the Port and Dir options
- are mandatory.</p>
-
- <marker id="get_user"></marker>
+ <p><c>delete_group/2, delete_group/3</c>, and <c>delete_group/4</c>
+ each deletes the group specified and returns <c>true</c>.
+ If there is an error, <c>{error, Reason}</c> is returned.
+ When <c>delete_group/2</c> is called, option
+ <c>Port</c> and <c>Dir</c> are mandatory.</p>
</desc>
</func>
- <func>
- <name>get_user(UserName,Options) -> {ok, #httpd_user} |{error, Reason}</name>
- <name>get_user(UserName, Port, Dir) -> {ok, #httpd_user} | {error, Reason}</name>
- <name>get_user(UserName, Address, Port, Dir) -> {ok, #httpd_user} | {error, Reason}</name>
- <fsummary>Returns a user from the user database.</fsummary>
+ <func>
+ <name>delete_group_member(GroupName, UserName, Options) -> true | {error, Reason}</name>
+ <name>delete_group_member(GroupName, UserName, Port, Dir) -> true | {error, Reason}</name>
+ <name>delete_group_member(GroupName, UserName, Address, Port, Dir) -> true | {error, Reason}</name>
+ <fsummary>Removes a user from a group.</fsummary>
<type>
- <v>UserName = string()</v>
- <v>Options = [Option]</v>
- <v>Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}</v>
- <v>Port = integer()</v>
- <v>Address = {A,B,C,D} | string() | undefined</v>
- <v>Dir = string()</v>
+ <v>GroupName = string()</v>
+ <v>UserName = string()</v>
+ <v>Options = [Option]</v>
+ <v>Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}</v>
+ <v>Port = integer()</v>
+ <v>Address = {A,B,C,D} | string() | undefined</v>
+ <v>Dir = string()</v>
<v>AuthPassword = string()</v>
- <v>Reason = term()</v>
+ <v>Reason = term()</v>
</type>
<desc>
- <marker id="get_user"></marker>
- <p><c>get_user/2, get_user/3</c> and <c>get_user/4</c> returns a
- <c>httpd_user</c> record containing the userdata for a
- specific user. If the user cannot be found, <c>{error, Reason}</c>
- is returned. When <c>get_user/2</c> is called the Port and Dir
- options are mandatory.</p>
-
- <marker id="list_users"></marker>
+ <p><c>delete_group_member/3, delete_group_member/4</c>, and
+ <c>delete_group_member/5</c> each deletes a user from a group.
+ If the group or the user does not exist,
+ this function returns an error, otherwise <c>true</c>.
+ When <c>delete_group_member/3</c> is called, the options <c>Port</c>
+ and <c>Dir</c> are mandatory.</p>
</desc>
</func>
-
+
<func>
- <name>list_users(Options) -> {ok, Users} | {error, Reason}</name>
- <name>list_users(Port, Dir) -> {ok, Users} | {error, Reason}</name>
- <name>list_users(Address, Port, Dir) -> {ok, Users} | {error, Reason}</name>
- <fsummary>List users in the user database.</fsummary>
+ <name>delete_user(UserName,Options) -> true | {error, Reason}</name>
+ <name>delete_user(UserName, Port, Dir) -> true | {error, Reason}</name>
+ <name>delete_user(UserName, Address, Port, Dir) -> true | {error, Reason}</name>
+ <fsummary>Deletes a user from the user database.</fsummary>
<type>
- <v>Options = [Option]</v>
- <v>Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}</v>
- <v>Port = integer()</v>
- <v>Address = {A,B,C,D} | string() | undefined</v>
- <v>Dir = string()</v>
- <v>Users = list()</v>
+ <v>UserName = string()</v>
+ <v>Options = [Option]</v>
+ <v>Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}</v>
+ <v>Port = integer()</v>
+ <v>Address = {A,B,C,D} | string() | undefined</v>
+ <v>Dir = string()</v>
<v>AuthPassword = string()</v>
- <v>Reason = atom()</v>
+ <v>Reason = term()</v>
</type>
<desc>
- <marker id="list_users"></marker>
- <p><c>list_users/1, list_users/2</c> and <c>list_users/3</c>
- returns a list
- of users in the user database for a specific <c>Port/Dir</c>.
- When <c>list_users/1</c> is called the Port and Dir
- options are mandatory.</p>
-
- <marker id="add_group_member"></marker>
+ <p><c>delete_user/2, delete_user/3</c>, and <c>delete_user/4</c>
+ each deletes a user from the user database.
+ If the operation is successful, this function returns <c>true</c>.
+ If an error occurs, <c>{error,Reason}</c> is returned.
+ When <c>delete_user/2</c> is called, options <c>Port</c> and <c>Dir</c>
+ are mandatory.</p>
</desc>
</func>
<func>
- <name>add_group_member(GroupName, UserName, Options) -> true | {error, Reason}</name>
- <name>add_group_member(GroupName, UserName, Port, Dir) -> true | {error, Reason}</name>
- <name>add_group_member(GroupName, UserName, Address, Port, Dir) -> true | {error, Reason}</name>
- <fsummary>Add a user to a group.</fsummary>
+ <name>get_user(UserName,Options) -> {ok, #httpd_user} |{error, Reason}</name>
+ <name>get_user(UserName, Port, Dir) -> {ok, #httpd_user} | {error, Reason}</name>
+ <name>get_user(UserName, Address, Port, Dir) -> {ok, #httpd_user} | {error, Reason}</name>
+ <fsummary>Returns a user from the user database.</fsummary>
<type>
- <v>GroupName = string()</v>
- <v>UserName = string()</v>
- <v>Options = [Option]</v>
- <v>Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}</v>
- <v>Port = integer()</v>
- <v>Address = {A,B,C,D} | string() | undefined</v>
- <v>Dir = string()</v>
+ <v>UserName = string()</v>
+ <v>Options = [Option]</v>
+ <v>Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}</v>
+ <v>Port = integer()</v>
+ <v>Address = {A,B,C,D} | string() | undefined</v>
+ <v>Dir = string()</v>
<v>AuthPassword = string()</v>
- <v>Reason = term()</v>
+ <v>Reason = term()</v>
</type>
<desc>
- <marker id="add_group_member"></marker>
- <p><c>add_group_member/3, add_group_member/4</c> and
- <c>add_group_member/5</c>
- adds a user to a group. If the group does not exist, it
- is created and the user is added to the group. Upon successful
- operation, this function returns <c>true</c>.
- When <c>add_group_members/3</c>
- is called the Port and Dir options are mandatory.</p>
-
- <marker id="delete_group_member"></marker>
+ <p><c>get_user/2, get_user/3</c>, and <c>get_user/4</c> each
+ returns an <c>httpd_user</c> record containing the userdata for a
+ specific user. If the user cannot be found, <c>{error, Reason}</c>
+ is returned. When <c>get_user/2</c> is called, options <c>Port</c> and <c>Dir</c>
+ are mandatory.</p>
</desc>
</func>
- <func>
- <name>delete_group_member(GroupName, UserName, Options) -> true | {error, Reason}</name>
- <name>delete_group_member(GroupName, UserName, Port, Dir) -> true | {error, Reason}</name>
- <name>delete_group_member(GroupName, UserName, Address, Port, Dir) -> true | {error, Reason}</name>
- <fsummary>Remove a user from a group.</fsummary>
+ <func>
+ <name>list_groups(Options) -> {ok, Groups} | {error, Reason}</name>
+ <name>list_groups(Port, Dir) -> {ok, Groups} | {error, Reason}</name>
+ <name>list_groups(Address, Port, Dir) -> {ok, Groups} | {error, Reason}</name>
+ <fsummary>Lists all the groups.</fsummary>
<type>
- <v>GroupName = string()</v>
- <v>UserName = string()</v>
- <v>Options = [Option]</v>
- <v>Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}</v>
- <v>Port = integer()</v>
- <v>Address = {A,B,C,D} | string() | undefined</v>
- <v>Dir = string()</v>
+ <v>Options = [Option]</v>
+ <v>Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}</v>
+ <v>Port = integer()</v>
+ <v>Address = {A,B,C,D} | string() | undefined</v>
+ <v>Dir = string()</v>
+ <v>Groups = list()</v>
<v>AuthPassword = string()</v>
- <v>Reason = term()</v>
+ <v>Reason = term()</v>
</type>
<desc>
- <marker id="delete_group_member"></marker>
- <p><c>delete_group_member/3, delete_group_member/4</c> and
- <c>delete_group_member/5</c> deletes a user from a group.
- If the group or the user does not exist,
- this function returns an error, otherwise it returns <c>true</c>.
- When <c>delete_group_member/3</c> is called the Port and Dir options
- are mandatory.</p>
-
- <marker id="list_group_members"></marker>
+ <p><c>list_groups/1, list_groups/2</c>, and <c>list_groups/3</c>
+ each lists all the groups available.
+ If there is an error, <c>{error, Reason}</c> is returned.
+ When <c>list_groups/1</c> is called, options <c>Port</c>
+ and <c>Dir</c> are mandatory.</p>
</desc>
</func>
-
+
<func>
<name>list_group_members(GroupName, Options) -> {ok, Users} | {error, Reason}</name>
<name>list_group_members(GroupName, Port, Dir) -> {ok, Users} | {error, Reason}</name>
<name>list_group_members(GroupName, Address, Port, Dir) -> {ok, Users} | {error, Reason}</name>
- <fsummary>List the members of a group.</fsummary>
+ <fsummary>Lists the members of a group.</fsummary>
<type>
- <v>GroupName = string()</v>
- <v>Options = [Option]</v>
- <v>Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}</v>
- <v>Port = integer()</v>
- <v>Address = {A,B,C,D} | string() | undefined</v>
- <v>Dir = string()</v>
- <v>Users = list()</v>
+ <v>GroupName = string()</v>
+ <v>Options = [Option]</v>
+ <v>Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}</v>
+ <v>Port = integer()</v>
+ <v>Address = {A,B,C,D} | string() | undefined</v>
+ <v>Dir = string()</v>
+ <v>Users = list()</v>
<v>AuthPassword = string()</v>
- <v>Reason = term()</v>
+ <v>Reason = term()</v>
</type>
<desc>
- <marker id="list_group_members"></marker>
- <p><c>list_group_members/2, list_group_members/3</c> and
- <c>list_group_members/4</c>
+ <p><c>list_group_members/2, list_group_members/3</c>, and
+ <c>list_group_members/4</c> each
lists the members of a specified group. If the group does not
exist or there is an error, <c>{error, Reason}</c> is returned.
- When <c>list_group_members/2</c> is called the Port and Dir options
- are mandatory.</p>
-
- <marker id="list_groups"></marker>
+ When <c>list_group_members/2</c> is called, options <c>Port</c>
+ and <c>Dir</c> are mandatory.</p>
</desc>
</func>
- <func>
- <name>list_groups(Options) -> {ok, Groups} | {error, Reason}</name>
- <name>list_groups(Port, Dir) -> {ok, Groups} | {error, Reason}</name>
- <name>list_groups(Address, Port, Dir) -> {ok, Groups} | {error, Reason}</name>
- <fsummary>List all the groups.</fsummary>
+ <func>
+ <name>list_users(Options) -> {ok, Users} | {error, Reason}</name>
+ <name>list_users(Port, Dir) -> {ok, Users} | {error, Reason}</name>
+ <name>list_users(Address, Port, Dir) -> {ok, Users} | {error, Reason}</name>
+ <fsummary>Lists users in the user database.</fsummary>
<type>
- <v>Options = [Option]</v>
- <v>Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}</v>
- <v>Port = integer()</v>
- <v>Address = {A,B,C,D} | string() | undefined</v>
- <v>Dir = string()</v>
- <v>Groups = list()</v>
+ <v>Options = [Option]</v>
+ <v>Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}</v>
+ <v>Port = integer()</v>
+ <v>Address = {A,B,C,D} | string() | undefined</v>
+ <v>Dir = string()</v>
+ <v>Users = list()</v>
<v>AuthPassword = string()</v>
- <v>Reason = term()</v>
+ <v>Reason = atom()</v>
</type>
<desc>
- <marker id="list_groups"></marker>
- <p><c>list_groups/1, list_groups/2</c> and <c>list_groups/3</c>
- lists all the groups available.
- If there is an error, <c>{error, Reason}</c> is returned.
- When <c>list_groups/1</c> is called the Port and Dir options
+ <p><c>list_users/1, list_users/2</c>, and <c>list_users/3</c>
+ each returns a list
+ of users in the user database for a specific <c>Port/Dir</c>.
+ When <c>list_users/1</c> is called, options <c>Port</c> and <c>Dir</c>
are mandatory.</p>
-
- <marker id="delete_group"></marker>
</desc>
</func>
-
- <func>
- <name>delete_group(GroupName, Options) -> true | {error,Reason} &lt;name>delete_group(GroupName, Port, Dir) -> true | {error, Reason}</name>
- <name>delete_group(GroupName, Address, Port, Dir) -> true | {error, Reason}</name>
- <fsummary>Deletes a group</fsummary>
- <type>
- <v>Options = [Option]</v>
- <v>Option = {port,Port} | {addr,Address} | {dir,Directory} | {authPassword,AuthPassword}</v>
- <v>Port = integer()</v>
- <v>Address = {A,B,C,D} | string() | undefined</v>
- <v>Dir = string()</v>
- <v>GroupName = string()</v>
- <v>AuthPassword = string()</v>
- <v>Reason = term()</v>
- </type>
- <desc>
- <marker id="delete_group"></marker>
- <p><c>delete_group/2, delete_group/3</c> and <c>delete_group/4</c>
- deletes the group specified and returns <c>true</c>.
- If there is an error, <c>{error, Reason}</c> is returned.
- When <c>delete_group/2</c> is called the
- Port and Dir options are mandatory.</p>
-
- <marker id="update_password"></marker>
- </desc>
- </func>
-
+
<func>
<name>update_password(Port, Dir, OldPassword, NewPassword, NewPassword) -> ok | {error, Reason}</name>
<name>update_password(Address,Port, Dir, OldPassword, NewPassword, NewPassword) -> ok | {error, Reason}</name>
- <fsummary>Change the AuthAcessPassword</fsummary>
+ <fsummary>Changes <c>AuthAcessPassword</c>.</fsummary>
<type>
- <v>Port = integer()</v>
- <v>Address = {A,B,C,D} | string() | undefined</v>
- <v>Dir = string()</v>
- <v>GroupName = string()</v>
- <v>OldPassword = string()</v>
- <v>NewPassword = string()</v>
- <v>Reason = term()</v>
+ <v>Port = integer()</v>
+ <v>Address = {A,B,C,D} | string() | undefined</v>
+ <v>Dir = string()</v>
+ <v>GroupName = string()</v>
+ <v>OldPassword = string()</v>
+ <v>NewPassword = string()</v>
+ <v>Reason = term()</v>
</type>
<desc>
- <marker id="update_password"></marker>
- <p><c>update_password/5</c> and <c>update_password/6</c>
- Updates the AuthAccessPassword for the specified directory.
- If NewPassword is equal to "NoPassword" no password is requires to
+ <p><c>update_password/5</c> and <c>update_password/6</c> each
+ updates <c>AuthAccessPassword</c> for the specified directory.
+ If <c>NewPassword</c> is equal to "NoPassword", no password is required to
change authorisation data.
- If NewPassword is equal to "DummyPassword" no changes can be done
+ If <c>NewPassword</c> is equal to "DummyPassword", no changes can be done
without changing the password first.</p>
</desc>
</func>
</funcs>
<section>
- <marker id="see_also"></marker>
<title>SEE ALSO</title>
<p><seealso marker="httpd">httpd(3)</seealso>,
- <seealso marker="mod_alias">mod_alias(3)</seealso>,</p>
+ <seealso marker="mod_alias">mod_alias(3)</seealso></p>
</section>
</erlref>
diff --git a/lib/inets/doc/src/mod_esi.xml b/lib/inets/doc/src/mod_esi.xml
index 8044f46242..66c59a0c60 100644
--- a/lib/inets/doc/src/mod_esi.xml
+++ b/lib/inets/doc/src/mod_esi.xml
@@ -30,11 +30,11 @@
<file>mod_esi.sgml</file>
</header>
<module>mod_esi</module>
- <modulesummary>Erlang Server Interface </modulesummary>
+ <modulesummary>Erlang Server Interface</modulesummary>
<description>
<p>This module defines the Erlang Server Interface (ESI) API.
- It is a more efficient way of writing erlang scripts
- for your Inets web server than writing them as common CGI scripts.</p>
+ It is a more efficient way of writing Erlang scripts
+ for your <c>Inets</c> web server than writing them as common CGI scripts.</p>
<marker id="deliver"></marker>
</description>
@@ -42,7 +42,7 @@
<funcs>
<func>
<name>deliver(SessionID, Data) -> ok | {error, Reason}</name>
- <fsummary>Sends Data back to client.</fsummary>
+ <fsummary>Sends <c>Data</c> back to client.</fsummary>
<type>
<v>SessionID = term()</v>
<v>Data = string() | io_list() | binary()</v>
@@ -53,16 +53,16 @@
<p>This function is <em>only</em> intended to be used from
functions called by the Erl Scheme interface to deliver
parts of the content to the user.</p>
- <p>Sends data from a Erl Scheme script back to the client.</p>
+ <p>Sends data from an Erl Scheme script back to the client.</p>
<note>
- <p>Note that if any HTTP-header fields should be added by the
- script they must be in the first call to deliver/2 and the
- data in the call must be a string. Calls after the headers
- are complete may contain binary data to reduce copying
- overhead. Do not assume anything about the data type of
- SessionID, the SessionID must be the value given as input to
- the esi call back function that you implemented.</p>
+ <p>If any HTTP header fields are added by the
+ script, they must be in the first call to <c>deliver/2</c>,
+ and the data in the call must be a string. Calls after the headers
+ are complete can contain binary data to reduce copying
+ overhead. Do not assume anything about the data type of
+ <c>SessionID</c>. <c>SessionID</c> must be the value given
+ as input to the ESI callback function that you implemented.</p>
</note>
</desc>
</func>
@@ -74,54 +74,55 @@
<funcs>
<func>
<name>Module:Function(SessionID, Env, Input)-> _ </name>
- <fsummary>Creates a dynamic web page and returns it chunk by chunk to the server process by calling mod_esi:deliver/2.</fsummary>
+ <fsummary>Creates a dynamic web page and returns it chunk by chunk
+ to the server process by calling <c>mod_esi:deliver/2</c>.</fsummary>
<type>
<v>SessionID = term()</v>
- <v>Env = [EnvironmentDirectives] ++ ParsedHeader</v>
+ <v>Env = [EnvironmentDirectives] ++ ParsedHeader</v>
<v>EnvironmentDirectives = {Key,Value}</v>
<v>Key = query_string | content_length | server_software | gateway_interface | server_protocol | server_port | request_method | remote_addr | script_name</v>
<v>Input = string()</v>
</type>
<desc>
- <p>The <c>Module</c> must be found in the code path and export
- <c>Function</c> with an arity of three. An erlScriptAlias must
- also be set up in the configuration file for the Web server.</p>
- <p>If the HTTP request is a 'post' request and a body is sent
- then content_length will be the length of the posted
- data. If 'get' is used query_string will be the data after
- <em>?</em> in the url.</p>
- <p>ParsedHeader is the HTTP request as a key value tuple
- list. The keys in parsed header will be the in lower case.</p>
- <p>SessionID is a identifier
- the server uses when <c>deliver/2</c> is called; do not
+ <p><c>Module</c> must be found in the code path and export
+ <c>Function</c> with an arity of three. An <c>erlScriptAlias</c> must
+ also be set up in the configuration file for the web server.</p>
+ <p>If the HTTP request is a 'post' request and a body is sent,
+ <c>content_length</c> is the length of the posted
+ data. If 'get' is used, <c>query_string</c> is the data after
+ <em>?</em> in the URL.</p>
+ <p><c>ParsedHeader</c> is the HTTP request as a key-value tuple
+ list. The keys in <c>ParsedHeader</c> are in lower case.</p>
+ <p><c>SessionID</c> is an identifier
+ the server uses when <c>deliver/2</c> is called. Do not
assume anything about the datatype.</p>
- <p>Use this callback function to dynamically generate dynamic web
- content. When a part of the page is generated send the
- data back to the client through <c>deliver/2</c>. Note
+ <p>Use this callback function to generate dynamic web
+ content dynamically. When a part of the page is generated, send the
+ data back to the client through <c>deliver/2</c>. Notice
that the first chunk of data sent to the client must at
least contain all HTTP header fields that the response
will generate. If the first chunk does not contain the
- <em>End of HTTP header</em>, that is <c>"\r\n\r\n",</c>
- the server will
- assume that no HTTP header fields will be generated.</p>
+ <em>end of HTTP header</em>, that is, <c>"\r\n\r\n",</c>
+ the server assumes that no HTTP header fields will be generated.</p>
</desc>
</func>
<func>
<name>Module:Function(Env, Input)-> Response </name>
- <fsummary>Creates a dynamic web page and return it as a list. This functions is deprecated and only kept for backwards compatibility.</fsummary>
+ <fsummary>Creates a dynamic web page and returns it as a list.
+ This function is deprecated and is only kept for backwards compatibility.</fsummary>
<type>
- <v>Env = [EnvironmentDirectives] ++ ParsedHeader</v>
+ <v>Env = [EnvironmentDirectives] ++ ParsedHeader</v>
<v>EnvironmentDirectives = {Key,Value}</v>
<v>Key = query_string | content_length | server_software | gateway_interface | server_protocol | server_port | request_method | remote_addr | script_name.</v>
<v>Input = string()</v>
<v>Response = string()</v>
</type>
<desc>
- <p>This callback format consumes a lot of memory since the
+ <p>This callback format consumes much memory, as the
whole response must be generated before it is sent to the
- user. This function is deprecated and only kept for backwards
+ user. This function is deprecated and is only kept for backwards
compatibility.
- For new development Module:Function/3 should be used.</p>
+ For new development, use <c>Module:Function/3</c>.</p>
</desc>
</func>
</funcs>
diff --git a/lib/inets/doc/src/mod_security.xml b/lib/inets/doc/src/mod_security.xml
index 467c68d364..9dc32b971b 100644
--- a/lib/inets/doc/src/mod_security.xml
+++ b/lib/inets/doc/src/mod_security.xml
@@ -35,24 +35,45 @@
<p>Security Audit and Trailing Functionality</p>
</description>
<funcs>
+
+ <func>
+ <name>block_user(User, Port, Dir, Seconds) -> true | {error, Reason}</name>
+ <name>block_user(User, Address, Port, Dir, Seconds) -> true | {error, Reason}</name>
+ <fsummary>Blocks a user from access to a directory for a certain amount of time.</fsummary>
+ <type>
+ <v>User = string()</v>
+ <v>Port = integer()</v>
+ <v>Address = {A,B,C,D} | string() | undefined</v>
+ <v>Dir = string()</v>
+ <v>Seconds = integer() | infinity</v>
+ <v>Reason = no_such_directory</v>
+ </type>
+ <desc>
+ <p><c>block_user/4</c> and <c>block_user/5</c> each blocks the user
+ <c>User</c> from directory <c>Dir</c> for a specified
+ amount of time.</p>
+ </desc>
+ </func>
+
<func>
<name>list_auth_users(Port) -> Users | []</name>
<name>list_auth_users(Address, Port) -> Users | []</name>
<name>list_auth_users(Port, Dir) -> Users | []</name>
<name>list_auth_users(Address, Port, Dir) -> Users | []</name>
- <fsummary>List users that have authenticated within the SecurityAuthTimeout time for a given address (if specified), port number and directory (if specified).</fsummary>
+ <fsummary>Lists users that have authenticated within the <c>SecurityAuthTimeout</c>
+ time for a given address (if specified), port number, and directory
+ (if specified).</fsummary>
<type>
- <v>Port = integer()</v>
+ <v>Port = integer()</v>
<v>Address = {A,B,C,D} | string() | undefined</v>
- <v>Dir = string()</v>
- <v>Users = list() = [string()]</v>
+ <v>Dir = string()</v>
+ <v>Users = list() = [string()]</v>
</type>
<desc>
- <marker id="list_auth_users"></marker>
- <p><c>list_auth_users/1</c>, <c>list_auth_users/2</c> and
- <c>list_auth_users/3</c> returns a list of users that are
+ <p><c>list_auth_users/1</c>, <c>list_auth_users/2</c>, and
+ <c>list_auth_users/3</c> each returns a list of users that are
currently authenticated. Authentications are stored for
- SecurityAuthTimeout seconds, and are then discarded.</p>
+ <c>SecurityAuthTimeout</c> seconds, and then discarded.</p>
</desc>
</func>
<func>
@@ -60,96 +81,83 @@
<name>list_blocked_users(Address, Port) -> Users | []</name>
<name>list_blocked_users(Port, Dir) -> Users | []</name>
<name>list_blocked_users(Address, Port, Dir) -> Users | []</name>
- <fsummary>List users that are currently blocked from access to a specified port number, for a given address (if specified).</fsummary>
+ <fsummary>Lists users that are currently blocked from access to a
+ specified port number, for a given address (if specified).</fsummary>
<type>
- <v>Port = integer()</v>
+ <v>Port = integer()</v>
<v>Address = {A,B,C,D} | string() | undefined</v>
- <v>Dir = string()</v>
- <v>Users = list() = [string()]</v>
+ <v>Dir = string()</v>
+ <v>Users = list() = [string()]</v>
</type>
<desc>
- <marker id="list_blocked_users"></marker>
- <p><c>list_blocked_users/1</c>, <c>list_blocked_users/2</c> and
- <c>list_blocked_users/3</c> returns a list of users that are
+ <p><c>list_blocked_users/1</c>, <c>list_blocked_users/2</c>, and
+ <c>list_blocked_users/3</c> each returns a list of users that are
currently blocked from access.</p>
</desc>
</func>
+
<func>
- <name>block_user(User, Port, Dir, Seconds) -> true | {error, Reason}</name>
- <name>block_user(User, Address, Port, Dir, Seconds) -> true | {error, Reason}</name>
- <fsummary>Block user from access to a directory for a certain amount of time.</fsummary>
- <type>
- <v>User = string()</v>
- <v>Port = integer()</v>
- <v>Address = {A,B,C,D} | string() | undefined</v>
- <v>Dir = string()</v>
- <v>Seconds = integer() | infinity</v>
- <v>Reason = no_such_directory</v>
- </type>
- <desc>
- <marker id="block_user"></marker>
- <p><c>block_user/4</c> and <c>block_user/5</c> blocks the user
- <c>User</c> from the directory <c>Dir</c> for a specified
- amount of time.</p>
- </desc>
- </func>
- <func>
- <name>unblock_user(User, Port) -> true | {error, Reason}</name>
+ <name>unblock_user(User, Port) -> true | {error, Reason}</name>
<name>unblock_user(User, Address, Port) -> true | {error, Reason}</name>
- <name>unblock_user(User, Port, Dir) -> true | {error, Reason}</name>
+ <name>unblock_user(User, Port, Dir) -> true | {error, Reason}</name>
<name>unblock_user(User, Address, Port, Dir) -> true | {error, Reason}</name>
- <fsummary>Remove a blocked user from the block list</fsummary>
+ <fsummary>Removes a blocked user from the block list.</fsummary>
<type>
- <v>User = string()</v>
- <v>Port = integer()</v>
+ <v>User = string()</v>
+ <v>Port = integer()</v>
<v>Address = {A,B,C,D} | string() | undefined</v>
- <v>Dir = string()</v>
+ <v>Dir = string()</v>
<v>Reason = term()</v>
</type>
<desc>
- <marker id="unblock_user"></marker>
- <p><c>unblock_user/2</c>, <c>unblock_user/3</c> and
- <c>unblock_user/4</c> removes the user <c>User</c> from
- the list of blocked users for the Port (and Dir) specified.</p>
+ <p><c>unblock_user/2</c>, <c>unblock_user/3</c>, and
+ <c>unblock_user/4</c> each removes the user <c>User</c> from
+ the list of blocked users for <c>Port</c> (and <c>Dir</c>).</p>
</desc>
</func>
</funcs>
<section>
<marker id="callback_module"></marker>
- <title>The SecurityCallbackModule</title>
- <p>The SecurityCallbackModule is a user written module that can receive
- events from the mod_security Erlang Webserver API module.
- This module only exports the function(s),
- <seealso marker="#callback_module_event">event/4,5</seealso>,
- which are described below.
+ <title>SecurityCallbackModule</title>
+ <p>The <c>SecurityCallbackModule</c> is a user-written module that can receive
+ events from the <c>mod_security</c> Erlang web server API module.
+ This module only exports the functions event/[4,5]
+ which are described here.
</p>
</section>
<funcs>
<func>
- <name>event(What, Port, Dir, Data) -> ignored</name>
- <name>event(What, Address, Port, Dir, Data) -> ignored</name>
- <fsummary>This function is called whenever an event occurs in mod_security</fsummary>
+ <name>Module:event(What, Port, Dir, Data) -> ignored</name>
+ <name>Module:event(What, Address, Port, Dir, Data) -> ignored</name>
+ <fsummary>Called whenever an event occurs in <c>mod_security</c>.</fsummary>
<type>
- <v>What = atom()</v>
- <v>Port = integer()</v>
+ <v>What = atom()</v>
+ <v>Port = integer()</v>
<v>Address = {A,B,C,D} | string() &lt;v>Dir = string()</v>
- <v>Data = [Info]</v>
- <v>Info = {Name, Value}</v>
+ <v>Data = [Info]</v>
+ <v>Info = {Name, Value}</v>
</type>
<desc>
<marker id="callback_module_event"></marker>
- <p><c>event/4</c> or <c>event/4</c> is called whenever an event
- occurs in the mod_security Erlang Webserver API module (<c>event/4</c> is
- called if Address is undefined and <c>event/5</c> otherwise).
- The <c>What</c> argument specifies the type of event that has
- occurred, and should be one of the following reasons;
- <c>auth_fail</c> (a failed user authentication),
- <c>user_block</c> (a user is being blocked from access) or
- <c>user_unblock</c> (a user is being removed from the block list).</p>
+ <p><c>event/4</c> or <c>event/5</c> is called whenever an event
+ occurs in the <c>mod_security</c> Erlang web server API module.
+ (<c>event/4</c> is called if <c>Address</c> is undefined,
+ otherwise <c>event/5</c>.
+ Argument <c>What</c> specifies the type of event that has
+ occurred and is one of the following reasons:
+ </p>
+ <taglist>
+ <tag><c>auth_fail</c></tag>
+ <item><p>A failed user authentication.</p></item>
+ <tag><c>user_block</c></tag>
+ <item><p>A user is being blocked from access.</p></item>
+ <tag><c>user_unblock</c></tag>
+ <item><p>A user is being removed from the block list.</p></item>
+ </taglist>
<note>
- <p>Note that the <c>user_unblock</c> event is not triggered when
+ <p>The event <c>user_unblock</c> is not triggered when
a user is removed from the block list explicitly using the
<c>unblock_user</c> function.</p>
</note>
diff --git a/lib/inets/doc/src/notes.xml b/lib/inets/doc/src/notes.xml
index d1bfa28013..ef11fdc10c 100644
--- a/lib/inets/doc/src/notes.xml
+++ b/lib/inets/doc/src/notes.xml
@@ -33,7 +33,95 @@
<file>notes.xml</file>
</header>
- <section><title>Inets 6.0</title>
+ <section><title>Inets 6.0.2</title>
+
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p>
+ Avoid crash in mod_auth_server and mod_security_server
+ due to using an atom instead of a string when creating a
+ name.</p>
+ <p>
+ Own Id: OTP-13022</p>
+ </item>
+ </list>
+ </section>
+
+
+ <section><title>Improvements and New Features</title>
+ <list>
+ <item>
+ <p>
+ Add function response_default_headers/0 to httpd
+ customize API, to allow user to specify default values
+ for HTTP response headers.</p>
+ <p>
+ Own Id: OTP-13013</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
+<section><title>Inets 6.0.1</title>
+
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p>
+ Fix broken socket feature, that is on Linux systems a
+ socket may be opened before starting Erlang and then
+ passed to Erlang's httpd daemon. This is useful as the
+ wrap program can open a privileged port and Erlang does
+ not have to be run as root.</p>
+ <p>
+ Own Id: OTP-12875 Aux Id: seq12878 </p>
+ </item>
+ <item>
+ <p>
+ Fix broken socket feature, that is on Linux systems a
+ socket may be opened before starting Erlang and then
+ passed to Erlangs tftp daemon. This is useful as the wrap
+ program can open a privileged port and Erlang does not
+ have to be run as root.</p>
+ <p>
+ Own Id: OTP-12898 Aux Id: seq12900 </p>
+ </item>
+ <item>
+ <p>
+ httpc_handler should react properly to cancel requests
+ even when the request to be canceled was already finished
+ but httpc_manager did not get notified about that yet.</p>
+ <p>
+ Own Id: OTP-12922</p>
+ </item>
+ </list>
+ </section>
+
+
+ <section><title>Improvements and New Features</title>
+ <list>
+ <item>
+ <p>
+ Added format_status function to httpd process to avoid
+ sensitive information to be printed in supervisor logs.</p>
+ <p>
+ Own Id: OTP-12976</p>
+ </item>
+ <item>
+ <p>
+ Return meaningful error reason disregarding whether a
+ http proxy is used or not.</p>
+ <p>
+ Own Id: OTP-12984</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
+<section><title>Inets 6.0</title>
<section><title>Fixed Bugs and Malfunctions</title>
<list>
@@ -765,9 +853,9 @@
<p>Better handling of errorI(s) during update of the session
database. </p>
<p>Also added and updated some debugging functions
- <seealso marker="httpc#which_sessions">which_sessions/10,1</seealso>
+ <seealso marker="httpc#which_sessions-0">which_sessions/[0,1]</seealso>
and
- <seealso marker="httpc#info">info/0</seealso>. </p>
+ <seealso marker="httpc#info-0">info/0</seealso>. </p>
<p>Own Id: OTP-10093</p>
<p>Aux Id: Seq 12062</p>
</item>
@@ -861,7 +949,7 @@
<item>
<p>[httpc] Add function for retrieving current options,
- <seealso marker="httpc#get_options">get_options/1,2</seealso>. </p>
+ <seealso marker="httpc#get_options-1">get_options/[1,2]</seealso>. </p>
<p>Own Id: OTP-9979</p>
</item>
@@ -1038,15 +1126,11 @@
<section>
<title>Incompatibilities</title>
-<!--
- <p>-</p>
--->
-
<list>
<item>
<p>[httpc] Deprecated interface module <c>http</c> has been removed.
It has (long) been replaced by http client interface module
- <seealso marker="httpc#">httpc</seealso>. </p>
+ <seealso marker="httpc">httpc</seealso>. </p>
<p>Own Id: OTP-9359</p>
</item>
@@ -1234,15 +1318,13 @@
<section><title>Inets 5.6</title>
<section><title>Improvements and New Features</title>
-<!--
- <p>-</p>
--->
+
<list>
<item>
<p>[httpc] Add support for upload body streaming (PUT and POST).</p>
<p>For more info,
see the definition of the <c>Body</c> argument of the
- <seealso marker="httpc#request2">request/4,5</seealso>
+ <seealso marker="httpc#request-4">request/[4,5]</seealso>
function. </p>
<p>Filipe David Manana</p>
<p>Own Id: OTP-9094</p>
@@ -1255,7 +1337,7 @@
<item>
<p>[httpd]
- <seealso marker="mod_esi#deliver">mod_esi:deliver/2</seealso>
+ <seealso marker="mod_esi#deliver-2">mod_esi:deliver/2</seealso>
made to accept binary data. </p>
<p>Bernard Duggan</p>
<p>Own Id: OTP-9123</p>
@@ -1283,7 +1365,7 @@
for using file descriptors has been improved.
It is now possible to add the file descriptor to the config
(option fd) when calling the
- <seealso marker="inets#start2">inets:start(httpd, ...)</seealso>
+ <seealso marker="inets#start-2">inets:start(httpd, ...)</seealso>
function. </p>
<p>Attila Rajmund Nohl</p>
<p>Own Id: OTP-9202</p>
@@ -1297,7 +1379,7 @@
<p>See the httpd
<seealso marker="httpd#props_comm">socket_type</seealso>
communication property or the httpc
- <seealso marker="httpc#request2">request/4,5</seealso> function
+ <seealso marker="httpc#request-4">request/[4,5]</seealso> function
for more info. </p>
<p>Own Id: OTP-9230</p>
<p>*** POTENTIAL INCOMPATIBILITY ***</p>
@@ -1497,7 +1579,7 @@
<p>[httpc|httpd] - Now allow the use of the "new" ssl, by using
the <c>essl</c> tag instead. </p>
<p>See the <c>http_option</c> option in the
- <seealso marker="httpc#request2">request/4,5</seealso> or
+ <seealso marker="httpc#request-4">request/[4,5]</seealso> or
the <seealso marker="httpd#props_comm">socket-type</seealso>
section of the Communication properties chapter for more info, </p>
<p>Own Id: OTP-7907</p>
@@ -1729,8 +1811,8 @@
<p>[httpc] - Allow users to pass socket options to the transport
module when making requests. </p>
<p>See the <c>socket_opts</c> option in the
- <seealso marker="httpc#request2">request/4</seealso> or
- <seealso marker="httpc#set_options">set_options/1,2</seealso>
+ <seealso marker="httpc#request-4">request/4</seealso> or
+ <seealso marker="httpc#set_options-1">set_options/[1,2]</seealso>
for more info, </p>
<p>Own Id: OTP-8352</p>
</item>
@@ -1771,7 +1853,7 @@
deliver an async reply to more receivers then the calling
process. </p>
<p>See the
- <seealso marker="httpc#request2">receiver</seealso>
+ <seealso marker="httpc#request-2">receiver</seealso>
option for more info, </p>
<p>Own Id: OTP-8106</p>
</item>
@@ -2040,7 +2122,7 @@
request, when the client connects to the server. Default
value is that of the <c>timeout</c> option. </p>
<p>See the
- <seealso marker="httpc#request2">request/4,5</seealso>
+ <seealso marker="httpc#request-4">request/[4,5]</seealso>
function for more info. </p>
<p>Own Id: OTP-7298</p>
<!-- <p>Aux Id: seq11086</p> -->
@@ -2147,7 +2229,7 @@
the client connects to the server. </p>
<p>As a side-effect of this, the option <c>ipv6</c> has been
removed and replaced by the <c>ipfamily</c> option. </p>
- <p>See <seealso marker="httpc#set_options">http:set_options/1,2</seealso>
+ <p>See <seealso marker="httpc#set_options-1">http:set_options/[1,2]</seealso>
for more info. </p>
<p>*** POTENTIAL INCOMPATIBILITY ***</p>
<p>Own Id: OTP-8004</p>
diff --git a/lib/inets/doc/src/part.xml b/lib/inets/doc/src/part.xml
index 1640ff507c..3b817eecf2 100644
--- a/lib/inets/doc/src/part.xml
+++ b/lib/inets/doc/src/part.xml
@@ -30,10 +30,18 @@
<file>part.sgml</file>
</header>
<description>
- <p>The <em>Inets Application </em> provides a set of Internet
- related services. Currently supported are a HTTP client, a HTTP
- server a FTP client and a TFTP client and server.</p>
+ <p>The <c>Inets</c> application provides a set of
+ Internet-related services as follows:</p>
+ <list type="bulleted">
+ <item>An FTP client</item>
+ <item>A TFTP client and server</item>
+ <item>An <term id="HTTP"></term> client and server</item>
+ </list>
+ <p>The HTTP client and server are HTTP 1.1 compliant as
+ defined in
+ <url href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</url>.</p>
</description>
+ <xi:include href="introduction.xml"/>
<xi:include href="inets_services.xml"/>
<xi:include href="ftp_client.xml"/>
<xi:include href="http_client.xml"/>
diff --git a/lib/inets/doc/src/ref_man.xml b/lib/inets/doc/src/ref_man.xml
index bcebcc0fd4..27021ea09a 100644
--- a/lib/inets/doc/src/ref_man.xml
+++ b/lib/inets/doc/src/ref_man.xml
@@ -30,16 +30,15 @@
<file>ref_man.xml</file>
</header>
<description>
- <p>Inets is a container for Internet clients and
- servers. Currently a FTP client, a HTTP client and server, and
- a tftp client and server has been incorporated in Inets.</p>
+ <p><c>Inets</c> is a container for Internet clients and
+ servers. An FTP client, an HTTP client and server, and
+ a TFTP client and server are incorporated in <c>Inets</c>.</p>
</description>
<xi:include href="inets.xml"/>
<xi:include href="ftp.xml"/>
<xi:include href="tftp.xml"/>
<xi:include href="httpc.xml"/>
<xi:include href="httpd.xml"/>
- <xi:include href="httpd_conf.xml"/>
<xi:include href="httpd_custom_api.xml"/>
<xi:include href="httpd_socket.xml"/>
<xi:include href="httpd_util.xml"/>
diff --git a/lib/inets/doc/src/tftp.xml b/lib/inets/doc/src/tftp.xml
index e70712fd1e..00d9d53376 100644
--- a/lib/inets/doc/src/tftp.xml
+++ b/lib/inets/doc/src/tftp.xml
@@ -29,173 +29,170 @@
<rev></rev>
</header>
<module>tftp</module>
- <modulesummary>Trivial FTP</modulesummary>
+ <modulesummary>Trivial FTP.</modulesummary>
<description>
<p>This is a complete implementation of the following IETF standards:</p>
<list type="bulleted">
- <item>RFC 1350, The TFTP Protocol (revision 2).</item>
- <item>RFC 2347, TFTP Option Extension.</item>
- <item>RFC 2348, TFTP Blocksize Option.</item>
- <item>RFC 2349, TFTP Timeout Interval and Transfer Size Options.</item>
+ <item>RFC 1350, The TFTP Protocol (revision 2)</item>
+ <item>RFC 2347, TFTP Option Extension</item>
+ <item>RFC 2348, TFTP Blocksize Option</item>
+ <item>RFC 2349, TFTP Timeout Interval and Transfer Size Options</item>
</list>
- <p>The only feature that not is implemented in this release is
+ <p>The only feature that not is implemented is
the "netascii" transfer mode.</p>
<p>The <seealso marker="#start/1">start/1</seealso> function starts
- a daemon process which listens for UDP packets on a port. When it
- receives a request for read or write it spawns a temporary server
- process which handles the actual transfer of the file.</p>
- <p>On the client side
- the <seealso marker="#read_file/3">read_file/3</seealso>
+ a daemon process listening for UDP packets on a port. When it
+ receives a request for read or write, it spawns a temporary server
+ process handling the transfer.</p>
+ <p>On the client side,
+ function <seealso marker="#read_file/3">read_file/3</seealso>
and <seealso marker="#write_file/3">write_file/3</seealso>
- functions spawns a temporary client process which establishes
- contact with a TFTP daemon and performs the actual transfer of
- the file.</p>
- <p><c>tftp</c> uses a callback module to handle the actual file
+ spawn a temporary client process establishing
+ contact with a TFTP daemon and perform the file transfer.</p>
+ <p><c>tftp</c> uses a callback module to handle the file
transfer. Two such callback modules are provided,
<c>tftp_binary</c> and <c>tftp_file</c>. See
<seealso marker="#read_file/3">read_file/3</seealso> and
- <seealso marker="#write_file/3">write_file/3</seealso> for
- more information about these. The user can also implement own
- callback modules, see <seealso marker="#tftp_callback">CALLBACK FUNCTIONS</seealso> below. A callback module provided by
- the user is registered using the <c>callback</c> option, see
- <seealso marker="#options">DATA TYPES</seealso> below.</p>
+ <seealso marker="#write_file/3">write_file/3</seealso> for details.
+ You can also implement your own callback modules, see
+ <seealso marker="#tftp_callback">CALLBACK FUNCTIONS</seealso>.
+ A callback module provided by
+ the user is registered using option <c>callback</c>, see
+ <seealso marker="#options">DATA TYPES</seealso>.</p>
</description>
<section>
- <title>TFTP SERVER SERVICE START/STOP </title>
+ <title>TFTP SERVER SERVICE START/STOP</title>
<p>A TFTP server can be configured to start statically when starting
- the Inets application. Alternatively it can be started dynamically
- (when Inets already is started) by calling the Inets application API
- <c>inets:start(tftpd, ServiceConfig)</c>, or
+ the <c>Inets</c> application. Alternatively, it can be started dynamically
+ (when <c>Inets</c> is already started) by calling the <c>Inets</c> application
+ API <c>inets:start(tftpd, ServiceConfig)</c> or
<c>inets:start(tftpd, ServiceConfig, How)</c>,
see <seealso marker="inets">inets(3)</seealso> for details.
- The <c>ServiceConfig</c> for TFTP is described below in
- the <seealso marker="#options">COMMON DATA TYPES</seealso>
+ The <c>ServiceConfig</c> for TFTP is described in
+ the <seealso marker="#options">DATA TYPES</seealso>
section.</p>
<p>The TFTP server can be stopped using <c>inets:stop(tftpd, Pid)</c>,
see <seealso marker="inets">inets(3)</seealso> for details.</p>
<p>The TPFT client is of such a temporary nature that it is not
- handled as a service in the Inets service framework.</p>
+ handled as a service in the <c>Inets</c> service framework.</p>
</section>
<section>
<marker id="options"></marker>
- <title>COMMON DATA TYPES</title>
- <pre>
- ServiceConfig = Options
- Options = [option()]
- option() -- see below
- </pre>
+ <title>DATA TYPES</title>
+ <p><c>ServiceConfig = Options</c></p>
+ <p><c>Options = [option()]</c></p>
<p>Most of the options are common for both the client and the server
- side, but some of them differs a little. Here are the available
- options:</p>
+ side, but some of them differs a little.
+ The available <c>option()</c>s are as follows:</p>
<taglist>
<tag><c>{debug, Level}</c></tag>
<item>
<p><c>Level = none | error | warning | brief | normal | verbose | all</c></p>
- <p>Controls the level of debug printouts. The default is
- <c>none</c>.</p>
+ <p>Controls the level of debug printouts.
+ Default is <c>none</c>.</p>
</item>
<tag><c>{host, Host}</c></tag>
<item>
- <p><c>Host = hostname()</c> see
- <seealso marker="kernel:inet">inet(3)</seealso></p>
+ <p><c>Host = hostname()</c>, see
+ <seealso marker="kernel:inet">inet(3)</seealso>.</p>
<p>The name or IP address of the host where the TFTP daemon
resides. This option is only used by the client.</p>
</item>
<tag><c>{port, Port}</c></tag>
<item>
<p><c>Port = int()</c></p>
- <p>The TFTP port where the daemon listens. It defaults to
- the standardized number 69. On the server side it may
- sometimes make sense to set it to 0, which means that
- the daemon just will pick a free port (which one is
- returned by the <c>info/1</c> function).</p>
- <p>If a socket has somehow already has been connected, the
- {udp, [{fd, integer()}]} option can be used to pass the
- open file descriptor to gen_udp. This can be automated
- a bit by using a command line argument stating the
+ <p>The TFTP port where the daemon listens. Defaults is
+ the standardized number 69. On the server side, it can
+ sometimes make sense to set it to 0, meaning that
+ the daemon just picks a free port (which one is
+ returned by function <c>info/1</c>).</p>
+ <p>If a socket is connected already, option
+ <c>{udp, [{fd, integer()}]}</c> can be used to pass the
+ open file descriptor to <c>gen_udp</c>. This can be automated
+ by using a command-line argument stating the
prebound file descriptor number. For example, if the
- Port is 69 and the file descriptor 22 has been opened by
- setuid_socket_wrap. Then the command line argument
- "-tftpd_69 22" will trigger the prebound file
+ port is 69 and file descriptor 22 is opened by
+ <c>setuid_socket_wrap</c>, the command-line argument
+ "-tftpd_69 22" triggers the prebound file
descriptor 22 to be used instead of opening port 69.
- The UDP option {udp, [{fd, 22}]} automatically be added.
- See init:get_argument/ about command line arguments and
- gen_udp:open/2 about UDP options.</p>
+ The UDP option <c>{udp, [{fd, 22}]}</c> is automatically added.
+ See <c>init:get_argument/</c> about command-line arguments and
+ <c>gen_udp:open/2</c> about UDP options.</p>
</item>
<tag><c>{port_policy, Policy}</c></tag>
<item>
- <p><c>Policy = random | Port | {range, MinPort, MaxPort}</c> <br></br>
-<c>Port = MinPort = MaxPort = int()</c></p>
- <p>Policy for the selection of the temporary port which is used
- by the server/client during the file transfer. It defaults to
- <c>random</c> which is the standardized policy. With this
- policy a randomized free port used. A single port or a range
- of ports can be useful if the protocol should pass through a
+ <p><c>Policy = random | Port | {range, MinPort, MaxPort}</c></p>
+ <p><c>Port = MinPort = MaxPort = int()</c></p>
+ <p>Policy for the selection of the temporary port that is used
+ by the server/client during the file transfer. Default is
+ <c>random</c>, which is the standardized policy. With this
+ policy a randomized free port is used. A single port or a range
+ of ports can be useful if the protocol passes through a
firewall.</p>
</item>
<tag><c>{udp, Options}</c></tag>
<item>
- <p><c>Options = [Opt]</c> see
- <seealso marker="kernel:gen_udp#open/1">gen_udp:open/2</seealso></p>
+ <p><c>Options = [Opt]</c>, see
+ <seealso marker="kernel:gen_udp#open/1">gen_udp:open/2</seealso>.</p>
</item>
<tag><c>{use_tsize, Bool}</c></tag>
<item>
<p><c>Bool = bool()</c></p>
- <p>Flag for automated usage of the <c>tsize</c> option. With
- this set to true, the <c>write_file/3</c> client will
- determine the filesize and send it to the server as
+ <p>Flag for automated use of option <c>tsize</c>. With
+ this set to <c>true</c>, the <c>write_file/3</c> client
+ determines the filesize and sends it to the server as
the standardized <c>tsize</c> option. A <c>read_file/3</c>
- client will just acquire filesize from the server by sending
+ client acquires only a filesize from the server by sending
a zero <c>tsize</c>.</p>
</item>
<tag><c>{max_tsize, MaxTsize}</c></tag>
<item>
<p><c>MaxTsize = int() | infinity</c></p>
<p>Threshold for the maximal filesize in bytes. The transfer
- will be aborted if the limit is exceeded. It defaults to
- <c>infinity</c>.</p>
+ is aborted if the limit is exceeded.
+ Default is <c>infinity</c>.</p>
</item>
<tag><c>{max_conn, MaxConn}</c></tag>
<item>
<p><c>MaxConn = int() | infinity</c></p>
<p>Threshold for the maximal number of active connections.
- The daemon will reject the setup of new connections if
- the limit is exceeded. It defaults to <c>infinity</c>.</p>
+ The daemon rejects the setup of new connections if
+ the limit is exceeded. Default is <c>infinity</c>.</p>
</item>
<tag><c>{TftpKey, TftpVal}</c></tag>
<item>
<p><c>TftpKey = string()</c> <br></br>
<c>TftpVal = string()</c></p>
- <p>The name and value of a TFTP option.</p>
+ <p>Name and value of a TFTP option.</p>
</item>
<tag><c>{reject, Feature}</c></tag>
<item>
<p><c>Feature = Mode | TftpKey</c> <br></br>
<c>&nbsp;Mode = read | write</c> <br></br>
<c>&nbsp;TftpKey = string()</c></p>
- <p>Control which features that should be rejected. This is
- mostly useful for the server as it may restrict usage of
- certain TFTP options or read/write access.</p>
+ <p>Controls which features to reject. This is
+ mostly useful for the server as it can restrict the use
+ of certain TFTP options or read/write access.</p>
</item>
<tag><c>{callback, {RegExp, Module, State}}</c></tag>
<item>
<p><c>RegExp = string()</c> <br></br>
<c>Module = atom()</c> <br></br>
-<c>State = term()</c></p>
+<c>State = term()</c></p>
<p>Registration of a callback module. When a file is to be
- transferred, its local filename will be matched to the regular
+ transferred, its local filename is matched to the regular
expressions of the registered callbacks. The first matching
- callback will be used the during the transfer. See
+ callback is used during the transfer. See
<seealso marker="#read_file/3">read_file/3</seealso> and
<seealso marker="#write_file/3">write_file/3</seealso>.
</p>
- <p>The callback module must implement the <c>tftp</c> behavior,
+ <p>The callback module must implement the <c>tftp</c> behavior, see
<seealso marker="#tftp_callback">CALLBACK FUNCTIONS</seealso>.</p>
</item>
@@ -203,9 +200,9 @@
<item>
<p><c>Module = module()()</c></p>
- <p>Callback module for customized logging of error, warning and
- info messages. >The callback module must implement the
- <c>tftp_logger</c> behavior,
+ <p>Callback module for customized logging of errors, warnings, and
+ info messages. The callback module must implement the
+ <c>tftp_logger</c> behavior, see
<seealso marker="#tftp_logger">LOGGER FUNCTIONS</seealso>.
The default module is <c>tftp_logger</c>.</p>
</item>
@@ -215,8 +212,8 @@
<p><c>MaxRetries = int()</c></p>
<p>Threshold for the maximal number of retries. By default
- the server/client will try to resend a message up to
- <c>5</c> times when the timeout expires.</p>
+ the server/client tries to resend a message up to
+ five times when the time-out expires.</p>
</item>
</taglist>
@@ -224,98 +221,67 @@
</section>
<funcs>
+ <marker id="change_config_daemons"></marker>
<func>
- <name>start(Options) -> {ok, Pid} | {error, Reason}</name>
- <fsummary>Start a daemon process</fsummary>
+ <name>change_config(daemons, Options) -> [{Pid, Result}]</name>
+ <fsummary>Changes configuration for all daemons.
+ </fsummary>
<type>
<v>Options = [option()]</v>
<v>Pid = pid()</v>
+ <v>Result = ok | {error, Reason}</v>
<v>Reason = term()</v>
</type>
<desc>
- <p>Starts a daemon process which listens for udp packets on a
- port. When it receives a request for read or write it spawns
- a temporary server process which handles the actual transfer
- of the (virtual) file.</p>
+ <p>Changes configuration for all TFTP daemon processes. </p>
- <marker id="read_file"></marker>
+ <marker id="change_config_servers"></marker>
</desc>
</func>
<func>
- <name>read_file(RemoteFilename, LocalFilename, Options) -> {ok, LastCallbackState} | {error, Reason}</name>
- <fsummary>Read a (virtual) file from a TFTP server</fsummary>
+ <name>change_config(servers, Options) -> [{Pid, Result}]</name>
+ <fsummary>Changes configuration for all servers.
+ </fsummary>
<type>
- <v>RemoteFilename = string()</v>
- <v>LocalFilename = binary | string()</v>
<v>Options = [option()]</v>
- <v>LastCallbackState = term()</v>
+ <v>Pid = pid()</v>
+ <v>Result = ok | {error, Reason}</v>
<v>Reason = term()</v>
</type>
<desc>
- <p>Reads a (virtual) file <c>RemoteFilename</c> from a TFTP
- server.</p>
- <p>If <c>LocalFilename</c> is the atom <c>binary</c>,
- <c>tftp_binary</c> is used as callback module. It concatenates
- all transferred blocks and returns them as one single binary
- in <c>LastCallbackState</c>.</p>
- <p>If <c>LocalFilename</c> is a string and there are no
- registered callback modules, <c>tftp_file</c> is used as
- callback module. It writes each transferred block to the file
- named <c>LocalFilename</c> and returns the number of
- transferred bytes in <c>LastCallbackState</c>.</p>
- <p>If <c>LocalFilename</c> is a string and there are registered
- callback modules, <c>LocalFilename</c> is tested against
- the regexps of these and the callback module corresponding to
- the first match is used, or an error tuple is returned if no
- matching regexp is found.</p>
- </desc>
+ <p>Changes configuration for all TFTP server processes.</p>
- <marker id="write_file"></marker>
+ <marker id="change_config_pid"></marker>
+ </desc>
</func>
<func>
- <name>write_file(RemoteFilename, LocalFilename, Options) -> {ok, LastCallbackState} | {error, Reason}</name>
- <fsummary>Write a (virtual) file to a TFTP server</fsummary>
+ <name>change_config(Pid, Options) -> Result</name>
+ <fsummary>Changes configuration for a TFTP daemon, server,
+ or client process.</fsummary>
<type>
- <v>RemoteFilename = string()</v>
- <v>LocalFilename = binary() | string()</v>
+ <v>Pid = pid()</v>
<v>Options = [option()]</v>
- <v>LastCallbackState = term()</v>
+ <v>Result = ok | {error, Reason}</v>
<v>Reason = term()</v>
</type>
<desc>
- <p>Writes a (virtual) file <c>RemoteFilename</c> to a TFTP
- server.</p>
- <p>If <c>LocalFilename</c> is a binary, <c>tftp_binary</c> is
- used as callback module. The binary is transferred block by
- block and the number of transferred bytes is returned in
- <c>LastCallbackState</c>.</p>
- <p>If <c>LocalFilename</c> is a string and there are no
- registered callback modules, <c>tftp_file</c> is used as
- callback module. It reads the file named <c>LocalFilename</c>
- block by block and returns the number of transferred bytes
- in <c>LastCallbackState</c>.</p>
- <p>If <c>LocalFilename</c> is a string and there are registered
- callback modules, <c>LocalFilename</c> is tested against
- the regexps of these and the callback module corresponding to
- the first match is used, or an error tuple is returned if no
- matching regexp is found.</p>
-
+ <p>Changes configuration for a TFTP daemon, server, or client process.</p>
<marker id="info_daemons"></marker>
</desc>
</func>
-
+
<func>
<name>info(daemons) -> [{Pid, Options}]</name>
- <fsummary>Return information about all daemons</fsummary>
+ <fsummary>Returns information about all daemons.</fsummary>
<type>
<v>Pid = [pid()()]</v>
<v>Options = [option()]</v>
<v>Reason = term()</v>
</type>
<desc>
- <p>Returns info about all TFTP daemon processes. </p>
+ <p>Returns information about all TFTP daemon processes.</p>
<marker id="info_servers"></marker>
</desc>
@@ -323,14 +289,14 @@
<func>
<name>info(servers) -> [{Pid, Options}]</name>
- <fsummary>Return information about all servers</fsummary>
+ <fsummary>Returns information about all servers.</fsummary>
<type>
<v>Pid = [pid()()]</v>
<v>Options = [option()]</v>
<v>Reason = term()</v>
</type>
<desc>
- <p>Returns info about all TFTP server processes. </p>
+ <p>Returns information about all TFTP server processes. </p>
<marker id="info_pid"></marker>
</desc>
@@ -338,117 +304,136 @@
<func>
<name>info(Pid) -> {ok, Options} | {error, Reason}</name>
- <fsummary>Return information about a daemon, server or client process</fsummary>
+ <fsummary>Returns information about a daemon, server, or client process.</fsummary>
<type>
<v>Options = [option()]</v>
<v>Reason = term()</v>
</type>
<desc>
- <p>Returns info about a TFTP daemon, server or client process.</p>
-
- <marker id="change_config_daemons"></marker>
+ <p>Returns information about a TFTP daemon, server, or client process.</p>
</desc>
</func>
-
- <func>
- <name>change_config(daemons, Options) -> [{Pid, Result}]</name>
- <fsummary>Changes config for all daemons
- </fsummary>
+
+ <func>
+ <name>read_file(RemoteFilename, LocalFilename, Options) -> {ok, LastCallbackState} | {error, Reason}</name>
+ <fsummary>Reads a (virtual) file from a TFTP server.</fsummary>
<type>
+ <v>RemoteFilename = string()</v>
+ <v>LocalFilename = binary | string()</v>
<v>Options = [option()]</v>
- <v>Pid = pid()</v>
- <v>Result = ok | {error, Reason}</v>
+ <v>LastCallbackState = term()</v>
<v>Reason = term()</v>
</type>
<desc>
- <p>Changes config for all TFTP daemon processes. </p>
-
- <marker id="change_config_servers"></marker>
+ <p>Reads a (virtual) file <c>RemoteFilename</c> from a TFTP
+ server.</p>
+ <p>If <c>LocalFilename</c> is the atom <c>binary</c>,
+ <c>tftp_binary</c> is used as callback module. It concatenates
+ all transferred blocks and returns them as one single binary
+ in <c>LastCallbackState</c>.</p>
+ <p>If <c>LocalFilename</c> is a string and there are no
+ registered callback modules, <c>tftp_file</c> is used as
+ callback module. It writes each transferred block to the file
+ named <c>LocalFilename</c> and returns the number of
+ transferred bytes in <c>LastCallbackState</c>.</p>
+ <p>If <c>LocalFilename</c> is a string and there are registered
+ callback modules, <c>LocalFilename</c> is tested against
+ the regexps of these and the callback module corresponding to
+ the first match is used, or an error tuple is returned if no
+ matching regexp is found.</p>
</desc>
+
+ <marker id="write_file"></marker>
</func>
-
+
<func>
- <name>change_config(servers, Options) -> [{Pid, Result}]</name>
- <fsummary>Changes config for all servers
- </fsummary>
+ <name>start(Options) -> {ok, Pid} | {error, Reason}</name>
+ <fsummary>Starts a daemon process.</fsummary>
<type>
<v>Options = [option()]</v>
<v>Pid = pid()</v>
- <v>Result = ok | {error, Reason}</v>
<v>Reason = term()</v>
</type>
<desc>
- <p>Changes config for all TFTP server processes. </p>
+ <p>Starts a daemon process listening for UDP packets on a
+ port. When it receives a request for read or write, it spawns
+ a temporary server process handling the actual transfer
+ of the (virtual) file.</p>
- <marker id="change_config_pid"></marker>
+ <marker id="read_file"></marker>
</desc>
</func>
<func>
- <name>change_config(Pid, Options) -> Result</name>
- <fsummary>Changes config for a TFTP daemon, server or client process</fsummary>
+ <name>write_file(RemoteFilename, LocalFilename, Options) -> {ok, LastCallbackState} | {error, Reason}</name>
+ <fsummary>Writes a (virtual) file to a TFTP server.</fsummary>
<type>
- <v>Pid = pid()</v>
+ <v>RemoteFilename = string()</v>
+ <v>LocalFilename = binary() | string()</v>
<v>Options = [option()]</v>
- <v>Result = ok | {error, Reason}</v>
- <v>Reason = term()</v>
- </type>
- <desc>
- <p>Changes config for a TFTP daemon, server or client process</p>
-
- <marker id="start2"></marker>
- </desc>
- </func>
-
- <func>
- <name>start() -> ok | {error, Reason}</name>
- <fsummary>Start the Inets application</fsummary>
- <type>
+ <v>LastCallbackState = term()</v>
<v>Reason = term()</v>
</type>
<desc>
- <p>Starts the Inets application.</p>
+ <p>Writes a (virtual) file <c>RemoteFilename</c> to a TFTP
+ server.</p>
+ <p>If <c>LocalFilename</c> is a binary, <c>tftp_binary</c> is
+ used as callback module. The binary is transferred block by
+ block and the number of transferred bytes is returned in
+ <c>LastCallbackState</c>.</p>
+ <p>If <c>LocalFilename</c> is a string and there are no
+ registered callback modules, <c>tftp_file</c> is used as
+ callback module. It reads the file named <c>LocalFilename</c>
+ block by block and returns the number of transferred bytes
+ in <c>LastCallbackState</c>.</p>
+ <p>If <c>LocalFilename</c> is a string and there are registered
+ callback modules, <c>LocalFilename</c> is tested against
+ the regexps of these and the callback module corresponding to
+ the first match is used, or an error tuple is returned if no
+ matching regexp is found.</p>
</desc>
</func>
+
</funcs>
<section>
<marker id="tftp_callback"></marker>
<title>CALLBACK FUNCTIONS</title>
- <p>A <c>tftp</c> callback module should be implemented as a
- <c>tftp</c> behavior and export the functions listed below.</p>
- <p>On the server side the callback interaction starts with a call to
+ <p>A <c>tftp</c> callback module is to be implemented as a
+ <c>tftp</c> behavior and export the functions listed
+ in the following.</p>
+ <p>On the server side, the callback interaction starts with a call to
<c>open/5</c> with the registered initial callback state.
<c>open/5</c> is expected to open the (virtual) file. Then either
- the <c>read/1</c> or <c>write/2</c> functions are invoked
- repeatedly, once per transferred block. At each function call
+ function <c>read/1</c> or <c>write/2</c> is invoked
+ repeatedly, once per transferred block. At each function call,
the state returned from the previous call is obtained. When
- the last block has been encountered the <c>read/1</c> or
- <c>write/2</c> functions is expected to close the (virtual) file
- and return its last state. The <c>abort/3</c> function is only
- used in error situations. <c>prepare/5</c> is not used on
+ the last block is encountered, function <c>read/1</c> or
+ <c>write/2</c> is expected to close the (virtual) file
+ and return its last state. Function <c>abort/3</c> is only
+ used in error situations. Function <c>prepare/5</c> is not used on
the server side.</p>
- <p>On the client side the callback interaction is the same, but it
+ <p>On the client side, the callback interaction is the same, but it
starts and ends a bit differently. It starts with a call to
<c>prepare/5</c> with the same arguments as <c>open/5</c> takes.
- <c>prepare/5</c> is expected to validate the TFTP options,
- suggested by the user and return the subset of them that it
- accepts. Then the options is sent to the server which will perform
+ <c>prepare/5</c> is expected to validate the TFTP options
+ suggested by the user and to return the subset of them that it
+ accepts. Then the options are sent to the server, which performs
the same TFTP option negotiation procedure. The options that are
- accepted by the server are forwarded to the <c>open/5</c> function
- on the client side. On the client side the <c>open/5</c> function
- must accept all option as is or reject the transfer. Then
+ accepted by the server are forwarded to function <c>open/5</c>
+ on the client side. On the client side, function <c>open/5</c>
+ must accept all option as-is or reject the transfer. Then
the callback interaction follows the same pattern as described
- above for the server side. When the last block is encountered in
- <c>read/1</c> or <c>write/2</c> the returned state is forwarded to
+ for the server side. When the last block is encountered in
+ <c>read/1</c> or <c>write/2</c>, the returned state is forwarded to
the user and returned from <c>read_file</c>/3 or
<c>write_file/3</c>.</p>
- <p> If a callback (which performs the file access
+ <p> If a callback (performing the file access
in the TFTP server) takes too long time (more than
- the double TFTP timeout), the server will abort the
- connection and send an error reply to the client.
- This implies that the server will release resources
+ the double TFTP time-out), the server aborts the
+ connection and sends an error reply to the client.
+ This implies that the server releases resources
attached to the connection faster than before. The
server simply assumes that the client has given
up.</p>
@@ -456,21 +441,45 @@
<p>If the TFTP server receives yet another request from
the same client (same host and port) while it
already has an active connection to the client, it
- will simply ignore the new request if the request is
- equal with the first one (same filename and options).
+ ignores the new request if the request is
+ equal to the first one (same filename and options).
This implies that the (new) client will be served
by the already ongoing connection on the server
side. By not setting up yet another connection, in
- parallel with the ongoing one, the server will
- consumer lesser resources. </p>
+ parallel with the ongoing one, the server
+ consumes less resources.</p>
<marker id="prepare"></marker>
</section>
<funcs>
- <func>
- <name>prepare(Peer, Access, Filename, Mode, SuggestedOptions, InitialState) -> {ok, AcceptedOptions, NewState} | {error, {Code, Text}}</name>
- <fsummary>Prepare to open a file on the client side</fsummary>
+ <func>
+ <name>Module:abort(Code, Text, State) -> ok</name>
+ <fsummary>Aborts the file transfer.</fsummary>
+ <type>
+ <v>Code = undef | enoent | eacces | enospc</v>
+ <v>&nbsp;&nbsp;| badop | eexist | baduser | badopt</v>
+ <v>&nbsp;&nbsp;| int()</v>
+ <v>Text = string()</v>
+ <v>State = term()</v>
+ </type>
+ <desc>
+ <p>Invoked when the file transfer is aborted.</p>
+ <p>The callback function is expected to clean
+ up its used resources after the aborted file
+ transfer, such as closing open file
+ descriptors and so on. The function is not
+ invoked if any of the other callback
+ functions returns an error, as it is
+ expected that they already have cleaned up
+ the necessary resources. However, it is
+ invoked if the functions fail (crash).</p>
+ </desc>
+ </func>
+
+ <func>
+ <name>Module:open(Peer, Access, Filename, Mode, SuggestedOptions, State) -> {ok, AcceptedOptions, NewState} | {error, {Code, Text}}</name>
+ <fsummary>Opens a file for read or write access.</fsummary>
<type>
<v>Peer = {PeerType, PeerHost, PeerPort}</v>
<v>PeerType = inet | inet6</v>
@@ -481,7 +490,8 @@
<v>Mode = string()</v>
<v>SuggestedOptions = AcceptedOptions = [{Key, Value}]</v>
<v>&nbsp;Key = Value = string()</v>
- <v>InitialState = [] | [{root_dir, string()}]</v>
+ <v>State = InitialState | term()</v>
+ <v>&nbsp;InitialState = [] | [{root_dir, string()}]</v>
<v>NewState = term()</v>
<v>Code = undef | enoent | eacces | enospc</v>
<v>&nbsp;&nbsp;| badop | eexist | baduser | badopt</v>
@@ -489,23 +499,22 @@
<v>Text = string()</v>
</type>
<desc>
- <p>Prepares to open a file on the client side.</p>
- <p>No new options may be added, but the ones that are present in
- <c>SuggestedOptions</c> may be omitted or replaced with new
- values in <c>AcceptedOptions</c>.</p>
- <p>Will be followed by a call to <c>open/4</c> before any
- read/write access is performed. <c>AcceptedOptions</c> is
- sent to the server which replies with those options that it
- accepts. These will be forwarded to <c>open/4</c> as
- <c>SuggestedOptions</c>.</p>
+ <p>Opens a file for read or write access.</p>
+ <p>On the client side, where the <c>open/5</c> call has been
+ preceded by a call to <c>prepare/5</c>, all options must be
+ accepted or rejected.</p>
+ <p>On the server side, where there is no preceding
+ <c>prepare/5</c> call, no new options can be added, but
+ those present in <c>SuggestedOptions</c> can be
+ omitted or replaced with new values in <c>AcceptedOptions</c>.</p>
- <marker id="open"></marker>
+ <marker id="read"></marker>
</desc>
</func>
-
+
<func>
- <name>open(Peer, Access, Filename, Mode, SuggestedOptions, State) -> {ok, AcceptedOptions, NewState} | {error, {Code, Text}}</name>
- <fsummary>Open a file for read or write access</fsummary>
+ <name>Module:prepare(Peer, Access, Filename, Mode, SuggestedOptions, InitialState) -> {ok, AcceptedOptions, NewState} | {error, {Code, Text}}</name>
+ <fsummary>Prepares to open a file on the client side.</fsummary>
<type>
<v>Peer = {PeerType, PeerHost, PeerPort}</v>
<v>PeerType = inet | inet6</v>
@@ -516,8 +525,7 @@
<v>Mode = string()</v>
<v>SuggestedOptions = AcceptedOptions = [{Key, Value}]</v>
<v>&nbsp;Key = Value = string()</v>
- <v>State = InitialState | term()</v>
- <v>&nbsp;InitialState = [] | [{root_dir, string()}]</v>
+ <v>InitialState = [] | [{root_dir, string()}]</v>
<v>NewState = term()</v>
<v>Code = undef | enoent | eacces | enospc</v>
<v>&nbsp;&nbsp;| badop | eexist | baduser | badopt</v>
@@ -525,22 +533,23 @@
<v>Text = string()</v>
</type>
<desc>
- <p>Opens a file for read or write access.</p>
- <p>On the client side where the <c>open/5</c> call has been
- preceded by a call to <c>prepare/5</c>, all options must be
- accepted or rejected.</p>
- <p>On the server side, where there is no preceding
- <c>prepare/5</c> call, no new options may be added, but
- the ones that are present in <c>SuggestedOptions</c> may be
- omitted or replaced with new values in <c>AcceptedOptions</c>.</p>
+ <p>Prepares to open a file on the client side.</p>
+ <p>No new options can be added, but those present in
+ <c>SuggestedOptions</c> can be omitted or replaced with new
+ values in <c>AcceptedOptions</c>.</p>
+ <p>This is followed by a call to <c>open/4</c> before any
+ read/write access is performed. <c>AcceptedOptions</c> is
+ sent to the server, which replies with the options that it
+ accepts. These are then forwarded to <c>open/4</c> as
+ <c>SuggestedOptions</c>.</p>
- <marker id="read"></marker>
+ <marker id="open"></marker>
</desc>
</func>
<func>
- <name>read(State) -> {more, Bin, NewState} | {last, Bin, FileSize} | {error, {Code, Text}}</name>
- <fsummary>Read a chunk from the file</fsummary>
+ <name>Module:read(State) -> {more, Bin, NewState} | {last, Bin, FileSize} | {error, {Code, Text}}</name>
+ <fsummary>Reads a chunk from the file.</fsummary>
<type>
<v>State = NewState = term()</v>
<v>Bin = binary()</v>
@@ -551,13 +560,13 @@
<v>Text = string()</v>
</type>
<desc>
- <p>Read a chunk from the file.</p>
+ <p>Reads a chunk from the file.</p>
<p>The callback function is expected to close
the file when the last file chunk is
- encountered. When an error is encountered
+ encountered. When an error is encountered,
the callback function is expected to clean
up after the aborted file transfer, such as
- closing open file descriptors etc. In both
+ closing open file descriptors, and so on. In both
cases there will be no more calls to any of
the callback functions.</p>
@@ -566,8 +575,8 @@
</func>
<func>
- <name>write(Bin, State) -> {more, NewState} | {last, FileSize} | {error, {Code, Text}}</name>
- <fsummary>Write a chunk to the file</fsummary>
+ <name>Module:write(Bin, State) -> {more, NewState} | {last, FileSize} | {error, {Code, Text}}</name>
+ <fsummary>Writes a chunk to the file.</fsummary>
<type>
<v>Bin = binary()</v>
<v>State = NewState = term()</v>
@@ -578,99 +587,75 @@
<v>Text = string()</v>
</type>
<desc>
- <p>Write a chunk to the file.</p>
+ <p>Writes a chunk to the file.</p>
<p>The callback function is expected to close
the file when the last file chunk is
- encountered. When an error is encountered
+ encountered. When an error is encountered,
the callback function is expected to clean
up after the aborted file transfer, such as
- closing open file descriptors etc. In both
+ closing open file descriptors, and so on. In both
cases there will be no more calls to any of
the callback functions.</p>
<marker id="abort"></marker>
</desc>
</func>
-
- <func>
- <name>abort(Code, Text, State) -> ok</name>
- <fsummary>Abort the file transfer</fsummary>
- <type>
- <v>Code = undef | enoent | eacces | enospc</v>
- <v>&nbsp;&nbsp;| badop | eexist | baduser | badopt</v>
- <v>&nbsp;&nbsp;| int()</v>
- <v>Text = string()</v>
- <v>State = term()</v>
- </type>
- <desc>
- <p>Invoked when the file transfer is aborted.</p>
- <p>The callback function is expected to clean
- up its used resources after the aborted file
- transfer, such as closing open file
- descriptors etc. The function will not be
- invoked if any of the other callback
- functions returns an error, as it is
- expected that they already have cleaned up
- the necessary resources. It will however be
- invoked if the functions fails (crashes).</p>
- </desc>
- </func>
</funcs>
<section>
<marker id="tftp_logger"></marker>
<title>LOGGER FUNCTIONS</title>
- <p>A <c>tftp_logger</c> callback module should be implemented as a
- <c>tftp_logger</c> behavior and export the functions listed below.</p>
+ <p>A <c>tftp_logger</c> callback module is to be implemented as a
+ <c>tftp_logger</c> behavior and export the following functions:</p>
<marker id="error_msg"></marker>
</section>
<funcs>
<func>
- <name>error_msg(Format, Data) -> ok | exit(Reason)</name>
- <fsummary>Log an error message</fsummary>
+ <name>Logger:error_msg(Format, Data) -> ok | exit(Reason)</name>
+ <fsummary>Logs an error message.</fsummary>
<type>
<v>Format = string()</v>
<v>Data = [term()]</v>
<v>Reason = term()</v>
</type>
<desc>
- <p>Log an error message.
- See <c>error_logger:error_msg/2 for details.</c> </p>
+ <p>Logs an error message.
+ See <c>error_logger:error_msg/2</c> for details.</p>
<marker id="warning_msg"></marker>
</desc>
</func>
<func>
- <name>warning_msg(Format, Data) -> ok | exit(Reason)</name>
- <fsummary>Log an error message</fsummary>
+ <name>Logger:info_msg(Format, Data) -> ok | exit(Reason)</name>
+ <fsummary>Logs an info message.</fsummary>
<type>
<v>Format = string()</v>
<v>Data = [term()]</v>
<v>Reason = term()</v>
</type>
<desc>
- <p>Log a warning message.
- See <c>error_logger:warning_msg/2 for details.</c> </p>
-
- <marker id="info_msg"></marker>
+ <p>Logs an info message.
+ See <c>error_logger:info_msg/2</c> for details.</p>
</desc>
</func>
-
+
<func>
- <name>info_msg(Format, Data) -> ok | exit(Reason)</name>
- <fsummary>Log an error message</fsummary>
+ <name>Logger:warning_msg(Format, Data) -> ok | exit(Reason)</name>
+ <fsummary>Logs a warning message.</fsummary>
<type>
<v>Format = string()</v>
<v>Data = [term()]</v>
<v>Reason = term()</v>
</type>
<desc>
- <p>Log an info message.
- See <c>error_logger:info_msg/2 for details.</c> </p>
+ <p>Logs a warning message.
+ See <c>error_logger:warning_msg/2</c> for details.</p>
+
+ <marker id="info_msg"></marker>
</desc>
</func>
</funcs>
diff --git a/lib/inets/src/http_client/httpc_handler.erl b/lib/inets/src/http_client/httpc_handler.erl
index 205348524a..6e6cc38c06 100644
--- a/lib/inets/src/http_client/httpc_handler.erl
+++ b/lib/inets/src/http_client/httpc_handler.erl
@@ -1817,13 +1817,13 @@ host_header(_, URI) ->
tls_upgrade(#state{status =
{ssl_tunnel,
#request{settings =
- #http_options{ssl = {_, TLSOptions} = SocketType}} = Request},
+ #http_options{ssl = {_, TLSOptions} = SocketType},
+ address = Address} = Request},
session = #session{socket = TCPSocket} = Session0,
options = Options} = State) ->
case ssl:connect(TCPSocket, TLSOptions) of
{ok, TLSSocket} ->
- Address = Request#request.address,
ClientClose = httpc_request:is_client_closing(Request#request.headers),
SessionType = httpc_manager:session_type(Options),
Session = Session0#session{
@@ -1844,7 +1844,11 @@ tls_upgrade(#state{status =
status = new
},
{noreply, activate_request_timeout(NewState)};
- {error, _Reason} ->
+ {error, Reason} ->
+ Error = httpc_response:error(Request, {failed_connect,
+ [{to_address, Address},
+ {tls, TLSOptions, Reason}]}),
+ maybe_send_answer(Request, Error, State),
{stop, normal, State#state{request = Request}}
end.
diff --git a/lib/inets/src/http_client/httpc_response.erl b/lib/inets/src/http_client/httpc_response.erl
index 10af1949a4..4bf2ba2b9b 100644
--- a/lib/inets/src/http_client/httpc_response.erl
+++ b/lib/inets/src/http_client/httpc_response.erl
@@ -328,7 +328,7 @@ status_service_unavailable(Response = {_, Headers, _}, Request) ->
undefined ->
status_server_error_50x(Response, Request);
Time when (length(Time) < 3) -> % Wait only 99 s or less
- NewTime = list_to_integer(Time) * 100, % time in ms
+ NewTime = list_to_integer(Time) * 1000, % time in ms
{_, Data} = format_response(Response),
{retry, {NewTime, Request}, Data};
_ ->
diff --git a/lib/inets/src/http_lib/http_response.erl b/lib/inets/src/http_lib/http_response.erl
index 58b30c4e9e..d13670700c 100644
--- a/lib/inets/src/http_lib/http_response.erl
+++ b/lib/inets/src/http_lib/http_response.erl
@@ -31,16 +31,11 @@
%% Value - string()
%%
%% Description: Creates a http_response_h-record used internally to
-%% handle http-headers.
+%% handle http-headers, assumes reversed list of headers
+%% to unfold multiline headers with obs-folds
%%-------------------------------------------------------------------------
-headers([], Headers) ->
- Headers;
-
-headers([Header | Tail], Headers) ->
- {Key, [$: | Value]} =
- lists:splitwith(fun($:) -> false; (_) -> true end, Header),
- headers(Tail, headers(http_util:to_lower(string:strip(Key)),
- string:strip(Value), Headers)).
+headers(RevLines, Headers) ->
+ fill_headers(RevLines, [], Headers).
%%-------------------------------------------------------------------------
%% headers(#http_response_h{}) -> HeaderList
@@ -68,6 +63,23 @@ header_list(Headers) ->
%%%========================================================================
%%% Internal functions
%%%========================================================================
+fill_headers([], _, Headers) ->
+ Headers;
+fill_headers([[Ch|HeaderFold]|Tail], Folded, Headers)
+ when Ch == $\t; Ch == $\s ->
+ fill_headers(Tail, [HeaderFold|Folded], Headers);
+fill_headers([Header | Tail], Folded, Headers) ->
+ Unfolded = unfold([Header|Folded]),
+ {Key, [$: | Value]} =
+ lists:splitwith(fun($:) -> false; (_) -> true end, Unfolded),
+ fill_headers(Tail, [], headers(http_util:to_lower(string:strip(Key)),
+ string:strip(Value), Headers)).
+
+unfold([L]) ->
+ L;
+unfold(Folded) ->
+ string:join(Folded, " ").
+
headers("cache-control", Value, Headers) ->
Headers#http_response_h{'cache-control'= Value};
headers("connection", Value, Headers) ->
diff --git a/lib/inets/src/http_lib/http_transport.erl b/lib/inets/src/http_lib/http_transport.erl
index bbe3ec9e4c..719dc4c425 100644
--- a/lib/inets/src/http_lib/http_transport.erl
+++ b/lib/inets/src/http_lib/http_transport.erl
@@ -269,7 +269,7 @@ get_socket_info(Addr, Port, Fd) ->
undefined ->
{Port, sock_opts(Addr, BaseOpts)};
Fd ->
- {0, sock_opts(Addr, [{fd, Fd} | BaseOpts])}
+ {0, sock_opts([{fd, Fd} | BaseOpts])}
end.
%%-------------------------------------------------------------------------
diff --git a/lib/inets/src/http_lib/http_uri.erl b/lib/inets/src/http_lib/http_uri.erl
index 79591eec29..6fe8c1776d 100644
--- a/lib/inets/src/http_lib/http_uri.erl
+++ b/lib/inets/src/http_lib/http_uri.erl
@@ -138,16 +138,33 @@ parse_scheme(AbsURI, Opts) ->
{error, no_scheme} ->
{error, no_scheme};
{SchemeStr, Rest} ->
- Scheme = list_to_atom(http_util:to_lower(SchemeStr)),
- SchemeDefaults = which_scheme_defaults(Opts),
- case lists:keysearch(Scheme, 1, SchemeDefaults) of
- {value, {Scheme, DefaultPort}} ->
- {Scheme, DefaultPort, Rest};
- false ->
- {Scheme, no_default_port, Rest}
+ case extract_scheme(SchemeStr, Opts) of
+ {error, Error} ->
+ {error, Error};
+ {ok, Scheme} ->
+ SchemeDefaults = which_scheme_defaults(Opts),
+ case lists:keysearch(Scheme, 1, SchemeDefaults) of
+ {value, {Scheme, DefaultPort}} ->
+ {Scheme, DefaultPort, Rest};
+ false ->
+ {Scheme, no_default_port, Rest}
+ end
end
end.
+extract_scheme(Str, Opts) ->
+ case lists:keysearch(scheme_validation_fun, 1, Opts) of
+ {value, {scheme_validation_fun, Fun}} when is_function(Fun) ->
+ case Fun(Str) of
+ valid ->
+ {ok, list_to_atom(http_util:to_lower(Str))};
+ {error, Error} ->
+ {error, Error}
+ end;
+ _ ->
+ {ok, list_to_atom(http_util:to_lower(Str))}
+ end.
+
parse_uri_rest(Scheme, DefaultPort, "//" ++ URIPart, Opts) ->
{Authority, PathQueryFragment} =
split_uri(URIPart, "[/?#]", {URIPart, ""}, 1, 0),
diff --git a/lib/inets/src/http_server/Makefile b/lib/inets/src/http_server/Makefile
index b09877550d..b9f2290289 100644
--- a/lib/inets/src/http_server/Makefile
+++ b/lib/inets/src/http_server/Makefile
@@ -40,6 +40,10 @@ RELSYSDIR = $(RELEASE_PATH)/lib/$(APPLICATION)-$(VSN)
# ----------------------------------------------------
# Target Specs
# ----------------------------------------------------
+
+BEHAVIOUR_MODULES= \
+ httpd_custom_api
+
MODULES = \
httpd \
httpd_acceptor \
@@ -86,10 +90,13 @@ MODULES = \
HRL_FILES = httpd.hrl httpd_internal.hrl mod_auth.hrl
-ERL_FILES = $(MODULES:%=%.erl)
+ERL_FILES = $(MODULES:%=%.erl)\
+ $(BEHAVIOUR_MODULES:%=%.erl)
TARGET_FILES= $(MODULES:%=$(EBIN)/%.$(EMULATOR))
+BEHAVIOUR_TARGET_FILES= $(BEHAVIOUR_MODULES:%=$(EBIN)/%.$(EMULATOR))
+
INETS_FLAGS = -D'SERVER_SOFTWARE="$(APPLICATION)/$(VSN)"'
@@ -109,11 +116,12 @@ ERL_COMPILE_FLAGS += \
# ----------------------------------------------------
# Targets
# ----------------------------------------------------
+$(TARGET_FILES): $(BEHAVIOUR_TARGET_FILES)
debug opt: $(TARGET_FILES)
clean:
- rm -f $(TARGET_FILES)
+ rm -f $(TARGET_FILES) $(BEHAVIOUR_TARGET_FILES)
rm -f core
docs:
diff --git a/lib/inets/src/http_server/httpd_custom.erl b/lib/inets/src/http_server/httpd_custom.erl
index a1fe058bd1..2b9701ef75 100644
--- a/lib/inets/src/http_server/httpd_custom.erl
+++ b/lib/inets/src/http_server/httpd_custom.erl
@@ -20,16 +20,27 @@
%%
-module(httpd_custom).
--export([response_header/1, request_header/1]).
--export([customize_headers/3]).
+-export([response_header/1, request_header/1, response_default_headers/0]).
+-export([customize_headers/3, response_default_headers/1]).
--include_lib("inets/src/inets_app/inets_internal.hrl").
+-include("../inets_app/inets_internal.hrl").
+
+-behaviour(httpd_custom_api).
+
+%%--------------------------------------------------------------------
+%% Behavior API -----------------------------------
+%%--------------------------------------------------------------------
response_header(Header) ->
{true, httpify(Header)}.
request_header(Header) ->
{true, Header}.
+response_default_headers() ->
+ [].
+%%--------------------------------------------------------------------
+%% Internal API -----------------------------------
+%%--------------------------------------------------------------------
customize_headers(?MODULE, Function, Arg) ->
?MODULE:Function(Arg);
customize_headers(Module, Function, Arg) ->
@@ -43,6 +54,20 @@ customize_headers(Module, Function, Arg) ->
?MODULE:Function(Arg)
end.
+response_default_headers(?MODULE) ->
+ response_default_headers();
+response_default_headers(Module) ->
+ try Module:response_default_headers() of
+ Defaults ->
+ [{http_util:to_lower(Key), Value} || {Key, Value} <- Defaults,
+ is_list(Key), is_list(Value)]
+ catch
+ _:_ ->
+ ?MODULE:response_default_headers()
+ end.
+%%--------------------------------------------------------------------
+%% Internal functions -----------------------------------
+%%--------------------------------------------------------------------
httpify({Key0, Value}) ->
%% make sure first letter is capital (defacto standard)
Words1 = string:tokens(Key0, "-"),
diff --git a/lib/webtool/src/webtool.app.src b/lib/inets/src/http_server/httpd_custom_api.erl
index 6b9750c2b4..282f3a6ee6 100644
--- a/lib/webtool/src/webtool.app.src
+++ b/lib/inets/src/http_server/httpd_custom_api.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2001-2009. All Rights Reserved.
+%% Copyright Ericsson AB 2015-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -17,12 +17,15 @@
%%
%% %CopyrightEnd%
%%
-{application,webtool,
- [{description,"Toolbar lookalike for the web"},
- {vsn,"%VSN%"},
- {modules,[webtool,webtool_sup]},
- {registered,[web_tool,websup]},
- {applications,[kernel,stdlib]},
- {runtime_dependencies, ["stdlib-2.0","observer-2.0","kernel-3.0",
- "inets-5.10","erts-6.0"]}]}.
-
+%%
+-module(httpd_custom_api).
+
+-callback response_default_headers() ->
+ [{Key::string(), Value::string()}].
+-callback response_header({Key::string(), Value::string()}) ->
+ {true, {Key::string(), Value::string()}} | false.
+-callback request_header({Key::string(), Value::string()}) ->
+ {true, {Key::string(), Value::string()}} | false.
+
+-optional_callbacks([response_default_headers/0, response_header/1,
+ request_header/1]).
diff --git a/lib/inets/src/http_server/httpd_request_handler.erl b/lib/inets/src/http_server/httpd_request_handler.erl
index 25aea56568..e5d006c1fd 100644
--- a/lib/inets/src/http_server/httpd_request_handler.erl
+++ b/lib/inets/src/http_server/httpd_request_handler.erl
@@ -30,7 +30,7 @@
%% gen_server callbacks
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
- terminate/2, code_change/3]).
+ terminate/2, code_change/3, format_status/2]).
-include("httpd.hrl").
-include("http_internal.hrl").
@@ -310,6 +310,18 @@ do_terminate(#state{mod = ModData} = State) ->
cancel_request_timeout(State),
httpd_socket:close(ModData#mod.socket_type, ModData#mod.socket).
+format_status(normal, [_, State]) ->
+ [{data, [{"StateData", State}]}];
+format_status(terminate, [_, State]) ->
+ Mod = (State#state.mod),
+ case Mod#mod.socket_type of
+ ip_comm ->
+ [{data, [{"StateData", State}]}];
+ {essl, _} ->
+ %% Do not print ssl options in superviosr reports
+ [{data, [{"StateData",
+ State#state{mod = Mod#mod{socket_type = 'TLS'}}}]}]
+ end.
%%--------------------------------------------------------------------
%% code_change(OldVsn, State, Extra) -> {ok, NewState}
diff --git a/lib/inets/src/http_server/httpd_response.erl b/lib/inets/src/http_server/httpd_response.erl
index 7e73da7060..71243f525a 100644
--- a/lib/inets/src/http_server/httpd_response.erl
+++ b/lib/inets/src/http_server/httpd_response.erl
@@ -287,14 +287,21 @@ create_header(ConfigDb, KeyValueTupleHeaders) ->
Date = httpd_util:rfc1123_date(),
ContentType = "text/html",
Server = server(ConfigDb),
- Headers0 = add_default_headers([{"date", Date},
- {"content-type", ContentType}
- | if Server=="" -> [];
- true -> [{"server", Server}]
- end
- ],
- KeyValueTupleHeaders),
CustomizeCB = httpd_util:lookup(ConfigDb, customize, httpd_custom),
+
+ CustomDefaults = httpd_custom:response_default_headers(CustomizeCB),
+ SystemDefaultes = ([{"date", Date},
+ {"content-type", ContentType}
+ | if Server=="" -> [];
+ true -> [{"server", Server}]
+ end
+ ]),
+
+ %% System defaults not present in custom defaults will be added
+ %% to defaults
+ Defaults = add_default_headers(SystemDefaultes, CustomDefaults),
+
+ Headers0 = add_default_headers(Defaults, KeyValueTupleHeaders),
lists:filtermap(fun(H) ->
httpd_custom:customize_headers(CustomizeCB, response_header, H)
end,
diff --git a/lib/inets/src/http_server/httpd_sup.erl b/lib/inets/src/http_server/httpd_sup.erl
index de08624d44..f0b1942e2f 100644
--- a/lib/inets/src/http_server/httpd_sup.erl
+++ b/lib/inets/src/http_server/httpd_sup.erl
@@ -185,12 +185,16 @@ httpd_child_spec(ConfigFile, AcceptTimeoutDef, DebugDef) ->
end.
httpd_child_spec(Config, AcceptTimeout, Debug, Addr, Port, Profile) ->
- Fd = proplists:get_value(fd, Config, undefined),
- case Port == 0 orelse Fd =/= undefined of
- true ->
- httpd_child_spec_listen(Config, AcceptTimeout, Debug, Addr, Port, Profile);
- false ->
- httpd_child_spec_nolisten(Config, AcceptTimeout, Debug, Addr, Port, Profile)
+ case get_fd(Port) of
+ {ok, Fd} ->
+ case Port == 0 orelse Fd =/= undefined of
+ true ->
+ httpd_child_spec_listen(Config, AcceptTimeout, Debug, Addr, Port, Profile);
+ false ->
+ httpd_child_spec_nolisten(Config, AcceptTimeout, Debug, Addr, Port, Profile)
+ end;
+ Error ->
+ Error
end.
httpd_child_spec_listen(Config, AcceptTimeout, Debug, Addr, Port, Profile) ->
@@ -236,7 +240,7 @@ listen(Address, Port, Config) ->
SocketType ->
case http_transport:start(SocketType) of
ok ->
- Fd = proplists:get_value(fd, Config),
+ {ok, Fd} = get_fd(Port),
IpFamily = proplists:get_value(ipfamily, Config, inet6fb4),
case http_transport:listen(SocketType, Address, Port, Fd, IpFamily) of
{ok, ListenSocket} ->
@@ -355,3 +359,19 @@ ssl_ca_certificate_file(Config) ->
File ->
[{cacertfile, File}]
end.
+
+get_fd(0) ->
+ {ok, undefined};
+get_fd(Port) ->
+ FdKey = list_to_atom("httpd_" ++ integer_to_list(Port)),
+ case init:get_argument(FdKey) of
+ {ok, [[Value]]} ->
+ case (catch list_to_integer(Value)) of
+ N when is_integer(N) ->
+ {ok, N};
+ _ ->
+ {error, {bad_descriptor, Value}}
+ end;
+ _ ->
+ {ok, undefined}
+ end.
diff --git a/lib/inets/src/http_server/mod_auth_server.erl b/lib/inets/src/http_server/mod_auth_server.erl
index 3685c2e617..7d1e1a3431 100644
--- a/lib/inets/src/http_server/mod_auth_server.erl
+++ b/lib/inets/src/http_server/mod_auth_server.erl
@@ -316,7 +316,7 @@ lookup(Db, Key) ->
make_name(Addr, Port, Profile) ->
- httpd_util:make_name(?MODULE, Addr, Port, Profile).
+ httpd_util:make_name(?MODULE_STRING, Addr, Port, Profile).
call(Name, Req) ->
diff --git a/lib/inets/src/http_server/mod_security_server.erl b/lib/inets/src/http_server/mod_security_server.erl
index 81561493a0..f9281b0fdc 100644
--- a/lib/inets/src/http_server/mod_security_server.erl
+++ b/lib/inets/src/http_server/mod_security_server.erl
@@ -523,10 +523,10 @@ unblock_user(Info, User, Dir, Addr, Port, Profile, ETS, DETS, CBModule) ->
ets:match_delete(ETS, {blocked_user, {User, Addr, Port, Profile, Dir, '_'}}).
make_name(Addr,Port, Profile) ->
- httpd_util:make_name(?MODULE,Addr,Port, Profile).
+ httpd_util:make_name(?MODULE_STRING, Addr, Port, Profile).
make_name(Addr,Port, Profile, Num) ->
- httpd_util:make_name(?MODULE,Addr,Port,
+ httpd_util:make_name(?MODULE_STRING, Addr,Port,
atom_to_list(Profile) ++ "__" ++ integer_to_list(Num)).
auth_fail_event(Mod,Addr,Port,Dir,User,Passwd) ->
diff --git a/lib/inets/src/inets_app/inets.appup.src b/lib/inets/src/inets_app/inets.appup.src
index d3da76d789..a9fbb1c3f7 100644
--- a/lib/inets/src/inets_app/inets.appup.src
+++ b/lib/inets/src/inets_app/inets.appup.src
@@ -18,9 +18,11 @@
%% %CopyrightEnd%
{"%VSN%",
[
+ {<<"6\\..*">>,[{restart_application, inets}]},
{<<"5\\..*">>,[{restart_application, inets}]}
],
[
+ {<<"6\\..*">>,[{restart_application, inets}]},
{<<"5\\..*">>,[{restart_application, inets}]}
]
}.
diff --git a/lib/inets/src/tftp/tftp_engine.erl b/lib/inets/src/tftp/tftp_engine.erl
index fa44cd61ce..282a97e720 100644
--- a/lib/inets/src/tftp/tftp_engine.erl
+++ b/lib/inets/src/tftp/tftp_engine.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2005-2009. All Rights Reserved.
+%% Copyright Ericsson AB 2005-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -63,7 +63,8 @@
-record(file_info, {peer_req, pid}).
-record(sys_misc, {module, function, arguments}).
-record(error, {where, code, text, filename}).
--record(prepared, {status :: prep_status(), result, block_no, next_data, prev_data}).
+-record(prepared, {status :: prep_status() | 'undefined',
+ result, block_no, next_data, prev_data}).
-record(transfer_res, {status, decoded_msg, prepared}).
-define(ERROR(Where, Code, Text, Filename),
#error{where = Where, code = Code, text = Text, filename = Filename}).
@@ -128,8 +129,8 @@ daemon_start(Options) when is_list(Options) ->
daemon_init(Config) when is_record(Config, config),
is_pid(Config#config.parent_pid) ->
process_flag(trap_exit, true),
- UdpOptions = prepare_daemon_udp(Config),
- case catch gen_udp:open(Config#config.udp_port, UdpOptions) of
+ {Port, UdpOptions} = prepare_daemon_udp(Config),
+ case catch gen_udp:open(Port, UdpOptions) of
{ok, Socket} ->
{ok, ActualPort} = inet:port(Socket),
proc_lib:init_ack({ok, self()}),
@@ -157,7 +158,7 @@ prepare_daemon_udp(#config{udp_port = Port, udp_options = UdpOptions} = Config)
case lists:keymember(fd, 1, UdpOptions) of
true ->
%% Use explicit fd
- UdpOptions;
+ {Port, UdpOptions};
false ->
%% Use fd from setuid_socket_wrap, such as -tftpd_69
InitArg = list_to_atom("tftpd_" ++ integer_to_list(Port)),
@@ -165,7 +166,7 @@ prepare_daemon_udp(#config{udp_port = Port, udp_options = UdpOptions} = Config)
{ok, [[FdStr]] = Badarg} when is_list(FdStr) ->
case catch list_to_integer(FdStr) of
Fd when is_integer(Fd) ->
- [{fd, Fd} | UdpOptions];
+ {0, [{fd, Fd} | lists:keydelete(ip, 1, UdpOptions)]};
{'EXIT', _} ->
Text = lists:flatten(io_lib:format("Illegal prebound fd ~p: ~p", [InitArg, Badarg])),
print_debug_info(Config, daemon, open, ?ERROR(open, undef, Text, "")),
@@ -176,7 +177,7 @@ prepare_daemon_udp(#config{udp_port = Port, udp_options = UdpOptions} = Config)
print_debug_info(Config, daemon, open, ?ERROR(open, undef, Text, "")),
exit({badarg, {prebound_fd, InitArg, Badarg}});
error ->
- UdpOptions
+ {Port, UdpOptions}
end
end.
diff --git a/lib/inets/test/Makefile b/lib/inets/test/Makefile
index cae77a05f3..607ec7c182 100644
--- a/lib/inets/test/Makefile
+++ b/lib/inets/test/Makefile
@@ -174,7 +174,8 @@ MODULES = \
inets_appup_test \
tftp_test_lib \
tftp_SUITE \
- uri_SUITE
+ uri_SUITE \
+ inets_socketwrap_SUITE
EBIN = .
@@ -203,7 +204,7 @@ INETS_FILES = inets.config $(INETS_SPECS)
# inets_ftp_suite \
# inets_tftp_suite
-INETS_DATADIRS = inets_SUITE_data inets_sup_SUITE_data
+INETS_DATADIRS = inets_SUITE_data inets_socketwrap_SUITE_data
HTTPD_DATADIRS = httpd_test_data httpd_SUITE_data httpd_basic_SUITE_data old_httpd_SUITE_data
HTTPC_DATADIRS = httpc_SUITE_data httpc_proxy_SUITE_data
FTP_DATADIRS = ftp_SUITE_data
@@ -250,7 +251,7 @@ ERL_COMPILE_FLAGS += \
# 1) INETS_PRIV_DIR must be created
# ----------------------------------------------------
-tests debug opt: $(BUILDTARGET)
+tests debug opt: $(BUILDTARGET)
targets: $(TARGET_FILES)
diff --git a/lib/inets/test/httpc_SUITE.erl b/lib/inets/test/httpc_SUITE.erl
index 5b40d08859..2ad00bdf76 100644
--- a/lib/inets/test/httpc_SUITE.erl
+++ b/lib/inets/test/httpc_SUITE.erl
@@ -105,6 +105,7 @@ only_simulated() ->
internal_server_error,
invalid_http,
headers_dummy,
+ headers_with_obs_fold,
empty_response_header,
remote_socket_close,
remote_socket_close_async,
@@ -893,6 +894,13 @@ headers_dummy(Config) when is_list(Config) ->
%%-------------------------------------------------------------------------
+headers_with_obs_fold(Config) when is_list(Config) ->
+ Request = {url(group_name(Config), "/obs_folded_headers.html", Config), []},
+ {ok, {{_,200,_}, Headers, [_|_]}} = httpc:request(get, Request, [], []),
+ "a b" = proplists:get_value("folded", Headers).
+
+%%-------------------------------------------------------------------------
+
invalid_headers(Config) ->
Request = {url(group_name(Config), "/dummy.html", Config), [{"cookie", undefined}]},
{error, _} = httpc:request(get, Request, [], []).
@@ -1713,6 +1721,13 @@ handle_uri(_,"/dummy_headers.html",_,_,Socket,_) ->
send(Socket, http_chunk:encode("obar</BODY></HTML>")),
http_chunk:encode_last();
+handle_uri(_,"/obs_folded_headers.html",_,_,_,_) ->
+ "HTTP/1.1 200 ok\r\n"
+ "Content-Length:5\r\n"
+ "Folded: a\r\n"
+ " b\r\n\r\n"
+ "Hello";
+
handle_uri(_,"/capital_transfer_encoding.html",_,_,Socket,_) ->
Head = "HTTP/1.1 200 ok\r\n" ++
"Transfer-Encoding:Chunked\r\n\r\n",
diff --git a/lib/inets/test/httpc_proxy_SUITE.erl b/lib/inets/test/httpc_proxy_SUITE.erl
index 786de1bc42..6d7af4ea5d 100644
--- a/lib/inets/test/httpc_proxy_SUITE.erl
+++ b/lib/inets/test/httpc_proxy_SUITE.erl
@@ -58,7 +58,7 @@ groups() ->
[http_emulate_lower_versions
|local_proxy_cases()]},
{local_proxy_https,[],
- local_proxy_cases()}].
+ local_proxy_cases() ++ local_proxy_https_cases()}].
%% internal functions
@@ -77,6 +77,9 @@ local_proxy_cases() ->
http_stream,
http_not_modified_otp_6821].
+local_proxy_https_cases() ->
+ [https_connect_error].
+
%%--------------------------------------------------------------------
init_per_suite(Config0) ->
@@ -432,6 +435,21 @@ header_value(Name, [{HeaderName,HeaderValue}|Headers]) ->
end.
%%--------------------------------------------------------------------
+https_connect_error(doc) ->
+ ["Error from CONNECT tunnel should be returned"];
+https_connect_error(Config) when is_list(Config) ->
+ {HttpServer,HttpPort} = ?config(http, Config),
+ Method = get,
+ %% using HTTPS scheme with HTTP port to trigger connection error
+ URL = "https://" ++ HttpServer ++ ":" ++
+ integer_to_list(HttpPort) ++ "/index.html",
+ Opts = [],
+ HttpOpts = [],
+ Request = {URL,[]},
+ {error,{failed_connect,[_,{tls,_,_}]}} =
+ httpc:request(Method, Request, HttpOpts, Opts).
+
+%%--------------------------------------------------------------------
%% Internal Functions ------------------------------------------------
%%--------------------------------------------------------------------
diff --git a/lib/inets/test/httpc_proxy_SUITE_data/server_proxy.sh b/lib/inets/test/httpc_proxy_SUITE_data/server_proxy.sh
index 9d1698c386..473024ae63 100755
--- a/lib/inets/test/httpc_proxy_SUITE_data/server_proxy.sh
+++ b/lib/inets/test/httpc_proxy_SUITE_data/server_proxy.sh
@@ -169,6 +169,8 @@ MaxRequestsPerChild 0
ViaProxyName "tinyproxy"
ConnectPort $APACHE_HTTPS_PORT
+# to test connect error
+ConnectPort $APACHE_HTTP_PORT
EOF
(tinyproxy -d -c tinyproxy.conf 1>/dev/null 2>&1 </dev/null &)&
wait_for_pidfile tinyproxy.pid
diff --git a/lib/inets/test/httpd_SUITE.erl b/lib/inets/test/httpd_SUITE.erl
index a6236f828a..b50d31a5c1 100644
--- a/lib/inets/test/httpd_SUITE.erl
+++ b/lib/inets/test/httpd_SUITE.erl
@@ -97,7 +97,7 @@ groups() ->
{https_reload, [], [{group, reload}]},
{http_mime_types, [], [alias_1_1, alias_1_0, alias_0_9]},
{limit, [], [max_clients_1_1, max_clients_1_0, max_clients_0_9]},
- {custom, [], [customize]},
+ {custom, [], [customize, add_default]},
{reload, [], [non_disturbing_reconfiger_dies,
disturbing_reconfiger_dies,
non_disturbing_1_1,
@@ -1003,10 +1003,23 @@ customize(Config) when is_list(Config) ->
{no_header, "Server"},
{version, Version}]).
-response_header({"server", _}) ->
- false;
-response_header(Header) ->
- {true, Header}.
+add_default() ->
+ [{doc, "Test adding default header with custom callback"}].
+
+add_default(Config) when is_list(Config) ->
+ Version = "HTTP/1.1",
+ Host = ?config(host, Config),
+ Type = ?config(type, Config),
+ ok = httpd_test_lib:verify_request(?config(type, Config), Host,
+ ?config(port, Config),
+ transport_opts(Type, Config),
+ ?config(node, Config),
+ http_request("GET /index.html ", Version, Host),
+ [{statuscode, 200},
+ {header, "Content-Type", "text/html"},
+ {header, "Date", "Override-date"},
+ {header, "X-Frame-Options"},
+ {version, Version}]).
%%-------------------------------------------------------------------------
max_header() ->
@@ -1425,9 +1438,9 @@ server_config(http_limit, Config) ->
%% Make sure option checking code is run
{max_content_length, 100000002}] ++ server_config(http, Config);
server_config(http_custom, Config) ->
- [{custom, ?MODULE}] ++ server_config(http, Config);
+ [{customize, ?MODULE}] ++ server_config(http, Config);
server_config(https_custom, Config) ->
- [{custom, ?MODULE}] ++ server_config(https, Config);
+ [{customize, ?MODULE}] ++ server_config(https, Config);
server_config(https_limit, Config) ->
[{max_clients, 1}] ++ server_config(https, Config);
server_config(http_basic_auth, Config) ->
@@ -2030,3 +2043,14 @@ typestr(ip_comm) ->
"tcp";
typestr(_) ->
"ssl".
+
+response_header({"server", _}) ->
+ false;
+response_header(Header) ->
+ {true, Header}.
+
+response_default_headers() ->
+ [%% Add new header
+ {"X-Frame-Options", "SAMEORIGIN"},
+ %% Override built-in default
+ {"Date", "Override-date"}].
diff --git a/lib/inets/test/httpd_test_lib.erl b/lib/inets/test/httpd_test_lib.erl
index cb2e86c81e..a5b836f651 100644
--- a/lib/inets/test/httpd_test_lib.erl
+++ b/lib/inets/test/httpd_test_lib.erl
@@ -294,9 +294,9 @@ do_validate(Header, [{header, HeaderField, Value}|Rest],N,P) ->
{value, {LowerHeaderField, Value}} ->
ok;
false ->
- ct:fail({wrong_header_field_value, LowerHeaderField, Header});
+ ct:fail({wrong_header_field_value, LowerHeaderField, Header, Value});
_ ->
- ct:fail({wrong_header_field_value, LowerHeaderField, Header})
+ ct:fail({wrong_header_field_value, LowerHeaderField, Header, Value})
end,
do_validate(Header, Rest, N, P);
do_validate(Header,[{no_header, HeaderField}|Rest],N,P) ->
diff --git a/lib/inets/test/inets_SUITE.erl b/lib/inets/test/inets_SUITE.erl
index c3586f09e3..928d9dc391 100644
--- a/lib/inets/test/inets_SUITE.erl
+++ b/lib/inets/test/inets_SUITE.erl
@@ -21,7 +21,6 @@
-module(inets_SUITE).
-include_lib("common_test/include/ct.hrl").
--include("test_server_line.hrl").
-include("inets_test_lib.hrl").
%% Note: This directive should only be used in test suites.
@@ -37,8 +36,12 @@ all() ->
groups() ->
[{services_test, [],
- [start_inets, start_httpc, start_httpd, start_ftpc,
- start_tftpd]},
+ [start_inets,
+ start_httpc,
+ start_httpd,
+ start_ftpc,
+ start_tftpd
+ ]},
{app_test, [], [{inets_app_test, all}]},
{appup_test, [], [{inets_appup_test, all}]}].
@@ -48,9 +51,6 @@ init_per_group(_GroupName, Config) ->
end_per_group(_GroupName, Config) ->
Config.
-
-
-
%%--------------------------------------------------------------------
%% Function: init_per_suite(Config) -> Config
%% Config - [tuple()]
@@ -103,14 +103,8 @@ end_per_testcase(_, Config) ->
%% Test cases starts here.
%%-------------------------------------------------------------------------
-
-
-%%-------------------------------------------------------------------------
-
-start_inets(doc) ->
- ["Test inets API functions"];
-start_inets(suite) ->
- [];
+start_inets() ->
+ [{doc, "Test inets API functions"}].
start_inets(Config) when is_list(Config) ->
[_|_] = inets:service_names(),
@@ -134,134 +128,85 @@ start_inets(Config) when is_list(Config) ->
ok = inets:start(permanent),
ok = inets:stop().
-
%%-------------------------------------------------------------------------
-start_httpc(doc) ->
- ["Start/stop of httpc service"];
-start_httpc(suite) ->
- [];
+start_httpc() ->
+ [{doc, "Start/stop of httpc service"}].
start_httpc(Config) when is_list(Config) ->
process_flag(trap_exit, true),
- tsp("start_httpc -> entry with"
- "~n Config: ~p", [Config]),
-
PrivDir = ?config(priv_dir, Config),
- tsp("start_httpc -> start (empty) inets"),
ok = inets:start(),
-
- tsp("start_httpc -> start httpc (as inets service) with profile foo"),
{ok, Pid0} = inets:start(httpc, [{profile, foo}]),
- tsp("start_httpc -> check running services"),
Pids0 = [ServicePid || {_, ServicePid} <- inets:services()],
true = lists:member(Pid0, Pids0),
[_|_] = inets:services_info(),
- tsp("start_httpc -> stop httpc"),
inets:stop(httpc, Pid0),
- tsp("start_httpc -> sleep some"),
test_server:sleep(100),
- tsp("start_httpc -> check running services"),
Pids1 = [ServicePid || {_, ServicePid} <- inets:services()],
false = lists:member(Pid0, Pids1),
- tsp("start_httpc -> start httpc (stand-alone) with profile bar"),
{ok, Pid1} = inets:start(httpc, [{profile, bar}], stand_alone),
- tsp("start_httpc -> check running services"),
Pids2 = [ServicePid || {_, ServicePid} <- inets:services()],
false = lists:member(Pid1, Pids2),
- tsp("start_httpc -> stop httpc"),
ok = inets:stop(stand_alone, Pid1),
receive
{'EXIT', Pid1, shutdown} ->
ok
after 100 ->
- tsf(stand_alone_not_shutdown)
+ ct:fail(stand_alone_not_shutdown)
end,
- tsp("start_httpc -> stop inets"),
ok = inets:stop(),
- tsp("start_httpc -> unload inets"),
application:load(inets),
-
- tsp("start_httpc -> set inets environment (httpc profile foo)"),
application:set_env(inets, services, [{httpc,[{profile, foo},
{data_dir, PrivDir}]}]),
-
- tsp("start_httpc -> start inets"),
ok = inets:start(),
- tsp("start_httpc -> check running services"),
(?NUM_DEFAULT_SERVICES + 1) = length(inets:services()),
- tsp("start_httpc -> unset inets env"),
application:unset_env(inets, services),
-
- tsp("start_httpc -> stop inets"),
ok = inets:stop(),
-
- tsp("start_httpc -> start (empty) inets"),
ok = inets:start(),
- tsp("start_httpc -> start inets httpc service with profile foo"),
{ok, Pid3} = inets:start(httpc, [{profile, foo}]),
-
- tsp("start_httpc -> stop inets service httpc with profile foo"),
ok = inets:stop(httpc, foo),
-
- tsp("start_httpc -> check running services"),
Pids3 = [ServicePid || {_, ServicePid} <- inets:services()],
false = lists:member(Pid3, Pids3),
-
- tsp("start_httpc -> stop inets"),
- ok = inets:stop(),
-
- tsp("start_httpc -> done"),
- ok.
-
+ ok = inets:stop().
%%-------------------------------------------------------------------------
-start_httpd(doc) ->
- ["Start/stop of httpd service"];
-start_httpd(suite) ->
- [];
+start_httpd() ->
+ [{doc, "Start/stop of httpd service"}].
start_httpd(Config) when is_list(Config) ->
process_flag(trap_exit, true),
- i("start_httpd -> entry with"
- "~n Config: ~p", [Config]),
PrivDir = ?config(priv_dir, Config),
HttpdConf = [{server_name, "httpd_test"}, {server_root, PrivDir},
- {document_root, PrivDir}, {bind_address, "localhost"}],
+ {document_root, PrivDir}, {bind_address, any}],
- i("start_httpd -> start inets"),
ok = inets:start(),
-
- i("start_httpd -> start httpd service"),
{ok, Pid0} = inets:start(httpd, [{port, 0}, {ipfamily, inet} | HttpdConf]),
Pids0 = [ServicePid || {_, ServicePid} <- inets:services()],
true = lists:member(Pid0, Pids0),
[_|_] = inets:services_info(),
- i("start_httpd -> stop httpd service"),
inets:stop(httpd, Pid0),
test_server:sleep(500),
Pids1 = [ServicePid || {_, ServicePid} <- inets:services()],
false = lists:member(Pid0, Pids1),
- i("start_httpd -> start (stand-alone) httpd service"),
{ok, Pid1} =
inets:start(httpd, [{port, 0}, {ipfamily, inet} | HttpdConf],
stand_alone),
Pids2 = [ServicePid || {_, ServicePid} <- inets:services()],
false = lists:member(Pid1, Pids2),
- i("start_httpd -> stop (stand-alone) httpd service"),
ok = inets:stop(stand_alone, Pid1),
receive
{'EXIT', Pid1, shutdown} ->
@@ -269,7 +214,6 @@ start_httpd(Config) when is_list(Config) ->
after 100 ->
test_server:fail(stand_alone_not_shutdown)
end,
- i("start_httpd -> stop inets"),
ok = inets:stop(),
File0 = filename:join(PrivDir, "httpd.conf"),
{ok, Fd0} = file:open(File0, [write]),
@@ -277,17 +221,12 @@ start_httpd(Config) when is_list(Config) ->
ok = file:write(Fd0, Str),
file:close(Fd0),
- i("start_httpd -> [application] load inets"),
application:load(inets),
- i("start_httpd -> [application] set httpd services env with proplist-file"),
application:set_env(inets,
services, [{httpd, [{proplist_file, File0}]}]),
- i("start_httpd -> start inets"),
ok = inets:start(),
(?NUM_DEFAULT_SERVICES + 1) = length(inets:services()),
- i("start_httpd -> [application] unset services env"),
application:unset_env(inets, services),
- i("start_httpd -> stop inets"),
ok = inets:stop(),
File1 = filename:join(PrivDir, "httpd_apache.conf"),
@@ -300,68 +239,46 @@ start_httpd(Config) when is_list(Config) ->
file:write(Fd1, "Port 0\r\n"),
file:close(Fd1),
- i("start_httpd -> [application] load inets"),
application:load(inets),
- i("start_httpd -> [application] set httpd services env with file"),
application:set_env(inets,
services, [{httpd, [{file, File1}]}]),
- i("start_httpd -> start inets"),
ok = inets:start(),
(?NUM_DEFAULT_SERVICES + 1) = length(inets:services()),
- i("start_httpd -> [application] unset services env"),
application:unset_env(inets, services),
- i("start_httpd -> stop inets"),
ok = inets:stop(),
%% OLD format
- i("start_httpd -> [application] load inets"),
application:load(inets),
- i("start_httpd -> [application] set httpd services OLD env"),
application:set_env(inets,
services, [{httpd, File1}]),
- i("start_httpd -> start inets"),
ok = inets:start(),
(?NUM_DEFAULT_SERVICES + 1) = length(inets:services()),
- i("start_httpd -> [application] unset services enc"),
application:unset_env(inets, services),
- i("start_httpd -> stop inets"),
ok = inets:stop(),
-
- i("start_httpd -> start inets"),
ok = inets:start(),
- i("start_httpd -> try (and fail) start httpd service - server_name"),
{error, {missing_property, server_name}} =
inets:start(httpd, [{port, 0},
{server_root, PrivDir},
{document_root, PrivDir},
{bind_address, "localhost"}]),
- i("start_httpd -> try (and fail) start httpd service - missing document_root"),
{error, {missing_property, document_root}} =
inets:start(httpd, [{port, 0},
{server_name, "httpd_test"},
{server_root, PrivDir},
{bind_address, "localhost"}]),
- i("start_httpd -> try (and fail) start httpd service - missing server_root"),
{error, {missing_property, server_root}} =
inets:start(httpd, [{port, 0},
{server_name, "httpd_test"},
{document_root, PrivDir},
{bind_address, "localhost"}]),
- i("start_httpd -> try (and fail) start httpd service - missing port"),
{error, {missing_property, port}} =
inets:start(httpd, HttpdConf),
- i("start_httpd -> stop inets"),
- ok = inets:stop(),
- i("start_httpd -> done"),
- ok.
-
+ ok = inets:stop().
%%-------------------------------------------------------------------------
start_ftpc(doc) ->
- ["Start/stop of ftpc service"];
-start_ftpc(suite) ->
- [];
+ [{doc, "Start/stop of ftpc service"}];
start_ftpc(Config) when is_list(Config) ->
process_flag(trap_exit, true),
ok = inets:start(),
@@ -389,7 +306,7 @@ start_ftpc(Config) when is_list(Config) ->
{'EXIT', Pid1, shutdown} ->
ok
after 100 ->
- tsf(stand_alone_not_shutdown)
+ ct:fail(stand_alone_not_shutdown)
end,
ok = inets:stop(),
ok;
@@ -401,15 +318,11 @@ start_ftpc(Config) when is_list(Config) ->
throw:{error, not_found} ->
{skip, "No available FTP servers"}
end.
-
-
%%-------------------------------------------------------------------------
-start_tftpd(doc) ->
- ["Start/stop of tfpd service"];
-start_tftpd(suite) ->
- [];
+start_tftpd() ->
+ [{doc, "Start/stop of tfpd service"}].
start_tftpd(Config) when is_list(Config) ->
process_flag(trap_exit, true),
ok = inets:start(),
@@ -441,16 +354,12 @@ start_tftpd(Config) when is_list(Config) ->
application:unset_env(inets, services),
ok = inets:stop().
-
%%-------------------------------------------------------------------------
-httpd_reload(doc) ->
- ["Reload httpd configuration without restarting service"];
-httpd_reload(suite) ->
- [];
+httpd_reload() ->
+ [{doc, "Reload httpd configuration without restarting service"}].
httpd_reload(Config) when is_list(Config) ->
process_flag(trap_exit, true),
- i("httpd_reload -> starting"),
PrivDir = ?config(priv_dir, Config),
DataDir = ?config(data_dir, Config),
HttpdConf = [{server_name, "httpd_test"},
@@ -458,23 +367,18 @@ httpd_reload(Config) when is_list(Config) ->
{document_root, PrivDir},
{bind_address, "localhost"}],
- i("httpd_reload -> start inets"),
-
ok = inets:start(),
test_server:sleep(5000),
- i("httpd_reload -> inets started - start httpd service"),
- {ok, Pid0} = inets:start(httpd, [{port, 0}, {ipfamily, inet} | HttpdConf]),
+ {ok, Pid0} = inets:start(httpd, [{port, 0},
+ {ipfamily, inet} | HttpdConf]),
test_server:sleep(5000),
- i("httpd_reload -> httpd service started (~p) - get port", [Pid0]),
[{port, Port0}] = httpd:info(Pid0, [port]),
test_server:sleep(5000),
- i("httpd_reload -> Port: ~p - get document root", [Port0]),
[{document_root, PrivDir}] = httpd:info(Pid0, [document_root]),
test_server:sleep(5000),
- i("httpd_reload -> document root: ~p - reload config", [PrivDir]),
ok = httpd:reload_config([{port, Port0}, {ipfamily, inet},
{server_name, "httpd_test"},
@@ -482,11 +386,8 @@ httpd_reload(Config) when is_list(Config) ->
{document_root, DataDir},
{bind_address, "localhost"}], non_disturbing),
test_server:sleep(5000),
- io:format("~w:~w:httpd_reload - reloaded - get document root~n", [?MODULE, ?LINE]),
-
[{document_root, DataDir}] = httpd:info(Pid0, [document_root]),
test_server:sleep(5000),
- i("httpd_reload -> document root: ~p - reload config", [DataDir]),
ok = httpd:reload_config([{port, Port0}, {ipfamily, inet},
{server_name, "httpd_test"},
@@ -539,23 +440,5 @@ httpd_reload(Config) when is_list(Config) ->
ok = inets:stop(httpd, Pid1),
application:unset_env(inets, services),
- ok = inets:stop(),
- i("httpd_reload -> starting"),
- ok.
-
-
-tsf(Reason) ->
- test_server:fail(Reason).
-
-tsp(F) ->
- tsp(F, []).
-tsp(F, A) ->
- Timestamp = inets_lib:formated_timestamp(),
- test_server:format("** ~s ** ~p ~p:" ++ F ++ "~n", [Timestamp, self(), ?MODULE | A]).
-
-i(F) ->
- i(F, []).
+ ok = inets:stop().
-i(F, A) ->
- Timestamp = inets_lib:formated_timestamp(),
- io:format("*** ~s ~w:" ++ F ++ "~n", [Timestamp, ?MODULE | A]).
diff --git a/lib/inets/test/inets_socketwrap_SUITE.erl b/lib/inets/test/inets_socketwrap_SUITE.erl
new file mode 100644
index 0000000000..cfbda3ccf5
--- /dev/null
+++ b/lib/inets/test/inets_socketwrap_SUITE.erl
@@ -0,0 +1,154 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 1997-2015. All Rights Reserved.
+%%
+%% Licensed under the Apache License, Version 2.0 (the "License");
+%% you may not use this file except in compliance with the License.
+%% You may obtain a copy of the License at
+%%
+%% http://www.apache.org/licenses/LICENSE-2.0
+%%
+%% Unless required by applicable law or agreed to in writing, software
+%% distributed under the License is distributed on an "AS IS" BASIS,
+%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+%% See the License for the specific language governing permissions and
+%% limitations under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+-module(inets_socketwrap_SUITE).
+
+-include_lib("common_test/include/ct.hrl").
+-include("inets_test_lib.hrl").
+
+%% Note: This directive should only be used in test suites.
+-compile(export_all).
+
+suite() ->
+ [{ct_hooks,[ts_install_cth]}].
+
+all() ->
+ [start_httpd_fd, start_tftpd_fd].
+
+init_per_suite(Config) ->
+ case os:type() of
+ {unix, linux} ->
+ Config;
+ _ ->
+ {skip, linux_feature}
+ end.
+
+end_per_suite(_Config) ->
+ ok.
+
+init_per_group(_GroupName, Config) ->
+ Config.
+
+end_per_group(_GroupName, Config) ->
+ Config.
+
+init_per_testcase(Case, Config) ->
+ end_per_testcase(Case, Config),
+ Config.
+
+end_per_testcase(_, Config) ->
+ inets:stop(),
+ Config.
+
+%%-------------------------------------------------------------------------
+start_httpd_fd() ->
+ [{doc, "Start/stop of httpd service with socket wrapper"}].
+start_httpd_fd(Config) when is_list(Config) ->
+ PrivDir = ?config(priv_dir, Config),
+ DataDir = ?config(data_dir, Config),
+ HttpdConf = [{port, 80}, {ipfamily, inet},
+ {server_name, "httpd_fd_test"}, {server_root, PrivDir},
+ {document_root, PrivDir}, {bind_address, any}],
+ case setup_node_info(node()) of
+ {skip, _} = Skip ->
+ Skip;
+ {Node, NodeArg} ->
+ InetPort = inets_test_lib:inet_port(node()),
+ ct:pal("Node: ~p Port ~p~n", [Node, InetPort]),
+ Wrapper = filename:join(DataDir, "setuid_socket_wrap"),
+ Cmd = Wrapper ++
+ " -s -httpd_80,0:" ++ integer_to_list(InetPort)
+ ++ " -p " ++ os:find_executable("erl") ++
+ " -- " ++ NodeArg,
+ ct:pal("cmd: ~p~n", [Cmd]),
+ case open_port({spawn, Cmd}, [stderr_to_stdout]) of
+ Port when is_port(Port) ->
+ wait_node_up(Node, 10),
+ ct:pal("~p", [rpc:call(Node, init, get_argument, [httpd_80])]),
+ ok = rpc:call(Node, inets, start, []),
+ {ok, Pid} = rpc:call(Node, inets, start, [httpd, HttpdConf]),
+ [{port, InetPort}] = rpc:call(Node, httpd, info, [Pid, [port]]),
+ rpc:call(Node, erlang, halt, []);
+ _ ->
+ ct:fail(open_port_failed)
+ end
+ end.
+%%-------------------------------------------------------------------------
+start_tftpd_fd() ->
+ [{doc, "Start/stop of tfpd service with socket wrapper"}].
+start_tftpd_fd(Config) when is_list(Config) ->
+ DataDir = ?config(data_dir, Config),
+ case setup_node_info(node()) of
+ {skip, _} = Skip ->
+ Skip;
+ {Node, NodeArg} ->
+ InetPort = inets_test_lib:inet_port(node()),
+ ct:pal("Node: ~p~n", [Node]),
+ Wrapper = filename:join(DataDir, "setuid_socket_wrap"),
+ Cmd = Wrapper ++
+ " -s -tftpd_69,0:" ++ integer_to_list(InetPort)
+ ++ " -p " ++ os:find_executable("erl") ++
+ " -- " ++ NodeArg,
+ ct:pal("cmd: ~p~n", [Cmd]),
+ case open_port({spawn, Cmd}, [stderr_to_stdout]) of
+ Port when is_port(Port) ->
+ wait_node_up(Node, 10),
+ ct:pal("~p", [rpc:call(Node, init, get_argument, [tftpd_69])]),
+ ok = rpc:call(Node, inets, start, []),
+ {ok, Pid} = rpc:call(Node, inets, start,
+ [tftpd,[{host, "localhost"}]]),
+ {ok, Info} = rpc:call(Node, tftp, info, [Pid]),
+ {value,{port, InetPort}} = lists:keysearch(port, 1, Info),
+ rpc:call(Node, erlang, halt, []);
+ _ ->
+ ct:fail(open_port_failed)
+ end
+ end.
+%%-------------------------------------------------------------------------
+%% Internal functions
+%%-------------------------------------------------------------------------
+setup_node_info(nonode@nohost) ->
+ {skip, needs_distributed_node};
+setup_node_info(Node) ->
+ Static = "-detached -noinput",
+ Name = "inets_fd_test",
+ NameSw = case net_kernel:longnames() of
+ false -> "-sname ";
+ _ -> "-name "
+ end,
+ StrNode =
+ Static ++ " "
+ ++ NameSw ++ " " ++ Name ++ " "
+ ++ "-setcookie " ++ atom_to_list(erlang:get_cookie()),
+ [_, Location] = string:tokens(atom_to_list(Node), "$@"),
+ TestNode = Name ++ "@" ++ Location,
+ {list_to_atom(TestNode), StrNode}.
+
+wait_node_up(Node, 0) ->
+ ct:fail({failed_to_start_node, Node});
+wait_node_up(Node, N) ->
+ ct:pal("(Node ~p: net_adm:ping(~p)~n", [node(), Node]),
+ case net_adm:ping(Node) of
+ pong ->
+ ok;
+ pang ->
+ ct:sleep(5000),
+ wait_node_up(Node, N-1)
+ end.
diff --git a/lib/ose/Makefile b/lib/inets/test/inets_socketwrap_SUITE_data/Makefile.src
index 6119b75c3f..0933815b58 100644
--- a/lib/ose/Makefile
+++ b/lib/inets/test/inets_socketwrap_SUITE_data/Makefile.src
@@ -1,8 +1,8 @@
-#
+#
# %CopyrightBegin%
-#
-# Copyright Ericsson AB 1996-2009. All Rights Reserved.
-#
+#
+# Copyright Ericsson AB 2015-2015. All Rights Reserved.
+#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -14,24 +14,26 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
+#
# %CopyrightEnd%
#
-include $(ERL_TOP)/make/target.mk
-include $(ERL_TOP)/make/$(TARGET)/otp.mk
-#
-# Macros
-#
+CC = @CC@
+LD = @LD@
+CFLAGS = @CFLAGS@
+CROSSLDFLAGS = @CROSSLDFLAGS@
-SUB_DIRECTORIES = src doc/src
+PROGS = setuid_socket_wrap@exe@
-include vsn.mk
-VSN = $(OSE_VSN)
+.PHONY: all
+@IFEQ@ (@os@, linux-gnu)
+all: $(PROGS)
+@ELSE@
+all:
+@ENDIF@
-SPECIAL_TARGETS =
+setuid_socket_wrap@exe@: setuid_socket_wrap@obj@
+ $(LD) $(CROSSLDFLAGS) -o setuid_socket_wrap setuid_socket_wrap@obj@ @LIBS@
-#
-# Default Subdir Targets
-#
-include $(ERL_TOP)/make/otp_subdir.mk
+setuid_socket_wrap@obj@: setuid_socket_wrap.c
+ $(CC) -c $(CFLAGS) -o setuid_socket_wrap@obj@ setuid_socket_wrap.c
diff --git a/lib/inets/test/inets_socketwrap_SUITE_data/setuid_socket_wrap.c b/lib/inets/test/inets_socketwrap_SUITE_data/setuid_socket_wrap.c
new file mode 100644
index 0000000000..b28f6b1c08
--- /dev/null
+++ b/lib/inets/test/inets_socketwrap_SUITE_data/setuid_socket_wrap.c
@@ -0,0 +1,259 @@
+/*
+ * %CopyrightBegin%
+ *
+ * Copyright Ericsson AB 1999-2009. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * %CopyrightEnd%
+ */
+/*
+ * setuid_socket_wrap.c
+ *
+ * ./a.out [-s [tag,][addr]:[port]]* [-d [tag,][addr]:[port]]*
+ * [-r [tag,]proto]* [-p erl_path]* -- program args
+ *
+ * Where: -s = stream socket, -d datagram socket and -r means raw socket.
+ *
+ */
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <ctype.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+
+#ifndef INADDR_NONE
+#define INADDR_NONE 0xffffffff
+#endif
+
+struct sock_list {
+ struct sock_list *next;
+ int fd;
+ int type;
+ int protocol;
+ struct sockaddr_in addr;
+ char *arg;
+};
+
+int parse_addr(addr, str)
+ struct sockaddr_in *addr;
+ char *str;
+{
+ int port = 0;
+ char *cp;
+ struct hostent *hp;
+ struct servent *se;
+
+ if ((cp = strrchr(str, (int)':')) != NULL)
+ *cp++ = '\0';
+ if (cp) {
+ if (!isdigit((int)cp[0])) {
+ if ((se = getservbyname(cp, "tcp")) != NULL) {
+ port = ntohs(se->s_port);
+ } else {
+ fprintf(stderr, "unknown port %s\n", cp);
+ return -1;
+ }
+ } else {
+ port = atoi(cp);
+ }
+ }
+ if (port < 0 || port > 0xffff) {
+ fprintf(stderr, "bad port number %d\n", port);
+ return -1;
+ }
+
+ bzero(addr, sizeof(*addr));
+ addr->sin_family = AF_INET;
+ addr->sin_port = htons(port);
+ if (*str == '\000') {
+ addr->sin_addr.s_addr = INADDR_ANY;
+ } else {
+ if ((addr->sin_addr.s_addr = inet_addr(str)) == INADDR_NONE) {
+ if ((hp = gethostbyname(str)) == NULL) {
+ fprintf(stderr, "\"%s\" unknown host or address!\n", str);
+ return -1;
+ } else {
+ bcopy(hp->h_addr_list[0], &addr->sin_addr.s_addr,hp->h_length);
+ }
+ }
+ }
+ return 0;
+}
+
+struct sock_list *new_entry(type, argstr)
+ int type;
+ char *argstr;
+{
+ struct sock_list *sle;
+ char *cp;
+
+ sle = (struct sock_list *)malloc(sizeof(struct sock_list));
+ if (!sle)
+ return NULL;
+ sle->next = NULL;
+ sle->fd = -1;
+
+ if ((cp = strchr(argstr, (int)',')) != NULL) {
+ *cp++ = '\0';
+ sle->arg = argstr;
+ argstr = cp;
+ } else {
+ sle->arg = "-fd";
+ }
+ sle->type = type;
+ switch (type) {
+ case SOCK_RAW: {
+ struct protoent *pe;
+ pe = getprotobyname(argstr);
+ if (!pe) {
+ fprintf(stderr, "Unknown protocol: %s\n", argstr);
+ free(sle);
+ return NULL;
+ }
+ sle->protocol = pe->p_proto;
+ break;
+ }
+ case SOCK_STREAM:
+ case SOCK_DGRAM:
+ sle->protocol = 0;
+ if (parse_addr(&sle->addr, argstr) < 0) {
+ free(sle);
+ return NULL;
+ }
+ break;
+ }
+ return sle;
+}
+
+int open_socket(sle)
+ struct sock_list *sle;
+{
+ sle->fd = socket(AF_INET, sle->type, sle->protocol);
+ if (sle->fd < 0) {
+ perror("socket");
+ return -1;
+ }
+ if (sle->type != SOCK_RAW) {
+#if 0
+ printf("binding fd %d to %s:%d\n", sle->fd,
+ inet_ntoa(sle->addr.sin_addr), ntohs(sle->addr.sin_port));
+#endif
+ if (bind(sle->fd, (struct sockaddr *)&sle->addr, sizeof(sle->addr))<0){
+ perror("bind");
+ close(sle->fd);
+ return -1;
+ }
+ }
+ return sle->fd;
+}
+
+int main(argc, argv)
+ int argc;
+ char *argv[];
+{
+ struct sock_list *sl = NULL, *sltmp = NULL;
+ int count = 0;
+ int c;
+ char *run_prog = NULL;
+
+ while ((c = getopt(argc, argv, "s:d:r:p:")) != EOF)
+ switch (c) {
+ case 's':
+ sltmp = new_entry(SOCK_STREAM, optarg);
+ if (!sltmp) {
+ exit(1);
+ }
+ sltmp->next = sl;
+ sl = sltmp;
+ count++;
+ break;
+ case 'd':
+ sltmp = new_entry(SOCK_DGRAM, optarg);
+ if (!sltmp) {
+ exit(1);
+ }
+ sltmp->next = sl;
+ sl = sltmp;
+ count++;
+ break;
+ case 'r':
+ sltmp = new_entry(SOCK_RAW, optarg);
+ if (!sltmp) {
+ exit(1);
+ }
+ sltmp->next = sl;
+ sl = sltmp;
+ count++;
+ break;
+ case 'p':
+ run_prog = optarg;
+ break;
+ default:
+ exit(1);
+ }
+ argc -= optind;
+ argv += optind;
+
+ for(sltmp = sl; sltmp != NULL; sltmp = sltmp->next)
+ if (open_socket(sltmp) < 0) {
+ fprintf(stderr, "failed to create socket!\n");
+ exit(1);
+ }
+
+ setuid(getuid());
+
+ {
+ int i;
+ char **newargv;
+ char *run_prog_name;
+
+ newargv = (char **)malloc((1 + 2*count + argc + 1) * sizeof(char*));
+
+ if ((run_prog_name = strrchr(run_prog, (int)'/')) == NULL)
+ run_prog_name = run_prog;
+ else
+ run_prog_name++;
+
+ i = 0;
+ newargv[i++] = run_prog_name;
+
+ for (; argc; argc--, argv++, i++)
+ newargv[i] = *argv;
+ for(sltmp = sl; sltmp != NULL; ) {
+ char *fd_str = (char *)malloc(8);
+ if (!fd_str) exit(1);
+ sprintf(fd_str, "%d", sltmp->fd);
+ if (sltmp->arg && *(sltmp->arg))
+ newargv[i++] = sltmp->arg;
+ newargv[i++] = fd_str;
+ sl = sltmp;
+ sltmp = sltmp->next;
+ free(sl);
+ }
+ newargv[i] = (char *)NULL;
+ execv(run_prog, newargv);
+ perror("exec");
+ exit(1);
+ }
+ exit(0);
+}
diff --git a/lib/inets/test/inets_test_lib.erl b/lib/inets/test/inets_test_lib.erl
index b471dcf784..f1185f7574 100644
--- a/lib/inets/test/inets_test_lib.erl
+++ b/lib/inets/test/inets_test_lib.erl
@@ -563,3 +563,12 @@ stop_apps(Apps) ->
application:stop(App)
end, Apps).
+inet_port(Node) ->
+ {Port, Socket} = do_inet_port(Node),
+ rpc:call(Node, gen_tcp, close, [Socket]),
+ Port.
+
+do_inet_port(Node) ->
+ {ok, Socket} = rpc:call(Node, gen_tcp, listen, [0, [{reuseaddr, true}]]),
+ {ok, Port} = rpc:call(Node, inet, port, [Socket]),
+ {Port, Socket}.
diff --git a/lib/inets/test/uri_SUITE.erl b/lib/inets/test/uri_SUITE.erl
index bfcd7bd339..2642b8fd4e 100644
--- a/lib/inets/test/uri_SUITE.erl
+++ b/lib/inets/test/uri_SUITE.erl
@@ -49,7 +49,8 @@ all() ->
queries,
fragments,
escaped,
- hexed_query
+ hexed_query,
+ scheme_validation
].
%%--------------------------------------------------------------------
@@ -175,6 +176,26 @@ hexed_query(Config) when is_list(Config) ->
verify_uri(URI2, Verify2),
verify_uri(URI3, Verify3).
+scheme_validation(Config) when is_list(Config) ->
+ {ok, {http,[],"localhost",80,"/",""}} =
+ http_uri:parse("http://localhost#fragment"),
+
+ ValidationFun =
+ fun("http") -> valid;
+ (_) -> {error, bad_scheme}
+ end,
+
+ {ok, {http,[],"localhost",80,"/",""}} =
+ http_uri:parse("http://localhost#fragment",
+ [{scheme_validation_fun, ValidationFun}]),
+ {error, bad_scheme} =
+ http_uri:parse("https://localhost#fragment",
+ [{scheme_validation_fun, ValidationFun}]),
+ %% non-fun scheme_validation_fun works as no option passed
+ {ok, {https,[],"localhost",443,"/",""}} =
+ http_uri:parse("https://localhost#fragment",
+ [{scheme_validation_fun, none}]).
+
%%--------------------------------------------------------------------
%% Internal Functions ------------------------------------------------
diff --git a/lib/inets/vsn.mk b/lib/inets/vsn.mk
index 5395df1d07..480caeca4b 100644
--- a/lib/inets/vsn.mk
+++ b/lib/inets/vsn.mk
@@ -19,6 +19,6 @@
# %CopyrightEnd%
APPLICATION = inets
-INETS_VSN = 6.0
+INETS_VSN = 6.0.2
PRE_VSN =
APP_VSN = "$(APPLICATION)-$(INETS_VSN)$(PRE_VSN)"
diff --git a/lib/kernel/doc/src/app.xml b/lib/kernel/doc/src/app.xml
index 1591d589af..d6d6167923 100644
--- a/lib/kernel/doc/src/app.xml
+++ b/lib/kernel/doc/src/app.xml
@@ -191,7 +191,7 @@ RTDeps [ApplicationVersion] []
start phases must be a subset of the set of phases defined
for the primary application. Refer to <em>OTP Design Principles</em> for more information.</p>
</item>
- <tag><marker id="runtime_dependencies"><c>runtime_dependencies</c></marker></tag>
+ <tag><marker id="runtime_dependencies"></marker><c>runtime_dependencies</c></tag>
<item><p>A list of application versions that the application
depends on. An example of such an application version is
<c>"kernel-3.0"</c>. Application versions specified as runtime
diff --git a/lib/kernel/doc/src/application.xml b/lib/kernel/doc/src/application.xml
index 0fe774a73f..4d8e6ce94b 100644
--- a/lib/kernel/doc/src/application.xml
+++ b/lib/kernel/doc/src/application.xml
@@ -60,8 +60,9 @@
</datatype>
<datatype>
<!-- Parameterized opaque types are NYI: -->
- <name><marker id="type-tuple_of">tuple_of(T)</marker></name>
- <desc><p>A tuple where the elements are of type <c>T</c>.</p></desc>
+ <name>tuple_of(T)</name>
+ <desc><p><marker id="type-tuple_of"/>
+ A tuple where the elements are of type <c>T</c>.</p></desc>
</datatype>
</datatypes>
<funcs>
diff --git a/lib/kernel/doc/src/auth.xml b/lib/kernel/doc/src/auth.xml
index 9ebc6f8f1a..71b1863e96 100644
--- a/lib/kernel/doc/src/auth.xml
+++ b/lib/kernel/doc/src/auth.xml
@@ -50,7 +50,7 @@
be established in this case. Returns <c>no</c> if <c><anno>Node</anno></c>
does not exist or communication is not authorized (it has
another cookie than <c>auth</c> thinks it has).</p>
- <p>Use <seealso marker="net_adm#ping/1">net_adm:ping(<anno>Node</anno>)</seealso>
+ <p>Use <seealso marker="net_adm#ping/1">net_adm:ping(<c><anno>Node</anno></c>)</seealso>
instead.</p>
</desc>
</func>
@@ -71,7 +71,7 @@
</type_desc>
<desc>
<p>Use
- <seealso marker="erts:erlang#erlang:set_cookie/2">erlang:set_cookie(node(), <anno>Cookie</anno>)</seealso>
+ <seealso marker="erts:erlang#erlang:set_cookie/2">erlang:set_cookie(node(), <c><anno>Cookie</anno></c>)</seealso>
instead.</p>
</desc>
</func>
@@ -94,8 +94,8 @@
<p>Sets the magic cookie of <c><anno>Node</anno></c> to <c><anno>Cookie</anno></c>, and
verifies the status of the authorization.
Equivalent to calling
- <seealso marker="erts:erlang#erlang:set_cookie/2">erlang:set_cookie(<anno>Node</anno>, <anno>Cookie</anno>)</seealso>, followed by
- <seealso marker="#is_auth/1">auth:is_auth(<anno>Node</anno>)</seealso>.</p>
+ <seealso marker="erts:erlang#erlang:set_cookie/2">erlang:set_cookie(<c><anno>Node</anno></c>, <c><anno>Cookie</anno>)</c></seealso>, followed by
+ <seealso marker="#is_auth/1">auth:is_auth(<c><anno>Node</anno></c>)</seealso>.</p>
</desc>
</func>
</funcs>
diff --git a/lib/kernel/doc/src/code.xml b/lib/kernel/doc/src/code.xml
index 7cdedfa0ba..4e3be35079 100644
--- a/lib/kernel/doc/src/code.xml
+++ b/lib/kernel/doc/src/code.xml
@@ -180,7 +180,7 @@
example, the call
<c>erl_prim_loader:list_dir( "/otp/root/lib/mnesia-4.4.7.ez/mnesia-4.4.7/examples/bench)"</c>
would list the contents of a directory inside an archive.
- See <seealso marker="erts:erl_prim_loader">erl_prim_loader(3)</seealso></p>.
+ See <seealso marker="erts:erl_prim_loader">erl_prim_loader(3)</seealso>.</p>
<p>An application archive file and a regular application directory
may coexist. This may be useful when there is a need of having
@@ -242,7 +242,7 @@
particular useful to set the flag to <c>relaxed</c> when you want
to elaborate with code loading from archives without editing the
<c>boot script</c>. The default is <c>relaxed</c>. See <seealso
- marker="erts:init">init(3)</seealso></p> </section>
+ marker="erts:init">init(3)</seealso></p></section>
<section>
diff --git a/lib/kernel/doc/src/disk_log.xml b/lib/kernel/doc/src/disk_log.xml
index 32488a9f01..7d4a9687ea 100644
--- a/lib/kernel/doc/src/disk_log.xml
+++ b/lib/kernel/doc/src/disk_log.xml
@@ -233,11 +233,11 @@
<func>
<name name="alog" arity="2"/>
<name name="balog" arity="2"/>
+ <fsummary>Asynchronously log an item onto a disk log.</fsummary>
<type variable="Log"/>
<type variable="Term" name_i="1"/>
<type variable="Bytes"/>
<type name="notify_ret"/>
- <fsummary>Asynchronously log an item onto a disk log.</fsummary>
<desc>
<p>The <c>alog/2</c> and <c>balog/2</c> functions asynchronously
append an item to a disk log. The function <c>alog/2</c> is
@@ -288,8 +288,8 @@
<func>
<name name="block" arity="1"/>
<name name="block" arity="2"/>
- <type name="block_error_rsn"/>
<fsummary>Block a disk log.</fsummary>
+ <type name="block_error_rsn"/>
<desc>
<p>With a call to <c>block/1,2</c> a process can block a log.
If the blocking process is not an owner of the log, a temporary
@@ -663,8 +663,8 @@
<func>
<name name="lclose" arity="1"/>
<name name="lclose" arity="2"/>
- <type name="lclose_error_rsn"/>
<fsummary>Close a disk log on one node.</fsummary>
+ <type name="lclose_error_rsn"/>
<desc>
<p>The function <c>lclose/1</c> closes a local log or an
individual distributed log on the current node.
@@ -744,6 +744,7 @@
</func>
<func>
<name name="open" arity="1"/>
+ <fsummary>Open a disk log file.</fsummary>
<type name="dlog_options"/>
<type name="dlog_option"/>
<type name="open_ret"/>
@@ -753,7 +754,6 @@
<type name="open_error_rsn"/>
<type name="dlog_optattr"/>
<type name="dlog_size"/>
- <fsummary>Open a disk log file.</fsummary>
<desc>
<p>The <c><anno>ArgL</anno></c> parameter is a list of options which have
the following meanings:</p>
@@ -1043,8 +1043,8 @@ If
</func>
<func>
<name name="sync" arity="1"/>
- <type name="sync_error_rsn"/>
<fsummary>Flush the contents of a disk log to the disk.</fsummary>
+ <type name="sync_error_rsn"/>
<desc>
<p>The <c>sync/1</c> function ensures that the contents of the
log are actually written to the disk.
@@ -1086,8 +1086,8 @@ If
</func>
<func>
<name name="unblock" arity="1"/>
- <type name="unblock_error_rsn"/>
<fsummary>Unblock a disk log.</fsummary>
+ <type name="unblock_error_rsn"/>
<desc>
<p>The <c>unblock/1</c> function unblocks a log.
A log can only be unblocked by the blocking process.
diff --git a/lib/kernel/doc/src/erl_ddll.xml b/lib/kernel/doc/src/erl_ddll.xml
index d622725ba0..8d71883cf4 100644
--- a/lib/kernel/doc/src/erl_ddll.xml
+++ b/lib/kernel/doc/src/erl_ddll.xml
@@ -388,14 +388,14 @@
remove a monitor.</p>
<p>The function accepts the following parameters:</p>
<taglist>
- <tag><em><anno>Tag</anno></em></tag>
+ <tag><em><c><anno>Tag</anno></c></em></tag>
<item>
<p>The monitor tag is always <c>driver</c> as this function
can only be used to create driver monitors. In the future,
driver monitors will be integrated with process monitors,
why this parameter has to be given for consistence.</p>
</item>
- <tag><em><anno>Item</anno></em></tag>
+ <tag><em><c><anno>Item</anno></c></em></tag>
<item>
<p>The <c><anno>Item</anno></c> parameter specifies which driver one
wants to monitor (the name of the driver) as well as
@@ -642,7 +642,7 @@
</note>
<p>The function accepts the following parameters:</p>
<taglist>
- <tag><em><anno>Path</anno></em></tag>
+ <tag><em><c><anno>Path</anno></c></em></tag>
<item>
<p>The filesystem path to the directory where the driver
object file is situated. The filename of the object file
@@ -665,7 +665,7 @@
to have <em>only one loader</em> of a driver one wants to
upgrade in a running system! </p>
</item>
- <tag><em><anno>Name</anno></em></tag>
+ <tag><em><c><anno>Name</anno></c></em></tag>
<item>
<p>The name parameter is the name of the driver to be used
in subsequent calls to <seealso marker="erts:erlang#open_port/2">open_port</seealso>. The
@@ -678,14 +678,14 @@
with this <c><anno>Name</anno></c> parameter, much as a beam-file's
module name much correspond to its filename.</p>
</item>
- <tag><em><anno>OptionList</anno></em></tag>
+ <tag><em><c><anno>OptionList</anno></c></em></tag>
<item>
<p>A number of options can be specified to control the
loading operation. The options are given as a list of
two-tuples, the tuples having the following values and
meanings:</p>
<taglist>
- <tag><em>{driver_options, <anno>DriverOptionList</anno>}</em></tag>
+ <tag><em>{driver_options, <c><anno>DriverOptionList</anno></c>}</em></tag>
<item>
<p>This option is to provide options that will change
its general behavior and will "stick" to the driver
@@ -701,7 +701,7 @@
when the last <seealso marker="#users">user</seealso> calls <seealso marker="#try_unload/2">try_unload/2</seealso>, or
the last process having loaded the driver exits.</p>
</item>
- <tag><em>{monitor, <anno>MonitorOption</anno>}</em></tag>
+ <tag><em>{monitor, <c><anno>MonitorOption</anno></c>}</em></tag>
<item>
<p>A <c><anno>MonitorOption</anno></c> tells <c>try_load/3</c> to
trigger a driver monitor under certain
@@ -732,7 +732,7 @@
<c>{monitor, pending_driver}</c> in production
code (see the monitor discussion above). </p>
</item>
- <tag><em>{reload,<anno>ReloadOption</anno>}</em></tag>
+ <tag><em>{reload, <c><anno>ReloadOption</anno></c>}</em></tag>
<item>
<p>This option is used when one wants to
<em>reload</em> a driver from disk, most often in a
@@ -910,13 +910,13 @@
</taglist>
<p>The function accepts the following parameters:</p>
<taglist>
- <tag><em><anno>Name</anno></em></tag>
+ <tag><em><c><anno>Name</anno></c></em></tag>
<item>
<p>The name parameter is the name of the driver to be
unloaded. The name can be specified either as an
<c>iolist()</c> or as an <c>atom()</c>. </p>
</item>
- <tag><em><anno>OptionList</anno></em></tag>
+ <tag><em><c><anno>OptionList</anno></c></em></tag>
<item>
<p>The <c><anno>OptionList</anno></c> argument can be used to specify
certain behavior regarding ports as well as triggering
@@ -934,7 +934,7 @@
unloads, one should use the driver option
<c>kill_ports</c> when loading the driver instead.</p>
</item>
- <tag><em>{monitor, <anno>MonitorOption</anno>}</em></tag>
+ <tag><em>{monitor, <c><anno>MonitorOption</anno></c>}</em></tag>
<item>
<p>This option creates a driver monitor if the condition
given in <c><anno>MonitorOption</anno></c> is true. The valid
diff --git a/lib/kernel/doc/src/error_logger.xml b/lib/kernel/doc/src/error_logger.xml
index f83fe53084..92e14c2bef 100644
--- a/lib/kernel/doc/src/error_logger.xml
+++ b/lib/kernel/doc/src/error_logger.xml
@@ -299,12 +299,12 @@ ok</pre>
<name name="logfile" arity="1" clause_i="1"/>
<name name="logfile" arity="1" clause_i="2"/>
<name name="logfile" arity="1" clause_i="3"/>
+ <fsummary>Enable or disable error printouts to a file</fsummary>
<type variable="Filename"/>
<type variable="OpenReason" name_i="1"/>
<type variable="CloseReason" name_i="2"/>
<type variable="FilenameReason" name_i="3"/>
<type name="open_error"/>
- <fsummary>Enable or disable error printouts to a file</fsummary>
<desc>
<p>Enables or disables printout of standard events to a file.</p>
<p>This is done by adding or deleting the standard event handler
diff --git a/lib/kernel/doc/src/file.xml b/lib/kernel/doc/src/file.xml
index 4954568086..9cd4cfa712 100644
--- a/lib/kernel/doc/src/file.xml
+++ b/lib/kernel/doc/src/file.xml
@@ -87,9 +87,10 @@
<name name="deep_list"/>
</datatype>
<datatype>
- <name><marker id="type-fd">fd()</marker></name>
+ <name>fd()</name>
<desc>
- <p>A file descriptor representing a file opened in <seealso
+ <p><marker id="type-fd"/>
+ A file descriptor representing a file opened in <seealso
marker="#raw">raw</seealso> mode.</p>
</desc>
</datatype>
@@ -491,7 +492,7 @@
<name name="list_dir" arity="1"/>
<fsummary>List files in a directory</fsummary>
<desc>
- <p>Lists all files in a directory, <b>except</b> files
+ <p>Lists all files in a directory, <em>except</em> files
with "raw" names. Returns
<c>{ok, <anno>Filenames</anno>}</c> if successful.
Otherwise, it returns <c>{error, <anno>Reason</anno>}</c>.
@@ -1307,15 +1308,15 @@
<item>
<p>The current system access to the file.</p>
</item>
- <tag><c>atime = <seealso marker="#type-date_time">date_time()</seealso> | integer() >= 0</c></tag>
+ <tag><c>atime = </c><seealso marker="#type-date_time">date_time()</seealso><c> | integer() >= 0</c></tag>
<item>
<p>The last time the file was read.</p>
</item>
- <tag><c>mtime = <seealso marker="#type-date_time">date_time()</seealso> | integer() >= 0</c></tag>
+ <tag><c>mtime = </c><seealso marker="#type-date_time">date_time()</seealso><c> | integer() >= 0</c></tag>
<item>
<p>The last time the file was written.</p>
</item>
- <tag><c>ctime = <seealso marker="#type-date_time">date_time()</seealso> | integer() >=0</c></tag>
+ <tag><c>ctime = </c><seealso marker="#type-date_time">date_time()</seealso><c> | integer() >=0</c></tag>
<item>
<p>The interpretation of this time field depends on
the operating system. On Unix, it is the last time
@@ -1745,7 +1746,7 @@
See <seealso marker="gen_tcp#controlling_process-2">gen_tcp:controlling_process/2</seealso></p>
<p>If the OS used does not support sendfile, an Erlang fallback
using file:read and gen_tcp:send is used.</p>
- <p>The option list can contain the following options:
+ <p>The option list can contain the following options:</p>
<taglist>
<tag><c>chunk_size</c></tag>
<item>The chunk size used by the erlang fallback to send
@@ -1760,7 +1761,6 @@
the sendfile call will return <c>{error,einval}</c>.
Introduced in Erlang/OTP 17.0. Default is false.</item>
</taglist>
- </p>
</desc>
</func>
<func>
@@ -1851,22 +1851,21 @@
Type <c>local</c> will interpret the time set as local, <c>universal</c> will
interpret it as universal time and <c>posix</c> must be seconds since
or before unix time epoch which is 1970-01-01 00:00 UTC.
- Default is <c>{time, local}</c>.
+ Default is <c>{time, local}</c>.</p>
<p>If the <c>raw</c> option is set, the file server will not be called
and only informations about local files will be returned.</p>
- </p>
<p>The following fields are used from the record, if they are
given.</p>
<taglist>
- <tag><c>atime = <seealso marker="#type-date_time">date_time()</seealso> | integer() >= 0</c></tag>
+ <tag><c>atime = </c><seealso marker="#type-date_time">date_time()</seealso><c> | integer() >= 0</c></tag>
<item>
<p>The last time the file was read.</p>
</item>
- <tag><c>mtime = <seealso marker="#type-date_time">date_time()</seealso> | integer() >= 0</c></tag>
+ <tag><c>mtime = </c><seealso marker="#type-date_time">date_time()</seealso><c> | integer() >= 0</c></tag>
<item>
<p>The last time the file was written.</p>
</item>
- <tag><c>ctime = <seealso marker="#type-date_time">date_time()</seealso> | integer() >= 0</c></tag>
+ <tag><c>ctime = </c><seealso marker="#type-date_time">date_time()</seealso><c> | integer() >= 0</c></tag>
<item>
<p>On Unix, any value give for this field will be ignored
(the "ctime" for the file will be set to the current
diff --git a/lib/kernel/doc/src/gen_sctp.xml b/lib/kernel/doc/src/gen_sctp.xml
index b704d90613..456108a2fe 100644
--- a/lib/kernel/doc/src/gen_sctp.xml
+++ b/lib/kernel/doc/src/gen_sctp.xml
@@ -77,9 +77,10 @@
<datatypes>
<datatype>
- <name><marker id="type-assoc_id">assoc_id()</marker></name>
+ <name>assoc_id()</name>
<desc>
- <p>An opaque term returned in for example #sctp_paddr_change{}
+ <p><marker id="type-assoc_id"/>
+ An opaque term returned in for example #sctp_paddr_change{}
that identifies an association for an SCTP socket. The term
is opaque except for the special value <c>0</c> that has a
meaning such as "the whole endpoint" or "all future associations".
@@ -98,9 +99,10 @@
<desc><marker id="type-sctp_socket"></marker></desc>
</datatype>
<datatype>
- <name><marker id="type-sctp_socket">sctp_socket()</marker></name>
+ <name>sctp_socket()</name>
<desc>
- <p>Socket identifier returned from <c>open/*</c>.</p>
+ <p><marker id="type-sctp_socket"/>
+ Socket identifier returned from <c>open/*</c>.</p>
<marker id="exports"></marker>
</desc>
</datatype>
@@ -146,7 +148,7 @@
<c><anno>Addr</anno></c> and <c><anno>Port</anno></c>. The <c><anno>Timeout</anno></c>,
is expressed in milliseconds. A socket can be associated with multiple peers.</p>
- <p><b>WARNING:</b>Using a value of <c><anno>Timeout</anno></c> less than
+ <p><em>WARNING:</em>Using a value of <c><anno>Timeout</anno></c> less than
the maximum time taken by the OS to establish an association (around 4.5 minutes
if the default values from RFC 4960 are used) can result in
inconsistent or incorrect return values. This is especially
@@ -170,7 +172,7 @@
<p>The number of outbound and inbound streams can be set by
giving an <c>sctp_initmsg</c> option to <c>connect</c>
as in:</p>
-<pre> connect(<anno>Socket</anno>, Ip, <anno>Port</anno>,
+<pre> connect(Socket, Ip, Port>,
[{sctp_initmsg,#sctp_initmsg{num_ostreams=OutStreams,
max_instreams=MaxInStreams}}]) </pre>
<p>All options <c><anno>Opt</anno></c> are set on the socket before the
diff --git a/lib/kernel/doc/src/gen_tcp.xml b/lib/kernel/doc/src/gen_tcp.xml
index 8d9f09cea7..6a19e76c4f 100644
--- a/lib/kernel/doc/src/gen_tcp.xml
+++ b/lib/kernel/doc/src/gen_tcp.xml
@@ -78,9 +78,10 @@ do_recv(Sock, Bs) ->
<name name="listen_option"/>
</datatype>
<datatype>
- <name><marker id="type-socket">socket()</marker></name>
+ <name>socket()</name>
<desc>
- <p>As returned by accept/1,2 and connect/3,4.</p>
+ <p><marker id="type-socket"/>
+ As returned by accept/1,2 and connect/3,4.</p>
<marker id="connect"></marker>
</desc>
</datatype>
diff --git a/lib/kernel/doc/src/gen_udp.xml b/lib/kernel/doc/src/gen_udp.xml
index 6f34aba43c..79cd87dcef 100644
--- a/lib/kernel/doc/src/gen_udp.xml
+++ b/lib/kernel/doc/src/gen_udp.xml
@@ -43,9 +43,9 @@
<name name="option_name"/>
</datatype>
<datatype>
- <name><marker id="type-socket">socket()</marker></name>
+ <name>socket()</name>
<desc>
- <p>As returned by open/1,2.</p>
+ <p><marker id="type-socket"/>As returned by open/1,2.</p>
</desc>
</datatype>
</datatypes>
diff --git a/lib/kernel/doc/src/inet.xml b/lib/kernel/doc/src/inet.xml
index e5d7ce048a..088d78c1d6 100644
--- a/lib/kernel/doc/src/inet.xml
+++ b/lib/kernel/doc/src/inet.xml
@@ -4,7 +4,7 @@
<erlref>
<header>
<copyright>
- <year>1997</year><year>2013</year>
+ <year>1997</year><year>2015</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -117,8 +117,9 @@ fe80::204:acff:fe17:bf38
</desc>
</datatype>
<datatype>
- <name><marker id="type-socket">socket()</marker></name>
- <desc><p>See <seealso marker="gen_tcp#type-socket">gen_tcp(3)</seealso>
+ <name>socket()</name>
+ <desc><p><marker id="type-socket"></marker>
+ See <seealso marker="gen_tcp#type-socket">gen_tcp(3)</seealso>
and <seealso marker="gen_udp#type-socket">gen_udp(3)</seealso>.</p>
</desc>
</datatype>
@@ -222,7 +223,7 @@ fe80::204:acff:fe17:bf38
</p>
<p>
Do not rely too much on the order of <c><anno>Flag</anno></c> atoms or
- <c><anno>Ifopt</anno></c> tuples. There are some rules, though:
+ <c><anno>Ifopt</anno></c> tuples. There are some rules, though:</p>
<list>
<item>
Immediately after <c>{addr,_}</c> follows <c>{netmask,_}</c>
@@ -238,7 +239,6 @@ fe80::204:acff:fe17:bf38
tuple concerns that address.
</item>
</list>
- </p>
<p>
The <c>{hwaddr,_}</c> tuple is not returned on Solaris since the
hardware address historically belongs to the link layer and only
@@ -379,14 +379,14 @@ fe80::204:acff:fe17:bf38
<name name="ntoa" arity="1" />
<fsummary>Convert IPv6 / IPV4 adress to ascii</fsummary>
<desc>
- <p>Parses an <a href="#type-ip_address">ip_address()</a> and returns an IPv4 or IPv6 address string.</p>
+ <p>Parses an <seealso marker="#type-ip_address">ip_address()</seealso> and returns an IPv4 or IPv6 address string.</p>
</desc>
</func>
<func>
<name name="parse_ipv4_address" arity="1" />
<fsummary>Parse an IPv4 address</fsummary>
<desc>
- <p>Parses an IPv4 address string and returns an <a href="#type-ip4_address">ip4_address()</a>.
+ <p>Parses an IPv4 address string and returns an <seealso marker="#type-ip4_address">ip4_address()</seealso>.
Accepts a shortened IPv4 shortened address string.</p>
</desc>
</func>
@@ -394,14 +394,14 @@ fe80::204:acff:fe17:bf38
<name name="parse_ipv4strict_address" arity="1" />
<fsummary>Parse an IPv4 address strict.</fsummary>
<desc>
- <p>Parses an IPv4 address string containing four fields, i.e <b>not</b> shortened, and returns an <a href="#type-ip4_adress">ip4_address()</a>.</p>
+ <p>Parses an IPv4 address string containing four fields, i.e <em>not</em> shortened, and returns an <seealso marker="#type-ip4_address">ip4_address()</seealso>.</p>
</desc>
</func>
<func>
<name name="parse_ipv6_address" arity="1" />
<fsummary>Parse an IPv6 address</fsummary>
<desc>
- <p>Parses an IPv6 address string and returns an <a href="#type-ip6_address">ip6_address()</a>.
+ <p>Parses an IPv6 address string and returns an <seealso marker="#type-ip6_address">ip6_address()</seealso>.
If an IPv4 address string is passed, an IPv4-mapped IPv6 address is returned.</p>
</desc>
</func>
@@ -409,22 +409,22 @@ fe80::204:acff:fe17:bf38
<name name="parse_ipv6strict_address" arity="1" />
<fsummary>Parse an IPv6 address strict.</fsummary>
<desc>
- <p>Parses an IPv6 address string and returns an <a href="#type-ip6_address">ip6_address()</a>.
- Does <b>not</b> accept IPv4 adresses.</p>
+ <p>Parses an IPv6 address string and returns an <seealso marker="#type-ip6_address">ip6_address()</seealso>.
+ Does <em>not</em> accept IPv4 adresses.</p>
</desc>
</func>
<func>
<name name="parse_address" arity="1" />
<fsummary>Parse an IPv4 or IPv6 address.</fsummary>
<desc>
- <p>Parses an IPv4 or IPv6 address string and returns an <a href="#type-ip4_address">ip4_address()</a> or <a href="#type-ip6_address">ip6_address()</a>. Accepts a shortened IPv4 address string.</p>
+ <p>Parses an IPv4 or IPv6 address string and returns an <seealso marker="#type-ip4_address">ip4_address()</seealso> or <seealso marker="#type-ip6_address">ip6_address()</seealso>. Accepts a shortened IPv4 address string.</p>
</desc>
</func>
<func>
<name name="parse_strict_address" arity="1" />
<fsummary>Parse an IPv4 or IPv6 address strict.</fsummary>
<desc>
- <p>Parses an IPv4 or IPv6 address string and returns an <a href="#type-ip4_address">ip4_address()</a> or <a href="#type-ip6_adress">ip6_address()</a>. Does <b>not</b> accept a shortened IPv4 address string.</p>
+ <p>Parses an IPv4 or IPv6 address string and returns an <seealso marker="#type-ip4_address">ip4_address()</seealso> or <seealso marker="#type-ip6_address">ip6_address()</seealso>. Does <em>not</em> accept a shortened IPv4 address string.</p>
</desc>
</func>
<func>
@@ -862,10 +862,10 @@ fe80::204:acff:fe17:bf38
<c>CAP_SYS_ADMIN</c> according to the documentation for setns(2).
However, during testing also <c>CAP_SYS_PTRACE</c>
and <c>CAP_DAC_READ_SEARCH</c> has proven to be necessary.
- Example:<code>
+ Example:</p><code>
setcap cap_sys_admin,cap_sys_ptrace,cap_dac_read_search+epi beam.smp
</code>
- Note also that the filesystem containing the virtual machine
+ <p>Note also that the filesystem containing the virtual machine
executable (<c>beam.smp</c> in the example above) has to be local,
mounted without the <c>nosetuid</c> flag,
support extended attributes and that
@@ -981,6 +981,11 @@ setcap cap_sys_admin,cap_sys_ptrace,cap_dac_read_search+epi beam.smp
indicated length are accepted and not considered invalid due
to internal buffer limitations.</p>
</item>
+ <tag><c>{line_delimiter, Char}</c>(TCP/IP sockets)</tag>
+ <item>
+ <p>Sets the line delimiting character for line oriented protocols
+ (<c>line</c>). Default value is <c>$\n</c>.</p>
+ </item>
<tag><c>{priority, Priority}</c></tag>
<item> <p>Set the protocol-defined priority for all packets to be sent
diff --git a/lib/kernel/doc/src/inet_res.xml b/lib/kernel/doc/src/inet_res.xml
index 6a2c9b1955..851a36aba9 100644
--- a/lib/kernel/doc/src/inet_res.xml
+++ b/lib/kernel/doc/src/inet_res.xml
@@ -4,7 +4,7 @@
<erlref>
<header>
<copyright>
- <year>2009</year><year>2013</year>
+ <year>2009</year><year>2015</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -77,8 +77,11 @@
query is tried for the <c>alt_nameservers</c>.</p>
</section>
+ <section>
+ <title>Resolver Types</title>
+ <p>The following data types concern the resolver:</p>
+ </section>
<datatypes>
- <p>Resolver types:</p>
<datatype>
<name name="res_option"/>
</datatype>
@@ -88,8 +91,13 @@
<datatype>
<name name="res_error"/>
</datatype>
-
- <p><marker id="dns_types"/>DNS types:</p>
+ </datatypes>
+ <section>
+ <title>DNS Types</title>
+ <p><marker id="dns_types"/>
+ The following data types concern the DNS client:</p>
+ </section>
+ <datatypes>
<datatype>
<name name="dns_name"/>
<desc><p>A string with no adjacent dots.</p></desc>
@@ -106,7 +114,7 @@
<p>This is the start of a hiearchy of opaque data structures
that can be examined with access functions in inet_dns that
return lists of {Field,Value} tuples. The arity 2 functions
- just return the value for a given field.
+ just return the value for a given field.</p>
<pre>
dns_msg() = DnsMsg
inet_dns:msg(DnsMsg) ->
@@ -154,18 +162,19 @@ dns_rr() = DnsRr
| {version, integer()}
| {z, integer()}
| {data, dns_data()} ]
- inet_dns:rr(DnsRr, Field) -> Value
+ inet_dns:rr(DnsRr, Field) -> Value</pre>
-There is an info function for the types above:
+<p>There is an info function for the types above:</p>
+<pre>
inet_dns:record_type(dns_msg()) -> msg;
inet_dns:record_type(dns_header()) -> header;
inet_dns:record_type(dns_query()) -> dns_query;
inet_dns:record_type(dns_rr()) -> rr;
-inet_dns:record_type(_) -> undefined.
+inet_dns:record_type(_) -> undefined.</pre>
-So; inet_dns:(inet_dns:record_type(X))(X) will convert
-any of these data structures into a {Field,Value} list.</pre></p>
+<p>So; inet_dns:(inet_dns:record_type(X))(X) will convert
+any of these data structures into a {Field,Value} list.</p>
</desc>
</datatype>
<datatype>
@@ -272,7 +281,7 @@ any of these data structures into a {Field,Value} list.</pre></p>
<p>Resolve a DNS record of the given type and class for the given name.
The returned <c>dns_msg()</c> can be examined using
access functions in <c>inet_db</c> as described
- in <seealso marker="#dns_types">DNS types</seealso>.
+ in <seealso marker="#dns_types">DNS Types</seealso>.
</p><p>
If <c><anno>Name</anno></c> is an <c>ip_address()</c>, the domain name
to query for is generated as the standard reverse
diff --git a/lib/kernel/doc/src/net_adm.xml b/lib/kernel/doc/src/net_adm.xml
index 1072be44a5..4ef9d361f6 100644
--- a/lib/kernel/doc/src/net_adm.xml
+++ b/lib/kernel/doc/src/net_adm.xml
@@ -89,8 +89,8 @@
<func>
<name name="world" arity="0"/>
<name name="world" arity="1"/>
- <type name="verbosity"/>
<fsummary>Lookup and connect to all nodes at all hosts in <c>.hosts.erlang</c></fsummary>
+ <type name="verbosity"/>
<desc>
<p>This function calls <c>names(Host)</c> for all hosts which
are specified in the Erlang host file <c>.hosts.erlang</c>,
@@ -110,8 +110,8 @@
<func>
<name name="world_list" arity="1"/>
<name name="world_list" arity="2"/>
- <type name="verbosity"/>
<fsummary>Lookup and connect to all nodes at specified hosts</fsummary>
+ <type name="verbosity"/>
<desc>
<p>As <c>world/0,1</c>, but the hosts are given as argument
instead of being read from <c>.hosts.erlang</c>.</p>
diff --git a/lib/kernel/doc/src/notes.xml b/lib/kernel/doc/src/notes.xml
index b8db22aba7..1e909cb6f2 100644
--- a/lib/kernel/doc/src/notes.xml
+++ b/lib/kernel/doc/src/notes.xml
@@ -31,6 +31,32 @@
</header>
<p>This document describes the changes made to the Kernel application.</p>
+<section><title>Kernel 4.1</title>
+
+ <section><title>Improvements and New Features</title>
+ <list>
+ <item>
+ <p>A mechanism for limiting the amount of text that the
+ built-in error logger events will produce has been
+ introduced. It is useful for limiting both the size of
+ log files and the CPU time used to produce them.</p>
+ <p>This mechanism is experimental in the sense that it
+ may be changed if it turns out that it does not solve the
+ problem it is supposed to solve. In that case, there may
+ be backward incompatible improvements to this
+ mechanism.</p>
+ <p>See the documentation for the config parameter
+ <c>error_logger_format_depth</c> in the Kernel
+ application for information about how to turn on this
+ feature.</p>
+ <p>
+ Own Id: OTP-12864</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
<section><title>Kernel 4.0</title>
<section><title>Fixed Bugs and Malfunctions</title>
@@ -423,8 +449,7 @@
Erlang/OTP has been ported to the realtime operating
system OSE. The port supports both smp and non-smp
emulator. For details around the port and how to started
- see the User's Guide in the <seealso
- marker="ose:ose_intro">ose</seealso> application. </p>
+ see the User's Guide in the ose application. </p>
<p>
Note that not all parts of Erlang/OTP has been ported. </p>
<p>
@@ -1192,7 +1217,7 @@
</item>
<item>
<p> Fix returned error from gen_tcp:accept/1,2 when
- running out of ports
+ running out of ports.</p>
<p>
The {error, enfile} return value is badly misleading and
confusing for this case, since the Posix ENFILE errno
@@ -1201,7 +1226,7 @@
{error, system_limit}, which is consistent with e.g.
various file(3) functions. inet:format_error/1 has also
been updated to support system_limit in the same manner
- as file:format_error/1. (Thanks to Per Hedeland)</p></p>
+ as file:format_error/1. (Thanks to Per Hedeland)</p>
<p>
Own Id: OTP-9990</p>
</item>
@@ -1396,7 +1421,6 @@
Own Id: OTP-9764</p>
</item>
<item>
- <p>
<list> <item><p>Correct callback spec in application
module</p></item> <item><p>Refine warning about callback
specs with extra ranges</p></item> <item><p>Cleanup
@@ -1407,7 +1431,7 @@
analysis</p></item> <item><p>Fix crash in
Dialyzer</p></item> <item><p>Variable substitution was
not generalizing any unknown variables.</p></item>
- </list></p>
+ </list>
<p>
Own Id: OTP-9776</p>
</item>
diff --git a/lib/kernel/doc/src/os.xml b/lib/kernel/doc/src/os.xml
index 2d2a690fea..682d4a2eac 100644
--- a/lib/kernel/doc/src/os.xml
+++ b/lib/kernel/doc/src/os.xml
@@ -171,8 +171,8 @@ DirOut = os:cmd("dir"), % on Win32 platform</code>
</func>
<func>
<name name="timestamp" arity="0"/>
- <type_desc variable="Timestamp">Timestamp = {MegaSecs, Secs, MicroSecs}</type_desc>
<fsummary>Current OS system time on the erlang:timestamp/0 format</fsummary>
+ <type_desc variable="Timestamp">Timestamp = {MegaSecs, Secs, MicroSecs}</type_desc>
<desc>
<p>Returns current
<seealso marker="erts:time_correction#OS_System_Time">OS system time</seealso>
@@ -205,7 +205,7 @@ format_utc_timestamp() ->
29 Apr 2009 9:55:30.051711
</pre>
<p>OS system time can also be retreived by
- <c><seealso marker="#system_time/0"><c>os:system_time/0</c></seealso></c>,
+ <seealso marker="#system_time/0"><c>os:system_time/0</c></seealso>,
and <seealso marker="#system_time/1"><c>os:system_time/1</c></seealso>.</p>
</desc>
</func>
diff --git a/lib/kernel/doc/src/ref_man.xml.src b/lib/kernel/doc/src/ref_man.xml.src
deleted file mode 100644
index 7eb48a5f1d..0000000000
--- a/lib/kernel/doc/src/ref_man.xml.src
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE application SYSTEM "application.dtd">
-
-<application xmlns:xi="http://www.w3.org/2001/XInclude">
- <header>
- <copyright>
- <year>1996</year><year>2013</year>
- <holder>Ericsson AB. All Rights Reserved.</holder>
- </copyright>
- <legalnotice>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- </legalnotice>
-
- <title>Kernel Reference Manual</title>
- <prepared></prepared>
- <docno></docno>
- <date></date>
- <rev></rev>
- </header>
- <description>
- <p>The <em>Kernel</em> application has all the code necessary to run
- the Erlang runtime system itself: file servers and code servers
- and so on.</p>
- </description>
- <xi:include href="kernel_app.xml"/>
- <xi:include href="application.xml"/>
- <xi:include href="auth.xml"/>
- <xi:include href="code.xml"/>
- <xi:include href="disk_log.xml"/>
- <xi:include href="erl_boot_server.xml"/>
- <xi:include href="erl_ddll.xml"/>
- <xi:include href="erl_prim_loader_stub.xml"/>
- <xi:include href="erlang_stub.xml"/>
- <xi:include href="error_handler.xml"/>
- <xi:include href="error_logger.xml"/>
- <xi:include href="file.xml"/>
- <xi:include href="gen_tcp.xml"/>
- <xi:include href="gen_udp.xml"/>
- <xi:include href="gen_sctp.xml"/>
- <xi:include href="global.xml"/>
- <xi:include href="global_group.xml"/>
- <xi:include href="heart.xml"/>
- <xi:include href="inet.xml"/>
- <xi:include href="inet_res.xml"/>
- <xi:include href="init_stub.xml"/>
- <xi:include href="net_adm.xml"/>
- <xi:include href="net_kernel.xml"/>
- <xi:include href="os.xml"/>
- <xi:include href="pg2.xml"/>
- <xi:include href="rpc.xml"/>
- <xi:include href="seq_trace.xml"/>
- <xi:include href="user.xml"/>
- <xi:include href="wrap_log_reader.xml"/>
- <xi:include href="zlib_stub.xml"/>
- <xi:include href="app.xml"/>
- <xi:include href="config.xml"/>
-</application>
diff --git a/lib/kernel/include/file.hrl b/lib/kernel/include/file.hrl
index 7cf033f7f5..36112bb040 100644
--- a/lib/kernel/include/file.hrl
+++ b/lib/kernel/include/file.hrl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2013. All Rights Reserved.
+%% Copyright Ericsson AB 1997-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -23,37 +23,40 @@
%%--------------------------------------------------------------------------
-record(file_info,
- {size :: non_neg_integer(), % Size of file in bytes.
- type :: 'device' | 'directory' | 'other' | 'regular' | 'symlink',
- access :: 'read' | 'write' | 'read_write' | 'none',
- atime :: file:date_time() | non_neg_integer(),
+ {size :: non_neg_integer() | 'undefined', % Size of file in bytes.
+ type :: 'device' | 'directory' | 'other' | 'regular' | 'symlink'
+ | 'undefined',
+ access :: 'read' | 'write' | 'read_write' | 'none' | 'undefined',
+ atime :: file:date_time() | non_neg_integer() | 'undefined',
% The local time the file was last read:
% {{Year, Mon, Day}, {Hour, Min, Sec}}.
% atime, ctime, mtime may also be unix epochs()
- mtime :: file:date_time() | non_neg_integer(),
+ mtime :: file:date_time() | non_neg_integer() | 'undefined',
% The local time the file was last written.
- ctime :: file:date_time() | non_neg_integer(),
+ ctime :: file:date_time() | non_neg_integer() | 'undefined',
% The interpretation of this time field
% is dependent on operating system.
% On Unix it is the last time the file
% or the inode was changed. On Windows,
% it is the creation time.
- mode :: non_neg_integer(), % File permissions. On Windows,
+ mode :: non_neg_integer() | 'undefined',
+ % File permissions. On Windows,
% the owner permissions will be
% duplicated for group and user.
- links :: non_neg_integer(),
+ links :: non_neg_integer() | 'undefined',
% Number of links to the file (1 if the
% filesystem doesn't support links).
- major_device :: non_neg_integer(),
+ major_device :: non_neg_integer() | 'undefined',
% Identifies the file system (Unix),
% or the drive number (A: = 0, B: = 1)
% (Windows).
%% The following are Unix specific.
%% They are set to zero on other operating systems.
- minor_device :: non_neg_integer(), % Only valid for devices.
- inode :: non_neg_integer(), % Inode number for file.
- uid :: non_neg_integer(), % User id for owner.
- gid :: non_neg_integer()}). % Group id for owner.
+ minor_device :: non_neg_integer() | 'undefined',
+ % Only valid for devices.
+ inode :: non_neg_integer() | 'undefined', % Inode number for file.
+ uid :: non_neg_integer() | 'undefined', % User id for owner.
+ gid :: non_neg_integer() | 'undefined'}). % Group id for owner.
-record(file_descriptor,
diff --git a/lib/kernel/src/disk_log.erl b/lib/kernel/src/disk_log.erl
index f5450f30af..9b44021872 100644
--- a/lib/kernel/src/disk_log.erl
+++ b/lib/kernel/src/disk_log.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2013. All Rights Reserved.
+%% Copyright Ericsson AB 1997-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -1310,13 +1310,20 @@ compare_arg(_Attr, _Val, _A) ->
%% -> {ok, Res, log(), Cnt} | Error
do_open(A) ->
- L = #log{name = A#arg.name,
- filename = A#arg.file,
- size = A#arg.size,
- head = mk_head(A#arg.head, A#arg.format),
- mode = A#arg.mode,
- version = A#arg.version},
- do_open2(L, A).
+ #arg{type = Type, format = Format, name = Name, head = Head0,
+ file = FName, repair = Repair, size = Size, mode = Mode,
+ version = V} = A,
+ Head = mk_head(Head0, Format),
+ case do_open2(Type, Format, Name, FName, Repair, Size, Mode, Head, V) of
+ {ok, Ret, Extra, FormatType, NoItems} ->
+ L = #log{name = Name, type = Type, format = Format,
+ filename = FName, size = Size,
+ format_type = FormatType, head = Head, mode = Mode,
+ version = V, extra = Extra},
+ {ok, Ret, L, NoItems};
+ Error ->
+ Error
+ end.
mk_head({head, Term}, internal) -> {ok, term_to_binary(Term)};
mk_head({head, Bytes}, external) -> {ok, check_bytes(Bytes)};
@@ -1432,57 +1439,44 @@ do_inc_wrap_file(L) ->
%%-----------------------------------------------------------------
%% -> {ok, Reply, log(), Cnt} | Error
%% Note: the header is always written, even if the log size is too small.
-do_open2(L, #arg{type = halt, format = internal, name = Name,
- file = FName, repair = Repair, size = Size, mode = Mode}) ->
- case catch disk_log_1:int_open(FName, Repair, Mode, L#log.head) of
+do_open2(halt, internal, Name, FName, Repair, Size, Mode, Head, _V) ->
+ case catch disk_log_1:int_open(FName, Repair, Mode, Head) of
{ok, {_Alloc, FdC, {NoItems, _NoBytes}, FileSize}} ->
Halt = #halt{fdc = FdC, curB = FileSize, size = Size},
- {ok, {ok, Name}, L#log{format_type = halt_int, extra = Halt},
- NoItems};
+ {ok, {ok, Name}, Halt, halt_int, NoItems};
{repaired, FdC, Rec, Bad, FileSize} ->
Halt = #halt{fdc = FdC, curB = FileSize, size = Size},
{ok, {repaired, Name, {recovered, Rec}, {badbytes, Bad}},
- L#log{format_type = halt_int, extra = Halt},
- Rec};
+ Halt, halt_int, Rec};
Error ->
Error
end;
-do_open2(L, #arg{type = wrap, format = internal, size = {MaxB, MaxF},
- name = Name, repair = Repair, file = FName, mode = Mode,
- version = V}) ->
+do_open2(wrap, internal, Name, FName, Repair, Size, Mode, Head, V) ->
+ {MaxB, MaxF} = Size,
case catch
- disk_log_1:mf_int_open(FName, MaxB, MaxF, Repair, Mode, L#log.head, V) of
+ disk_log_1:mf_int_open(FName, MaxB, MaxF, Repair, Mode, Head, V) of
{ok, Handle, Cnt} ->
- {ok, {ok, Name}, L#log{type = wrap,
- format_type = wrap_int,
- extra = Handle}, Cnt};
+ {ok, {ok, Name}, Handle, wrap_int, Cnt};
{repaired, Handle, Rec, Bad, Cnt} ->
{ok, {repaired, Name, {recovered, Rec}, {badbytes, Bad}},
- L#log{type = wrap, format_type = wrap_int, extra = Handle}, Cnt};
+ Handle, wrap_int, Cnt};
Error ->
Error
end;
-do_open2(L, #arg{type = halt, format = external, file = FName, name = Name,
- size = Size, repair = Repair, mode = Mode}) ->
- case catch disk_log_1:ext_open(FName, Repair, Mode, L#log.head) of
+do_open2(halt, external, Name, FName, Repair, Size, Mode, Head, _V) ->
+ case catch disk_log_1:ext_open(FName, Repair, Mode, Head) of
{ok, {_Alloc, FdC, {NoItems, _NoBytes}, FileSize}} ->
Halt = #halt{fdc = FdC, curB = FileSize, size = Size},
- {ok, {ok, Name},
- L#log{format_type = halt_ext, format = external, extra = Halt},
- NoItems};
+ {ok, {ok, Name}, Halt, halt_ext, NoItems};
Error ->
Error
end;
-do_open2(L, #arg{type = wrap, format = external, size = {MaxB, MaxF},
- name = Name, file = FName, repair = Repair, mode = Mode,
- version = V}) ->
+do_open2(wrap, external, Name, FName, Repair, Size, Mode, Head, V) ->
+ {MaxB, MaxF} = Size,
case catch
- disk_log_1:mf_ext_open(FName, MaxB, MaxF, Repair, Mode, L#log.head, V) of
+ disk_log_1:mf_ext_open(FName, MaxB, MaxF, Repair, Mode, Head, V) of
{ok, Handle, Cnt} ->
- {ok, {ok, Name}, L#log{type = wrap,
- format_type = wrap_ext,
- extra = Handle,
- format = external}, Cnt};
+ {ok, {ok, Name}, Handle, wrap_ext, Cnt};
Error ->
Error
end.
diff --git a/lib/kernel/src/disk_log.hrl b/lib/kernel/src/disk_log.hrl
index 6c0aea070f..3262d979ee 100644
--- a/lib/kernel/src/disk_log.hrl
+++ b/lib/kernel/src/disk_log.hrl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2012. All Rights Reserved.
+%% Copyright Ericsson AB 1997-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -152,8 +152,8 @@
users = 0 :: non_neg_integer(), %% non-linked users
filename :: file:filename(), %% real name of the file
owners = [] :: [{pid(), boolean()}],%% [{pid, notify}]
- type = halt :: dlog_type(),
- format = internal :: dlog_format(),
+ type :: dlog_type(),
+ format :: dlog_format(),
format_type :: dlog_format_type(),
head = none, %% none | {head, H} | {M,F,A}
%% called when wraplog wraps
diff --git a/lib/kernel/src/global.erl b/lib/kernel/src/global.erl
index 2be1efaf24..dcabeb5e49 100644
--- a/lib/kernel/src/global.erl
+++ b/lib/kernel/src/global.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2014. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -459,17 +459,17 @@ init([]) ->
no_trace
end,
+ Ca = case init:get_argument(connect_all) of
+ {ok, [["false"]]} ->
+ false;
+ _ ->
+ true
+ end,
S = #state{the_locker = start_the_locker(DoTrace),
trace = T0,
- the_registrar = start_the_registrar()},
- S1 = trace_message(S, {init, node()}, []),
-
- case init:get_argument(connect_all) of
- {ok, [["false"]]} ->
- {ok, S1#state{connect_all = false}};
- _ ->
- {ok, S1#state{connect_all = true}}
- end.
+ the_registrar = start_the_registrar(),
+ connect_all = Ca},
+ {ok, trace_message(S, {init, node()}, [])}.
%%-----------------------------------------------------------------
%% Connection algorithm
diff --git a/lib/kernel/src/global_group.erl b/lib/kernel/src/global_group.erl
index 848df13c39..e71f83f9d3 100644
--- a/lib/kernel/src/global_group.erl
+++ b/lib/kernel/src/global_group.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1998-2013. All Rights Reserved.
+%% Copyright Ericsson AB 1998-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -273,7 +273,7 @@ init([]) ->
{ok, #state{publish_type = PT, group_publish_type = PubTpGrp,
sync_state = synced, group_name = DefGroupName,
no_contact = lists:sort(DefNodes),
- other_grps = DefOther}}
+ other_grps = DefOther, connect_all = Ca}}
end.
diff --git a/lib/kernel/src/inet.erl b/lib/kernel/src/inet.erl
index da7f04089d..855c6377a3 100644
--- a/lib/kernel/src/inet.erl
+++ b/lib/kernel/src/inet.erl
@@ -671,7 +671,7 @@ stats() ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
connect_options() ->
[tos, priority, reuseaddr, keepalive, linger, sndbuf, recbuf, nodelay,
- header, active, packet, packet_size, buffer, mode, deliver,
+ header, active, packet, packet_size, buffer, mode, deliver, line_delimiter,
exit_on_close, high_watermark, low_watermark, high_msgq_watermark,
low_msgq_watermark, send_timeout, send_timeout_close, delay_send, raw,
show_econnreset].
@@ -721,6 +721,8 @@ con_opt([Opt | Opts], #connect_opts{} = R, As) ->
{active,N} when is_integer(N), N < 32768, N >= -32768 ->
NOpts = lists:keydelete(active, 1, R#connect_opts.opts),
con_opt(Opts, R#connect_opts { opts = [{active,N}|NOpts] }, As);
+ {line_delimiter,C} when is_integer(C), C >= 0, C =< 255 ->
+ con_add(line_delimiter, C, R, Opts, As);
{Name,Val} when is_atom(Name) -> con_add(Name, Val, R, Opts, As);
_ -> {error, badarg}
end;
diff --git a/lib/kernel/src/inet6_tcp.erl b/lib/kernel/src/inet6_tcp.erl
index 2ea017285c..1978307b3c 100644
--- a/lib/kernel/src/inet6_tcp.erl
+++ b/lib/kernel/src/inet6_tcp.erl
@@ -25,10 +25,29 @@
-export([controlling_process/2]).
-export([fdopen/2]).
+-export([family/0, mask/2, parse_address/1]).
-export([getserv/1, getaddr/1, getaddr/2, getaddrs/1, getaddrs/2]).
-include("inet_int.hrl").
+%% my address family
+family() -> inet6.
+
+%% Apply netmask on address
+mask({M1,M2,M3,M4,M5,M6,M7,M8}, {IP1,IP2,IP3,IP4,IP5,IP6,IP7,IP8}) ->
+ {M1 band IP1,
+ M2 band IP2,
+ M3 band IP3,
+ M4 band IP4,
+ M5 band IP5,
+ M6 band IP6,
+ M7 band IP7,
+ M8 band IP8 }.
+
+%% Parse address string
+parse_address(Host) ->
+ inet_parse:ipv6strict_address(Host).
+
%% inet_tcp port lookup
getserv(Port) when is_integer(Port) -> {ok, Port};
getserv(Name) when is_atom(Name) -> inet:getservbyname(Name,tcp).
diff --git a/lib/kernel/src/inet6_tcp_dist.erl b/lib/kernel/src/inet6_tcp_dist.erl
index a74a4916ba..3ab7f269bb 100644
--- a/lib/kernel/src/inet6_tcp_dist.erl
+++ b/lib/kernel/src/inet6_tcp_dist.erl
@@ -24,28 +24,6 @@
-export([listen/1, accept/1, accept_connection/5,
setup/5, close/1, select/1, is_node_name/1]).
-%% internal exports
-
--export([accept_loop/2,do_accept/6,do_setup/6, getstat/1,tick/1]).
-
--import(error_logger,[error_msg/2]).
-
--include("net_address.hrl").
-
-
-
--define(to_port(Socket, Data, Opts),
- case inet6_tcp:send(Socket, Data, Opts) of
- {error, closed} ->
- self() ! {tcp_closed, Socket},
- {error, closed};
- R ->
- R
- end).
-
-
--include("dist.hrl").
--include("dist_util.hrl").
%% ------------------------------------------------------------
%% Select this protocol based on node name
@@ -53,14 +31,7 @@
%% ------------------------------------------------------------
select(Node) ->
- case split_node(atom_to_list(Node), $@, []) of
- [_, Host] ->
- case inet:getaddr(Host,inet6) of
- {ok,_} -> true;
- _ -> false
- end;
- _ -> false
- end.
+ inet_tcp_dist:gen_select(inet6_tcp, Node).
%% ------------------------------------------------------------
%% Create the listen socket, i.e. the port that this erlang
@@ -68,59 +39,14 @@ select(Node) ->
%% ------------------------------------------------------------
listen(Name) ->
- case inet6_tcp:listen(0, [{active, false}, {packet,2}]) of
- {ok, Socket} ->
- TcpAddress = get_tcp_address(Socket),
- {_,Port} = TcpAddress#net_address.address,
- case erl_epmd:register_node(Name, Port) of
- {ok, Creation} ->
- {ok, {Socket, TcpAddress, Creation}};
- Error ->
- Error
- end;
- Error ->
- Error
- end.
+ inet_tcp_dist:gen_listen(inet6_tcp, Name).
%% ------------------------------------------------------------
%% Accepts new connection attempts from other Erlang nodes.
%% ------------------------------------------------------------
accept(Listen) ->
- spawn_opt(?MODULE, accept_loop, [self(), Listen], [link, {priority, max}]).
-
-accept_loop(Kernel, Listen) ->
- case inet6_tcp:accept(Listen) of
- {ok, Socket} ->
- Kernel ! {accept,self(),Socket,inet6,tcp},
- _ = controller(Kernel, Socket),
- accept_loop(Kernel, Listen);
- Error ->
- exit(Error)
- end.
-
-controller(Kernel, Socket) ->
- receive
- {Kernel, controller, Pid} ->
- flush_controller(Pid, Socket),
- inet6_tcp:controlling_process(Socket, Pid),
- flush_controller(Pid, Socket),
- Pid ! {self(), controller};
- {Kernel, unsupported_protocol} ->
- exit(unsupported_protocol)
- end.
-
-flush_controller(Pid, Socket) ->
- receive
- {tcp, Socket, Data} ->
- Pid ! {tcp, Socket, Data},
- flush_controller(Pid, Socket);
- {tcp_closed, Socket} ->
- Pid ! {tcp_closed, Socket},
- flush_controller(Pid, Socket)
- after 0 ->
- ok
- end.
+ inet_tcp_dist:gen_accept(inet6_tcp, Listen).
%% ------------------------------------------------------------
%% Accepts a new connection attempt from another Erlang node.
@@ -128,85 +54,7 @@ flush_controller(Pid, Socket) ->
%% ------------------------------------------------------------
accept_connection(AcceptPid, Socket, MyNode, Allowed, SetupTime) ->
- spawn_opt(?MODULE, do_accept,
- [self(), AcceptPid, Socket, MyNode, Allowed, SetupTime],
- [link, {priority, max}]).
-
-do_accept(Kernel, AcceptPid, Socket, MyNode, Allowed, SetupTime) ->
- receive
- {AcceptPid, controller} ->
- Timer = dist_util:start_timer(SetupTime),
- case check_ip(Socket) of
- true ->
- HSData = #hs_data{
- kernel_pid = Kernel,
- this_node = MyNode,
- socket = Socket,
- timer = Timer,
- this_flags = 0,
- allowed = Allowed,
- f_send = fun(S,D) -> inet6_tcp:send(S,D) end,
- f_recv = fun(S,N,T) -> inet6_tcp:recv(S,N,T)
- end,
- f_setopts_pre_nodeup =
- fun(S) ->
- inet:setopts(S,
- [{active, false},
- {packet, 4},
- nodelay()])
- end,
- f_setopts_post_nodeup =
- fun(S) ->
- inet:setopts(S,
- [{active, true},
- {deliver, port},
- {packet, 4},
- nodelay()])
- end,
- f_getll = fun(S) ->
- inet:getll(S)
- end,
- f_address = fun get_remote_id/2,
- mf_tick = fun ?MODULE:tick/1,
- mf_getstat = fun ?MODULE:getstat/1
- },
- dist_util:handshake_other_started(HSData);
- {false,IP} ->
- error_msg("** Connection attempt from "
- "disallowed IP ~w ** ~n", [IP]),
- ?shutdown(no_node)
- end
- end.
-
-
-%% we may not always want the nodelay behaviour
-%% for performance reasons
-
-nodelay() ->
- case application:get_env(kernel, dist_nodelay) of
- undefined ->
- {nodelay, true};
- {ok, true} ->
- {nodelay, true};
- {ok, false} ->
- {nodelay, false};
- _ ->
- {nodelay, true}
- end.
-
-
-%% ------------------------------------------------------------
-%% Get remote information about a Socket.
-%% ------------------------------------------------------------
-
-get_remote_id(Socket, Node) ->
- {ok, Address} = inet:peername(Socket),
- [_, Host] = split_node(atom_to_list(Node), $@, []),
- #net_address {
- address = Address,
- host = Host,
- protocol = tcp,
- family = inet6 }.
+ inet_tcp_dist:gen_accept_connection(inet6_tcp, AcceptPid, Socket, MyNode, Allowed, SetupTime).
%% ------------------------------------------------------------
%% Setup a new connection to another Erlang node.
@@ -214,214 +62,13 @@ get_remote_id(Socket, Node) ->
%% ------------------------------------------------------------
setup(Node, Type, MyNode, LongOrShortNames,SetupTime) ->
- spawn_opt(?MODULE, do_setup,
- [self(), Node, Type, MyNode, LongOrShortNames, SetupTime],
- [link, {priority, max}]).
-
-do_setup(Kernel, Node, Type, MyNode, LongOrShortNames,SetupTime) ->
- ?trace("~p~n",[{?MODULE,self(),setup,Node}]),
- [Name, Address] = splitnode(Node, LongOrShortNames),
- case inet:getaddr(Address, inet6) of
- {ok, Ip} ->
- Timer = dist_util:start_timer(SetupTime),
- case erl_epmd:port_please(Name, Ip) of
- {port, TcpPort, Version} ->
- ?trace("port_please(~p) -> version ~p~n",
- [Node,Version]),
- dist_util:reset_timer(Timer),
- case inet6_tcp:connect(Ip, TcpPort,
- [{active, false},
- {packet,2}]) of
- {ok, Socket} ->
- HSData = #hs_data{
- kernel_pid = Kernel,
- other_node = Node,
- this_node = MyNode,
- socket = Socket,
- timer = Timer,
- this_flags = 0,
- other_version = Version,
- f_send = fun inet6_tcp:send/2,
- f_recv = fun inet6_tcp:recv/3,
- f_setopts_pre_nodeup =
- fun(S) ->
- inet:setopts
- (S,
- [{active, false},
- {packet, 4},
- nodelay()])
- end,
- f_setopts_post_nodeup =
- fun(S) ->
- inet:setopts
- (S,
- [{active, true},
- {deliver, port},
- {packet, 4},
- nodelay()])
- end,
- f_getll = fun inet:getll/1,
- f_address =
- fun(_,_) ->
- #net_address {
- address = {Ip,TcpPort},
- host = Address,
- protocol = tcp,
- family = inet6}
- end,
- mf_tick = fun ?MODULE:tick/1,
- mf_getstat = fun ?MODULE:getstat/1,
- request_type = Type
- },
- dist_util:handshake_we_started(HSData);
- _ ->
- %% Other Node may have closed since
- %% port_please !
- ?trace("other node (~p) "
- "closed since port_please.~n",
- [Node]),
- ?shutdown(Node)
- end;
- _ ->
- ?trace("port_please (~p) "
- "failed.~n", [Node]),
- ?shutdown(Node)
- end;
- __Other ->
- ?trace("inet_getaddr(~p) "
- "failed (~p).~n", [Node,__Other]),
- ?shutdown(Node)
- end.
+ inet_tcp_dist:gen_setup(inet6_tcp, Node, Type, MyNode, LongOrShortNames, SetupTime).
%%
%% Close a socket.
%%
close(Socket) ->
inet6_tcp:close(Socket).
-
-
-%% If Node is illegal terminate the connection setup!!
-splitnode(Node, LongOrShortNames) ->
- case split_node(atom_to_list(Node), $@, []) of
- [Name|Tail] when Tail =/= [] ->
- Host = lists:append(Tail),
- case split_node(Host, $., []) of
- [_] when LongOrShortNames =:= longnames ->
- case inet_parse:ipv6strict_address(Host) of
- {ok, _} ->
- [Name, Host];
- _ ->
- error_msg("** System running to use "
- "fully qualified "
- "hostnames **~n"
- "** Hostname ~s is illegal **~n",
- [Host]),
- ?shutdown(Node)
- end;
- L when length(L) > 1, LongOrShortNames =:= shortnames ->
- error_msg("** System NOT running to use fully qualified "
- "hostnames **~n"
- "** Hostname ~s is illegal **~n",
- [Host]),
- ?shutdown(Node);
- _ ->
- [Name, Host]
- end;
- [_] ->
- error_msg("** Nodename ~p illegal, no '@' character **~n",
- [Node]),
- ?shutdown(Node);
- _ ->
- error_msg("** Nodename ~p illegal **~n", [Node]),
- ?shutdown(Node)
- end.
-
-split_node([Chr|T], Chr, Ack) -> [lists:reverse(Ack)|split_node(T, Chr, [])];
-split_node([H|T], Chr, Ack) -> split_node(T, Chr, [H|Ack]);
-split_node([], _, Ack) -> [lists:reverse(Ack)].
-
-%% ------------------------------------------------------------
-%% Fetch local information about a Socket.
-%% ------------------------------------------------------------
-get_tcp_address(Socket) ->
- {ok, Address} = inet:sockname(Socket),
- {ok, Host} = inet:gethostname(),
- #net_address {
- address = Address,
- host = Host,
- protocol = tcp,
- family = inet6
- }.
-
-%% ------------------------------------------------------------
-%% Do only accept new connection attempts from nodes at our
-%% own LAN, if the check_ip environment parameter is true.
-%% ------------------------------------------------------------
-check_ip(Socket) ->
- case application:get_env(check_ip) of
- {ok, true} ->
- case get_ifs(Socket) of
- {ok, IFs, IP} ->
- check_ip(IFs, IP);
- _ ->
- ?shutdown(no_node)
- end;
- _ ->
- true
- end.
-
-get_ifs(Socket) ->
- case inet:peername(Socket) of
- {ok, {IP, _}} ->
- case inet:getif(Socket) of
- {ok, IFs} -> {ok, IFs, IP};
- Error -> Error
- end;
- Error ->
- Error
- end.
-
-check_ip([{OwnIP, _, Netmask}|IFs], PeerIP) ->
- case {mask(Netmask, PeerIP), mask(Netmask, OwnIP)} of
- {M, M} -> true;
- _ -> check_ip(IFs, PeerIP)
- end;
-check_ip([], PeerIP) ->
- {false, PeerIP}.
-mask({M1,M2,M3,M4,M5,M6,M7,M8}, {IP1,IP2,IP3,IP4,IP5,IP6,IP7,IP8}) ->
- {M1 band IP1,
- M2 band IP2,
- M3 band IP3,
- M4 band IP4,
- M5 band IP5,
- M6 band IP6,
- M7 band IP7,
- M8 band IP8 }.
-
is_node_name(Node) when is_atom(Node) ->
- case split_node(atom_to_list(Node), $@, []) of
- [_,_Host] -> true;
- _ -> false
- end;
-is_node_name(_Node) ->
- false.
-tick(Sock) ->
- ?to_port(Sock,[],[force]).
-getstat(Socket) ->
- case inet:getstat(Socket, [recv_cnt, send_cnt, send_pend]) of
- {ok, Stat} ->
- split_stat(Stat,0,0,0);
- Error ->
- Error
- end.
-
-split_stat([{recv_cnt, R}|Stat], _, W, P) ->
- split_stat(Stat, R, W, P);
-split_stat([{send_cnt, W}|Stat], R, _, P) ->
- split_stat(Stat, R, W, P);
-split_stat([{send_pend, P}|Stat], R, W, _) ->
- split_stat(Stat, R, W, P);
-split_stat([], R, W, P) ->
- {ok, R, W, P}.
-
+ inet_tcp_dist:is_node_name(Node).
diff --git a/lib/kernel/src/inet_config.erl b/lib/kernel/src/inet_config.erl
index 803fae846e..a0d5344f11 100644
--- a/lib/kernel/src/inet_config.erl
+++ b/lib/kernel/src/inet_config.erl
@@ -188,9 +188,6 @@ do_load_resolv({win32,Type}, longnames) ->
win32_load_from_registry(Type),
inet_db:set_lookup([native]);
-do_load_resolv({ose,_}, _) ->
- inet_db:set_lookup([file]);
-
do_load_resolv(_, _) ->
inet_db:set_lookup([native]).
diff --git a/lib/kernel/src/inet_dns_record_adts.pl b/lib/kernel/src/inet_dns_record_adts.pl
index 657d2b9d35..6d719d836e 100644
--- a/lib/kernel/src/inet_dns_record_adts.pl
+++ b/lib/kernel/src/inet_dns_record_adts.pl
@@ -57,7 +57,8 @@ while(<DATA>) {
$" = ',';
$\ = "\n";
-while( my ($Name, $r) = each(%Names)) {
+foreach my $Name (sort keys %Names) {
+ my $r = $Names{$Name};
# Create substitutions for this Name
my ($Record, @Fields) = @{ $r };
my @FieldMatchValues;
@@ -110,7 +111,8 @@ while( my ($Name, $r) = each(%Names)) {
for my $i ( 0 .. $#INDEX ) {
my $line = $INDEX[$i];
if ($line =~ s/^[*]//) {
- while( my ($Name, $r) = each(%Names)) {
+ foreach my $Name (sort keys %Names) {
+ my $r = $Names{$Name};
my ($Record) = @{ $r };
$_ = $line;
s/Name\b/$Name/g;
diff --git a/lib/kernel/src/inet_int.hrl b/lib/kernel/src/inet_int.hrl
index bfe4c9ec8c..e7c6cf8ae2 100644
--- a/lib/kernel/src/inet_int.hrl
+++ b/lib/kernel/src/inet_int.hrl
@@ -149,6 +149,7 @@
-define(INET_LOPT_MSGQ_LOWTRMRK, 37).
-define(INET_LOPT_NETNS, 38).
-define(INET_LOPT_TCP_SHOW_ECONNRESET, 39).
+-define(INET_LOPT_LINE_DELIM, 40).
% Specific SCTP options: separate range:
-define(SCTP_OPT_RTOINFO, 100).
-define(SCTP_OPT_ASSOCINFO, 101).
diff --git a/lib/kernel/src/inet_tcp.erl b/lib/kernel/src/inet_tcp.erl
index b5c758c02c..f551af9709 100644
--- a/lib/kernel/src/inet_tcp.erl
+++ b/lib/kernel/src/inet_tcp.erl
@@ -27,11 +27,25 @@
-export([controlling_process/2]).
-export([fdopen/2]).
+-export([family/0, mask/2, parse_address/1]).
-export([getserv/1, getaddr/1, getaddr/2, getaddrs/1, getaddrs/2]).
-
-include("inet_int.hrl").
+%% my address family
+family() -> inet.
+
+%% Apply netmask on address
+mask({M1,M2,M3,M4}, {IP1,IP2,IP3,IP4}) ->
+ {M1 band IP1,
+ M2 band IP2,
+ M3 band IP3,
+ M4 band IP4}.
+
+%% Parse address string
+parse_address(Host) ->
+ inet_parse:ipv4strict_address(Host).
+
%% inet_tcp port lookup
getserv(Port) when is_integer(Port) -> {ok, Port};
getserv(Name) when is_atom(Name) -> inet:getservbyname(Name,tcp).
diff --git a/lib/kernel/src/inet_tcp_dist.erl b/lib/kernel/src/inet_tcp_dist.erl
index 1bdc1c9ed8..64b28bb49b 100644
--- a/lib/kernel/src/inet_tcp_dist.erl
+++ b/lib/kernel/src/inet_tcp_dist.erl
@@ -24,9 +24,13 @@
-export([listen/1, accept/1, accept_connection/5,
setup/5, close/1, select/1, is_node_name/1]).
+%% Generalized dist API
+-export([gen_listen/2, gen_accept/2, gen_accept_connection/6,
+ gen_setup/6, gen_select/2]).
+
%% internal exports
--export([accept_loop/2,do_accept/6,do_setup/6,getstat/1,tick/1]).
+-export([accept_loop/3,do_accept/7,do_setup/7,getstat/1]).
-import(error_logger,[error_msg/2]).
@@ -34,15 +38,6 @@
--define(to_port(Socket, Data, Opts),
- case inet_tcp:send(Socket, Data, Opts) of
- {error, closed} ->
- self() ! {tcp_closed, Socket},
- {error, closed};
- R ->
- R
- end).
-
-include("dist.hrl").
-include("dist_util.hrl").
@@ -53,8 +48,15 @@
%% ------------------------------------------------------------
select(Node) ->
+ gen_select(inet_tcp, Node).
+
+gen_select(Driver, Node) ->
case split_node(atom_to_list(Node), $@, []) of
- [_,_Host] -> true;
+ [_, Host] ->
+ case inet:getaddr(Host, Driver:family()) of
+ {ok,_} -> true;
+ _ -> false
+ end;
_ -> false
end.
@@ -64,9 +66,12 @@ select(Node) ->
%% ------------------------------------------------------------
listen(Name) ->
- case do_listen([{active, false}, {packet,2}, {reuseaddr, true}]) of
+ gen_listen(inet_tcp, Name).
+
+gen_listen(Driver, Name) ->
+ case do_listen(Driver, [{active, false}, {packet,2}, {reuseaddr, true}]) of
{ok, Socket} ->
- TcpAddress = get_tcp_address(Socket),
+ TcpAddress = get_tcp_address(Driver, Socket),
{_,Port} = TcpAddress#net_address.address,
case erl_epmd:register_node(Name, Port) of
{ok, Creation} ->
@@ -78,7 +83,7 @@ listen(Name) ->
Error
end.
-do_listen(Options) ->
+do_listen(Driver, Options) ->
{First,Last} = case application:get_env(kernel,inet_dist_listen_min) of
{ok,N} when is_integer(N) ->
case application:get_env(kernel,
@@ -91,14 +96,14 @@ do_listen(Options) ->
_ ->
{0,0}
end,
- do_listen(First, Last, listen_options([{backlog,128}|Options])).
+ do_listen(Driver, First, Last, listen_options([{backlog,128}|Options])).
-do_listen(First,Last,_) when First > Last ->
+do_listen(_Driver, First,Last,_) when First > Last ->
{error,eaddrinuse};
-do_listen(First,Last,Options) ->
- case inet_tcp:listen(First, Options) of
+do_listen(Driver, First,Last,Options) ->
+ case Driver:listen(First, Options) of
{error, eaddrinuse} ->
- do_listen(First+1,Last,Options);
+ do_listen(Driver, First+1,Last,Options);
Other ->
Other
end.
@@ -124,23 +129,26 @@ listen_options(Opts0) ->
%% ------------------------------------------------------------
accept(Listen) ->
- spawn_opt(?MODULE, accept_loop, [self(), Listen], [link, {priority, max}]).
+ gen_accept(inet_tcp, Listen).
-accept_loop(Kernel, Listen) ->
- case inet_tcp:accept(Listen) of
+gen_accept(Driver, Listen) ->
+ spawn_opt(?MODULE, accept_loop, [Driver, self(), Listen], [link, {priority, max}]).
+
+accept_loop(Driver, Kernel, Listen) ->
+ case Driver:accept(Listen) of
{ok, Socket} ->
- Kernel ! {accept,self(),Socket,inet,tcp},
- _ = controller(Kernel, Socket),
- accept_loop(Kernel, Listen);
+ Kernel ! {accept,self(),Socket,Driver:family(),tcp},
+ _ = controller(Driver, Kernel, Socket),
+ accept_loop(Driver, Kernel, Listen);
Error ->
exit(Error)
end.
-controller(Kernel, Socket) ->
+controller(Driver, Kernel, Socket) ->
receive
{Kernel, controller, Pid} ->
flush_controller(Pid, Socket),
- inet_tcp:controlling_process(Socket, Pid),
+ Driver:controlling_process(Socket, Pid),
flush_controller(Pid, Socket),
Pid ! {self(), controller};
{Kernel, unsupported_protocol} ->
@@ -165,15 +173,18 @@ flush_controller(Pid, Socket) ->
%% ------------------------------------------------------------
accept_connection(AcceptPid, Socket, MyNode, Allowed, SetupTime) ->
+ gen_accept_connection(inet_tcp, AcceptPid, Socket, MyNode, Allowed, SetupTime).
+
+gen_accept_connection(Driver, AcceptPid, Socket, MyNode, Allowed, SetupTime) ->
spawn_opt(?MODULE, do_accept,
- [self(), AcceptPid, Socket, MyNode, Allowed, SetupTime],
+ [Driver, self(), AcceptPid, Socket, MyNode, Allowed, SetupTime],
[link, {priority, max}]).
-do_accept(Kernel, AcceptPid, Socket, MyNode, Allowed, SetupTime) ->
+do_accept(Driver, Kernel, AcceptPid, Socket, MyNode, Allowed, SetupTime) ->
receive
{AcceptPid, controller} ->
Timer = dist_util:start_timer(SetupTime),
- case check_ip(Socket) of
+ case check_ip(Driver, Socket) of
true ->
HSData = #hs_data{
kernel_pid = Kernel,
@@ -182,9 +193,8 @@ do_accept(Kernel, AcceptPid, Socket, MyNode, Allowed, SetupTime) ->
timer = Timer,
this_flags = 0,
allowed = Allowed,
- f_send = fun(S,D) -> inet_tcp:send(S,D) end,
- f_recv = fun(S,N,T) -> inet_tcp:recv(S,N,T)
- end,
+ f_send = fun Driver:send/2,
+ f_recv = fun Driver:recv/3,
f_setopts_pre_nodeup =
fun(S) ->
inet:setopts(S,
@@ -203,8 +213,8 @@ do_accept(Kernel, AcceptPid, Socket, MyNode, Allowed, SetupTime) ->
f_getll = fun(S) ->
inet:getll(S)
end,
- f_address = fun get_remote_id/2,
- mf_tick = fun ?MODULE:tick/1,
+ f_address = fun(S, Node) -> get_remote_id(Driver, S, Node) end,
+ mf_tick = fun(S) -> tick(Driver, S) end,
mf_getstat = fun ?MODULE:getstat/1
},
dist_util:handshake_other_started(HSData);
@@ -235,13 +245,13 @@ nodelay() ->
%% ------------------------------------------------------------
%% Get remote information about a Socket.
%% ------------------------------------------------------------
-get_remote_id(Socket, Node) ->
+get_remote_id(Driver, Socket, Node) ->
case inet:peername(Socket) of
{ok,Address} ->
case split_node(atom_to_list(Node), $@, []) of
[_,Host] ->
#net_address{address=Address,host=Host,
- protocol=tcp,family=inet};
+ protocol=tcp,family=Driver:family()};
_ ->
%% No '@' or more than one '@' in node name.
?shutdown(no_node)
@@ -256,14 +266,18 @@ get_remote_id(Socket, Node) ->
%% ------------------------------------------------------------
setup(Node, Type, MyNode, LongOrShortNames,SetupTime) ->
+ gen_setup(inet_tcp, Node, Type, MyNode, LongOrShortNames, SetupTime).
+
+gen_setup(Driver, Node, Type, MyNode, LongOrShortNames, SetupTime) ->
spawn_opt(?MODULE, do_setup,
- [self(), Node, Type, MyNode, LongOrShortNames, SetupTime],
+ [Driver, self(), Node, Type, MyNode, LongOrShortNames, SetupTime],
[link, {priority, max}]).
-do_setup(Kernel, Node, Type, MyNode, LongOrShortNames,SetupTime) ->
+do_setup(Driver, Kernel, Node, Type, MyNode, LongOrShortNames, SetupTime) ->
?trace("~p~n",[{inet_tcp_dist,self(),setup,Node}]),
- [Name, Address] = splitnode(Node, LongOrShortNames),
- case inet:getaddr(Address, inet) of
+ [Name, Address] = splitnode(Driver, Node, LongOrShortNames),
+ AddressFamily = Driver:family(),
+ case inet:getaddr(Address, AddressFamily) of
{ok, Ip} ->
Timer = dist_util:start_timer(SetupTime),
case erl_epmd:port_please(Name, Ip) of
@@ -272,7 +286,7 @@ do_setup(Kernel, Node, Type, MyNode, LongOrShortNames,SetupTime) ->
[Node,Version]),
dist_util:reset_timer(Timer),
case
- inet_tcp:connect(
+ Driver:connect(
Ip, TcpPort,
connect_options([{active, false}, {packet, 2}]))
of
@@ -285,8 +299,8 @@ do_setup(Kernel, Node, Type, MyNode, LongOrShortNames,SetupTime) ->
timer = Timer,
this_flags = 0,
other_version = Version,
- f_send = fun inet_tcp:send/2,
- f_recv = fun inet_tcp:recv/3,
+ f_send = fun Driver:send/2,
+ f_recv = fun Driver:recv/3,
f_setopts_pre_nodeup =
fun(S) ->
inet:setopts
@@ -311,9 +325,9 @@ do_setup(Kernel, Node, Type, MyNode, LongOrShortNames,SetupTime) ->
address = {Ip,TcpPort},
host = Address,
protocol = tcp,
- family = inet}
+ family = AddressFamily}
end,
- mf_tick = fun ?MODULE:tick/1,
+ mf_tick = fun(S) -> tick(Driver, S) end,
mf_getstat = fun ?MODULE:getstat/1,
request_type = Type
},
@@ -353,18 +367,23 @@ close(Socket) ->
%% If Node is illegal terminate the connection setup!!
-splitnode(Node, LongOrShortNames) ->
+splitnode(Driver, Node, LongOrShortNames) ->
case split_node(atom_to_list(Node), $@, []) of
[Name|Tail] when Tail =/= [] ->
Host = lists:append(Tail),
case split_node(Host, $., []) of
[_] when LongOrShortNames =:= longnames ->
- error_msg("** System running to use "
- "fully qualified "
- "hostnames **~n"
- "** Hostname ~s is illegal **~n",
- [Host]),
- ?shutdown(Node);
+ case Driver:parse_address(Host) of
+ {ok, _} ->
+ [Name, Host];
+ _ ->
+ error_msg("** System running to use "
+ "fully qualified "
+ "hostnames **~n"
+ "** Hostname ~s is illegal **~n",
+ [Host]),
+ ?shutdown(Node)
+ end;
L when length(L) > 1, LongOrShortNames =:= shortnames ->
error_msg("** System NOT running to use fully qualified "
"hostnames **~n"
@@ -390,26 +409,26 @@ split_node([], _, Ack) -> [lists:reverse(Ack)].
%% ------------------------------------------------------------
%% Fetch local information about a Socket.
%% ------------------------------------------------------------
-get_tcp_address(Socket) ->
+get_tcp_address(Driver, Socket) ->
{ok, Address} = inet:sockname(Socket),
{ok, Host} = inet:gethostname(),
#net_address {
address = Address,
host = Host,
protocol = tcp,
- family = inet
+ family = Driver:family()
}.
%% ------------------------------------------------------------
%% Do only accept new connection attempts from nodes at our
%% own LAN, if the check_ip environment parameter is true.
%% ------------------------------------------------------------
-check_ip(Socket) ->
+check_ip(Driver, Socket) ->
case application:get_env(check_ip) of
{ok, true} ->
case get_ifs(Socket) of
{ok, IFs, IP} ->
- check_ip(IFs, IP);
+ check_ip(Driver, IFs, IP);
_ ->
?shutdown(no_node)
end;
@@ -428,20 +447,14 @@ get_ifs(Socket) ->
Error
end.
-check_ip([{OwnIP, _, Netmask}|IFs], PeerIP) ->
- case {mask(Netmask, PeerIP), mask(Netmask, OwnIP)} of
+check_ip(Driver, [{OwnIP, _, Netmask}|IFs], PeerIP) ->
+ case {Driver:mask(Netmask, PeerIP), Driver:mask(Netmask, OwnIP)} of
{M, M} -> true;
- _ -> check_ip(IFs, PeerIP)
+ _ -> check_ip(Driver, IFs, PeerIP)
end;
-check_ip([], PeerIP) ->
+check_ip(_Driver, [], PeerIP) ->
{false, PeerIP}.
-mask({M1,M2,M3,M4}, {IP1,IP2,IP3,IP4}) ->
- {M1 band IP1,
- M2 band IP2,
- M3 band IP3,
- M4 band IP4}.
-
is_node_name(Node) when is_atom(Node) ->
case split_node(atom_to_list(Node), $@, []) of
[_, _Host] -> true;
@@ -450,8 +463,14 @@ is_node_name(Node) when is_atom(Node) ->
is_node_name(_Node) ->
false.
-tick(Sock) ->
- ?to_port(Sock,[],[force]).
+tick(Driver, Socket) ->
+ case Driver:send(Socket, [], [force]) of
+ {error, closed} ->
+ self() ! {tcp_closed, Socket},
+ {error, closed};
+ R ->
+ R
+ end.
getstat(Socket) ->
case inet:getstat(Socket, [recv_cnt, send_cnt, send_pend]) of
diff --git a/lib/kernel/src/kernel.app.src b/lib/kernel/src/kernel.app.src
index c9327e4f31..b5555ca1a5 100644
--- a/lib/kernel/src/kernel.app.src
+++ b/lib/kernel/src/kernel.app.src
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2013. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -116,6 +116,6 @@
{applications, []},
{env, [{error_logger, tty}]},
{mod, {kernel, []}},
- {runtime_dependencies, ["erts-7.0", "stdlib-2.5", "sasl-2.4"]}
+ {runtime_dependencies, ["erts-7.0", "stdlib-2.6", "sasl-2.6"]}
]
}.
diff --git a/lib/kernel/src/kernel.appup.src b/lib/kernel/src/kernel.appup.src
index 701aafc717..3fda55d1a9 100644
--- a/lib/kernel/src/kernel.appup.src
+++ b/lib/kernel/src/kernel.appup.src
@@ -18,7 +18,9 @@
%% %CopyrightEnd%
{"%VSN%",
%% Up from - max one major revision back
- [{<<"3\\.[0-2](\\.[0-9]+)*">>,[restart_new_emulator]}], % OTP-17
+ [{<<"4\\.0(\\.[0-9]+)*">>,[restart_new_emulator]}, % OTP-18.0.*
+ {<<"3\\.[0-2](\\.[0-9]+)*">>,[restart_new_emulator]}], % OTP-17
%% Down to - max one major revision back
- [{<<"3\\.[0-2](\\.[0-9]+)*">>,[restart_new_emulator]}] % OTP-17
+ [{<<"4\\.0(\\.[0-9]+)*">>,[restart_new_emulator]}, % OTP-18.0.*
+ {<<"3\\.[0-2](\\.[0-9]+)*">>,[restart_new_emulator]}] % OTP-17
}.
diff --git a/lib/kernel/src/os.erl b/lib/kernel/src/os.erl
index 3330b38d84..ffb899e5ca 100644
--- a/lib/kernel/src/os.erl
+++ b/lib/kernel/src/os.erl
@@ -93,7 +93,7 @@ unsetenv(_) ->
%%% End of BIFs
-spec type() -> {Osfamily, Osname} when
- Osfamily :: unix | win32 | ose,
+ Osfamily :: unix | win32,
Osname :: atom().
type() ->
diff --git a/lib/kernel/test/bif_SUITE.erl b/lib/kernel/test/bif_SUITE.erl
index c3840f3d16..dd3010567a 100644
--- a/lib/kernel/test/bif_SUITE.erl
+++ b/lib/kernel/test/bif_SUITE.erl
@@ -33,6 +33,7 @@
spawn_failures/1,
run_fun/1,
+ decode_packet_delim/1,
wilderness/1]).
-export([init_per_testcase/2, end_per_testcase/2]).
@@ -516,6 +517,15 @@ fetch_proc_vals(Pid) ->
{value,{heap_size,HS}} = lists:keysearch(heap_size, 1, PI),
?line {Ls, P, FA, HS}.
+decode_packet_delim(doc) ->
+ ["Test erlang:packet_delim/3 with {line_delimiter,0} option"];
+decode_packet_delim(suite) ->
+ [];
+decode_packet_delim(Config) when is_list(Config) ->
+ {ok,<<"abc",0>>,<<"efg",0>>} =
+ erlang:decode_packet(line, <<"abc",0,"efg",0>>, [{line_delimiter, 0}]),
+ {more, undefined} = erlang:decode_packet(line, <<"abc",0,"efg",0>>, []).
+
% This testcase should probably be moved somewhere else
wilderness(doc) ->
["Test that memory allocation command line options affecting the"
diff --git a/lib/kernel/test/erl_prim_loader_SUITE.erl b/lib/kernel/test/erl_prim_loader_SUITE.erl
index 0803cf428f..ffcde5e458 100644
--- a/lib/kernel/test/erl_prim_loader_SUITE.erl
+++ b/lib/kernel/test/erl_prim_loader_SUITE.erl
@@ -260,46 +260,41 @@ multiple_slaves(doc) ->
["Start nodes in parallell, all using the 'inet' loading method, ",
"verify that the boot server manages"];
multiple_slaves(Config) when is_list(Config) ->
- case os:type() of
- {ose,_} ->
- {comment, "OSE: multiple nodes not supported"};
- _ ->
- ?line Name = erl_prim_test_multiple_slaves,
- ?line Host = host(),
- ?line Cookie = atom_to_list(erlang:get_cookie()),
- ?line IpStr = ip_str(Host),
- ?line LFlag = get_loader_flag(os:type()),
- ?line Args = LFlag ++ " -hosts " ++ IpStr ++
- " -setcookie " ++ Cookie,
-
- NoOfNodes = 10, % no of slave nodes to be started
-
- NamesAndNodes =
- lists:map(fun(N) ->
- NameN = atom_to_list(Name) ++
- integer_to_list(N),
- NodeN = NameN ++ "@" ++ Host,
- {list_to_atom(NameN),list_to_atom(NodeN)}
- end, lists:seq(1, NoOfNodes)),
-
- ?line Nodes = start_multiple_nodes(NamesAndNodes, Args, []),
-
- %% "queue up" the nodes to wait for the boot server to respond
- %% (note: test_server supervises each node start by accept()
- %% on a socket, the timeout value for the accept has to be quite
- %% long for this test to work).
- ?line test_server:sleep(test_server:seconds(5)),
- %% start the code loading circus!
- ?line {ok,BootPid} = erl_boot_server:start_link([Host]),
- %% give the nodes a chance to boot up before attempting to stop them
- ?line test_server:sleep(test_server:seconds(10)),
+ ?line Name = erl_prim_test_multiple_slaves,
+ ?line Host = host(),
+ ?line Cookie = atom_to_list(erlang:get_cookie()),
+ ?line IpStr = ip_str(Host),
+ ?line LFlag = get_loader_flag(os:type()),
+ ?line Args = LFlag ++ " -hosts " ++ IpStr ++
+ " -setcookie " ++ Cookie,
+
+ NoOfNodes = 10, % no of slave nodes to be started
+
+ NamesAndNodes =
+ lists:map(fun(N) ->
+ NameN = atom_to_list(Name) ++
+ integer_to_list(N),
+ NodeN = NameN ++ "@" ++ Host,
+ {list_to_atom(NameN),list_to_atom(NodeN)}
+ end, lists:seq(1, NoOfNodes)),
+
+ ?line Nodes = start_multiple_nodes(NamesAndNodes, Args, []),
+
+ %% "queue up" the nodes to wait for the boot server to respond
+ %% (note: test_server supervises each node start by accept()
+ %% on a socket, the timeout value for the accept has to be quite
+ %% long for this test to work).
+ ?line test_server:sleep(test_server:seconds(5)),
+ %% start the code loading circus!
+ ?line {ok,BootPid} = erl_boot_server:start_link([Host]),
+ %% give the nodes a chance to boot up before attempting to stop them
+ ?line test_server:sleep(test_server:seconds(10)),
- ?line wait_and_shutdown(lists:reverse(Nodes), 30),
+ ?line wait_and_shutdown(lists:reverse(Nodes), 30),
- ?line unlink(BootPid),
- ?line exit(BootPid, kill),
- ok
- end.
+ ?line unlink(BootPid),
+ ?line exit(BootPid, kill),
+ ok.
start_multiple_nodes([{Name,Node} | NNs], Args, Started) ->
?line {ok,Node} = start_node(Name, Args, [{wait, false}]),
diff --git a/lib/kernel/test/file_SUITE.erl b/lib/kernel/test/file_SUITE.erl
index 8856be31c2..5263130574 100644
--- a/lib/kernel/test/file_SUITE.erl
+++ b/lib/kernel/test/file_SUITE.erl
@@ -167,12 +167,7 @@ init_per_suite(Config) when is_list(Config) ->
ok ->
[{sasl,started}]
end,
- ok = case os:type() of
- {ose,_} ->
- ok;
- _ ->
- application:start(os_mon)
- end,
+ application:start(os_mon),
case os:type() of
{win32, _} ->
@@ -198,12 +193,7 @@ end_per_suite(Config) when is_list(Config) ->
ok
end,
- case os:type() of
- {ose,_} ->
- ok;
- _ ->
- application:stop(os_mon)
- end,
+ application:stop(os_mon),
case proplists:get_value(sasl, Config) of
started ->
application:stop(sasl);
@@ -888,10 +878,7 @@ open1(Config) when is_list(Config) ->
?line io:format(Fd1,Str,[]),
?line {ok,0} = ?FILE_MODULE:position(Fd1,bof),
?line Str = io:get_line(Fd1,''),
- ?line case io:get_line(Fd2,'') of
- Str -> Str;
- eof -> Str
- end,
+ ?line Str = io:get_line(Fd2,''),
?line ok = ?FILE_MODULE:close(Fd2),
?line {ok,0} = ?FILE_MODULE:position(Fd1,bof),
?line ok = ?FILE_MODULE:truncate(Fd1),
@@ -2346,9 +2333,6 @@ e_rename(Config) when is_list(Config) ->
%% At least Windows NT can
%% successfully move a file to
%% another drive.
- ok;
- {ose, _} ->
- %% disabled for now
ok
end,
[] = flush(),
diff --git a/lib/kernel/test/gen_tcp_api_SUITE.erl b/lib/kernel/test/gen_tcp_api_SUITE.erl
index a051d504b2..962471c20c 100644
--- a/lib/kernel/test/gen_tcp_api_SUITE.erl
+++ b/lib/kernel/test/gen_tcp_api_SUITE.erl
@@ -31,7 +31,7 @@
init_per_testcase/2, end_per_testcase/2,
t_connect_timeout/1, t_accept_timeout/1,
t_connect_bad/1,
- t_recv_timeout/1, t_recv_eof/1,
+ t_recv_timeout/1, t_recv_eof/1, t_recv_delim/1,
t_shutdown_write/1, t_shutdown_both/1, t_shutdown_error/1,
t_shutdown_async/1,
t_fdopen/1, t_fdconnect/1, t_implicit_inet6/1]).
@@ -48,7 +48,7 @@ all() ->
groups() ->
[{t_accept, [], [t_accept_timeout]},
{t_connect, [], [t_connect_timeout, t_connect_bad]},
- {t_recv, [], [t_recv_timeout, t_recv_eof]}].
+ {t_recv, [], [t_recv_timeout, t_recv_eof, t_recv_delim]}].
@@ -131,6 +131,21 @@ t_recv_eof(Config) when is_list(Config) ->
?line {error, closed} = gen_tcp:recv(Client, 0),
ok.
+t_recv_delim(doc) -> "Test using message delimiter $X";
+t_recv_delim(suite) -> [];
+t_recv_delim(Config) when is_list(Config) ->
+ {ok, L} = gen_tcp:listen(0, []),
+ {ok, Port} = inet:port(L),
+ Opts = [{active,false},{packet,line},{line_delimiter,$X}],
+ {ok, Client} = gen_tcp:connect(localhost, Port, Opts),
+ {ok, A} = gen_tcp:accept(L),
+ ok = gen_tcp:send(A, "abcXefgX"),
+ {ok, "abcX"} = gen_tcp:recv(Client, 0, 0),
+ {ok, "efgX"} = gen_tcp:recv(Client, 0, 0),
+ ok = gen_tcp:close(Client),
+ ok = gen_tcp:close(A),
+ ok.
+
%%% gen_tcp:shutdown/2
t_shutdown_write(Config) when is_list(Config) ->
diff --git a/lib/kernel/test/gen_tcp_misc_SUITE.erl b/lib/kernel/test/gen_tcp_misc_SUITE.erl
index 81c6dcd0fd..3adca83ec9 100644
--- a/lib/kernel/test/gen_tcp_misc_SUITE.erl
+++ b/lib/kernel/test/gen_tcp_misc_SUITE.erl
@@ -58,14 +58,6 @@
oct_acceptor/1,
otp_7731_server/1, zombie_server/2, do_iter_max_socks/2]).
-init_per_testcase(wrapping_oct, Config) when is_list(Config) ->
- Dog = case os:type() of
- {ose,_} ->
- test_server:timetrap(test_server:minutes(20));
- _Else ->
- test_server:timetrap(test_server:seconds(600))
- end,
- [{watchdog, Dog}|Config];
init_per_testcase(iter_max_socks, Config) when is_list(Config) ->
Dog = case os:type() of
{win32,_} ->
@@ -74,14 +66,6 @@ init_per_testcase(iter_max_socks, Config) when is_list(Config) ->
test_server:timetrap(test_server:seconds(240))
end,
[{watchdog, Dog}|Config];
-init_per_testcase(accept_system_limit, Config) when is_list(Config) ->
- case os:type() of
- {ose,_} ->
- {skip,"Skip in OSE"};
- _ ->
- Dog = test_server:timetrap(test_server:seconds(240)),
- [{watchdog,Dog}|Config]
- end;
init_per_testcase(wrapping_oct, Config) when is_list(Config) ->
Dog = test_server:timetrap(test_server:seconds(600)),
[{watchdog, Dog}|Config];
diff --git a/lib/kernel/test/prim_file_SUITE.erl b/lib/kernel/test/prim_file_SUITE.erl
index 3e6d8492f7..366231d2cc 100644
--- a/lib/kernel/test/prim_file_SUITE.erl
+++ b/lib/kernel/test/prim_file_SUITE.erl
@@ -455,10 +455,7 @@ open1(Config) when is_list(Config) ->
?line ?PRIM_FILE:write(Fd1,Str),
?line {ok,0} = ?PRIM_FILE:position(Fd1,bof),
?line {ok, Str} = ?PRIM_FILE:read(Fd1,Length),
- ?line case ?PRIM_FILE:read(Fd2,Length) of
- {ok,Str} -> Str;
- eof -> Str
- end,
+ ?line {ok, Str} = ?PRIM_FILE:read(Fd2,Length),
?line ok = ?PRIM_FILE:close(Fd2),
?line {ok,0} = ?PRIM_FILE:position(Fd1,bof),
?line ok = ?PRIM_FILE:truncate(Fd1),
@@ -1629,7 +1626,7 @@ e_rename(Config) when is_list(Config) ->
%% successfully move a file to
%% another drive.
ok;
- {unix, _ } ->
+ _ ->
OtherFs = "/tmp",
?line NameOnOtherFs =
filename:join(OtherFs,
@@ -1653,10 +1650,7 @@ e_rename(Config) when is_list(Config) ->
Else ->
Else
end,
- Com;
- {ose, _} ->
- %% disabled for now
- ok
+ Com
end,
?line test_server:timetrap_cancel(Dog),
Comment.
diff --git a/lib/kernel/vsn.mk b/lib/kernel/vsn.mk
index c912da0091..d549033302 100644
--- a/lib/kernel/vsn.mk
+++ b/lib/kernel/vsn.mk
@@ -1 +1 @@
-KERNEL_VSN = 4.0
+KERNEL_VSN = 4.1
diff --git a/lib/mnesia/doc/src/notes.xml b/lib/mnesia/doc/src/notes.xml
index c4f937f183..8650e03a60 100644
--- a/lib/mnesia/doc/src/notes.xml
+++ b/lib/mnesia/doc/src/notes.xml
@@ -39,7 +39,39 @@
thus constitutes one section in this document. The title of each
section is the version number of Mnesia.</p>
- <section><title>Mnesia 4.13</title>
+ <section><title>Mnesia 4.13.2</title>
+
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p>
+ Fixed a process and file descriptor leak in
+ mnesia:restore/2.</p>
+ <p>
+ Own Id: OTP-13025 Aux Id: seq12957 </p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
+<section><title>Mnesia 4.13.1</title>
+
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p>
+ Improved index updates to avoid a timing glitch in
+ dirty_index_read.</p>
+ <p>
+ Own Id: OTP-12972</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
+<section><title>Mnesia 4.13</title>
<section><title>Fixed Bugs and Malfunctions</title>
<list>
diff --git a/lib/mnesia/src/mnesia_bup.erl b/lib/mnesia/src/mnesia_bup.erl
index 0e653f2bc4..1f150ae38b 100644
--- a/lib/mnesia/src/mnesia_bup.erl
+++ b/lib/mnesia/src/mnesia_bup.erl
@@ -157,10 +157,11 @@ fallback_to_schema(Fname) ->
read_schema(Mod, Opaque) ->
R = #restore{bup_module = Mod, bup_data = Opaque},
try read_schema_section(R) of
- {_, {_Header, Schema, _}} -> Schema
+ {R2, {_Header, Schema, _}} ->
+ close_read(R2),
+ Schema
catch throw:{error,_} = Error ->
Error
- after close_read(R)
end.
%% Open backup media and extract schema
@@ -173,8 +174,13 @@ read_schema_section(R) ->
do_read_schema_section(R) ->
R2 = safe_apply(R, open_read, [R#restore.bup_data]),
- {R3, RawSchema} = safe_apply(R2, read, [R2#restore.bup_data]),
- do_read_schema_section(R3, verify_header(RawSchema), []).
+ try
+ {R3, RawSchema} = safe_apply(R2, read, [R2#restore.bup_data]),
+ do_read_schema_section(R3, verify_header(RawSchema), [])
+ catch T:E ->
+ close_read(R2),
+ erlang:raise(T,E,erlang:get_stacktrace())
+ end.
do_read_schema_section(R, {ok, B, C, []}, Acc) ->
case safe_apply(R, read, [R#restore.bup_data]) of
diff --git a/lib/mnesia/src/mnesia_index.erl b/lib/mnesia/src/mnesia_index.erl
index 81ed5a8f1a..0c882c0df6 100644
--- a/lib/mnesia/src/mnesia_index.erl
+++ b/lib/mnesia/src/mnesia_index.erl
@@ -70,17 +70,24 @@ add_index(Index, Tab, Key, Obj, Old) ->
add_index2([{Pos, Ixt} |Tail], bag, Tab, K, Obj, OldRecs) ->
db_put(Ixt, {element(Pos, Obj), K}),
add_index2(Tail, bag, Tab, K, Obj, OldRecs);
-add_index2([{Pos, Ixt} |Tail], Type, Tab, K, Obj, OldRecs) ->
+add_index2([{Pos, Ixt} |Tail], Type, Tab, K, Obj, OldRecs0) ->
%% Remove old tuples in index if Tab is updated
- case OldRecs of
- undefined ->
- Old = mnesia_lib:db_get(Tab, K),
- del_ixes(Ixt, Old, Pos, K);
- Old ->
- del_ixes(Ixt, Old, Pos, K)
- end,
- db_put(Ixt, {element(Pos, Obj), K}),
- add_index2(Tail, Type, Tab, K, Obj, OldRecs);
+ OldRecs1 = case OldRecs0 of
+ undefined -> mnesia_lib:db_get(Tab, K);
+ _ -> OldRecs0
+ end,
+ IdxVal = element(Pos, Obj),
+ case [Old || Old <- OldRecs1, element(Pos, Old) =/= IdxVal] of
+ [] when OldRecs1 =:= [] -> %% Write
+ db_put(Ixt, {element(Pos, Obj), K}),
+ add_index2(Tail, Type, Tab, K, Obj, OldRecs0);
+ [] -> %% when OldRecs1 =/= [] Update without modifying index field
+ add_index2(Tail, Type, Tab, K, Obj, OldRecs0);
+ OldRecs -> %% Update
+ db_put(Ixt, {element(Pos, Obj), K}),
+ del_ixes(Ixt, OldRecs, Pos, K),
+ add_index2(Tail, Type, Tab, K, Obj, OldRecs0)
+ end;
add_index2([], _, _Tab, _K, _Obj, _) -> ok.
delete_index(Index, Tab, K) ->
diff --git a/lib/mnesia/test/mnesia_dirty_access_test.erl b/lib/mnesia/test/mnesia_dirty_access_test.erl
index 89aff2b3b8..0d57e5a1b1 100644
--- a/lib/mnesia/test/mnesia_dirty_access_test.erl
+++ b/lib/mnesia/test/mnesia_dirty_access_test.erl
@@ -401,9 +401,26 @@ dirty_index_read(Config, Storage) ->
?match({'EXIT', _}, mnesia:dirty_index_read(Tab, 2, BadValPos)),
?match({'EXIT', _}, mnesia:dirty_index_read(foo, 2, ValPos)),
?match({'EXIT', _}, mnesia:dirty_index_read([], 2, ValPos)),
-
+
+ mnesia:dirty_write({Tab, 5, 1}),
+ ?match(ok, index_read_loop(Tab, 0)),
+
?verify_mnesia(Nodes, []).
+
+index_read_loop(Tab, N) when N =< 1000 ->
+ spawn_link(fun() ->
+ mnesia:transaction(fun() -> mnesia:write({Tab, 5, 1}) end)
+ end),
+ case mnesia:dirty_match_object({Tab, '_', 1}) of
+ [{Tab, 5, 1}] ->
+ index_read_loop(Tab, N+1);
+ Other -> {N, Other}
+ end;
+index_read_loop(_, _) ->
+ ok.
+
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/lib/mnesia/test/mnesia_evil_backup.erl b/lib/mnesia/test/mnesia_evil_backup.erl
index 89f2861661..e605fa7926 100644
--- a/lib/mnesia/test/mnesia_evil_backup.erl
+++ b/lib/mnesia/test/mnesia_evil_backup.erl
@@ -232,7 +232,13 @@ restore(Config, Op) ->
Res21 = [{Tab2, N, N+1} || N <- lists:seq(1, 11)],
Res31 = [[{Tab3, N, N+1}, {Tab3, N, N+44}] || N <- lists:seq(1, 10)],
-
+ Check = fun() ->
+ [disk_log:pid2name(X) ||
+ X <- processes(), Data <- [process_info(X, [current_function])],
+ Data =/= undefined,
+ element(1, element(2, lists:keyfind(current_function, 1, Data)))=:= disk_log]
+ end,
+ Before = Check(),
?match({atomic, [Tab1]}, Restore(File1, [{Op, [Tab1]},
{skip_tables, Tabs -- [Tab1]}])),
case Op of
@@ -319,6 +325,8 @@ restore(Config, Op) ->
end,
?match(ok, file:delete(File1)),
?match(ok, file:delete(File2)),
+ ?match([], Check() -- Before),
+
?verify_mnesia(Nodes, []).
diff --git a/lib/mnesia/vsn.mk b/lib/mnesia/vsn.mk
index 79dd495c4b..0fe5b5db8b 100644
--- a/lib/mnesia/vsn.mk
+++ b/lib/mnesia/vsn.mk
@@ -1 +1 @@
-MNESIA_VSN = 4.13
+MNESIA_VSN = 4.13.2
diff --git a/lib/observer/src/cdv_ets_cb.erl b/lib/observer/src/cdv_ets_cb.erl
index 9e6e72e08d..bac8b56fc3 100644
--- a/lib/observer/src/cdv_ets_cb.erl
+++ b/lib/observer/src/cdv_ets_cb.erl
@@ -97,7 +97,7 @@ info_fields() ->
[{"Id", id},
{"Name", name},
{"Slot", slot},
- {"Owner", owner},
+ {"Owner", pid},
{"Data Structure", data_type}
]},
{"Settings",
diff --git a/lib/observer/src/crashdump_viewer.erl b/lib/observer/src/crashdump_viewer.erl
index f2ce51b2af..b66b4d59c9 100644
--- a/lib/observer/src/crashdump_viewer.erl
+++ b/lib/observer/src/crashdump_viewer.erl
@@ -1572,7 +1572,7 @@ get_etsinfo(Fd,EtsTable = #ets_table{details=Ds},WS) ->
get_etsinfo(Fd,EtsTable#ets_table{details=Ds#{fixed=>Val}},WS);
"Type" ->
Val = val(Fd),
- get_etsinfo(Fd,EtsTable#ets_table{details=Ds#{data_type=>Val}},WS);
+ get_etsinfo(Fd,EtsTable#ets_table{data_type=Val},WS);
"Protection" ->
Val = val(Fd),
get_etsinfo(Fd,EtsTable#ets_table{details=Ds#{protection=>Val}},WS);
diff --git a/lib/observer/src/observer_sys_wx.erl b/lib/observer/src/observer_sys_wx.erl
index d6183d0249..dfd15380f2 100644
--- a/lib/observer/src/observer_sys_wx.erl
+++ b/lib/observer/src/observer_sys_wx.erl
@@ -83,11 +83,11 @@ update_syspage(#sys_wx_state{node = Node, fields=Fields, sizer=Sizer}) ->
info_fields() ->
Info = [{"System and Architecture",
[{"System Version", otp_release},
- {"Erts Version", version},
+ {"ERTS Version", version},
{"Compiled for", system_architecture},
{"Emulator Wordsize", wordsize_external},
{"Process Wordsize", wordsize_internal},
- {"Smp Support", smp_support},
+ {"SMP Support", smp_support},
{"Thread Support", threads},
{"Async thread pool size", thread_pool_size}
]},
@@ -106,7 +106,7 @@ info_fields() ->
{"Atoms", {bytes, atom}},
{"Binaries", {bytes, binary}},
{"Code", {bytes, code}},
- {"Ets", {bytes, ets}}
+ {"ETS", {bytes, ets}}
]},
{"Statistics", right,
[{"Up time", {time_ms, uptime}},
diff --git a/lib/odbc/doc/src/notes.xml b/lib/odbc/doc/src/notes.xml
index add8229955..59d46de02a 100644
--- a/lib/odbc/doc/src/notes.xml
+++ b/lib/odbc/doc/src/notes.xml
@@ -32,7 +32,31 @@
<p>This document describes the changes made to the odbc application.
</p>
- <section><title>ODBC 2.11</title>
+ <section><title>ODBC 2.11.1</title>
+
+ <section><title>Improvements and New Features</title>
+ <list>
+ <item>
+ <p>
+ New application variable to set timeout of internal
+ communication setup between the erlang code and the
+ c-port program that interfaces the odbc driver. This can
+ be useful if you have an underlying system that is slow
+ due to heavy load at startup.</p>
+ <p>
+ With this environment variable you can easily bypass and
+ tailor odbc to the needs of the underlying actual system
+ without changing the configuration. Which is a good thing
+ because this value is very system specific.</p>
+ <p>
+ Own Id: OTP-12935</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
+<section><title>ODBC 2.11</title>
<section><title>Improvements and New Features</title>
<list>
diff --git a/lib/odbc/vsn.mk b/lib/odbc/vsn.mk
index d4dc6bbe1d..c7c84560d1 100644
--- a/lib/odbc/vsn.mk
+++ b/lib/odbc/vsn.mk
@@ -1 +1 @@
-ODBC_VSN = 2.11
+ODBC_VSN = 2.11.1
diff --git a/lib/os_mon/doc/src/cpu_sup.xml b/lib/os_mon/doc/src/cpu_sup.xml
index 524426ce86..51e1a4c9d6 100644
--- a/lib/os_mon/doc/src/cpu_sup.xml
+++ b/lib/os_mon/doc/src/cpu_sup.xml
@@ -63,7 +63,7 @@
measure.</p>
<p>A server which receives just enough requests to never become
idle will score a CPU utilization of 100%. If the server receives
- 50% more requests, it will still scores 100%. When the system load
+ 50% more requests, it will still score 100%. When the system load
is calculated with the percentage formula shown previously,
the load will increase from 80% to 87%.</p>
<p>The <c>avg1/0</c>, <c>avg5/0</c>, and <c>avg15/0</c> functions
diff --git a/lib/ose/doc/man3/.gitignore b/lib/ose/doc/man3/.gitignore
deleted file mode 100644
index e69de29bb2..0000000000
--- a/lib/ose/doc/man3/.gitignore
+++ /dev/null
diff --git a/lib/ose/doc/man6/.gitignore b/lib/ose/doc/man6/.gitignore
deleted file mode 100644
index e69de29bb2..0000000000
--- a/lib/ose/doc/man6/.gitignore
+++ /dev/null
diff --git a/lib/ose/doc/pdf/.gitignore b/lib/ose/doc/pdf/.gitignore
deleted file mode 100644
index e69de29bb2..0000000000
--- a/lib/ose/doc/pdf/.gitignore
+++ /dev/null
diff --git a/lib/ose/doc/src/.gitignore b/lib/ose/doc/src/.gitignore
deleted file mode 100644
index 860e9e703e..0000000000
--- a/lib/ose/doc/src/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-ose.xml
diff --git a/lib/ose/doc/src/Makefile b/lib/ose/doc/src/Makefile
deleted file mode 100644
index 7ebd4125ba..0000000000
--- a/lib/ose/doc/src/Makefile
+++ /dev/null
@@ -1,133 +0,0 @@
-#
-# %CopyrightBegin%
-#
-# Copyright Ericsson AB 1997-2012. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# %CopyrightEnd%
-#
-include $(ERL_TOP)/make/target.mk
-include $(ERL_TOP)/make/$(TARGET)/otp.mk
-
-# ----------------------------------------------------
-# Application version
-# ----------------------------------------------------
-include ../../vsn.mk
-VSN=$(OSE_VSN)
-APPLICATION=ose
-
-# ----------------------------------------------------
-# Release directory specification
-# ----------------------------------------------------
-RELSYSDIR = $(RELEASE_PATH)/lib/$(APPLICATION)-$(VSN)
-
-# ----------------------------------------------------
-# Help application directory specification
-# ----------------------------------------------------
-EDOC_DIR = $(ERL_TOP)/lib/edoc
-SYNTAX_TOOLS_DIR = $(ERL_TOP)/lib/syntax_tools
-
-# ----------------------------------------------------
-# Target Specs
-# ----------------------------------------------------
-XML_APPLICATION_FILES = ref_man.xml
-
-XML_REF3_FILES = \
- ose.xml \
- ose_erl_driver.xml
-
-XML_REF6_FILES = ose_app.xml
-
-XML_PART_FILES = part.xml
-XML_CHAPTER_FILES = notes.xml ose_intro.xml ose_signals_chapter.xml
-
-BOOK_FILES = book.xml
-
-XML_FILES = \
- $(BOOK_FILES) $(XML_CHAPTER_FILES) \
- $(XML_PART_FILES) $(XML_REF3_FILES) $(XML_REF6_FILES) \
- $(XML_APPLICATION_FILES)
-
-# ----------------------------------------------------
-
-HTML_FILES = $(XML_APPLICATION_FILES:%.xml=$(HTMLDIR)/%.html) \
- $(XML_PART_FILES:%.xml=$(HTMLDIR)/%.html)
-
-INFO_FILE = ../../info
-
-MAN3_FILES = $(XML_REF3_FILES:%.xml=$(MAN3DIR)/%.3)
-MAN6_FILES = $(XML_REF6_FILES:%_app.xml=$(MAN6DIR)/%.6)
-
-HTML_REF_MAN_FILE = $(HTMLDIR)/index.html
-
-TOP_PDF_FILE = $(PDFDIR)/$(APPLICATION)-$(VSN).pdf
-
-SPECS_FILES =
-
-TOP_SPECS_FILE =
-
-# ----------------------------------------------------
-# FLAGS
-# ----------------------------------------------------
-XML_FLAGS +=
-
-SPECS_FLAGS = -I../../include -I../../../kernel/include
-
-OSE_SRC_DIR = ../../src
-
-# ----------------------------------------------------
-# Targets
-# ----------------------------------------------------
-docs: man pdf html
-
-$(TOP_PDF_FILE): $(XML_FILES)
-
-pdf: $(TOP_PDF_FILE)
-
-html: $(HTML_REF_MAN_FILE)
-
-man: $(MAN3_FILES) $(MAN6_FILES)
-
-ose.xml: $(OSE_SRC_DIR)/ose.erl
- escript $(DOCGEN)/priv/bin/xml_from_edoc.escript\
- $(OSE_SRC_DIR)/$(@:%.xml=%.erl)
-
-debug opt:
-
-clean clean_docs:
- rm -rf $(HTMLDIR)/*
- rm -f $(MAN3DIR)/*
- rm -f $(MAN6DIR)/*
- rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo)
- rm -f $(SPECDIR)/*
- rm -f errs core *~
-
-# ----------------------------------------------------
-# Release Target
-# ----------------------------------------------------
-include $(ERL_TOP)/make/otp_release_targets.mk
-
-release_docs_spec: docs
- $(INSTALL_DIR) "$(RELSYSDIR)/doc/pdf"
- $(INSTALL_DATA) $(TOP_PDF_FILE) "$(RELSYSDIR)/doc/pdf"
- $(INSTALL_DIR) "$(RELSYSDIR)/doc/html"
- $(INSTALL_DATA) $(HTMLDIR)/* \
- "$(RELSYSDIR)/doc/html"
- $(INSTALL_DATA) $(INFO_FILE) "$(RELSYSDIR)"
- $(INSTALL_DIR) "$(RELEASE_PATH)/man/man3"
- $(INSTALL_DATA) $(MAN3DIR)/* "$(RELEASE_PATH)/man/man3"
- $(INSTALL_DIR) "$(RELEASE_PATH)/man/man6"
- $(INSTALL_DATA) $(MAN6_FILES) "$(RELEASE_PATH)/man/man6"
-
-release_spec:
diff --git a/lib/ose/doc/src/book.xml b/lib/ose/doc/src/book.xml
deleted file mode 100644
index d62e0d32f4..0000000000
--- a/lib/ose/doc/src/book.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE book SYSTEM "book.dtd">
-
-<book xmlns:xi="http://www.w3.org/2001/XInclude">
- <header titlestyle="normal">
- <copyright>
- <year>2014</year><year>2014</year>
- <holder>Ericsson AB. All Rights Reserved.</holder>
- </copyright>
- <legalnotice>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- </legalnotice>
-
- <title>OSE</title>
- <prepared>Lukas Larsson</prepared>
- <docno></docno>
- <date>2014-01-08</date>
- <rev>1.0</rev>
- <file>book.xml</file>
- </header>
- <insidecover>
- </insidecover>
- <pagetext>OSE</pagetext>
- <preamble>
- <contents level="2"></contents>
- </preamble>
- <parts>
- <xi:include href="part.xml"/>
- </parts>
- <applications>
- <xi:include href="ref_man.xml"/>
- </applications>
- <releasenotes>
- <xi:include href="notes.xml"/>
- </releasenotes>
- <listofterms></listofterms>
- <index></index>
-</book>
diff --git a/lib/ose/doc/src/notes.xml b/lib/ose/doc/src/notes.xml
deleted file mode 100644
index 06881b6c99..0000000000
--- a/lib/ose/doc/src/notes.xml
+++ /dev/null
@@ -1,109 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE chapter SYSTEM "chapter.dtd">
-
-<chapter>
- <header>
- <copyright>
- <year>2014</year><year>2014</year>
- <holder>Ericsson AB. All Rights Reserved.</holder>
- </copyright>
- <legalnotice>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- </legalnotice>
-
- <title>OSE Release Notes</title>
- <prepared></prepared>
- <docno></docno>
- <date></date>
- <rev></rev>
- <file>notes.xml</file>
- </header>
- <p>This document describes the changes made to the OSE application.</p>
-
-<section><title>Ose 1.1</title>
-
- <section><title>Improvements and New Features</title>
- <list>
- <item>
- <p>
- Change license text from Erlang Public License to Apache
- Public License v2</p>
- <p>
- Own Id: OTP-12845</p>
- </item>
- </list>
- </section>
-
-</section>
-
-<section><title>Ose 1.0.2</title>
-
- <section><title>Fixed Bugs and Malfunctions</title>
- <list>
- <item>
- <p>
- Add missing release notes for the OSE application.</p>
- <p>
- Own Id: OTP-12177</p>
- </item>
- </list>
- </section>
-
-</section>
-
-<section><title>Ose 1.0.1</title>
-
- <section><title>Fixed Bugs and Malfunctions</title>
- <list>
- <item>
- <p>
- Fix some spelling mistakes in documentation</p>
- <p>
- Own Id: OTP-12152</p>
- </item>
- </list>
- </section>
-
-</section>
-
-<section><title>Ose 1.0</title>
-
- <section><title>Improvements and New Features</title>
- <list>
- <item>
- <p>
- Erlang/OTP has been ported to the realtime operating
- system OSE. The port supports both smp and non-smp
- emulator. For details around the port and how to started
- see the User's Guide in the <seealso
- marker="ose:ose_intro">ose</seealso> application. </p>
- <p>
- Note that not all parts of Erlang/OTP has been ported. </p>
- <p>
- Notable things that work are: non-smp and smp emulators,
- OSE signal interaction, crypto, asn1, run_erl/to_erl,
- tcp, epmd, distribution and most if not all non-os
- specific functionality of Erlang.</p>
- <p>
- Notable things that does not work are: udp/sctp, os_mon,
- erl_interface, binding of schedulers.</p>
- <p>
- Own Id: OTP-11334</p>
- </item>
- </list>
- </section>
-
-</section>
-
-</chapter>
diff --git a/lib/ose/doc/src/ose_app.xml b/lib/ose/doc/src/ose_app.xml
deleted file mode 100644
index d555f0ec4f..0000000000
--- a/lib/ose/doc/src/ose_app.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE appref SYSTEM "appref.dtd">
-
-<appref>
- <header>
- <copyright>
- <year>2014</year><year>2014</year>
- <holder>Ericsson AB. All Rights Reserved.</holder>
- </copyright>
- <legalnotice>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- </legalnotice>
-
- <title>Enea OSE</title>
- <prepared></prepared>
- <docno></docno>
- <date></date>
- <rev></rev>
- </header>
- <app>ose</app>
- <appsummary>The OSE Application</appsummary>
- <description>
- <p>The OSE application contains modules and documentation that only
- applies when running Erlang/OTP on Enea OSE.</p>
- </description>
-
-</appref>
diff --git a/lib/ose/doc/src/ose_erl_driver.xml b/lib/ose/doc/src/ose_erl_driver.xml
deleted file mode 100644
index b804c29d2d..0000000000
--- a/lib/ose/doc/src/ose_erl_driver.xml
+++ /dev/null
@@ -1,111 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE cref SYSTEM "cref.dtd">
-
-<cref>
- <header>
- <copyright>
- <year>2013</year><year>2014</year>
- <holder>Ericsson AB. All Rights Reserved.</holder>
- </copyright>
- <legalnotice>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- </legalnotice>
-
- <title>erl_driver for Enea OSE</title>
- <prepared>Lukas Larsson</prepared>
- <docno></docno>
- <date>2014-01-08</date>
- <rev>A</rev>
- <file>ose_erl_driver.xml</file>
- </header>
- <lib>ose_erl_driver</lib>
- <libsummary>Linked-in drivers in Enea OSE</libsummary>
- <description>
- <p>Writing Linked-in drivers that also work on Enea OSE is very similar for
- how you would do it for Unix. The difference from Unix is that
- driver_select, ready_input and ready_output all work with signals
- instead of file descriptors. This means that the driver_select is
- used to specify which type of signal should trigger calls to
- ready_input/ready_output. The functions described below are available
- to driver programmers on Enea OSE to facilitate this.
- </p>
- </description>
- <section>
- <title>DATA TYPES</title>
-
- <taglist>
- <tag><marker id="union_SIGNAL"/>union SIGNAL</tag>
- <item>See the Enea OSE SPI documentation for a description.</item>
- <tag><marker id="SIGSELECT"/>SIGSELECT</tag>
- <item>See the Enea OSE SPI documentation for a description.</item>
- <tag><marker id="ErlDrvEvent"/>ErlDrvEvent</tag>
- <item>The <c>ErlDrvEvent</c> is a handle to a signal number and id combination. It is passed to <seealso marker="erts:erl_driver#driver_select">driver_select(3)</seealso>.</item>
- <tag><marker id="ErlDrvOseEventId"/>ErlDrvOseEventId</tag>
- <item>This is the id used to associate a specific signal to a
- certain driver instance. </item>
- </taglist>
- </section>
- <funcs>
- <func>
- <name><ret>union SIGNAL *</ret><nametext>erl_drv_ose_get_signal(ErlDrvEvent drv_event)</nametext></name>
- <desc>
- <marker id="erl_drv_ose_get_signal"></marker>
- <p>Fetch the next signal associated with <c>drv_event</c>.
- Signals will be returned in the order which they were received and
- when no more signals are available <c>NULL</c> will be returned.
- Use this function in the ready_input/ready_output callbacks
- to get signals.</p>
- </desc>
- </func>
- <func>
- <name><ret>ErlDrvEvent</ret><nametext>erl_drv_ose_event_alloc(SIGSELECT signo, ErlDrvOseEventId id, ErlDrvOseEventId (*resolve_signal)(union SIGNAL* sig), void *extra)</nametext></name>
- <desc>
- <marker id="erl_drv_ose_event_alloc"></marker>
- <p>Create a new <c>ErlDrvEvent</c> associated with <c>signo</c>,
- <c>id</c> and uses the <c>resolve_signal</c> function to extract
- the <c>id</c> from a signal with <c>signo</c>. The <c>extra</c>
- parameter can be used for additional data. See
- <seealso marker="ose_signals_chapter#driver">
- Signals in a Linked-in driver</seealso> in the OSE User's Guide.
- </p>
- </desc>
- </func>
- <func>
- <name><ret>void</ret><nametext>erl_drv_ose_event_free(ErlDrvEvent drv_event)</nametext></name>
- <desc>
- <marker id="erl_drv_ose_event_free"></marker>
- <p>Free a <c>ErlDrvEvent</c>. This should always be done in the
- <seealso marker="erts:driver_entry#stop_select">stop_select</seealso>
- callback when the event is no longer being used.</p>
- </desc>
- </func>
- <func>
- <name><ret>void</ret><nametext>erl_drv_ose_event_fetch(ErlDrvEvent drv_event, SIGSELECT *signo, ErlDrvOseEventId *id, void **extra)</nametext></name>
- <desc>
- <marker id="erl_drv_ose_event_fetch"></marker>
- <p>Write the signal number, id and any extra data associated with <c>drv_event</c>
- into <c>*signo</c> and <c>*id</c> respectively. <c>NULL</c> can be
- also passed as <c>signo</c> or <c>id</c> in order to ignore that field.
- </p>
- </desc>
- </func>
- </funcs>
- <section>
- <title>SEE ALSO</title>
- <p>
- <seealso marker="erts:driver_entry">driver_entry(3)</seealso>,
- <seealso marker="erts:erl_driver">erl_driver(3)</seealso>
- </p>
- </section>
-</cref>
diff --git a/lib/ose/doc/src/ose_intro.xml b/lib/ose/doc/src/ose_intro.xml
deleted file mode 100644
index 982516c8bd..0000000000
--- a/lib/ose/doc/src/ose_intro.xml
+++ /dev/null
@@ -1,154 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE chapter SYSTEM "chapter.dtd">
-
-<chapter>
- <header>
- <copyright>
- <year>2013</year><year>2014</year>
- <holder>Ericsson AB. All Rights Reserved.</holder>
- </copyright>
- <legalnotice>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- </legalnotice>
-
- <title>Introduction</title>
- <prepared>Lukas Larsson</prepared>
- <docno></docno>
- <date>2014-01-08</date>
- <rev>A</rev>
- <file>ose_intro.xml</file>
- </header>
-
- <section>
- <title>Features</title>
- </section>
-
- <section>
- <title>Starting Erlang/OTP</title>
- <p>
- Starting Erlang/OTP on OSE is not as simple as on Unix/Windows (yet).
- First of all you have to explicitly use the beam (or beam.smp) executables
- found in erts-X.Y.Z/bin as the load module that you run. This in turn
- means that you have to supply the raw beam arguments to the emulator
- when starting. Fortunately <c>erl</c> on Unix/Windows has a
- undocumented flag called <c>-emu_args_exit</c> that can be used to
- figure out what the arguments to beam look like. For example:</p>
- <code># erl +Mut false +A 10 +S 4:4 +Muycs256 +P 2096 +Q 2096 -emu_args_exit
--Mut
-false
--A
-10
--S
-4:4
--Muycs256
--P
-2096
--Q
-2096
---
--root
-/usr/local/lib/erlang
--progname
-erl
---
--home
-/home/erlang
---</code>
- <p>
- The arguments are printed on separate lines to make it possible to know
- what has to be quoted with &quot;. Each line is one quotable unit.
- So taking the arguments above you can supply them to pm_create or
- just execute directly on the command line. For example:</p>
- <code>rtose@acp3400> pm_install erlang /mst/erlang/erts-6.0/bin/beam.smp
-rtose@acp3400> pm_create -c ARGV="-Mut false -A 10 -S 4:4 -Muycs256 -P 2096 -Q 2099 -- -root /mst/erlang -progname erl -- -home /mst/erlang --" erlang
-pid: 0x110059
-rtose@acp3400> pm_start 0x110059</code>
- <p>
- Also note that since we are running erl to figure out the arguments on a
- separate machine the paths have to be updated. In the example above
- <c>/usr/local/lib/erlang</c> was replaced by <c>/mst/erlang/</c>. The
- goal is to in future releases not have to do the special argument handling
- but for now (OTP 17.0) you have to do it.
- </p>
- <note>
- Because of a limitation in the way the OSE handles stdio when starting
- load modules using pm_install/create the Erlang shell only reads every
- other command from stdin. However if you start Erlang using run_erl
- you do not have this problem. So it is highly recommended that you
- start Erlang using run_erl.
- </note>
- </section>
-
- <section>
- <title>run_erl and to_erl</title>
- <p>
- In OSE run_erl and to_erl are combined into a single load module called
- run_erl_lm. Installing and starting the load module will add two new
- shell commands called run_erl and to_erl. They work in exactly the same
- way as the unix variants of run_erl and to_erl, except that the read
- and write pipes have to be placed under the /pipe vm. One additional
- option also exists to run_erl on ose:
- <taglist>
- <tag><c>-block Name</c></tag>
- <item>The name of the install handle and block that will be created/used by
- installing and exectuting the first part of the command. If nothing
- if given the basename of the load module will be used for this value.
- Example:
- <code>pm_install erlang /path/to/erlang/vm/beam.smp
-run_erl -daemon -block erlang /pipe/ /mst/erlang_logs/ "beam.smp -A 1 -- -root /mst/erlang -- -home /mst --"</code>
- </item>
- </taglist>
- The same argument munching as when starting Erlang/OTP without run_erl
- has to be done. If <c>-daemon</c> is given then all error printouts
- are sent to the ramlog.
- See also
- <seealso marker="erts:run_erl">run_erl</seealso> for more details.
- </p>
- <p>
- Below is an example of how to get started with <c>run_erl_lm</c>.
- <code>rtose@acp3400> pm_install run_erl_lm /mst/erlang/erts-6.0/bin/run_erl_lm
-rtose@acp3400> pm_create run_erl_lm
-pid: 0x1c005d
-rtose@acp3400> pm_start 0x1c005d
-rtose@acp3400> mkdir /mst/erlang_log
-rtose@acp3400> run_erl -daemon /pipe/ /mst/erlang_log/ "/mst/erlang/erts-6.0/bin/beam.smp -A 1 -- -root /mst/erlang -- -home /mst --"
-rtose@acp3400> to_erl
-Attaching to /pipe/erlang.pipe.1 (^C to exit)
-os:type().
-{ose,release}
-2>
-'to_erl' terminated.</code>
- Note that Ctrl-C is used instead of Ctrl-D to exit the to_erl shell.
- </p>
- </section>
-
- <section>
- <title>epmd</title>
- <p>
- In OSE epmd will not be started automatically so if you want to use
- Erlang distribution you have to manually start epmd.
- </p>
- </section>
-
- <section>
- <title>VM Process Priorities</title>
- <p>
- It is possible to set the priorities you want for the OSE processes that
- thr emulator creates in the lmconf. An example of how to do it can be
- found in the default lmconf file in
- $ERL_TOP/erts/emulator/sys/ose/beam.lmconf.
- </p>
- </section>
-
-</chapter>
diff --git a/lib/ose/doc/src/ose_signals_chapter.xml b/lib/ose/doc/src/ose_signals_chapter.xml
deleted file mode 100644
index bcf2259577..0000000000
--- a/lib/ose/doc/src/ose_signals_chapter.xml
+++ /dev/null
@@ -1,240 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE chapter SYSTEM "chapter.dtd">
-
-<chapter>
- <header>
- <copyright>
- <year>2013</year><year>2014</year>
- <holder>Ericsson AB. All Rights Reserved.</holder>
- </copyright>
- <legalnotice>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- </legalnotice>
-
- <title>Interacting with Enea OSE</title>
- <prepared>Lukas Larsson</prepared>
- <docno></docno>
- <date>2014-01-08</date>
- <rev>A</rev>
- <file>ose_signals_chapter.xml</file>
- </header>
-
- <marker id="introduction"></marker>
- <section>
- <title>Introduction</title>
- <p>The main way which programs on Enea OSE interact is through the
- usage of message passing, much the same way as Erlang processes
- communicate. There are two ways in which an Erlang programmer can
- interact with the signals sent from other Enea OSE processes; either
- through the provided <c>ose</c> module, or by writing a custom linked-in
- driver. This User's Guide describes and provides examples for both
- approaches.
- </p>
- </section>
-
- <marker id="erlang"></marker>
- <section>
- <title>Signals in Erlang</title>
- <p>Erlang/OTP on OSE provides a erlang module called
- <seealso marker="ose:ose">ose</seealso> that can be used to interact
- with other OSE processes using message passing. The api in the module
- is very similar to the native OSE api, so for details of how the
- functions work please refer to the official OSE documenation. Below
- is an example usage of the API.
- </p>
- <code>1> P1 = ose:open("p1").
-#Port&gt;0.344>
-2> ose:hunt(P1,"p2").
-{#Port&gt;0.344>,1}
-3> P2 = ose:open("p2").
-#Port&gt;0.355>
-4> flush().
-Shell got {mailbox_up,#Port&gt;0.344>,{#Port&gt;0.344>,1},852189}
-ok
-5> ose:listen(P1,[1234]).
-ok
-6> ose:send(P2,ose:get_id(P1),1234,&gt;&gt;"hello">>).
-ok
-7> flush().
-Shell got {message,#Port&gt;0.344>,{852189,1245316,1234,&gt;&gt;"hello">>}}
-ok</code>
- </section>
-
- <marker id="driver"></marker>
- <section>
- <title>Signals in a Linked-in driver</title>
- <p>
- Writing Linked-in drivers for OSE is very similar to how it is done
- for Unix/Windows. It is only the way in which the driver subscribes
- and consumed external events that is different. In Unix (and Windows)
- file descriptiors (and Event Objects) are used to select on. On OSE
- we use signals to deliver the same functionality. There are two large
- differences between a signal and an fd.
- </p>
- <p>
- In OSE it is not possible for a signal number to be a unique identifier
- for a resource in the same way as an fd is. For example; let's say we
- implement a driver that does an asynchronous hunt that uses signal
- number 1234 as the hunt_sig. If we want to be able to have multiple
- hunt ports running at the same time we have to have someway of routing
- the signal to the correct port. This is achieved by supplying a secondary
- id that can be retrieved through the meta-data or payload of the signal,
- e.g:
- <code>ErlDrvEvent event = erl_drv_ose_event_alloc(1234,port,resolver);</code>
- The event you get back from
- <seealso marker="ose_erl_driver#erl_drv_ose_event_alloc">
- erl_drv_ose_event_alloc</seealso> can then be used by
- <seealso marker="erts:erl_driver#driver_select">driver_select</seealso>
- to subscribe to signals. The first argument is just the signal number
- that we are interested in. The second is the id that we choose to use,
- in this case the port id that we got in the
- <seealso marker="erts:driver_entry#start">start</seealso> callback is
- used. The third argument is a function pointer to a function that can
- be used to figure out the id from a given signal. The fourth argument can
- point to any additional data you might want to associate with the event.
- There is a complete. You can examine the data contained in the event with
- <seealso marker="ose_erl_driver#erl_drv_ose_event_fetch">erl_drv_ose_event_fetch</seealso>
- , eg:
- <code>erl_drv_ose_event_fetch(event, &amp;signal, &amp;port, (void **)&amp;extra);</code>
- example of what this could look like in
- <seealso marker="#example">the next section</seealso>.
- <note>It is very important to issue the driver_select call before
- any of the signals you are interested in are sent. If driver_select
- is called after the signal is sent, there is a high probability that it
- will be lost.</note>
- </p>
- <p>
- The other difference from unix is that in OSE the payload of the event
- (i.e. the signal data) is already received when the ready_output/input
- callbacks are called. This means that you access the data of a signal
- by calling <seealso marker="ose_erl_driver#erl_drv_ose_get_signal">
- erl_drv_ose_get_signal</seealso>. Additionally multiple signals might be
- associated with the event, so you should call
- <seealso marker="ose_erl_driver#erl_drv_ose_get_signal">
- erl_drv_ose_get_signal</seealso> until <c>NULL</c> is returned.
- </p>
- </section>
-
- <marker id="example"></marker>
- <section>
- <title>Example Linked-in driver</title>
-<code>#include "erl_driver.h"
-#include "ose.h"
-
-struct huntsig {
- SIGSELECT signo;
- ErlDrvPort port;
-};
-
-union SIGNAL {
- SIGSELECT signo;
- struct huntsig;
-}
-
-/* Here we have to get the id from the signal. In this case we use the
- port id since we have control over the data structure of the signal.
- It is however possible to use anything in here. The only restriction
- is that the same id has to be used for all signals of the same number.*/
-ErlDrvOseEventId resolver(union SIGNAL *sig) {
- return (ErlDrvOseEventId)sig->huntsig.port;
-}
-
-static int drv_init(void) { return 0; };
-
-static ErlDrvData drv_start(ErlDrvPort port, char *command) {
- return (ErlDrvData)port;
-}
-
-static ErlDrvSSizeT control(ErlDrvData driver_data, unsigned int cmd,
- char *buf, ErlDrvSizeT len,
- char **rbuf, ErlDrvSizeT rlen) {
- ErlDrvPort port = (ErlDrvPort)driver_data;
-
- /* An example of extra data to associate with the event */
- char *extra_data = driver_alloc(80);
- snprintf("extra_data, "Event, sig_no: 1234, and port: %d", port);
-
- /* Create a new event to select on */
- ErlDrvOseEvent evt = erl_drv_ose_event_alloc(1234,port,resolver, extra_data);
-
- /* Make sure to do the select call _BEFORE_ the signal arrives.
- The signal might get lost if the hunt call is done before the
- select. */
- driver_select(port,evt,ERL_DRV_READ|ERL_DRV_USE,1);
-
- union SIGNAL *sig = alloc(sizeof(union SIGNAL),1234);
- sig->huntsig.port = port;
- hunt("testprocess",0,NULL,&amp;sig);
- return 0;
-}
-
-static void ready_input(ErlDrvData driver_data, ErlDrvEvent evt) {
- char *extra_data;
- /* Get the first signal payload from the event */
- union SIGNAL *sig = erl_drv_ose_get_signal(evt);
- ErlDrvPort port = (ErlDrvPort)driver_data;
- while (sig != NULL) {
- if (sig->signo == 1234) {
- /* Print out the string we added as the extra parameter */
- erl_drv_ose_event_fetch(evt, NULL, NULL, (void **)&amp;extra_data);
- printf("We've received: %s\n", extra_data);
-
- /* If it is our signal we send a message with the sender of the signal
- to the controlling erlang process */
- ErlDrvTermData reply[] = { ERL_DRV_UINT, (ErlDrvUInt)sender(&amp;sig) };
- erl_drv_send_term(port,reply,sizeof(reply) / sizeof(reply[0]));
- }
-
- /* Cleanup the signal and deselect on the event.
- Note that the event itself has to be free'd in the stop_select
- callback. */
- free_buf(&amp;sig);
- driver_select(port,evt,ERL_DRV_READ|ERL_DRV_USE,0);
-
- /* There could be more than one signal waiting in this event, so
- we have to loop until sig == NULL */
- sig = erl_drv_ose_get_signal(evt);
- }
-}
-
-static void stop_select(ErlDrvEvent event, void *reserved)
-{
- /* Free the extra_data */
- erl_drv_ose_event_fetch(evt, NULL, NULL, (void **)&amp;extra_data);
- driver_free(extra_data);
-
- /* Free the event itself */
- erl_drv_ose_event_free(event);
-}
-
-/**
- * Setup the driver entry for the Erlang runtime
- **/
-ErlDrvEntry ose_signal_driver_entry = {
- .init = drv_init,
- .start = drv_start,
- .stop = drv_stop,
- .ready_input = ready_input,
- .driver_name = DRIVER_NAME,
- .control = control,
- .extended_marker = ERL_DRV_EXTENDED_MARKER,
- .major_version = ERL_DRV_EXTENDED_MAJOR_VERSION,
- .minor_version = ERL_DRV_EXTENDED_MINOR_VERSION,
- .driver_flags = ERL_DRV_FLAG_USE_PORT_LOCKING,
- .stop_select = stop_select
-};
-</code>
- </section>
-
-</chapter>
diff --git a/lib/ose/doc/src/part.xml b/lib/ose/doc/src/part.xml
deleted file mode 100644
index 0c9ebd16c0..0000000000
--- a/lib/ose/doc/src/part.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE part SYSTEM "part.dtd">
-
-<part xmlns:xi="http://www.w3.org/2001/XInclude">
- <header>
- <copyright>
- <year>2014</year>
- <year>2014</year>
- <holder>Ericsson AB, All Rights Reserved</holder>
- </copyright>
- <legalnotice>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- The Initial Developer of the Original Code is Ericsson AB.
- </legalnotice>
-
- <title>OSE User's Guide</title>
- <prepared>Lukas Larsson</prepared>
- <docno></docno>
- <date>2014-01-08</date>
- <rev>1.0</rev>
- <file>part.xml</file>
- </header>
- <description>
- <p><em>OSE</em>.</p>
- </description>
- <xi:include href="ose_intro.xml"/>
- <xi:include href="ose_signals_chapter.xml"/>
-</part>
diff --git a/lib/ose/doc/src/ref_man.xml b/lib/ose/doc/src/ref_man.xml
deleted file mode 100644
index 964e5ab8ff..0000000000
--- a/lib/ose/doc/src/ref_man.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE application SYSTEM "application.dtd">
-
-<application xmlns:xi="http://www.w3.org/2001/XInclude">
- <header>
- <copyright>
- <year>2014</year><year>2014</year>
- <holder>Ericsson AB. All Rights Reserved.</holder>
- </copyright>
- <legalnotice>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- </legalnotice>
-
- <title>OSE Reference Manual</title>
- <prepared>Lukas Larsson</prepared>
- <docno></docno>
- <date>2014-01-08</date>
- <rev>1.0</rev>
- <file>ref_man.xml</file>
- </header>
- <description>
- <p>The Standard Erlang Libraries application, <em>STDLIB</em>,
- contains modules for manipulating lists, strings and files etc.</p>
- <br></br>
- </description>
- <xi:include href="ose_app.xml"/>
- <xi:include href="ose.xml"/>
- <xi:include href="ose_erl_driver.xml"/>
-</application>
diff --git a/lib/ose/ebin/.gitignore b/lib/ose/ebin/.gitignore
deleted file mode 100644
index e69de29bb2..0000000000
--- a/lib/ose/ebin/.gitignore
+++ /dev/null
diff --git a/lib/ose/include/.gitignore b/lib/ose/include/.gitignore
deleted file mode 100644
index e69de29bb2..0000000000
--- a/lib/ose/include/.gitignore
+++ /dev/null
diff --git a/lib/ose/info b/lib/ose/info
deleted file mode 100644
index 85c07dbe82..0000000000
--- a/lib/ose/info
+++ /dev/null
@@ -1,2 +0,0 @@
-group: misc Miscellaneous Applications
-short: Description of Enea OSE specific functionality
diff --git a/lib/ose/src/Makefile b/lib/ose/src/Makefile
deleted file mode 100644
index a89e9392e9..0000000000
--- a/lib/ose/src/Makefile
+++ /dev/null
@@ -1,107 +0,0 @@
-#
-# %CopyrightBegin%
-#
-# Copyright Ericsson AB 1996-2013. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# %CopyrightEnd%
-#
-
-include $(ERL_TOP)/make/target.mk
-include $(ERL_TOP)/make/$(TARGET)/otp.mk
-
-# ----------------------------------------------------
-# Application version
-# ----------------------------------------------------
-include ../vsn.mk
-VSN=$(OSE_VSN)
-
-# ----------------------------------------------------
-# Release directory specification
-# ----------------------------------------------------
-RELSYSDIR = $(RELEASE_PATH)/lib/ose-$(VSN)
-
-# ----------------------------------------------------
-# Target Specs
-# ----------------------------------------------------
-MODULES= \
- ose
-
-HRL_FILES=
-
-INTERNAL_HRL_FILES=
-
-ERL_FILES= $(MODULES:%=%.erl)
-
-TARGET_FILES= $(MODULES:%=$(EBIN)/%.$(EMULATOR)) $(APP_TARGET) $(APPUP_TARGET)
-
-APP_FILE= ose.app
-
-APP_SRC= $(APP_FILE).src
-APP_TARGET= $(EBIN)/$(APP_FILE)
-
-APPUP_FILE= ose.appup
-
-APPUP_SRC= $(APPUP_FILE).src
-APPUP_TARGET= $(EBIN)/$(APPUP_FILE)
-
-# ----------------------------------------------------
-# FLAGS
-# ----------------------------------------------------
-
-ifeq ($(NATIVE_LIBS_ENABLED),yes)
-ERL_COMPILE_FLAGS += +native
-endif
-ERL_COMPILE_FLAGS += -I../include -I../../kernel/include -Werror
-
-# ----------------------------------------------------
-# Targets
-# ----------------------------------------------------
-
-debug opt: $(TARGET_FILES)
-
-clean:
- rm -f $(TARGET_FILES)
- rm -f core
- rm -f erl_parse.erl
-
-docs:
-
-# ----------------------------------------------------
-# Special Build Targets
-# ----------------------------------------------------
-
-$(APP_TARGET): $(APP_SRC) ../vsn.mk
- $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@
-
-$(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk
- $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@
-
-# ----------------------------------------------------
-# Release Target
-# ----------------------------------------------------
-include $(ERL_TOP)/make/otp_release_targets.mk
-
-release_spec: opt
- $(INSTALL_DIR) "$(RELSYSDIR)/src"
- $(INSTALL_DATA) $(ERL_FILES) "$(RELSYSDIR)/src"
- $(INSTALL_DIR) "$(RELSYSDIR)/include"
- $(INSTALL_DIR) "$(RELSYSDIR)/ebin"
- $(INSTALL_DATA) $(TARGET_FILES) "$(RELSYSDIR)/ebin"
-
-release_docs_spec:
-
-# ----------------------------------------------------
-# Dependencies -- alphabetically, please
-# ----------------------------------------------------
diff --git a/lib/ose/src/ose.app.src b/lib/ose/src/ose.app.src
deleted file mode 100644
index 036779eb16..0000000000
--- a/lib/ose/src/ose.app.src
+++ /dev/null
@@ -1,28 +0,0 @@
-%% This is an -*- erlang -*- file.
-%%
-%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1996-2011. All Rights Reserved.
-%%
-%% Licensed under the Apache License, Version 2.0 (the "License");
-%% you may not use this file except in compliance with the License.
-%% You may obtain a copy of the License at
-%%
-%% http://www.apache.org/licenses/LICENSE-2.0
-%%
-%% Unless required by applicable law or agreed to in writing, software
-%% distributed under the License is distributed on an "AS IS" BASIS,
-%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-%% See the License for the specific language governing permissions and
-%% limitations under the License.
-%%
-%% %CopyrightEnd%
-%%
-{application, ose,
- [{description, "Enea OSE specific modules"},
- {vsn, "%VSN%"},
- {modules, [ose]},
- {registered,[]},
- {applications, [stdlib,kernel]},
- {env, []},
- {runtime_dependencies, ["stdlib-2.0","erts-6.0"]}]}.
diff --git a/lib/ose/src/ose.appup.src b/lib/ose/src/ose.appup.src
deleted file mode 100644
index 28b6da3439..0000000000
--- a/lib/ose/src/ose.appup.src
+++ /dev/null
@@ -1,23 +0,0 @@
-%% -*- erlang -*-
-%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1999-2013. All Rights Reserved.
-%%
-%% Licensed under the Apache License, Version 2.0 (the "License");
-%% you may not use this file except in compliance with the License.
-%% You may obtain a copy of the License at
-%%
-%% http://www.apache.org/licenses/LICENSE-2.0
-%%
-%% Unless required by applicable law or agreed to in writing, software
-%% distributed under the License is distributed on an "AS IS" BASIS,
-%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-%% See the License for the specific language governing permissions and
-%% limitations under the License.
-%%
-%% %CopyrightEnd%
-{"%VSN%",
- [
- ],
- [
- ]}.
diff --git a/lib/ose/src/ose.erl b/lib/ose/src/ose.erl
deleted file mode 100644
index 5534dba4d4..0000000000
--- a/lib/ose/src/ose.erl
+++ /dev/null
@@ -1,453 +0,0 @@
-%%
-%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2013. All Rights Reserved.
-%%
-%% Licensed under the Apache License, Version 2.0 (the "License");
-%% you may not use this file except in compliance with the License.
-%% You may obtain a copy of the License at
-%%
-%% http://www.apache.org/licenses/LICENSE-2.0
-%%
-%% Unless required by applicable law or agreed to in writing, software
-%% distributed under the License is distributed on an "AS IS" BASIS,
-%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-%% See the License for the specific language governing permissions and
-%% limitations under the License.
-%%
-%% %CopyrightEnd%
-%%
-%% @doc Interface module for OSE messaging and process monitoring from Erlang
-%%
-%% For each mailbox created through {@link open/1} a OSE phantom process with
-%% that name is started. Since phantom processes are used the memory footprint
-%% of each mailbox is quite small.
-%%
-%% To receive messages you first have to subscribe to the specific message
-%% numbers that you are interested in with {@link listen/2}. The messages
-%% will be sent to the Erlang process that created the mailbox.
-%%
-%% @end
-%%
--module(ose).
-
-%%==============================================================================
-%% Exported API
-%%==============================================================================
--export([open/1,
- close/1,
- get_id/1,
- get_name/2,
- hunt/2,
- dehunt/2,
- attach/2,
- detach/2,
- send/4,
- send/5,
- listen/2
- ]).
-
-%%==============================================================================
-%% Types
-%%==============================================================================
--opaque mailbox() :: port().
-%% Mailbox handle. Implemented as an erlang port.
-
--opaque mailbox_id() :: integer().
-%% Mailbox ID, this is the same as the process id of an OSE process.
-%% An integer.
-
--type message_number() :: 0..4294967295.
-%% OSE Signal number
-
--opaque hunt_ref() :: {mailbox(),integer()}.
-%% Reference from a hunt request. This term will be included
-%% in a successful hunt response.
-
--opaque attach_ref() :: {mailbox(),integer()}.
-%% Reference from an attach request. This term will be included
-%% in the term returned when the attached mailbox disappears.
-
--export_type([mailbox_id/0,
- message_number/0,
- mailbox/0,
- hunt_ref/0,
- attach_ref/0]).
-
-%%==============================================================================
-%% Defines
-%%==============================================================================
--define(DRIVER_NAME, "ose_signal_drv").
--define(GET_SPID, 1).
--define(GET_NAME, 2).
--define(HUNT, 100).
--define(DEHUNT, 101).
--define(ATTACH, 102).
--define(DETACH, 103).
--define(SEND, 104).
--define(SEND_W_S, 105).
--define(LISTEN, 106).
--define(OPEN, 200).
-
--define(INT_32BIT(Int),(is_integer(Int) andalso (Int >= 0) andalso (Int < (1 bsl 32)))).
-
-%%==============================================================================
-%% API functions
-%%==============================================================================
-
-%%------------------------------------------------------------------------------
-%% @doc Create a mailbox with the given name and return a port that handles
-%% the mailbox.
-%%
-%% An OSE phantom process with the given name will be created that will send any
-%% messages sent through this mailbox. Any messages sent to the new OSE process
-%% will automatically be converted to an Erlang message and sent to the Erlang
-%% process that calls this function. See {@link listen/2} for details about the
-%% format of the message sent.
-%%
-%% The caller gets linked to the created mailbox.
-%%
-%% raises: `badarg' | `system_limit'
-%%
-%% @see listen/2
-%% @end
-%%------------------------------------------------------------------------------
--spec open(Name) -> Port when
- Name :: iodata(),
- Port :: mailbox().
-open(Name) ->
- try open_port({spawn_driver,?DRIVER_NAME}, [binary]) of
- Port ->
- try port_command(Port,[?OPEN,Name]) of
- true ->
- receive
- {ose_drv_reply,Port,{error,Error}} ->
- close(Port),
- erlang:error(Error,[Name]);
- {ose_drv_reply,Port,ok} ->
- Port
- end
- catch
- error:badarg -> close(Port),erlang:error(badarg,[Name])
- end
- catch
- error:badarg -> erlang:error(badarg,[Name])
- end.
-
-%%------------------------------------------------------------------------------
-%% @doc Close a mailbox
-%%
-%% This kills the OSE phantom process associated with this mailbox.
-%%
-%% Will also consume any ``{'EXIT',Port,_}'' message from the port that comes
-%% due to the port closing when the calling process traps exits.
-%%
-%% raises: `badarg'
-%% @end
-%%------------------------------------------------------------------------------
--spec close(Port) -> ok when
- Port :: mailbox().
-close(Port) when is_port(Port) ->
- %% Copied from prim_inet
- case erlang:process_info(self(), trap_exit) of
- {trap_exit,true} ->
- link(Port),
- catch erlang:port_close(Port),
- receive {'EXIT',Port,_} -> ok end;
- {trap_exit,false} ->
- catch erlang:port_close(Port),
- ok
- end;
-close(NotPort) ->
- erlang:error(badarg,[NotPort]).
-
-%%------------------------------------------------------------------------------
-%% @doc Get the mailbox id for the given port.
-%%
-%% The mailbox id is the same as the OSE process id of the OSE phantom process
-%% that this mailbox represents.
-%%
-%% raises: `badarg'
-%% @end
-%%------------------------------------------------------------------------------
--spec get_id(Port) -> Pid when
- Port :: mailbox(),
- Pid :: mailbox_id().
-get_id(Port) ->
- try port_control(Port, ?GET_SPID, <<>>) of
- <<Spid:32>> -> Spid
- catch error:_Error ->
- erlang:error(badarg,[Port])
- end.
-
-%%------------------------------------------------------------------------------
-%% @doc Get the mailbox name for the given mailbox id.
-%%
-%% The mailbox name is the name of the OSE process with process id Pid.
-%%
-%% This call will fail with badarg if the underlying system does not support
-%% getting the name from a process id.
-%%
-%% raises: `badarg'
-%% @end
-%%------------------------------------------------------------------------------
--spec get_name(Port, Pid) -> Name | undefined when
- Port :: mailbox(),
- Pid :: mailbox_id(),
- Name :: binary().
-get_name(Port, Pid) when ?INT_32BIT(Pid) ->
- try port_control(Port, ?GET_NAME, <<Pid:32>>) of
- [] -> undefined;
- Res -> Res
- catch error:_Error ->
- erlang:error(badarg,[Port,Pid])
- end;
-get_name(Port, Pid) ->
- erlang:error(badarg,[Port,Pid]).
-
-
-%%------------------------------------------------------------------------------
-%% @doc Hunt for OSE process by name.
-%%
-%% Will send `{mailbox_up, Port, Ref, MboxId}'
-%% to the calling process when the OSE process becomes available.
-%%
-%% Returns a reference term that can be used to cancel the hunt
-%% using {@link dehunt/2}.
-%%
-%% raises: `badarg'
-%%
-%% @end
-%%------------------------------------------------------------------------------
--spec hunt(Port, HuntPath) -> Ref when
- Port :: mailbox(),
- HuntPath :: iodata(),
- Ref :: hunt_ref().
-hunt(Port, HuntPath) ->
- try port_command(Port, [?HUNT,HuntPath]) of
- true ->
- receive
- {ose_drv_reply,Port,{error,Error}} ->
- erlang:error(Error,[Port,HuntPath]);
- {ose_drv_reply,Port,Ref} ->
- Ref
- end
- catch error:_Error ->
- erlang:error(badarg,[Port,HuntPath])
- end.
-
-%%------------------------------------------------------------------------------
-%% @doc Stop hunting for OSE process.
-%%
-%% If a message for this hunt has been sent but not received
-%% by the calling process, it is removed from the message queue.
-%% Note that this only works if the same process that did
-%% the hunt does the dehunt.
-%%
-%% raises: `badarg'
-%%
-%% @see hunt/2
-%% @end
-%%------------------------------------------------------------------------------
--spec dehunt(Port, Ref) -> ok when
- Port :: mailbox(),
- Ref :: hunt_ref().
-dehunt(Port, {Port,Ref}) when ?INT_32BIT(Ref) ->
- try port_command(Port, <<?DEHUNT:8, Ref:32>>) of
- true ->
- receive
- {ose_drv_reply,Port,{error,enoent}} ->
- %% enoent could mean that it is in the message queue
- receive
- {mailbox_up, Port, {Port,Ref}, _} ->
- ok
- after 0 ->
- ok
- end;
- {ose_drv_reply,Port,ok} ->
- ok
- end
- catch error:_Error ->
- erlang:error(badarg,[Port,{Port,Ref}])
- end;
-dehunt(Port,Ref) ->
- erlang:error(badarg,[Port,Ref]).
-
-%%------------------------------------------------------------------------------
-%% @doc Attach to an OSE process.
-%%
-%% Will send `{mailbox_down, Port, Ref, MboxId}'
-%% to the calling process if the OSE process exits.
-%%
-%% Returns a reference that can be used to cancel the attachment
-%% using {@link detach/2}.
-%%
-%% raises: `badarg' | `enomem'
-%%
-%% @end
-%%------------------------------------------------------------------------------
--spec attach(Port,Pid) -> Ref when
- Port :: mailbox(),
- Pid :: mailbox_id(),
- Ref :: attach_ref().
-attach(Port, Spid) when ?INT_32BIT(Spid) ->
- try port_command(Port, <<?ATTACH:8, Spid:32>>) of
- true ->
- receive
- {ose_drv_reply,Port,{error,Error}} ->
- erlang:error(Error,[Port,Spid]);
- {ose_drv_reply,Port,Ref} ->
- Ref
- end
- catch error:_Error ->
- erlang:error(badarg,[Port,Spid])
- end;
-attach(Port,Spid) ->
- erlang:error(badarg,[Port,Spid]).
-
-
-%%------------------------------------------------------------------------------
-%% @doc Remove attachment to an OSE process.
-%%
-%% If a message for this monitor has been sent but not received
-%% by the calling process, it is removed from the message queue.
-%% Note that this only works of the same process
-%% that did the attach does the detach.
-%%
-%% raises: `badarg'
-%%
-%% @see attach/2
-%% @end
-%%------------------------------------------------------------------------------
--spec detach(Port,Ref) -> ok when
- Port :: mailbox(),
- Ref :: attach_ref().
-detach(Port, {Port,Ref} ) when ?INT_32BIT(Ref) ->
- try port_command(Port, <<?DETACH:8, Ref:32>>) of
- true ->
- receive
- {ose_drv_reply,Port,{error,enoent}} ->
- %% enoent could mean that it is in the message queue
- receive
- {mailbox_down,Port,{Port,Ref},_} ->
- ok
- after 0 ->
- ok
- end;
- {ose_drv_reply,Port,ok} ->
- ok
- end
- catch error:_Error ->
- erlang:error(badarg,[Port,{Port,Ref}])
- end;
-detach(Port,Ref) ->
- erlang:error(badarg,[Port,Ref]).
-
-%%------------------------------------------------------------------------------
-%% @doc Send an OSE message.
-%%
-%% The message is sent from the OSE process' own ID that is: `get_id(Port)'.
-%%
-%% raises: `badarg'
-%%
-%% @see send/5
-%% @end
-%%------------------------------------------------------------------------------
--spec send(Port,Pid,SigNo,SigData) -> ok when
- Port :: mailbox(),
- Pid :: mailbox_id(),
- SigNo :: message_number(),
- SigData :: iodata().
-send(Port, Spid, SigNo, SigData) when ?INT_32BIT(Spid), ?INT_32BIT(SigNo) ->
- try erlang:port_command(Port, [<<?SEND:8, Spid:32, SigNo:32>>, SigData]) of
- true -> ok
- catch error:_Error ->
- erlang:error(badarg,[Port,Spid,SigNo,SigData])
- end;
-send(Port,Spid,SigNo,SigData) ->
- erlang:error(badarg,[Port,Spid,SigNo,SigData]).
-
-
-%%------------------------------------------------------------------------------
-%% @doc Send an OSE message with different sender.
-%%
-%% As {@link send/4} but the sender will be `SenderPid'.
-%%
-%% raises: `badarg'
-%%
-%% @see send/4
-%% @end
-%%------------------------------------------------------------------------------
--spec send(Port,Pid,SenderPid,SigNo,SigData) -> ok when
- Port :: mailbox(),
- Pid :: mailbox_id(),
- SenderPid :: mailbox_id(),
- SigNo :: message_number(),
- SigData :: iodata().
-send(Port, Spid, SenderPid, SigNo, SigData)
- when ?INT_32BIT(Spid), ?INT_32BIT(SenderPid), ?INT_32BIT(SigNo) ->
- try erlang:port_command(Port, [<<?SEND_W_S:8, Spid:32, SenderPid:32,
- SigNo:32>>, SigData]) of
- true -> ok
- catch error:_Error ->
- erlang:error(badarg,[Port,Spid,SenderPid,SigNo,SigData])
- end;
-send(Port,Spid,SenderPid,SigNo,SigData) ->
- erlang:error(badarg,[Port,Spid,SenderPid,SigNo,SigData]).
-
-%%------------------------------------------------------------------------------
-%% @doc Start listening for specified OSE signal numbers.
-%%
-%% The mailbox will send `{message,Port,{FromMboxId,ToMboxId,MsgNo,MsgData}}'
-%% to the process that created the mailbox when an OSE message with any
-%% of the specified `SigNos' arrives.
-%%
-%% Repeated calls to listen will replace the current set of signal numbers to
-%% listen to. i.e
-%%
-%% ```1>ose:listen(MsgB,[1234,12345]).
-%% ok
-%% 2> ose:listen(MsgB,[1234,123456]).
-%% ok.'''
-%%
-%% The above will first listen for signals with numbers 1234 and 12345, and then
-%% replace that with only listening to 1234 and 123456.
-%%
-%% With the current implementation it is not possible to listen to all signal
-%% numbers.
-%%
-%% raises: `badarg' | `enomem'
-%%
-%% @end
-%%------------------------------------------------------------------------------
--spec listen(Port, SigNos) -> ok when
- Port :: mailbox(),
- SigNos :: list(message_number()).
-listen(Port, SigNos) when is_list(SigNos) ->
- USSigNos = lists:usort(SigNos),
- BinSigNos = try
- << <<SigNo:32>> ||
- SigNo <- USSigNos,
- ?INT_32BIT(SigNo) orelse erlang:error(badarg)
- >>
- catch _:_ ->
- erlang:error(badarg,[Port,SigNos])
- end,
- try port_command(Port, [?LISTEN, BinSigNos]) of
- true ->
- receive
- {ose_drv_reply,Port,{error,Error}} ->
- erlang:error(Error,[Port,SigNos]);
- {ose_drv_reply,Port,Else} ->
- Else
- end
- catch error:_Error ->
- erlang:error(badarg,[Port,SigNos])
- end;
-listen(Port, SigNos) ->
- erlang:error(badarg,[Port,SigNos]).
-
-
-%%%=============================================================================
-%%% Internal functions
-%%%=============================================================================
diff --git a/lib/ose/test/Makefile b/lib/ose/test/Makefile
deleted file mode 100644
index 7e2080ba38..0000000000
--- a/lib/ose/test/Makefile
+++ /dev/null
@@ -1,67 +0,0 @@
-include $(ERL_TOP)/make/target.mk
-include $(ERL_TOP)/make/$(TARGET)/otp.mk
-
-# ----------------------------------------------------
-# Target Specs
-# ----------------------------------------------------
-
-MODULES= \
- ose_SUITE
-
-ERL_FILES= $(MODULES:%=%.erl)
-
-TARGET_FILES= $(MODULES:%=$(EBIN)/%.$(EMULATOR))
-
-INSTALL_PROGS= $(TARGET_FILES)
-
-# ----------------------------------------------------
-# Release directory specification
-# ----------------------------------------------------
-RELSYSDIR = $(RELEASE_PATH)/ose_test
-
-# ----------------------------------------------------
-# FLAGS
-# ----------------------------------------------------
-
-ERL_MAKE_FLAGS +=
-ERL_COMPILE_FLAGS += -I$(ERL_TOP)/lib/test_server/include \
- -I$(ERL_TOP)/lib/kernel/include
-
-EBIN = .
-
-EMAKEFILE=Emakefile
-COVERFILE=ose.cover
-
-# ----------------------------------------------------
-# Targets
-# ----------------------------------------------------
-
-make_emakefile:
- $(ERL_TOP)/make/make_emakefile $(ERL_COMPILE_FLAGS) -o$(EBIN) $(MODULES) \
- > $(EMAKEFILE)
-
-tests debug opt: make_emakefile
- erl $(ERL_MAKE_FLAGS) -make
-
-clean:
- rm -f $(EMAKEFILE)
- rm -f $(TARGET_FILES)
- rm -f core
-
-docs:
-
-# ----------------------------------------------------
-# Release Target
-# ----------------------------------------------------
-include $(ERL_TOP)/make/otp_release_targets.mk
-
-release_spec: opt
-
-release_tests_spec: make_emakefile
- $(INSTALL_DIR) "$(RELSYSDIR)"
- $(INSTALL_DATA) ose.spec $(EMAKEFILE) \
- $(ERL_FILES) $(COVERFILE) "$(RELSYSDIR)"
- chmod -R u+w "$(RELSYSDIR)"
- @tar cf - *_SUITE_data | (cd "$(RELSYSDIR)"; tar xf -)
-
-release_docs_spec:
diff --git a/lib/ose/test/ose.cover b/lib/ose/test/ose.cover
deleted file mode 100644
index 7b846cfaf6..0000000000
--- a/lib/ose/test/ose.cover
+++ /dev/null
@@ -1,2 +0,0 @@
-%% -*- erlang -*-
-{incl_app,ose,details}.
diff --git a/lib/ose/test/ose.spec b/lib/ose/test/ose.spec
deleted file mode 100644
index c897e8cd16..0000000000
--- a/lib/ose/test/ose.spec
+++ /dev/null
@@ -1 +0,0 @@
-{suites,"../ose_test",all}.
diff --git a/lib/ose/test/ose_SUITE.erl b/lib/ose/test/ose_SUITE.erl
deleted file mode 100644
index 31d950bd03..0000000000
--- a/lib/ose/test/ose_SUITE.erl
+++ /dev/null
@@ -1,766 +0,0 @@
-%%
-%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1998-2013. All Rights Reserved.
-%%
-%% Licensed under the Apache License, Version 2.0 (the "License");
-%% you may not use this file except in compliance with the License.
-%% You may obtain a copy of the License at
-%%
-%% http://www.apache.org/licenses/LICENSE-2.0
-%%
-%% Unless required by applicable law or agreed to in writing, software
-%% distributed under the License is distributed on an "AS IS" BASIS,
-%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-%% See the License for the specific language governing permissions and
-%% limitations under the License.
-%%
-%% %CopyrightEnd%
-%%
--module(ose_SUITE).
-
-%-compile(export_all).
-
--export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
- init_per_group/2,end_per_group/2,init_per_testcase/2,
- end_per_testcase/2]).
--export([
- basic/1,stress/1,multi_msg_numbers/1,multi_mailboxes/1,
- hunt/1,multi_hunt/1,dehunt/1,multi_dehunt/1,
- attach/1,multi_attach/1,detach/1,multi_detach/1,
- open_errors/1,close_errors/1,get_id_errors/1,get_name_errors/1,
- hunt_errors/1,dehunt_errors/1,attach_errors/1,detach_errors/1,
- send_errors/1,send_w_s_errors/1,listen_errors/1
- ]).
-
--define(INTERFACE,ose).
-
-
-init_per_testcase(_Func, Config) ->
- Config.
-end_per_testcase(_Func, _Config) ->
- ok.
-
-suite() -> [{timeout,{30,seconds}}].
-
-all() ->
- [
- basic,stress,multi_msg_numbers,multi_mailboxes,
- hunt,multi_hunt,dehunt,multi_dehunt,
- attach,multi_attach,detach,multi_detach,
-
- open_errors,close_errors,get_id_errors,get_name_errors,
- hunt_errors,dehunt_errors,attach_errors,detach_errors,
- send_errors,send_w_s_errors,listen_errors
- ].
-
-groups() ->
- [].
-
-init_per_suite(Config) ->
- case os:type() of
- {ose,_} ->
- Config;
- _Else ->
- {skip,"Only run on OSE"}
- end.
-
-end_per_suite(_Config) ->
- ok.
-
-init_per_group(_GroupName, Config) ->
- Config.
-
-end_per_group(_GroupName, Config) ->
- Config.
-
-basic(_Config) ->
-
- [P1,P2] = multi_open(2,[42]),
- P1Id = ?INTERFACE:get_id(P1),
- P2Id = ?INTERFACE:get_id(P2),
-
- ok = ?INTERFACE:send(P2,P1Id,42,<<"ping">>),
- receive
- {message,P1,V1} ->
- {P2Id,P1Id,42,<<"ping">>} = V1,
- ?INTERFACE:send(P1,P2Id,42,<<"pong">>);
- Else1 ->
- ct:fail({got_wrong_message,Else1})
- end,
-
- receive
- {message,P2,V2} ->
- {P1Id,P2Id,42,<<"pong">>} = V2;
- Else2 ->
- ct:fail({got_wrong_message,Else2})
- end,
-
- ?INTERFACE:close(P1),
- ?INTERFACE:close(P2).
-
-%% Send 1000 messages and see if we can cope and that msg order is preserved
-stress(_Config) ->
-
- Iterations = 1000,
-
- [P1,P2] = multi_open(2,[42]),
- P1Id = ?INTERFACE:get_id(P1),
- P2Id = ?INTERFACE:get_id(P2),
-
- spawn(fun() ->
- n(fun(N) ->
- Msg = [<<"ping">>|integer_to_list(N)],
- ?INTERFACE:send(P2,P1Id,42,Msg)
- end,Iterations)
- end),
- timer:sleep(100),
- n(fun(N) ->
- receive
- {message,P1,Value} ->
- Int = integer_to_binary(N),
- {P2Id,P1Id,42,<<"ping",Int/binary>>} = Value,
- ok;
- Else ->
- ct:fail({got_wrong_message,Else})
- end
- end,Iterations),
-
- ?INTERFACE:close(P1),
- ?INTERFACE:close(P2).
-
-%% Listen to 1000 different message numbers and send some random messages
-multi_msg_numbers(_Config) ->
-
- Iterations = 100,
-
- [P1,P2] = multi_open(2,lists:seq(2000,3000)),
- P1Id = ?INTERFACE:get_id(P1),
-
- n(fun(_) ->
- Num = random:uniform(1000)+2000,
- ?INTERFACE:send(P2,P1Id,Num,<<"ping",(integer_to_binary(Num))/binary>>)
- end,Iterations),
-
- n(fun(_) ->
- receive
- {message,P1,{_,_,Id,<<"ping",Num/binary>>}} when Id > 2000;
- Id =< 3000 ->
- Id = binary_to_integer(Num),
- ok;
- Else ->
- ct:fail({got_wrong_message,Else})
- end
- end,Iterations),
-
- ?INTERFACE:close(P1),
- ?INTERFACE:close(P2).
-
-
-%% Create 100 mailboxes and send messages to them
-multi_mailboxes(_Config) ->
-
- Mailboxes = 100,
-
- [P1|MBs] = multi_open(Mailboxes,[42]),
-
- [?INTERFACE:send(P1,?INTERFACE:get_id(P),42,[<<"ping">>,?INTERFACE:get_name(P,?INTERFACE:get_id(P))]) || P <- MBs],
-
- [receive
- {message,P,Value} ->
- Name = ?INTERFACE:get_name(P,?INTERFACE:get_id(P)),
- {_,_,42,<<"ping",Name/binary>>} = Value,
- ok
- end || P <- MBs],
-
- [?INTERFACE:close(P) || P <- [P1|MBs]],
- ok.
-
-hunt(_Config) ->
- [P1,P2] = multi_open(2,[]),
-
- Ref = ?INTERFACE:hunt(P1,"p2"),
- receive
- {mailbox_up,P1,Ref,Pid} ->
- Pid = ?INTERFACE:get_id(P2),
- ?INTERFACE:close(P1),
- ?INTERFACE:close(P2);
- Else ->
- ct:fail({got_wrong_message,Else,Ref})
- end.
-
-multi_hunt(_Config) ->
-
- Iterations = 100,
-
- P = ?INTERFACE:open("p"),
-
- Refs = [?INTERFACE:hunt(P,"p"++integer_to_list(N))|| N <- lists:seq(1,Iterations)],
-
- Pids = [begin
- Prt = ?INTERFACE:open("p"++integer_to_list(N)),
- Pid = ?INTERFACE:get_id(Prt),
- ?INTERFACE:close(Prt),
- Pid
- end || N <- lists:seq(1,Iterations)],
-
- [receive
- {mailbox_up,P,Ref,Pid} ->
- ok
- after 10 ->
- ct:fail({did_not_get,Pid,Ref})
- end || {Pid,Ref} <- lists:zip(Pids,Refs)],
- ?INTERFACE:close(P).
-
-
-dehunt(_Config) ->
- [P1] = multi_open(1,[]),
- Ref = ?INTERFACE:hunt(P1,"p2"),
- receive
- _Else -> ct:fail({got,_Else})
- after 1000 ->
- ok
- end,
- P2 = ?INTERFACE:open("p2"),
-
- % Make sure any messages are sent
- receive after 10 -> ok end,
-
- ok = ?INTERFACE:dehunt(P1,Ref),
-
- % Make sure no messages are received
- receive
- _Else2 -> ct:fail({got,_Else2})
- after 1000 ->
- ?INTERFACE:close(P1),
- ?INTERFACE:close(P2)
- end.
-
-%%%
-%%% This testcase basically:
-%%% spawn 10 processes that in parallel
-%%% adds some hunts for different OSE processes
-%%% maybe create hunted OSE process
-%%% dehunt half of the hunts
-%%% create more hunts
-%%% if not created create hunted OSE process
-%%% veryify that all expected hunt messages are received
-%%% verify that all processes exited correctly
-%%%
-%%% This complex test is done to make sure that the internal handling
-%%% of dehunt works as expected.
-%%%
-multi_dehunt(_Config) ->
- [P1] = multi_open(1,[]),
-
- Scenario =
- fun(Iterations) ->
-
- Hunted = "p"++integer_to_list(Iterations),
- %% Start a couple of hunts
- Refs = [?INTERFACE:hunt(P1,Hunted) || _ <- lists:seq(1,Iterations)],
-
- %% We alternate if the process is opened before or after the dehunt
- P2O = if Iterations rem 2 == 0 ->
- ?INTERFACE:open(Hunted);
- true ->
- undefined
- end,
-
- %% Remove half of them
- {RemRefs,_} = lists:mapfoldl(fun(Ref,Acc) when Acc rem 2 == 0 ->
- ok = ?INTERFACE:dehunt(P1,Ref),
- {[],Acc+1};
- (Ref,Acc) ->
- {Ref,Acc+1}
- end,0,Refs),
-
- %% Add some new ones
- NewRefs = [?INTERFACE:hunt(P1,Hunted)
- || _ <- lists:seq(1,Iterations div 4)]
- ++ lists:flatten(RemRefs),
-
- P2 = if P2O == undefined ->
- ?INTERFACE:open(Hunted);
- true ->
- P2O
- end,
- P2Id = ?INTERFACE:get_id(P2),
-
- %% Receive all the expected ones
- lists:foreach(fun(Ref) ->
- receive
- {mailbox_up,P1,Ref,P2Id} ->
- ok
- after 1000 ->
- io:format("Flush: ~p~n",[flush()]),
- io:format("~p~n",[{Iterations,{did_not_get, Ref}}]),
- ok = Ref
- end
- end,NewRefs),
-
- %% Check that no other have arrived
- receive
- _Else ->
- io:format("Flush: ~p~n",[flush()]),
- io:format("~p~n",[{Iterations,{got, _Else}}]),
- ok = _Else
- after 100 ->
- ok
- end,
- ?INTERFACE:close(P2)
- end,
-
- Self = self(),
-
- n(fun(N) ->
- spawn(fun() -> Self !
- Scenario(N*25)
- end),
- ok
- end,10),
-
- n(fun(_N) ->
- receive ok -> ok
- after 60000 -> ct:fail(failed)
- end
- end,10),
- ?INTERFACE:close(P1).
-
-attach(_Config) ->
- [P1,P2] = multi_open(2,[]),
-
- P2Id = ?INTERFACE:get_id(P2),
- Ref = ?INTERFACE:attach(P1,P2Id),
- ?INTERFACE:close(P2),
- receive
- {mailbox_down,P1,Ref,P2Id} ->
- ?INTERFACE:close(P1);
- _Else ->
- ct:fail({got,_Else, {P1,Ref,P2Id}})
- after 1000 ->
- ct:fail({did_not_get,P1,Ref,P2Id})
- end.
-
-multi_attach(_Config) ->
-
- Iterations = 100,
-
- [P1|Pids] = multi_open(Iterations,[]),
-
- Refs = [{?INTERFACE:get_id(Pid),?INTERFACE:attach(P1,?INTERFACE:get_id(Pid))} || Pid <- Pids],
-
- [?INTERFACE:close(Pid) || Pid <- Pids],
-
- [receive
- {mailbox_down,P1,Ref,Pid} ->
- ok
- after 10000 ->
- ct:fail({did_not_get,Pid,Ref})
- end || {Pid,Ref} <- Refs],
- ?INTERFACE:close(P1).
-
-detach(_Config) ->
- [P1,P2] = multi_open(2,[]),
- P2Id = ?INTERFACE:get_id(P2),
- Ref = ?INTERFACE:attach(P1,P2Id),
- receive
- _Else -> ct:fail({got,_Else})
- after 100 ->
- ok
- end,
-
- ?INTERFACE:close(P2),
-
- % Make sure any messages are sent
- receive after 10 -> ok end,
-
- ?INTERFACE:detach(P1,Ref),
-
- % Make sure no messages are received
- receive
- _Else2 -> ct:fail({got,_Else2})
- after 1000 ->
- ?INTERFACE:close(P1)
- end.
-
-%%%
-%%% This testcase basically:
-%%% spawn 10 processes that in parallel
-%%% adds some attach for different OSE processes
-%%% maybe close OSE process
-%%% dehunt half of the hunts
-%%% create more hunts
-%%% if not closed close attached OSE process
-%%% veryify that all expected attach messages are received
-%%% verify that all processes exited correctly
-%%%
-%%% This complex test is done to make sure that the internal handling
-%%% of dehunt works as expected.
-%%%
-multi_detach(_Config) ->
- [P1] = multi_open(1,[]),
-
- Scenario =
- fun(Iterations) ->
-
- Attached = ?INTERFACE:open("p"++integer_to_list(Iterations)),
- AttachedId = ?INTERFACE:get_id(Attached),
- %% Start a couple of attachs
- Refs = [?INTERFACE:attach(P1,AttachedId) || _ <- lists:seq(1,Iterations)],
-
- %% We alternate if the process is closed before or after the detach
- P2O = if Iterations rem 2 == 0 ->
- ?INTERFACE:close(Attached);
- true ->
- undefined
- end,
-
- %% Remove half of them
- {RemRefs,_} = lists:mapfoldl(fun(Ref,Acc) when Acc rem 2 == 0 ->
- ok = ?INTERFACE:detach(P1,Ref),
- {[],Acc+1};
- (Ref,Acc) ->
- {Ref,Acc+1}
- end,0,Refs),
-
- %% Add some new ones
- NewRefs = [?INTERFACE:attach(P1,AttachedId)
- || _ <- lists:seq(1,Iterations div 4)]
- ++ lists:flatten(RemRefs),
-
- if P2O == undefined ->
- ?INTERFACE:close(Attached);
- true ->
- P2O
- end,
-
- %% Receive all the expected ones
- lists:foreach(fun(Ref) ->
- receive
- {mailbox_down,P1,Ref,AttachedId} ->
- ok
- after 1000 ->
- io:format("Flush: ~p~n",[flush()]),
- io:format("~p~n",[{Iterations,{did_not_get, Ref}}]),
- ok = Ref
- end
- end,NewRefs),
-
- %% Check that no other have arrived
- receive
- _Else ->
- io:format("Flush: ~p~n",[flush()]),
- io:format("~p~n",[{Iterations,{got, _Else}}]),
- ok = _Else
- after 100 ->
- ok
- end
- end,
-
- Self = self(),
-
- n(fun(N) ->
- spawn(fun() -> Self !
- Scenario(N*5)
- end),
- ok
- end,10),
-
- n(fun(_N) ->
- receive ok -> ok
- after 60000 -> ct:fail(failed)
- end
- end,10),
- ?INTERFACE:close(P1).
-
-
-open_errors(_Config) ->
- {'EXIT',{badarg,[{?INTERFACE,open,[inval],_}|_]}} =
- (catch ?INTERFACE:open(inval)),
- {'EXIT',{badarg,[{?INTERFACE,open,[["p"|1]],_}|_]}} =
- (catch ?INTERFACE:open(["p"|1])),
- {'EXIT',{badarg,[{?INTERFACE,open,[["p",1234]],_}|_]}} =
- (catch ?INTERFACE:open(["p",1234])),
-
- ok.
-
-close_errors(_Config) ->
- {'EXIT',{badarg,[{?INTERFACE,close,[inval],_}|_]}} =
- (catch ?INTERFACE:close(inval)),
-
- P1 = ?INTERFACE:open("p1"),
- ok = ?INTERFACE:close(P1),
- ok = ?INTERFACE:close(P1).
-
-
-get_id_errors(_Config) ->
- {'EXIT',{badarg,[{?INTERFACE,get_id,[inval],_}|_]}} =
- (catch ?INTERFACE:get_id(inval)),
-
- P1 = ?INTERFACE:open("p1"),
- ok = ?INTERFACE:close(P1),
- {'EXIT',{badarg,[{?INTERFACE,get_id,[P1],_}|_]}} =
- (catch ?INTERFACE:get_id(P1)),
-
- ok.
-
-get_name_errors(_Config) ->
- P1 = ?INTERFACE:open("p1"),
- {'EXIT',{badarg,[{?INTERFACE,get_name,[P1,inval],_}|_]}} =
- (catch ?INTERFACE:get_name(P1,inval)),
-
- undefined = ?INTERFACE:get_name(P1,1234),
-
- P2 = ?INTERFACE:open("p2"),
- P2Id = ?INTERFACE:get_id(P2),
- ok = ?INTERFACE:close(P1),
- {'EXIT',{badarg,[{?INTERFACE,get_name,[P1,P2Id],_}|_]}} =
- (catch ?INTERFACE:get_name(P1,P2Id)),
- ?INTERFACE:close(P2),
-
- P3 = ?INTERFACE:open([255]),
- <<255>> = ?INTERFACE:get_name(P3, ?INTERFACE:get_id(P3)),
- ?INTERFACE:close(P3),
-
- ok.
-
-hunt_errors(_Config) ->
-
- {'EXIT',{badarg,[{?INTERFACE,hunt,[inval,"hello"],_}|_]}} =
- (catch ?INTERFACE:hunt(inval,"hello")),
-
- P1 = ?INTERFACE:open("p1"),
- {'EXIT',{badarg,[{?INTERFACE,hunt,[P1,["hello",12345]],_}|_]}} =
- (catch ?INTERFACE:hunt(P1,["hello",12345])),
-
- P2 = ?INTERFACE:open(<<255>>),
- P2Pid = ?INTERFACE:get_id(P2),
- Ref = ?INTERFACE:hunt(P1,[255]),
- receive
- {mailbox_up,P1,Ref,P2Pid} ->
- ok;
- Else ->
- ct:fail({got,Else,{mailbox_up,P1,Ref,P2Pid}})
- after 150 ->
- ct:fail({did_not_get,{mailbox_up,P1,Ref,P2Pid}})
- end,
-
- ok = ?INTERFACE:close(P1),
- ok = ?INTERFACE:close(P2),
- {'EXIT',{badarg,[{?INTERFACE,hunt,[P1,["hello"]],_}|_]}} =
- (catch ?INTERFACE:hunt(P1,["hello"])),
-
- ok.
-
-dehunt_errors(_Config) ->
- P1 = ?INTERFACE:open("p1"),
- Ref = ?INTERFACE:hunt(P1,"p2"),
-
- {'EXIT',{badarg,[{?INTERFACE,dehunt,[inval,Ref],_}|_]}} =
- (catch ?INTERFACE:dehunt(inval,Ref)),
-
- {'EXIT',{badarg,[{?INTERFACE,dehunt,[P1,inval],_}|_]}} =
- (catch ?INTERFACE:dehunt(P1,inval)),
-
- ok = ?INTERFACE:dehunt(P1,Ref),
- ok = ?INTERFACE:dehunt(P1,Ref),
-
- ok = ?INTERFACE:close(P1),
-
- {'EXIT',{badarg,[{?INTERFACE,dehunt,[P1,Ref],_}|_]}} =
- (catch ?INTERFACE:dehunt(P1,Ref)),
-
- case ?INTERFACE of
- ose -> ok;
- _ ->
- P2 = ?INTERFACE:open("p2"),
- ok = ?INTERFACE:close(P2)
- end,
-
- receive
- Else -> ct:fail({got,Else})
- after 100 ->
- ok
- end.
-
-attach_errors(_Config) ->
- P1 = ?INTERFACE:open("p1"),
- P2 = ?INTERFACE:open("p2"),
- P2Id = ?INTERFACE:get_id(P2),
-
- {'EXIT',{badarg,[{?INTERFACE,attach,[inval,P2Id],_}|_]}} =
- (catch ?INTERFACE:attach(inval,P2Id)),
-
- {'EXIT',{badarg,[{?INTERFACE,attach,[P1,[12345]],_}|_]}} =
- (catch ?INTERFACE:attach(P1,[12345])),
-
- ok = ?INTERFACE:close(P1),
- ok = ?INTERFACE:close(P2),
- {'EXIT',{badarg,[{?INTERFACE,attach,[P1,P2Id],_}|_]}} =
- (catch ?INTERFACE:attach(P1,P2Id)),
-
- ok.
-
-detach_errors(_Config) ->
- P1 = ?INTERFACE:open("p1"),
- P2 = ?INTERFACE:open("p2"),
- P2Id = ?INTERFACE:get_id(P2),
-
- Ref = ?INTERFACE:attach(P1,P2Id),
-
- {'EXIT',{badarg,[{?INTERFACE,detach,[inval,Ref],_}|_]}} =
- (catch ?INTERFACE:detach(inval,Ref)),
-
- {'EXIT',{badarg,[{?INTERFACE,detach,[P1,inval],_}|_]}} =
- (catch ?INTERFACE:detach(P1,inval)),
-
- ok = ?INTERFACE:detach(P1,Ref),
- ok = ?INTERFACE:detach(P1,Ref),
-
- case ?INTERFACE of
- ose -> ok;
- _ ->
- ok = ?INTERFACE:close(P1)
- end,
-
- ok = ?INTERFACE:close(P2),
- ok = ?INTERFACE:close(P1),
-
- {'EXIT',{badarg,[{?INTERFACE,detach,[P1,Ref],_}|_]}} =
- (catch ?INTERFACE:detach(P1,Ref)),
-
- receive
- Else -> ct:fail({got,Else})
- after 100 ->
- ok
- end.
-
-send_errors(_Config) ->
- P1 = ?INTERFACE:open("p1"),
- P2 = ?INTERFACE:open("p2"),
- P2Id = ?INTERFACE:get_id(P2),
-
- {'EXIT',{badarg,[{?INTERFACE,send,[inval,P2Id,42,"hello"],_}|_]}} =
- (catch ?INTERFACE:send(inval,P2Id,42,"hello")),
- {'EXIT',{badarg,[{?INTERFACE,send,[P1,inval,42,"hello"],_}|_]}} =
- (catch ?INTERFACE:send(P1,inval,42,"hello")),
- {'EXIT',{badarg,[{?INTERFACE,send,[P1,P2Id,inval,"hello"],_}|_]}} =
- (catch ?INTERFACE:send(P1,P2Id,inval,"hello")),
- {'EXIT',{badarg,[{?INTERFACE,send,[P1,P2Id,42,inval],_}|_]}} =
- (catch ?INTERFACE:send(P1,P2Id,42,inval)),
-
- ok = ?INTERFACE:close(P2),
- ok = ?INTERFACE:send(P1,P2Id,42,"hello"),
- ok = ?INTERFACE:close(P1),
-
- {'EXIT',{badarg,[{?INTERFACE,send,[P1,P2Id,42,"hello"],_}|_]}} =
- (catch ?INTERFACE:send(P1,P2Id,42,"hello")),
-
- receive
- Else -> ct:fail({got,Else})
- after 100 ->
- ok
- end.
-
-send_w_s_errors(_Config) ->
- P1 = ?INTERFACE:open("p1"),
- P1Id = ?INTERFACE:get_id(P1),
- P2 = ?INTERFACE:open("p2"),
- P2Id = ?INTERFACE:get_id(P2),
- P3 = ?INTERFACE:open("p3"),
- P3Id = ?INTERFACE:get_id(P3),
-
- {'EXIT',{badarg,[{?INTERFACE,send,[inval,P2Id,P1Id,42,"hello"],_}|_]}} =
- (catch ?INTERFACE:send(inval,P2Id,P1Id,42,"hello")),
- {'EXIT',{badarg,[{?INTERFACE,send,[P2,-1,P1Id,42,"hello"],_}|_]}} =
- (catch ?INTERFACE:send(P2,-1,P1Id,42,"hello")),
- {'EXIT',{badarg,[{?INTERFACE,send,[P2,P2Id,1 bsl 32,42,"hello"],_}|_]}} =
- (catch ?INTERFACE:send(P2,P2Id,1 bsl 32,42,"hello")),
- {'EXIT',{badarg,[{?INTERFACE,send,[P2,P2Id,P1Id,inval,"hello"],_}|_]}} =
- (catch ?INTERFACE:send(P2,P2Id,P1Id,inval,"hello")),
- {'EXIT',{badarg,[{?INTERFACE,send,[P2,P2Id,P1Id,42,inval],_}|_]}} =
- (catch ?INTERFACE:send(P2,P2Id,P1Id,42,inval)),
-
- ok = ?INTERFACE:close(P3),
- ok = ?INTERFACE:send(P2,P3Id,P1Id,42,"hello"),
-
- ok = ?INTERFACE:close(P1),
- ok = ?INTERFACE:send(P2,P2Id,P1Id,42,"hello"),
- ok = ?INTERFACE:close(P2),
-
- {'EXIT',{badarg,[{?INTERFACE,send,[P1,P2Id,P1Id,42,"hello"],_}|_]}} =
- (catch ?INTERFACE:send(P1,P2Id,P1Id,42,"hello")),
-
- receive
- Else -> ct:fail({got,Else})
- after 100 ->
- ok
- end.
-
-listen_errors(_Config) ->
-
- P1 = ?INTERFACE:open("p1"),
- P1Id = ?INTERFACE:get_id(P1),
-
- {'EXIT',{badarg,[{?INTERFACE,listen,[inval,[42]],_}|_]}} =
- (catch ?INTERFACE:listen(inval,[42])),
- {'EXIT',{badarg,[{?INTERFACE,listen,[P1,inval],_}|_]}} =
- (catch ?INTERFACE:listen(P1,inval)),
- {'EXIT',{badarg,[{?INTERFACE,listen,[P1,[1 bsl 33]],_}|_]}} =
- (catch ?INTERFACE:listen(P1,[1 bsl 33])),
-
- ok = ?INTERFACE:listen(P1,[42,42,42,42,42,42,42,42,42,42,42,42,42]),
-
- case ?INTERFACE of
- ose -> ok;
- _ ->
- ?INTERFACE:send(P1,P1Id,42,"hello"),
- timer:sleep(50),
- ?INTERFACE:listen(P1,[]),
- ?INTERFACE:send(P1,P1Id,42,"hello2"),
-
- receive
- {message,P1,42,"hello"} -> ok
- end,
-
- receive
- Else -> ct:fail({got,Else})
- after 100 ->
- ok
- end
- end,
-
- ok = ?INTERFACE:close(P1),
- {'EXIT',{badarg,[{?INTERFACE,listen,[P1,[42]],_}|_]}} =
- (catch ?INTERFACE:listen(P1,[42])),
-
- ok.
-
-%%
-%% Internal functions
-%%
-multi_open(N,ListenNums) ->
- multi_open(N,ListenNums,[]).
-
-multi_open(0,_,Acc) ->
- Acc;
-multi_open(N,ListenNums,Acc) ->
- P = ?INTERFACE:open("p"++integer_to_list(N)),
- ok = ?INTERFACE:listen(P,ListenNums),
- multi_open(N-1,ListenNums,[P|Acc]).
-
-n(_F,0) ->
- ok;
-n(F,N) ->
- ok = F(N),
- n(F,N-1).
-
-
-flush() ->
- receive
- Msg ->
- [Msg|flush()]
- after 0 ->
- []
- end.
diff --git a/lib/ose/vsn.mk b/lib/ose/vsn.mk
deleted file mode 100644
index fb1cf8219f..0000000000
--- a/lib/ose/vsn.mk
+++ /dev/null
@@ -1 +0,0 @@
-OSE_VSN = 1.1
diff --git a/lib/parsetools/doc/src/leex.xml b/lib/parsetools/doc/src/leex.xml
index 7ee0633dac..85680f58a6 100644
--- a/lib/parsetools/doc/src/leex.xml
+++ b/lib/parsetools/doc/src/leex.xml
@@ -47,7 +47,7 @@ Token = tuple()</code>
<v>LeexRet = {ok, Scannerfile}
| {ok, Scannerfile, Warnings}
| error
- | {error, Warnings, Errors}</v>
+ | {error, Errors, Warnings}</v>
<v>Scannerfile = filename()</v>
<v>Warnings = Errors = [{filename(), [ErrorInfo]}]</v>
<v>ErrorInfo = {ErrorLine, module(), Reason}</v>
diff --git a/lib/parsetools/doc/src/yecc.xml b/lib/parsetools/doc/src/yecc.xml
index 8c356099e7..87fdfcdaef 100644
--- a/lib/parsetools/doc/src/yecc.xml
+++ b/lib/parsetools/doc/src/yecc.xml
@@ -52,7 +52,7 @@
<v>Grammarfile = filename()</v>
<v>Options = Option | [Option]</v>
<v>Option =&nbsp;-&nbsp;see below&nbsp;-</v>
- <v>YeccRet = {ok, Parserfile} | {ok, Parserfile, Warnings} | error | {error, Warnings, Errors}</v>
+ <v>YeccRet = {ok, Parserfile} | {ok, Parserfile, Warnings} | error | {error, Errors, Warnings}</v>
<v>Parserfile = filename()</v>
<v>Warnings = Errors = [{filename(), [ErrorInfo]}]</v>
<v>ErrorInfo = {ErrorLine, module(), Reason}</v>
diff --git a/lib/public_key/doc/src/notes.xml b/lib/public_key/doc/src/notes.xml
index 87db5bd9f4..8034d7fade 100644
--- a/lib/public_key/doc/src/notes.xml
+++ b/lib/public_key/doc/src/notes.xml
@@ -35,6 +35,21 @@
<file>notes.xml</file>
</header>
+<section><title>Public_Key 1.0.1</title>
+
+ <section><title>Improvements and New Features</title>
+ <list>
+ <item>
+ <p>
+ Document enhancements</p>
+ <p>
+ Own Id: OTP-12986</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
<section><title>Public_Key 1.0</title>
<section><title>Improvements and New Features</title>
diff --git a/lib/public_key/doc/src/public_key.xml b/lib/public_key/doc/src/public_key.xml
index 209de2bdf7..b247618efc 100644
--- a/lib/public_key/doc/src/public_key.xml
+++ b/lib/public_key/doc/src/public_key.xml
@@ -498,13 +498,13 @@
<name>pkix_path_validation(TrustedCert, CertChain, Options) -> {ok, {PublicKeyInfo, PolicyTree}} | {error, {bad_cert, Reason}} </name>
<fsummary>Performs a basic path validation according to RFC 5280.</fsummary>
<type>
- <v>TrustedCert = #'OTPCertificate'{} | der_encode() | atom()</v>
+ <v>TrustedCert = #'OTPCertificate'{} | der_encoded() | atom()</v>
<d>Normally a trusted certificate, but it can also be a path-validation
error that can be discovered while
constructing the input to this function and that is to be run through the <c>verify_fun</c>.
Examples are <c>unknown_ca</c> and <c>selfsigned_peer.</c>
</d>
- <v>CertChain = [der_encode()]</v>
+ <v>CertChain = [der_encoded()]</v>
<d>A list of DER-encoded certificates in trust order ending with the peer certificate.</d>
<v>Options = proplists:proplist()</v>
<v>PublicKeyInfo = {?'rsaEncryption' | ?'id-dsa',
diff --git a/lib/public_key/src/pubkey_ssh.erl b/lib/public_key/src/pubkey_ssh.erl
index 7680d0ce59..82042550a0 100644
--- a/lib/public_key/src/pubkey_ssh.erl
+++ b/lib/public_key/src/pubkey_ssh.erl
@@ -21,9 +21,12 @@
-include("public_key.hrl").
--export([decode/2, encode/2]).
+-export([decode/2, encode/2
+ ]).
-define(UINT32(X), X:32/unsigned-big-integer).
+-define(STRING(X), ?UINT32((size(X))), (X)/binary).
+
%% Max encoded line length is 72, but conformance examples use 68
%% Comment from rfc 4716: "The following are some examples of public
%% key files that are compliant (note that the examples all wrap
@@ -31,13 +34,16 @@
%% are still compliant.)" So we choose to use 68 also.
-define(ENCODED_LINE_LENGTH, 68).
+
%%====================================================================
%% Internal application API
%%====================================================================
%%--------------------------------------------------------------------
-spec decode(binary(), public_key | public_key:ssh_file()) ->
- [{public_key:public_key(), Attributes::list()}].
+ [{public_key:public_key(), Attributes::list()}]
+ ; (binary(), ssh2_pubkey) -> public_key:public_key()
+ .
%%
%% Description: Decodes a ssh file-binary.
%%--------------------------------------------------------------------
@@ -50,15 +56,21 @@ decode(Bin, public_key)->
end;
decode(Bin, rfc4716_public_key) ->
rfc4716_decode(Bin);
+decode(Bin, ssh2_pubkey) ->
+ ssh2_pubkey_decode(Bin);
decode(Bin, Type) ->
openssh_decode(Bin, Type).
%%--------------------------------------------------------------------
-spec encode([{public_key:public_key(), Attributes::list()}], public_key:ssh_file()) ->
- binary().
+ binary()
+ ; (public_key:public_key(), ssh2_pubkey) -> binary()
+ .
%%
%% Description: Encodes a list of ssh file entries.
%%--------------------------------------------------------------------
+encode(Bin, ssh2_pubkey) ->
+ ssh2_pubkey_encode(Bin);
encode(Entries, Type) ->
iolist_to_binary(lists:map(fun({Key, Attributes}) ->
do_encode(Type, Key, Attributes)
@@ -130,7 +142,12 @@ rfc4716_pubkey_decode(<<?UINT32(Len), Type:Len/binary,
{erlint(SizeY, Y),
#'Dss-Parms'{p = erlint(SizeP, P),
q = erlint(SizeQ, Q),
- g = erlint(SizeG, G)}}.
+ g = erlint(SizeG, G)}};
+rfc4716_pubkey_decode(<<?UINT32(Len), ECDSA_SHA2_etc:Len/binary,
+ ?UINT32(SizeId), Id:SizeId/binary,
+ ?UINT32(SizeQ), Q:SizeQ/binary>>) ->
+ <<"ecdsa-sha2-", Id/binary>> = ECDSA_SHA2_etc,
+ {#'ECPoint'{point = Q}, {namedCurve,public_key:ssh_curvename2oid(Id)}}.
openssh_decode(Bin, FileType) ->
Lines = binary:split(Bin, <<"\n">>, [global]),
@@ -184,46 +201,42 @@ do_openssh_decode(known_hosts = FileType, [Line | Lines], Acc) ->
end;
do_openssh_decode(openssh_public_key = FileType, [Line | Lines], Acc) ->
- case split_n(2, Line, []) of
- [KeyType, Base64Enc] when KeyType == <<"ssh-rsa">>;
- KeyType == <<"ssh-dss">> ->
+ [KeyType, Base64Enc | Comment0] = split_n(2, Line, []),
+ KnownKeyType =
+ case KeyType of
+ <<"ssh-rsa">> -> true;
+ <<"ssh-dss">> -> true;
+ <<"ecdsa-sha2-",Curve/binary>> -> is_ssh_curvename(Curve);
+ _ -> false
+ end,
+
+ case Comment0 of
+ [] when KnownKeyType==true ->
do_openssh_decode(FileType, Lines,
[{openssh_pubkey_decode(KeyType, Base64Enc),
[]} | Acc]);
- [KeyType, Base64Enc | Comment0] when KeyType == <<"ssh-rsa">>;
- KeyType == <<"ssh-dss">> ->
+ _ when KnownKeyType==true ->
Comment = string:strip(string_decode(iolist_to_binary(Comment0)), right, $\n),
do_openssh_decode(FileType, Lines,
[{openssh_pubkey_decode(KeyType, Base64Enc),
[{comment, Comment}]} | Acc])
end.
+
decode_comment([]) ->
[];
decode_comment(Comment) ->
[{comment, string_decode(iolist_to_binary(Comment))}].
-openssh_pubkey_decode(<<"ssh-rsa">>, Base64Enc) ->
- <<?UINT32(StrLen), _:StrLen/binary,
- ?UINT32(SizeE), E:SizeE/binary,
- ?UINT32(SizeN), N:SizeN/binary>>
- = base64:mime_decode(Base64Enc),
- #'RSAPublicKey'{modulus = erlint(SizeN, N),
- publicExponent = erlint(SizeE, E)};
-openssh_pubkey_decode(<<"ssh-dss">>, Base64Enc) ->
- <<?UINT32(StrLen), _:StrLen/binary,
- ?UINT32(SizeP), P:SizeP/binary,
- ?UINT32(SizeQ), Q:SizeQ/binary,
- ?UINT32(SizeG), G:SizeG/binary,
- ?UINT32(SizeY), Y:SizeY/binary>>
- = base64:mime_decode(Base64Enc),
- {erlint(SizeY, Y),
- #'Dss-Parms'{p = erlint(SizeP, P),
- q = erlint(SizeQ, Q),
- g = erlint(SizeG, G)}};
-openssh_pubkey_decode(KeyType, Base64Enc) ->
- {KeyType, base64:mime_decode(Base64Enc)}.
+openssh_pubkey_decode(Type, Base64Enc) ->
+ try
+ ssh2_pubkey_decode(Type, base64:mime_decode(Base64Enc))
+ catch
+ _:_ ->
+ {Type, base64:mime_decode(Base64Enc)}
+ end.
+
erlint(MPIntSize, MPIntValue) ->
Bits= MPIntSize * 8,
@@ -347,10 +360,9 @@ line_end("") ->
line_end(Comment) ->
[" ", Comment, "\n"].
-key_type(#'RSAPublicKey'{}) ->
- <<"ssh-rsa">>;
-key_type({_, #'Dss-Parms'{}}) ->
- <<"ssh-dss">>.
+key_type(#'RSAPublicKey'{}) -> <<"ssh-rsa">>;
+key_type({_, #'Dss-Parms'{}}) -> <<"ssh-dss">>;
+key_type({#'ECPoint'{}, {namedCurve,Curve}}) -> <<"ecdsa-sha2-", (public_key:oid2ssh_curvename(Curve))/binary>>.
comma_list_encode([Option], []) ->
Option;
@@ -380,20 +392,49 @@ ssh2_pubkey_encode({Y, #'Dss-Parms'{p = P, q = Q, g = G}}) ->
PBin/binary,
QBin/binary,
GBin/binary,
- YBin/binary>>.
-
-is_key_field(<<"ssh-dss">>) ->
- true;
-is_key_field(<<"ssh-rsa">>) ->
- true;
-is_key_field(<<"ecdsa-sha2-nistp256">>) ->
- true;
-is_key_field(<<"ecdsa-sha2-nistp384">>) ->
- true;
-is_key_field(<<"ecdsa-sha2-nistp521">>) ->
- true;
-is_key_field(_) ->
- false.
+ YBin/binary>>;
+ssh2_pubkey_encode(Key={#'ECPoint'{point = Q}, {namedCurve,OID}}) ->
+ TypeStr = key_type(Key),
+ StrLen = size(TypeStr),
+ IdB = public_key:oid2ssh_curvename(OID),
+ <<?UINT32(StrLen), TypeStr:StrLen/binary,
+ (string(IdB))/binary,
+ (string(Q))/binary>>.
+
+
+ssh2_pubkey_decode(Bin = <<?UINT32(Len), Type:Len/binary, _/binary>>) ->
+ ssh2_pubkey_decode(Type, Bin).
+
+ssh2_pubkey_decode(<<"ssh-rsa">>,
+ <<?UINT32(Len), _:Len/binary,
+ ?UINT32(SizeE), E:SizeE/binary,
+ ?UINT32(SizeN), N:SizeN/binary>>) ->
+ #'RSAPublicKey'{modulus = erlint(SizeN, N),
+ publicExponent = erlint(SizeE, E)};
+
+ssh2_pubkey_decode(<<"ssh-dss">>,
+ <<?UINT32(Len), _:Len/binary,
+ ?UINT32(SizeP), P:SizeP/binary,
+ ?UINT32(SizeQ), Q:SizeQ/binary,
+ ?UINT32(SizeG), G:SizeG/binary,
+ ?UINT32(SizeY), Y:SizeY/binary>>) ->
+ {erlint(SizeY, Y),
+ #'Dss-Parms'{p = erlint(SizeP, P),
+ q = erlint(SizeQ, Q),
+ g = erlint(SizeG, G)}};
+ssh2_pubkey_decode(<<"ecdsa-sha2-",Id/binary>>,
+ <<?UINT32(Len), ECDSA_SHA2_etc:Len/binary,
+ ?UINT32(SizeId), Id:SizeId/binary,
+ ?UINT32(SizeQ), Q:SizeQ/binary>>) ->
+ <<"ecdsa-sha2-", Id/binary>> = ECDSA_SHA2_etc,
+ {#'ECPoint'{point = Q}, {namedCurve,public_key:ssh_curvename2oid(Id)}}.
+
+
+
+is_key_field(<<"ssh-dss">>) -> true;
+is_key_field(<<"ssh-rsa">>) -> true;
+is_key_field(<<"ecdsa-sha2-",Id/binary>>) -> is_ssh_curvename(Id);
+is_key_field(_) -> false.
is_bits_field(Part) ->
try list_to_integer(binary_to_list(Part)) of
@@ -507,3 +548,14 @@ int_to_bin_neg(-1, Ds=[MSB|_]) when MSB >= 16#80 ->
list_to_binary(Ds);
int_to_bin_neg(X,Ds) ->
int_to_bin_neg(X bsr 8, [(X band 255)|Ds]).
+
+
+string(X) when is_binary(X) ->
+ << ?STRING(X) >>;
+string(X) ->
+ << ?STRING(list_to_binary(X)) >>.
+
+is_ssh_curvename(Id) -> try public_key:ssh_curvename2oid(Id) of _ -> true
+ catch _:_ -> false
+ end.
+
diff --git a/lib/public_key/src/public_key.erl b/lib/public_key/src/public_key.erl
index 2f4cc64c2a..8288f68f7f 100644
--- a/lib/public_key/src/public_key.erl
+++ b/lib/public_key/src/public_key.erl
@@ -47,6 +47,7 @@
pkix_normalize_name/1,
pkix_path_validation/3,
ssh_decode/2, ssh_encode/2,
+ ssh_curvename2oid/1, oid2ssh_curvename/1,
pkix_crls_validate/3,
pkix_dist_point/1,
pkix_dist_points/1,
@@ -711,7 +712,9 @@ pkix_crls_validate(OtpCert, DPAndCRLs0, Options) ->
%%--------------------------------------------------------------------
--spec ssh_decode(binary(), public_key | ssh_file()) -> [{public_key(), Attributes::list()}].
+-spec ssh_decode(binary(), public_key | ssh_file()) -> [{public_key(), Attributes::list()}]
+ ; (binary(), ssh2_pubkey) -> public_key()
+ .
%%
%% Description: Decodes a ssh file-binary. In the case of know_hosts
%% or auth_keys the binary may include one or more lines of the
@@ -724,12 +727,15 @@ ssh_decode(SshBin, Type) when is_binary(SshBin),
Type == rfc4716_public_key;
Type == openssh_public_key;
Type == auth_keys;
- Type == known_hosts ->
+ Type == known_hosts;
+ Type == ssh2_pubkey ->
pubkey_ssh:decode(SshBin, Type).
%%--------------------------------------------------------------------
--spec ssh_encode([{public_key(), Attributes::list()}], ssh_file()) ->
- binary().
+-spec ssh_encode([{public_key(), Attributes::list()}], ssh_file()) -> binary()
+ ; (public_key(), ssh2_pubkey) -> binary()
+ .
+%%
%% Description: Encodes a list of ssh file entries (public keys and
%% attributes) to a binary. Possible attributes depends on the file
%% type.
@@ -738,10 +744,30 @@ ssh_encode(Entries, Type) when is_list(Entries),
Type == rfc4716_public_key;
Type == openssh_public_key;
Type == auth_keys;
- Type == known_hosts ->
+ Type == known_hosts;
+ Type == ssh2_pubkey ->
pubkey_ssh:encode(Entries, Type).
%%--------------------------------------------------------------------
+-spec ssh_curvename2oid(binary()) -> oid().
+
+%% Description: Converts from the ssh name of elliptic curves to
+%% the OIDs.
+%%--------------------------------------------------------------------
+ssh_curvename2oid(<<"nistp256">>) -> ?'secp256r1';
+ssh_curvename2oid(<<"nistp384">>) -> ?'secp384r1';
+ssh_curvename2oid(<<"nistp521">>) -> ?'secp521r1'.
+
+%%--------------------------------------------------------------------
+-spec oid2ssh_curvename(oid()) -> binary().
+
+%% Description: Converts from elliptic curve OIDs to the ssh name.
+%%--------------------------------------------------------------------
+oid2ssh_curvename(?'secp256r1') -> <<"nistp256">>;
+oid2ssh_curvename(?'secp384r1') -> <<"nistp384">>;
+oid2ssh_curvename(?'secp521r1') -> <<"nistp521">>.
+
+%%--------------------------------------------------------------------
%%% Internal functions
%%--------------------------------------------------------------------
do_verify(DigestOrPlainText, DigestType, Signature,
diff --git a/lib/public_key/test/public_key_SUITE.erl b/lib/public_key/test/public_key_SUITE.erl
index 6f142c951c..5e677f31d6 100644
--- a/lib/public_key/test/public_key_SUITE.erl
+++ b/lib/public_key/test/public_key_SUITE.erl
@@ -49,8 +49,10 @@ groups() ->
[{pem_decode_encode, [], [dsa_pem, rsa_pem, encrypted_pem,
dh_pem, cert_pem, pkcs7_pem, pkcs10_pem]},
{ssh_public_key_decode_encode, [],
- [ssh_rsa_public_key, ssh_dsa_public_key, ssh_rfc4716_rsa_comment,
- ssh_rfc4716_dsa_comment, ssh_rfc4716_rsa_subject, ssh_known_hosts,
+ [ssh_rsa_public_key, ssh_dsa_public_key, ssh_ecdsa_public_key,
+ ssh_rfc4716_rsa_comment, ssh_rfc4716_dsa_comment,
+ ssh_rfc4716_rsa_subject,
+ ssh_known_hosts,
ssh_auth_keys, ssh1_known_hosts, ssh1_auth_keys, ssh_openssh_public_key_with_comment,
ssh_openssh_public_key_long_header]},
{sign_verify, [], [rsa_sign_verify, dsa_sign_verify]}
@@ -291,6 +293,32 @@ ssh_dsa_public_key(Config) when is_list(Config) ->
public_key:ssh_decode(EncodedOpenSsh, public_key).
%%--------------------------------------------------------------------
+
+ssh_ecdsa_public_key() ->
+ [{doc, "ssh ecdsa public key decode/encode"}].
+ssh_ecdsa_public_key(Config) when is_list(Config) ->
+ Datadir = ?config(data_dir, Config),
+
+ {ok, ECDSARawSsh2} = file:read_file(filename:join(Datadir, "ssh2_ecdsa_pub")),
+ [{PubKey, Attributes1}] = public_key:ssh_decode(ECDSARawSsh2, public_key),
+ [{PubKey, Attributes1}] = public_key:ssh_decode(ECDSARawSsh2, rfc4716_public_key),
+
+ {ok, ECDSARawOpenSsh} = file:read_file(filename:join(Datadir, "openssh_ecdsa_pub")),
+ [{PubKey, Attributes2}] = public_key:ssh_decode(ECDSARawOpenSsh, public_key),
+ [{PubKey, Attributes2}] = public_key:ssh_decode(ECDSARawOpenSsh, openssh_public_key),
+
+ %% Can not check EncodedSSh == ECDSARawSsh2 and EncodedOpenSsh
+ %% = ECDSARawOpenSsh as line breakpoints may differ
+
+ EncodedSSh = public_key:ssh_encode([{PubKey, Attributes1}], rfc4716_public_key),
+ EncodedOpenSsh = public_key:ssh_encode([{PubKey, Attributes2}], openssh_public_key),
+
+ [{PubKey, Attributes1}] =
+ public_key:ssh_decode(EncodedSSh, public_key),
+ [{PubKey, Attributes2}] =
+ public_key:ssh_decode(EncodedOpenSsh, public_key).
+
+%%--------------------------------------------------------------------
ssh_rfc4716_rsa_comment() ->
[{doc, "Test comment header and rsa key"}].
ssh_rfc4716_rsa_comment(Config) when is_list(Config) ->
diff --git a/lib/public_key/test/public_key_SUITE_data/openssh_ecdsa_pub b/lib/public_key/test/public_key_SUITE_data/openssh_ecdsa_pub
new file mode 100644
index 0000000000..a49b4264b8
--- /dev/null
+++ b/lib/public_key/test/public_key_SUITE_data/openssh_ecdsa_pub
@@ -0,0 +1 @@
+ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBIJrVlKYIT+MlxxRx5BFXisHHkcGMAAKv2dguUeOsutsYyzs9JAczvl6c+Sypra5+qOi2LHPXw6GGluuXcOssOM= uabhnil@elxadlj3q32
diff --git a/lib/public_key/test/public_key_SUITE_data/ssh2_ecdsa_pub b/lib/public_key/test/public_key_SUITE_data/ssh2_ecdsa_pub
new file mode 100644
index 0000000000..702e5c4fde
--- /dev/null
+++ b/lib/public_key/test/public_key_SUITE_data/ssh2_ecdsa_pub
@@ -0,0 +1,6 @@
+---- BEGIN SSH2 PUBLIC KEY ----
+Comment: "256-bit ECDSA, converted by uabhnil@elxadlj3q32 from OpenSSH"
+AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBIJrVlKYIT+MlxxRx5
+BFXisHHkcGMAAKv2dguUeOsutsYyzs9JAczvl6c+Sypra5+qOi2LHPXw6GGluuXcOssOM=
+
+---- END SSH2 PUBLIC KEY ----
diff --git a/lib/public_key/vsn.mk b/lib/public_key/vsn.mk
index 7f752529f0..f762473a58 100644
--- a/lib/public_key/vsn.mk
+++ b/lib/public_key/vsn.mk
@@ -1 +1 @@
-PUBLIC_KEY_VSN = 1.0
+PUBLIC_KEY_VSN = 1.0.1
diff --git a/lib/reltool/src/reltool.hrl b/lib/reltool/src/reltool.hrl
index 4c3f76bdc6..9ac22b9450 100644
--- a/lib/reltool/src/reltool.hrl
+++ b/lib/reltool/src/reltool.hrl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2009-2012. All Rights Reserved.
+%% Copyright Ericsson AB 2009-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -141,15 +141,15 @@
app_name :: '_' | app_name(),
incl_cond :: '_' | incl_cond() | undefined,
debug_info :: '_' | debug_info() | undefined,
- is_app_mod :: '_' | boolean(),
- is_ebin_mod :: '_' | boolean(),
- uses_mods :: '$2' | [mod_name()],
- exists :: '_' | boolean(),
+ is_app_mod :: '_' | boolean() | undefined,
+ is_ebin_mod :: '_' | boolean() | undefined,
+ uses_mods :: '$2' | [mod_name()] | undefined,
+ exists :: '_' | boolean() | undefined,
%% Dynamic
- status :: '_' | status(),
- used_by_mods :: '_' | [mod_name()],
- is_pre_included :: '_' | boolean() | undefined,
- is_included :: '_' | boolean() | undefined
+ status = ok :: '_' | status(),
+ used_by_mods = [] :: '_' | [mod_name()],
+ is_pre_included :: '_' | boolean() | undefined,
+ is_included :: '_' | boolean() | undefined
}).
-record(app_info,
@@ -177,10 +177,10 @@
name :: '_' | app_name(),
is_escript :: '_' | boolean() | {inlined, escript_app_name()},
use_selected_vsn :: '_' | vsn | dir | undefined,
- active_dir :: '_' | dir(),
+ active_dir :: '_' | dir() | undefined,
sorted_dirs :: '_' | [dir()],
- vsn :: '_' | app_vsn(),
- label :: '_' | app_label(),
+ vsn :: '_' | app_vsn() | undefined,
+ label :: '_' | app_label() | undefined,
info :: '_' | #app_info{} | undefined,
mods :: '_' | [#mod{}],
@@ -192,21 +192,21 @@
debug_info :: '_' | debug_info() | undefined,
app_file :: '_' | app_file() | undefined,
app_type :: '_' | app_type() | undefined,
- incl_app_filters :: '_' | [#regexp{}],
- excl_app_filters :: '_' | [#regexp{}],
- incl_archive_filters :: '_' | [#regexp{}],
- excl_archive_filters :: '_' | [#regexp{}],
- archive_opts :: '_' | [archive_opt()],
+ incl_app_filters :: '_' | [#regexp{}] | undefined,
+ excl_app_filters :: '_' | [#regexp{}] | undefined,
+ incl_archive_filters :: '_' | [#regexp{}] | undefined,
+ excl_archive_filters :: '_' | [#regexp{}] | undefined,
+ archive_opts :: '_' | [archive_opt()] | undefined,
%% Dynamic
status :: '_' | status(),
- uses_mods :: '_' | [mod_name()],
- used_by_mods :: '_' | [mod_name()],
- uses_apps :: '_' | [app_name()],
- used_by_apps :: '_' | [app_name()],
+ uses_mods :: '_' | [mod_name()] | undefined,
+ used_by_mods :: '_' | [mod_name()] | undefined,
+ uses_apps :: '_' | [app_name()] | undefined,
+ used_by_apps :: '_' | [app_name()] | undefined,
is_pre_included :: '_' | '$2' | boolean() | undefined,
is_included :: '_' | '$1' | boolean() | undefined,
- rels :: '_' | [rel_name()]
+ rels :: '_' | [rel_name()] | undefined
}).
-record(rel_app,
@@ -237,7 +237,7 @@
rels :: [#rel{}],
emu_name :: emu_name(),
profile :: profile(),
- excl_lib :: excl_lib(),
+ excl_lib :: excl_lib() | undefined,
incl_sys_filters :: [#regexp{}],
excl_sys_filters :: [#regexp{}],
incl_app_filters :: [#regexp{}],
diff --git a/lib/runtime_tools/c_src/Makefile.in b/lib/runtime_tools/c_src/Makefile.in
index 448b8c62c2..aeacee0655 100644
--- a/lib/runtime_tools/c_src/Makefile.in
+++ b/lib/runtime_tools/c_src/Makefile.in
@@ -102,12 +102,7 @@ endif
_create_dirs := $(shell mkdir -p $(OBJDIR) $(LIBDIR))
-ifneq ($(findstring ose,$(TARGET)),ose)
debug opt valgrind: $(SOLIBS) $(OBJDIR) $(LIBDIR) $(NIF_LIB)
-else
-# We do not build this on OSE
-debug opt valgrind:
-endif
DYNTRACE_OBJS = $(before_DTrace_OBJS)
@@ -159,10 +154,8 @@ include $(ERL_TOP)/make/otp_release_targets.mk
release_spec: opt
$(INSTALL_DIR) "$(RELSYSDIR)/priv/obj"
$(INSTALL_DIR) "$(RELSYSDIR)/priv/lib"
-ifneq ($(findstring ose,$(TARGET)),ose)
$(INSTALL_PROGRAM) $(DYNTRACE_OBJS) "$(RELSYSDIR)/priv/obj"
$(INSTALL_PROGRAM) $(NIF_LIB) $(SOLIBS) "$(RELSYSDIR)/priv/lib"
-endif
release_docs_spec:
diff --git a/lib/runtime_tools/doc/src/dbg.xml b/lib/runtime_tools/doc/src/dbg.xml
index 1a11806211..2065627026 100644
--- a/lib/runtime_tools/doc/src/dbg.xml
+++ b/lib/runtime_tools/doc/src/dbg.xml
@@ -1030,9 +1030,9 @@ hello</pre>
<fsummary>Stop the <c>dbg</c>server and the tracing of all processes.</fsummary>
<desc>
<p>Stops the <c>dbg</c> server and clears all trace flags for
- all processes and all trace patterns for all functions. Also
+ all processes and all local trace patterns for all functions. Also
shuts down all trace clients and closes all trace ports.</p>
- <p>Note that no trace patterns are affected by this
+ <p>Note that no global trace patterns are affected by this
function.</p>
</desc>
</func>
@@ -1040,8 +1040,7 @@ hello</pre>
<name>stop_clear() -> ok</name>
<fsummary>Stop the <c>dbg</c>server and the tracing of all processes, and clears trace patterns.</fsummary>
<desc>
- <p>Same as stop/0, but also clears all trace patterns on local
- and global functions calls.</p>
+ <p>Same as stop/0, but also clears all trace patterns on global functions calls.</p>
</desc>
</func>
</funcs>
diff --git a/lib/sasl/doc/src/notes.xml b/lib/sasl/doc/src/notes.xml
index 36ea42762a..5945ef6490 100644
--- a/lib/sasl/doc/src/notes.xml
+++ b/lib/sasl/doc/src/notes.xml
@@ -31,6 +31,32 @@
</header>
<p>This document describes the changes made to the SASL application.</p>
+<section><title>SASL 2.6</title>
+
+ <section><title>Improvements and New Features</title>
+ <list>
+ <item>
+ <p>A mechanism for limiting the amount of text that the
+ built-in error logger events will produce has been
+ introduced. It is useful for limiting both the size of
+ log files and the CPU time used to produce them.</p>
+ <p>This mechanism is experimental in the sense that it
+ may be changed if it turns out that it does not solve the
+ problem it is supposed to solve. In that case, there may
+ be backward incompatible improvements to this
+ mechanism.</p>
+ <p>See the documentation for the config parameter
+ <c>error_logger_format_depth</c> in the Kernel
+ application for information about how to turn on this
+ feature.</p>
+ <p>
+ Own Id: OTP-12864</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
<section><title>SASL 2.5</title>
<section><title>Fixed Bugs and Malfunctions</title>
diff --git a/lib/sasl/src/sasl.app.src b/lib/sasl/src/sasl.app.src
index 7864e84773..705bb73fc5 100644
--- a/lib/sasl/src/sasl.app.src
+++ b/lib/sasl/src/sasl.app.src
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2010. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -46,6 +46,6 @@
{env, [{sasl_error_logger, tty},
{errlog_type, all}]},
{mod, {sasl, []}},
- {runtime_dependencies, ["tools-2.6.14","stdlib-2.0","kernel-3.0",
+ {runtime_dependencies, ["tools-2.6.14","stdlib-2.6","kernel-4.1",
"erts-6.0"]}]}.
diff --git a/lib/sasl/src/sasl.appup.src b/lib/sasl/src/sasl.appup.src
index eddb5a3fd0..2c8812f566 100644
--- a/lib/sasl/src/sasl.appup.src
+++ b/lib/sasl/src/sasl.appup.src
@@ -18,7 +18,9 @@
%% %CopyrightEnd%
{"%VSN%",
%% Up from - max one major revision back
- [{<<"2\\.4(\\.[0-9]+)*">>,[restart_new_emulator]}], % OTP-17
+ [{<<"2\\.5(\\.[0-9]+)*">>,[restart_new_emulator]}, % OTP-18.0.*
+ {<<"2\\.4(\\.[0-9]+)*">>,[restart_new_emulator]}], % OTP-17
%% Down to - max one major revision back
- [{<<"2\\.4(\\.[0-9]+)*">>,[restart_new_emulator]}] % OTP-17
+ [{<<"2\\.5(\\.[0-9]+)*">>,[restart_new_emulator]}, % OTP-18.0.*
+ {<<"2\\.4(\\.[0-9]+)*">>,[restart_new_emulator]}] % OTP-17
}.
diff --git a/lib/sasl/test/systools_SUITE.erl b/lib/sasl/test/systools_SUITE.erl
index cf0ed5fcfc..825a7f6e86 100644
--- a/lib/sasl/test/systools_SUITE.erl
+++ b/lib/sasl/test/systools_SUITE.erl
@@ -1640,25 +1640,21 @@ app_start_type_relup(Dir2,Name2,Config) ->
%% ?t:format("Dn: ~p",[DownInstructions]),
[{load_object_code, {mnesia, _, _}},
{load_object_code, {runtime_tools, _, _}},
- {load_object_code, {webtool, _, _}},
{load_object_code, {snmp, _, _}},
{load_object_code, {xmerl, _, _}},
point_of_no_return
| UpInstructionsT] = UpInstructions,
true = lists:member({apply,{application,start,[mnesia,permanent]}}, UpInstructionsT),
true = lists:member({apply,{application,start,[runtime_tools,transient]}}, UpInstructionsT),
- true = lists:member({apply,{application,start,[webtool,temporary]}}, UpInstructionsT),
true = lists:member({apply,{application,load,[snmp]}}, UpInstructionsT),
false = lists:any(fun({apply,{application,_,[xmerl|_]}}) -> true; (_) -> false end, UpInstructionsT),
[point_of_no_return | DownInstructionsT] = DownInstructions,
true = lists:member({apply,{application,stop,[mnesia]}}, DownInstructionsT),
true = lists:member({apply,{application,stop,[runtime_tools]}}, DownInstructionsT),
- true = lists:member({apply,{application,stop,[webtool]}}, DownInstructionsT),
true = lists:member({apply,{application,stop,[snmp]}}, DownInstructionsT),
true = lists:member({apply,{application,stop,[xmerl]}}, DownInstructionsT),
true = lists:member({apply,{application,unload,[mnesia]}}, DownInstructionsT),
true = lists:member({apply,{application,unload,[runtime_tools]}}, DownInstructionsT),
- true = lists:member({apply,{application,unload,[webtool]}}, DownInstructionsT),
true = lists:member({apply,{application,unload,[snmp]}}, DownInstructionsT),
true = lists:member({apply,{application,unload,[xmerl]}}, DownInstructionsT),
ok.
@@ -2207,7 +2203,6 @@ create_script(latest_app_start_type1,Config) ->
create_script(latest_app_start_type2,Config) ->
OtherApps = [{mnesia,current,permanent},
{runtime_tools,current,transient},
- {webtool,current,temporary},
{snmp,current,load},
{xmerl,current,none}],
Apps = core_apps(current) ++ OtherApps,
diff --git a/lib/sasl/vsn.mk b/lib/sasl/vsn.mk
index e07b36f4ba..959d9c88d5 100644
--- a/lib/sasl/vsn.mk
+++ b/lib/sasl/vsn.mk
@@ -1 +1 @@
-SASL_VSN = 2.5
+SASL_VSN = 2.6
diff --git a/lib/snmp/doc/src/snmp_advanced_agent.xml b/lib/snmp/doc/src/snmp_advanced_agent.xml
index 717f7426c6..b17246438d 100644
--- a/lib/snmp/doc/src/snmp_advanced_agent.xml
+++ b/lib/snmp/doc/src/snmp_advanced_agent.xml
@@ -340,7 +340,7 @@
SEQUENCE {
empDepNo INTEGER,
empName DisplayString,
- empTelNo DisplayString
+ empTelNo DisplayString,
empStatus RowStatus
}
</code>
diff --git a/lib/ssh/doc/src/notes.xml b/lib/ssh/doc/src/notes.xml
index 9d498c0fdc..bb111c8e0e 100644
--- a/lib/ssh/doc/src/notes.xml
+++ b/lib/ssh/doc/src/notes.xml
@@ -30,6 +30,140 @@
<file>notes.xml</file>
</header>
+<section><title>Ssh 4.1.2</title>
+
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p>
+ Add a 1024 group to the list of key group-exchange groups</p>
+ <p>
+ Own Id: OTP-13046</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
+<section><title>Ssh 4.1.1</title>
+
+ <section><title>Improvements and New Features</title>
+ <list>
+ <item>
+ <p>
+ A new option <c>max_channels</c> limits the number of
+ channels with active server-side subsystems that are
+ accepted.</p>
+ <p>
+ Own Id: OTP-13036</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
+<section><title>Ssh 4.1</title>
+
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p>
+ Send an understandable disconnect message when the key
+ exchange phase can't find a common algorithm. There are
+ also some test cases added.</p>
+ <p>
+ Own Id: OTP-11531</p>
+ </item>
+ <item>
+ <p>
+ The third parameter in <c>ssh_sftp:write_file</c> is now
+ accepting iolists again. Unicode handling adjusted.</p>
+ <p>
+ Own Id: OTP-12853 Aux Id: seq12891 </p>
+ </item>
+ </list>
+ </section>
+
+
+ <section><title>Improvements and New Features</title>
+ <list>
+ <item>
+ <p>
+ First part of ssh test suite re-organization and
+ extension.</p>
+ <p>
+ Own Id: OTP-12230</p>
+ </item>
+ <item>
+ <p>
+ The key exchange algorithms 'ecdh-sha2-nistp256',
+ 'ecdh-sha2-nistp384' and 'ecdh-sha2-nistp521' are
+ implemented. See RFC 5656.</p>
+ <p>
+ This raises the security level considerably.</p>
+ <p>
+ Own Id: OTP-12622 Aux Id: OTP-12671, OTP-12672 </p>
+ </item>
+ <item>
+ <p>
+ The key exchange algorithm 'diffie-hellman-group14-sha1'
+ is implemented. See RFC 4253.</p>
+ <p>
+ This raises the security level.</p>
+ <p>
+ Own Id: OTP-12671 Aux Id: OTP-12672, OTP-12622 </p>
+ </item>
+ <item>
+ <p>
+ The key exchange algorithms
+ 'diffie-hellman-group-exchange-sha1' and
+ 'diffie-hellman-group-exchange-sha256' are implemented.
+ See RFC 4419.</p>
+ <p>
+ This raises the security level.</p>
+ <p>
+ Own Id: OTP-12672 Aux Id: OTP-12671, OTP-12622 </p>
+ </item>
+ <item>
+ <p>
+ Adding random length extra padding as recommended in RFC
+ 4253 section 6.</p>
+ <p>
+ Own Id: OTP-12831</p>
+ </item>
+ <item>
+ <p>
+ New test library for low-level protocol testing. There is
+ also a test suite using it for some preliminary tests.
+ The intention is to build on that for more testing of
+ individual ssh messages. See
+ <c>lib/ssh/test/ssh_trpt_test_lib.erl</c> and
+ <c>ssh_protocol_SUITE.erl</c> in the same directory.</p>
+ <p>
+ Own Id: OTP-12858</p>
+ </item>
+ <item>
+ <p>
+ Increased default values for
+ diffie-hellman-group-exchange-sha* to Min = 1024, N =
+ 6144, Max = 8192.</p>
+ <p>
+ Added 6144 and 8192 bit default gex groups.</p>
+ <p>
+ Own Id: OTP-12937</p>
+ </item>
+ <item>
+ <p>
+ The mac algorithm 'hmac-sha2-512' is implemented. See RFC
+ 6668.</p>
+ <p>
+ Own Id: OTP-12938</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
<section><title>Ssh 4.0</title>
<section><title>Fixed Bugs and Malfunctions</title>
diff --git a/lib/ssh/doc/src/ssh.xml b/lib/ssh/doc/src/ssh.xml
index cf5e8f1aff..2b190c98b6 100644
--- a/lib/ssh/doc/src/ssh.xml
+++ b/lib/ssh/doc/src/ssh.xml
@@ -40,18 +40,24 @@
<list type="bulleted">
<item>For application dependencies see <seealso marker="SSH_app"> ssh(6)</seealso> </item>
<item>Supported SSH version is 2.0.</item>
- <item>Supported public key algorithms: ssh-rsa and ssh-dss.</item>
- <item>Supported MAC algorithms: hmac-sha2-256 and hmac-sha1.</item>
- <item>Supported encryption algorithms: aes128-ctr, aes128-cb and 3des-cbc.</item>
- <item>Supported key exchange algorithms: diffie-hellman-group1-sha1, diffie-hellman-group14-sha1, diffie-hellman-group-exchange-sha1 and diffie-hellman-group-exchange-sha256.</item>
- <item>Supported compression algorithms: none, zlib, [email protected],</item>
+ <item>Supported public key algorithms: ecdsa-sha2-nistp256, ecdsa-sha2-nistp384, ecdsa-sha2-nistp521, ssh-rsa and ssh-dss.</item>
+ <item>Supported MAC algorithms: hmac-sha2-256, hmac-sha2-512 and hmac-sha1.</item>
+ <item>Supported encryption algorithms: aes256-ctr, aes192-ctr, aes128-ctr, aes128-cb and 3des-cbc.</item>
+ <item>Supported key exchange algorithms: ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521, diffie-hellman-group14-sha1, diffie-hellman-group-exchange-sha1, diffie-hellman-group-exchange-sha256 and diffie-hellman-group1-sha1</item>
+ <item>Supported compression algorithms: none, [email protected] and zlib</item>
<item>Supports unicode filenames if the emulator and the underlaying OS support it.
See section DESCRIPTION in the
<seealso marker="kernel:file">file</seealso> manual page in <c>kernel</c>
for information about this subject.</item>
<item>Supports unicode in shell and CLI.</item>
</list>
-
+ <p>The actual set of algorithms can vary depending on which OpenSSL crypto library that is installed on the machine.
+ For the list on a particular installation, use the command <seealso marker="#default_algorithms/0">default_algorithms/0</seealso>.
+ The user may override the default algorithm configuration both on the server side and the client side.
+ See the option preferred_algorithms in the <seealso marker="#daemon/1">daemon</seealso> and
+ <seealso marker="#connect/3">connect</seealso> functions.
+</p>
+
</section>
<section>
@@ -243,7 +249,7 @@ kex is implicit but public_key is set explicitly.</p>
<tag><c><![CDATA[{dh_gex_limits,{Min=integer(),I=integer(),Max=integer()}}]]></c></tag>
<item>
<p>Sets the three diffie-hellman-group-exchange parameters that guides the connected server in choosing a group.
- See RFC 4419 for the function of thoose. The default value is <c>{512, 1024, 4096}</c>.
+ See RFC 4419 for the function of thoose. The default value is <c>{1024, 6144, 8192}</c>.
</p>
</item>
@@ -501,6 +507,15 @@ kex is implicit but public_key is set explicitly.</p>
</p>
</item>
+ <tag><c><![CDATA[{max_channels, pos_integer()}]]></c></tag>
+ <item>
+ <p>The maximum number of channels with active remote subsystem that are accepted for
+ each connection to this daemon</p>
+ <p>By default, this option is not set. This means that the number is not limited.
+ </p>
+ </item>
+
+
<tag><c><![CDATA[{parallel_login, boolean()}]]></c></tag>
<item>
<p>If set to false (the default value), only one login is handled at a time.
diff --git a/lib/ssh/src/ssh.erl b/lib/ssh/src/ssh.erl
index 132de71aed..049018b21c 100644
--- a/lib/ssh/src/ssh.erl
+++ b/lib/ssh/src/ssh.erl
@@ -117,9 +117,9 @@ channel_info(ConnectionRef, ChannelId, Options) ->
ssh_connection_handler:channel_info(ConnectionRef, ChannelId, Options).
%%--------------------------------------------------------------------
--spec daemon(integer()) -> {ok, pid()}.
--spec daemon(integer(), proplists:proplist()) -> {ok, pid()}.
--spec daemon(any | inet:ip_address(), integer(), proplists:proplist()) -> {ok, pid()}.
+-spec daemon(integer()) -> {ok, pid()} | {error, term()}.
+-spec daemon(integer(), proplists:proplist()) -> {ok, pid()} | {error, term()}.
+-spec daemon(any | inet:ip_address(), integer(), proplists:proplist()) -> {ok, pid()} | {error, term()}.
%% Description: Starts a server listening for SSH connections
%% on the given port.
@@ -385,12 +385,15 @@ handle_option([{rekey_limit, _} = Opt|Rest], SocketOptions, SshOptions) ->
handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]);
handle_option([{max_sessions, _} = Opt|Rest], SocketOptions, SshOptions) ->
handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]);
+handle_option([{max_channels, _} = Opt|Rest], SocketOptions, SshOptions) ->
+ handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]);
handle_option([{negotiation_timeout, _} = Opt|Rest], SocketOptions, SshOptions) ->
handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]);
handle_option([{parallel_login, _} = Opt|Rest], SocketOptions, SshOptions) ->
handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]);
-handle_option([parallel_login|Rest], SocketOptions, SshOptions) ->
- handle_option(Rest, SocketOptions, [handle_ssh_option({parallel_login,true}) | SshOptions]);
+%% (Is handled by proplists:unfold above:)
+%% handle_option([parallel_login|Rest], SocketOptions, SshOptions) ->
+%% handle_option(Rest, SocketOptions, [handle_ssh_option({parallel_login,true}) | SshOptions]);
handle_option([{minimal_remote_max_packet_size, _} = Opt|Rest], SocketOptions, SshOptions) ->
handle_option(Rest, SocketOptions, [handle_ssh_option(Opt) | SshOptions]);
handle_option([{id_string, _ID} = Opt|Rest], SocketOptions, SshOptions) ->
@@ -443,6 +446,8 @@ handle_ssh_option({connect_timeout, Value} = Opt) when is_integer(Value); Value
Opt;
handle_ssh_option({max_sessions, Value} = Opt) when is_integer(Value), Value>0 ->
Opt;
+handle_ssh_option({max_channels, Value} = Opt) when is_integer(Value), Value>0 ->
+ Opt;
handle_ssh_option({negotiation_timeout, Value} = Opt) when is_integer(Value); Value == infinity ->
Opt;
handle_ssh_option({parallel_login, Value} = Opt) when Value==true ; Value==false ->
diff --git a/lib/ssh/src/ssh.hrl b/lib/ssh/src/ssh.hrl
index 462c98f503..fc9d60c500 100644
--- a/lib/ssh/src/ssh.hrl
+++ b/lib/ssh/src/ssh.hrl
@@ -37,13 +37,16 @@
-define(FALSE, 0).
-define(TRUE, 1).
%% basic binary constructors
--define(BOOLEAN(X), X:8/unsigned-big-integer).
--define(BYTE(X), X:8/unsigned-big-integer).
--define(UINT16(X), X:16/unsigned-big-integer).
--define(UINT32(X), X:32/unsigned-big-integer).
--define(UINT64(X), X:64/unsigned-big-integer).
+-define(BOOLEAN(X), (X):8/unsigned-big-integer).
+-define(BYTE(X), (X):8/unsigned-big-integer).
+-define(UINT16(X), (X):16/unsigned-big-integer).
+-define(UINT32(X), (X):32/unsigned-big-integer).
+-define(UINT64(X), (X):64/unsigned-big-integer).
-define(STRING(X), ?UINT32((size(X))), (X)/binary).
+-define(DEC_BIN(X,Len), ?UINT32(Len), X:Len/binary ).
+-define(DEC_MPINT(I,Len), ?UINT32(Len), I:Len/big-signed-integer-unit:8 ).
+
%% building macros
-define(boolean(X),
case X of
@@ -133,7 +136,6 @@
userauth_supported_methods, % string() eg "keyboard-interactive,password"
userauth_methods, % list( string() ) eg ["keyboard-interactive", "password"]
kb_tries_left = 0, % integer(), num tries left for "keyboard-interactive"
- kb_data,
userauth_preference,
available_host_keys,
authenticated = false
diff --git a/lib/ssh/src/ssh_auth.erl b/lib/ssh/src/ssh_auth.erl
index a91b8c200e..04749fcf8e 100644
--- a/lib/ssh/src/ssh_auth.erl
+++ b/lib/ssh/src/ssh_auth.erl
@@ -31,8 +31,7 @@
-export([publickey_msg/1, password_msg/1, keyboard_interactive_msg/1,
service_request_msg/1, init_userauth_request_msg/1,
userauth_request_msg/1, handle_userauth_request/3,
- handle_userauth_info_request/3, handle_userauth_info_response/2,
- default_public_key_algorithms/0
+ handle_userauth_info_request/3, handle_userauth_info_response/2
]).
%%--------------------------------------------------------------------
@@ -42,27 +41,29 @@ publickey_msg([Alg, #ssh{user = User,
session_id = SessionId,
service = Service,
opts = Opts} = Ssh]) ->
-
Hash = sha, %% Maybe option?!
KeyCb = proplists:get_value(key_cb, Opts, ssh_file),
-
case KeyCb:user_key(Alg, Opts) of
- {ok, Key} ->
- StrAlgo = algorithm_string(Alg),
- PubKeyBlob = encode_public_key(Key),
- SigData = build_sig_data(SessionId,
- User, Service, PubKeyBlob, StrAlgo),
- Sig = ssh_transport:sign(SigData, Hash, Key),
- SigBlob = list_to_binary([?string(StrAlgo), ?binary(Sig)]),
- ssh_transport:ssh_packet(
- #ssh_msg_userauth_request{user = User,
- service = Service,
- method = "publickey",
- data = [?TRUE,
- ?string(StrAlgo),
- ?binary(PubKeyBlob),
- ?binary(SigBlob)]},
- Ssh);
+ {ok, PrivKey} ->
+ StrAlgo = atom_to_list(Alg),
+ case encode_public_key(StrAlgo, ssh_transport:extract_public_key(PrivKey)) of
+ not_ok ->
+ not_ok;
+ PubKeyBlob ->
+ SigData = build_sig_data(SessionId,
+ User, Service, PubKeyBlob, StrAlgo),
+ Sig = ssh_transport:sign(SigData, Hash, PrivKey),
+ SigBlob = list_to_binary([?string(StrAlgo), ?binary(Sig)]),
+ ssh_transport:ssh_packet(
+ #ssh_msg_userauth_request{user = User,
+ service = Service,
+ method = "publickey",
+ data = [?TRUE,
+ ?string(StrAlgo),
+ ?binary(PubKeyBlob),
+ ?binary(SigBlob)]},
+ Ssh)
+ end;
_Error ->
not_ok
end.
@@ -121,7 +122,7 @@ init_userauth_request_msg(#ssh{opts = Opts} = Ssh) ->
Algs = proplists:get_value(public_key,
proplists:get_value(preferred_algorithms, Opts, []),
- default_public_key_algorithms()),
+ ssh_transport:default_algorithms(public_key)),
Prefs = method_preference(Algs),
ssh_transport:ssh_packet(Msg, Ssh#ssh{user = User,
userauth_preference = Prefs,
@@ -153,7 +154,7 @@ userauth_request_msg(#ssh{userauth_methods = Methods,
not_ok ->
userauth_request_msg(Ssh);
Result ->
- Result
+ {Pref,Result}
end;
false ->
userauth_request_msg(Ssh)
@@ -299,8 +300,7 @@ handle_userauth_request(#ssh_msg_userauth_request{user = User,
>>
},
{not_authorized, {User, undefined},
- ssh_transport:ssh_packet(Msg, Ssh#ssh{user = User,
- kb_data = Msg
+ ssh_transport:ssh_packet(Msg, Ssh#ssh{user = User
})}
end;
@@ -313,6 +313,8 @@ handle_userauth_request(#ssh_msg_userauth_request{user = User,
#ssh_msg_userauth_failure{authentications = Methods,
partial_success = false}, Ssh)}.
+
+
handle_userauth_info_request(
#ssh_msg_userauth_info_request{name = Name,
instruction = Instr,
@@ -330,36 +332,19 @@ handle_userauth_info_request(
handle_userauth_info_response(#ssh_msg_userauth_info_response{num_responses = 1,
data = <<?UINT32(Sz), Password:Sz/binary>>},
#ssh{opts = Opts,
- kb_tries_left = KbTriesLeft0,
- kb_data = InfoMsg,
+ kb_tries_left = KbTriesLeft,
user = User,
userauth_supported_methods = Methods} = Ssh) ->
- KbTriesLeft = KbTriesLeft0 - 1,
case check_password(User, unicode:characters_to_list(Password), Opts) of
true ->
{authorized, User,
ssh_transport:ssh_packet(#ssh_msg_userauth_success{}, Ssh)};
- false when KbTriesLeft > 0 ->
- UserAuthInfoMsg =
- InfoMsg#ssh_msg_userauth_info_request{
- name = "",
- instruction =
- lists:concat(
- ["Bad user or password, try again. ",
- integer_to_list(KbTriesLeft),
- " tries left."])
- },
- {not_authorized, {User, undefined},
- ssh_transport:ssh_packet(UserAuthInfoMsg,
- Ssh#ssh{kb_tries_left = KbTriesLeft})};
-
false ->
{not_authorized, {User, {error,"Bad user or password"}},
ssh_transport:ssh_packet(#ssh_msg_userauth_failure{
authentications = Methods,
partial_success = false},
- Ssh#ssh{kb_data = undefined,
- kb_tries_left = 0}
+ Ssh#ssh{kb_tries_left = max(KbTriesLeft-1, 0)}
)}
end;
@@ -371,8 +356,6 @@ handle_userauth_info_response(#ssh_msg_userauth_info_response{},
language = "en"}).
-default_public_key_algorithms() -> ?PREFERRED_PK_ALGS.
-
%%--------------------------------------------------------------------
%%% Internal functions
%%--------------------------------------------------------------------
@@ -447,10 +430,7 @@ build_sig_data(SessionId, User, Service, KeyBlob, Alg) ->
?binary(KeyBlob)],
list_to_binary(Sig).
-algorithm_string('ssh-rsa') ->
- "ssh-rsa";
-algorithm_string('ssh-dss') ->
- "ssh-dss".
+
decode_keyboard_interactive_prompts(_NumPrompts, Data) ->
ssh_message:decode_keyboard_interactive_prompts(Data, []).
@@ -501,23 +481,18 @@ keyboard_interact_fun(KbdInteractFun, Name, Instr, PromptInfos, NumPrompts) ->
language = "en"}})
end.
-decode_public_key_v2(<<?UINT32(Len0), _:Len0/binary,
- ?UINT32(Len1), E:Len1/big-signed-integer-unit:8,
- ?UINT32(Len2), N:Len2/big-signed-integer-unit:8>>
- ,"ssh-rsa") ->
- {ok, #'RSAPublicKey'{publicExponent = E, modulus = N}};
-decode_public_key_v2(<<?UINT32(Len0), _:Len0/binary,
- ?UINT32(Len1), P:Len1/big-signed-integer-unit:8,
- ?UINT32(Len2), Q:Len2/big-signed-integer-unit:8,
- ?UINT32(Len3), G:Len3/big-signed-integer-unit:8,
- ?UINT32(Len4), Y:Len4/big-signed-integer-unit:8>>
- , "ssh-dss") ->
- {ok, {Y, #'Dss-Parms'{p = P, q = Q, g = G}}};
-
-decode_public_key_v2(_, _) ->
- {error, bad_format}.
-
-encode_public_key(#'RSAPrivateKey'{publicExponent = E, modulus = N}) ->
- ssh_bits:encode(["ssh-rsa",E,N], [string,mpint,mpint]);
-encode_public_key(#'DSAPrivateKey'{p = P, q = Q, g = G, y = Y}) ->
- ssh_bits:encode(["ssh-dss",P,Q,G,Y], [string,mpint,mpint,mpint,mpint]).
+decode_public_key_v2(Bin, _Type) ->
+ try
+ public_key:ssh_decode(Bin, ssh2_pubkey)
+ of
+ Key -> {ok, Key}
+ catch
+ _:_ -> {error, bad_format}
+ end.
+
+encode_public_key(_Alg, Key) ->
+ try
+ public_key:ssh_encode(Key, ssh2_pubkey)
+ catch
+ _:_ -> not_ok
+ end.
diff --git a/lib/ssh/src/ssh_auth.hrl b/lib/ssh/src/ssh_auth.hrl
index 71f222f6d7..5197a42fa4 100644
--- a/lib/ssh/src/ssh_auth.hrl
+++ b/lib/ssh/src/ssh_auth.hrl
@@ -24,8 +24,6 @@
-define(SUPPORTED_AUTH_METHODS, "publickey,keyboard-interactive,password").
--define(PREFERRED_PK_ALGS, ['ssh-rsa','ssh-dss']).
-
-define(SSH_MSG_USERAUTH_REQUEST, 50).
-define(SSH_MSG_USERAUTH_FAILURE, 51).
-define(SSH_MSG_USERAUTH_SUCCESS, 52).
diff --git a/lib/ssh/src/ssh_connection.erl b/lib/ssh/src/ssh_connection.erl
index 64d2113125..266c64fd4f 100644
--- a/lib/ssh/src/ssh_connection.erl
+++ b/lib/ssh/src/ssh_connection.erl
@@ -935,14 +935,27 @@ encode_ip(Addr) when is_list(Addr) ->
end
end.
-start_channel(Cb, Id, Args, SubSysSup) ->
- start_channel(Cb, Id, Args, SubSysSup, undefined).
+start_channel(Cb, Id, Args, SubSysSup, Opts) ->
+ start_channel(Cb, Id, Args, SubSysSup, undefined, Opts).
-start_channel(Cb, Id, Args, SubSysSup, Exec) ->
+start_channel(Cb, Id, Args, SubSysSup, Exec, Opts) ->
ChildSpec = child_spec(Cb, Id, Args, Exec),
ChannelSup = ssh_subsystem_sup:channel_supervisor(SubSysSup),
+ assert_limit_num_channels_not_exceeded(ChannelSup, Opts),
ssh_channel_sup:start_child(ChannelSup, ChildSpec).
+assert_limit_num_channels_not_exceeded(ChannelSup, Opts) ->
+ MaxNumChannels = proplists:get_value(max_channels, Opts, infinity),
+ NumChannels = length([x || {_,_,worker,[ssh_channel]} <-
+ supervisor:which_children(ChannelSup)]),
+ if
+ %% Note that NumChannels is BEFORE starting a new one
+ NumChannels < MaxNumChannels ->
+ ok;
+ true ->
+ throw(max_num_channels_exceeded)
+ end.
+
%%--------------------------------------------------------------------
%%% Internal functions
%%--------------------------------------------------------------------
@@ -998,9 +1011,11 @@ child_spec(Callback, Id, Args, Exec) ->
start_cli(#connection{cli_spec = no_cli}, _) ->
{error, cli_disabled};
-start_cli(#connection{cli_spec = {CbModule, Args}, exec = Exec,
+start_cli(#connection{options = Options,
+ cli_spec = {CbModule, Args},
+ exec = Exec,
sub_system_supervisor = SubSysSup}, ChannelId) ->
- start_channel(CbModule, ChannelId, Args, SubSysSup, Exec).
+ start_channel(CbModule, ChannelId, Args, SubSysSup, Exec, Options).
start_subsytem(BinName, #connection{options = Options,
sub_system_supervisor = SubSysSup},
@@ -1008,7 +1023,7 @@ start_subsytem(BinName, #connection{options = Options,
Name = binary_to_list(BinName),
case check_subsystem(Name, Options) of
{Callback, Opts} when is_atom(Callback), Callback =/= none ->
- start_channel(Callback, ChannelId, Opts, SubSysSup);
+ start_channel(Callback, ChannelId, Opts, SubSysSup, Options);
{Other, _} when Other =/= none ->
{error, legacy_option_not_supported}
end.
diff --git a/lib/ssh/src/ssh_connection_handler.erl b/lib/ssh/src/ssh_connection_handler.erl
index fcd66b80c0..7fb86c1108 100644
--- a/lib/ssh/src/ssh_connection_handler.erl
+++ b/lib/ssh/src/ssh_connection_handler.erl
@@ -49,7 +49,10 @@
-export([hello/2, kexinit/2, key_exchange/2,
key_exchange_dh_gex_init/2, key_exchange_dh_gex_reply/2,
new_keys/2,
- userauth/2, connected/2,
+ service_request/2, connected/2,
+ userauth/2,
+ userauth_keyboard_interactive/2,
+ userauth_keyboard_interactive_info_response/2,
error/2]).
-export([init/1, handle_event/3,
@@ -82,7 +85,12 @@
recbuf
}).
--type state_name() :: hello | kexinit | key_exchange | new_keys | userauth | connection.
+-type state_name() :: hello | kexinit | key_exchange | key_exchange_dh_gex_init |
+ key_exchange_dh_gex_reply | new_keys | service_request |
+ userauth | userauth_keyboard_interactive |
+ userauth_keyboard_interactive_info_response |
+ connection.
+
-type gen_fsm_state_return() :: {next_state, state_name(), term()} |
{next_state, state_name(), term(), timeout()} |
{stop, term(), term()}.
@@ -474,28 +482,30 @@ new_keys(#ssh_msg_newkeys{} = Msg, #state{ssh_params = Ssh0} = State0) ->
after_new_keys(next_packet(State0#state{ssh_params = Ssh})).
%%--------------------------------------------------------------------
--spec userauth(#ssh_msg_service_request{} | #ssh_msg_service_accept{} |
- #ssh_msg_userauth_request{} | #ssh_msg_userauth_info_request{} |
- #ssh_msg_userauth_info_response{} | #ssh_msg_userauth_success{} |
- #ssh_msg_userauth_failure{} | #ssh_msg_userauth_banner{},
- #state{}) -> gen_fsm_state_return().
+-spec service_request(#ssh_msg_service_request{} | #ssh_msg_service_accept{},
+ #state{}) -> gen_fsm_state_return().
%%--------------------------------------------------------------------
-
-userauth(#ssh_msg_service_request{name = "ssh-userauth"} = Msg,
+service_request(#ssh_msg_service_request{name = "ssh-userauth"} = Msg,
#state{ssh_params = #ssh{role = server,
session_id = SessionId} = Ssh0} = State) ->
{ok, {Reply, Ssh}} = ssh_auth:handle_userauth_request(Msg, SessionId, Ssh0),
send_msg(Reply, State),
{next_state, userauth, next_packet(State#state{ssh_params = Ssh})};
-userauth(#ssh_msg_service_accept{name = "ssh-userauth"},
- #state{ssh_params = #ssh{role = client,
- service = "ssh-userauth"} = Ssh0} =
- State) ->
+service_request(#ssh_msg_service_accept{name = "ssh-userauth"},
+ #state{ssh_params = #ssh{role = client,
+ service = "ssh-userauth"} = Ssh0} =
+ State) ->
{Msg, Ssh} = ssh_auth:init_userauth_request_msg(Ssh0),
send_msg(Msg, State),
- {next_state, userauth, next_packet(State#state{auth_user = Ssh#ssh.user, ssh_params = Ssh})};
+ {next_state, userauth, next_packet(State#state{auth_user = Ssh#ssh.user, ssh_params = Ssh})}.
+%%--------------------------------------------------------------------
+-spec userauth(#ssh_msg_userauth_request{} | #ssh_msg_userauth_info_request{} |
+ #ssh_msg_userauth_info_response{} | #ssh_msg_userauth_success{} |
+ #ssh_msg_userauth_failure{} | #ssh_msg_userauth_banner{},
+ #state{}) -> gen_fsm_state_return().
+%%--------------------------------------------------------------------
userauth(#ssh_msg_userauth_request{service = "ssh-connection",
method = "none"} = Msg,
#state{ssh_params = #ssh{session_id = SessionId, role = server,
@@ -520,7 +530,11 @@ userauth(#ssh_msg_userauth_request{service = "ssh-connection",
Pid ! ssh_connected,
connected_fun(User, Address, Method, Opts),
{next_state, connected,
- next_packet(State#state{auth_user = User, ssh_params = Ssh})};
+ next_packet(State#state{auth_user = User, ssh_params = Ssh#ssh{authenticated = true}})};
+ {not_authorized, {User, Reason}, {Reply, Ssh}} when Method == "keyboard-interactive" ->
+ retry_fun(User, Address, Reason, Opts),
+ send_msg(Reply, State),
+ {next_state, userauth_keyboard_interactive, next_packet(State#state{ssh_params = Ssh})};
{not_authorized, {User, Reason}, {Reply, Ssh}} ->
retry_fun(User, Address, Reason, Opts),
send_msg(Reply, State),
@@ -530,30 +544,6 @@ userauth(#ssh_msg_userauth_request{service = "ssh-connection",
userauth(Msg#ssh_msg_userauth_request{method="none"}, State)
end;
-userauth(#ssh_msg_userauth_info_request{} = Msg,
- #state{ssh_params = #ssh{role = client,
- io_cb = IoCb} = Ssh0} = State) ->
- {ok, {Reply, Ssh}} = ssh_auth:handle_userauth_info_request(Msg, IoCb, Ssh0),
- send_msg(Reply, State),
- {next_state, userauth, next_packet(State#state{ssh_params = Ssh})};
-
-userauth(#ssh_msg_userauth_info_response{} = Msg,
- #state{ssh_params = #ssh{role = server,
- peer = {_, Address}} = Ssh0,
- opts = Opts, starter = Pid} = State) ->
- case ssh_auth:handle_userauth_info_response(Msg, Ssh0) of
- {authorized, User, {Reply, Ssh}} ->
- send_msg(Reply, State),
- Pid ! ssh_connected,
- connected_fun(User, Address, "keyboard-interactive", Opts),
- {next_state, connected,
- next_packet(State#state{auth_user = User, ssh_params = Ssh})};
- {not_authorized, {User, Reason}, {Reply, Ssh}} ->
- retry_fun(User, Address, Reason, Opts),
- send_msg(Reply, State),
- {next_state, userauth, next_packet(State#state{ssh_params = Ssh})}
- end;
-
userauth(#ssh_msg_userauth_success{}, #state{ssh_params = #ssh{role = client} = Ssh,
starter = Pid} = State) ->
Pid ! ssh_connected,
@@ -580,19 +570,25 @@ userauth(#ssh_msg_userauth_failure{authentications = Methodes},
{disconnect, DisconnectMsg, {Msg, Ssh}} ->
send_msg(Msg, State),
handle_disconnect(DisconnectMsg, State#state{ssh_params = Ssh});
- {Msg, Ssh} ->
+ {"keyboard-interactive", {Msg, Ssh}} ->
+ send_msg(Msg, State),
+ {next_state, userauth_keyboard_interactive, next_packet(State#state{ssh_params = Ssh})};
+ {_Method, {Msg, Ssh}} ->
send_msg(Msg, State),
{next_state, userauth, next_packet(State#state{ssh_params = Ssh})}
end;
%% The prefered authentication method failed try next method
-userauth(#ssh_msg_userauth_failure{},
+userauth(#ssh_msg_userauth_failure{},
#state{ssh_params = #ssh{role = client} = Ssh0} = State) ->
case ssh_auth:userauth_request_msg(Ssh0) of
{disconnect, DisconnectMsg,{Msg, Ssh}} ->
send_msg(Msg, State),
handle_disconnect(DisconnectMsg, State#state{ssh_params = Ssh});
- {Msg, Ssh} ->
+ {"keyboard-interactive", {Msg, Ssh}} ->
+ send_msg(Msg, State),
+ {next_state, userauth_keyboard_interactive, next_packet(State#state{ssh_params = Ssh})};
+ {_Method, {Msg, Ssh}} ->
send_msg(Msg, State),
{next_state, userauth, next_packet(State#state{ssh_params = Ssh})}
end;
@@ -607,6 +603,40 @@ userauth(#ssh_msg_userauth_banner{message = Msg},
io:format("~s", [Msg]),
{next_state, userauth, next_packet(State)}.
+
+
+userauth_keyboard_interactive(#ssh_msg_userauth_info_request{} = Msg,
+ #state{ssh_params = #ssh{role = client,
+ io_cb = IoCb} = Ssh0} = State) ->
+ {ok, {Reply, Ssh}} = ssh_auth:handle_userauth_info_request(Msg, IoCb, Ssh0),
+ send_msg(Reply, State),
+ {next_state, userauth_keyboard_interactive_info_response, next_packet(State#state{ssh_params = Ssh})};
+
+userauth_keyboard_interactive(#ssh_msg_userauth_info_response{} = Msg,
+ #state{ssh_params = #ssh{role = server,
+ peer = {_, Address}} = Ssh0,
+ opts = Opts, starter = Pid} = State) ->
+ case ssh_auth:handle_userauth_info_response(Msg, Ssh0) of
+ {authorized, User, {Reply, Ssh}} ->
+ send_msg(Reply, State),
+ Pid ! ssh_connected,
+ connected_fun(User, Address, "keyboard-interactive", Opts),
+ {next_state, connected,
+ next_packet(State#state{auth_user = User, ssh_params = Ssh#ssh{authenticated = true}})};
+ {not_authorized, {User, Reason}, {Reply, Ssh}} ->
+ retry_fun(User, Address, Reason, Opts),
+ send_msg(Reply, State),
+ {next_state, userauth, next_packet(State#state{ssh_params = Ssh})}
+ end.
+
+
+
+userauth_keyboard_interactive_info_response(Msg=#ssh_msg_userauth_failure{}, State) ->
+ userauth(Msg, State);
+
+userauth_keyboard_interactive_info_response(Msg=#ssh_msg_userauth_success{}, State) ->
+ userauth(Msg, State).
+
%%--------------------------------------------------------------------
-spec connected({#ssh_msg_kexinit{}, binary()}, %%| %% #ssh_msg_kexdh_init{},
#state{}) -> gen_fsm_state_return().
@@ -1236,9 +1266,9 @@ supported_host_keys(client, _, Options) ->
proplists:get_value(preferred_algorithms,Options,[])
) of
undefined ->
- ssh_auth:default_public_key_algorithms();
+ ssh_transport:default_algorithms(public_key);
L ->
- L -- (L--ssh_auth:default_public_key_algorithms())
+ L -- (L--ssh_transport:default_algorithms(public_key))
end
of
[] ->
@@ -1250,21 +1280,17 @@ supported_host_keys(client, _, Options) ->
{stop, {shutdown, Reason}}
end;
supported_host_keys(server, KeyCb, Options) ->
- Algs=
[atom_to_list(A) || A <- proplists:get_value(public_key,
proplists:get_value(preferred_algorithms,Options,[]),
- ssh_auth:default_public_key_algorithms()
+ ssh_transport:default_algorithms(public_key)
),
available_host_key(KeyCb, A, Options)
- ],
- Algs.
-
+ ].
%% Alg :: atom()
available_host_key(KeyCb, Alg, Opts) ->
element(1, catch KeyCb:host_key(Alg, Opts)) == ok.
-
send_msg(Msg, #state{socket = Socket, transport_cb = Transport}) ->
Transport:send(Socket, Msg).
@@ -1563,10 +1589,10 @@ after_new_keys(#state{renegotiate = false,
ssh_params = #ssh{role = client} = Ssh0} = State) ->
{Msg, Ssh} = ssh_auth:service_request_msg(Ssh0),
send_msg(Msg, State),
- {next_state, userauth, State#state{ssh_params = Ssh}};
+ {next_state, service_request, State#state{ssh_params = Ssh}};
after_new_keys(#state{renegotiate = false,
ssh_params = #ssh{role = server}} = State) ->
- {next_state, userauth, State}.
+ {next_state, service_request, State}.
after_new_keys_events({sync, _Event, From}, {stop, _Reason, _StateData}=Terminator) ->
gen_fsm:reply(From, {error, closed}),
diff --git a/lib/ssh/src/ssh_file.erl b/lib/ssh/src/ssh_file.erl
index b98a8a8410..c087ce14d7 100644
--- a/lib/ssh/src/ssh_file.erl
+++ b/lib/ssh/src/ssh_file.erl
@@ -52,8 +52,20 @@ host_key(Algorithm, Opts) ->
%% so probably we could hardcod Password = ignore, but
%% we keep it as an undocumented option for now.
Password = proplists:get_value(identity_pass_phrase(Algorithm), Opts, ignore),
- decode(File, Password).
-
+ case decode(File, Password) of
+ {ok,Key} ->
+ case {Key,Algorithm} of
+ {#'RSAPrivateKey'{}, 'ssh-rsa'} -> {ok,Key};
+ {#'DSAPrivateKey'{}, 'ssh-dss'} -> {ok,Key};
+ {#'ECPrivateKey'{parameters = {namedCurve, ?'secp256r1'}}, 'ecdsa-sha2-nistp256'} -> {ok,Key};
+ {#'ECPrivateKey'{parameters = {namedCurve, ?'secp384r1'}}, 'ecdsa-sha2-nistp384'} -> {ok,Key};
+ {#'ECPrivateKey'{parameters = {namedCurve, ?'secp521r1'}}, 'ecdsa-sha2-nistp521'} -> {ok,Key};
+ _ ->
+ {error,bad_keytype_in_file}
+ end;
+ Other ->
+ Other
+ end.
is_auth_key(Key, User,Opts) ->
case lookup_user_key(Key, User, Opts) of
@@ -81,16 +93,15 @@ user_key(Algorithm, Opts) ->
%% Internal functions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-file_base_name('ssh-rsa') ->
- "ssh_host_rsa_key";
-file_base_name('ssh-dss') ->
- "ssh_host_dsa_key";
-file_base_name(_) ->
- "ssh_host_key".
+file_base_name('ssh-rsa' ) -> "ssh_host_rsa_key";
+file_base_name('ssh-dss' ) -> "ssh_host_dsa_key";
+file_base_name('ecdsa-sha2-nistp256') -> "ssh_host_ecdsa_key";
+file_base_name('ecdsa-sha2-nistp384') -> "ssh_host_ecdsa_key";
+file_base_name('ecdsa-sha2-nistp521') -> "ssh_host_ecdsa_key";
+file_base_name(_ ) -> "ssh_host_key".
decode(File, Password) ->
- try
- {ok, decode_ssh_file(read_ssh_file(File), Password)}
+ try {ok, decode_ssh_file(read_ssh_file(File), Password)}
catch
throw:Reason ->
{error, Reason};
@@ -215,20 +226,18 @@ do_lookup_host_key(KeyToMatch, Host, Alg, Opts) ->
Error -> Error
end.
-identity_key_filename('ssh-dss') ->
- "id_dsa";
-identity_key_filename('ssh-rsa') ->
- "id_rsa".
-
-identity_pass_phrase("ssh-dss") ->
- dsa_pass_phrase;
-identity_pass_phrase('ssh-dss') ->
- dsa_pass_phrase;
-identity_pass_phrase('ssh-rsa') ->
- rsa_pass_phrase;
-identity_pass_phrase("ssh-rsa") ->
- rsa_pass_phrase.
-
+identity_key_filename('ssh-dss' ) -> "id_dsa";
+identity_key_filename('ssh-rsa' ) -> "id_rsa";
+identity_key_filename('ecdsa-sha2-nistp256') -> "id_ecdsa";
+identity_key_filename('ecdsa-sha2-nistp384') -> "id_ecdsa";
+identity_key_filename('ecdsa-sha2-nistp521') -> "id_ecdsa".
+
+identity_pass_phrase("ssh-dss" ) -> dsa_pass_phrase;
+identity_pass_phrase("ssh-rsa" ) -> rsa_pass_phrase;
+identity_pass_phrase("ecdsa-sha2-"++_) -> ecdsa_pass_phrase;
+identity_pass_phrase(P) when is_atom(P) ->
+ identity_pass_phrase(atom_to_list(P)).
+
lookup_host_key_fd(Fd, KeyToMatch, Host, KeyType) ->
case io:get_line(Fd, '') of
eof ->
@@ -267,6 +276,13 @@ key_match(#'RSAPublicKey'{}, 'ssh-rsa') ->
true;
key_match({_, #'Dss-Parms'{}}, 'ssh-dss') ->
true;
+key_match({#'ECPoint'{},{namedCurve,Curve}}, Alg) ->
+ case atom_to_list(Alg) of
+ "ecdsa-sha2-"++IdS ->
+ Curve == public_key:ssh_curvename2oid(list_to_binary(IdS));
+ _ ->
+ false
+ end;
key_match(_, _) ->
false.
diff --git a/lib/ssh/src/ssh_message.erl b/lib/ssh/src/ssh_message.erl
index cb1dcb67c5..b6c4496be2 100644
--- a/lib/ssh/src/ssh_message.erl
+++ b/lib/ssh/src/ssh_message.erl
@@ -30,7 +30,7 @@
-include("ssh_auth.hrl").
-include("ssh_transport.hrl").
--export([encode/1, decode/1, encode_host_key/1, decode_keyboard_interactive_prompts/2]).
+-export([encode/1, decode/1, decode_keyboard_interactive_prompts/2]).
encode(#ssh_msg_global_request{
name = Name,
@@ -227,8 +227,8 @@ encode(#ssh_msg_kexdh_reply{
f = F,
h_sig = Signature
}) ->
- EncKey = encode_host_key(Key),
- EncSign = encode_sign(Key, Signature),
+ EncKey = public_key:ssh_encode(Key, ssh2_pubkey),
+ EncSign = encode_signature(Key, Signature),
ssh_bits:encode([?SSH_MSG_KEXDH_REPLY, EncKey, F, EncSign], [byte, binary, mpint, binary]);
encode(#ssh_msg_kex_dh_gex_request{
@@ -255,16 +255,16 @@ encode(#ssh_msg_kex_dh_gex_reply{
f = F,
h_sig = Signature
}) ->
- EncKey = encode_host_key(Key),
- EncSign = encode_sign(Key, Signature),
+ EncKey = public_key:ssh_encode(Key, ssh2_pubkey),
+ EncSign = encode_signature(Key, Signature),
ssh_bits:encode([?SSH_MSG_KEX_DH_GEX_REPLY, EncKey, F, EncSign], [byte, binary, mpint, binary]);
encode(#ssh_msg_kex_ecdh_init{q_c = Q_c}) ->
ssh_bits:encode([?SSH_MSG_KEX_ECDH_INIT, Q_c], [byte, mpint]);
encode(#ssh_msg_kex_ecdh_reply{public_host_key = Key, q_s = Q_s, h_sig = Sign}) ->
- EncKey = encode_host_key(Key),
- EncSign = encode_sign(Key, Sign),
+ EncKey = public_key:ssh_encode(Key, ssh2_pubkey),
+ EncSign = encode_signature(Key, Sign),
ssh_bits:encode([?SSH_MSG_KEX_ECDH_REPLY, EncKey, Q_s, EncSign], [byte, binary, mpint, binary]);
encode(#ssh_msg_ignore{data = Data}) ->
@@ -280,8 +280,7 @@ encode(#ssh_msg_debug{always_display = Bool,
%% Connection Messages
-decode(<<?BYTE(?SSH_MSG_GLOBAL_REQUEST), ?UINT32(Len), Name:Len/binary,
- ?BYTE(Bool), Data/binary>>) ->
+decode(<<?BYTE(?SSH_MSG_GLOBAL_REQUEST), ?DEC_BIN(Name,__0), ?BYTE(Bool), Data/binary>>) ->
#ssh_msg_global_request{
name = Name,
want_reply = erl_boolean(Bool),
@@ -292,8 +291,7 @@ decode(<<?BYTE(?SSH_MSG_REQUEST_SUCCESS), Data/binary>>) ->
decode(<<?BYTE(?SSH_MSG_REQUEST_FAILURE)>>) ->
#ssh_msg_request_failure{};
decode(<<?BYTE(?SSH_MSG_CHANNEL_OPEN),
- ?UINT32(Len), Type:Len/binary,
- ?UINT32(Sender), ?UINT32(Window), ?UINT32(Max),
+ ?DEC_BIN(Type,__0), ?UINT32(Sender), ?UINT32(Window), ?UINT32(Max),
Data/binary>>) ->
#ssh_msg_channel_open{
channel_type = binary_to_list(Type),
@@ -313,7 +311,7 @@ decode(<<?BYTE(?SSH_MSG_CHANNEL_OPEN_CONFIRMATION), ?UINT32(Recipient), ?UINT32(
data = Data
};
decode(<<?BYTE(?SSH_MSG_CHANNEL_OPEN_FAILURE), ?UINT32(Recipient), ?UINT32(Reason),
- ?UINT32(Len0), Desc:Len0/binary, ?UINT32(Len1), Lang:Len1/binary >>) ->
+ ?DEC_BIN(Desc,__0), ?DEC_BIN(Lang,__1) >> ) ->
#ssh_msg_channel_open_failure{
recipient_channel = Recipient,
reason = Reason,
@@ -326,13 +324,13 @@ decode(<<?BYTE(?SSH_MSG_CHANNEL_WINDOW_ADJUST), ?UINT32(Recipient), ?UINT32(Byte
bytes_to_add = Bytes
};
-decode(<<?BYTE(?SSH_MSG_CHANNEL_DATA), ?UINT32(Recipient), ?UINT32(Len), Data:Len/binary>>) ->
+decode(<<?BYTE(?SSH_MSG_CHANNEL_DATA), ?UINT32(Recipient), ?DEC_BIN(Data,__0)>>) ->
#ssh_msg_channel_data{
recipient_channel = Recipient,
data = Data
};
decode(<<?BYTE(?SSH_MSG_CHANNEL_EXTENDED_DATA), ?UINT32(Recipient),
- ?UINT32(DataType), ?UINT32(Len), Data:Len/binary>>) ->
+ ?UINT32(DataType), ?DEC_BIN(Data,__0)>>) ->
#ssh_msg_channel_extended_data{
recipient_channel = Recipient,
data_type_code = DataType,
@@ -347,8 +345,7 @@ decode(<<?BYTE(?SSH_MSG_CHANNEL_CLOSE), ?UINT32(Recipient)>>) ->
recipient_channel = Recipient
};
decode(<<?BYTE(?SSH_MSG_CHANNEL_REQUEST), ?UINT32(Recipient),
- ?UINT32(Len), RequestType:Len/binary,
- ?BYTE(Bool), Data/binary>>) ->
+ ?DEC_BIN(RequestType,__0), ?BYTE(Bool), Data/binary>>) ->
#ssh_msg_channel_request{
recipient_channel = Recipient,
request_type = unicode:characters_to_list(RequestType),
@@ -366,9 +363,7 @@ decode(<<?BYTE(?SSH_MSG_CHANNEL_FAILURE), ?UINT32(Recipient)>>) ->
%%% Auth Messages
decode(<<?BYTE(?SSH_MSG_USERAUTH_REQUEST),
- ?UINT32(Len0), User:Len0/binary,
- ?UINT32(Len1), Service:Len1/binary,
- ?UINT32(Len2), Method:Len2/binary,
+ ?DEC_BIN(User,__0), ?DEC_BIN(Service,__1), ?DEC_BIN(Method,__2),
Data/binary>>) ->
#ssh_msg_userauth_request{
user = unicode:characters_to_list(User),
@@ -378,7 +373,7 @@ decode(<<?BYTE(?SSH_MSG_USERAUTH_REQUEST),
};
decode(<<?BYTE(?SSH_MSG_USERAUTH_FAILURE),
- ?UINT32(Len0), Auths:Len0/binary,
+ ?DEC_BIN(Auths,__0),
?BYTE(Bool)>>) ->
#ssh_msg_userauth_failure {
authentications = unicode:characters_to_list(Auths),
@@ -388,16 +383,14 @@ decode(<<?BYTE(?SSH_MSG_USERAUTH_FAILURE),
decode(<<?BYTE(?SSH_MSG_USERAUTH_SUCCESS)>>) ->
#ssh_msg_userauth_success{};
-decode(<<?BYTE(?SSH_MSG_USERAUTH_BANNER),
- ?UINT32(Len0), Banner:Len0/binary,
- ?UINT32(Len1), Lang:Len1/binary>>) ->
+decode(<<?BYTE(?SSH_MSG_USERAUTH_BANNER), ?DEC_BIN(Banner,__0), ?DEC_BIN(Lang,__1) >>) ->
#ssh_msg_userauth_banner{
message = Banner,
language = Lang
};
-decode(<<?BYTE(?SSH_MSG_USERAUTH_INFO_REQUEST), ?UINT32(Len0), Name:Len0/binary,
- ?UINT32(Len1), Inst:Len1/binary, ?UINT32(Len2), Lang:Len2/binary,
+decode(<<?BYTE(?SSH_MSG_USERAUTH_INFO_REQUEST),
+ ?DEC_BIN(Name,__0), ?DEC_BIN(Inst,__1), ?DEC_BIN(Lang,__2),
?UINT32(NumPromtps), Data/binary>>) ->
#ssh_msg_userauth_info_request{
name = Name,
@@ -407,15 +400,14 @@ decode(<<?BYTE(?SSH_MSG_USERAUTH_INFO_REQUEST), ?UINT32(Len0), Name:Len0/binary,
data = Data};
%%% Unhandled message, also masked by same 1:st byte value as ?SSH_MSG_USERAUTH_INFO_REQUEST:
-decode(<<?BYTE(?SSH_MSG_USERAUTH_PASSWD_CHANGEREQ), ?UINT32(Len0), Prompt:Len0/binary,
- ?UINT32(Len1), Lang:Len1/binary>>) ->
+decode(<<?BYTE(?SSH_MSG_USERAUTH_PASSWD_CHANGEREQ), ?DEC_BIN(Prompt,__0), ?DEC_BIN(Lang,__1) >>) ->
#ssh_msg_userauth_passwd_changereq{
prompt = Prompt,
languge = Lang
};
%%% Unhandled message, also masked by same 1:st byte value as ?SSH_MSG_USERAUTH_INFO_REQUEST:
-decode(<<?BYTE(?SSH_MSG_USERAUTH_PK_OK), ?UINT32(Len), Alg:Len/binary, KeyBlob/binary>>) ->
+decode(<<?BYTE(?SSH_MSG_USERAUTH_PK_OK), ?DEC_BIN(Alg,__0), KeyBlob/binary>>) ->
#ssh_msg_userauth_pk_ok{
algorithm_name = Alg,
key_blob = KeyBlob
@@ -430,18 +422,15 @@ decode(<<?BYTE(?SSH_MSG_USERAUTH_INFO_RESPONSE), ?UINT32(Num), Data/binary>>) ->
decode(<<?BYTE(?SSH_MSG_KEXINIT), Cookie:128, Data/binary>>) ->
decode_kex_init(Data, [Cookie, ssh_msg_kexinit], 10);
-decode(<<"dh",?BYTE(?SSH_MSG_KEXDH_INIT), ?UINT32(Len), E:Len/big-signed-integer-unit:8>>) ->
+decode(<<"dh",?BYTE(?SSH_MSG_KEXDH_INIT), ?DEC_MPINT(E,__0)>>) ->
#ssh_msg_kexdh_init{e = E
};
-decode(<<"dh", ?BYTE(?SSH_MSG_KEXDH_REPLY),
- ?UINT32(Len0), Key:Len0/binary,
- ?UINT32(Len1), F:Len1/big-signed-integer-unit:8,
- ?UINT32(Len2), Hashsign:Len2/binary>>) ->
+decode(<<"dh", ?BYTE(?SSH_MSG_KEXDH_REPLY), ?DEC_BIN(Key,__0), ?DEC_MPINT(F,__1), ?DEC_BIN(Hashsign,__2)>>) ->
#ssh_msg_kexdh_reply{
- public_host_key = decode_host_key(Key),
+ public_host_key = public_key:ssh_decode(Key, ssh2_pubkey),
f = F,
- h_sig = decode_sign(Hashsign)
+ h_sig = decode_signature(Hashsign)
};
decode(<<?BYTE(?SSH_MSG_KEX_DH_GEX_REQUEST), ?UINT32(Min), ?UINT32(N), ?UINT32(Max)>>) ->
@@ -456,57 +445,48 @@ decode(<<"dh_gex",?BYTE(?SSH_MSG_KEX_DH_GEX_REQUEST_OLD), ?UINT32(N)>>) ->
n = N
};
-decode(<<"dh_gex",?BYTE(?SSH_MSG_KEX_DH_GEX_GROUP),
- ?UINT32(Len0), Prime:Len0/big-signed-integer-unit:8,
- ?UINT32(Len1), Generator:Len1/big-signed-integer-unit:8>>) ->
+decode(<<"dh_gex",?BYTE(?SSH_MSG_KEX_DH_GEX_GROUP), ?DEC_MPINT(Prime,__0), ?DEC_MPINT(Generator,__1) >>) ->
#ssh_msg_kex_dh_gex_group{
p = Prime,
g = Generator
};
-decode(<<?BYTE(?SSH_MSG_KEX_DH_GEX_INIT), ?UINT32(Len), E:Len/big-signed-integer-unit:8>>) ->
+decode(<<?BYTE(?SSH_MSG_KEX_DH_GEX_INIT), ?DEC_MPINT(E,__0)>>) ->
#ssh_msg_kex_dh_gex_init{
e = E
};
-decode(<<?BYTE(?SSH_MSG_KEX_DH_GEX_REPLY),
- ?UINT32(Len0), Key:Len0/binary,
- ?UINT32(Len1), F:Len1/big-signed-integer-unit:8,
- ?UINT32(Len2), Hashsign:Len2/binary>>) ->
+decode(<<?BYTE(?SSH_MSG_KEX_DH_GEX_REPLY), ?DEC_BIN(Key,__0), ?DEC_MPINT(F,__1), ?DEC_BIN(Hashsign,__2)>>) ->
#ssh_msg_kex_dh_gex_reply{
- public_host_key = decode_host_key(Key),
+ public_host_key = public_key:ssh_decode(Key, ssh2_pubkey),
f = F,
- h_sig = decode_sign(Hashsign)
+ h_sig = decode_signature(Hashsign)
};
-decode(<<"ecdh",?BYTE(?SSH_MSG_KEX_ECDH_INIT),
- ?UINT32(Len0), Q_c:Len0/big-signed-integer-unit:8>>) ->
+decode(<<"ecdh",?BYTE(?SSH_MSG_KEX_ECDH_INIT), ?DEC_MPINT(Q_c,__0)>>) ->
#ssh_msg_kex_ecdh_init{
q_c = Q_c
};
decode(<<"ecdh",?BYTE(?SSH_MSG_KEX_ECDH_REPLY),
- ?UINT32(Len1), Key:Len1/binary,
- ?UINT32(Len2), Q_s:Len2/big-signed-integer-unit:8,
- ?UINT32(Len3), Sig:Len3/binary>>) ->
+ ?DEC_BIN(Key,__1), ?DEC_MPINT(Q_s,__2), ?DEC_BIN(Sig,__3)>>) ->
#ssh_msg_kex_ecdh_reply{
- public_host_key = decode_host_key(Key),
+ public_host_key = public_key:ssh_decode(Key, ssh2_pubkey),
q_s = Q_s,
- h_sig = decode_sign(Sig)
+ h_sig = decode_signature(Sig)
};
-decode(<<?SSH_MSG_SERVICE_REQUEST, ?UINT32(Len0), Service:Len0/binary>>) ->
+decode(<<?SSH_MSG_SERVICE_REQUEST, ?DEC_BIN(Service,__0)>>) ->
#ssh_msg_service_request{
name = unicode:characters_to_list(Service)
};
-decode(<<?SSH_MSG_SERVICE_ACCEPT, ?UINT32(Len0), Service:Len0/binary>>) ->
+decode(<<?SSH_MSG_SERVICE_ACCEPT, ?DEC_BIN(Service,__0)>>) ->
#ssh_msg_service_accept{
name = unicode:characters_to_list(Service)
};
-decode(<<?BYTE(?SSH_MSG_DISCONNECT), ?UINT32(Code),
- ?UINT32(Len0), Desc:Len0/binary, ?UINT32(Len1), Lang:Len1/binary>>) ->
+decode(<<?BYTE(?SSH_MSG_DISCONNECT), ?UINT32(Code), ?DEC_BIN(Desc,__0), ?DEC_BIN(Lang,__1)>>) ->
#ssh_msg_disconnect{
code = Code,
description = unicode:characters_to_list(Desc),
@@ -514,8 +494,7 @@ decode(<<?BYTE(?SSH_MSG_DISCONNECT), ?UINT32(Code),
};
%% Accept bad disconnects from ancient openssh clients that doesn't send language tag. Use english as a work-around.
-decode(<<?BYTE(?SSH_MSG_DISCONNECT), ?UINT32(Code),
- ?UINT32(Len0), Desc:Len0/binary>>) ->
+decode(<<?BYTE(?SSH_MSG_DISCONNECT), ?UINT32(Code), ?DEC_BIN(Desc,__0)>>) ->
#ssh_msg_disconnect{
code = Code,
description = unicode:characters_to_list(Desc),
@@ -525,21 +504,25 @@ decode(<<?BYTE(?SSH_MSG_DISCONNECT), ?UINT32(Code),
decode(<<?SSH_MSG_NEWKEYS>>) ->
#ssh_msg_newkeys{};
-decode(<<?BYTE(?SSH_MSG_IGNORE), ?UINT32(Len), Data:Len/binary>>) ->
+decode(<<?BYTE(?SSH_MSG_IGNORE), ?DEC_BIN(Data,__0)>>) ->
#ssh_msg_ignore{data = Data};
decode(<<?BYTE(?SSH_MSG_UNIMPLEMENTED), ?UINT32(Seq)>>) ->
#ssh_msg_unimplemented{sequence = Seq};
-decode(<<?BYTE(?SSH_MSG_DEBUG), ?BYTE(Bool), ?UINT32(Len0), Msg:Len0/binary,
- ?UINT32(Len1), Lang:Len1/binary>>) ->
+decode(<<?BYTE(?SSH_MSG_DEBUG), ?BYTE(Bool), ?DEC_BIN(Msg,__0), ?DEC_BIN(Lang,__1)>>) ->
#ssh_msg_debug{always_display = erl_boolean(Bool),
message = Msg,
language = Lang}.
+%%%================================================================
+%%%
+%%% Helper functions
+%%%
+
decode_keyboard_interactive_prompts(<<>>, Acc) ->
lists:reverse(Acc);
-decode_keyboard_interactive_prompts(<<?UINT32(Len), Prompt:Len/binary, ?BYTE(Bool), Bin/binary>>,
+decode_keyboard_interactive_prompts(<<?DEC_BIN(Prompt,__0), ?BYTE(Bool), Bin/binary>>,
Acc) ->
decode_keyboard_interactive_prompts(Bin, [{Prompt, erl_boolean(Bool)} | Acc]).
@@ -555,43 +538,25 @@ decode_kex_init(<<?BYTE(Bool)>>, Acc, 0) ->
%% See rfc 4253 7.1
X = 0,
list_to_tuple(lists:reverse([X, erl_boolean(Bool) | Acc]));
-decode_kex_init(<<?UINT32(Len), Data:Len/binary, Rest/binary>>, Acc, N) ->
+decode_kex_init(<<?DEC_BIN(Data,__0), Rest/binary>>, Acc, N) ->
Names = string:tokens(unicode:characters_to_list(Data), ","),
decode_kex_init(Rest, [Names | Acc], N -1).
+%%%================================================================
+%%%
+%%% Signature decode/encode
+%%%
-decode_sign(<<?UINT32(Len), _Alg:Len/binary, ?UINT32(_), Signature/binary>>) ->
+decode_signature(<<?DEC_BIN(_Alg,__0), ?UINT32(_), Signature/binary>>) ->
Signature.
-decode_host_key(<<?UINT32(Len), Alg:Len/binary, Rest/binary>>) ->
- decode_host_key(Alg, Rest).
-
-decode_host_key(<<"ssh-rsa">>, <<?UINT32(Len0), E:Len0/big-signed-integer-unit:8,
- ?UINT32(Len1), N:Len1/big-signed-integer-unit:8>>) ->
- #'RSAPublicKey'{publicExponent = E,
- modulus = N};
-
-decode_host_key(<<"ssh-dss">>,
- <<?UINT32(Len0), P:Len0/big-signed-integer-unit:8,
- ?UINT32(Len1), Q:Len1/big-signed-integer-unit:8,
- ?UINT32(Len2), G:Len2/big-signed-integer-unit:8,
- ?UINT32(Len3), Y:Len3/big-signed-integer-unit:8>>) ->
- {Y, #'Dss-Parms'{p = P,
- q = Q,
- g = G}}.
-
-encode_host_key(#'RSAPublicKey'{modulus = N, publicExponent = E}) ->
- ssh_bits:encode(["ssh-rsa", E, N], [string, mpint, mpint]);
-encode_host_key({Y, #'Dss-Parms'{p = P, q = Q, g = G}}) ->
- ssh_bits:encode(["ssh-dss", P, Q, G, Y],
- [string, mpint, mpint, mpint, mpint]);
-encode_host_key(#'RSAPrivateKey'{modulus = N, publicExponent = E}) ->
- ssh_bits:encode(["ssh-rsa", E, N], [string, mpint, mpint]);
-encode_host_key(#'DSAPrivateKey'{y = Y, p = P, q = Q, g = G}) ->
- ssh_bits:encode(["ssh-dss", P, Q, G, Y],
- [string, mpint, mpint, mpint, mpint]).
-encode_sign(#'RSAPrivateKey'{}, Signature) ->
+
+encode_signature(#'RSAPublicKey'{}, Signature) ->
ssh_bits:encode(["ssh-rsa", Signature],[string, binary]);
-encode_sign(#'DSAPrivateKey'{}, Signature) ->
- ssh_bits:encode(["ssh-dss", Signature],[string, binary]).
+encode_signature({_, #'Dss-Parms'{}}, Signature) ->
+ ssh_bits:encode(["ssh-dss", Signature],[string, binary]);
+encode_signature({#'ECPoint'{}, {namedCurve,OID}}, Signature) ->
+ CurveName = public_key:oid2ssh_curvename(OID),
+ ssh_bits:encode([<<"ecdsa-sha2-",CurveName/binary>>, Signature], [binary,binary]).
+
diff --git a/lib/ssh/src/ssh_transport.erl b/lib/ssh/src/ssh_transport.erl
index 2b6f0a3cdc..d622ec27fc 100644
--- a/lib/ssh/src/ssh_transport.erl
+++ b/lib/ssh/src/ssh_transport.erl
@@ -44,7 +44,8 @@
handle_kexdh_reply/2,
handle_kex_ecdh_init/2,
handle_kex_ecdh_reply/2,
- unpack/3, decompress/2, ssh_packet/2, pack/2, msg_data/1,
+ extract_public_key/1,
+ unpack/3, decompress/2, ssh_packet/2, pack/2, pack/3, msg_data/1,
sign/3, verify/4]).
%%%----------------------------------------------------------------------------
@@ -65,9 +66,8 @@ default_algorithms() -> [{K,default_algorithms(K)} || K <- algo_classes()].
algo_classes() -> [kex, public_key, cipher, mac, compression].
-default_algorithms(compression) ->
- %% Do not announce '[email protected]' because there seem to be problems
- supported_algorithms(compression, same(['[email protected]']));
+%% default_algorithms(kex) -> % Example of how to disable an algorithm
+%% supported_algorithms(kex, ['ecdh-sha2-nistp521']);
default_algorithms(Alg) ->
supported_algorithms(Alg).
@@ -79,18 +79,27 @@ supported_algorithms(kex) ->
[
{'ecdh-sha2-nistp256', [{public_keys,ecdh}, {ec_curve,secp256r1}, {hashs,sha256}]},
{'ecdh-sha2-nistp384', [{public_keys,ecdh}, {ec_curve,secp384r1}, {hashs,sha384}]},
+ {'diffie-hellman-group14-sha1', [{public_keys,dh}, {hashs,sha}]},
+ {'diffie-hellman-group-exchange-sha256', [{public_keys,dh}, {hashs,sha256}]},
+ {'diffie-hellman-group-exchange-sha1', [{public_keys,dh}, {hashs,sha}]},
{'ecdh-sha2-nistp521', [{public_keys,ecdh}, {ec_curve,secp521r1}, {hashs,sha512}]},
- {'diffie-hellman-group14-sha1', [{public_keys,dh}, {hashs,sha}]},
- {'diffie-hellman-group-exchange-sha256', [{public_keys,dh}, {hashs,sha256}]},
- {'diffie-hellman-group-exchange-sha1', [{public_keys,dh}, {hashs,sha}]},
- {'diffie-hellman-group1-sha1', [{public_keys,dh}, {hashs,sha}]}
+ {'diffie-hellman-group1-sha1', [{public_keys,dh}, {hashs,sha}]}
]);
supported_algorithms(public_key) ->
- ssh_auth:default_public_key_algorithms();
+ select_crypto_supported(
+ [{'ecdsa-sha2-nistp256', [{public_keys,ecdsa}, {hashs,sha256}, {ec_curve,secp256r1}]},
+ {'ecdsa-sha2-nistp384', [{public_keys,ecdsa}, {hashs,sha384}, {ec_curve,secp384r1}]},
+ {'ecdsa-sha2-nistp521', [{public_keys,ecdsa}, {hashs,sha512}, {ec_curve,secp521r1}]},
+ {'ssh-rsa', [{public_keys,rsa}, {hashs,sha} ]},
+ {'ssh-dss', [{public_keys,dss}, {hashs,sha} ]}
+ ]);
+
supported_algorithms(cipher) ->
same(
select_crypto_supported(
- [{'aes128-ctr', [{ciphers,aes_ctr}]},
+ [{'aes256-ctr', [{ciphers,{aes_ctr,256}}]},
+ {'aes192-ctr', [{ciphers,{aes_ctr,192}}]},
+ {'aes128-ctr', [{ciphers,{aes_ctr,128}}]},
{'aes128-cbc', [{ciphers,aes_cbc128}]},
{'3des-cbc', [{ciphers,des3_cbc}]}
]
@@ -98,20 +107,22 @@ supported_algorithms(cipher) ->
supported_algorithms(mac) ->
same(
select_crypto_supported(
- [{'hmac-sha2-512', [{hashs,sha512}]},
- {'hmac-sha2-256', [{hashs,sha256}]},
+ [{'hmac-sha2-256', [{hashs,sha256}]},
+ {'hmac-sha2-512', [{hashs,sha512}]},
{'hmac-sha1', [{hashs,sha}]}
]
));
supported_algorithms(compression) ->
- same(['none','zlib','[email protected]']).
+ same(['none',
+ 'zlib'
+ ]).
-
-supported_algorithms(Key, [{client2server,BL1},{server2client,BL2}]) ->
- [{client2server,As1},{server2client,As2}] = supported_algorithms(Key),
- [{client2server,As1--BL1},{server2client,As2--BL2}];
-supported_algorithms(Key, BlackList) ->
- supported_algorithms(Key) -- BlackList.
+%% Dialyzer complains when not called...supported_algorithms(Key, [{client2server,BL1},{server2client,BL2}]) ->
+%% Dialyzer complains when not called... [{client2server,As1},{server2client,As2}] = supported_algorithms(Key),
+%% Dialyzer complains when not called... [{client2server,As1--BL1},{server2client,As2--BL2}];
+%% Dialyzer complains when not called...supported_algorithms(Key, BlackList) ->
+%% Dialyzer complains when not called... supported_algorithms(Key) -- BlackList.
select_crypto_supported(L) ->
Sup = [{ec_curve,crypto_supported_curves()} | crypto:supports()],
@@ -124,10 +135,25 @@ crypto_supported_curves() ->
end.
crypto_supported(Conditions, Supported) ->
- lists:all( fun({Tag,CryptoName}) ->
- lists:member(CryptoName, proplists:get_value(Tag,Supported,[]))
+ lists:all( fun({Tag,CryptoName}) when is_atom(CryptoName) ->
+ crypto_name_supported(Tag,CryptoName,Supported);
+ ({Tag,{Name=aes_ctr,Len}}) when is_integer(Len) ->
+ crypto_name_supported(Tag,Name,Supported) andalso
+ ctr_len_supported(Name,Len)
end, Conditions).
+crypto_name_supported(Tag, CryptoName, Supported) ->
+ lists:member(CryptoName, proplists:get_value(Tag,Supported,[])).
+
+ctr_len_supported(Name, Len) ->
+ try
+ crypto:stream_encrypt(crypto:stream_init(Name, <<0:Len>>, <<0:128>>), <<"">>)
+ of
+ {_,X} -> is_binary(X)
+ catch
+ _:_ -> false
+ end.
+
same(Algs) -> [{client2server,Algs}, {server2client,Algs}].
@@ -303,9 +329,7 @@ verify_algorithm(#alg{encrypt = undefined}) -> false;
verify_algorithm(#alg{decrypt = undefined}) -> false;
verify_algorithm(#alg{compress = undefined}) -> false;
verify_algorithm(#alg{decompress = undefined}) -> false;
-
-verify_algorithm(#alg{kex = Kex}) -> lists:member(Kex, supported_algorithms(kex));
-verify_algorithm(_) -> false.
+verify_algorithm(#alg{kex = Kex}) -> lists:member(Kex, supported_algorithms(kex)).
%%%----------------------------------------------------------------
%%%
@@ -319,11 +343,12 @@ key_exchange_first_msg(Kex, Ssh0) when Kex == 'diffie-hellman-group1-sha1' ;
{ok, SshPacket,
Ssh1#ssh{keyex_key = {{Private, Public}, {G, P}}}};
-key_exchange_first_msg(Kex, Ssh0) when Kex == 'diffie-hellman-group-exchange-sha1' ;
- Kex == 'diffie-hellman-group-exchange-sha256' ->
- Min = ?DEFAULT_DH_GROUP_MIN,
- NBits = ?DEFAULT_DH_GROUP_NBITS,
- Max = ?DEFAULT_DH_GROUP_MAX,
+key_exchange_first_msg(Kex, Ssh0=#ssh{opts=Opts}) when Kex == 'diffie-hellman-group-exchange-sha1' ;
+ Kex == 'diffie-hellman-group-exchange-sha256' ->
+ {Min,NBits,Max} =
+ proplists:get_value(dh_gex_limits, Opts, {?DEFAULT_DH_GROUP_MIN,
+ ?DEFAULT_DH_GROUP_NBITS,
+ ?DEFAULT_DH_GROUP_MAX}),
{SshPacket, Ssh1} =
ssh_packet(#ssh_msg_kex_dh_gex_request{min = Min,
n = NBits,
@@ -354,13 +379,15 @@ handle_kexdh_init(#ssh_msg_kexdh_init{e = E},
1=<E, E=<(P-1) ->
{Public, Private} = generate_key(dh, [P,G]),
K = compute_key(dh, E, Private, [P,G]),
- Key = get_host_key(Ssh0),
- H = kex_h(Ssh0, Key, E, Public, K),
- H_SIG = sign_host_key(Ssh0, Key, H),
- {SshPacket, Ssh1} = ssh_packet(#ssh_msg_kexdh_reply{public_host_key = Key,
- f = Public,
- h_sig = H_SIG
- }, Ssh0),
+ MyPrivHostKey = get_host_key(Ssh0),
+ MyPubHostKey = extract_public_key(MyPrivHostKey),
+ H = kex_h(Ssh0, MyPubHostKey, E, Public, K),
+ H_SIG = sign_host_key(Ssh0, MyPrivHostKey, H),
+ {SshPacket, Ssh1} =
+ ssh_packet(#ssh_msg_kexdh_reply{public_host_key = MyPubHostKey,
+ f = Public,
+ h_sig = H_SIG
+ }, Ssh0),
{ok, SshPacket, Ssh1#ssh{keyex_key = {{Private, Public}, {G, P}},
shared_secret = K,
exchanged_hash = H,
@@ -375,7 +402,7 @@ handle_kexdh_init(#ssh_msg_kexdh_init{e = E},
})
end.
-handle_kexdh_reply(#ssh_msg_kexdh_reply{public_host_key = HostKey,
+handle_kexdh_reply(#ssh_msg_kexdh_reply{public_host_key = PeerPubHostKey,
f = F,
h_sig = H_SIG},
#ssh{keyex_key = {{Private, Public}, {G, P}}} = Ssh0) ->
@@ -383,9 +410,9 @@ handle_kexdh_reply(#ssh_msg_kexdh_reply{public_host_key = HostKey,
if
1=<F, F=<(P-1)->
K = compute_key(dh, F, Private, [P,G]),
- H = kex_h(Ssh0, HostKey, Public, F, K),
+ H = kex_h(Ssh0, PeerPubHostKey, Public, F, K),
- case verify_host_key(Ssh0, HostKey, H, H_SIG) of
+ case verify_host_key(Ssh0, PeerPubHostKey, H, H_SIG) of
ok ->
{SshPacket, Ssh} = ssh_packet(#ssh_msg_newkeys{}, Ssh0),
{ok, SshPacket, Ssh#ssh{shared_secret = K,
@@ -454,11 +481,12 @@ handle_kex_dh_gex_init(#ssh_msg_kex_dh_gex_init{e = E},
K = compute_key(dh, E, Private, [P,G]),
if
1<K, K<(P-1) ->
- HostKey = get_host_key(Ssh0),
- H = kex_h(Ssh0, HostKey, Min, NBits, Max, P, G, E, Public, K),
- H_SIG = sign_host_key(Ssh0, HostKey, H),
+ MyPrivHostKey = get_host_key(Ssh0),
+ MyPubHostKey = extract_public_key(MyPrivHostKey),
+ H = kex_h(Ssh0, MyPubHostKey, Min, NBits, Max, P, G, E, Public, K),
+ H_SIG = sign_host_key(Ssh0, MyPrivHostKey, H),
{SshPacket, Ssh} =
- ssh_packet(#ssh_msg_kex_dh_gex_reply{public_host_key = HostKey,
+ ssh_packet(#ssh_msg_kex_dh_gex_reply{public_host_key = MyPubHostKey,
f = Public,
h_sig = H_SIG}, Ssh0),
{ok, SshPacket, Ssh#ssh{shared_secret = K,
@@ -482,7 +510,7 @@ handle_kex_dh_gex_init(#ssh_msg_kex_dh_gex_init{e = E},
})
end.
-handle_kex_dh_gex_reply(#ssh_msg_kex_dh_gex_reply{public_host_key = HostKey,
+handle_kex_dh_gex_reply(#ssh_msg_kex_dh_gex_reply{public_host_key = PeerPubHostKey,
f = F,
h_sig = H_SIG},
#ssh{keyex_key = {{Private, Public}, {G, P}},
@@ -494,9 +522,9 @@ handle_kex_dh_gex_reply(#ssh_msg_kex_dh_gex_reply{public_host_key = HostKey,
K = compute_key(dh, F, Private, [P,G]),
if
1<K, K<(P-1) ->
- H = kex_h(Ssh0, HostKey, Min, NBits, Max, P, G, Public, F, K),
+ H = kex_h(Ssh0, PeerPubHostKey, Min, NBits, Max, P, G, Public, F, K),
- case verify_host_key(Ssh0, HostKey, H, H_SIG) of
+ case verify_host_key(Ssh0, PeerPubHostKey, H, H_SIG) of
ok ->
{SshPacket, Ssh} = ssh_packet(#ssh_msg_newkeys{}, Ssh0),
{ok, SshPacket, Ssh#ssh{shared_secret = K,
@@ -539,11 +567,12 @@ handle_kex_ecdh_init(#ssh_msg_kex_ecdh_init{q_c = PeerPublic},
true ->
{MyPublic, MyPrivate} = generate_key(ecdh, Curve),
K = compute_key(ecdh, PeerPublic, MyPrivate, Curve),
- HostKey = get_host_key(Ssh0),
- H = kex_h(Ssh0, Curve, HostKey, PeerPublic, MyPublic, K),
- H_SIG = sign_host_key(Ssh0, HostKey, H),
+ MyPrivHostKey = get_host_key(Ssh0),
+ MyPubHostKey = extract_public_key(MyPrivHostKey),
+ H = kex_h(Ssh0, Curve, MyPubHostKey, PeerPublic, MyPublic, K),
+ H_SIG = sign_host_key(Ssh0, MyPrivHostKey, H),
{SshPacket, Ssh1} =
- ssh_packet(#ssh_msg_kex_ecdh_reply{public_host_key = HostKey,
+ ssh_packet(#ssh_msg_kex_ecdh_reply{public_host_key = MyPubHostKey,
q_s = MyPublic,
h_sig = H_SIG},
Ssh0),
@@ -561,7 +590,7 @@ handle_kex_ecdh_init(#ssh_msg_kex_ecdh_init{q_c = PeerPublic},
})
end.
-handle_kex_ecdh_reply(#ssh_msg_kex_ecdh_reply{public_host_key = HostKey,
+handle_kex_ecdh_reply(#ssh_msg_kex_ecdh_reply{public_host_key = PeerPubHostKey,
q_s = PeerPublic,
h_sig = H_SIG},
#ssh{keyex_key = {{MyPublic,MyPrivate}, Curve}} = Ssh0
@@ -570,8 +599,8 @@ handle_kex_ecdh_reply(#ssh_msg_kex_ecdh_reply{public_host_key = HostKey,
case ecdh_validate_public_key(PeerPublic, Curve) of
true ->
K = compute_key(ecdh, PeerPublic, MyPrivate, Curve),
- H = kex_h(Ssh0, Curve, HostKey, MyPublic, PeerPublic, K),
- case verify_host_key(Ssh0, HostKey, H, H_SIG) of
+ H = kex_h(Ssh0, Curve, PeerPubHostKey, MyPublic, PeerPublic, K),
+ case verify_host_key(Ssh0, PeerPubHostKey, H, H_SIG) of
ok ->
{SshPacket, Ssh} = ssh_packet(#ssh_msg_newkeys{}, Ssh0),
{ok, SshPacket, Ssh#ssh{shared_secret = K,
@@ -596,7 +625,61 @@ handle_kex_ecdh_reply(#ssh_msg_kex_ecdh_reply{public_host_key = HostKey,
end.
-ecdh_validate_public_key(_, _) -> true. % FIXME: Far too many false positives :)
+%%%----------------------------------------------------------------
+%%%
+%%% Standards for Efficient Cryptography Group, "Elliptic Curve Cryptography", SEC 1
+%%% Section 3.2.2.1
+%%%
+
+ecdh_validate_public_key(Key, Curve) ->
+ case key_size(Curve) of
+ undefined ->
+ false;
+
+ Sz ->
+ case dec_key(Key, Sz) of
+ {ok,Q} ->
+ case crypto:ec_curve(Curve) of
+ {{prime_field,P}, {A, B, _Seed},
+ _P0Bin, _OrderBin, _CoFactorBin} ->
+ on_curve(Q, bin2int(A), bin2int(B), bin2int(P))
+ end;
+
+ {error,compressed_not_implemented} -> % Be a bit generous...
+ true;
+
+ _Error ->
+ false
+ end
+ end.
+
+
+on_curve({X,Y}, A, B, P) when 0 =< X,X =< (P-1),
+ 0 =< Y,Y =< (P-1) ->
+ %% Section 3.2.2.1, point 2
+ (Y*Y) rem P == (X*X*X + A*X + B) rem P;
+on_curve(_, _, _, _) ->
+ false.
+
+
+bin2int(B) ->
+ Sz = erlang:bit_size(B),
+ <<I:Sz/big-unsigned-integer>> = B,
+ I.
+
+key_size(secp256r1) -> 256;
+key_size(secp384r1) -> 384;
+key_size(secp521r1) -> 528; % Round 521 up to closest 8-bits.
+key_size(_) -> undefined.
+
+
+dec_key(Key, NBits) ->
+ Size = 8 + 2*NBits,
+ case <<Key:Size>> of
+ <<4:8, X:NBits, Y:NBits>> -> {ok,{X,Y}};
+ <<4:8, _/binary>> -> {error,bad_format};
+ _ -> {error,compressed_not_implemented}
+ end.
%%%----------------------------------------------------------------
handle_new_keys(#ssh_msg_newkeys{}, Ssh0) ->
@@ -623,33 +706,49 @@ get_host_key(SSH) ->
#ssh{key_cb = Mod, opts = Opts, algorithms = ALG} = SSH,
case Mod:host_key(ALG#alg.hkey, Opts) of
- {ok, #'RSAPrivateKey'{} = Key} ->
- Key;
- {ok, #'DSAPrivateKey'{} = Key} ->
- Key;
+ {ok, #'RSAPrivateKey'{} = Key} -> Key;
+ {ok, #'DSAPrivateKey'{} = Key} -> Key;
+ {ok, #'ECPrivateKey'{} = Key} -> Key;
Result ->
exit({error, {Result, unsupported_key_type}})
end.
-sign_host_key(_Ssh, #'RSAPrivateKey'{} = Private, H) ->
- Hash = sha,
- _Signature = sign(H, Hash, Private);
-sign_host_key(_Ssh, #'DSAPrivateKey'{} = Private, H) ->
- Hash = sha,
- _RawSignature = sign(H, Hash, Private).
+sign_host_key(_Ssh, PrivateKey, H) ->
+ sign(H, sign_host_key_sha(PrivateKey), PrivateKey).
+
+sign_host_key_sha(#'ECPrivateKey'{parameters = {namedCurve,OID}}) -> sha(OID);
+sign_host_key_sha(#'RSAPrivateKey'{}) -> sha;
+sign_host_key_sha(#'DSAPrivateKey'{}) -> sha.
+
+
+extract_public_key(#'RSAPrivateKey'{modulus = N, publicExponent = E}) ->
+ #'RSAPublicKey'{modulus = N, publicExponent = E};
+extract_public_key(#'DSAPrivateKey'{y = Y, p = P, q = Q, g = G}) ->
+ {Y, #'Dss-Parms'{p=P, q=Q, g=G}};
+extract_public_key(#'ECPrivateKey'{parameters = {namedCurve,OID},
+ publicKey = Q}) ->
+ {#'ECPoint'{point=Q}, {namedCurve,OID}}.
+
verify_host_key(SSH, PublicKey, Digest, Signature) ->
- case verify(Digest, sha, Signature, PublicKey) of
+ case verify(Digest, host_key_sha(PublicKey), Signature, PublicKey) of
false ->
{error, bad_signature};
true ->
known_host_key(SSH, PublicKey, public_algo(PublicKey))
end.
-public_algo(#'RSAPublicKey'{}) ->
- 'ssh-rsa';
-public_algo({_, #'Dss-Parms'{}}) ->
- 'ssh-dss'.
+
+host_key_sha(#'RSAPublicKey'{}) -> sha;
+host_key_sha({_, #'Dss-Parms'{}}) -> sha;
+host_key_sha({#'ECPoint'{},{namedCurve,OID}}) -> sha(OID).
+
+public_algo(#'RSAPublicKey'{}) -> 'ssh-rsa';
+public_algo({_, #'Dss-Parms'{}}) -> 'ssh-dss';
+public_algo({#'ECPoint'{},{namedCurve,OID}}) ->
+ Curve = public_key:oid2ssh_curvename(OID),
+ list_to_atom("ecdsa-sha2-" ++ binary_to_list(Curve)).
+
accepted_host(Ssh, PeerName, Opts) ->
case proplists:get_value(silently_accept_hosts, Opts, false) of
@@ -830,11 +929,18 @@ ssh_packet(Msg, Ssh) ->
BinMsg = ssh_message:encode(Msg),
pack(BinMsg, Ssh).
+pack(Data, Ssh=#ssh{}) ->
+ pack(Data, Ssh, 0).
+
+%%% Note: pack/3 is only to be called from tests that wants
+%%% to deliberetly send packets with wrong PacketLength!
+%%% Use pack/2 for all other purposes!
pack(Data0, #ssh{encrypt_block_size = BlockSize,
send_sequence = SeqNum, send_mac = MacAlg,
send_mac_key = MacKey,
random_length_padding = RandomLengthPadding}
- = Ssh0) when is_binary(Data0) ->
+ = Ssh0,
+ PacketLenDeviationForTests) when is_binary(Data0) ->
{Ssh1, Data} = compress(Ssh0, Data0),
PL = (BlockSize - ((4 + 1 + size(Data)) rem BlockSize)) rem BlockSize,
MinPaddingLen = if PL < 4 -> PL + BlockSize;
@@ -847,7 +953,7 @@ pack(Data0, #ssh{encrypt_block_size = BlockSize,
end,
PaddingLen = MinPaddingLen + ExtraPaddingLen,
Padding = ssh_bits:random(PaddingLen),
- PacketLen = 1 + PaddingLen + size(Data),
+ PacketLen = 1 + PaddingLen + size(Data) + PacketLenDeviationForTests,
PacketData = <<?UINT32(PacketLen),?BYTE(PaddingLen),
Data/binary, Padding/binary>>,
{Ssh2, EncPacket} = encrypt(Ssh1, PacketData),
@@ -889,6 +995,10 @@ sign(SigData, Hash, #'DSAPrivateKey'{} = Key) ->
DerSignature = public_key:sign(SigData, Hash, Key),
#'Dss-Sig-Value'{r = R, s = S} = public_key:der_decode('Dss-Sig-Value', DerSignature),
<<R:160/big-unsigned-integer, S:160/big-unsigned-integer>>;
+sign(SigData, Hash, Key = #'ECPrivateKey'{}) ->
+ DerEncodedSign = public_key:sign(SigData, Hash, Key),
+ #'ECDSA-Sig-Value'{r=R, s=S} = public_key:der_decode('ECDSA-Sig-Value', DerEncodedSign),
+ ssh_bits:encode([R,S], [mpint,mpint]);
sign(SigData, Hash, Key) ->
public_key:sign(SigData, Hash, Key).
@@ -896,55 +1006,18 @@ verify(PlainText, Hash, Sig, {_, #'Dss-Parms'{}} = Key) ->
<<R:160/big-unsigned-integer, S:160/big-unsigned-integer>> = Sig,
Signature = public_key:der_encode('Dss-Sig-Value', #'Dss-Sig-Value'{r = R, s = S}),
public_key:verify(PlainText, Hash, Signature, Key);
+verify(PlainText, Hash, Sig, {#'ECPoint'{},_} = Key) ->
+ <<?UINT32(Rlen),R:Rlen/big-signed-integer-unit:8,
+ ?UINT32(Slen),S:Slen/big-signed-integer-unit:8>> = Sig,
+ Sval = #'ECDSA-Sig-Value'{r=R, s=S},
+ DerEncodedSig = public_key:der_encode('ECDSA-Sig-Value',Sval),
+ public_key:verify(PlainText, Hash, DerEncodedSig, Key);
verify(PlainText, Hash, Sig, Key) ->
public_key:verify(PlainText, Hash, Sig, Key).
-%% public key algorithms
-%%
-%% ssh-dss REQUIRED sign Raw DSS Key
-%% ssh-rsa RECOMMENDED sign Raw RSA Key
-%% x509v3-sign-rsa OPTIONAL sign X.509 certificates (RSA key)
-%% x509v3-sign-dss OPTIONAL sign X.509 certificates (DSS key)
-%% spki-sign-rsa OPTIONAL sign SPKI certificates (RSA key)
-%% spki-sign-dss OPTIONAL sign SPKI certificates (DSS key)
-%% pgp-sign-rsa OPTIONAL sign OpenPGP certificates (RSA key)
-%% pgp-sign-dss OPTIONAL sign OpenPGP certificates (DSS key)
-%%
-
-%% key exchange
-%%
-%% diffie-hellman-group1-sha1 REQUIRED
-%% diffie-hellman-group14-sha1 REQUIRED
-%%
-%%
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% Encryption
-%%
-%% chiphers
%%
-%% 3des-cbc REQUIRED
-%% three-key 3DES in CBC mode
-%% blowfish-cbc OPTIONAL Blowfish in CBC mode
-%% twofish256-cbc OPTIONAL Twofish in CBC mode,
-%% with 256-bit key
-%% twofish-cbc OPTIONAL alias for "twofish256-cbc" (this
-%% is being retained for
-%% historical reasons)
-%% twofish192-cbc OPTIONAL Twofish with 192-bit key
-%% twofish128-cbc OPTIONAL Twofish with 128-bit key
-%% aes256-cbc OPTIONAL AES in CBC mode,
-%% with 256-bit key
-%% aes192-cbc OPTIONAL AES with 192-bit key
-%% aes128-cbc RECOMMENDED AES with 128-bit key
-%% serpent256-cbc OPTIONAL Serpent in CBC mode, with
-%% 256-bit key
-%% serpent192-cbc OPTIONAL Serpent with 192-bit key
-%% serpent128-cbc OPTIONAL Serpent with 128-bit key
-%% arcfour OPTIONAL the ARCFOUR stream cipher
-%% idea-cbc OPTIONAL IDEA in CBC mode
-%% cast128-cbc OPTIONAL CAST-128 in CBC mode
-%% none OPTIONAL no encryption; NOT RECOMMENDED
+%% Encryption
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -975,18 +1048,46 @@ encrypt_init(#ssh{encrypt = 'aes128-cbc', role = server} = Ssh) ->
encrypt_block_size = 16,
encrypt_ctx = IV}};
encrypt_init(#ssh{encrypt = 'aes128-ctr', role = client} = Ssh) ->
- IV = hash(Ssh, "A", 128),
+ IV = hash(Ssh, "A", 128),
<<K:16/binary>> = hash(Ssh, "C", 128),
State = crypto:stream_init(aes_ctr, K, IV),
{ok, Ssh#ssh{encrypt_keys = K,
encrypt_block_size = 16,
encrypt_ctx = State}};
+encrypt_init(#ssh{encrypt = 'aes192-ctr', role = client} = Ssh) ->
+ IV = hash(Ssh, "A", 128),
+ <<K:24/binary>> = hash(Ssh, "C", 192),
+ State = crypto:stream_init(aes_ctr, K, IV),
+ {ok, Ssh#ssh{encrypt_keys = K,
+ encrypt_block_size = 16,
+ encrypt_ctx = State}};
+encrypt_init(#ssh{encrypt = 'aes256-ctr', role = client} = Ssh) ->
+ IV = hash(Ssh, "A", 128),
+ <<K:32/binary>> = hash(Ssh, "C", 256),
+ State = crypto:stream_init(aes_ctr, K, IV),
+ {ok, Ssh#ssh{encrypt_keys = K,
+ encrypt_block_size = 16,
+ encrypt_ctx = State}};
encrypt_init(#ssh{encrypt = 'aes128-ctr', role = server} = Ssh) ->
- IV = hash(Ssh, "B", 128),
+ IV = hash(Ssh, "B", 128),
<<K:16/binary>> = hash(Ssh, "D", 128),
State = crypto:stream_init(aes_ctr, K, IV),
{ok, Ssh#ssh{encrypt_keys = K,
encrypt_block_size = 16,
+ encrypt_ctx = State}};
+encrypt_init(#ssh{encrypt = 'aes192-ctr', role = server} = Ssh) ->
+ IV = hash(Ssh, "B", 128),
+ <<K:24/binary>> = hash(Ssh, "D", 192),
+ State = crypto:stream_init(aes_ctr, K, IV),
+ {ok, Ssh#ssh{encrypt_keys = K,
+ encrypt_block_size = 16,
+ encrypt_ctx = State}};
+encrypt_init(#ssh{encrypt = 'aes256-ctr', role = server} = Ssh) ->
+ IV = hash(Ssh, "B", 128),
+ <<K:32/binary>> = hash(Ssh, "D", 256),
+ State = crypto:stream_init(aes_ctr, K, IV),
+ {ok, Ssh#ssh{encrypt_keys = K,
+ encrypt_block_size = 16,
encrypt_ctx = State}}.
encrypt_final(Ssh) ->
@@ -1013,6 +1114,14 @@ encrypt(#ssh{encrypt = 'aes128-cbc',
encrypt(#ssh{encrypt = 'aes128-ctr',
encrypt_ctx = State0} = Ssh, Data) ->
{State, Enc} = crypto:stream_encrypt(State0,Data),
+ {Ssh#ssh{encrypt_ctx = State}, Enc};
+encrypt(#ssh{encrypt = 'aes192-ctr',
+ encrypt_ctx = State0} = Ssh, Data) ->
+ {State, Enc} = crypto:stream_encrypt(State0,Data),
+ {Ssh#ssh{encrypt_ctx = State}, Enc};
+encrypt(#ssh{encrypt = 'aes256-ctr',
+ encrypt_ctx = State0} = Ssh, Data) ->
+ {State, Enc} = crypto:stream_encrypt(State0,Data),
{Ssh#ssh{encrypt_ctx = State}, Enc}.
@@ -1053,12 +1162,40 @@ decrypt_init(#ssh{decrypt = 'aes128-ctr', role = client} = Ssh) ->
{ok, Ssh#ssh{decrypt_keys = K,
decrypt_block_size = 16,
decrypt_ctx = State}};
+decrypt_init(#ssh{decrypt = 'aes192-ctr', role = client} = Ssh) ->
+ IV = hash(Ssh, "B", 128),
+ <<K:24/binary>> = hash(Ssh, "D", 192),
+ State = crypto:stream_init(aes_ctr, K, IV),
+ {ok, Ssh#ssh{decrypt_keys = K,
+ decrypt_block_size = 16,
+ decrypt_ctx = State}};
+decrypt_init(#ssh{decrypt = 'aes256-ctr', role = client} = Ssh) ->
+ IV = hash(Ssh, "B", 128),
+ <<K:32/binary>> = hash(Ssh, "D", 256),
+ State = crypto:stream_init(aes_ctr, K, IV),
+ {ok, Ssh#ssh{decrypt_keys = K,
+ decrypt_block_size = 16,
+ decrypt_ctx = State}};
decrypt_init(#ssh{decrypt = 'aes128-ctr', role = server} = Ssh) ->
IV = hash(Ssh, "A", 128),
<<K:16/binary>> = hash(Ssh, "C", 128),
State = crypto:stream_init(aes_ctr, K, IV),
{ok, Ssh#ssh{decrypt_keys = K,
decrypt_block_size = 16,
+ decrypt_ctx = State}};
+decrypt_init(#ssh{decrypt = 'aes192-ctr', role = server} = Ssh) ->
+ IV = hash(Ssh, "A", 128),
+ <<K:24/binary>> = hash(Ssh, "C", 192),
+ State = crypto:stream_init(aes_ctr, K, IV),
+ {ok, Ssh#ssh{decrypt_keys = K,
+ decrypt_block_size = 16,
+ decrypt_ctx = State}};
+decrypt_init(#ssh{decrypt = 'aes256-ctr', role = server} = Ssh) ->
+ IV = hash(Ssh, "A", 128),
+ <<K:32/binary>> = hash(Ssh, "C", 256),
+ State = crypto:stream_init(aes_ctr, K, IV),
+ {ok, Ssh#ssh{decrypt_keys = K,
+ decrypt_block_size = 16,
decrypt_ctx = State}}.
@@ -1084,6 +1221,14 @@ decrypt(#ssh{decrypt = 'aes128-cbc', decrypt_keys = Key,
decrypt(#ssh{decrypt = 'aes128-ctr',
decrypt_ctx = State0} = Ssh, Data) ->
{State, Enc} = crypto:stream_decrypt(State0,Data),
+ {Ssh#ssh{decrypt_ctx = State}, Enc};
+decrypt(#ssh{decrypt = 'aes192-ctr',
+ decrypt_ctx = State0} = Ssh, Data) ->
+ {State, Enc} = crypto:stream_decrypt(State0,Data),
+ {Ssh#ssh{decrypt_ctx = State}, Enc};
+decrypt(#ssh{decrypt = 'aes256-ctr',
+ decrypt_ctx = State0} = Ssh, Data) ->
+ {State, Enc} = crypto:stream_decrypt(State0,Data),
{Ssh#ssh{decrypt_ctx = State}, Enc}.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -1168,17 +1313,8 @@ decompress(#ssh{decompress = '[email protected]', decompress_ctx = Context, authe
{Ssh, list_to_binary(Decompressed)}.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% MAC calculation
%%
-%% hmac-sha1 REQUIRED HMAC-SHA1 (digest length = key
-%% length = 20)
-%% hmac-sha1-96 RECOMMENDED first 96 bits of HMAC-SHA1 (digest
-%% length = 12, key length = 20)
-%% hmac-md5 OPTIONAL HMAC-MD5 (digest length = key
-%% length = 16)
-%% hmac-md5-96 OPTIONAL first 96 bits of HMAC-MD5 (digest
-%% length = 12, key length = 16)
-%% none OPTIONAL no MAC; NOT RECOMMENDED
+%% MAC calculation
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -1268,52 +1404,58 @@ hash(K, H, Ki, N, HASH) ->
hash(K, H, <<Ki/binary, Kj/binary>>, N-128, HASH).
kex_h(SSH, Key, E, F, K) ->
+ KeyBin = public_key:ssh_encode(Key, ssh2_pubkey),
L = ssh_bits:encode([SSH#ssh.c_version, SSH#ssh.s_version,
SSH#ssh.c_keyinit, SSH#ssh.s_keyinit,
- ssh_message:encode_host_key(Key), E,F,K],
+ KeyBin, E,F,K],
[string,string,binary,binary,binary,
mpint,mpint,mpint]),
crypto:hash(sha((SSH#ssh.algorithms)#alg.kex), L).
%% crypto:hash(sha,L).
kex_h(SSH, Curve, Key, Q_c, Q_s, K) ->
+ KeyBin = public_key:ssh_encode(Key, ssh2_pubkey),
L = ssh_bits:encode([SSH#ssh.c_version, SSH#ssh.s_version,
SSH#ssh.c_keyinit, SSH#ssh.s_keyinit,
- ssh_message:encode_host_key(Key), Q_c, Q_s, K],
+ KeyBin, Q_c, Q_s, K],
[string,string,binary,binary,binary,
mpint,mpint,mpint]),
crypto:hash(sha(Curve), L).
kex_h(SSH, Key, Min, NBits, Max, Prime, Gen, E, F, K) ->
L = if Min==-1; Max==-1 ->
+ KeyBin = public_key:ssh_encode(Key, ssh2_pubkey),
Ts = [string,string,binary,binary,binary,
uint32,
mpint,mpint,mpint,mpint,mpint],
ssh_bits:encode([SSH#ssh.c_version,SSH#ssh.s_version,
SSH#ssh.c_keyinit,SSH#ssh.s_keyinit,
- ssh_message:encode_host_key(Key), NBits, Prime, Gen, E,F,K],
+ KeyBin, NBits, Prime, Gen, E,F,K],
Ts);
true ->
+ KeyBin = public_key:ssh_encode(Key, ssh2_pubkey),
Ts = [string,string,binary,binary,binary,
uint32,uint32,uint32,
mpint,mpint,mpint,mpint,mpint],
ssh_bits:encode([SSH#ssh.c_version,SSH#ssh.s_version,
SSH#ssh.c_keyinit,SSH#ssh.s_keyinit,
- ssh_message:encode_host_key(Key), Min, NBits, Max,
+ KeyBin, Min, NBits, Max,
Prime, Gen, E,F,K], Ts)
end,
crypto:hash(sha((SSH#ssh.algorithms)#alg.kex), L).
-sha('nistp256') -> sha256;
-sha('secp256r1')-> sha256;
-sha('nistp384') -> sha384;
-sha('secp384r1')-> sha384;
-sha('nistp521') -> sha512;
-sha('secp521r1')-> sha512;
+
+sha(secp256r1) -> sha256;
+sha(secp384r1) -> sha384;
+sha(secp521r1) -> sha512;
sha('diffie-hellman-group1-sha1') -> sha;
sha('diffie-hellman-group14-sha1') -> sha;
sha('diffie-hellman-group-exchange-sha1') -> sha;
-sha('diffie-hellman-group-exchange-sha256') -> sha256.
+sha('diffie-hellman-group-exchange-sha256') -> sha256;
+sha(?'secp256r1') -> sha(secp256r1);
+sha(?'secp384r1') -> sha(secp384r1);
+sha(?'secp521r1') -> sha(secp521r1).
+
mac_key_size('hmac-sha1') -> 20*8;
mac_key_size('hmac-sha1-96') -> 20*8;
@@ -1350,7 +1492,7 @@ dh_gex_group(Min, N, Max, undefined) ->
dh_gex_group(Min, N, Max, dh_gex_default_groups());
dh_gex_group(Min, N, Max, Groups) ->
%% First try to find an exact match. If not an exact match, select the largest possible.
- {_,Group} =
+ {_Size,Group} =
lists:foldl(
fun(_, {I,G}) when I==N ->
%% If we have an exact match already: use that one
diff --git a/lib/ssh/src/ssh_transport.hrl b/lib/ssh/src/ssh_transport.hrl
index d962b1111f..337f455279 100644
--- a/lib/ssh/src/ssh_transport.hrl
+++ b/lib/ssh/src/ssh_transport.hrl
@@ -30,10 +30,10 @@
-define(DEFAULT_CLIENT_VERSION, {2, 0}).
-define(DEFAULT_SERVER_VERSION, {2, 0}).
--define(MAX_NUM_ALGORITHMS, 100).
+-define(MAX_NUM_ALGORITHMS, 200).
-define(DEFAULT_DH_GROUP_MIN, 1024).
--define(DEFAULT_DH_GROUP_NBITS, 6144).
+-define(DEFAULT_DH_GROUP_NBITS, 2048).
-define(DEFAULT_DH_GROUP_MAX, 8192).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -258,7 +258,8 @@
{8192,
{2, 16#FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A92108011A723C12A787E6D788719A10BDBA5B2699C327186AF4E23C1A946834B6150BDA2583E9CA2AD44CE8DBBBC2DB04DE8EF92E8EFC141FBECAA6287C59474E6BC05D99B2964FA090C3A2233BA186515BE7ED1F612970CEE2D7AFB81BDD762170481CD0069127D5B05AA993B4EA988D8FDDC186FFB7DC90A6C08F4DF435C93402849236C3FAB4D27C7026C1D4DCB2602646DEC9751E763DBA37BDF8FF9406AD9E530EE5DB382F413001AEB06A53ED9027D831179727B0865A8918DA3EDBEBCF9B14ED44CE6CBACED4BB1BDB7F1447E6CC254B332051512BD7AF426FB8F401378CD2BF5983CA01C64B92ECF032EA15D1721D03F482D7CE6E74FEF6D55E702F46980C82B5A84031900B1C9E59E7C97FBEC7E8F323A97A7E36CC88BE0F1D45B7FF585AC54BD407B22B4154AACC8F6D7EBF48E1D814CC5ED20F8037E0A79715EEF29BE32806A1D58BB7C5DA76F550AA3D8A1FBFF0EB19CCB1A313D55CDA56C9EC2EF29632387FE8D76E3C0468043E8F663F4860EE12BF2D5B0B7474D6E694F91E6DBE115974A3926F12FEE5E438777CB6A932DF8CD8BEC4D073B931BA3BC832B68D9DD300741FA7BF8AFC47ED2576F6936BA424663AAB639C5AE4F5683423B4742BF1C978238F16CBE39D652DE3FDB8BEFC848AD922222E04A4037C0713EB57A81A23F0C73473FC646CEA306B4BCBC8862F8385DDFA9D4B7FA2C087E879683303ED5BDD3A062B3CF5B3A278A66D2A13F83F44F82DDF310EE074AB6A364597E899A0255DC164F31CC50846851DF9AB48195DED7EA1B1D510BD7EE74D73FAF36BC31ECFA268359046F4EB879F924009438B481C6CD7889A002ED5EE382BC9190DA6FC026E479558E4475677E9AA9E3050E2765694DFC81F56E880B96E7160C980DD98EDD3DFFFFFFFFFFFFFFFFF}}).
--define(dh_default_groups, [?dh_group14,
+-define(dh_default_groups, [?dh_group1,
+ ?dh_group14,
?dh_group15,
?dh_group16,
?dh_group17,
diff --git a/lib/ssh/test/ssh_algorithms_SUITE.erl b/lib/ssh/test/ssh_algorithms_SUITE.erl
index e67fa2469f..2ab83d84e1 100644
--- a/lib/ssh/test/ssh_algorithms_SUITE.erl
+++ b/lib/ssh/test/ssh_algorithms_SUITE.erl
@@ -23,6 +23,7 @@
-module(ssh_algorithms_SUITE).
-include_lib("common_test/include/ct.hrl").
+-include_lib("ssh/src/ssh_transport.hrl").
%% Note: This directive should only be used in test suites.
-compile(export_all).
@@ -57,7 +58,7 @@ groups() ->
],
AlgoTcSet =
- [{Alg, [], specific_test_cases(Tag,Alg,SshcAlgos,SshdAlgos)}
+ [{Alg, [parallel], specific_test_cases(Tag,Alg,SshcAlgos,SshdAlgos)}
|| {Tag,Algs} <- ErlAlgos ++ DoubleAlgos,
Alg <- Algs],
@@ -72,11 +73,19 @@ init_per_suite(Config) ->
"OS ssh:~n=======~n~p~n~n~n"
"Erl ssh:~n========~n~p~n~n~n"
"Installed ssh client:~n=====================~n~p~n~n~n"
- "Installed ssh server:~n=====================~n~p~n~n~n",
- [os:cmd("ssh -V"),
+ "Installed ssh server:~n=====================~n~p~n~n~n"
+ "Misc values:~n============~n"
+ " -- Default dh group exchange parameters ({min,def,max}): ~p~n"
+ " -- dh_default_groups: ~p~n"
+ " -- Max num algorithms: ~p~n"
+ ,[os:cmd("ssh -V"),
ssh:default_algorithms(),
ssh_test_lib:default_algorithms(sshc),
- ssh_test_lib:default_algorithms(sshd)]),
+ ssh_test_lib:default_algorithms(sshd),
+ {?DEFAULT_DH_GROUP_MIN,?DEFAULT_DH_GROUP_NBITS,?DEFAULT_DH_GROUP_MAX},
+ [KeyLen || {KeyLen,_} <- ?dh_default_groups],
+ ?MAX_NUM_ALGORITHMS
+ ]),
ct:log("all() ->~n ~p.~n~ngroups()->~n ~p.~n",[all(),groups()]),
catch crypto:stop(),
case catch crypto:start() of
@@ -101,7 +110,8 @@ init_per_group(Group, Config) ->
Config;
false ->
%% An algorithm group
- [[{name,Tag}]|_] = ?config(tc_group_path, Config),
+ Tag = proplists:get_value(name,
+ hd(?config(tc_group_path, Config))),
Alg = Group,
PA =
case split(Alg) of
@@ -162,6 +172,21 @@ simple_exec(Config) ->
ssh_test_lib:std_simple_exec(Host, Port, Config).
%%--------------------------------------------------------------------
+%% Testing all default groups
+simple_exec_group14(Config) -> simple_exec_group(2048, Config).
+simple_exec_group15(Config) -> simple_exec_group(3072, Config).
+simple_exec_group16(Config) -> simple_exec_group(4096, Config).
+simple_exec_group17(Config) -> simple_exec_group(6144, Config).
+simple_exec_group18(Config) -> simple_exec_group(8192, Config).
+
+simple_exec_group(I, Config) ->
+ Min = I-100,
+ Max = I+100,
+ {Host,Port} = ?config(srvr_addr, Config),
+ ssh_test_lib:std_simple_exec(Host, Port, Config,
+ [{dh_gex_limits,{Min,I,Max}}]).
+
+%%--------------------------------------------------------------------
%% Use the ssh client of the OS to connect
sshc_simple_exec(Config) ->
PrivDir = ?config(priv_dir, Config),
@@ -254,6 +279,17 @@ specific_test_cases(Tag, Alg, SshcAlgos, SshdAlgos) ->
[sshd_simple_exec];
_ ->
[]
+ end ++
+ case {Tag,Alg} of
+ {kex,_} when Alg == 'diffie-hellman-group-exchange-sha1' ;
+ Alg == 'diffie-hellman-group-exchange-sha256' ->
+ [simple_exec_group14,
+ simple_exec_group15,
+ simple_exec_group16,
+ simple_exec_group17,
+ simple_exec_group18];
+ _ ->
+ []
end.
supports(Tag, Alg, Algos) ->
diff --git a/lib/ssh/test/ssh_basic_SUITE.erl b/lib/ssh/test/ssh_basic_SUITE.erl
index 51431da48e..400edb4d2c 100644
--- a/lib/ssh/test/ssh_basic_SUITE.erl
+++ b/lib/ssh/test/ssh_basic_SUITE.erl
@@ -77,6 +77,9 @@ all() ->
appup_test,
{group, dsa_key},
{group, rsa_key},
+ {group, ecdsa_sha2_nistp256_key},
+ {group, ecdsa_sha2_nistp384_key},
+ {group, ecdsa_sha2_nistp521_key},
{group, dsa_pass_key},
{group, rsa_pass_key},
{group, internal_error},
@@ -89,6 +92,9 @@ all() ->
groups() ->
[{dsa_key, [], basic_tests()},
{rsa_key, [], basic_tests()},
+ {ecdsa_sha2_nistp256_key, [], basic_tests()},
+ {ecdsa_sha2_nistp384_key, [], basic_tests()},
+ {ecdsa_sha2_nistp521_key, [], basic_tests()},
{dsa_pass_key, [], [pass_phrase]},
{rsa_pass_key, [], [pass_phrase]},
{internal_error, [], [internal_error]}
@@ -117,8 +123,6 @@ end_per_suite(_Config) ->
ssh:stop(),
crypto:stop().
%%--------------------------------------------------------------------
-init_per_group(hardening_tests, Config) ->
- init_per_group(dsa_key, Config);
init_per_group(dsa_key, Config) ->
DataDir = ?config(data_dir, Config),
PrivDir = ?config(priv_dir, Config),
@@ -129,6 +133,39 @@ init_per_group(rsa_key, Config) ->
PrivDir = ?config(priv_dir, Config),
ssh_test_lib:setup_rsa(DataDir, PrivDir),
Config;
+init_per_group(ecdsa_sha2_nistp256_key, Config) ->
+ case lists:member('ecdsa-sha2-nistp256',
+ ssh_transport:default_algorithms(public_key)) of
+ true ->
+ DataDir = ?config(data_dir, Config),
+ PrivDir = ?config(priv_dir, Config),
+ ssh_test_lib:setup_ecdsa("256", DataDir, PrivDir),
+ Config;
+ false ->
+ {skip, unsupported_pub_key}
+ end;
+init_per_group(ecdsa_sha2_nistp384_key, Config) ->
+ case lists:member('ecdsa-sha2-nistp384',
+ ssh_transport:default_algorithms(public_key)) of
+ true ->
+ DataDir = ?config(data_dir, Config),
+ PrivDir = ?config(priv_dir, Config),
+ ssh_test_lib:setup_ecdsa("384", DataDir, PrivDir),
+ Config;
+ false ->
+ {skip, unsupported_pub_key}
+ end;
+init_per_group(ecdsa_sha2_nistp521_key, Config) ->
+ case lists:member('ecdsa-sha2-nistp521',
+ ssh_transport:default_algorithms(public_key)) of
+ true ->
+ DataDir = ?config(data_dir, Config),
+ PrivDir = ?config(priv_dir, Config),
+ ssh_test_lib:setup_ecdsa("521", DataDir, PrivDir),
+ Config;
+ false ->
+ {skip, unsupported_pub_key}
+ end;
init_per_group(rsa_pass_key, Config) ->
DataDir = ?config(data_dir, Config),
PrivDir = ?config(priv_dir, Config),
@@ -190,8 +227,6 @@ init_per_group(dir_options, Config) ->
init_per_group(_, Config) ->
Config.
-end_per_group(hardening_tests, Config) ->
- end_per_group(dsa_key, Config);
end_per_group(dsa_key, Config) ->
PrivDir = ?config(priv_dir, Config),
ssh_test_lib:clean_dsa(PrivDir),
@@ -362,30 +397,36 @@ exec(Config) when is_list(Config) ->
%%--------------------------------------------------------------------
%%% Test that compression option works
exec_compressed(Config) when is_list(Config) ->
- process_flag(trap_exit, true),
- SystemDir = filename:join(?config(priv_dir, Config), system),
- UserDir = ?config(priv_dir, Config),
-
- {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir},{user_dir, UserDir},
- {preferred_algorithms,[{compression, [zlib]}]},
- {failfun, fun ssh_test_lib:failfun/2}]),
+ case ssh_test_lib:ssh_supports(zlib, compression) of
+ false ->
+ {skip, "zlib compression is not supported"};
+
+ true ->
+ process_flag(trap_exit, true),
+ SystemDir = filename:join(?config(priv_dir, Config), system),
+ UserDir = ?config(priv_dir, Config),
+
+ {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir},{user_dir, UserDir},
+ {preferred_algorithms,[{compression, [zlib]}]},
+ {failfun, fun ssh_test_lib:failfun/2}]),
- ConnectionRef =
- ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true},
- {user_dir, UserDir},
- {user_interaction, false}]),
- {ok, ChannelId} = ssh_connection:session_channel(ConnectionRef, infinity),
- success = ssh_connection:exec(ConnectionRef, ChannelId,
- "1+1.", infinity),
- Data = {ssh_cm, ConnectionRef, {data, ChannelId, 0, <<"2\n">>}},
- case ssh_test_lib:receive_exec_result(Data) of
- expected ->
- ok;
- Other ->
- ct:fail(Other)
- end,
- ssh_test_lib:receive_exec_end(ConnectionRef, ChannelId),
- ssh:stop_daemon(Pid).
+ ConnectionRef =
+ ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true},
+ {user_dir, UserDir},
+ {user_interaction, false}]),
+ {ok, ChannelId} = ssh_connection:session_channel(ConnectionRef, infinity),
+ success = ssh_connection:exec(ConnectionRef, ChannelId,
+ "1+1.", infinity),
+ Data = {ssh_cm, ConnectionRef, {data, ChannelId, 0, <<"2\n">>}},
+ case ssh_test_lib:receive_exec_result(Data) of
+ expected ->
+ ok;
+ Other ->
+ ct:fail(Other)
+ end,
+ ssh_test_lib:receive_exec_end(ConnectionRef, ChannelId),
+ ssh:stop_daemon(Pid)
+ end.
%%--------------------------------------------------------------------
%%% Idle timeout test
@@ -428,6 +469,8 @@ shell(Config) when is_list(Config) ->
ErlShellStart ->
ct:log("Erlang shell start: ~p~n", [ErlShellStart]),
do_shell(IO, Shell)
+ after
+ 30000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end.
%%--------------------------------------------------------------------
@@ -456,11 +499,15 @@ cli(Config) when is_list(Config) ->
{ssh_cm, ConnectionRef,
{data,0,0, <<"\r\nYou are accessing a dummy, type \"q\" to exit\r\n\n">>}} ->
ok = ssh_connection:send(ConnectionRef, ChannelId, <<"q">>)
+ after
+ 30000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end,
receive
{ssh_cm, ConnectionRef,{closed, ChannelId}} ->
ok
+ after
+ 30000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end.
%%--------------------------------------------------------------------
@@ -599,7 +646,7 @@ peername_sockname(Config) when is_list(Config) ->
host_equal(HostSockSrv, Host),
PortSockSrv = Port
after 10000 ->
- throw(timeout)
+ ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end.
host_equal(H1, H2) ->
@@ -633,7 +680,7 @@ close(Config) when is_list(Config) ->
{ssh_cm, Client,{closed, ChannelId}} ->
ok
after 5000 ->
- ct:fail(timeout)
+ ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end.
%%--------------------------------------------------------------------
@@ -708,22 +755,28 @@ shell_unicode_string(Config) ->
%%--------------------------------------------------------------------
%%% Test basic connection with openssh_zlib
openssh_zlib_basic_test(Config) ->
- SystemDir = filename:join(?config(priv_dir, Config), system),
- UserDir = ?config(priv_dir, Config),
+ case ssh_test_lib:ssh_supports(['[email protected]',none], compression) of
+ {false,L} ->
+ {skip, io_lib:format("~p compression is not supported",[L])};
- {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir},
- {user_dir, UserDir},
- {preferred_algorithms,[{compression, ['[email protected]']}]},
- {failfun, fun ssh_test_lib:failfun/2}]),
- ConnectionRef =
- ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true},
- {user_dir, UserDir},
- {user_interaction, false},
- {preferred_algorithms,[{compression, ['[email protected]',
- none]}]}
- ]),
- ok = ssh:close(ConnectionRef),
- ssh:stop_daemon(Pid).
+ true ->
+ SystemDir = filename:join(?config(priv_dir, Config), system),
+ UserDir = ?config(priv_dir, Config),
+
+ {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir},
+ {user_dir, UserDir},
+ {preferred_algorithms,[{compression, ['[email protected]']}]},
+ {failfun, fun ssh_test_lib:failfun/2}]),
+ ConnectionRef =
+ ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true},
+ {user_dir, UserDir},
+ {user_interaction, false},
+ {preferred_algorithms,[{compression, ['[email protected]',
+ none]}]}
+ ]),
+ ok = ssh:close(ConnectionRef),
+ ssh:stop_daemon(Pid)
+ end.
%%--------------------------------------------------------------------
ssh_info_print(Config) ->
@@ -825,22 +878,32 @@ do_shell(IO, Shell) ->
receive
Echo0 ->
ct:log("Echo: ~p ~n", [Echo0])
+ after
+ 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end,
receive
?NEWLINE ->
ok
+ after
+ 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end,
receive
Result0 = <<"2">> ->
ct:log("Result: ~p~n", [Result0])
+ after
+ 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end,
receive
?NEWLINE ->
ok
+ after
+ 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end,
receive
ErlPrompt1 ->
ct:log("Erlang prompt: ~p~n", [ErlPrompt1])
+ after
+ 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end,
exit(Shell, kill).
%%Does not seem to work in the testserver!
diff --git a/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa256 b/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa256
new file mode 100644
index 0000000000..4b1eb12eaa
--- /dev/null
+++ b/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa256
@@ -0,0 +1,5 @@
+-----BEGIN EC PRIVATE KEY-----
+MHcCAQEEIJfCaBKIIKhjbJl5F8BedqlXOQYDX5ba9Skypllmx/w+oAoGCCqGSM49
+AwEHoUQDQgAE49RbK2xQ/19ji3uDPM7uT4692LbwWF1TiaA9vUuebMGazoW/98br
+N9xZu0L1AWwtEjs3kmJDTB7eJEGXnjUAcQ==
+-----END EC PRIVATE KEY-----
diff --git a/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa256.pub b/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa256.pub
new file mode 100644
index 0000000000..a0147e60fa
--- /dev/null
+++ b/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa256.pub
@@ -0,0 +1 @@
+ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBOPUWytsUP9fY4t7gzzO7k+Ovdi28FhdU4mgPb1LnmzBms6Fv/fG6zfcWbtC9QFsLRI7N5JiQ0we3iRBl541AHE= uabhnil@elxadlj3q32
diff --git a/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa384 b/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa384
new file mode 100644
index 0000000000..4e8aa40959
--- /dev/null
+++ b/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa384
@@ -0,0 +1,6 @@
+-----BEGIN EC PRIVATE KEY-----
+MIGkAgEBBDCYXb6OSAZyXRfLXOtMo43za197Hdc/T0YKjgQQjwDt6rlRwqTh7v7S
+PV2kXwNGdWigBwYFK4EEACKhZANiAARN2khlJUOOIiwsWHEALwDieeZR96qL4pUd
+ci7aeGaczdUK5jOA9D9zmBZtSYTfO8Cr7ekVghDlcWAIJ/BXcswgQwSEQ6wyfaTF
+8FYfyr4l3u9IirsnyaFzeIgeoNis8Gw=
+-----END EC PRIVATE KEY-----
diff --git a/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa384.pub b/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa384.pub
new file mode 100644
index 0000000000..41e722e545
--- /dev/null
+++ b/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa384.pub
@@ -0,0 +1 @@
+ecdsa-sha2-nistp384 AAAAE2VjZHNhLXNoYTItbmlzdHAzODQAAAAIbmlzdHAzODQAAABhBE3aSGUlQ44iLCxYcQAvAOJ55lH3qovilR1yLtp4ZpzN1QrmM4D0P3OYFm1JhN87wKvt6RWCEOVxYAgn8FdyzCBDBIRDrDJ9pMXwVh/KviXe70iKuyfJoXN4iB6g2KzwbA== uabhnil@elxadlj3q32
diff --git a/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa521 b/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa521
new file mode 100644
index 0000000000..7196f46e97
--- /dev/null
+++ b/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa521
@@ -0,0 +1,7 @@
+-----BEGIN EC PRIVATE KEY-----
+MIHbAgEBBEFMadoz4ckEcClfqXa2tiUuYkJdDfwq+/iFQcpt8ESuEd26IY/vm47Q
+9UzbPkO4ou8xkNsQ3WvCRQBBWtn5O2kUU6AHBgUrgQQAI6GBiQOBhgAEAde5BRu5
+01/jS0jRk212xsb2DxPrxNpgp6IMCV8TA4Eps+8bSqHB091nLiBcP422HXYfuCd7
+XDjSs8ihcmhp0hCRASLqZR9EzW9W/SOt876May1Huj5X+WSO6RLe7vPn9vmf7kHf
+pip6m7M7qp2qGgQ3q2vRwS2K/O6156ohiOlmuuFs
+-----END EC PRIVATE KEY-----
diff --git a/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa521.pub b/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa521.pub
new file mode 100644
index 0000000000..8f059120bc
--- /dev/null
+++ b/lib/ssh/test/ssh_basic_SUITE_data/id_ecdsa521.pub
@@ -0,0 +1 @@
+ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAHXuQUbudNf40tI0ZNtdsbG9g8T68TaYKeiDAlfEwOBKbPvG0qhwdPdZy4gXD+Nth12H7gne1w40rPIoXJoadIQkQEi6mUfRM1vVv0jrfO+jGstR7o+V/lkjukS3u7z5/b5n+5B36YqepuzO6qdqhoEN6tr0cEtivzuteeqIYjpZrrhbA== uabhnil@elxadlj3q32
diff --git a/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key256 b/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key256
new file mode 100644
index 0000000000..2979ea88ed
--- /dev/null
+++ b/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key256
@@ -0,0 +1,5 @@
+-----BEGIN EC PRIVATE KEY-----
+MHcCAQEEIMe4MDoit0t8RzSVPwkCBemQ9fhXL+xnTSAWISw8HNCioAoGCCqGSM49
+AwEHoUQDQgAEo2q7U3P6r0W5WGOLtM78UQtofM9UalEhiZeDdiyylsR/RR17Op0s
+VPGSADLmzzgcucLEKy17j2S+oz42VUJy5A==
+-----END EC PRIVATE KEY-----
diff --git a/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key256.pub b/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key256.pub
new file mode 100644
index 0000000000..85dc419345
--- /dev/null
+++ b/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key256.pub
@@ -0,0 +1 @@
+ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBKNqu1Nz+q9FuVhji7TO/FELaHzPVGpRIYmXg3YsspbEf0UdezqdLFTxkgAy5s84HLnCxCste49kvqM+NlVCcuQ= uabhnil@elxadlj3q32
diff --git a/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key384 b/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key384
new file mode 100644
index 0000000000..fb1a862ded
--- /dev/null
+++ b/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key384
@@ -0,0 +1,6 @@
+-----BEGIN EC PRIVATE KEY-----
+MIGkAgEBBDArxbDfh3p1okrD9wQw6jJ4d4DdlBPD5GqXE8bIeRJiK41Sh40LgvPw
+mkqEDSXK++CgBwYFK4EEACKhZANiAAScl43Ih2lWTDKrSox5ve5uiTXil4smsup3
+CfS1XPjKxgBAmlfBim8izbdrT0BFdQzz2joduNMtpt61wO4rGs6jm0UP7Kim9PC7
+Hneb/99fIYopdMH5NMnk60zGO1uZ2vc=
+-----END EC PRIVATE KEY-----
diff --git a/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key384.pub b/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key384.pub
new file mode 100644
index 0000000000..428d5fb7d7
--- /dev/null
+++ b/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key384.pub
@@ -0,0 +1 @@
+ecdsa-sha2-nistp384 AAAAE2VjZHNhLXNoYTItbmlzdHAzODQAAAAIbmlzdHAzODQAAABhBJyXjciHaVZMMqtKjHm97m6JNeKXiyay6ncJ9LVc+MrGAECaV8GKbyLNt2tPQEV1DPPaOh240y2m3rXA7isazqObRQ/sqKb08Lsed5v/318hiil0wfk0yeTrTMY7W5na9w== uabhnil@elxadlj3q32
diff --git a/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key521 b/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key521
new file mode 100644
index 0000000000..3e51ec2ecd
--- /dev/null
+++ b/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key521
@@ -0,0 +1,7 @@
+-----BEGIN EC PRIVATE KEY-----
+MIHcAgEBBEIB8O1BFkl2HQjQLRLonEZ97da/h39DMa9/0/hvPZWAI8gUPEQcHxRx
+U7b09p3Zh+EBbMFq8+1ae9ds+ZTxE4WFSvKgBwYFK4EEACOhgYkDgYYABAAlWVjq
+Bzg7Wt4gE6UNb1lRE2cnlmH2L/A5uo6qZRx5lPnSKOxEhxSb/Oay1+9d6KRdrh6/
+vlhd9SHDBhLcAPDvWgBnJIEj92Q3pXX4JtoitL0yl+SvvU+vUh966mzHShHzj8p5
+ccOgPkPNoA70yrpGzkIhPezpZOQdCaOXj/jFqNCTDg==
+-----END EC PRIVATE KEY-----
diff --git a/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key521.pub b/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key521.pub
new file mode 100644
index 0000000000..017a29f4da
--- /dev/null
+++ b/lib/ssh/test/ssh_basic_SUITE_data/ssh_host_ecdsa_key521.pub
@@ -0,0 +1 @@
+ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAAlWVjqBzg7Wt4gE6UNb1lRE2cnlmH2L/A5uo6qZRx5lPnSKOxEhxSb/Oay1+9d6KRdrh6/vlhd9SHDBhLcAPDvWgBnJIEj92Q3pXX4JtoitL0yl+SvvU+vUh966mzHShHzj8p5ccOgPkPNoA70yrpGzkIhPezpZOQdCaOXj/jFqNCTDg== uabhnil@elxadlj3q32
diff --git a/lib/ssh/test/ssh_connection_SUITE.erl b/lib/ssh/test/ssh_connection_SUITE.erl
index fbcf06290a..1b93cc9c32 100644
--- a/lib/ssh/test/ssh_connection_SUITE.erl
+++ b/lib/ssh/test/ssh_connection_SUITE.erl
@@ -48,7 +48,8 @@ all() ->
gracefull_invalid_long_start,
gracefull_invalid_long_start_no_nl,
stop_listener,
- start_subsystem_on_closed_channel
+ start_subsystem_on_closed_channel,
+ max_channels_option
].
groups() ->
[{openssh, [], payload() ++ ptty()}].
@@ -119,20 +120,28 @@ simple_exec(Config) when is_list(Config) ->
receive
{ssh_cm, ConnectionRef, {data, ChannelId0, 0, <<"testing\n">>}} ->
ok
+ after
+ 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end,
%% receive close messages
receive
{ssh_cm, ConnectionRef, {eof, ChannelId0}} ->
ok
+ after
+ 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end,
receive
{ssh_cm, ConnectionRef, {exit_status, ChannelId0, 0}} ->
ok
+ after
+ 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end,
receive
{ssh_cm, ConnectionRef,{closed, ChannelId0}} ->
ok
+ after
+ 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end.
%%--------------------------------------------------------------------
@@ -154,20 +163,28 @@ small_cat(Config) when is_list(Config) ->
receive
{ssh_cm, ConnectionRef, {data, ChannelId0, 0, Data}} ->
ok
+ after
+ 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end,
%% receive close messages
receive
{ssh_cm, ConnectionRef, {eof, ChannelId0}} ->
ok
+ after
+ 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end,
receive
{ssh_cm, ConnectionRef, {exit_status, ChannelId0, 0}} ->
ok
+ after
+ 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end,
receive
{ssh_cm, ConnectionRef,{closed, ChannelId0}} ->
ok
+ after
+ 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end.
%%--------------------------------------------------------------------
big_cat() ->
@@ -211,11 +228,15 @@ big_cat(Config) when is_list(Config) ->
%% receive close messages (eof already consumed)
receive
{ssh_cm, ConnectionRef, {exit_status, ChannelId0, 0}} ->
- ok
+ ok
+ after
+ 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end,
receive
{ssh_cm, ConnectionRef,{closed, ChannelId0}} ->
ok
+ after
+ 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end.
%%--------------------------------------------------------------------
@@ -234,14 +255,20 @@ send_after_exit(Config) when is_list(Config) ->
receive
{ssh_cm, ConnectionRef, {eof, ChannelId0}} ->
ok
+ after
+ 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end,
receive
{ssh_cm, ConnectionRef, {exit_status, ChannelId0, _ExitStatus}} ->
ok
+ after
+ 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end,
receive
{ssh_cm, ConnectionRef,{closed, ChannelId0}} ->
ok
+ after
+ 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end,
case ssh_connection:send(ConnectionRef, ChannelId0, Data, 2000) of
{error, closed} -> ok;
@@ -455,6 +482,8 @@ gracefull_invalid_version(Config) when is_list(Config) ->
{tcp_closed, S} ->
ok
end
+ after
+ 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end.
gracefull_invalid_start(Config) when is_list(Config) ->
@@ -475,6 +504,8 @@ gracefull_invalid_start(Config) when is_list(Config) ->
{tcp_closed, S} ->
ok
end
+ after
+ 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end.
gracefull_invalid_long_start(Config) when is_list(Config) ->
@@ -495,6 +526,8 @@ gracefull_invalid_long_start(Config) when is_list(Config) ->
{tcp_closed, S} ->
ok
end
+ after
+ 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end.
@@ -516,6 +549,8 @@ gracefull_invalid_long_start_no_nl(Config) when is_list(Config) ->
{tcp_closed, S} ->
ok
end
+ after
+ 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end.
stop_listener() ->
@@ -606,6 +641,88 @@ start_subsystem_on_closed_channel(Config) ->
ssh:stop_daemon(Pid).
%%--------------------------------------------------------------------
+max_channels_option() ->
+ [{doc, "Test max_channels option"}].
+
+max_channels_option(Config) when is_list(Config) ->
+ PrivDir = ?config(priv_dir, Config),
+ UserDir = filename:join(PrivDir, nopubkey), % to make sure we don't use public-key-auth
+ file:make_dir(UserDir),
+ SysDir = ?config(data_dir, Config),
+ {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SysDir},
+ {user_dir, UserDir},
+ {password, "morot"},
+ {max_channels, 3},
+ {subsystems, [{"echo_n", {ssh_echo_server, [4000000]}}]}
+ ]),
+
+ ConnectionRef = ssh_test_lib:connect(Host, Port, [{silently_accept_hosts, true},
+ {user, "foo"},
+ {password, "morot"},
+ {user_interaction, true},
+ {user_dir, UserDir}]),
+
+ {ok, ChannelId0} = ssh_connection:session_channel(ConnectionRef, infinity),
+ {ok, ChannelId1} = ssh_connection:session_channel(ConnectionRef, infinity),
+ {ok, ChannelId2} = ssh_connection:session_channel(ConnectionRef, infinity),
+ {ok, ChannelId3} = ssh_connection:session_channel(ConnectionRef, infinity),
+ {ok, ChannelId4} = ssh_connection:session_channel(ConnectionRef, infinity),
+ {ok, ChannelId5} = ssh_connection:session_channel(ConnectionRef, infinity),
+ {ok, _ChannelId6} = ssh_connection:session_channel(ConnectionRef, infinity),
+
+ %%%---- shell
+ ok = ssh_connection:shell(ConnectionRef,ChannelId0),
+ receive
+ {ssh_cm,ConnectionRef, {data, ChannelId0, 0, <<"Eshell",_/binary>>}} ->
+ ok
+ after 5000 ->
+ ct:fail("CLI Timeout")
+ end,
+
+ %%%---- subsystem "echo_n"
+ success = ssh_connection:subsystem(ConnectionRef, ChannelId1, "echo_n", infinity),
+
+ %%%---- exec #1
+ success = ssh_connection:exec(ConnectionRef, ChannelId2, "testing1.\n", infinity),
+ receive
+ {ssh_cm, ConnectionRef, {data, ChannelId2, 0, <<"testing1",_/binary>>}} ->
+ ok
+ after 5000 ->
+ ct:fail("Exec #1 Timeout")
+ end,
+
+ %%%---- ptty
+ success = ssh_connection:ptty_alloc(ConnectionRef, ChannelId3, []),
+
+ %%%---- exec #2
+ failure = ssh_connection:exec(ConnectionRef, ChannelId4, "testing2.\n", infinity),
+
+ %%%---- close the shell
+ ok = ssh_connection:send(ConnectionRef, ChannelId0, "exit().\n", 5000),
+
+ %%%---- wait for the subsystem to terminate
+ receive
+ {ssh_cm,ConnectionRef,{closed,ChannelId0}} -> ok
+ after 5000 ->
+ ct:log("Timeout waiting for '{ssh_cm,~p,{closed,~p}}'~n"
+ "Message queue:~n~p",
+ [ConnectionRef,ChannelId0,erlang:process_info(self(),messages)]),
+ ct:fail("exit Timeout",[])
+ end,
+
+ %%%---- exec #3
+ success = ssh_connection:exec(ConnectionRef, ChannelId5, "testing3.\n", infinity),
+ receive
+ {ssh_cm, ConnectionRef, {data, ChannelId5, 0, <<"testing3",_/binary>>}} ->
+ ok
+ after 5000 ->
+ ct:fail("Exec #3 Timeout")
+ end,
+
+ ssh:close(ConnectionRef),
+ ssh:stop_daemon(Pid).
+
+%%--------------------------------------------------------------------
%% Internal functions ------------------------------------------------
%%--------------------------------------------------------------------
big_cat_rx(ConnectionRef, ChannelId) ->
diff --git a/lib/ssh/test/ssh_options_SUITE.erl b/lib/ssh/test/ssh_options_SUITE.erl
index d64c78da35..cf15ca4253 100644
--- a/lib/ssh/test/ssh_options_SUITE.erl
+++ b/lib/ssh/test/ssh_options_SUITE.erl
@@ -656,6 +656,8 @@ ssh_connect_arg4_timeout(_Config) ->
%% Get listening port
Port = receive
{port,Server,ServerPort} -> ServerPort
+ after
+ 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end,
%% try to connect with a timeout, but "supervise" it
@@ -861,6 +863,8 @@ ssh_connect_nonegtimeout_connected(Config, Parallel) ->
ct:sleep(round(Factor * NegTimeOut)),
one_shell_op(IO, NegTimeOut)
+ after
+ 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end,
exit(Shell, kill).
@@ -869,13 +873,13 @@ one_shell_op(IO, TimeOut) ->
ct:log("One shell op: Waiting for prompter"),
receive
ErlPrompt0 -> ct:log("Erlang prompt: ~p~n", [ErlPrompt0])
- after TimeOut -> ct:fail("Timeout waiting for promter")
+ after TimeOut -> ct:fail("Timeout waiting for promter")
end,
IO ! {input, self(), "2*3*7.\r\n"},
receive
Echo0 -> ct:log("Echo: ~p ~n", [Echo0])
- after TimeOut -> ct:fail("Timeout waiting for echo")
+ after TimeOut -> ct:fail("Timeout waiting for echo")
end,
receive
@@ -888,7 +892,7 @@ one_shell_op(IO, TimeOut) ->
receive
Result0 -> ct:log("Result: ~p~n", [Result0])
- after TimeOut -> ct:fail("Timeout waiting for result")
+ after TimeOut -> ct:fail("Timeout waiting for result")
end.
%%--------------------------------------------------------------------
@@ -1016,9 +1020,13 @@ fake_daemon(_Config) ->
{ok,S} = Rsa,
receive
{tcp, S, Id} -> Parent ! {id,self(),Id}
+ after
+ 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end
end),
%% Get listening host and port
receive
{sockname,Server,ServerHost,ServerPort} -> {Server, ServerHost, ServerPort}
+ after
+ 10000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end.
diff --git a/lib/ssh/test/ssh_protocol_SUITE.erl b/lib/ssh/test/ssh_protocol_SUITE.erl
index d8e99799e2..b84ccac885 100644
--- a/lib/ssh/test/ssh_protocol_SUITE.erl
+++ b/lib/ssh/test/ssh_protocol_SUITE.erl
@@ -46,7 +46,10 @@ suite() ->
all() ->
[{group,tool_tests},
- {group,kex}
+ {group,kex},
+ {group,service_requests},
+ {group,packet_size_error},
+ {group,field_size_error}
].
groups() ->
@@ -55,13 +58,25 @@ groups() ->
lib_match,
lib_no_match
]},
+ {packet_size_error, [], [packet_length_too_large,
+ packet_length_too_short]},
+
+ {field_size_error, [], [service_name_length_too_large,
+ service_name_length_too_short]},
+
{kex, [], [no_common_alg_server_disconnects,
no_common_alg_client_disconnects,
gex_client_init_default_noexact,
gex_client_init_default_exact,
gex_client_init_option_groups,
gex_client_init_option_groups_file
- ]}
+ ]},
+ {service_requests, [], [bad_service_name,
+ bad_long_service_name,
+ bad_very_long_service_name,
+ empty_service_name,
+ bad_service_name_then_correct
+ ]}
].
@@ -91,7 +106,7 @@ init_per_testcase(TC, Config) when TC == gex_client_init_default_noexact ;
[]
end,
start_std_daemon(Config,
- [{preferred_algorithms, ssh_transport:supported_algorithms()}
+ [{preferred_algorithms, ssh:default_algorithms()}
| Opts]);
init_per_testcase(_TestCase, Config) ->
check_std_daemon_works(Config, ?LINE).
@@ -114,25 +129,10 @@ end_per_testcase(_TestCase, Config) ->
%%% Connect to an erlang server and check that the testlib acts as a client.
lib_works_as_client(Config) ->
%% Connect and negotiate keys
- {ok,InitialState} =
- ssh_trpt_test_lib:exec(
- [{set_options, [print_ops, print_seqnums, print_messages]},
- {connect,
- server_host(Config),server_port(Config),
- [{preferred_algorithms,[{kex,['diffie-hellman-group1-sha1']}]},
- {silently_accept_hosts, true},
- {user_dir, user_dir(Config)},
- {user_interaction, false}]},
- receive_hello,
- {send, hello},
- {send, ssh_msg_kexinit},
- {match, #ssh_msg_kexinit{_='_'}, receive_msg},
- {send, ssh_msg_kexdh_init},
- {match,# ssh_msg_kexdh_reply{_='_'}, receive_msg},
- {send, #ssh_msg_newkeys{}},
- {match, #ssh_msg_newkeys{_='_'}, receive_msg}
- ]
- ),
+ {ok,InitialState} = ssh_trpt_test_lib:exec(
+ [{set_options, [print_ops, print_seqnums, print_messages]}]
+ ),
+ {ok,AfterKexState} = connect_and_kex(Config, InitialState),
%% Do the authentcation
{User,Pwd} = server_user_password(Config),
@@ -147,7 +147,7 @@ lib_works_as_client(Config) ->
?STRING(unicode:characters_to_binary(Pwd))>>
}},
{match, #ssh_msg_userauth_success{_='_'}, receive_msg}
- ], InitialState),
+ ], AfterKexState),
%% Disconnect
{ok,_} =
@@ -327,6 +327,8 @@ no_common_alg_client_disconnects(Config) ->
X ->
ct:log("¤¤¤¤¤"),
ct:fail(X)
+ after
+ 30000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end.
%%%--------------------------------------------------------------------
@@ -373,6 +375,106 @@ do_gex_client_init(Config, {Min,N,Max}, {_,{G,P}}) ->
]
).
+
+%%%--------------------------------------------------------------------
+bad_service_name(Config) ->
+ bad_service_name(Config, "kfglkjf").
+
+bad_long_service_name(Config) ->
+ bad_service_name(Config,
+ lists:duplicate(?SSH_MAX_PACKET_SIZE div 2, $a)).
+
+bad_very_long_service_name(Config) ->
+ bad_service_name(Config,
+ lists:duplicate(4*?SSH_MAX_PACKET_SIZE, $a)).
+
+empty_service_name(Config) ->
+ bad_service_name(Config, "").
+
+bad_service_name_then_correct(Config) ->
+ {ok,InitialState} = connect_and_kex(Config),
+ {ok,_} =
+ ssh_trpt_test_lib:exec(
+ [{set_options, [print_ops, print_seqnums, print_messages]},
+ {send, #ssh_msg_service_request{name = "kdjglkfdjgkldfjglkdfjglkfdjglkj"}},
+ {send, #ssh_msg_service_request{name = "ssh-connection"}},
+ {match, {'or',[#ssh_msg_disconnect{_='_'},
+ tcp_closed
+ ]},
+ receive_msg}
+ ], InitialState).
+
+
+bad_service_name(Config, Name) ->
+ {ok,InitialState} = connect_and_kex(Config),
+ {ok,_} =
+ ssh_trpt_test_lib:exec(
+ [{set_options, [print_ops, print_seqnums, print_messages]},
+ {send, #ssh_msg_service_request{name = Name}},
+ {match, {'or',[#ssh_msg_disconnect{_='_'},
+ tcp_closed
+ ]},
+ receive_msg}
+ ], InitialState).
+
+%%%--------------------------------------------------------------------
+packet_length_too_large(Config) -> bad_packet_length(Config, +4).
+
+packet_length_too_short(Config) -> bad_packet_length(Config, -4).
+
+bad_packet_length(Config, LengthExcess) ->
+ PacketFun =
+ fun(Msg, Ssh) ->
+ BinMsg = ssh_message:encode(Msg),
+ ssh_transport:pack(BinMsg, Ssh, LengthExcess)
+ end,
+ {ok,InitialState} = connect_and_kex(Config),
+ {ok,_} =
+ ssh_trpt_test_lib:exec(
+ [{set_options, [print_ops, print_seqnums, print_messages]},
+ {send, {special,
+ #ssh_msg_service_request{name="ssh-userauth"},
+ PacketFun}},
+ %% Prohibit remote decoder starvation:
+ {send, #ssh_msg_service_request{name="ssh-userauth"}},
+ {match, {'or',[#ssh_msg_disconnect{_='_'},
+ tcp_closed
+ ]},
+ receive_msg}
+ ], InitialState).
+
+%%%--------------------------------------------------------------------
+service_name_length_too_large(Config) -> bad_service_name_length(Config, +4).
+
+service_name_length_too_short(Config) -> bad_service_name_length(Config, -4).
+
+
+bad_service_name_length(Config, LengthExcess) ->
+ PacketFun =
+ fun(#ssh_msg_service_request{name=Service}, Ssh) ->
+ BinName = list_to_binary(Service),
+ BinMsg =
+ <<?BYTE(?SSH_MSG_SERVICE_REQUEST),
+ %% A bad string encoding of Service:
+ ?UINT32(size(BinName)+LengthExcess), BinName/binary
+ >>,
+ ssh_transport:pack(BinMsg, Ssh)
+ end,
+ {ok,InitialState} = connect_and_kex(Config),
+ {ok,_} =
+ ssh_trpt_test_lib:exec(
+ [{set_options, [print_ops, print_seqnums, print_messages]},
+ {send, {special,
+ #ssh_msg_service_request{name="ssh-userauth"},
+ PacketFun} },
+ %% Prohibit remote decoder starvation:
+ {send, #ssh_msg_service_request{name="ssh-userauth"}},
+ {match, {'or',[#ssh_msg_disconnect{_='_'},
+ tcp_closed
+ ]},
+ receive_msg}
+ ], InitialState).
+
%%%================================================================
%%%==== Internal functions ========================================
%%%================================================================
@@ -480,3 +582,24 @@ std_connect(Host, Port, Config, Opts) ->
30000).
%%%----------------------------------------------------------------
+connect_and_kex(Config) ->
+ connect_and_kex(Config, ssh_trpt_test_lib:exec([]) ).
+
+connect_and_kex(Config, InitialState) ->
+ ssh_trpt_test_lib:exec(
+ [{connect,
+ server_host(Config),server_port(Config),
+ [{preferred_algorithms,[{kex,['diffie-hellman-group1-sha1']}]},
+ {silently_accept_hosts, true},
+ {user_dir, user_dir(Config)},
+ {user_interaction, false}]},
+ receive_hello,
+ {send, hello},
+ {send, ssh_msg_kexinit},
+ {match, #ssh_msg_kexinit{_='_'}, receive_msg},
+ {send, ssh_msg_kexdh_init},
+ {match,# ssh_msg_kexdh_reply{_='_'}, receive_msg},
+ {send, #ssh_msg_newkeys{}},
+ {match, #ssh_msg_newkeys{_='_'}, receive_msg}
+ ],
+ InitialState).
diff --git a/lib/ssh/test/ssh_renegotiate_SUITE.erl b/lib/ssh/test/ssh_renegotiate_SUITE.erl
index 9daa6efc02..ef631d54bd 100644
--- a/lib/ssh/test/ssh_renegotiate_SUITE.erl
+++ b/lib/ssh/test/ssh_renegotiate_SUITE.erl
@@ -89,9 +89,10 @@ rekey_limit(Config) ->
UserDir = ?config(priv_dir, Config),
DataFile = filename:join(UserDir, "rekey.data"),
- {Pid, Host, Port} = ssh_test_lib:std_daemon(Config,[]),
+ {Pid, Host, Port} = ssh_test_lib:std_daemon(Config,[{max_random_length_padding,0}]),
- ConnectionRef = ssh_test_lib:std_connect(Config, Host, Port, [{rekey_limit, 4500}]),
+ ConnectionRef = ssh_test_lib:std_connect(Config, Host, Port, [{rekey_limit, 6000},
+ {max_random_length_padding,0}]),
{ok, SftpPid} = ssh_sftp:start_channel(ConnectionRef),
Kex1 = get_kex_init(ConnectionRef),
@@ -132,13 +133,13 @@ renegotiate1(Config) ->
UserDir = ?config(priv_dir, Config),
DataFile = filename:join(UserDir, "renegotiate1.data"),
- {Pid, Host, DPort} = ssh_test_lib:std_daemon(Config,[]),
+ {Pid, Host, DPort} = ssh_test_lib:std_daemon(Config,[{max_random_length_padding,0}]),
RPort = ssh_test_lib:inet_port(),
{ok,RelayPid} = ssh_relay:start_link({0,0,0,0}, RPort, Host, DPort),
- ConnectionRef = ssh_test_lib:std_connect(Config, Host, RPort, []),
+ ConnectionRef = ssh_test_lib:std_connect(Config, Host, RPort, [{max_random_length_padding,0}]),
{ok, SftpPid} = ssh_sftp:start_channel(ConnectionRef),
Kex1 = get_kex_init(ConnectionRef),
@@ -170,12 +171,12 @@ renegotiate2(Config) ->
UserDir = ?config(priv_dir, Config),
DataFile = filename:join(UserDir, "renegotiate2.data"),
- {Pid, Host, DPort} = ssh_test_lib:std_daemon(Config,[]),
+ {Pid, Host, DPort} = ssh_test_lib:std_daemon(Config,[{max_random_length_padding,0}]),
RPort = ssh_test_lib:inet_port(),
{ok,RelayPid} = ssh_relay:start_link({0,0,0,0}, RPort, Host, DPort),
- ConnectionRef = ssh_test_lib:std_connect(Config, Host, RPort, []),
+ ConnectionRef = ssh_test_lib:std_connect(Config, Host, RPort, [{max_random_length_padding,0}]),
{ok, SftpPid} = ssh_sftp:start_channel(ConnectionRef),
Kex1 = get_kex_init(ConnectionRef),
diff --git a/lib/ssh/test/ssh_sftp_SUITE.erl b/lib/ssh/test/ssh_sftp_SUITE.erl
index 32fdec9842..698af259c8 100644
--- a/lib/ssh/test/ssh_sftp_SUITE.erl
+++ b/lib/ssh/test/ssh_sftp_SUITE.erl
@@ -526,6 +526,8 @@ async_read(Config) when is_list(Config) ->
ok;
Msg ->
ct:fail(Msg)
+ after
+ 30000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end.
%%--------------------------------------------------------------------
async_write() ->
@@ -593,6 +595,8 @@ pos_read(Config) when is_list(Config) ->
ok;
Msg ->
ct:fail(Msg)
+ after
+ 30000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end,
NewData1 = "hopp",
@@ -618,6 +622,8 @@ pos_write(Config) when is_list(Config) ->
ok;
Msg ->
ct:fail(Msg)
+ after
+ 30000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end,
ok = ssh_sftp:pwrite(Sftp, Handle, eof, list_to_binary("!")),
diff --git a/lib/ssh/test/ssh_sftpd_SUITE.erl b/lib/ssh/test/ssh_sftpd_SUITE.erl
index 94a54ec9db..6b03a2b763 100644
--- a/lib/ssh/test/ssh_sftpd_SUITE.erl
+++ b/lib/ssh/test/ssh_sftpd_SUITE.erl
@@ -683,6 +683,8 @@ reply(Cm, Channel, RBuf) ->
closed;
{ssh_cm, Cm, Msg} ->
ct:fail(Msg)
+ after
+ 30000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end.
diff --git a/lib/ssh/test/ssh_test_lib.erl b/lib/ssh/test/ssh_test_lib.erl
index 6d568125bb..5816b708f2 100644
--- a/lib/ssh/test/ssh_test_lib.erl
+++ b/lib/ssh/test/ssh_test_lib.erl
@@ -93,9 +93,12 @@ std_connect(Config, Host, Port, ExtraOpts) ->
| ExtraOpts]).
std_simple_sftp(Host, Port, Config) ->
+ std_simple_sftp(Host, Port, Config, []).
+
+std_simple_sftp(Host, Port, Config, Opts) ->
UserDir = ?config(priv_dir, Config),
DataFile = filename:join(UserDir, "test.data"),
- ConnectionRef = ssh_test_lib:std_connect(Config, Host, Port, []),
+ ConnectionRef = ssh_test_lib:std_connect(Config, Host, Port, Opts),
{ok, ChannelRef} = ssh_sftp:start_channel(ConnectionRef),
Data = crypto:rand_bytes(proplists:get_value(std_simple_sftp_size,Config,10)),
ok = ssh_sftp:write_file(ChannelRef, DataFile, Data),
@@ -104,7 +107,10 @@ std_simple_sftp(Host, Port, Config) ->
Data == ReadData.
std_simple_exec(Host, Port, Config) ->
- ConnectionRef = ssh_test_lib:std_connect(Config, Host, Port, []),
+ std_simple_exec(Host, Port, Config, []).
+
+std_simple_exec(Host, Port, Config, Opts) ->
+ ConnectionRef = ssh_test_lib:std_connect(Config, Host, Port, Opts),
{ok, ChannelId} = ssh_connection:session_channel(ConnectionRef, infinity),
success = ssh_connection:exec(ConnectionRef, ChannelId, "23+21-2.", infinity),
Data = {ssh_cm, ConnectionRef, {data, ChannelId, 0, <<"42\n">>}},
@@ -157,7 +163,9 @@ loop_io_server(TestCase, Buff0) ->
{'EXIT',_, _} ->
erlang:display('ssh_test_lib:loop_io_server/2 EXIT'),
ok
- end.
+ after
+ 30000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
+ end.
io_request({put_chars, Chars}, TestCase, _, _, Buff) ->
reply(TestCase, Chars),
@@ -206,6 +214,8 @@ receive_exec_result(Msg) ->
Other ->
ct:log("Other ~p", [Other]),
{unexpected_msg, Other}
+ after
+ 30000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end.
@@ -286,6 +296,7 @@ setup_dsa(DataDir, UserDir) ->
file:make_dir(System),
file:copy(filename:join(DataDir, "ssh_host_dsa_key"), filename:join(System, "ssh_host_dsa_key")),
file:copy(filename:join(DataDir, "ssh_host_dsa_key.pub"), filename:join(System, "ssh_host_dsa_key.pub")),
+ct:pal("DataDir ~p:~n ~p~n~nSystDir ~p:~n ~p~n~nUserDir ~p:~n ~p",[DataDir, file:list_dir(DataDir), System, file:list_dir(System), UserDir, file:list_dir(UserDir)]),
setup_dsa_known_host(DataDir, UserDir),
setup_dsa_auth_keys(DataDir, UserDir).
@@ -294,10 +305,21 @@ setup_rsa(DataDir, UserDir) ->
System = filename:join(UserDir, "system"),
file:make_dir(System),
file:copy(filename:join(DataDir, "ssh_host_rsa_key"), filename:join(System, "ssh_host_rsa_key")),
- file:copy(filename:join(DataDir, "ssh_host_rsa_key"), filename:join(System, "ssh_host_rsa_key.pub")),
+ file:copy(filename:join(DataDir, "ssh_host_rsa_key.pub"), filename:join(System, "ssh_host_rsa_key.pub")),
+ct:pal("DataDir ~p:~n ~p~n~nSystDir ~p:~n ~p~n~nUserDir ~p:~n ~p",[DataDir, file:list_dir(DataDir), System, file:list_dir(System), UserDir, file:list_dir(UserDir)]),
setup_rsa_known_host(DataDir, UserDir),
setup_rsa_auth_keys(DataDir, UserDir).
+setup_ecdsa(Size, DataDir, UserDir) ->
+ file:copy(filename:join(DataDir, "id_ecdsa"++Size), filename:join(UserDir, "id_ecdsa")),
+ System = filename:join(UserDir, "system"),
+ file:make_dir(System),
+ file:copy(filename:join(DataDir, "ssh_host_ecdsa_key"++Size), filename:join(System, "ssh_host_ecdsa_key")),
+ file:copy(filename:join(DataDir, "ssh_host_ecdsa_key"++Size++".pub"), filename:join(System, "ssh_host_ecdsa_key.pub")),
+ct:pal("DataDir ~p:~n ~p~n~nSystDir ~p:~n ~p~n~nUserDir ~p:~n ~p",[DataDir, file:list_dir(DataDir), System, file:list_dir(System), UserDir, file:list_dir(UserDir)]),
+ setup_ecdsa_known_host(Size, System, UserDir),
+ setup_ecdsa_auth_keys(Size, UserDir, UserDir).
+
clean_dsa(UserDir) ->
del_dirs(filename:join(UserDir, "system")),
file:delete(filename:join(UserDir,"id_dsa")),
@@ -349,6 +371,11 @@ setup_rsa_known_host(SystemDir, UserDir) ->
[{Key, _}] = public_key:ssh_decode(SshBin, public_key),
setup_known_hosts(Key, UserDir).
+setup_ecdsa_known_host(_Size, SystemDir, UserDir) ->
+ {ok, SshBin} = file:read_file(filename:join(SystemDir, "ssh_host_ecdsa_key.pub")),
+ [{Key, _}] = public_key:ssh_decode(SshBin, public_key),
+ setup_known_hosts(Key, UserDir).
+
setup_known_hosts(Key, UserDir) ->
{ok, Hostname} = inet:gethostname(),
{ok, {A, B, C, D}} = inet:getaddr(Hostname, inet),
@@ -376,6 +403,14 @@ setup_rsa_auth_keys(Dir, UserDir) ->
PKey = #'RSAPublicKey'{publicExponent = E, modulus = N},
setup_auth_keys([{ PKey, [{comment, "Test"}]}], UserDir).
+setup_ecdsa_auth_keys(_Size, Dir, UserDir) ->
+ {ok, Pem} = file:read_file(filename:join(Dir, "id_ecdsa")),
+ ECDSA = public_key:pem_entry_decode(hd(public_key:pem_decode(Pem))),
+ #'ECPrivateKey'{publicKey = Q,
+ parameters = Param = {namedCurve,_Id0}} = ECDSA,
+ PKey = #'ECPoint'{point = Q},
+ setup_auth_keys([{ {PKey,Param}, [{comment, "Test"}]}], UserDir).
+
setup_auth_keys(Keys, Dir) ->
AuthKeys = public_key:ssh_encode(Keys, auth_keys),
AuthKeysFile = filename:join(Dir, "authorized_keys"),
@@ -424,6 +459,14 @@ openssh_sanity_check(Config) ->
{skip, Str}
end.
+openssh_supports(ClientOrServer, Tag, Alg) when ClientOrServer == sshc ;
+ ClientOrServer == sshd ->
+ SSH_algos = ssh_test_lib:default_algorithms(ClientOrServer),
+ L = proplists:get_value(Tag, SSH_algos, []),
+ lists:member(Alg, L) orelse
+ lists:member(Alg, proplists:get_value(client2server, L, [])) orelse
+ lists:member(Alg, proplists:get_value(server2client, L, [])).
+
%%--------------------------------------------------------------------
%% Check if we have a "newer" ssh client that supports these test cases
@@ -443,7 +486,63 @@ check_ssh_client_support2(P) ->
-1
end.
-default_algorithms(Host, Port) ->
+%%%--------------------------------------------------------------------
+%%% Probe a server or a client about algorithm support
+
+default_algorithms(sshd) ->
+ default_algorithms(sshd, "localhost", 22);
+
+default_algorithms(sshc) ->
+ default_algorithms(sshc, []).
+
+default_algorithms(sshd, Host, Port) ->
+ try run_fake_ssh(
+ ssh_trpt_test_lib:exec(
+ [{connect,Host,Port, [{silently_accept_hosts, true},
+ {user_interaction, false}]}]))
+ catch
+ _C:_E ->
+ ct:pal("***~p:~p: ~p:~p",[?MODULE,?LINE,_C,_E]),
+ []
+ end.
+
+default_algorithms(sshc, DaemonOptions) ->
+ Parent = self(),
+ %% Start a process handling one connection on the server side:
+ Srvr =
+ spawn_link(
+ fun() ->
+ Parent !
+ {result, self(),
+ try
+ {ok,InitialState} = ssh_trpt_test_lib:exec(listen),
+ Parent ! {hostport,self(),ssh_trpt_test_lib:server_host_port(InitialState)},
+ run_fake_ssh(
+ ssh_trpt_test_lib:exec([{accept, DaemonOptions}],
+ InitialState))
+ catch
+ _C:_E ->
+ ct:pal("***~p:~p: ~p:~p",[?MODULE,?LINE,_C,_E]),
+ []
+ end}
+ end),
+
+ receive
+ {hostport,Srvr,{_Host,Port}} ->
+ spawn(fun()-> os:cmd(lists:concat(["ssh -o \"StrictHostKeyChecking no\" -p ",Port," localhost"])) end)
+ after ?TIMEOUT ->
+ ct:fail("No server respons 1")
+ end,
+
+ receive
+ {result,Srvr,L} ->
+ L
+ after ?TIMEOUT ->
+ ct:fail("No server respons 2")
+ end.
+
+
+run_fake_ssh({ok,InitialState}) ->
KexInitPattern =
#ssh_msg_kexinit{
kex_algorithms = '$kex_algorithms',
@@ -456,61 +555,35 @@ default_algorithms(Host, Port) ->
compression_algorithms_server_to_client = '$compression_algorithms_server_to_client',
_ = '_'
},
+ {ok,E} = ssh_trpt_test_lib:exec([{set_options,[silent]},
+ {send, hello},
+ receive_hello,
+ {send, ssh_msg_kexinit},
+ {match, KexInitPattern, receive_msg},
+ close_socket
+ ],
+ InitialState),
+ [Kex, PubKey, EncC2S, EncS2C, MacC2S, MacS2C, CompC2S, CompS2C] =
+ ssh_trpt_test_lib:instantiate(['$kex_algorithms',
+ '$server_host_key_algorithms',
+ '$encryption_algorithms_client_to_server',
+ '$encryption_algorithms_server_to_client',
+ '$mac_algorithms_client_to_server',
+ '$mac_algorithms_server_to_client',
+ '$compression_algorithms_client_to_server',
+ '$compression_algorithms_server_to_client'
+ ], E),
+ [{kex, to_atoms(Kex)},
+ {public_key, to_atoms(PubKey)},
+ {cipher, [{client2server, to_atoms(EncC2S)},
+ {server2client, to_atoms(EncS2C)}]},
+ {mac, [{client2server, to_atoms(MacC2S)},
+ {server2client, to_atoms(MacS2C)}]},
+ {compression, [{client2server, to_atoms(CompC2S)},
+ {server2client, to_atoms(CompS2C)}]}].
+
- try ssh_trpt_test_lib:exec(
- [{connect,Host,Port, [{silently_accept_hosts, true},
- {user_interaction, false}]},
- {send,hello},
- receive_hello,
- {send, ssh_msg_kexinit},
- {match, KexInitPattern, receive_msg},
- close_socket])
- of
- {ok,E} ->
- [Kex, PubKey, EncC2S, EncS2C, MacC2S, MacS2C, CompC2S, CompS2C] =
- ssh_trpt_test_lib:instantiate(['$kex_algorithms',
- '$server_host_key_algorithms',
- '$encryption_algorithms_client_to_server',
- '$encryption_algorithms_server_to_client',
- '$mac_algorithms_client_to_server',
- '$mac_algorithms_server_to_client',
- '$compression_algorithms_client_to_server',
- '$compression_algorithms_server_to_client'
- ], E),
- [{kex, to_atoms(Kex)},
- {public_key, to_atoms(PubKey)},
- {cipher, [{client2server, to_atoms(EncC2S)},
- {server2client, to_atoms(EncS2C)}]},
- {mac, [{client2server, to_atoms(MacC2S)},
- {server2client, to_atoms(MacS2C)}]},
- {compression, [{client2server, to_atoms(CompC2S)},
- {server2client, to_atoms(CompS2C)}]}];
- _ ->
- []
- catch
- _:_ ->
- []
- end.
-
-
-default_algorithms(sshd) ->
- default_algorithms("localhost", 22);
-default_algorithms(sshc) ->
- case os:find_executable("ssh") of
- false ->
- [];
- _ ->
- Cipher = sshc(cipher),
- Mac = sshc(mac),
- [{kex, sshc(kex)},
- {public_key, sshc(key)},
- {cipher, [{client2server, Cipher},
- {server2client, Cipher}]},
- {mac, [{client2server, Mac},
- {server2client, Mac}]}
- ]
- end.
-
+%%--------------------------------------------------------------------
sshc(Tag) ->
to_atoms(
string:tokens(os:cmd(lists:concat(["ssh -Q ",Tag])), "\n")
@@ -552,4 +625,24 @@ algo_intersection(_, _) ->
to_atoms(L) -> lists:map(fun erlang:list_to_atom/1, L).
-
+%%%----------------------------------------------------------------
+ssh_supports(Alg, SshDefaultAlg_tag) ->
+ SupAlgs =
+ case proplists:get_value(SshDefaultAlg_tag,
+ ssh:default_algorithms()) of
+ [{_K1,L1}, {_K2,L2}] ->
+ lists:usort(L1++L2);
+ L ->
+ L
+ end,
+ if
+ is_atom(Alg) ->
+ lists:member(Alg, SupAlgs);
+ is_list(Alg) ->
+ case Alg--SupAlgs of
+ [] ->
+ true;
+ UnSup ->
+ {false,UnSup}
+ end
+ end.
diff --git a/lib/ssh/test/ssh_to_openssh_SUITE.erl b/lib/ssh/test/ssh_to_openssh_SUITE.erl
index 104c1f9107..d1dfa2efdf 100644
--- a/lib/ssh/test/ssh_to_openssh_SUITE.erl
+++ b/lib/ssh/test/ssh_to_openssh_SUITE.erl
@@ -45,7 +45,6 @@ all() ->
groups() ->
[{erlang_client, [], [erlang_shell_client_openssh_server,
- erlang_client_openssh_server_exec,
erlang_client_openssh_server_exec_compressed,
erlang_client_openssh_server_setenv,
erlang_client_openssh_server_publickey_rsa,
@@ -54,12 +53,7 @@ groups() ->
erlang_client_openssh_server_kexs,
erlang_client_openssh_server_nonexistent_subsystem
]},
- {erlang_server, [], [erlang_server_openssh_client_exec,
- erlang_server_openssh_client_exec_compressed,
- erlang_server_openssh_client_pulic_key_dsa,
- erlang_server_openssh_client_cipher_suites,
- erlang_server_openssh_client_macs,
- erlang_server_openssh_client_kexs]}
+ {erlang_server, [], [erlang_server_openssh_client_public_key_dsa]}
].
init_per_suite(Config) ->
@@ -88,7 +82,7 @@ init_per_group(erlang_server, Config) ->
init_per_group(erlang_client, Config) ->
CommonAlgs = ssh_test_lib:algo_intersection(
ssh:default_algorithms(),
- ssh_test_lib:default_algorithms("localhost", 22)),
+ ssh_test_lib:default_algorithms(sshd)),
[{common_algs,CommonAlgs} | Config];
init_per_group(_, Config) ->
Config.
@@ -100,18 +94,21 @@ end_per_group(erlang_server, Config) ->
end_per_group(_, Config) ->
Config.
-init_per_testcase(erlang_server_openssh_client_cipher_suites, Config) ->
- check_ssh_client_support(Config);
-
-init_per_testcase(erlang_server_openssh_client_macs, Config) ->
- check_ssh_client_support(Config);
-
-init_per_testcase(erlang_server_openssh_client_kexs, Config) ->
- check_ssh_client_support(Config);
-
-init_per_testcase(erlang_client_openssh_server_kexs, Config) ->
- check_ssh_client_support(Config);
+init_per_testcase(erlang_server_openssh_client_public_key_dsa, Config) ->
+ case ssh_test_lib:openssh_supports(sshc, public_key, 'ssh-dss') of
+ true ->
+ init_per_testcase('__default__',Config);
+ false ->
+ {skip,"openssh client does not support DSA"}
+ end;
+init_per_testcase(erlang_client_openssh_server_publickey_dsa, Config) ->
+ case ssh_test_lib:openssh_supports(sshd, public_key, 'ssh-dss') of
+ true ->
+ init_per_testcase('__default__',Config);
+ false ->
+ {skip,"openssh client does not support DSA"}
+ end;
init_per_testcase(_TestCase, Config) ->
ssh:start(),
Config.
@@ -182,23 +179,29 @@ erlang_client_openssh_server_exec_compressed() ->
erlang_client_openssh_server_exec_compressed(Config) when is_list(Config) ->
CompressAlgs = [zlib, '[email protected]',none],
- ConnectionRef = ssh_test_lib:connect(?SSH_DEFAULT_PORT, [{silently_accept_hosts, true},
- {user_interaction, false},
- {preferred_algorithms,
- [{compression,CompressAlgs}]}]),
- {ok, ChannelId} = ssh_connection:session_channel(ConnectionRef, infinity),
- success = ssh_connection:exec(ConnectionRef, ChannelId,
- "echo testing", infinity),
- Data = {ssh_cm, ConnectionRef, {data, ChannelId, 0, <<"testing\n">>}},
- case ssh_test_lib:receive_exec_result(Data) of
- expected ->
- ssh_test_lib:receive_exec_end(ConnectionRef, ChannelId);
- {unexpected_msg,{ssh_cm, ConnectionRef,
- {exit_status, ChannelId, 0}} = ExitStatus} ->
- ct:log("0: Collected data ~p", [ExitStatus]),
- ssh_test_lib:receive_exec_result(Data, ConnectionRef, ChannelId);
- Other ->
- ct:fail(Other)
+ case ssh_test_lib:ssh_supports(CompressAlgs, compression) of
+ {false,L} ->
+ {skip, io_lib:format("~p compression is not supported",[L])};
+
+ true ->
+ ConnectionRef = ssh_test_lib:connect(?SSH_DEFAULT_PORT, [{silently_accept_hosts, true},
+ {user_interaction, false},
+ {preferred_algorithms,
+ [{compression,CompressAlgs}]}]),
+ {ok, ChannelId} = ssh_connection:session_channel(ConnectionRef, infinity),
+ success = ssh_connection:exec(ConnectionRef, ChannelId,
+ "echo testing", infinity),
+ Data = {ssh_cm, ConnectionRef, {data, ChannelId, 0, <<"testing\n">>}},
+ case ssh_test_lib:receive_exec_result(Data) of
+ expected ->
+ ssh_test_lib:receive_exec_end(ConnectionRef, ChannelId);
+ {unexpected_msg,{ssh_cm, ConnectionRef,
+ {exit_status, ChannelId, 0}} = ExitStatus} ->
+ ct:log("0: Collected data ~p", [ExitStatus]),
+ ssh_test_lib:receive_exec_result(Data, ConnectionRef, ChannelId);
+ Other ->
+ ct:fail(Other)
+ end
end.
%%--------------------------------------------------------------------
@@ -252,202 +255,6 @@ erlang_client_openssh_server_kexs(Config) when is_list(Config) ->
end.
%%--------------------------------------------------------------------
-erlang_server_openssh_client_exec() ->
- [{doc, "Test that exec command works."}].
-
-erlang_server_openssh_client_exec(Config) when is_list(Config) ->
- SystemDir = ?config(data_dir, Config),
- PrivDir = ?config(priv_dir, Config),
- KnownHosts = filename:join(PrivDir, "known_hosts"),
-
- {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir},
- {failfun, fun ssh_test_lib:failfun/2}]),
-
-
- ct:sleep(500),
-
- Cmd = "ssh -p " ++ integer_to_list(Port) ++
- " -o UserKnownHostsFile=" ++ KnownHosts ++ " " ++ Host ++ " 1+1.",
-
- ct:log("Cmd: ~p~n", [Cmd]),
-
- SshPort = open_port({spawn, Cmd}, [binary]),
-
- receive
- {SshPort,{data, <<"2\n">>}} ->
- ok
- after ?TIMEOUT ->
- ct:fail("Did not receive answer")
-
- end,
- ssh:stop_daemon(Pid).
-
-%%--------------------------------------------------------------------
-erlang_server_openssh_client_cipher_suites() ->
- [{doc, "Test that we can connect with different cipher suites."}].
-
-erlang_server_openssh_client_cipher_suites(Config) when is_list(Config) ->
- SystemDir = ?config(data_dir, Config),
- PrivDir = ?config(priv_dir, Config),
- KnownHosts = filename:join(PrivDir, "known_hosts"),
-
- {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir},
- {failfun, fun ssh_test_lib:failfun/2}]),
-
- ct:sleep(500),
-
- OpenSshCiphers =
- ssh_test_lib:to_atoms(
- string:tokens(os:cmd("ssh -Q cipher"), "\n")),
- ErlCiphers =
- proplists:get_value(client2server,
- proplists:get_value(cipher, ssh:default_algorithms())),
- CommonCiphers =
- ssh_test_lib:algo_intersection(ErlCiphers, OpenSshCiphers),
-
- comment(CommonCiphers),
-
- lists:foreach(
- fun(Cipher) ->
- Cmd = lists:concat(["ssh -p ",Port,
- " -o UserKnownHostsFile=",KnownHosts," ",Host," ",
- " -c ",Cipher," 1+1."]),
- ct:log("Cmd: ~p~n", [Cmd]),
-
- SshPort = open_port({spawn, Cmd}, [binary, stderr_to_stdout]),
-
- receive
- {SshPort,{data, <<"2\n">>}} ->
- ok
- after ?TIMEOUT ->
- ct:fail("~p Did not receive answer",[Cipher])
- end
- end, CommonCiphers),
-
- ssh:stop_daemon(Pid).
-
-%%--------------------------------------------------------------------
-erlang_server_openssh_client_macs() ->
- [{doc, "Test that we can connect with different MACs."}].
-
-erlang_server_openssh_client_macs(Config) when is_list(Config) ->
- SystemDir = ?config(data_dir, Config),
- PrivDir = ?config(priv_dir, Config),
- KnownHosts = filename:join(PrivDir, "known_hosts"),
-
- {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir},
- {failfun, fun ssh_test_lib:failfun/2}]),
-
-
- ct:sleep(500),
-
- OpenSshMacs =
- ssh_test_lib:to_atoms(
- string:tokens(os:cmd("ssh -Q mac"), "\n")),
- ErlMacs =
- proplists:get_value(client2server,
- proplists:get_value(mac, ssh:default_algorithms())),
- CommonMacs =
- ssh_test_lib:algo_intersection(ErlMacs, OpenSshMacs),
-
- comment(CommonMacs),
-
- lists:foreach(
- fun(MAC) ->
- Cmd = lists:concat(["ssh -p ",Port,
- " -o UserKnownHostsFile=",KnownHosts," ",Host," ",
- " -o MACs=",MAC," 1+1."]),
- ct:log("Cmd: ~p~n", [Cmd]),
-
- SshPort = open_port({spawn, Cmd}, [binary, stderr_to_stdout]),
-
- receive
- {SshPort,{data, <<"2\n">>}} ->
- ok
- after ?TIMEOUT ->
- ct:fail("~p Did not receive answer",[MAC])
- end
- end, CommonMacs),
-
- ssh:stop_daemon(Pid).
-
-%%--------------------------------------------------------------------
-erlang_server_openssh_client_kexs() ->
- [{doc, "Test that we can connect with different KEXs."}].
-
-erlang_server_openssh_client_kexs(Config) when is_list(Config) ->
- SystemDir = ?config(data_dir, Config),
- PrivDir = ?config(priv_dir, Config),
- KnownHosts = filename:join(PrivDir, "known_hosts"),
-
- {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir},
- {failfun, fun ssh_test_lib:failfun/2},
- {preferred_algorithms,
- [{kex,ssh_transport:supported_algorithms(kex)}]}
- ]),
- ct:sleep(500),
-
- OpenSshKexs =
- ssh_test_lib:to_atoms(
- string:tokens(os:cmd("ssh -Q kex"), "\n")),
- ErlKexs =
- proplists:get_value(kex, ssh:default_algorithms()),
- CommonKexs =
- ssh_test_lib:algo_intersection(ErlKexs, OpenSshKexs),
-
- comment(CommonKexs),
-
- lists:foreach(
- fun(Kex) ->
- Cmd = lists:concat(["ssh -p ",Port,
- " -o UserKnownHostsFile=",KnownHosts," ",Host," ",
- " -o KexAlgorithms=",Kex," 1+1."]),
- ct:log("Cmd: ~p~n", [Cmd]),
-
- SshPort = open_port({spawn, Cmd}, [binary, stderr_to_stdout]),
-
- receive
- {SshPort,{data, <<"2\n">>}} ->
- ok
- after ?TIMEOUT ->
- ct:log("~p Did not receive answer",[Kex])
- end
- end, CommonKexs),
-
- ssh:stop_daemon(Pid).
-
-%%--------------------------------------------------------------------
-erlang_server_openssh_client_exec_compressed() ->
- [{doc, "Test that exec command works."}].
-
-erlang_server_openssh_client_exec_compressed(Config) when is_list(Config) ->
- SystemDir = ?config(data_dir, Config),
- PrivDir = ?config(priv_dir, Config),
- KnownHosts = filename:join(PrivDir, "known_hosts"),
-
-%% CompressAlgs = [zlib, '[email protected]'], % Does not work
- CompressAlgs = [zlib],
- {Pid, Host, Port} = ssh_test_lib:daemon([{system_dir, SystemDir},
- {preferred_algorithms,
- [{compression, CompressAlgs}]},
- {failfun, fun ssh_test_lib:failfun/2}]),
-
- ct:sleep(500),
-
- Cmd = "ssh -p " ++ integer_to_list(Port) ++
- " -o UserKnownHostsFile=" ++ KnownHosts ++ " -C "++ Host ++ " 1+1.",
- SshPort = open_port({spawn, Cmd}, [binary]),
-
- receive
- {SshPort,{data, <<"2\n">>}} ->
- ok
- after ?TIMEOUT ->
- ct:fail("Did not receive answer")
-
- end,
- ssh:stop_daemon(Pid).
-
-%%--------------------------------------------------------------------
erlang_client_openssh_server_setenv() ->
[{doc, "Test api function ssh_connection:setenv"}].
@@ -543,9 +350,9 @@ erlang_client_openssh_server_publickey_dsa(Config) when is_list(Config) ->
{skip, "no ~/.ssh/id_dsa"}
end.
%%--------------------------------------------------------------------
-erlang_server_openssh_client_pulic_key_dsa() ->
+erlang_server_openssh_client_public_key_dsa() ->
[{doc, "Validate using dsa publickey."}].
-erlang_server_openssh_client_pulic_key_dsa(Config) when is_list(Config) ->
+erlang_server_openssh_client_public_key_dsa(Config) when is_list(Config) ->
SystemDir = ?config(data_dir, Config),
PrivDir = ?config(priv_dir, Config),
KnownHosts = filename:join(PrivDir, "known_hosts"),
@@ -642,6 +449,8 @@ receive_hej() ->
ct:log("Extra info: ~p~n", [Info]),
receive_hej()
end
+ after
+ 30000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end.
receive_logout() ->
@@ -651,11 +460,15 @@ receive_logout() ->
receive
<<"Connection closed">> ->
ok
+ after
+ 30000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end;
Info ->
ct:log("Extra info when logging out: ~p~n", [Info]),
receive_logout()
- end.
+ after
+ 30000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
+ end.
receive_normal_exit(Shell) ->
receive
@@ -665,6 +478,8 @@ receive_normal_exit(Shell) ->
receive_normal_exit(Shell);
Other ->
ct:fail({unexpected_msg, Other})
+ after
+ 30000 -> ct:fail("timeout ~p:~p",[?MODULE,?LINE])
end.
extra_logout() ->
diff --git a/lib/ssh/test/ssh_trpt_test_lib.erl b/lib/ssh/test/ssh_trpt_test_lib.erl
index caf9bac3b6..4269529ae8 100644
--- a/lib/ssh/test/ssh_trpt_test_lib.erl
+++ b/lib/ssh/test/ssh_trpt_test_lib.erl
@@ -73,7 +73,10 @@ exec(Op, S0=#s{}) ->
op(Op, S1))
of
S = #s{} ->
- print_traces(S),
+ case proplists:get_value(silent,S#s.opts) of
+ true -> ok;
+ _ -> print_traces(S)
+ end,
{ok,S}
catch
{fail,Reason,Se} ->
@@ -383,7 +386,14 @@ send(S0, Line) when is_binary(Line) ->
fun(X) when X==true;X==detail -> {"Send line~n~p~n",[Line]} end),
send_bytes(Line, S#s{return_value = Line});
-%%% Msg = #ssh_msg_*{}
+send(S0, {special,Msg,PacketFun}) when is_tuple(Msg),
+ is_function(PacketFun,2) ->
+ S = opt(print_messages, S0,
+ fun(X) when X==true;X==detail -> {"Send~n~s~n",[format_msg(Msg)]} end),
+ {Packet, C} = PacketFun(Msg, S#s.ssh),
+ send_bytes(Packet, S#s{ssh = C, %%inc_send_seq_num(C),
+ return_value = Msg});
+
send(S0, Msg) when is_tuple(Msg) ->
S = opt(print_messages, S0,
fun(X) when X==true;X==detail -> {"Send~n~s~n",[format_msg(Msg)]} end),
@@ -743,7 +753,7 @@ print_traces(S) ->
[case Len-length(Acc)-1 of
0 ->
io_lib:format(Fmt,Args);
- N ->
+ _N ->
io_lib:format(lists:concat(['~p --------~n',Fmt]),
[Len-length(Acc)-1|Args])
end | Acc]
diff --git a/lib/ssh/test/ssh_upgrade_SUITE.erl b/lib/ssh/test/ssh_upgrade_SUITE.erl
index 85f4d36258..0d936c118b 100644
--- a/lib/ssh/test/ssh_upgrade_SUITE.erl
+++ b/lib/ssh/test/ssh_upgrade_SUITE.erl
@@ -46,20 +46,17 @@ all() ->
init_per_suite(Config0) ->
catch crypto:stop(),
- try {crypto:start(), erlang:system_info({wordsize, internal}) ==
- erlang:system_info({wordsize, external})} of
- {ok, true} ->
- case ct_release_test:init(Config0) of
- {skip, Reason} ->
- {skip, Reason};
- Config ->
- ssh:start(),
- Config
- end;
- {ok, false} ->
- {skip, "Test server will not handle halfwordemulator correctly. Skip as halfwordemulator is deprecated"}
+ try crypto:start() of
+ ok ->
+ case ct_release_test:init(Config0) of
+ {skip, Reason} ->
+ {skip, Reason};
+ Config ->
+ ssh:start(),
+ Config
+ end
catch _:_ ->
- {skip, "Crypto did not start"}
+ {skip, "Crypto did not start"}
end.
end_per_suite(Config) ->
diff --git a/lib/ssh/vsn.mk b/lib/ssh/vsn.mk
index b305eedcdc..d828bccd29 100644
--- a/lib/ssh/vsn.mk
+++ b/lib/ssh/vsn.mk
@@ -1,4 +1,4 @@
#-*-makefile-*- ; force emacs to enter makefile-mode
-SSH_VSN = 4.1
+SSH_VSN = 4.2
APP_VSN = "ssh-$(SSH_VSN)"
diff --git a/lib/ssl/doc/src/notes.xml b/lib/ssl/doc/src/notes.xml
index b87b1b4fa7..6faa3d5f9a 100644
--- a/lib/ssl/doc/src/notes.xml
+++ b/lib/ssl/doc/src/notes.xml
@@ -26,7 +26,63 @@
<file>notes.xml</file>
</header>
<p>This document describes the changes made to the SSL application.</p>
- <section><title>SSL 7.0</title>
+ <section><title>SSL 7.1</title>
+
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p>
+ Add DER encoded ECPrivateKey as valid input format for
+ key option.</p>
+ <p>
+ Own Id: OTP-12974</p>
+ </item>
+ <item>
+ <p>
+ Correct return value of default session callback module</p>
+ <p>
+ This error had the symptom that the client check for
+ unique session would always fail, potentially making the
+ client session table grow a lot and causing long setup
+ times.</p>
+ <p>
+ Own Id: OTP-12980</p>
+ </item>
+ </list>
+ </section>
+
+
+ <section><title>Improvements and New Features</title>
+ <list>
+ <item>
+ <p>
+ Add possibility to downgrade an SSL/TLS connection to a
+ tcp connection, and give back the socket control to a
+ user process.</p>
+ <p>
+ This also adds the possibility to specify a timeout to
+ the ssl:close function.</p>
+ <p>
+ Own Id: OTP-11397</p>
+ </item>
+ <item>
+ <p>
+ Add application setting to be able to change fatal alert
+ shutdown timeout, also shorten the default timeout. The
+ fatal alert timeout is the number of milliseconds between
+ sending of a fatal alert and closing the connection.
+ Waiting a little while improves the peers chances to
+ properly receiving the alert so it may shutdown
+ gracefully.</p>
+ <p>
+ Own Id: OTP-12832</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
+<section><title>SSL 7.0</title>
<section><title>Fixed Bugs and Malfunctions</title>
<list>
diff --git a/lib/ssl/doc/src/ssl.xml b/lib/ssl/doc/src/ssl.xml
index 6c977bdb74..22ac98c24e 100644
--- a/lib/ssl/doc/src/ssl.xml
+++ b/lib/ssl/doc/src/ssl.xml
@@ -766,6 +766,21 @@ fun(srp, Username :: string(), UserState :: term()) ->
</func>
<func>
+ <name>close(SslSocket, How) -> ok | {ok, port()} | {error, Reason}</name>
+ <fsummary>Closes an SSL connection.</fsummary>
+ <type>
+ <v>SslSocket = sslsocket()</v>
+ <v>How = timeout() | {NewController::pid(), timeout()} </v>
+ <v>Reason = term()</v>
+ </type>
+ <desc><p>Closes or downgrades an SSL connection, in the later case the transport
+ connection will be handed over to the <c>NewController</c> process after reciving
+ the TLS close alert from the peer. The retuned transport socket will have
+ the following options set [{active, false}, {packet, 0}, {mode, binary}].</p>
+ </desc>
+ </func>
+
+ <func>
<name>connection_info(SslSocket) ->
{ok, {ProtocolVersion, CipherSuite}} | {error, Reason}</name>
<fsummary>Returns the Negotiated Protocol version and cipher suite.
diff --git a/lib/ssl/doc/src/ssl_app.xml b/lib/ssl/doc/src/ssl_app.xml
index 2b6dc7e8be..51ce0cedf1 100644
--- a/lib/ssl/doc/src/ssl_app.xml
+++ b/lib/ssl/doc/src/ssl_app.xml
@@ -87,6 +87,17 @@
marker="ssl#clear_pem_cache-0">ssl:clear_pem_cache/0</seealso>
</item>
+ <tag><c><![CDATA[alert_timeout = integer() <optional>]]></c></tag>
+ <item>
+ <p>
+ Number of milliseconds between sending of a fatal alert and
+ closing the connection. Waiting a little while improves the
+ peers chances to properly receiving the alert so it may
+ shutdown gracefully. Defaults to 5000 milliseconds.
+ </p>
+ </item>
+
+
</taglist>
</section>
diff --git a/lib/ssl/src/ssl.appup.src b/lib/ssl/src/ssl.appup.src
index 1476336039..8d5bd6f8d8 100644
--- a/lib/ssl/src/ssl.appup.src
+++ b/lib/ssl/src/ssl.appup.src
@@ -1,12 +1,24 @@
%% -*- erlang -*-
{"%VSN%",
[
+ {<<"7\\.0">>, [{load_module, ssl, soft_purge, soft_purge, []},
+ {load_module, ssl_connection, soft_purge, soft_purge, []},
+ {load_module, tls_connection, soft_purge, soft_purge, []},
+ {load_module, ssl_session, soft_purge, soft_purge, []},
+ {load_module, ssl_session_cache, soft_purge, soft_purge, []}
+ ]},
{<<"6\\..*">>, [{restart_application, ssl}]},
{<<"5\\..*">>, [{restart_application, ssl}]},
{<<"4\\..*">>, [{restart_application, ssl}]},
{<<"3\\..*">>, [{restart_application, ssl}]}
],
[
+ {<<"7\\.0">>, [{load_module, ssl, soft_purge, soft_purge, []},
+ {load_module, ssl_connection, soft_purge, soft_purge, []},
+ {load_module, tls_connection, soft_purge, soft_purge, []},
+ {load_module, ssl_session, soft_purge, soft_purge, []},
+ {load_module, ssl_session_cache, soft_purge, soft_purge, []}
+ ]},
{<<"6\\..*">>, [{restart_application, ssl}]},
{<<"5\\..*">>, [{restart_application, ssl}]},
{<<"4\\..*">>, [{restart_application, ssl}]},
diff --git a/lib/ssl/src/ssl.erl b/lib/ssl/src/ssl.erl
index 9f2af73204..03495cfd90 100644
--- a/lib/ssl/src/ssl.erl
+++ b/lib/ssl/src/ssl.erl
@@ -34,7 +34,7 @@
listen/2, transport_accept/1, transport_accept/2,
ssl_accept/1, ssl_accept/2, ssl_accept/3,
controlling_process/2, peername/1, peercert/1, sockname/1,
- close/1, shutdown/2, recv/2, recv/3, send/2, getopts/2, setopts/2
+ close/1, close/2, shutdown/2, recv/2, recv/3, send/2, getopts/2, setopts/2
]).
%% SSL/TLS protocol handling
-export([cipher_suites/0, cipher_suites/1, suite_definition/1,
@@ -99,7 +99,8 @@ stop() ->
connect(Socket, SslOptions) when is_port(Socket) ->
connect(Socket, SslOptions, infinity).
-connect(Socket, SslOptions0, Timeout) when is_port(Socket) ->
+connect(Socket, SslOptions0, Timeout) when is_port(Socket),
+ (is_integer(Timeout) andalso Timeout > 0) or (Timeout == infinity) ->
{Transport,_,_,_} = proplists:get_value(cb_info, SslOptions0,
{gen_tcp, tcp, tcp_closed, tcp_error}),
EmulatedOptions = ssl_socket:emulated_options(),
@@ -125,7 +126,7 @@ connect(Socket, SslOptions0, Timeout) when is_port(Socket) ->
connect(Host, Port, Options) ->
connect(Host, Port, Options, infinity).
-connect(Host, Port, Options, Timeout) ->
+connect(Host, Port, Options, Timeout) when (is_integer(Timeout) andalso Timeout > 0) or (Timeout == infinity) ->
try handle_options(Options) of
{ok, Config} ->
do_connect(Host,Port,Config,Timeout)
@@ -175,7 +176,7 @@ transport_accept(#sslsocket{pid = {ListenSocket,
#config{transport_info = {Transport,_,_, _} =CbInfo,
connection_cb = ConnectionCb,
ssl = SslOpts,
- emulated = Tracker}}}, Timeout) ->
+ emulated = Tracker}}}, Timeout) when (is_integer(Timeout) andalso Timeout > 0) or (Timeout == infinity) ->
case Transport:accept(ListenSocket, Timeout) of
{ok, Socket} ->
{ok, EmOpts} = ssl_socket:get_emulated_opts(Tracker),
@@ -208,15 +209,16 @@ transport_accept(#sslsocket{pid = {ListenSocket,
ssl_accept(ListenSocket) ->
ssl_accept(ListenSocket, infinity).
-ssl_accept(#sslsocket{} = Socket, Timeout) ->
+ssl_accept(#sslsocket{} = Socket, Timeout) when (is_integer(Timeout) andalso Timeout > 0) or (Timeout == infinity) ->
ssl_connection:handshake(Socket, Timeout);
ssl_accept(ListenSocket, SslOptions) when is_port(ListenSocket) ->
ssl_accept(ListenSocket, SslOptions, infinity).
-ssl_accept(#sslsocket{} = Socket, [], Timeout) ->
+ssl_accept(#sslsocket{} = Socket, [], Timeout) when (is_integer(Timeout) andalso Timeout > 0) or (Timeout == infinity)->
ssl_accept(#sslsocket{} = Socket, Timeout);
-ssl_accept(#sslsocket{fd = {_, _, _, Tracker}} = Socket, SslOpts0, Timeout) ->
+ssl_accept(#sslsocket{fd = {_, _, _, Tracker}} = Socket, SslOpts0, Timeout) when
+ (is_integer(Timeout) andalso Timeout > 0) or (Timeout == infinity)->
try
{ok, EmOpts, InheritedSslOpts} = ssl_socket:get_all_opts(Tracker),
SslOpts = handle_options(SslOpts0, InheritedSslOpts),
@@ -224,7 +226,8 @@ ssl_accept(#sslsocket{fd = {_, _, _, Tracker}} = Socket, SslOpts0, Timeout) ->
catch
Error = {error, _Reason} -> Error
end;
-ssl_accept(Socket, SslOptions, Timeout) when is_port(Socket) ->
+ssl_accept(Socket, SslOptions, Timeout) when is_port(Socket),
+ (is_integer(Timeout) andalso Timeout > 0) or (Timeout == infinity) ->
{Transport,_,_,_} =
proplists:get_value(cb_info, SslOptions, {gen_tcp, tcp, tcp_closed, tcp_error}),
EmulatedOptions = ssl_socket:emulated_options(),
@@ -247,11 +250,27 @@ ssl_accept(Socket, SslOptions, Timeout) when is_port(Socket) ->
%% Description: Close an ssl connection
%%--------------------------------------------------------------------
close(#sslsocket{pid = Pid}) when is_pid(Pid) ->
- ssl_connection:close(Pid);
+ ssl_connection:close(Pid, {close, ?DEFAULT_TIMEOUT});
close(#sslsocket{pid = {ListenSocket, #config{transport_info={Transport,_, _, _}}}}) ->
Transport:close(ListenSocket).
%%--------------------------------------------------------------------
+-spec close(#sslsocket{}, integer() | {pid(), integer()}) -> term().
+%%
+%% Description: Close an ssl connection
+%%--------------------------------------------------------------------
+close(#sslsocket{pid = TLSPid},
+ {Pid, Timeout} = DownGrade) when is_pid(TLSPid),
+ is_pid(Pid),
+ (is_integer(Timeout) andalso Timeout > 0) or (Timeout == infinity) ->
+ ssl_connection:close(TLSPid, {close, DownGrade});
+close(#sslsocket{pid = TLSPid}, Timeout) when is_pid(TLSPid),
+ (is_integer(Timeout) andalso Timeout > 0) or (Timeout == infinity) ->
+ ssl_connection:close(TLSPid, {close, Timeout});
+close(#sslsocket{pid = {ListenSocket, #config{transport_info={Transport,_, _, _}}}}, _) ->
+ Transport:close(ListenSocket).
+
+%%--------------------------------------------------------------------
-spec send(#sslsocket{}, iodata()) -> ok | {error, reason()}.
%%
%% Description: Sends data over the ssl connection
@@ -269,7 +288,8 @@ send(#sslsocket{pid = {ListenSocket, #config{transport_info={Transport, _, _, _}
%%--------------------------------------------------------------------
recv(Socket, Length) ->
recv(Socket, Length, infinity).
-recv(#sslsocket{pid = Pid}, Length, Timeout) when is_pid(Pid) ->
+recv(#sslsocket{pid = Pid}, Length, Timeout) when is_pid(Pid),
+ (is_integer(Timeout) andalso Timeout > 0) or (Timeout == infinity)->
ssl_connection:recv(Pid, Length, Timeout);
recv(#sslsocket{pid = {Listen,
#config{transport_info = {Transport, _, _, _}}}}, _,_) when is_port(Listen)->
@@ -804,6 +824,7 @@ validate_option(key, {KeyType, Value}) when is_binary(Value),
KeyType == dsa; %% Backwards compatibility
KeyType == 'RSAPrivateKey';
KeyType == 'DSAPrivateKey';
+ KeyType == 'ECPrivateKey';
KeyType == 'PrivateKeyInfo' ->
{KeyType, Value};
diff --git a/lib/ssl/src/ssl_connection.erl b/lib/ssl/src/ssl_connection.erl
index 5b754c16bc..f8afbdb41d 100644
--- a/lib/ssl/src/ssl_connection.erl
+++ b/lib/ssl/src/ssl_connection.erl
@@ -41,7 +41,7 @@
socket_control/4, socket_control/5]).
%% User Events
--export([send/2, recv/3, close/1, shutdown/2,
+-export([send/2, recv/3, close/2, shutdown/2,
new_user/2, get_opts/2, set_opts/2, session_info/1,
peer_certificate/1, renegotiation/1, negotiated_protocol/1, prf/5,
connection_information/1
@@ -171,18 +171,19 @@ connection_information(Pid) when is_pid(Pid) ->
sync_send_all_state_event(Pid, connection_information).
%%--------------------------------------------------------------------
--spec close(pid()) -> ok | {error, reason()}.
+-spec close(pid(), {close, Timeout::integer() |
+ {NewController::pid(), Timeout::integer()}}) ->
+ ok | {ok, port()} | {error, reason()}.
%%
%% Description: Close an ssl connection
%%--------------------------------------------------------------------
-close(ConnectionPid) ->
- case sync_send_all_state_event(ConnectionPid, close) of
+close(ConnectionPid, How) ->
+ case sync_send_all_state_event(ConnectionPid, How) of
{error, closed} ->
ok;
Other ->
Other
end.
-
%%--------------------------------------------------------------------
-spec shutdown(pid(), atom()) -> ok | {error, reason()}.
%%
@@ -706,12 +707,12 @@ handle_sync_event({start, Timeout}, StartFrom, StateName, #state{role = Role, s
{stop, normal, {error, Error}, State0}
end;
-handle_sync_event(close, _, StateName, #state{protocol_cb = Connection} = State) ->
- %% Run terminate before returning
- %% so that the reuseaddr inet-option will work
- %% as intended.
- (catch Connection:terminate(user_close, StateName, State)),
- {stop, normal, ok, State#state{terminated = true}};
+handle_sync_event({close, _} = Close, _, StateName, #state{protocol_cb = Connection} = State) ->
+ %% Run terminate before returning so that the reuseaddr
+ %% inet-option and possible downgrade will work as intended.
+ Result = Connection:terminate(Close, StateName, State),
+ {stop, normal, Result, State#state{terminated = true}};
+
handle_sync_event({shutdown, How0}, _, StateName,
#state{transport_cb = Transport,
negotiated_version = Version,
@@ -901,41 +902,46 @@ terminate(_, _, #state{terminated = true}) ->
%% we want to guarantee that Transport:close has been called
%% when ssl:close/1 returns.
ok;
-terminate({shutdown, transport_closed}, StateName, #state{send_queue = SendQueue,
- renegotiation = Renegotiate} = State) ->
- handle_unrecv_data(StateName, State),
+terminate({shutdown, transport_closed} = Reason,
+ _StateName, #state{send_queue = SendQueue, protocol_cb = Connection,
+ socket = Socket, transport_cb = Transport,
+ renegotiation = Renegotiate} = State) ->
handle_trusted_certs_db(State),
notify_senders(SendQueue),
- notify_renegotiater(Renegotiate);
-
-terminate({shutdown, own_alert}, _StateName, #state{send_queue = SendQueue,
- renegotiation = Renegotiate} = State) ->
+ notify_renegotiater(Renegotiate),
+ Connection:close(Reason, Socket, Transport, undefined, undefined);
+terminate({shutdown, own_alert}, _StateName, #state{send_queue = SendQueue, protocol_cb = Connection,
+ socket = Socket, transport_cb = Transport,
+ renegotiation = Renegotiate} = State) ->
handle_trusted_certs_db(State),
notify_senders(SendQueue),
- notify_renegotiater(Renegotiate);
+ notify_renegotiater(Renegotiate),
+ case application:get_env(ssl, alert_timeout) of
+ {ok, Timeout} when is_integer(Timeout) ->
+ Connection:close({timeout, Timeout}, Socket, Transport, undefined, undefined);
+ _ ->
+ Connection:close({timeout, ?DEFAULT_TIMEOUT}, Socket, Transport, undefined, undefined)
+ end;
terminate(Reason, connection, #state{negotiated_version = Version,
protocol_cb = Connection,
- connection_states = ConnectionStates,
+ connection_states = ConnectionStates0,
+ ssl_options = #ssl_options{padding_check = Check},
transport_cb = Transport, socket = Socket,
send_queue = SendQueue, renegotiation = Renegotiate} = State) ->
handle_trusted_certs_db(State),
notify_senders(SendQueue),
notify_renegotiater(Renegotiate),
- BinAlert = terminate_alert(Reason, Version, ConnectionStates),
+ {BinAlert, ConnectionStates} = terminate_alert(Reason, Version, ConnectionStates0),
Transport:send(Socket, BinAlert),
- case Connection of
- tls_connection ->
- tls_connection:workaround_transport_delivery_problems(Socket, Transport);
- _ ->
- ok
- end;
-terminate(_Reason, _StateName, #state{transport_cb = Transport,
+ Connection:close(Reason, Socket, Transport, ConnectionStates, Check);
+
+terminate(Reason, _StateName, #state{transport_cb = Transport, protocol_cb = Connection,
socket = Socket, send_queue = SendQueue,
renegotiation = Renegotiate} = State) ->
handle_trusted_certs_db(State),
notify_senders(SendQueue),
notify_renegotiater(Renegotiate),
- Transport:close(Socket).
+ Connection:close(Reason, Socket, Transport, undefined, undefined).
format_status(normal, [_, State]) ->
[{data, [{"StateData", State}]}];
@@ -1758,30 +1764,17 @@ get_timeout(#state{ssl_options=#ssl_options{hibernate_after = undefined}}) ->
get_timeout(#state{ssl_options=#ssl_options{hibernate_after = HibernateAfter}}) ->
HibernateAfter.
-terminate_alert(Reason, Version, ConnectionStates) when Reason == normal;
- Reason == user_close ->
- {BinAlert, _} = ssl_alert:encode(?ALERT_REC(?WARNING, ?CLOSE_NOTIFY),
- Version, ConnectionStates),
- BinAlert;
-terminate_alert({shutdown, _}, Version, ConnectionStates) ->
- {BinAlert, _} = ssl_alert:encode(?ALERT_REC(?WARNING, ?CLOSE_NOTIFY),
- Version, ConnectionStates),
- BinAlert;
+terminate_alert(normal, Version, ConnectionStates) ->
+ ssl_alert:encode(?ALERT_REC(?WARNING, ?CLOSE_NOTIFY),
+ Version, ConnectionStates);
+terminate_alert({Reason, _}, Version, ConnectionStates) when Reason == close;
+ Reason == shutdown ->
+ ssl_alert:encode(?ALERT_REC(?WARNING, ?CLOSE_NOTIFY),
+ Version, ConnectionStates);
terminate_alert(_, Version, ConnectionStates) ->
- {BinAlert, _} = ssl_alert:encode(?ALERT_REC(?FATAL, ?INTERNAL_ERROR),
- Version, ConnectionStates),
- BinAlert.
-
-handle_unrecv_data(StateName, #state{socket = Socket, transport_cb = Transport,
- protocol_cb = Connection} = State) ->
- ssl_socket:setopts(Transport, Socket, [{active, false}]),
- case Transport:recv(Socket, 0, 0) of
- {error, closed} ->
- ok;
- {ok, Data} ->
- Connection:handle_close_alert(Data, StateName, State)
- end.
+ ssl_alert:encode(?ALERT_REC(?FATAL, ?INTERNAL_ERROR),
+ Version, ConnectionStates).
handle_trusted_certs_db(#state{ssl_options = #ssl_options{cacertfile = <<>>, cacerts = []}}) ->
%% No trusted certs specified
diff --git a/lib/ssl/src/ssl_connection.hrl b/lib/ssl/src/ssl_connection.hrl
index 9a58f2b8f7..bb41ef2b62 100644
--- a/lib/ssl/src/ssl_connection.hrl
+++ b/lib/ssl/src/ssl_connection.hrl
@@ -48,27 +48,28 @@
socket_options :: #socket_options{},
connection_states :: #connection_states{} | secret_printout(),
protocol_buffers :: term() | secret_printout() , %% #protocol_buffers{} from tls_record.hrl or dtls_recor.hrl
- tls_handshake_history :: ssl_handshake:ssl_handshake_history() | secret_printout(),
- cert_db :: reference(),
+ tls_handshake_history :: ssl_handshake:ssl_handshake_history() | secret_printout()
+ | 'undefined',
+ cert_db :: reference() | 'undefined',
session :: #session{} | secret_printout(),
session_cache :: db_handle(),
session_cache_cb :: atom(),
crl_db :: term(),
- negotiated_version :: ssl_record:ssl_version(),
+ negotiated_version :: ssl_record:ssl_version() | 'undefined',
client_certificate_requested = false :: boolean(),
key_algorithm :: ssl_cipher:key_algo(),
hashsign_algorithm = {undefined, undefined},
cert_hashsign_algorithm,
- public_key_info :: ssl_handshake:public_key_info(),
- private_key :: public_key:private_key() | secret_printout(),
+ public_key_info :: ssl_handshake:public_key_info() | 'undefined',
+ private_key :: public_key:private_key() | secret_printout() | 'undefined',
diffie_hellman_params:: #'DHParameter'{} | undefined | secret_printout(),
diffie_hellman_keys :: {PublicKey :: binary(), PrivateKey :: binary()} | #'ECPrivateKey'{} | undefined | secret_printout(),
- psk_identity :: binary(), % server psk identity hint
- srp_params :: #srp_user{} | secret_printout(),
- srp_keys ::{PublicKey :: binary(), PrivateKey :: binary()} | secret_printout(),
- premaster_secret :: binary() | secret_printout() ,
+ psk_identity :: binary() | 'undefined', % server psk identity hint
+ srp_params :: #srp_user{} | secret_printout() | 'undefined',
+ srp_keys ::{PublicKey :: binary(), PrivateKey :: binary()} | secret_printout() | 'undefined',
+ premaster_secret :: binary() | secret_printout() | 'undefined',
file_ref_db :: db_handle(),
- cert_db_ref :: certdb_ref(),
+ cert_db_ref :: certdb_ref() | 'undefined',
bytes_to_read :: undefined | integer(), %% bytes to read in passive mode
user_data_buffer :: undefined | binary() | secret_printout(),
renegotiation :: undefined | {boolean(), From::term() | internal | peer},
@@ -81,7 +82,7 @@
expecting_finished = false ::boolean(),
negotiated_protocol = undefined :: undefined | binary(),
client_ecc, % {Curves, PointFmt}
- tracker :: pid(), %% Tracker process for listen socket
+ tracker :: pid() | 'undefined', %% Tracker process for listen socket
sni_hostname = undefined
}).
diff --git a/lib/ssl/src/ssl_internal.hrl b/lib/ssl/src/ssl_internal.hrl
index 3851b2bc6e..007723c982 100644
--- a/lib/ssl/src/ssl_internal.hrl
+++ b/lib/ssl/src/ssl_internal.hrl
@@ -90,16 +90,16 @@
validate_extensions_fun,
depth :: integer(),
certfile :: binary(),
- cert :: public_key:der_encoded() | secret_printout(),
+ cert :: public_key:der_encoded() | secret_printout() | 'undefined',
keyfile :: binary(),
- key :: {'RSAPrivateKey' | 'DSAPrivateKey' | 'ECPrivateKey' | 'PrivateKeyInfo', public_key:der_encoded()} | secret_printout(),
- password :: string() | secret_printout(),
- cacerts :: [public_key:der_encoded()] | secret_printout(),
+ key :: {'RSAPrivateKey' | 'DSAPrivateKey' | 'ECPrivateKey' | 'PrivateKeyInfo', public_key:der_encoded()} | secret_printout() | 'undefined',
+ password :: string() | secret_printout() | 'undefined',
+ cacerts :: [public_key:der_encoded()] | secret_printout() | 'undefined',
cacertfile :: binary(),
dh :: public_key:der_encoded() | secret_printout(),
- dhfile :: binary() | secret_printout(),
+ dhfile :: binary() | secret_printout() | 'undefined',
user_lookup_fun, % server option, fun to lookup the user
- psk_identity :: binary() | secret_printout() ,
+ psk_identity :: binary() | secret_printout() | 'undefined',
srp_identity, % client option {User, Password}
ciphers, %
%% Local policy for the server if it want's to reuse the session
@@ -115,7 +115,7 @@
%% undefined if not hibernating, or number of ms of
%% inactivity after which ssl_connection will go into
%% hibernation
- hibernate_after :: boolean(),
+ hibernate_after :: boolean() | 'undefined',
%% This option should only be set to true by inet_tls_dist
erl_dist = false :: boolean(),
alpn_advertised_protocols = undefined :: [binary()] | undefined ,
diff --git a/lib/ssl/src/ssl_session.erl b/lib/ssl/src/ssl_session.erl
index 1770faf1ff..0d6cc93a20 100644
--- a/lib/ssl/src/ssl_session.erl
+++ b/lib/ssl/src/ssl_session.erl
@@ -100,14 +100,14 @@ select_session([], _, _) ->
no_session;
select_session(Sessions, #ssl_options{ciphers = Ciphers}, OwnCert) ->
IsNotResumable =
- fun([_Id, Session]) ->
+ fun(Session) ->
not (resumable(Session#session.is_resumable) andalso
lists:member(Session#session.cipher_suite, Ciphers)
andalso (OwnCert == Session#session.own_certificate))
end,
case lists:dropwhile(IsNotResumable, Sessions) of
[] -> no_session;
- [[Id, _]|_] -> Id
+ [Session | _] -> Session#session.session_id
end.
is_resumable(_, _, #ssl_options{reuse_sessions = false}, _, _, _, _) ->
diff --git a/lib/ssl/src/ssl_session_cache.erl b/lib/ssl/src/ssl_session_cache.erl
index 11ed310477..cfc48cd935 100644
--- a/lib/ssl/src/ssl_session_cache.erl
+++ b/lib/ssl/src/ssl_session_cache.erl
@@ -83,7 +83,7 @@ foldl(Fun, Acc0, Cache) ->
%%--------------------------------------------------------------------
select_session(Cache, PartialKey) ->
ets:select(Cache,
- [{{{PartialKey,'$1'}, '$2'},[],['$$']}]).
+ [{{{PartialKey,'_'}, '$1'},[],['$1']}]).
%%--------------------------------------------------------------------
%%% Internal functions
diff --git a/lib/ssl/src/tls_connection.erl b/lib/ssl/src/tls_connection.erl
index 7fda2377ee..3093508f61 100644
--- a/lib/ssl/src/tls_connection.erl
+++ b/lib/ssl/src/tls_connection.erl
@@ -54,7 +54,7 @@
%% Alert and close handling
-export([send_alert/2, handle_own_alert/4, handle_close_alert/3,
handle_normal_shutdown/3, handle_unexpected_message/3,
- workaround_transport_delivery_problems/2, alert_user/6, alert_user/9
+ close/5, alert_user/6, alert_user/9
]).
%% Data handling
@@ -924,8 +924,7 @@ handle_own_alert(Alert, Version, StateName,
try %% Try to tell the other side
{BinMsg, _} =
ssl_alert:encode(Alert, Version, ConnectionStates),
- Transport:send(Socket, BinMsg),
- workaround_transport_delivery_problems(Socket, Transport)
+ Transport:send(Socket, BinMsg)
catch _:_ -> %% Can crash if we are in a uninitialized state
ignore
end,
@@ -977,21 +976,57 @@ invalidate_session(client, Host, Port, Session) ->
invalidate_session(server, _, Port, Session) ->
ssl_manager:invalidate_session(Port, Session).
-workaround_transport_delivery_problems(Socket, gen_tcp = Transport) ->
+%% User downgrades connection
+%% When downgrading an TLS connection to a transport connection
+%% we must recive the close message before releasing the
+%% transport socket.
+close({close, {Pid, Timeout}}, Socket, Transport, ConnectionStates, Check) when is_pid(Pid) ->
+ ssl_socket:setopts(Transport, Socket, [{active, false}, {packet, ssl_tls}]),
+ case Transport:recv(Socket, 0, Timeout) of
+ {ok, {ssl_tls, Socket, ?ALERT, Version, Fragment}} ->
+ case tls_record:decode_cipher_text(#ssl_tls{type = ?ALERT,
+ version = Version,
+ fragment = Fragment
+ }, ConnectionStates, Check) of
+ {#ssl_tls{fragment = Plain}, _} ->
+ [Alert| _] = decode_alerts(Plain),
+ downgrade(Alert, Transport, Socket, Pid)
+ end;
+ {error, timeout} ->
+ {error, timeout};
+ _ ->
+ {error, no_tls_close}
+ end;
+%% User closes or recursive call!
+close({close, Timeout}, Socket, Transport = gen_tcp, _,_) ->
+ ssl_socket:setopts(Transport, Socket, [{active, false}]),
+ Transport:shutdown(Socket, write),
+ _ = Transport:recv(Socket, 0, Timeout),
+ ok;
+%% Peer closed socket
+close({shutdown, transport_closed}, Socket, Transport = gen_tcp, ConnectionStates, Check) ->
+ close({close, 0}, Socket, Transport, ConnectionStates, Check);
+%% We generate fatal alert
+close({shutdown, own_alert}, Socket, Transport = gen_tcp, ConnectionStates, Check) ->
%% Standard trick to try to make sure all
%% data sent to the tcp port is really delivered to the
%% peer application before tcp port is closed so that the peer will
%% get the correct TLS alert message and not only a transport close.
- ssl_socket:setopts(Transport, Socket, [{active, false}]),
- Transport:shutdown(Socket, write),
- %% Will return when other side has closed or after 30 s
+ %% Will return when other side has closed or after timout millisec
%% e.g. we do not want to hang if something goes wrong
%% with the network but we want to maximise the odds that
%% peer application gets all data sent on the tcp connection.
- Transport:recv(Socket, 0, 30000);
-workaround_transport_delivery_problems(Socket, Transport) ->
+ close({close, ?DEFAULT_TIMEOUT}, Socket, Transport, ConnectionStates, Check);
+%% Other
+close(_, Socket, Transport, _,_) ->
Transport:close(Socket).
-
+downgrade(#alert{description = ?CLOSE_NOTIFY}, Transport, Socket, Pid) ->
+ ssl_socket:setopts(Transport, Socket, [{active, false}, {packet, 0}, {mode, binary}]),
+ Transport:controlling_process(Socket, Pid),
+ {ok, Socket};
+downgrade(_, _,_,_) ->
+ {error, no_tls_close}.
+
convert_state(#state{ssl_options = Options} = State, up, "5.3.5", "5.3.6") ->
State#state{ssl_options = convert_options_partial_chain(Options, up)};
convert_state(#state{ssl_options = Options} = State, down, "5.3.6", "5.3.5") ->
diff --git a/lib/ssl/test/ssl_ECC_SUITE.erl b/lib/ssl/test/ssl_ECC_SUITE.erl
index 85152fda22..3a9f21ea99 100644
--- a/lib/ssl/test/ssl_ECC_SUITE.erl
+++ b/lib/ssl/test/ssl_ECC_SUITE.erl
@@ -46,7 +46,7 @@ groups() ->
{'tlsv1', [], all_versions_groups()},
{'erlang_server', [], key_cert_combinations()},
{'erlang_client', [], key_cert_combinations()},
- {'erlang', [], key_cert_combinations()}
+ {'erlang', [], key_cert_combinations() ++ misc()}
].
all_versions_groups ()->
@@ -65,6 +65,9 @@ key_cert_combinations() ->
client_rsa_server_ecdsa
].
+misc()->
+ [client_ecdsa_server_ecdsa_with_raw_key].
+
%%--------------------------------------------------------------------
init_per_suite(Config0) ->
end_per_suite(Config0),
@@ -189,6 +192,32 @@ client_rsa_server_ecdsa(Config) when is_list(Config) ->
SOpts = ?config(server_ecdsa_verify_opts, Config),
basic_test(COpts, SOpts, Config).
+client_ecdsa_server_ecdsa_with_raw_key(Config) when is_list(Config) ->
+ COpts = ?config(client_ecdsa_opts, Config),
+ SOpts = ?config(server_ecdsa_verify_opts, Config),
+ ServerCert = proplists:get_value(certfile, SOpts),
+ ServerKeyFile = proplists:get_value(keyfile, SOpts),
+ {ok, PemBin} = file:read_file(ServerKeyFile),
+ PemEntries = public_key:pem_decode(PemBin),
+ {'ECPrivateKey', Key, not_encrypted} = proplists:lookup('ECPrivateKey', PemEntries),
+ ServerKey = {'ECPrivateKey', Key},
+ ServerCA = proplists:get_value(cacertfile, SOpts),
+ ClientCert = proplists:get_value(certfile, COpts),
+ ClientKey = proplists:get_value(keyfile, COpts),
+ ClientCA = proplists:get_value(cacertfile, COpts),
+ SType = ?config(server_type, Config),
+ CType = ?config(client_type, Config),
+ {Server, Port} = start_server_with_raw_key(SType,
+ ClientCA, ServerCA,
+ ServerCert,
+ ServerKey,
+ Config),
+ Client = start_client(CType, Port, ServerCA, ClientCA,
+ ClientCert,
+ ClientKey, Config),
+ check_result(Server, SType, Client, CType),
+ close(Server, Client).
+
%%--------------------------------------------------------------------
%% Internal functions ------------------------------------------------
%%--------------------------------------------------------------------
@@ -247,9 +276,7 @@ start_server(openssl, CA, OwnCa, Cert, Key, Config) ->
OpenSslPort = open_port({spawn, Cmd}, [stderr_to_stdout]),
true = port_command(OpenSslPort, "Hello world"),
{OpenSslPort, Port};
-
start_server(erlang, CA, _, Cert, Key, Config) ->
-
{_, ServerNode, _} = ssl_test_lib:run_where(Config),
Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0},
{from, self()},
@@ -260,6 +287,17 @@ start_server(erlang, CA, _, Cert, Key, Config) ->
[{verify, verify_peer}, {cacertfile, CA},
{certfile, Cert}, {keyfile, Key}]}]),
{Server, ssl_test_lib:inet_port(Server)}.
+start_server_with_raw_key(erlang, CA, _, Cert, Key, Config) ->
+ {_, ServerNode, _} = ssl_test_lib:run_where(Config),
+ Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0},
+ {from, self()},
+ {mfa, {ssl_test_lib,
+ send_recv_result_active,
+ []}},
+ {options,
+ [{verify, verify_peer}, {cacertfile, CA},
+ {certfile, Cert}, {key, Key}]}]),
+ {Server, ssl_test_lib:inet_port(Server)}.
check_result(Server, erlang, Client, erlang) ->
ssl_test_lib:check_result(Server, ok, Client, ok);
diff --git a/lib/ssl/test/ssl_basic_SUITE.erl b/lib/ssl/test/ssl_basic_SUITE.erl
index 378f42c2ee..6f6107de2c 100644
--- a/lib/ssl/test/ssl_basic_SUITE.erl
+++ b/lib/ssl/test/ssl_basic_SUITE.erl
@@ -129,6 +129,8 @@ api_tests() ->
controlling_process,
upgrade,
upgrade_with_timeout,
+ downgrade,
+ close_with_timeout,
shutdown,
shutdown_write,
shutdown_both,
@@ -320,7 +322,8 @@ init_per_testcase(rizzo, Config) ->
Config;
init_per_testcase(TestCase, Config) when TestCase == ssl_accept_timeout;
- TestCase == client_closes_socket ->
+ TestCase == client_closes_socket;
+ TestCase == downgrade ->
ct:log("TLS/SSL version ~p~n ", [tls_record:supported_protocol_versions()]),
ct:timetrap({seconds, 15}),
Config;
@@ -1408,6 +1411,53 @@ upgrade_with_timeout(Config) when is_list(Config) ->
ssl_test_lib:close(Client).
%%--------------------------------------------------------------------
+downgrade() ->
+ [{doc,"Test that you can downgarde an ssl connection to an tcp connection"}].
+downgrade(Config) when is_list(Config) ->
+ ClientOpts = ?config(client_opts, Config),
+ ServerOpts = ?config(server_opts, Config),
+
+ {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config),
+
+ Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0},
+ {from, self()},
+ {mfa, {?MODULE, tls_downgrade, []}},
+ {options, [{active, false} | ServerOpts]}]),
+ Port = ssl_test_lib:inet_port(Server),
+ Client = ssl_test_lib:start_client([{node, ClientNode}, {port, Port},
+ {host, Hostname},
+ {from, self()},
+ {mfa, {?MODULE, tls_downgrade, []}},
+ {options, [{active, false} |ClientOpts]}]),
+
+ ssl_test_lib:check_result(Server, ok, Client, ok),
+ ssl_test_lib:close(Server),
+ ssl_test_lib:close(Client).
+
+%%--------------------------------------------------------------------
+close_with_timeout() ->
+ [{doc,"Test normal (not downgrade) ssl:close/2"}].
+close_with_timeout(Config) when is_list(Config) ->
+ ClientOpts = ?config(client_opts, Config),
+ ServerOpts = ?config(server_opts, Config),
+
+ {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config),
+
+ Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0},
+ {from, self()},
+ {mfa, {?MODULE, tls_close, []}},
+ {options,[{active, false} | ServerOpts]}]),
+ Port = ssl_test_lib:inet_port(Server),
+ Client = ssl_test_lib:start_client([{node, ClientNode}, {port, Port},
+ {host, Hostname},
+ {from, self()},
+ {mfa, {?MODULE, tls_close, []}},
+ {options, [{active, false} |ClientOpts]}]),
+
+ ssl_test_lib:check_result(Server, ok, Client, ok).
+
+
+%%--------------------------------------------------------------------
tcp_connect() ->
[{doc,"Test what happens when a tcp tries to connect, i,e. a bad (ssl) packet is sent first"}].
@@ -3931,6 +3981,33 @@ connect_dist_c(S) ->
{ok, Test} = ssl:recv(S, 0, 10000),
ok.
+tls_downgrade(Socket) ->
+ ok = ssl_test_lib:send_recv_result(Socket),
+ case ssl:close(Socket, {self(), 10000}) of
+ {ok, TCPSocket} ->
+ inet:setopts(TCPSocket, [{active, true}]),
+ gen_tcp:send(TCPSocket, "Downgraded"),
+ receive
+ {tcp, TCPSocket, <<"Downgraded">>} ->
+ ok;
+ {tcp_closed, TCPSocket} ->
+ ct:pal("Peer timed out, downgrade aborted"),
+ ok;
+ Other ->
+ {error, Other}
+ end;
+ {error, timeout} ->
+ ct:pal("Timed out, downgrade aborted"),
+ ok;
+ Fail ->
+ {error, Fail}
+ end.
+
+tls_close(Socket) ->
+ ok = ssl_test_lib:send_recv_result(Socket),
+ ok = ssl:close(Socket, 5000).
+
+
%% First two clauses handles 1/n-1 splitting countermeasure Rizzo/Duong-Beast
treashold(N, {3,0}) ->
(N div 2) + 1;
diff --git a/lib/ssl/test/ssl_session_cache_SUITE.erl b/lib/ssl/test/ssl_session_cache_SUITE.erl
index 8ddc5db4b2..924898f6fa 100644
--- a/lib/ssl/test/ssl_session_cache_SUITE.erl
+++ b/lib/ssl/test/ssl_session_cache_SUITE.erl
@@ -45,7 +45,8 @@
all() ->
[session_cleanup,
session_cache_process_list,
- session_cache_process_mnesia].
+ session_cache_process_mnesia,
+ client_unique_session].
groups() ->
[].
@@ -90,8 +91,8 @@ init_per_testcase(session_cleanup, Config) ->
ct:timetrap({seconds, 20}),
Config;
-init_per_testcase(_TestCase, Config) ->
- ct:timetrap({seconds, 5}),
+init_per_testcase(client_unique_session, Config) ->
+ ct:timetrap({seconds, 20}),
Config.
init_customized_session_cache(Type, Config) ->
@@ -131,10 +132,40 @@ end_per_testcase(_, Config) ->
%%--------------------------------------------------------------------
%% Test Cases --------------------------------------------------------
%%--------------------------------------------------------------------
+client_unique_session() ->
+ [{doc, "Test session table does not grow when client "
+ "sets up many connections"}].
+client_unique_session(Config) when is_list(Config) ->
+ process_flag(trap_exit, true),
+ ClientOpts = ?config(client_opts, Config),
+ ServerOpts = ?config(server_opts, Config),
+ {ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config),
+ Server =
+ ssl_test_lib:start_server([{node, ServerNode}, {port, 0},
+ {from, self()},
+ {mfa, {ssl_test_lib, no_result, []}},
+ {tcp_options, [{active, false}]},
+ {options, ServerOpts}]),
+ Port = ssl_test_lib:inet_port(Server),
+ LastClient = clients_start(Server,
+ ClientNode, Hostname, Port, ClientOpts, 20),
+ receive
+ {LastClient, {ok, _}} ->
+ ok
+ end,
+ {status, _, _, StatusInfo} = sys:get_status(whereis(ssl_manager)),
+ [_, _,_, _, Prop] = StatusInfo,
+ State = ssl_test_lib:state(Prop),
+ ClientCache = element(2, State),
+ 1 = ets:info(ClientCache, size),
+
+ ssl_test_lib:close(Server, 500),
+ ssl_test_lib:close(LastClient).
+
session_cleanup() ->
[{doc, "Test that sessions are cleand up eventually, so that the session table "
"does not grow and grow ..."}].
-session_cleanup(Config)when is_list(Config) ->
+session_cleanup(Config) when is_list(Config) ->
process_flag(trap_exit, true),
ClientOpts = ?config(client_opts, Config),
ServerOpts = ?config(server_opts, Config),
@@ -148,9 +179,9 @@ session_cleanup(Config)when is_list(Config) ->
Port = ssl_test_lib:inet_port(Server),
Client =
ssl_test_lib:start_client([{node, ClientNode},
- {port, Port}, {host, Hostname},
+ {port, Port}, {host, Hostname},
{mfa, {ssl_test_lib, no_result, []}},
- {from, self()}, {options, ClientOpts}]),
+ {from, self()}, {options, ClientOpts}]),
SessionInfo =
receive
{Server, Info} ->
@@ -325,8 +356,8 @@ select_session(Cache, PartialKey) ->
mnesia ->
Sel = fun() ->
mnesia:select(Cache,
- [{{Cache,{PartialKey,'$1'}, '$2'},
- [],['$$']}])
+ [{{Cache,{PartialKey,'_'}, '$1'},
+ [],['$1']}])
end,
{atomic, Res} = mnesia:transaction(Sel),
Res
@@ -354,8 +385,8 @@ session_loop(Sess) ->
Pid ! {self(), Res},
session_loop(Sess);
{Pid,select_session,PKey} ->
- Sel = fun({{PKey0, Id},Session}, Acc) when PKey == PKey0 ->
- [[Id, Session]|Acc];
+ Sel = fun({{PKey0, _Id},Session}, Acc) when PKey == PKey0 ->
+ [Session | Acc];
(_,Acc) ->
Acc
end,
@@ -370,3 +401,23 @@ session_loop(Sess) ->
session_cache_process(_Type,Config) when is_list(Config) ->
ssl_basic_SUITE:reuse_session(Config).
+
+
+clients_start(_Server, ClientNode, Hostname, Port, ClientOpts, 0) ->
+ %% Make sure session is registered
+ ct:sleep(?SLEEP * 2),
+ ssl_test_lib:start_client([{node, ClientNode},
+ {port, Port}, {host, Hostname},
+ {mfa, {?MODULE, connection_info_result, []}},
+ {from, self()}, {options, ClientOpts}]);
+clients_start(Server, ClientNode, Hostname, Port, ClientOpts, N) ->
+ spawn_link(ssl_test_lib, start_client,
+ [[{node, ClientNode},
+ {port, Port}, {host, Hostname},
+ {mfa, {ssl_test_lib, no_result, []}},
+ {from, self()}, {options, ClientOpts}]]),
+ Server ! listen,
+ clients_start(Server, ClientNode, Hostname, Port, ClientOpts, N-1).
+
+connection_info_result(Socket) ->
+ ssl:connection_information(Socket, [protocol, cipher_suite]).
diff --git a/lib/ssl/test/ssl_test_lib.erl b/lib/ssl/test/ssl_test_lib.erl
index 8317148aa5..f25f6f9425 100644
--- a/lib/ssl/test/ssl_test_lib.erl
+++ b/lib/ssl/test/ssl_test_lib.erl
@@ -226,6 +226,17 @@ run_client(Opts) ->
ct:log("~p:~p~nClient faild several times: connection failed: ~p ~n", [?MODULE,?LINE, Reason]),
Pid ! {self(), {error, Reason}}
end;
+ {error, econnreset = Reason} ->
+ case get(retries) of
+ N when N < 5 ->
+ ct:log("~p:~p~neconnreset retries=~p sleep ~p",[?MODULE,?LINE, N,?SLEEP]),
+ put(retries, N+1),
+ ct:sleep(?SLEEP),
+ run_client(Opts);
+ _ ->
+ ct:log("~p:~p~nClient faild several times: connection failed: ~p ~n", [?MODULE,?LINE, Reason]),
+ Pid ! {self(), {error, Reason}}
+ end;
{error, Reason} ->
ct:log("~p:~p~nClient: connection failed: ~p ~n", [?MODULE,?LINE, Reason]),
Pid ! {connect_failed, Reason};
@@ -241,7 +252,21 @@ close(Pid) ->
receive
{'DOWN', Monitor, process, Pid, Reason} ->
erlang:demonitor(Monitor),
- ct:log("~p:~p~nPid: ~p down due to:~p ~n", [?MODULE,?LINE, Pid, Reason])
+ ct:log("~p:~p~nPid: ~p down due to:~p ~n", [?MODULE,?LINE, Pid, Reason])
+
+ end.
+
+close(Pid, Timeout) ->
+ ct:log("~p:~p~n Close ~p ~n", [?MODULE,?LINE, Pid]),
+ Monitor = erlang:monitor(process, Pid),
+ Pid ! close,
+ receive
+ {'DOWN', Monitor, process, Pid, Reason} ->
+ erlang:demonitor(Monitor),
+ ct:log("~p:~p~nPid: ~p down due to:~p ~n", [?MODULE,?LINE, Pid, Reason])
+ after
+ Timeout ->
+ exit(Pid, kill)
end.
check_result(Server, ServerMsg, Client, ClientMsg) ->
@@ -360,7 +385,7 @@ cert_options(Config) ->
SNIServerAKeyFile = filename:join([?config(priv_dir, Config), "a.server", "key.pem"]),
SNIServerBCertFile = filename:join([?config(priv_dir, Config), "b.server", "cert.pem"]),
SNIServerBKeyFile = filename:join([?config(priv_dir, Config), "b.server", "key.pem"]),
- [{client_opts, [{ssl_imp, new},{reuseaddr, true}]},
+ [{client_opts, []},
{client_verification_opts, [{cacertfile, ClientCaCertFile},
{certfile, ClientCertFile},
{keyfile, ClientKeyFile},
diff --git a/lib/ssl/test/ssl_upgrade_SUITE.erl b/lib/ssl/test/ssl_upgrade_SUITE.erl
index 17b0240fe8..f5f4b25b23 100644
--- a/lib/ssl/test/ssl_upgrade_SUITE.erl
+++ b/lib/ssl/test/ssl_upgrade_SUITE.erl
@@ -28,7 +28,8 @@
config,
server,
client,
- soft
+ soft,
+ result_proxy
}).
all() ->
@@ -39,20 +40,19 @@ all() ->
init_per_suite(Config0) ->
catch crypto:stop(),
- try {crypto:start(), erlang:system_info({wordsize, internal}) == erlang:system_info({wordsize, external})} of
- {ok, true} ->
- case ct_release_test:init(Config0) of
- {skip, Reason} ->
- {skip, Reason};
- Config ->
- {ok, _} = make_certs:all(?config(data_dir, Config),
- ?config(priv_dir, Config)),
- ssl_test_lib:cert_options(Config)
- end;
- {ok, false} ->
- {skip, "Test server will not handle halfwordemulator correctly. Skip as halfwordemulator is deprecated"}
+ try crypto:start() of
+ ok ->
+ case ct_release_test:init(Config0) of
+ {skip, Reason} ->
+ {skip, Reason};
+ Config ->
+ Result =
+ {ok, _} = make_certs:all(?config(data_dir, Config),
+ ?config(priv_dir, Config)),
+ ssl_test_lib:cert_options(Config)
+ end
catch _:_ ->
- {skip, "Crypto did not start"}
+ {skip, "Crypto did not start"}
end.
end_per_suite(Config) ->
@@ -77,45 +77,58 @@ upgrade_init(CTData, #state{config = Config} = State) ->
{ok, {_, _, Up, _Down}} = ct_release_test:get_appup(CTData, ssl),
ct:pal("Up: ~p", [Up]),
Soft = is_soft(Up), %% It is symmetrical, if upgrade is soft so is downgrade
+ Pid = spawn(?MODULE, result_proxy_init, [[]]),
case Soft of
true ->
- {Server, Client} = soft_start_connection(Config),
+ {Server, Client} = soft_start_connection(Config, Pid),
State#state{server = Server, client = Client,
- soft = Soft};
+ soft = Soft,
+ result_proxy = Pid};
false ->
- State#state{soft = Soft}
+ State#state{soft = Soft, result_proxy = Pid}
end.
-upgrade_upgraded(_, #state{soft = false, config = Config} = State) ->
- {Server, Client} = restart_start_connection(Config),
- ssl_test_lib:check_result(Server, ok, Client, ok),
+upgrade_upgraded(_, #state{soft = false, config = Config, result_proxy = Pid} = State) ->
+ ct:pal("Restart upgrade ~n", []),
+ {Server, Client} = restart_start_connection(Config, Pid),
+ Result = check_result(Pid, Server, Client),
ssl_test_lib:close(Server),
ssl_test_lib:close(Client),
+ ok = Result,
State;
upgrade_upgraded(_, #state{server = Server0, client = Client0,
- config = Config, soft = true} = State) ->
+ config = Config, soft = true,
+ result_proxy = Pid} = State) ->
+ ct:pal("Soft upgrade: ~n", []),
Server0 ! changed_version,
Client0 ! changed_version,
- ssl_test_lib:check_result(Server0, ok, Client0, ok),
+ Result = check_result(Pid, Server0, Client0),
ssl_test_lib:close(Server0),
ssl_test_lib:close(Client0),
- {Server, Client} = soft_start_connection(Config),
+ ok = Result,
+ {Server, Client} = soft_start_connection(Config, Pid),
State#state{server = Server, client = Client}.
-upgrade_downgraded(_, #state{soft = false, config = Config} = State) ->
- {Server, Client} = restart_start_connection(Config),
- ssl_test_lib:check_result(Server, ok, Client, ok),
+upgrade_downgraded(_, #state{soft = false, config = Config, result_proxy = Pid} = State) ->
+ ct:pal("Restart downgrade: ~n", []),
+ {Server, Client} = restart_start_connection(Config, Pid),
+ Result = check_result(Pid, Server, Client),
ssl_test_lib:close(Server),
ssl_test_lib:close(Client),
+ Pid ! stop,
+ ok = Result,
State;
-upgrade_downgraded(_, #state{server = Server, client = Client, soft = true} = State) ->
+upgrade_downgraded(_, #state{server = Server, client = Client, soft = true, result_proxy = Pid} = State) ->
+ ct:pal("Soft downgrade: ~n", []),
Server ! changed_version,
Client ! changed_version,
- ssl_test_lib:check_result(Server, ok, Client, ok),
+ Result = check_result(Pid, Server, Client),
+ Pid ! stop,
ssl_test_lib:close(Server),
ssl_test_lib:close(Client),
+ ok = Result,
State.
use_connection(Socket) ->
@@ -125,36 +138,35 @@ use_connection(Socket) ->
ssl_test_lib:send_recv_result_active(Socket)
end.
-soft_start_connection(Config) ->
+soft_start_connection(Config, ResulProxy) ->
ClientOpts = ?config(client_verification_opts, Config),
ServerOpts = ?config(server_verification_opts, Config),
{ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config),
- Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0},
- {from, self()},
- {mfa, {?MODULE, use_connection, []}},
- {options, ServerOpts}]),
+ Server = start_server([{node, ServerNode}, {port, 0},
+ {from, ResulProxy},
+ {mfa, {?MODULE, use_connection, []}},
+ {options, ServerOpts}]),
- Port = ssl_test_lib:inet_port(Server),
- Client = ssl_test_lib:start_client([{node, ClientNode}, {port, Port},
- {host, Hostname},
- {from, self()},
- {mfa, {?MODULE, use_connection, []}},
- {options, ClientOpts}]),
+ Port = inet_port(ResulProxy, Server),
+ Client = start_client([{node, ClientNode}, {port, Port},
+ {host, Hostname},
+ {from, ResulProxy},
+ {mfa, {?MODULE, use_connection, []}},
+ {options, ClientOpts}]),
{Server, Client}.
-restart_start_connection(Config) ->
+restart_start_connection(Config, ResulProxy) ->
ClientOpts = ?config(client_verification_opts, Config),
ServerOpts = ?config(server_verification_opts, Config),
{ClientNode, ServerNode, Hostname} = ssl_test_lib:run_where(Config),
- Server = ssl_test_lib:start_server([{node, ServerNode}, {port, 0},
- {from, self()},
+ Server = start_server([{node, ServerNode}, {port, 0},
+ {from, ResulProxy},
{mfa, {ssl_test_lib, send_recv_result_active, []}},
{options, ServerOpts}]),
-
- Port = ssl_test_lib:inet_port(Server),
- Client = ssl_test_lib:start_client([{node, ClientNode}, {port, Port},
+ Port = inet_port(ResulProxy, Server),
+ Client = start_client([{node, ClientNode}, {port, Port},
{host, Hostname},
- {from, self()},
+ {from, ResulProxy},
{mfa, {ssl_test_lib, send_recv_result_active, []}},
{options, ClientOpts}]),
{Server, Client}.
@@ -163,3 +175,103 @@ is_soft([{restart_application, ssl}]) ->
false;
is_soft(_) ->
true.
+
+result_proxy_init(Args) ->
+ result_proxy_loop(Args).
+
+result_proxy_loop(Args) ->
+ receive
+ {Pid, {check_result, Server, Client}} ->
+ Result = do_check_result(Server, ok, Client, ok),
+ Pid ! {self(), Result},
+ result_proxy_loop(Args);
+ {Pid, port, Server} ->
+ Port = recv_port(Server),
+ Pid ! Port,
+ result_proxy_loop(Args);
+ {Pid, listen} ->
+ recv_listen(),
+ Pid ! ok,
+ result_proxy_loop(Args);
+ {Pid, connected} ->
+ Connected = recv_connected(),
+ Pid ! Connected,
+ result_proxy_loop(Args)
+ end.
+
+check_result(Pid, Server, Client) ->
+ Pid ! {self(), {check_result, Server, Client}},
+ receive
+ {Pid, Result} ->
+ Result
+ end.
+
+do_check_result(Server, ServerMsg, Client, ClientMsg) ->
+ receive
+ {Server, ServerMsg} ->
+ do_check_result(Client, ClientMsg);
+
+ {Client, ClientMsg} ->
+ do_check_result(Server, ServerMsg);
+ Unexpected ->
+ {{expected, {Client, ClientMsg}},
+ {expected, {Server, ServerMsg}}, {got, Unexpected}}
+ end.
+
+do_check_result(Pid, Msg) ->
+ receive
+ {Pid, Msg} ->
+ ok;
+ Unexpected ->
+ {{expected, {Pid, Msg}},
+ {got, Unexpected}}
+ end.
+
+inet_port(Pid, Server) ->
+ Pid ! {self(), port, Server},
+ receive
+ {port, Port} ->
+ Port
+ end.
+
+recv_port(Server) ->
+ receive
+ {Server, {port, Port}} ->
+ {port, Port}
+ end.
+
+recv_connected() ->
+ receive
+ {connected, _Socket} ->
+ ok;
+ {connect_failed, Reason} ->
+ {connect_failed, Reason}
+ end.
+
+
+start_server(Args) ->
+ Pid = proplists:get_value(from, Args),
+ Result = spawn_link(ssl_test_lib, run_server, [Args]),
+ Pid ! {self(), listen},
+ receive
+ ok ->
+ ok
+ end,
+ Result.
+
+start_client(Args) ->
+ Pid = proplists:get_value(from, Args),
+ Result = spawn_link(ssl_test_lib, run_client_init, [lists:delete(return_socket, Args)]),
+ Pid ! {self(), connected},
+ receive
+ ok ->
+ Result;
+ Reason ->
+ exit(Reason)
+ end.
+
+recv_listen()->
+ receive
+ {listen, up} ->
+ ok
+ end.
diff --git a/lib/ssl/vsn.mk b/lib/ssl/vsn.mk
index 171147adf2..4587c448f6 100644
--- a/lib/ssl/vsn.mk
+++ b/lib/ssl/vsn.mk
@@ -1 +1 @@
-SSL_VSN = 7.0
+SSL_VSN = 7.1
diff --git a/lib/stdlib/doc/src/array.xml b/lib/stdlib/doc/src/array.xml
index 28b4435938..0f33e2621c 100644
--- a/lib/stdlib/doc/src/array.xml
+++ b/lib/stdlib/doc/src/array.xml
@@ -164,7 +164,7 @@ the default value cannot be confused with the values of set entries.</p>
</fsummary>
<desc><marker id="from_list-1"/>
-<p>Equivalent to <seealso marker="#from_list-2">from_list(<anno>List</anno>, undefined)</seealso>.</p>
+<p>Equivalent to <seealso marker="#from_list-2">from_list(<c><anno>List</anno></c>, undefined)</seealso>.</p>
</desc></func>
<func>
<name name="from_list" arity="2"/>
@@ -184,7 +184,7 @@ the default value cannot be confused with the values of set entries.</p>
</fsummary>
<desc><marker id="from_orddict-1"/>
-<p>Equivalent to <seealso marker="#from_orddict-2">from_orddict(<anno>Orddict</anno>, undefined)</seealso>.</p>
+<p>Equivalent to <seealso marker="#from_orddict-2">from_orddict(<c><anno>Orddict</anno></c>, undefined)</seealso>.</p>
</desc></func>
<func>
<name name="from_orddict" arity="2"/>
diff --git a/lib/stdlib/doc/src/assert_hrl.xml b/lib/stdlib/doc/src/assert_hrl.xml
index b85be514d8..ef4f928e57 100644
--- a/lib/stdlib/doc/src/assert_hrl.xml
+++ b/lib/stdlib/doc/src/assert_hrl.xml
@@ -77,9 +77,6 @@ erlc -DNOASSERT=true *.erl</code>
</description>
<section>
- </section>
-
- <section>
<title>Macros</title>
<taglist>
<tag><c>assert(BoolExpr)</c></tag>
@@ -94,12 +91,12 @@ erlc -DNOASSERT=true *.erl</code>
<tag><c>assertMatch(GuardedPattern, Expr)</c></tag>
<item><p>Tests that <c>Expr</c> completes normally yielding a value
- that matches <c>GuardedPattern</c>. For example:
+ that matches <c>GuardedPattern</c>. For example:</p>
<code type="none">
- ?assertMatch({bork, _}, f())</code></p>
- <p>Note that a guard <c>when ...</c> can be included:
+ ?assertMatch({bork, _}, f())</code>
+ <p>Note that a guard <c>when ...</c> can be included:</p>
<code type="none">
- ?assertMatch({bork, X} when X > 0, f())</code></p>
+ ?assertMatch({bork, X} when X > 0, f())</code>
</item>
<tag><c>assertNotMatch(GuardedPattern, Expr)</c></tag>
diff --git a/lib/stdlib/doc/src/beam_lib.xml b/lib/stdlib/doc/src/beam_lib.xml
index c556180b8b..7c89c8b43e 100644
--- a/lib/stdlib/doc/src/beam_lib.xml
+++ b/lib/stdlib/doc/src/beam_lib.xml
@@ -4,7 +4,7 @@
<erlref>
<header>
<copyright>
- <year>2000</year><year>2013</year>
+ <year>2000</year><year>2015</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -71,6 +71,7 @@
using <seealso marker="#strip/1">strip/1</seealso>,
<seealso marker="#strip_files/1">strip_files/1</seealso> and/or
<seealso marker="#strip_release/1">strip_release/1</seealso>.</p>
+ </section>
<section>
<title>Reconstructing source code</title>
<p>Here is an example of how to reconstruct source code from
@@ -152,7 +153,6 @@
keys.</p>
</note>
</section>
- </section>
<datatypes>
<datatype>
@@ -224,6 +224,13 @@
<funcs>
<func>
+ <name name="all_chunks" arity="1"/>
+ <fsummary>Read all chunks from a BEAM file or binary</fsummary>
+ <desc>
+ <p>Reads chunk data for all chunks.</p>
+ </desc>
+ </func>
+ <func>
<name name="chunks" arity="2"/>
<fsummary>Read selected chunks from a BEAM file or binary</fsummary>
<desc>
@@ -251,6 +258,13 @@
</desc>
</func>
<func>
+ <name name="build_module" arity="1"/>
+ <fsummary>Creates a BEAM module from a list of chunks</fsummary>
+ <desc>
+ <p>Builds a BEAM module (as a binary) from a list of chunks.</p>
+ </desc>
+ </func>
+ <func>
<name name="version" arity="1"/>
<fsummary>Read the BEAM file's module version</fsummary>
<desc>
diff --git a/lib/stdlib/doc/src/binary.xml b/lib/stdlib/doc/src/binary.xml
index 063f3048e0..2682198fe5 100644
--- a/lib/stdlib/doc/src/binary.xml
+++ b/lib/stdlib/doc/src/binary.xml
@@ -299,8 +299,8 @@
</func>
<func>
<name name="match" arity="3"/>
- <type name="part"/>
<fsummary>Searches for the first match of a pattern in a binary</fsummary>
+ <type name="part"/>
<desc>
<p>Searches for the first occurrence of <c><anno>Pattern</anno></c> in <c><anno>Subject</anno></c> and
@@ -353,8 +353,8 @@
</func>
<func>
<name name="matches" arity="3"/>
- <type name="part"/>
<fsummary>Searches for all matches of a pattern in a binary</fsummary>
+ <type name="part"/>
<desc>
<p>Works like <c>match/2</c>, but the <c><anno>Subject</anno></c> is searched until
diff --git a/lib/stdlib/doc/src/c.xml b/lib/stdlib/doc/src/c.xml
index a0f18bd899..e5238fa7db 100644
--- a/lib/stdlib/doc/src/c.xml
+++ b/lib/stdlib/doc/src/c.xml
@@ -121,12 +121,12 @@ compile:file(<anno>File</anno>, <anno>Options</anno> ++ [report_errors, report_w
</func>
<func>
<name>lc(Files) -> ok</name>
+ <fsummary>Compile a list of files</fsummary>
<type>
<v>Files = [File]</v>
<v>File = <seealso marker="file#type-filename">file:filename()
</seealso></v>
</type>
- <fsummary>Compile a list of files</fsummary>
<desc>
<p>Compiles a list of files by calling <c>compile:file(File, [report_errors, report_warnings])</c> for each <c>File</c>
in <c>Files</c>.</p>
diff --git a/lib/stdlib/doc/src/calendar.xml b/lib/stdlib/doc/src/calendar.xml
index a8d933dc83..853184dc0f 100644
--- a/lib/stdlib/doc/src/calendar.xml
+++ b/lib/stdlib/doc/src/calendar.xml
@@ -130,11 +130,11 @@
<func>
<name name="date_to_gregorian_days" arity="1"/>
<name name="date_to_gregorian_days" arity="3"/>
+ <fsummary>Compute the number of days from year 0 up to the given date</fsummary>
<type variable="Date" name_i="1"/>
<type variable="Year"/>
<type variable="Month"/>
<type variable="Day"/>
- <fsummary>Compute the number of days from year 0 up to the given date</fsummary>
<desc>
<p>This function computes the number of gregorian days starting
with year 0 and ending at the given date.</p>
@@ -347,11 +347,11 @@
<func>
<name name="valid_date" arity="1"/>
<name name="valid_date" arity="3"/>
+ <fsummary>Check if a date is valid</fsummary>
<type variable="Date" name_i="1"/>
<type variable="Year"/>
<type variable="Month"/>
<type variable="Day"/>
- <fsummary>Check if a date is valid</fsummary>
<desc>
<p>This function checks if a date is a valid.</p>
</desc>
diff --git a/lib/stdlib/doc/src/dets.xml b/lib/stdlib/doc/src/dets.xml
index 14237b6f90..a0d3f95b6a 100644
--- a/lib/stdlib/doc/src/dets.xml
+++ b/lib/stdlib/doc/src/dets.xml
@@ -316,20 +316,20 @@
bytes.</p>
</item>
<item>
- <p><c>{filename, <seealso marker="file#type-name">file:name()</seealso>}</c>,
+ <p><c>{filename, </c><seealso marker="file#type-name">file:name()</seealso><c>}</c>,
the name of the file where objects are stored.</p>
</item>
<item>
- <p><c>{keypos, <seealso marker="#type-keypos">keypos()</seealso>}
- </c>, the position of the key.</p>
+ <p><c>{keypos, </c><seealso marker="#type-keypos">keypos()</seealso>
+ <c>}</c>, the position of the key.</p>
</item>
<item>
<p><c>{size, integer() >= 0}</c>, the number of objects stored
in the table.</p>
</item>
<item>
- <p><c>{type, <seealso marker="#type-type">type()</seealso>}</c>,
- the type of the table.</p>
+ <p><c>{type, </c><seealso marker="#type-type">type()</seealso>
+ <c>}</c>, the type of the table.</p>
</item>
</list>
</desc>
@@ -345,12 +345,12 @@
allowed:</p>
<list type="bulleted">
<item>
- <p><c>{access, <seealso marker="#type-access">access()</seealso>}
- </c>, the access mode.</p>
+ <p><c>{access, </c><seealso marker="#type-access">access()</seealso>
+ <c>}</c>, the access mode.</p>
</item>
<item>
- <p><c>{auto_save, <seealso marker="#type-auto_save">
- auto_save()</seealso>}</c>, the auto save interval.</p>
+ <p><c>{auto_save, </c><seealso marker="#type-auto_save">
+ auto_save()</seealso><c>}</c>, the auto save interval.</p>
</item>
<item>
<p><c>{bchunk_format, binary()}</c>, an opaque binary
@@ -730,16 +730,16 @@ ok
tuples where the following values are allowed:</p>
<list type="bulleted">
<item>
- <p><c>{access, <seealso marker="#type-access">
- access()</seealso>}</c>. It is possible to open
+ <p><c>{access, </c><seealso marker="#type-access">
+ access()</seealso><c>}</c>. It is possible to open
existing tables in read-only mode. A table which is opened
in read-only mode is not subjected to the automatic file
reparation algorithm if it is later opened after a crash.
The default value is <c>read_write</c>.</p>
</item>
<item>
- <p><c>{auto_save, <seealso marker="#type-auto_save">
- auto_save()</seealso>}</c>, the auto save
+ <p><c>{auto_save, </c><seealso marker="#type-auto_save">
+ auto_save()</seealso><c>}</c>, the auto save
interval. If the interval is an integer <c>Time</c>, the
table is flushed to disk whenever it is not accessed for
<c>Time</c> milliseconds. A table that has been flushed
@@ -749,18 +749,18 @@ ok
is 180000 (3 minutes).</p>
</item>
<item>
- <p><c>{estimated_no_objects, <seealso marker="#type-no_slots">
- no_slots()</seealso>}</c>. Equivalent to the
+ <p><c>{estimated_no_objects, </c><seealso marker="#type-no_slots">
+ no_slots()</seealso><c>}</c>. Equivalent to the
<c>min_no_slots</c> option.</p>
</item>
<item>
- <p><c>{file, <seealso marker="file#type-name">
- file:name()</seealso>}</c>, the name of the file to be
+ <p><c>{file, </c><seealso marker="file#type-name">
+ file:name()</seealso><c>}</c>, the name of the file to be
opened. The default value is the name of the table.</p>
</item>
<item>
- <p><c>{max_no_slots, <seealso marker="#type-no_slots">
- no_slots()</seealso>}</c>, the maximum number
+ <p><c>{max_no_slots, </c><seealso marker="#type-no_slots">
+ no_slots()</seealso><c>}</c>, the maximum number
of slots that will be used. The default value as well as
the maximal value is 32 M. Note that a higher value may
increase the fragmentation of the table, and conversely,
@@ -769,16 +769,16 @@ ok
9 tables.</p>
</item>
<item>
- <p><c>{min_no_slots, <seealso marker="#type-no_slots">
- no_slots()</seealso>}</c>. Application
+ <p><c>{min_no_slots, </c><seealso marker="#type-no_slots">
+ no_slots()</seealso><c>}</c>. Application
performance can be enhanced with this flag by specifying,
when the table is created, the estimated number of
different keys that will be stored in the table. The
default value as well as the minimum value is 256.</p>
</item>
<item>
- <p><c>{keypos, <seealso marker="#type-keypos">
- keypos()</seealso>}</c>, the position of the
+ <p><c>{keypos, </c><seealso marker="#type-keypos">
+ keypos()</seealso><c>}</c>, the position of the
element of each object to be used as key. The default
value is 1. The ability to explicitly state the key
position is most convenient when we want to store Erlang
@@ -815,12 +815,12 @@ ok
already open.</p>
</item>
<item>
- <p><c>{type, <seealso marker="#type-type">type()</seealso>}</c>,
+ <p><c>{type, </c><seealso marker="#type-type">type()</seealso><c>}</c>,
the type of the table. The default value is <c>set</c>.</p>
</item>
<item>
- <p><c>{version, <seealso marker="#type-version">
- version()</seealso>}</c>, the version of the format
+ <p><c>{version, </c><seealso marker="#type-version">
+ version()</seealso><c>}</c>, the version of the format
used for the table. The default value is <c>9</c>. Tables
on the format used before OTP R8 can be created by giving
the value <c>8</c>. A version 8 table can be converted to
@@ -1036,8 +1036,8 @@ ok
specification that matches all objects.</p>
</item>
<item>
- <p><c>{select, <seealso marker="#type-match_spec">
- match_spec()}</seealso></c>. As for <c>select</c>
+ <p><c>{select, </c><seealso marker="#type-match_spec">
+ match_spec()</seealso><c>}</c>. As for <c>select</c>
the table is traversed by calling <c>dets:select/3</c>
and <c>dets:select/1</c>. The difference is that the
match specification is explicitly given. This is how to
diff --git a/lib/stdlib/doc/src/digraph.xml b/lib/stdlib/doc/src/digraph.xml
index 49dc68e103..291be6c08b 100644
--- a/lib/stdlib/doc/src/digraph.xml
+++ b/lib/stdlib/doc/src/digraph.xml
@@ -103,13 +103,15 @@
<desc><p>A digraph as returned by <c>new/0,1</c>.</p></desc>
</datatype>
<datatype>
- <name><marker id="type-edge">edge()</marker></name>
+ <name>edge()</name>
+ <desc><p><marker id="type-edge"/></p></desc>
</datatype>
<datatype>
<name name="label"/>
</datatype>
<datatype>
- <name><marker id="type-vertex">vertex()</marker></name>
+ <name>vertex()</name>
+ <desc><p><marker id="type-vertex"/></p></desc>
</datatype>
</datatypes>
<funcs>
diff --git a/lib/stdlib/doc/src/digraph_utils.xml b/lib/stdlib/doc/src/digraph_utils.xml
index 6a4db2e963..639069543c 100644
--- a/lib/stdlib/doc/src/digraph_utils.xml
+++ b/lib/stdlib/doc/src/digraph_utils.xml
@@ -122,8 +122,9 @@
<datatypes>
<datatype>
- <name><marker id="type-digraph">digraph()</marker></name>
- <desc><p>A digraph as returned by <c>digraph:new/0,1</c>.</p></desc>
+ <name>digraph()</name>
+ <desc><p><marker id="type-digraph"/>
+ A digraph as returned by <c>digraph:new/0,1</c>.</p></desc>
</datatype>
</datatypes>
<funcs>
diff --git a/lib/stdlib/doc/src/epp.xml b/lib/stdlib/doc/src/epp.xml
index fe2944bbf7..8c901f57ec 100644
--- a/lib/stdlib/doc/src/epp.xml
+++ b/lib/stdlib/doc/src/epp.xml
@@ -39,7 +39,7 @@
by <c>compile</c> to preprocess macros and include files before
the actual parsing takes place.</p>
<p>The Erlang source file <marker
- id="encoding"><em>encoding</em></marker> is selected by a
+ id="encoding"/><em>encoding</em> is selected by a
comment in one of the first two lines of the source file. The
first string that matches the regular expression
<c>coding\s*[:=]\s*([-a-zA-Z0-9])+</c> selects the encoding. If
diff --git a/lib/stdlib/doc/src/erl_anno.xml b/lib/stdlib/doc/src/erl_anno.xml
index be0ffe6f4d..ddc8b8c765 100644
--- a/lib/stdlib/doc/src/erl_anno.xml
+++ b/lib/stdlib/doc/src/erl_anno.xml
@@ -44,7 +44,7 @@
<p>This module implements an abstract type that is used by the
Erlang Compiler and its helper modules for holding data such as
column, line number, and text. The data type is a collection of
- <marker id="annotations"><em>annotations</em></marker> as
+ <marker id="annotations"/><em>annotations</em> as
described in the following.</p>
<p>The Erlang Token Scanner returns tokens with a subset of
the following annotations, depending on the options:</p>
@@ -102,8 +102,8 @@
<datatypes>
<datatype>
- <name><marker id="type-anno">anno()</marker></name>
- <desc><p>A collection of annotations.</p>
+ <name>anno()</name>
+ <desc><p><marker id="type-anno"/>A collection of annotations.</p>
</desc>
</datatype>
<datatype>
@@ -133,8 +133,8 @@
<funcs>
<func>
<name name="column" arity="1"/>
- <type name="column"></type>
<fsummary>Return the column</fsummary>
+ <type name="column"></type>
<desc>
<p>Returns the column of the annotations <anno>Anno</anno>.
</p>
@@ -142,8 +142,8 @@
</func>
<func>
<name name="end_location" arity="1"/>
- <type name="location"></type>
<fsummary>Return the end location of the text</fsummary>
+ <type name="location"></type>
<desc>
<p>Returns the end location of the text of the
annotations <anno>Anno</anno>. If there is no text,
@@ -153,8 +153,8 @@
</func>
<func>
<name name="file" arity="1"/>
- <type name="filename"></type>
<fsummary>Return the filename</fsummary>
+ <type name="filename"></type>
<desc>
<p>Returns the filename of the annotations <anno>Anno</anno>.
If there is no filename, <c>undefined</c> is returned.
@@ -180,8 +180,8 @@
</func>
<func>
<name name="generated" arity="1"/>
- <type name="generated"></type>
<fsummary>Return the generated Boolean</fsummary>
+ <type name="generated"></type>
<desc>
<p>Returns <c>true</c> if the annotations <anno>Anno</anno>
has been marked as generated. The default is to return
@@ -199,8 +199,8 @@
</func>
<func>
<name name="line" arity="1"/>
- <type name="line"></type>
<fsummary>Return the line</fsummary>
+ <type name="line"></type>
<desc>
<p>Returns the line of the annotations <anno>Anno</anno>.
</p>
@@ -208,8 +208,8 @@
</func>
<func>
<name name="location" arity="1"/>
- <type name="location"></type>
<fsummary>Return the location</fsummary>
+ <type name="location"></type>
<desc>
<p>Returns the location of the annotations <anno>Anno</anno>.
</p>
@@ -217,16 +217,16 @@
</func>
<func>
<name name="new" arity="1"/>
- <type name="location"></type>
<fsummary>Create a new collection of annotations</fsummary>
+ <type name="location"></type>
<desc>
<p>Creates a new collection of annotations given a location.</p>
</desc>
</func>
<func>
<name name="set_file" arity="2"/>
- <type name="filename"></type>
<fsummary>Modify the filename</fsummary>
+ <type name="filename"></type>
<desc>
<p>Modifies the filename of the annotations <anno>Anno</anno>.
</p>
@@ -234,8 +234,8 @@
</func>
<func>
<name name="set_generated" arity="2"/>
- <type name="generated"></type>
<fsummary>Modify the generated marker</fsummary>
+ <type name="generated"></type>
<desc>
<p>Modifies the generated marker of the annotations
<anno>Anno</anno>.
@@ -244,8 +244,8 @@
</func>
<func>
<name name="set_line" arity="2"/>
- <type name="line"></type>
<fsummary>Modify the line</fsummary>
+ <type name="line"></type>
<desc>
<p>Modifies the line of the annotations <anno>Anno</anno>.
</p>
@@ -253,8 +253,8 @@
</func>
<func>
<name name="set_location" arity="2"/>
- <type name="location"></type>
<fsummary>Modify the location</fsummary>
+ <type name="location"></type>
<desc>
<p>Modifies the location of the annotations <anno>Anno</anno>.
</p>
@@ -262,8 +262,8 @@
</func>
<func>
<name name="set_record" arity="2"/>
- <type name="record"></type>
<fsummary>Modify the record marker</fsummary>
+ <type name="record"></type>
<desc>
<p>Modifies the record marker of the annotations <anno>Anno</anno>.
</p>
@@ -271,8 +271,8 @@
</func>
<func>
<name name="set_text" arity="2"/>
- <type name="text"></type>
<fsummary>Modify the text</fsummary>
+ <type name="text"></type>
<desc>
<p>Modifies the text of the annotations <anno>Anno</anno>.
</p>
@@ -280,8 +280,8 @@
</func>
<func>
<name name="text" arity="1"/>
- <type name="text"></type>
<fsummary>Return the text</fsummary>
+ <type name="text"></type>
<desc>
<p>Returns the text of the annotations <anno>Anno</anno>.
If there is no text, <c>undefined</c> is returned.
diff --git a/lib/stdlib/doc/src/erl_parse.xml b/lib/stdlib/doc/src/erl_parse.xml
index fdd776b7f1..0938b5dec3 100644
--- a/lib/stdlib/doc/src/erl_parse.xml
+++ b/lib/stdlib/doc/src/erl_parse.xml
@@ -174,8 +174,8 @@
</func>
<func>
<name name="abstract" arity="2"/>
- <type name="encoding_func"/>
<fsummary>Convert an Erlang term into an abstract form</fsummary>
+ <type name="encoding_func"/>
<desc>
<p>Converts the Erlang data structure <c><anno>Data</anno></c> into an
abstract form of type <c><anno>AbsTerm</anno></c>.</p>
diff --git a/lib/stdlib/doc/src/erl_pp.xml b/lib/stdlib/doc/src/erl_pp.xml
index c9d9e2723d..4b8a571c81 100644
--- a/lib/stdlib/doc/src/erl_pp.xml
+++ b/lib/stdlib/doc/src/erl_pp.xml
@@ -48,8 +48,8 @@
<datatype>
<name name="hook_function"/>
<desc>
- <p>The optional argument <marker id="hook_function">
- <c>HookFunction</c></marker>, shown in the functions described below,
+ <p>The optional argument <marker id="hook_function"/>
+ <c>HookFunction</c>, shown in the functions described below,
defines a function which is called when an unknown form occurs where there
should be a valid expression.</p>
diff --git a/lib/stdlib/doc/src/erl_scan.xml b/lib/stdlib/doc/src/erl_scan.xml
index 18e988e286..ee0d6b6033 100644
--- a/lib/stdlib/doc/src/erl_scan.xml
+++ b/lib/stdlib/doc/src/erl_scan.xml
@@ -40,39 +40,15 @@
</description>
<datatypes>
<datatype>
- <name name="attribute_info"></name>
- </datatype>
- <datatype>
- <name name="attributes"></name>
- </datatype>
- <datatype>
- <name name="attributes_data"></name>
- </datatype>
- <datatype>
<name name="category"></name>
</datatype>
<datatype>
- <name name="column"></name>
- </datatype>
- <datatype>
<name name="error_description"></name>
</datatype>
<datatype>
<name name="error_info"></name>
</datatype>
<datatype>
- <name name="info_line"></name>
- </datatype>
- <datatype>
- <name name="info_location"></name>
- </datatype>
- <datatype>
- <name name="line"></name>
- </datatype>
- <datatype>
- <name name="location"></name>
- </datatype>
- <datatype>
<name name="option"></name>
</datatype>
<datatype>
@@ -88,9 +64,6 @@
<name name="token"></name>
</datatype>
<datatype>
- <name name="token_info"></name>
- </datatype>
- <datatype>
<name name="tokens"></name>
</datatype>
<datatype>
@@ -122,25 +95,23 @@
<anno>StartLocation</anno>, [])</c>.</p>
<p><c><anno>StartLocation</anno></c> indicates the initial location
when scanning starts. If <c><anno>StartLocation</anno></c> is a line,
- <c>attributes()</c> as well as <c><anno>EndLocation</anno></c> and
+ <c>Anno</c> as well as <c><anno>EndLocation</anno></c> and
<c><anno>ErrorLocation</anno></c> will be lines. If
<c><anno>StartLocation</anno></c> is a pair of a line and a column
- <c>attributes()</c> takes the form of an opaque compound
+ <c>Anno</c> takes the form of an opaque compound
data type, and <c><anno>EndLocation</anno></c> and
<c><anno>ErrorLocation</anno></c>
will be pairs of a line and a column. The <em>token
- attributes</em> contain information about the column and the
+ annotations</em> contain information about the column and the
line where the token begins, as well as the text of the
token (if the <c>text</c> option is given), all of which can
- be accessed by calling <seealso
- marker="#token_info/1">token_info/1,2</seealso>, <seealso
- marker="#attributes_info/1">attributes_info/1,2</seealso>,
+ be accessed by calling
<seealso marker="#column/1">column/1</seealso>,
<seealso marker="#line/1">line/1</seealso>,
<seealso marker="#location/1">location/1</seealso>, and
<seealso marker="#text/1">text/1</seealso>.</p>
<p>A <em>token</em> is a tuple containing information about
- syntactic category, the token attributes, and the actual
+ syntactic category, the token annotations, and the actual
terminal symbol. For punctuation characters (e.g. <c>;</c>,
<c>|</c>) and reserved words, the category and the symbol
coincide, and the token is represented by a two-tuple.
@@ -172,7 +143,7 @@
<item><p>Short for <c>[return_comments, return_white_spaces]</c>.</p>
</item>
<tag><c>text</c></tag>
- <item><p>Include the token's text in the token attributes. The
+ <item><p>Include the token's text in the token annotation. The
text is the part of the input corresponding to the token.</p>
</item>
</taglist>
@@ -181,10 +152,10 @@
<func>
<name name="tokens" arity="3"/>
<name name="tokens" arity="4"/>
+ <fsummary>Re-entrant scanner</fsummary>
<type name="char_spec"/>
<type name="return_cont"/>
<type_desc name="return_cont">An opaque continuation</type_desc>
- <fsummary>Re-entrant scanner</fsummary>
<desc>
<p>This is the re-entrant scanner which scans characters until
a <em>dot</em> ('.' followed by a white space) or
@@ -306,150 +277,6 @@
</desc>
</func>
<func>
- <name name="token_info" arity="1"/>
- <fsummary>Return information about a token</fsummary>
- <desc>
- <p>Returns a list containing information about the token
- <c><anno>Token</anno></c>. The order of the
- <c><anno>TokenInfoTuple</anno></c>s is not
- defined. See <seealso
- marker="#token_info/2">token_info/2</seealso> for
- information about specific
- <c><anno>TokenInfoTuple</anno></c>s.</p>
- <p>Note that if <c>token_info(Token, TokenItem)</c> returns
- <c>undefined</c> for some <c>TokenItem</c>, the
- item is not included in <c><anno>TokenInfo</anno></c>.</p>
- </desc>
- </func>
- <func>
- <name name="token_info" arity="2" clause_i="1"/>
- <name name="token_info" arity="2" clause_i="2"/>
- <type name="token_item"/>
- <type name="attribute_item"/>
- <fsummary>Return information about a token</fsummary>
- <desc>
- <p>Returns a list containing information about the token
- <c><anno>Token</anno></c>. If one single
- <c><anno>TokenItem</anno></c> is given the returned value is
- the corresponding
- <c>TokenInfoTuple</c>, or <c>undefined</c> if the
- <c>TokenItem</c> has no value. If a list of
- <c><anno>TokenItem</anno></c>s is given the result is a list of
- <c><anno>TokenInfoTuple</anno></c>. The
- <c><anno>TokenInfoTuple</anno></c>s will
- appear with the corresponding <c><anno>TokenItem</anno></c>s in
- the same order as the <c><anno>TokenItem</anno></c>s
- appear in the list of <c>TokenItem</c>s.
- <c><anno>TokenItem</anno></c>s with no value are not included
- in the list of <c><anno>TokenInfoTuple</anno></c>.</p>
- <p>The following <c><anno>TokenInfoTuple</anno></c>s with corresponding
- <c><anno>TokenItem</anno></c>s are valid:</p>
- <taglist>
- <tag><c>{category, <seealso marker="#type-category">
- category()</seealso>}</c></tag>
- <item><p>The category of the token.</p>
- </item>
- <tag><c>{column, <seealso marker="#type-column">
- column()</seealso>}</c></tag>
- <item><p>The column where the token begins.</p>
- </item>
- <tag><c>{length, integer() > 0}</c></tag>
- <item><p>The length of the token's text.</p>
- </item>
- <tag><c>{line, <seealso marker="#type-line">
- line()</seealso>}</c></tag>
- <item><p>The line where the token begins.</p>
- </item>
- <tag><c>{location, <seealso marker="#type-location">
- location()</seealso>}</c></tag>
- <item><p>The line and column where the token begins, or
- just the line if the column unknown.</p>
- </item>
- <tag><c>{symbol, <seealso marker="#type-symbol">
- symbol()</seealso>}</c></tag>
- <item><p>The token's symbol.</p>
- </item>
- <tag><c>{text, string()}</c></tag>
- <item><p>The token's text.</p>
- </item>
- </taglist>
- </desc>
- </func>
- <func>
- <name name="attributes_info" arity="1"/>
- <fsummary>Return information about token attributes</fsummary>
- <desc>
- <p>Returns a list containing information about the token
- attributes <c><anno>Attributes</anno></c>. The order of the
- <c><anno>AttributeInfoTuple</anno></c>s is not defined.
- See <seealso
- marker="#attributes_info/2">attributes_info/2</seealso> for
- information about specific
- <c><anno>AttributeInfoTuple</anno></c>s.</p>
- <p>Note that if <c>attributes_info(Token, AttributeItem)</c>
- returns <c>undefined</c> for some <c>AttributeItem</c> in
- the list above, the item is not included in
- <c><anno>AttributesInfo</anno></c>.</p>
- </desc>
- </func>
- <func>
- <name name="attributes_info" arity="2" clause_i="1"/>
- <name name="attributes_info" arity="2" clause_i="2"/>
- <fsummary>Return information about a token attributes</fsummary>
- <type name="attribute_item"/>
- <desc>
- <p>Returns a list containing information about the token
- attributes <c><anno>Attributes</anno></c>. If one single
- <c><anno>AttributeItem</anno></c> is given the returned value is the
- corresponding <c><anno>AttributeInfoTuple</anno></c>,
- or <c>undefined</c> if the <c><anno>AttributeItem</anno></c>
- has no value. If a list of <c><anno>AttributeItem</anno></c>
- is given the result is a list of
- <c><anno>AttributeInfoTuple</anno></c>.
- The <c><anno>AttributeInfoTuple</anno></c>s
- will appear with the corresponding <c><anno>AttributeItem</anno></c>s
- in the same order as the <c><anno>AttributeItem</anno></c>s
- appear in the list of <c><anno>AttributeItem</anno></c>s.
- <c><anno>AttributeItem</anno></c>s with no
- value are not included in the list of
- <c><anno>AttributeInfoTuple</anno></c>.</p>
- <p>The following <c><anno>AttributeInfoTuple</anno></c>s with
- corresponding <c><anno>AttributeItem</anno></c>s are valid:</p>
- <taglist>
- <tag><c>{column, <seealso marker="#type-column">
- column()</seealso>}</c></tag>
- <item><p>The column where the token begins.</p>
- </item>
- <tag><c>{length, integer() > 0}</c></tag>
- <item><p>The length of the token's text.</p>
- </item>
- <tag><c>{line, <seealso marker="#type-line">
- line()</seealso>}</c></tag>
- <item><p>The line where the token begins.</p>
- </item>
- <tag><c>{location, <seealso marker="#type-location">
- location()</seealso>}</c></tag>
- <item><p>The line and column where the token begins, or
- just the line if the column unknown.</p>
- </item>
- <tag><c>{text, string()}</c></tag>
- <item><p>The token's text.</p>
- </item>
- </taglist>
- </desc>
- </func>
- <func>
- <name name="set_attribute" arity="3"/>
- <fsummary>Set a token attribute value</fsummary>
- <desc>
- <p>Sets the value of the <c>line</c> attribute of the token
- attributes <c><anno>Attributes</anno></c>.</p>
- <p>The <c><anno>SetAttributeFun</anno></c> is called with the value of
- the <c>line</c> attribute, and is to return the new value of
- the <c>line</c> attribute.</p>
- </desc>
- </func>
- <func>
<name name="format_error" arity="1"/>
<fsummary>Format an error descriptor</fsummary>
<desc>
diff --git a/lib/stdlib/doc/src/erl_tar.xml b/lib/stdlib/doc/src/erl_tar.xml
index 0fa5a55c5b..898b55df72 100644
--- a/lib/stdlib/doc/src/erl_tar.xml
+++ b/lib/stdlib/doc/src/erl_tar.xml
@@ -442,7 +442,7 @@
structure like a file descriptor, a sftp channel id or such. The different <c>Fun</c>
clauses operates on that very term.
</p>
- <p>The fun clauses parameter lists are:
+ <p>The fun clauses parameter lists are:</p>
<taglist>
<tag><c>(write, {UserPrivate,DataToWrite})</c></tag>
<item>Write the term <c>DataToWrite</c> using <c>UserPrivate</c></item>
@@ -457,7 +457,6 @@
<tag><c></c></tag>
<item></item>
</taglist>
- </p>
<p>A complete <c>Fun</c> parameter for reading and writing on files using the
<seealso marker="kernel:file">file module</seealso> could be:
</p>
diff --git a/lib/stdlib/doc/src/ets.xml b/lib/stdlib/doc/src/ets.xml
index 03b995e4de..7b01109ff8 100644
--- a/lib/stdlib/doc/src/ets.xml
+++ b/lib/stdlib/doc/src/ets.xml
@@ -132,9 +132,10 @@
<name name="access"/>
</datatype>
<datatype>
- <name><marker id="type-continuation">continuation()</marker></name>
+ <name>continuation()</name>
<desc>
- <p>Opaque continuation used by <seealso marker="#select/1">
+ <p><marker id="type-continuation"/>
+ Opaque continuation used by <seealso marker="#select/1">
<c>select/1,3</c></seealso>, <seealso marker="#select_reverse/1">
<c>select_reverse/1,3</c></seealso>, <seealso
marker="#match/1">
@@ -448,13 +449,13 @@ Error: fun containing local Erlang function calls
<item><c>{owner, pid()}</c> <br></br>
The pid of the owner of the table.</item>
- <item><c>{protection, <seealso marker="#type-access">access()</seealso>}</c> <br></br>
+ <item><c>{protection, </c><seealso marker="#type-access">access()</seealso><c>}</c> <br></br>
The table access rights.</item>
<item><c>{size, integer() >= 0</c> <br></br>
The number of objects inserted in the table.</item>
- <item><c>{type, <seealso marker="#type-type">type()</seealso>}</c> <br></br>
+ <item><c>{type, </c><seealso marker="#type-type">type()</seealso><c>}</c> <br></br>
The table type.</item>
<item><c>{read_concurrency, boolean()}</c> <br></br>
@@ -916,7 +917,7 @@ ets:select(Table,MatchSpec),</code>
</item>
<item>
<p><c>{keypos,<anno>Pos</anno>}</c>
- Specfies which element in the stored tuples should be
+ Specifies which element in the stored tuples should be
used as key. By default, it is the first element, i.e.
<c><anno>Pos</anno>=1</c>. However, this is not always appropriate. In
particular, we do not want the first element to be the
@@ -1626,6 +1627,7 @@ true</pre>
<name name="update_counter" arity="4" clause_i="2"/>
<name name="update_counter" arity="3" clause_i="3"/>
<name name="update_counter" arity="4" clause_i="3"/>
+ <fsummary>Update a counter object in an ETS table.</fsummary>
<type variable="Tab"/>
<type variable="Key"/>
<type variable="UpdateOp" name_i="1"/>
@@ -1633,7 +1635,6 @@ true</pre>
<type variable="Threshold" name_i="1"/>
<type variable="SetValue" name_i="1"/>
<type variable="Default"/>
- <fsummary>Update a counter object in an ETS table.</fsummary>
<desc>
<p>This function provides an efficient way to update one or more
counters, without the hassle of having to look up an object, update
@@ -1700,11 +1701,11 @@ true</pre>
<func>
<name name="update_element" arity="3" clause_i="1"/>
<name name="update_element" arity="3" clause_i="2"/>
+ <fsummary>Updates the <c>Pos</c>:th element of the object with a given key in an ETS table.</fsummary>
<type variable="Tab"/>
<type variable="Key"/>
<type variable="Value"/>
<type variable="Pos"/>
- <fsummary>Updates the <c>Pos</c>:th element of the object with a given key in an ETS table.</fsummary>
<desc>
<p>This function provides an efficient way to update one or more
elements within an object, without the hassle of having to look up,
diff --git a/lib/stdlib/doc/src/file_sorter.xml b/lib/stdlib/doc/src/file_sorter.xml
index 30e09c17b0..f033eebec7 100644
--- a/lib/stdlib/doc/src/file_sorter.xml
+++ b/lib/stdlib/doc/src/file_sorter.xml
@@ -223,82 +223,82 @@ output(L) ->
<datatypes>
<datatype>
- <name name="file_name"/><br/>
+ <name name="file_name"/>
</datatype>
<datatype>
- <name name="file_names"/><br/>
+ <name name="file_names"/>
</datatype>
<datatype>
- <name name="i_command"/><br/>
+ <name name="i_command"/>
</datatype>
<datatype>
- <name name="i_reply"/><br/>
+ <name name="i_reply"/>
</datatype>
<datatype>
- <name name="infun"/><br/>
+ <name name="infun"/>
</datatype>
<datatype>
- <name name="input"/><br/>
+ <name name="input"/>
</datatype>
<datatype>
- <name name="input_reply"/><br/>
+ <name name="input_reply"/>
</datatype>
<datatype>
- <name name="o_command"/><br/>
+ <name name="o_command"/>
</datatype>
<datatype>
- <name name="o_reply"/><br/>
+ <name name="o_reply"/>
</datatype>
<datatype>
- <name name="object"/><br/>
+ <name name="object"/>
</datatype>
<datatype>
- <name name="outfun"/><br/>
+ <name name="outfun"/>
</datatype>
<datatype>
- <name name="output"/><br/>
+ <name name="output"/>
</datatype>
<datatype>
- <name name="output_reply"/><br/>
+ <name name="output_reply"/>
</datatype>
<datatype>
- <name name="value"/><br/>
+ <name name="value"/>
</datatype>
<datatype>
- <name name="options"/><br/>
+ <name name="options"/>
</datatype>
<datatype>
- <name name="option"/><br/>
+ <name name="option"/>
</datatype>
<datatype>
- <name name="format"/><br/>
+ <name name="format"/>
</datatype>
<datatype>
- <name name="format_fun"/><br/>
+ <name name="format_fun"/>
</datatype>
<datatype>
- <name name="header_length"/><br/>
+ <name name="header_length"/>
</datatype>
<datatype>
- <name name="key_pos"/><br/>
+ <name name="key_pos"/>
</datatype>
<datatype>
- <name name="no_files"/><br/>
+ <name name="no_files"/>
</datatype>
<datatype>
- <name name="order"/><br/>
+ <name name="order"/>
</datatype>
<datatype>
- <name name="order_fun"/><br/>
+ <name name="order_fun"/>
</datatype>
<datatype>
- <name name="size"/><br/>
+ <name name="size"/>
</datatype>
<datatype>
- <name name="tmp_directory"/><br/>
+ <name name="tmp_directory"/>
</datatype>
<datatype>
- <name name="reason"/><br/>
+ <name name="reason"/>
</datatype>
</datatypes>
diff --git a/lib/stdlib/doc/src/gen_event.xml b/lib/stdlib/doc/src/gen_event.xml
index 1efac1535a..c4bab45781 100644
--- a/lib/stdlib/doc/src/gen_event.xml
+++ b/lib/stdlib/doc/src/gen_event.xml
@@ -716,7 +716,7 @@ gen_event:stop -----> Module:terminate/2
the purposes described below.</p>
</note>
<p>This function is called by a gen_event process when:</p>
- <list typed="bulleted">
+ <list type="bulleted">
<item>One
of <seealso marker="sys#get_status/1">sys:get_status/1,2</seealso>
is invoked to get the gen_event status. <c>Opt</c> is set
@@ -740,7 +740,7 @@ gen_event:stop -----> Module:terminate/2
customises the details of the current state of the event
handler. Any term is allowed for <c>Status</c>. The
gen_event module uses <c>Status</c> as follows:</p>
- <list typed="bulleted">
+ <list type="bulleted">
<item>When <c>sys:get_status/1,2</c> is called, gen_event
ensures that its return value contains <c>Status</c> in
place of the event handler's actual state term.</item>
diff --git a/lib/stdlib/doc/src/gen_fsm.xml b/lib/stdlib/doc/src/gen_fsm.xml
index 5f7b5a3437..4d594b8eb2 100644
--- a/lib/stdlib/doc/src/gen_fsm.xml
+++ b/lib/stdlib/doc/src/gen_fsm.xml
@@ -339,11 +339,12 @@ gen_fsm:sync_send_all_state_event -----> Module:handle_sync_event/4
</desc>
</func>
<func>
- <name>reply(Caller, Reply) -> true</name>
+ <name>reply(Caller, Reply) -> Result</name>
<fsummary>Send a reply to a caller.</fsummary>
<type>
<v>Caller - see below</v>
<v>Reply = term()</v>
+ <v>Result = term()</v>
</type>
<desc>
<p>This function can be used by a gen_fsm to explicitly send a
@@ -358,6 +359,8 @@ gen_fsm:sync_send_all_state_event -----> Module:handle_sync_event/4
which will be given back to the client as the return value of
<c>sync_send_event/2,3</c> or
<c>sync_send_all_state_event/2,3</c>.</p>
+ <p>The return value <c>Result</c> is not further defined, and
+ should always be ignored.</p>
</desc>
</func>
<func>
@@ -802,7 +805,7 @@ gen_fsm:sync_send_all_state_event -----> Module:handle_sync_event/4
module state data.</p>
</note>
<p>This function is called by a gen_fsm process when:</p>
- <list typed="bulleted">
+ <list type="bulleted">
<item>One
of <seealso marker="sys#get_status/1">sys:get_status/1,2</seealso>
is invoked to get the gen_fsm status. <c>Opt</c> is set to
diff --git a/lib/stdlib/doc/src/gen_server.xml b/lib/stdlib/doc/src/gen_server.xml
index c31e869db8..6d04771cd4 100644
--- a/lib/stdlib/doc/src/gen_server.xml
+++ b/lib/stdlib/doc/src/gen_server.xml
@@ -673,7 +673,7 @@ gen_server:abcast -----> Module:handle_cast/2
module state.</p>
</note>
<p>This function is called by a gen_server process when:</p>
- <list typed="bulleted">
+ <list type="bulleted">
<item>One
of <seealso marker="sys#get_status/1">sys:get_status/1,2</seealso>
is invoked to get the gen_server status. <c>Opt</c> is set
diff --git a/lib/stdlib/doc/src/io.xml b/lib/stdlib/doc/src/io.xml
index edf3c51b4c..4655c8662f 100644
--- a/lib/stdlib/doc/src/io.xml
+++ b/lib/stdlib/doc/src/io.xml
@@ -132,8 +132,8 @@
<func>
<name name="get_chars" arity="2"/>
<name name="get_chars" arity="3"/>
- <type name="server_no_data"/>
<fsummary>Read a specified number of characters</fsummary>
+ <type name="server_no_data"/>
<desc>
<p>Reads <c><anno>Count</anno></c> characters from standard input
(<c><anno>IoDevice</anno></c>), prompting it with <c><anno>Prompt</anno></c>. It
@@ -162,8 +162,8 @@
<func>
<name name="get_line" arity="1"/>
<name name="get_line" arity="2"/>
- <type name="server_no_data"/>
<fsummary>Read a line</fsummary>
+ <type name="server_no_data"/>
<desc>
<p>Reads a line from the standard input (<c><anno>IoDevice</anno></c>),
prompting it with <c><anno>Prompt</anno></c>. It returns:</p>
@@ -300,8 +300,8 @@
<func>
<name name="read" arity="1"/>
<name name="read" arity="2"/>
- <type name="server_no_data"/>
<fsummary>Read a term</fsummary>
+ <type name="server_no_data"/>
<desc>
<p>Reads a term <c><anno>Term</anno></c> from the standard input
(<c><anno>IoDevice</anno></c>), prompting it with <c><anno>Prompt</anno></c>. It
@@ -330,8 +330,8 @@
<func>
<name name="read" arity="3"/>
<name name="read" arity="4"/>
- <type name="server_no_data"/>
<fsummary>Read a term</fsummary>
+ <type name="server_no_data"/>
<desc>
<p>Reads a term <c><anno>Term</anno></c> from <c><anno>IoDevice</anno></c>, prompting it
with <c><anno>Prompt</anno></c>. Reading starts at location
@@ -698,8 +698,8 @@ ok
<func>
<name name="fread" arity="2"/>
<name name="fread" arity="3"/>
- <type name="server_no_data"/>
<fsummary>Read formatted input</fsummary>
+ <type name="server_no_data"/>
<desc>
<p>Reads characters from the standard input (<c><anno>IoDevice</anno></c>),
prompting it with <c><anno>Prompt</anno></c>. Interprets the characters in
@@ -870,8 +870,8 @@ enter><input>:</input> <input>alan</input> <input>:</input> <input>joe</in
<name name="scan_erl_exprs" arity="2"/>
<name name="scan_erl_exprs" arity="3"/>
<name name="scan_erl_exprs" arity="4"/>
- <type name="server_no_data"/>
<fsummary>Read and tokenize Erlang expressions</fsummary>
+ <type name="server_no_data"/>
<desc>
<p>Reads data from the standard input (<c>IoDevice</c>),
prompting it with <c>Prompt</c>. Reading starts at location
@@ -919,8 +919,8 @@ enter><input>1.0er.</input>
<name name="scan_erl_form" arity="2"/>
<name name="scan_erl_form" arity="3"/>
<name name="scan_erl_form" arity="4"/>
- <type name="server_no_data"/>
<fsummary>Read and tokenize an Erlang form</fsummary>
+ <type name="server_no_data"/>
<desc>
<p>Reads data from the standard input (<c><anno>IoDevice</anno></c>),
prompting it with <c><anno>Prompt</anno></c>. Starts reading
@@ -939,9 +939,9 @@ enter><input>1.0er.</input>
<name name="parse_erl_exprs" arity="2"/>
<name name="parse_erl_exprs" arity="3"/>
<name name="parse_erl_exprs" arity="4"/>
+ <fsummary>Read, tokenize and parse Erlang expressions</fsummary>
<type name="parse_ret"/>
<type name="server_no_data"/>
- <fsummary>Read, tokenize and parse Erlang expressions</fsummary>
<desc>
<p>Reads data from the standard input
(<c><anno>IoDevice</anno></c>), prompting it with
@@ -990,9 +990,9 @@ enter><input>abc("hey".</input>
<name name="parse_erl_form" arity="2"/>
<name name="parse_erl_form" arity="3"/>
<name name="parse_erl_form" arity="4"/>
+ <fsummary>Read, tokenize and parse an Erlang form</fsummary>
<type name="parse_form_ret"/>
<type name="server_no_data"/>
- <fsummary>Read, tokenize and parse an Erlang form</fsummary>
<desc>
<p>Reads data from the standard input (<c><anno>IoDevice</anno></c>),
prompting it with <c><anno>Prompt</anno></c>. Starts reading at
diff --git a/lib/stdlib/doc/src/lists.xml b/lib/stdlib/doc/src/lists.xml
index 46edd9fe16..89ba5238b5 100644
--- a/lib/stdlib/doc/src/lists.xml
+++ b/lib/stdlib/doc/src/lists.xml
@@ -283,8 +283,8 @@ flatmap(Fun, List1) ->
</func>
<func>
<name name="keyfind" arity="3"/>
- <type_desc variable="N">1..tuple_size(<anno>Tuple</anno>)</type_desc>
<fsummary>Search for an element in a list of tuples</fsummary>
+ <type_desc variable="N">1..tuple_size(<anno>Tuple</anno>)</type_desc>
<desc>
<p>Searches the list of tuples <c><anno>TupleList</anno></c> for a
tuple whose <c><anno>N</anno></c>th element compares equal to <c><anno>Key</anno></c>.
@@ -311,8 +311,8 @@ flatmap(Fun, List1) ->
</func>
<func>
<name name="keymember" arity="3"/>
- <type_desc variable="N">1..tuple_size(<anno>Tuple</anno>)</type_desc>
<fsummary>Test for membership of a list of tuples</fsummary>
+ <type_desc variable="N">1..tuple_size(<anno>Tuple</anno>)</type_desc>
<desc>
<p>Returns <c>true</c> if there is a tuple in <c><anno>TupleList</anno></c>
whose <c><anno>N</anno></c>th element compares equal to <c><anno>Key</anno></c>, otherwise
@@ -346,8 +346,8 @@ flatmap(Fun, List1) ->
</func>
<func>
<name name="keysearch" arity="3"/>
- <type_desc variable="N">1..tuple_size(<anno>Tuple</anno>)</type_desc>
<fsummary>Search for an element in a list of tuples</fsummary>
+ <type_desc variable="N">1..tuple_size(<anno>Tuple</anno>)</type_desc>
<desc>
<p>Searches the list of tuples <c><anno>TupleList</anno></c> for a
tuple whose <c><anno>N</anno></c>th element compares equal to <c><anno>Key</anno></c>.
diff --git a/lib/stdlib/doc/src/math.xml b/lib/stdlib/doc/src/math.xml
index 31e838d741..aee6c3f238 100644
--- a/lib/stdlib/doc/src/math.xml
+++ b/lib/stdlib/doc/src/math.xml
@@ -72,9 +72,9 @@
<name name="log10" arity="1"/>
<name name="pow" arity="2"/>
<name name="sqrt" arity="1"/>
+ <fsummary>Diverse math functions</fsummary>
<type variable="X" name_i="7"/>
<type variable="Y" name_i="7"/>
- <fsummary>Diverse math functions</fsummary>
<desc>
<p>A collection of math functions which return floats. Arguments
are numbers. </p>
diff --git a/lib/stdlib/doc/src/notes.xml b/lib/stdlib/doc/src/notes.xml
index 514ac37d90..c84ca9c8ad 100644
--- a/lib/stdlib/doc/src/notes.xml
+++ b/lib/stdlib/doc/src/notes.xml
@@ -31,6 +31,71 @@
</header>
<p>This document describes the changes made to the STDLIB application.</p>
+<section><title>STDLIB 2.6</title>
+
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p> In OTP 18.0, <c>qlc</c> does not handle syntax errors
+ well. This bug has been fixed. </p>
+ <p>
+ Own Id: OTP-12946</p>
+ </item>
+ <item>
+ <p>
+ Optimize zip:unzip/2 when uncompressing to memory.</p>
+ <p>
+ Own Id: OTP-12950</p>
+ </item>
+ <item>
+ <p>
+ The <c>stdlib</c> reference manual is updated to show
+ correct information about the return value of
+ <c>gen_fsm:reply/2</c>.</p>
+ <p>
+ Own Id: OTP-12973</p>
+ </item>
+ <item>
+ <p>re:split2,3 and re:replace/3,4 now correctly handles
+ pre-compiled patterns that have been compiled using the
+ '<c>unicode</c>' option.</p>
+ <p>
+ Own Id: OTP-12977</p>
+ </item>
+ <item>
+ <p>
+ Export <c>shell:catch_exception/1</c> as documented.</p>
+ <p>
+ Own Id: OTP-12990</p>
+ </item>
+ </list>
+ </section>
+
+
+ <section><title>Improvements and New Features</title>
+ <list>
+ <item>
+ <p>A mechanism for limiting the amount of text that the
+ built-in error logger events will produce has been
+ introduced. It is useful for limiting both the size of
+ log files and the CPU time used to produce them.</p>
+ <p>This mechanism is experimental in the sense that it
+ may be changed if it turns out that it does not solve the
+ problem it is supposed to solve. In that case, there may
+ be backward incompatible improvements to this
+ mechanism.</p>
+ <p>See the documentation for the config parameter
+ <c>error_logger_format_depth</c> in the Kernel
+ application for information about how to turn on this
+ feature.</p>
+ <p>
+ Own Id: OTP-12864</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
<section><title>STDLIB 2.5</title>
<section><title>Fixed Bugs and Malfunctions</title>
@@ -89,8 +154,9 @@
Correct <c>maps</c> module error exceptions </p>
<p>
Bad input to maps module function will now yield the
- following exceptions: <list> <item>{badmap,NotMap}
- or,</item> <item>badarg</item> </list></p>
+ following exceptions:</p>
+ <list> <item>{badmap, NotMap}, or </item> <item>badarg.</item>
+ </list>
<p>
Own Id: OTP-12657</p>
</item>
@@ -188,12 +254,11 @@
<p>
<c>proc_lib:stop/1,3</c> is used by the following
functions:</p>
- <p>
<list> <item><c>gen_server:stop/1,3</c> (new)</item>
<item><c>gen_fsm:stop/1,3</c> (new)</item>
<item><c>gen_event:stop/1,3</c> (modified to be
synchronous)</item> <item><c>wx_object:stop/1,3</c>
- (new)</item> </list></p>
+ (new)</item> </list>
<p>
Own Id: OTP-11173 Aux Id: seq12353 </p>
</item>
@@ -800,8 +865,7 @@
also implemented by the generic behaviours
<c>gen_server</c>, <c>gen_event</c> and <c>gen_fsm</c>.</p>
<p>
- The potential incompatibility refers to</p>
- <p>
+ The potential incompatibility refers to:</p>
<list> <item>The previous behaviour of intercepting the
system message and passing a tuple of size 2 as the last
argument to <c>sys:handle_system_msg/6</c> is no longer
@@ -809,7 +873,7 @@
<c>StateFun</c> in <c>sys:replace_state/2,3</c> fails is
changed from being totally silent to possibly (if the
callback module does not catch) throw an exception in the
- client process.</item> </list></p>
+ client process.</item> </list>
<p>
(Thanks to James Fish and Steve Vinoski)</p>
<p>
@@ -971,22 +1035,28 @@
<p>
EEP43: New data type - Maps</p>
<p>
- With Maps you may for instance: <taglist> <item><c>M0 =
- #{ a =&gt; 1, b =&gt; 2}, % create
- associations</c></item> <item><c>M1 = M0#{ a := 10 }, %
- update values</c></item> <item><c>M2 = M1#{ "hi" =&gt;
- "hello"}, % add new associations</c></item> <item><c>#{
- "hi" := V1, a := V2, b := V3} = M2. % match keys with
- values</c></item> </taglist></p>
+ With Maps you may for instance:</p>
+ <taglist>
+ <tag/> <item><c>M0 = #{ a =&gt; 1, b =&gt; 2}, % create
+ associations</c></item>
+ <tag/><item><c>M1 = M0#{ a := 10 }, % update values</c></item>
+ <tag/><item><c>M2 = M1#{ "hi" =&gt;
+ "hello"}, % add new associations</c></item>
+ <tag/><item><c>#{ "hi" := V1, a := V2, b := V3} = M2.
+ % match keys with values</c></item>
+ </taglist>
<p>
For information on how to use Maps please see Map Expressions in the
<seealso marker="doc/reference_manual:expressions#map_expressions">
Reference Manual</seealso>.</p>
<p>
The current implementation is without the following
- features: <taglist> <item>No variable keys</item>
- <item>No single value access</item> <item>No map
- comprehensions</item> </taglist></p>
+ features:</p>
+ <taglist>
+ <tag/><item>No variable keys</item>
+ <tag/><item>No single value access</item>
+ <tag/><item>No map comprehensions</item>
+ </taglist>
<p>
Note that Maps is <em>experimental</em> during OTP 17.0.</p>
<p>
@@ -1737,13 +1807,15 @@
supervisor or for the problematic child.</p>
<p>
This introduces some incompatibilities in stdlib due to
- new return values from supervisor: <list>
+ new return values from supervisor:</p>
+ <list>
<item>restart_child/2 can now return
{error,restarting}</item> <item>delete_child/2 can now
return {error,restarting}</item> <item>which_children/1
returns a list of {Id,Child,Type,Mods}, where Child, in
addition to the old pid() or 'undefined', now also can be
- 'restarting'.</item> </list></p>
+ 'restarting'.</item>
+ </list>
<p>
*** POTENTIAL INCOMPATIBILITY ***</p>
<p>
@@ -1759,10 +1831,10 @@
Own Id: OTP-9782 Aux Id: seq11964 </p>
</item>
<item>
- <p> Use universal time as base in error logger
+ <p> Use universal time as base in error logger</p>
<p>
Previous conversion used the deprecated
- calendar:local_time_to_universal_time/1 </p></p>
+ calendar:local_time_to_universal_time/1 </p>
<p>
Own Id: OTP-9854</p>
</item>
@@ -2519,10 +2591,10 @@
Own Id: OTP-8989 Aux Id: seq11741 </p>
</item>
<item>
- <p>Fix exception generation in the io module
+ <p>Fix exception generation in the io module</p>
<p>
Some functions did not generate correct badarg exception
- on a badarg exception.</p></p>
+ on a badarg exception.</p>
<p>
Own Id: OTP-9045</p>
</item>
diff --git a/lib/stdlib/doc/src/random.xml b/lib/stdlib/doc/src/random.xml
index 91a4012ce9..a1bf67d332 100644
--- a/lib/stdlib/doc/src/random.xml
+++ b/lib/stdlib/doc/src/random.xml
@@ -76,9 +76,15 @@
dictionary, and returns the old state.</p>
<p>One easy way of obtaining a unique value to seed with is to:</p>
<code type="none">
- random:seed(<seealso marker="erts:erlang#phash2/1">erlang:phash2</seealso>([<seealso marker="erts:erlang#node/0">node()</seealso>]),
- <seealso marker="erts:erlang#monotonic_time/0">erlang:monotonic_time()</seealso>,
- <seealso marker="erts:erlang#unique_integer/0">erlang:unique_integer()</seealso>)</code>
+random:seed(erlang:phash2([node()]),
+ erlang:monotonic_time(),
+ erlang:unique_integer())</code>
+ <p>See <seealso marker="erts:erlang#phash2/1">
+ erlang:phash2/1</seealso>, <seealso marker="erts:erlang#node/0">
+ node/0</seealso>, <seealso marker="erts:erlang#monotonic_time/0">
+ erlang:monotonic_time/0</seealso>, and
+ <seealso marker="erts:erlang#unique_integer/0">
+ erlang:unique_integer/0</seealso>) for details.</p>
</desc>
</func>
<func>
diff --git a/lib/stdlib/doc/src/re.xml b/lib/stdlib/doc/src/re.xml
index 46b382a6be..8c19926b10 100644
--- a/lib/stdlib/doc/src/re.xml
+++ b/lib/stdlib/doc/src/re.xml
@@ -205,8 +205,8 @@ This option makes it possible to include comments inside complicated patterns. N
</func>
<func>
<name name="run" arity="3"/>
- <type_desc variable="CompileOpt">See <seealso marker="#compile_options">compile/2</seealso> above.</type_desc>
<fsummary>Match a subject against regular expression and capture subpatterns</fsummary>
+ <type_desc variable="CompileOpt">See <seealso marker="#compile_options">compile/2</seealso> above.</type_desc>
<desc>
<p>Executes a regexp matching, returning <c>match/{match,
@@ -881,11 +881,11 @@ nomatch
</desc>
</func>
</funcs>
-
- <marker id="regexp_syntax"></marker>
+
<section>
<title>PERL LIKE REGULAR EXPRESSIONS SYNTAX</title>
- <p>The following sections contain reference material for the
+ <p><marker id="regexp_syntax"></marker>
+ The following sections contain reference material for the
regular expressions used by this module. The regular expression
reference is based on the PCRE documentation, with changes in
cases where the re module behaves differently to the PCRE library.</p>
@@ -2070,7 +2070,7 @@ supported, and an error is given if they are encountered.</p>
<p>By default, in UTF modes, characters with values greater than 255 do not match
any of the POSIX character classes. However, if the PCRE_UCP option is passed
-to <b>pcre_compile()</b>, some of the classes are changed so that Unicode
+to <em>pcre_compile()</em>, some of the classes are changed so that Unicode
character properties are used. This is achieved by replacing the POSIX classes
by other sequences, as follows:</p>
@@ -2078,10 +2078,10 @@ by other sequences, as follows:</p>
<tag>[:alnum:]</tag> <item>becomes <em>\p{Xan}</em></item>
<tag>[:alpha:]</tag> <item>becomes <em>\p{L}</em></item>
<tag>[:blank:]</tag> <item>becomes <em>\h</em></item>
- <tag>[:digit:</tag>] <item>becomes <em>\p{Nd}</em></item>
+ <tag>[:digit:]</tag> <item>becomes <em>\p{Nd}</em></item>
<tag>[:lower:]</tag> <item>becomes <em>\p{Ll}</em></item>
<tag>[:space:]</tag> <item>becomes <em>\p{Xps}</em></item>
- <tag>[:upper:</tag>] <item>becomes <em>\p{Lu}</em></item>
+ <tag>[:upper:]</tag> <item>becomes <em>\p{Lu}</em></item>
<tag>[:word:]</tag> <item>becomes <em>\p{Xwd}</em></item>
</taglist>
@@ -3059,7 +3059,7 @@ default newline convention is in force:</p>
<quote><p> abc #comment \n still comment</p></quote>
-<p>On encountering the # character, <b>pcre_compile()</b> skips along, looking for
+<p>On encountering the # character, <em>pcre_compile()</em> skips along, looking for
a newline in the pattern. The sequence \n is still literal at this stage, so
it does not terminate the comment. Only an actual character with the code value
0x0a (the default newline) does so.</p>
diff --git a/lib/stdlib/doc/src/sofs.xml b/lib/stdlib/doc/src/sofs.xml
index 5d7648d9a1..53f6ca957a 100644
--- a/lib/stdlib/doc/src/sofs.xml
+++ b/lib/stdlib/doc/src/sofs.xml
@@ -398,8 +398,9 @@ fun(S) -> sofs:partition(1, S) end
</datatype>
<datatype>
<!-- Parameterized opaque types are NYI: -->
- <name><marker id="type-tuple_of">tuple_of(T)</marker></name>
- <desc><p>A tuple where the elements are of type <c>T</c>.</p></desc>
+ <name>tuple_of(T)</name>
+ <desc><p><marker id="type-tuple_of"/>
+ A tuple where the elements are of type <c>T</c>.</p></desc>
</datatype>
</datatypes>
<funcs>
diff --git a/lib/stdlib/doc/src/supervisor.xml b/lib/stdlib/doc/src/supervisor.xml
index f08b752998..24ff251ce3 100644
--- a/lib/stdlib/doc/src/supervisor.xml
+++ b/lib/stdlib/doc/src/supervisor.xml
@@ -353,7 +353,7 @@
<desc>
<p>Dynamically adds a child specification to the supervisor
<c><anno>SupRef</anno></c> which starts the corresponding child process.</p>
- <p><marker id="SupRef"><c><anno>SupRef</anno></c></marker> can be:</p>
+ <p><marker id="SupRef"/><c><anno>SupRef</anno></c> can be:</p>
<list type="bulleted">
<item>the pid,</item>
<item><c>Name</c>, if the supervisor is locally registered,</item>
diff --git a/lib/stdlib/doc/src/sys.xml b/lib/stdlib/doc/src/sys.xml
index 6ec515849e..d400f72e1d 100644
--- a/lib/stdlib/doc/src/sys.xml
+++ b/lib/stdlib/doc/src/sys.xml
@@ -238,8 +238,8 @@
<p>These functions are intended only to help with debugging. They are provided for
convenience, allowing developers to avoid having to create their own state extraction
functions and also avoid having to interactively extract state from the return values of
- <c><seealso marker="#get_status-1">get_status/1</seealso></c> or
- <c><seealso marker="#get_status-2">get_status/2</seealso></c> while debugging.</p>
+ <seealso marker="#get_status-1"><c>get_status/1</c></seealso> or
+ <seealso marker="#get_status-2"><c>get_status/2</c></seealso> while debugging.</p>
</note>
<p>The value of <c><anno>State</anno></c> varies for different types of
processes. For a <c>gen_server</c> process, the returned <c><anno>State</anno></c>
diff --git a/lib/stdlib/doc/src/timer.xml b/lib/stdlib/doc/src/timer.xml
index e002f519b9..7609487300 100644
--- a/lib/stdlib/doc/src/timer.xml
+++ b/lib/stdlib/doc/src/timer.xml
@@ -85,7 +85,6 @@
<name name="send_after" arity="3"/>
<fsummary>Send <c>Message</c>to <c>Pid</c>after a specified <c>Time</c>.</fsummary>
<desc>
- <p>
<taglist>
<tag><c>send_after/3</c></tag>
<item>
@@ -99,7 +98,6 @@
<p>Same as <c>send_after(<anno>Time</anno>, self(), <anno>Message</anno>)</c>.</p>
</item>
</taglist>
- </p>
</desc>
</func>
<func>
@@ -109,7 +107,6 @@
<name name="exit_after" arity="3"/>
<fsummary>Send an exit signal with <c>Reason</c>after a specified <c>Time</c>.</fsummary>
<desc>
- <p>
<taglist>
<tag><c>exit_after/3</c></tag>
<item>
@@ -130,7 +127,6 @@
<p>Same as <c>exit_after(<anno>Time</anno>, self(), kill)</c>. </p>
</item>
</taglist>
- </p>
</desc>
</func>
<func>
@@ -147,7 +143,6 @@
<name name="send_interval" arity="3"/>
<fsummary>Send <c>Message</c>repeatedly at intervals of <c>Time</c>.</fsummary>
<desc>
- <p>
<taglist>
<tag><c>send_interval/3</c></tag>
<item>
@@ -161,7 +156,6 @@
<p>Same as <c>send_interval(<anno>Time</anno>, self(), <anno>Message</anno>)</c>.</p>
</item>
</taglist>
- </p>
</desc>
</func>
<func>
@@ -192,7 +186,6 @@
Function, Arguments)</c> or <c>apply(Fun, Arguments)</c></fsummary>
<type_desc variable="Time">In microseconds</type_desc>
<desc>
- <p>
<taglist>
<tag><c>tc/3</c></tag>
<item>
@@ -213,7 +206,6 @@
</item>
</taglist>
- </p>
</desc>
</func>
<func>
diff --git a/lib/stdlib/doc/src/unicode.xml b/lib/stdlib/doc/src/unicode.xml
index 19ddf1cbd6..966eec49f5 100644
--- a/lib/stdlib/doc/src/unicode.xml
+++ b/lib/stdlib/doc/src/unicode.xml
@@ -133,7 +133,7 @@
<c>latin1</c>, or have characters encoded as one of the
UTF-encodings, which is given as the <c><anno>InEncoding</anno></c>
parameter. Only when the <c><anno>InEncoding</anno></c> is one of the UTF
- encodings, integers in the list are allowed to be grater than
+ encodings, integers in the list are allowed to be greater than
255.</p>
<p>If <c><anno>InEncoding</anno></c> is <c>latin1</c>, the <c><anno>Data</anno></c> parameter
diff --git a/lib/stdlib/doc/src/zip.xml b/lib/stdlib/doc/src/zip.xml
index 4500995c34..186c8ac724 100644
--- a/lib/stdlib/doc/src/zip.xml
+++ b/lib/stdlib/doc/src/zip.xml
@@ -126,7 +126,7 @@
</datatype>
<datatype>
<name name="filename"/>
- <p>The name of a zip file.</p>
+ <desc><p>The name of a zip file.</p></desc>
</datatype>
<datatype><name name="extension"/></datatype>
<datatype><name name="extension_spec"/></datatype>
diff --git a/lib/stdlib/include/erl_bits.hrl b/lib/stdlib/include/erl_bits.hrl
index 8405a55d55..2a54587a17 100644
--- a/lib/stdlib/include/erl_bits.hrl
+++ b/lib/stdlib/include/erl_bits.hrl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1999-2009. All Rights Reserved.
+%% Copyright Ericsson AB 1999-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -26,10 +26,10 @@
-type bt_unit() :: 1..256.
-record(bittype, {
- type :: bt_type(),
- unit :: bt_unit(), %% element unit
- sign :: bt_sign(),
- endian :: bt_endian()
+ type :: bt_type() | 'undefined',
+ unit :: bt_unit() | 'undefined', %% element unit
+ sign :: bt_sign() | 'undefined',
+ endian :: bt_endian() | 'undefined'
}).
-record(bitdefault, {
diff --git a/lib/stdlib/src/beam_lib.erl b/lib/stdlib/src/beam_lib.erl
index b93ce97cd3..6e00401dce 100644
--- a/lib/stdlib/src/beam_lib.erl
+++ b/lib/stdlib/src/beam_lib.erl
@@ -308,6 +308,17 @@ make_crypto_key(des3_cbc=Type, String) ->
<<K3:8/binary,IVec:8/binary>> = erlang:md5([First|reverse(String)]),
{Type,[K1,K2,K3],IVec,8}.
+-spec build_module(Chunks) -> {'ok', Binary} when
+ Chunks :: [{chunkid(), dataB()}],
+ Binary :: binary().
+
+build_module(Chunks0) ->
+ Chunks = list_to_binary(build_chunks(Chunks0)),
+ Size = byte_size(Chunks),
+ 0 = Size rem 4, % Assertion: correct padding?
+ {ok, <<"FOR1", (Size+4):32, "BEAM", Chunks/binary>>}.
+
+
%%
%% Local functions
%%
@@ -419,12 +430,6 @@ strip_file(File) ->
end
end.
-build_module(Chunks0) ->
- Chunks = list_to_binary(build_chunks(Chunks0)),
- Size = byte_size(Chunks),
- 0 = Size rem 4, % Assertion: correct padding?
- {ok, <<"FOR1", (Size+4):32, "BEAM", Chunks/binary>>}.
-
build_chunks([{Id, Data} | Chunks]) ->
BId = list_to_binary(Id),
Size = byte_size(Data),
@@ -867,7 +872,7 @@ mandatory_chunks() ->
%%% can use it.
%%% ====================================================================
--record(state, {crypto_key_f :: crypto_fun()}).
+-record(state, {crypto_key_f :: crypto_fun() | 'undefined'}).
-define(CRYPTO_KEY_SERVER, beam_lib__crypto_key_server).
diff --git a/lib/stdlib/src/edlin.erl b/lib/stdlib/src/edlin.erl
index 8c7a984f1c..19444c0502 100644
--- a/lib/stdlib/src/edlin.erl
+++ b/lib/stdlib/src/edlin.erl
@@ -227,6 +227,8 @@ key_map($F, meta_o) -> end_of_line;
key_map($\177, none) -> backward_delete_char;
key_map($\177, meta) -> backward_kill_word;
key_map($[, meta) -> meta_left_sq_bracket;
+key_map($H, meta_left_sq_bracket) -> beginning_of_line;
+key_map($F, meta_left_sq_bracket) -> end_of_line;
key_map($D, meta_left_sq_bracket) -> backward_char;
key_map($C, meta_left_sq_bracket) -> forward_char;
% support a few <CTRL>+<CURSOR LEFT|RIGHT> combinations...
@@ -237,8 +239,10 @@ key_map($[, meta_meta) -> meta_csi;
key_map($C, meta_csi) -> forward_word;
key_map($D, meta_csi) -> backward_word;
key_map($1, meta_left_sq_bracket) -> {csi, "1"};
+key_map($3, meta_left_sq_bracket) -> {csi, "3"};
key_map($5, meta_left_sq_bracket) -> {csi, "5"};
key_map($5, {csi, "1;"}) -> {csi, "1;5"};
+key_map($~, {csi, "3"}) -> forward_delete_char;
key_map($C, {csi, "5"}) -> forward_word;
key_map($C, {csi, "1;5"}) -> forward_word;
key_map($D, {csi, "5"}) -> backward_word;
diff --git a/lib/stdlib/src/epp.erl b/lib/stdlib/src/epp.erl
index d3124ac593..c8bba579cc 100644
--- a/lib/stdlib/src/epp.erl
+++ b/lib/stdlib/src/epp.erl
@@ -49,7 +49,8 @@
-define(DEFAULT_ENCODING, utf8).
%% Epp state record.
--record(epp, {file :: file:io_device(), %Current file
+-record(epp, {file :: file:io_device()
+ | 'undefined', %Current file
location=1, %Current location
delta=0 :: non_neg_integer(), %Offset from Location (-file)
name="" :: file:name(), %Current file name
diff --git a/lib/stdlib/src/erl_anno.erl b/lib/stdlib/src/erl_anno.erl
index 143318aa55..d32c34dabd 100644
--- a/lib/stdlib/src/erl_anno.erl
+++ b/lib/stdlib/src/erl_anno.erl
@@ -33,7 +33,7 @@
-export_type([anno_term/0]).
--define(LN(L), is_integer(L)).
+-define(LN(L), is_integer(L), L >= 0).
-define(COL(C), (is_integer(C) andalso C >= 1)).
%% Location.
@@ -52,13 +52,13 @@
| {'record', record()}
| {'text', string()}.
--type anno() :: location() | [annotation(), ...].
+-opaque anno() :: location() | [annotation(), ...].
-type anno_term() :: term().
-type column() :: pos_integer().
-type generated() :: boolean().
-type filename() :: file:filename_all().
--type line() :: integer().
+-type line() :: non_neg_integer().
-type location() :: line() | {line(), column()}.
-type record() :: boolean().
-type text() :: string().
@@ -90,9 +90,13 @@ to_term(Anno) ->
-ifdef(DEBUG).
from_term(Term) when is_list(Term) ->
Term;
+from_term(Line) when is_integer(Line), Line < 0 -> % Before OTP 19
+ set_generated(true, new(-Line));
from_term(Term) ->
[{location, Term}].
-else.
+from_term(Line) when is_integer(Line), Line < 0 -> % Before OTP 19
+ set_generated(true, new(-Line));
from_term(Term) ->
Term.
-endif.
@@ -198,18 +202,11 @@ file(Anno) ->
Anno :: anno().
generated(Line) when ?ALINE(Line) ->
- Line =< 0;
+ false;
generated({Line, Column}) when ?ALINE(Line), ?ACOLUMN(Column) ->
- Line =< 0;
+ false;
generated(Anno) ->
- _ = anno_info(Anno, generated, false),
- {location, Location} = lists:keyfind(location, 1, Anno),
- case Location of
- {Line, _Column} ->
- Line =< 0;
- Line ->
- Line =< 0
- end.
+ anno_info(Anno, generated, false).
-spec line(Anno) -> line() when
Anno :: anno().
@@ -226,18 +223,11 @@ line(Anno) ->
Anno :: anno().
location(Line) when ?ALINE(Line) ->
- abs(Line);
-location({Line, Column}) when ?ALINE(Line), ?ACOLUMN(Column) ->
- {abs(Line), Column};
+ Line;
+location({Line, Column}=Location) when ?ALINE(Line), ?ACOLUMN(Column) ->
+ Location;
location(Anno) ->
- case anno_info(Anno, location) of
- Line when Line < 0 ->
- -Line;
- {Line, Column} when Line < 0 ->
- {-Line, Column};
- Location ->
- Location
- end.
+ anno_info(Anno, location).
-spec record(Anno) -> record() when
Anno :: anno().
@@ -270,31 +260,8 @@ set_file(File, Anno) ->
Generated :: generated(),
Anno :: anno().
-set_generated(true, Line) when ?ALINE(Line) ->
- -abs(Line);
-set_generated(false, Line) when ?ALINE(Line) ->
- abs(Line);
-set_generated(true, {Line, Column}) when ?ALINE(Line),
- ?ACOLUMN(Column) ->
- {-abs(Line),Column};
-set_generated(false, {Line, Column}) when ?ALINE(Line),
- ?ACOLUMN(Column) ->
- {abs(Line),Column};
set_generated(Generated, Anno) ->
- _ = set(generated, Generated, Anno),
- {location, Location} = lists:keyfind(location, 1, Anno),
- NewLocation =
- case Location of
- {Line, Column} when Generated ->
- {-abs(Line), Column};
- {Line, Column} when not Generated ->
- {abs(Line), Column};
- Line when Generated ->
- -abs(Line);
- Line when not Generated ->
- abs(Line)
- end,
- lists:keyreplace(location, 1, Anno, {location, NewLocation}).
+ set(generated, Generated, Anno).
-spec set_line(Line, Anno) -> Anno when
Line :: line(),
@@ -313,38 +280,17 @@ set_line(Line, Anno) ->
Anno :: anno().
set_location(Line, L) when ?ALINE(L), ?LLINE(Line) ->
- new_location(fix_line(Line, L));
+ new_location(Line);
set_location(Line, {L, Column}) when ?ALINE(L), ?ACOLUMN(Column),
?LLINE(Line) ->
- new_location(fix_line(Line, L));
+ new_location(Line);
set_location({L, C}=Loc, Line) when ?ALINE(Line), ?LLINE(L), ?LCOLUMN(C) ->
- new_location(fix_location(Loc, Line));
+ new_location(Loc);
set_location({L, C}=Loc, {Line, Column}) when ?ALINE(Line), ?ACOLUMN(Column),
?LLINE(L), ?LCOLUMN(C) ->
- new_location(fix_location(Loc, Line));
+ new_location(Loc);
set_location(Location, Anno) ->
- _ = set(location, Location, Anno),
- {location, OldLocation} = lists:keyfind(location, 1, Anno),
- NewLocation =
- case {Location, OldLocation} of
- {{_Line, _Column}=Loc, {L, _C}} ->
- fix_location(Loc, L);
- {Line, {L, _C}} ->
- fix_line(Line, L);
- {{_Line, _Column}=Loc, L} ->
- fix_location(Loc, L);
- {Line, L} ->
- fix_line(Line, L)
- end,
- lists:keyreplace(location, 1, Anno, {location, NewLocation}).
-
-fix_location({Line, Column}, OldLine) ->
- {fix_line(Line, OldLine), Column}.
-
-fix_line(Line, OldLine) when OldLine < 0, Line > 0 ->
- -Line;
-fix_line(Line, _OldLine) ->
- Line.
+ set(location, Location, Anno).
-spec set_record(Record, Anno) -> Anno when
Record :: record(),
@@ -383,7 +329,7 @@ set_anno(Item, Value, Anno) ->
_ ->
lists:keyreplace(Item, 1, Anno, {Item, Value})
end,
- simplify(R)
+ reset_simplify(R)
end.
reset(Anno, Item) ->
diff --git a/lib/stdlib/src/erl_lint.erl b/lib/stdlib/src/erl_lint.erl
index c4cb5fdc80..a5f0e7dbd3 100644
--- a/lib/stdlib/src/erl_lint.erl
+++ b/lib/stdlib/src/erl_lint.erl
@@ -31,12 +31,8 @@
-export([is_guard_expr/1]).
-export([bool_option/4,value_option/3,value_option/7]).
--export([modify_line/2]).
-
-import(lists, [member/2,map/2,foldl/3,foldr/3,mapfoldl/3,all/2,reverse/1]).
--deprecated([{modify_line, 2, next_major_release}]).
-
%% bool_option(OnOpt, OffOpt, Default, Options) -> boolean().
%% value_option(Flag, Default, Options) -> Value.
%% value_option(Flag, Default, OnOpt, OnVal, OffOpt, OffVal, Options) ->
@@ -79,7 +75,7 @@ value_option(Flag, Default, On, OnVal, Off, OffVal, Opts) ->
%%-define(DEBUGF(X,Y), io:format(X, Y)).
-define(DEBUGF(X,Y), void).
--type line() :: erl_anno:line(). % a convenient alias
+-type line() :: erl_anno:anno(). % a convenient alias
-type fa() :: {atom(), arity()}. % function+arity
-type ta() :: {atom(), arity()}. % type+arity
@@ -238,6 +234,9 @@ format_error({removed, MFA, ReplacementMFA, Rel}) ->
"use ~s", [format_mfa(MFA), Rel, format_mfa(ReplacementMFA)]);
format_error({removed, MFA, String}) when is_list(String) ->
io_lib:format("~s: ~s", [format_mfa(MFA), String]);
+format_error({removed_type, MNA, ReplacementMNA, Rel}) ->
+ io_lib:format("the type ~s was removed in ~s; use ~s instead",
+ [format_mna(MNA), Rel, format_mna(ReplacementMNA)]);
format_error({obsolete_guard, {F, A}}) ->
io_lib:format("~p/~p obsolete", [F, A]);
format_error({too_many_arguments,Arity}) ->
@@ -413,6 +412,9 @@ format_mfa({M, F, A}) when is_integer(A) ->
format_mf(M, F, ArityString) when is_atom(M), is_atom(F) ->
atom_to_list(M) ++ ":" ++ atom_to_list(F) ++ "/" ++ ArityString.
+format_mna({M, N, A}) when is_integer(A) ->
+ atom_to_list(M) ++ ":" ++ atom_to_list(N) ++ gen_type_paren(A).
+
format_where(L) when is_integer(L) ->
io_lib:format("(line ~p)", [L]);
format_where({L,C}) when is_integer(L), is_integer(C) ->
@@ -3482,13 +3484,6 @@ vt_no_unused(Vt) -> [V || {_,{_,U,_L}}=V <- Vt, U =/= unused].
copy_expr(Expr, Anno) ->
erl_parse:map_anno(fun(_A) -> Anno end, Expr).
-%% modify_line(Form, Fun) -> Form
-%% modify_line(Expression, Fun) -> Expression
-%% Applies Fun to each line number occurrence.
-
-modify_line(T, F0) ->
- erl_parse:map_anno(F0, T).
-
%% Check a record_info call. We have already checked that it is not
%% shadowed by an import.
@@ -3557,6 +3552,7 @@ deprecated_function(Line, M, F, As, St) ->
St
end.
+-dialyzer({no_match, deprecated_type/5}).
deprecated_type(L, M, N, As, St) ->
NAs = length(As),
case otp_internal:obsolete_type(M, N, NAs) of
@@ -3567,6 +3563,8 @@ deprecated_type(L, M, N, As, St) ->
false ->
St
end;
+ {removed, Replacement, Rel} ->
+ add_warning(L, {removed_type, {M,N,NAs}, Replacement, Rel}, St);
no ->
St
end.
diff --git a/lib/stdlib/src/erl_parse.yrl b/lib/stdlib/src/erl_parse.yrl
index e82282421e..ae42a8f0b1 100644
--- a/lib/stdlib/src/erl_parse.yrl
+++ b/lib/stdlib/src/erl_parse.yrl
@@ -525,11 +525,6 @@ Erlang code.
-export([type_inop_prec/1,type_preop_prec/1]).
-export([map_anno/2, fold_anno/3, mapfold_anno/3,
new_anno/1, anno_to_term/1, anno_from_term/1]).
--export([set_line/2,get_attribute/2,get_attributes/1]).
-
--deprecated([{set_line, 2, next_major_release},
- {get_attribute, 2, next_major_release},
- {get_attributes, 1, next_major_release}]).
%% The following directive is needed for (significantly) faster compilation
%% of the generated .erl file by the HiPE compiler. Please do not remove.
@@ -795,31 +790,11 @@ record_fields([{match,_Am,{atom,Aa,A},Expr}|Fields]) ->
[{record_field,Aa,{atom,Aa,A},Expr}|record_fields(Fields)];
record_fields([{typed,Expr,TypeInfo}|Fields]) ->
[Field] = record_fields([Expr]),
- TypeInfo1 =
- case Expr of
- {match, _, _, _} -> TypeInfo; %% If we have an initializer.
- {atom, Aa, _} ->
- case has_undefined(TypeInfo) of
- false ->
- lift_unions(abstract2(undefined, Aa), TypeInfo);
- true ->
- TypeInfo
- end
- end,
- [{typed_record_field,Field,TypeInfo1}|record_fields(Fields)];
+ [{typed_record_field,Field,TypeInfo}|record_fields(Fields)];
record_fields([Other|_Fields]) ->
ret_err(?anno(Other), "bad record field");
record_fields([]) -> [].
-has_undefined({atom,_,undefined}) ->
- true;
-has_undefined({ann_type,_,[_,T]}) ->
- has_undefined(T);
-has_undefined({type,_,union,Ts}) ->
- lists:any(fun has_undefined/1, Ts);
-has_undefined(_) ->
- false.
-
term(Expr) ->
try normalise(Expr)
catch _:_R -> ret_err(?anno(Expr), "bad attribute")
@@ -1118,28 +1093,6 @@ type_preop_prec('-') -> {600,700};
type_preop_prec('bnot') -> {600,700};
type_preop_prec('#') -> {700,800}.
-%%% [Experimental]. The parser just copies the attributes of the
-%%% scanner tokens to the abstract format. This design decision has
-%%% been hidden to some extent: use set_line() and get_attribute() to
-%%% access the second element of (almost all) of the abstract format
-%%% tuples. A typical use is to negate line numbers to prevent the
-%%% compiler from emitting warnings and errors. The second element can
-%%% (of course) be set to any value, but then these functions no
-%%% longer apply. To get all present attributes as a property list
-%%% get_attributes() should be used.
-
--compile({nowarn_deprecated_function,{erl_scan,set_attribute,3}}).
-set_line(L, F) ->
- erl_scan:set_attribute(line, L, F).
-
--compile({nowarn_deprecated_function,{erl_scan,attributes_info,2}}).
-get_attribute(L, Name) ->
- erl_scan:attributes_info(L, Name).
-
--compile({nowarn_deprecated_function,{erl_scan,attributes_info,1}}).
-get_attributes(L) ->
- erl_scan:attributes_info(L).
-
-spec map_anno(Fun, Abstr) -> NewAbstr when
Fun :: fun((Anno) -> Anno),
Anno :: erl_anno:anno(),
diff --git a/lib/stdlib/src/erl_scan.erl b/lib/stdlib/src/erl_scan.erl
index d2f53816b8..47223b129c 100644
--- a/lib/stdlib/src/erl_scan.erl
+++ b/lib/stdlib/src/erl_scan.erl
@@ -52,25 +52,15 @@
%%% External exports
-export([string/1,string/2,string/3,tokens/3,tokens/4,
- format_error/1,reserved_word/1,
- token_info/1,token_info/2,
- attributes_info/1,attributes_info/2,set_attribute/3]).
+ format_error/1,reserved_word/1]).
-export([column/1,end_location/1,line/1,location/1,text/1,
category/1,symbol/1]).
--deprecated([{attributes_info, 1, next_major_release},
- {attributes_info, 2, next_major_release},
- {set_attribute, 3, next_major_release},
- {token_info, 1, next_major_release},
- {token_info, 2, next_major_release}]).
-
%%% Private
-export([continuation_location/1]).
-export_type([error_info/0,
- line/0,
- location/0,
options/0,
return_cont/0,
token/0,
@@ -85,29 +75,18 @@
-define(ALINE(L), is_integer(L)).
-define(STRING(S), is_list(S)).
-define(RESWORDFUN(F), is_function(F, 1)).
--define(SETATTRFUN(F), is_function(F, 1)).
-type category() :: atom().
--type column() :: pos_integer(). % Deprecated
--type line() :: integer(). % Deprecated
--type location() :: line() | {line(),column()}. % Deprecated
-type resword_fun() :: fun((atom()) -> boolean()).
-type option() :: 'return' | 'return_white_spaces' | 'return_comments'
| 'text' | {'reserved_word_fun', resword_fun()}.
-type options() :: option() | [option()].
-type symbol() :: atom() | float() | integer() | string().
--type info_line() :: integer() | term().
--type attributes_data()
- :: [{'column', column()} | {'line', info_line()} | {'text', string()}]
- | {line(), column()}.
-%% The fact that {line(),column()} is a possible attributes() type
-%% is hidden.
--type attributes() :: line() | attributes_data().
--type token() :: {category(), attributes(), symbol()}
- | {category(), attributes()}.
+-type token() :: {category(), Anno :: erl_anno:anno(), symbol()}
+ | {category(), Anno :: erl_anno:anno()}.
-type tokens() :: [token()].
-type error_description() :: term().
--type error_info() :: {location(), module(), error_description()}.
+-type error_info() :: {erl_anno:location(), module(), error_description()}.
%%% Local record.
-record(erl_scan,
@@ -136,8 +115,8 @@ format_error(Other) ->
String :: string(),
Return :: {'ok', Tokens :: tokens(), EndLocation}
| {'error', ErrorInfo :: error_info(), ErrorLocation},
- EndLocation :: location(),
- ErrorLocation :: location().
+ EndLocation :: erl_anno:location(),
+ ErrorLocation :: erl_anno:location().
string(String) ->
string(String, 1, []).
@@ -145,9 +124,9 @@ string(String) ->
String :: string(),
Return :: {'ok', Tokens :: tokens(), EndLocation}
| {'error', ErrorInfo :: error_info(), ErrorLocation},
- StartLocation :: location(),
- EndLocation :: location(),
- ErrorLocation :: location().
+ StartLocation :: erl_anno:location(),
+ EndLocation :: erl_anno:location(),
+ ErrorLocation :: erl_anno:location().
string(String, StartLocation) ->
string(String, StartLocation, []).
@@ -156,9 +135,9 @@ string(String, StartLocation) ->
Options :: options(),
Return :: {'ok', Tokens :: tokens(), EndLocation}
| {'error', ErrorInfo :: error_info(), ErrorLocation},
- StartLocation :: location(),
- EndLocation :: location(),
- ErrorLocation :: location().
+ StartLocation :: erl_anno:location(),
+ EndLocation :: erl_anno:location(),
+ ErrorLocation :: erl_anno:location().
string(String, Line, Options) when ?STRING(String), ?ALINE(Line) ->
string1(String, options(Options), Line, no_col, []);
string(String, {Line,Column}, Options) when ?STRING(String),
@@ -167,20 +146,23 @@ string(String, {Line,Column}, Options) when ?STRING(String),
string1(String, options(Options), Line, Column, []).
-type char_spec() :: string() | 'eof'.
--type cont_fun() :: fun((char_spec(), #erl_scan{}, line(), column(),
+-type cont_fun() :: fun((char_spec(), #erl_scan{},
+ erl_anno:line(), erl_anno:column(),
tokens(), any()) -> any()).
-opaque return_cont() :: {erl_scan_continuation,
- string(), column(), tokens(), line(),
+ string(), erl_anno:column(), tokens(),
+ erl_anno:line(),
#erl_scan{}, any(), cont_fun()}.
--type tokens_result() :: {'ok', Tokens :: tokens(), EndLocation :: location()}
- | {'eof', EndLocation :: location()}
+-type tokens_result() :: {'ok', Tokens :: tokens(),
+ EndLocation :: erl_anno:location()}
+ | {'eof', EndLocation :: erl_anno:location()}
| {'error', ErrorInfo :: error_info(),
- EndLocation :: location()}.
+ EndLocation :: erl_anno:location()}.
-spec tokens(Continuation, CharSpec, StartLocation) -> Return when
Continuation :: return_cont() | [],
CharSpec :: char_spec(),
- StartLocation :: location(),
+ StartLocation :: erl_anno:location(),
Return :: {'done',Result :: tokens_result(),LeftOverChars :: char_spec()}
| {'more', Continuation1 :: return_cont()}.
tokens(Cont, CharSpec, StartLocation) ->
@@ -189,7 +171,7 @@ tokens(Cont, CharSpec, StartLocation) ->
-spec tokens(Continuation, CharSpec, StartLocation, Options) -> Return when
Continuation :: return_cont() | [],
CharSpec :: char_spec(),
- StartLocation :: location(),
+ StartLocation :: erl_anno:location(),
Options :: options(),
Return :: {'done',Result :: tokens_result(),LeftOverChars :: char_spec()}
| {'more', Continuation1 :: return_cont()}.
@@ -257,155 +239,6 @@ symbol({_Category,_Anno,Symbol}) ->
symbol(T) ->
erlang:error(badarg, [T]).
--type attribute_item() :: 'column' | 'length' | 'line'
- | 'location' | 'text'.
--type info_location() :: location() | term().
--type attribute_info() :: {'column', column()}| {'length', pos_integer()}
- | {'line', info_line()}
- | {'location', info_location()}
- | {'text', string()}.
--type token_item() :: 'category' | 'symbol' | attribute_item().
--type token_info() :: {'category', category()} | {'symbol', symbol()}
- | attribute_info().
-
--spec token_info(Token) -> TokenInfo when
- Token :: token(),
- TokenInfo :: [TokenInfoTuple :: token_info()].
-token_info(Token) ->
- Items = [category,column,length,line,symbol,text], % undefined order
- token_info(Token, Items).
-
--spec token_info(Token, TokenItem) -> TokenInfoTuple | 'undefined' when
- Token :: token(),
- TokenItem :: token_item(),
- TokenInfoTuple :: token_info();
- (Token, TokenItems) -> TokenInfo when
- Token :: token(),
- TokenItems :: [TokenItem :: token_item()],
- TokenInfo :: [TokenInfoTuple :: token_info()].
-token_info(_Token, []) ->
- [];
-token_info(Token, [Item|Items]) when is_atom(Item) ->
- case token_info(Token, Item) of
- undefined ->
- token_info(Token, Items);
- TokenInfo when is_tuple(TokenInfo) ->
- [TokenInfo|token_info(Token, Items)]
- end;
-token_info({Category,_Attrs}, category=Item) ->
- {Item,Category};
-token_info({Category,_Attrs,_Symbol}, category=Item) ->
- {Item,Category};
-token_info({Category,_Attrs}, symbol=Item) ->
- {Item,Category};
-token_info({_Category,_Attrs,Symbol}, symbol=Item) ->
- {Item,Symbol};
-token_info({_Category,Attrs}, Item) ->
- attributes_info(Attrs, Item);
-token_info({_Category,Attrs,_Symbol}, Item) ->
- attributes_info(Attrs, Item).
-
--spec attributes_info(Attributes) -> AttributesInfo when
- Attributes :: attributes(),
- AttributesInfo :: [AttributeInfoTuple :: attribute_info()].
-attributes_info(Attributes) ->
- Items = [column,length,line,text], % undefined order
- attributes_info(Attributes, Items).
-
--spec attributes_info
- (Attributes, AttributeItem) -> AttributeInfoTuple | 'undefined' when
- Attributes :: attributes(),
- AttributeItem :: attribute_item(),
- AttributeInfoTuple :: attribute_info();
- (Attributes, AttributeItems) -> AttributeInfo when
- Attributes :: attributes(),
- AttributeItems :: [AttributeItem :: attribute_item()],
- AttributeInfo :: [AttributeInfoTuple :: attribute_info()].
-attributes_info(_Attrs, []) ->
- [];
-attributes_info(Attrs, [A|As]) when is_atom(A) ->
- case attributes_info(Attrs, A) of
- undefined ->
- attributes_info(Attrs, As);
- AttributeInfo when is_tuple(AttributeInfo) ->
- [AttributeInfo|attributes_info(Attrs, As)]
- end;
-attributes_info({Line,Column}, column=Item) when ?ALINE(Line),
- ?COLUMN(Column) ->
- {Item,Column};
-attributes_info(Line, column) when ?ALINE(Line) ->
- undefined;
-attributes_info(Attrs, column=Item) ->
- case attr_info(Attrs, Item) of
- undefined ->
- case erl_anno:column(Attrs) of
- undefined ->
- undefined;
- Column ->
- {Item,Column}
- end;
- T ->
- T
- end;
-attributes_info(Attrs, length=Item) ->
- case attributes_info(Attrs, text) of
- undefined ->
- undefined;
- {text,Text} ->
- {Item,length(Text)}
- end;
-attributes_info(Line, line=Item) when ?ALINE(Line) ->
- {Item,Line};
-attributes_info({Line,Column}, line=Item) when ?ALINE(Line),
- ?COLUMN(Column) ->
- {Item,Line};
-attributes_info(Attrs, line=Item) ->
- case attr_info(Attrs, Item) of
- undefined ->
- case attr_info(Attrs, location) of
- {location,{Line,_Column}} ->
- {Item,Line};
- {location,Line} ->
- {Item,Line};
- undefined ->
- undefined
- end;
- T ->
- T
- end;
-attributes_info({Line,Column}=Location, location=Item) when ?ALINE(Line),
- ?COLUMN(Column) ->
- {Item,Location};
-attributes_info(Line, location=Item) when ?ALINE(Line) ->
- {Item,Line};
-attributes_info(Attrs, location=Item) ->
- {line,Line} = attributes_info(Attrs, line),
- case attributes_info(Attrs, column) of
- undefined ->
- %% If set_attribute() has assigned a term such as {17,42}
- %% to 'line', then Line will look like {Line,Column}. One
- %% should not use 'location' but 'line' and 'column' in
- %% such special cases.
- {Item,Line};
- {column,Column} ->
- {Item,{Line,Column}}
- end;
-attributes_info({Line,Column}, text) when ?ALINE(Line), ?COLUMN(Column) ->
- undefined;
-attributes_info(Line, text) when ?ALINE(Line) ->
- undefined;
-attributes_info(Attrs, text=Item) ->
- attr_info(Attrs, Item);
-attributes_info(T1, T2) ->
- erlang:error(badarg, [T1,T2]).
-
--spec set_attribute(AttributeItem, Attributes, SetAttributeFun) -> Attributes when
- AttributeItem :: 'line',
- Attributes :: attributes(),
- SetAttributeFun :: fun((info_line()) -> info_line()).
-set_attribute(Tag, Attributes, Fun) when ?SETATTRFUN(Fun) ->
- set_attr(Tag, Attributes, Fun).
-
%%%
%%% Local functions
%%%
@@ -471,62 +304,6 @@ expand_opt(return, Os) ->
expand_opt(O, Os) ->
[O|Os].
-attr_info(Attrs, Item) ->
- try lists:keyfind(Item, 1, Attrs) of
- {_Item, _Value} = T ->
- T;
- false ->
- undefined
- catch
- _:_ ->
- erlang:error(badarg, [Attrs, Item])
- end.
-
--spec set_attr('line', attributes(), fun((line()) -> line())) -> attributes().
-
-set_attr(line, Line, Fun) when ?ALINE(Line) ->
- Ln = Fun(Line),
- if
- ?ALINE(Ln) ->
- Ln;
- true ->
- [{line,Ln}]
- end;
-set_attr(line, {Line,Column}, Fun) when ?ALINE(Line), ?COLUMN(Column) ->
- Ln = Fun(Line),
- if
- ?ALINE(Ln) ->
- {Ln,Column};
- true ->
- [{line,Ln},{column,Column}]
- end;
-set_attr(line=Tag, Attrs, Fun) when is_list(Attrs) ->
- case lists:keyfind(Tag, 1, Attrs) of
- {line,Line} ->
- case lists:keyreplace(Tag, 1, Attrs, {line,Fun(Line)}) of
- [{line,Ln}] when ?ALINE(Ln) ->
- Ln;
- As ->
- As
- end;
- false ->
- {location, Location} = lists:keyfind(location, 1, Attrs),
- Ln = case Location of
- {Line,Column} when ?ALINE(Line), ?COLUMN(Column) ->
- {Fun(Line),Column};
- _ ->
- Fun(Location)
- end,
- case lists:keyreplace(location, 1, Attrs, {location,Ln}) of
- [{location,Ln}] when ?ALINE(Ln) ->
- Ln;
- As ->
- As
- end
- end;
-set_attr(T1, T2, T3) ->
- erlang:error(badarg, [T1,T2,T3]).
-
tokens1(Cs, St, Line, Col, Toks, Fun, Any) when ?STRING(Cs); Cs =:= eof ->
case Fun(Cs, St, Line, Col, Toks, Any) of
{more,{Cs0,Ncol,Ntoks,Nline,Nany,Nfun}} ->
diff --git a/lib/stdlib/src/error_logger_file_h.erl b/lib/stdlib/src/error_logger_file_h.erl
index 48c471924e..fea1656051 100644
--- a/lib/stdlib/src/error_logger_file_h.erl
+++ b/lib/stdlib/src/error_logger_file_h.erl
@@ -94,14 +94,8 @@ handle_call(filename, #st{filename=File}=State) ->
handle_call(_Query, State) ->
{ok, {error, bad_query}, State}.
-terminate(_Reason, State) ->
- case State of
- {Fd, _File, _Prev} ->
- ok = file:close(Fd);
- _ ->
- ok
- end,
- [].
+terminate(_Reason, #st{fd=Fd}) ->
+ file:close(Fd).
code_change(_OldVsn, State, _Extra) ->
{ok, State}.
diff --git a/lib/stdlib/src/escript.erl b/lib/stdlib/src/escript.erl
index 41b49f4a86..b8ce311c35 100644
--- a/lib/stdlib/src/escript.erl
+++ b/lib/stdlib/src/escript.erl
@@ -38,7 +38,7 @@
-record(state, {file :: file:filename(),
module :: module(),
forms_or_bin,
- source :: source(),
+ source :: source() | 'undefined',
n_errors :: non_neg_integer(),
mode :: mode(),
exports_main :: boolean(),
@@ -49,9 +49,9 @@
-type emu_args() :: string().
-record(sections, {type,
- shebang :: shebang(),
- comment :: comment(),
- emu_args :: emu_args(),
+ shebang :: shebang() | 'undefined',
+ comment :: comment() | 'undefined',
+ emu_args :: emu_args() | 'undefined',
body}).
-record(extract_options, {compile_source}).
diff --git a/lib/stdlib/src/otp_internal.erl b/lib/stdlib/src/otp_internal.erl
index 2d77888512..90ef364d1a 100644
--- a/lib/stdlib/src/otp_internal.erl
+++ b/lib/stdlib/src/otp_internal.erl
@@ -586,49 +586,40 @@ obsolete_1(asn1rt, utf8_list_to_binary, 1) ->
%% Added in OTP 18.
obsolete_1(core_lib, get_anno, 1) ->
- {deprecated,{cerl,get_ann,1}};
+ {removed,{cerl,get_ann,1},"19"};
obsolete_1(core_lib, set_anno, 2) ->
- {deprecated,{cerl,set_ann,2}};
+ {removed,{cerl,set_ann,2},"19"};
obsolete_1(core_lib, is_literal, 1) ->
- {deprecated,{cerl,is_literal,1}};
+ {removed,{cerl,is_literal,1},"19"};
obsolete_1(core_lib, is_literal_list, 1) ->
- {deprecated,"deprecated; use lists:all(fun cerl:is_literal/1, L)"
+ {removed,"removed; use lists:all(fun cerl:is_literal/1, L)"
" instead"};
obsolete_1(core_lib, literal_value, 1) ->
- {deprecated,{core_lib,concrete,1}};
+ {removed,{core_lib,concrete,1},"19"};
obsolete_1(erl_scan, set_attribute, 3) ->
- {deprecated,
- "deprecated (will be removed in OTP 19); use erl_anno:set_line/2 instead"};
+ {removed,{erl_anno,set_line,2},"19.0"};
obsolete_1(erl_scan, attributes_info, 1) ->
- {deprecated,
- "deprecated (will be removed in OTP 19); use "
+ {removed,"removed in 19.0; use "
"erl_anno:{column,line,location,text}/1 instead"};
obsolete_1(erl_scan, attributes_info, 2) ->
- {deprecated,
- "deprecated (will be removed in OTP 19); use "
+ {removed,"removed in 19.0; use "
"erl_anno:{column,line,location,text}/1 instead"};
obsolete_1(erl_scan, token_info, 1) ->
- {deprecated,
- "deprecated (will be removed in OTP 19); use "
+ {removed,"removed in 19.0; use "
"erl_scan:{category,column,line,location,symbol,text}/1 instead"};
obsolete_1(erl_scan, token_info, 2) ->
- {deprecated,
- "deprecated (will be removed in OTP 19); use "
+ {removed,"removed in 19.0; use "
"erl_scan:{category,column,line,location,symbol,text}/1 instead"};
obsolete_1(erl_parse, set_line, 2) ->
- {deprecated,
- "deprecated (will be removed in OTP 19); use erl_anno:set_line/2 instead"};
+ {removed,{erl_anno,set_line,2},"19.0"};
obsolete_1(erl_parse, get_attributes, 1) ->
- {deprecated,
- "deprecated (will be removed in OTP 19); use "
+ {removed,"removed in 19.0; use "
"erl_anno:{column,line,location,text}/1 instead"};
obsolete_1(erl_parse, get_attribute, 2) ->
- {deprecated,
- "deprecated (will be removed in OTP 19); use "
+ {removed,"removed in 19.0; use "
"erl_anno:{column,line,location,text}/1 instead"};
obsolete_1(erl_lint, modify_line, 2) ->
- {deprecated,
- "deprecated (will be removed in OTP 19); use erl_parse:map_anno/2 instead"};
+ {removed,{erl_parse,map_anno,2},"19.0"};
obsolete_1(ssl, negotiated_next_protocol, 1) ->
{deprecated,{ssl,negotiated_protocol,1}};
@@ -698,26 +689,24 @@ is_snmp_agent_function(_, _) -> false.
-spec obsolete_type(module(), atom(), arity()) ->
'no' | {tag(), string()} | {tag(), mfas(), release()}.
+-dialyzer({no_match, obsolete_type/3}).
obsolete_type(Module, Name, NumberOfVariables) ->
case obsolete_type_1(Module, Name, NumberOfVariables) of
-%% {deprecated=Tag,{_,_,_}=Replacement} ->
-%% {Tag,Replacement,"in a future release"};
+ {deprecated=Tag,{_,_,_}=Replacement} ->
+ {Tag,Replacement,"in a future release"};
{_,String}=Ret when is_list(String) ->
Ret;
-%% {_,_,_}=Ret ->
-%% Ret;
+ {_,_,_}=Ret ->
+ Ret;
no ->
no
end.
obsolete_type_1(erl_scan,column,0) ->
- {deprecated,
- "deprecated (will be removed in OTP 19); use erl_anno:column() instead"};
+ {removed,{erl_anno,column,0},"19.0"};
obsolete_type_1(erl_scan,line,0) ->
- {deprecated,
- "deprecated (will be removed in OTP 19); use erl_anno:line() instead"};
+ {removed,{erl_anno,line,0},"19.0"};
obsolete_type_1(erl_scan,location,0) ->
- {deprecated,
- "deprecated (will be removed in OTP 19); use erl_anno:location() instead"};
+ {removed,{erl_anno,location,0},"19.0"};
obsolete_type_1(_,_,_) ->
no.
diff --git a/lib/stdlib/src/re.erl b/lib/stdlib/src/re.erl
index e5d9fc51d2..80bfe38970 100644
--- a/lib/stdlib/src/re.erl
+++ b/lib/stdlib/src/re.erl
@@ -132,8 +132,9 @@ split(Subject,RE) ->
split(Subject,RE,Options) ->
try
- {NewOpt,Convert,Unicode,Limit,Strip,Group} =
- process_split_params(Options,iodata,false,-1,false,false),
+ {NewOpt,Convert,Limit,Strip,Group} =
+ process_split_params(Options,iodata,-1,false,false),
+ Unicode = check_for_unicode(RE, Options),
FlatSubject = to_binary(Subject, Unicode),
case compile_split(RE,NewOpt) of
{error,_Err} ->
@@ -324,8 +325,8 @@ replace(Subject,RE,Replacement) ->
replace(Subject,RE,Replacement,Options) ->
try
- {NewOpt,Convert,Unicode} =
- process_repl_params(Options,iodata,false),
+ {NewOpt,Convert} = process_repl_params(Options,iodata),
+ Unicode = check_for_unicode(RE, Options),
FlatSubject = to_binary(Subject, Unicode),
FlatReplacement = to_binary(Replacement, Unicode),
IoList = do_replace(FlatSubject,Subject,RE,FlatReplacement,NewOpt),
@@ -367,65 +368,59 @@ do_replace(FlatSubject,Subject,RE,Replacement,Options) ->
apply_mlist(FlatSubject,Replacement,[Slist])
end.
-process_repl_params([],Convert,Unicode) ->
- {[],Convert,Unicode};
-process_repl_params([unicode|T],C,_U) ->
- {NT,NC,NU} = process_repl_params(T,C,true),
- {[unicode|NT],NC,NU};
-process_repl_params([report_errors|_],_,_) ->
+process_repl_params([],Convert) ->
+ {[],Convert};
+process_repl_params([report_errors|_],_) ->
throw(badopt);
-process_repl_params([{capture,_,_}|_],_,_) ->
+process_repl_params([{capture,_,_}|_],_) ->
throw(badopt);
-process_repl_params([{capture,_}|_],_,_) ->
+process_repl_params([{capture,_}|_],_) ->
throw(badopt);
-process_repl_params([{return,iodata}|T],_C,U) ->
- process_repl_params(T,iodata,U);
-process_repl_params([{return,list}|T],_C,U) ->
- process_repl_params(T,list,U);
-process_repl_params([{return,binary}|T],_C,U) ->
- process_repl_params(T,binary,U);
-process_repl_params([{return,_}|_],_,_) ->
+process_repl_params([{return,iodata}|T],_C) ->
+ process_repl_params(T,iodata);
+process_repl_params([{return,list}|T],_C) ->
+ process_repl_params(T,list);
+process_repl_params([{return,binary}|T],_C) ->
+ process_repl_params(T,binary);
+process_repl_params([{return,_}|_],_) ->
throw(badopt);
-process_repl_params([H|T],C,U) ->
- {NT,NC,NU} = process_repl_params(T,C,U),
- {[H|NT],NC,NU}.
-
-process_split_params([],Convert,Unicode,Limit,Strip,Group) ->
- {[],Convert,Unicode,Limit,Strip,Group};
-process_split_params([unicode|T],C,_U,L,S,G) ->
- {NT,NC,NU,NL,NS,NG} = process_split_params(T,C,true,L,S,G),
- {[unicode|NT],NC,NU,NL,NS,NG};
-process_split_params([trim|T],C,U,_L,_S,G) ->
- process_split_params(T,C,U,-1,true,G);
-process_split_params([{parts,0}|T],C,U,_L,_S,G) ->
- process_split_params(T,C,U,-1,true,G);
-process_split_params([{parts,N}|T],C,U,_L,_S,G) when is_integer(N), N >= 1 ->
- process_split_params(T,C,U,N-1,false,G);
-process_split_params([{parts,infinity}|T],C,U,_L,_S,G) ->
- process_split_params(T,C,U,-1,false,G);
-process_split_params([{parts,_}|_],_,_,_,_,_) ->
+process_repl_params([H|T],C) ->
+ {NT,NC} = process_repl_params(T,C),
+ {[H|NT],NC}.
+
+process_split_params([],Convert,Limit,Strip,Group) ->
+ {[],Convert,Limit,Strip,Group};
+process_split_params([trim|T],C,_L,_S,G) ->
+ process_split_params(T,C,-1,true,G);
+process_split_params([{parts,0}|T],C,_L,_S,G) ->
+ process_split_params(T,C,-1,true,G);
+process_split_params([{parts,N}|T],C,_L,_S,G) when is_integer(N), N >= 1 ->
+ process_split_params(T,C,N-1,false,G);
+process_split_params([{parts,infinity}|T],C,_L,_S,G) ->
+ process_split_params(T,C,-1,false,G);
+process_split_params([{parts,_}|_],_,_,_,_) ->
throw(badopt);
-process_split_params([group|T],C,U,L,S,_G) ->
- process_split_params(T,C,U,L,S,true);
-process_split_params([global|_],_,_,_,_,_) ->
+process_split_params([group|T],C,L,S,_G) ->
+ process_split_params(T,C,L,S,true);
+process_split_params([global|_],_,_,_,_) ->
throw(badopt);
-process_split_params([report_errors|_],_,_,_,_,_) ->
+process_split_params([report_errors|_],_,_,_,_) ->
throw(badopt);
-process_split_params([{capture,_,_}|_],_,_,_,_,_) ->
+process_split_params([{capture,_,_}|_],_,_,_,_) ->
throw(badopt);
-process_split_params([{capture,_}|_],_,_,_,_,_) ->
+process_split_params([{capture,_}|_],_,_,_,_) ->
throw(badopt);
-process_split_params([{return,iodata}|T],_C,U,L,S,G) ->
- process_split_params(T,iodata,U,L,S,G);
-process_split_params([{return,list}|T],_C,U,L,S,G) ->
- process_split_params(T,list,U,L,S,G);
-process_split_params([{return,binary}|T],_C,U,L,S,G) ->
- process_split_params(T,binary,U,L,S,G);
-process_split_params([{return,_}|_],_,_,_,_,_) ->
+process_split_params([{return,iodata}|T],_C,L,S,G) ->
+ process_split_params(T,iodata,L,S,G);
+process_split_params([{return,list}|T],_C,L,S,G) ->
+ process_split_params(T,list,L,S,G);
+process_split_params([{return,binary}|T],_C,L,S,G) ->
+ process_split_params(T,binary,L,S,G);
+process_split_params([{return,_}|_],_,_,_,_) ->
throw(badopt);
-process_split_params([H|T],C,U,L,S,G) ->
- {NT,NC,NU,NL,NS,NG} = process_split_params(T,C,U,L,S,G),
- {[H|NT],NC,NU,NL,NS,NG}.
+process_split_params([H|T],C,L,S,G) ->
+ {NT,NC,NL,NS,NG} = process_split_params(T,C,L,S,G),
+ {[H|NT],NC,NL,NS,NG}.
apply_mlist(Subject,Replacement,Mlist) ->
do_mlist(Subject,Subject,0,precomp_repl(Replacement), Mlist).
diff --git a/lib/stdlib/src/shell.erl b/lib/stdlib/src/shell.erl
index c64123a207..f215a66812 100644
--- a/lib/stdlib/src/shell.erl
+++ b/lib/stdlib/src/shell.erl
@@ -23,7 +23,7 @@
-export([whereis_evaluator/0, whereis_evaluator/1]).
-export([start_restricted/1, stop_restricted/0]).
-export([local_allowed/3, non_local_allowed/3]).
--export([prompt_func/1, strings/1]).
+-export([catch_exception/1, prompt_func/1, strings/1]).
-define(LINEMAX, 30).
-define(CHAR_MAX, 60).
diff --git a/lib/stdlib/src/slave.erl b/lib/stdlib/src/slave.erl
index 24fc8ce204..4e629a5e56 100644
--- a/lib/stdlib/src/slave.erl
+++ b/lib/stdlib/src/slave.erl
@@ -289,10 +289,7 @@ register_unique_name(Number) ->
%% no need to use rsh.
mk_cmd(Host, Name, Args, Waiter, Prog0) ->
- Prog = case os:type() of
- {ose,_} -> mk_ose_prog(Prog0);
- _ -> quote_progname(Prog0)
- end,
+ Prog = quote_progname(Prog0),
BasicCmd = lists:concat([Prog,
" -detached -noinput -master ", node(),
" ", long_or_short(), Name, "@", Host,
@@ -312,24 +309,6 @@ mk_cmd(Host, Name, Args, Waiter, Prog0) ->
end
end.
-%% On OSE we have to pass the beam arguments directory to the slave
-%% process. To find out what arguments that should be passed on we
-%% make an assumption. All arguments after the last "--" should be
-%% skipped. So given these arguments:
-%% -Muycs256 -A 1 -- -root /mst/ -progname beam.debug.smp -- -home /mst/ -- -kernel inetrc '"/mst/inetrc.conf"' -- -name test@localhost
-%% we send
-%% -Muycs256 -A 1 -- -root /mst/ -progname beam.debug.smp -- -home /mst/ -- -kernel inetrc '"/mst/inetrc.conf"' --
-%% to the slave with whatever other args that are added in mk_cmd.
-mk_ose_prog(Prog) ->
- SkipTail = fun("--",[]) ->
- ["--"];
- (_,[]) ->
- [];
- (Arg,Args) ->
- [Arg," "|Args]
- end,
- [Prog,tl(lists:foldr(SkipTail,[],erlang:system_info(emu_args)))].
-
%% This is an attempt to distinguish between spaces in the program
%% path and spaces that separate arguments. The program is quoted to
%% allow spaces in the path.
diff --git a/lib/stdlib/src/stdlib.app.src b/lib/stdlib/src/stdlib.app.src
index 4400956943..7f9bbbf649 100644
--- a/lib/stdlib/src/stdlib.app.src
+++ b/lib/stdlib/src/stdlib.app.src
@@ -105,7 +105,7 @@
dets]},
{applications, [kernel]},
{env, []},
- {runtime_dependencies, ["sasl-2.4","kernel-4.0","erts-7.0","crypto-3.3",
+ {runtime_dependencies, ["sasl-2.6","kernel-4.1","erts-7.0","crypto-3.3",
"compiler-5.0"]}
]}.
diff --git a/lib/stdlib/src/stdlib.appup.src b/lib/stdlib/src/stdlib.appup.src
index 828e1d9aa4..5f61752655 100644
--- a/lib/stdlib/src/stdlib.appup.src
+++ b/lib/stdlib/src/stdlib.appup.src
@@ -18,7 +18,9 @@
%% %CopyrightEnd%
{"%VSN%",
%% Up from - max one major revision back
- [{<<"2\\.[0-4](\\.[0-9]+)*">>,[restart_new_emulator]}], %% 17.0-17.5
+ [{<<"2\\.5(\\.[0-9]+)*">>,[restart_new_emulator]}, %% OTP-18.0.*
+ {<<"2\\.[0-4](\\.[0-9]+)*">>,[restart_new_emulator]}], %% 17.0-17.5
%% Down to - max one major revision back
- [{<<"2\\.[0-4](\\.[0-9]+)*">>,[restart_new_emulator]}] %% 17.0-17.5
+ [{<<"2\\.5(\\.[0-9]+)*">>,[restart_new_emulator]}, %% OTP-18.0.*
+ {<<"2\\.[0-4](\\.[0-9]+)*">>,[restart_new_emulator]}] %% 17.0-17.5
}.
diff --git a/lib/stdlib/src/supervisor.erl b/lib/stdlib/src/supervisor.erl
index 3c77501c0f..23f3aaee1f 100644
--- a/lib/stdlib/src/supervisor.erl
+++ b/lib/stdlib/src/supervisor.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2014. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -107,11 +107,13 @@
-define(SET, sets:set).
-record(state, {name,
- strategy :: strategy(),
+ strategy :: strategy() | 'undefined',
children = [] :: [child_rec()],
- dynamics :: ?DICT(pid(), list()) | ?SET(pid()),
- intensity :: non_neg_integer(),
- period :: pos_integer(),
+ dynamics :: {'dict', ?DICT(pid(), list())}
+ | {'set', ?SET(pid())}
+ | 'undefined',
+ intensity :: non_neg_integer() | 'undefined',
+ period :: pos_integer() | 'undefined',
restarts = [],
module,
args}).
@@ -577,7 +579,7 @@ handle_cast({try_again_restart,Pid}, #state{children=[Child]}=State)
when ?is_simple(State) ->
RT = Child#child.restart_type,
RPid = restarting(Pid),
- case dynamic_child_args(RPid, dynamics_db(RT, State#state.dynamics)) of
+ case dynamic_child_args(RPid, RT, State#state.dynamics) of
{ok, Args} ->
{M, F, _} = Child#child.mfargs,
NChild = Child#child{pid = RPid, mfargs = {M, F, Args}},
@@ -735,7 +737,7 @@ handle_start_child(Child, State) ->
restart_child(Pid, Reason, #state{children = [Child]} = State) when ?is_simple(State) ->
RestartType = Child#child.restart_type,
- case dynamic_child_args(Pid, dynamics_db(RestartType, State#state.dynamics)) of
+ case dynamic_child_args(Pid, RestartType, State#state.dynamics) of
{ok, Args} ->
{M, F, _} = Child#child.mfargs,
NChild = Child#child{pid = Pid, mfargs = {M, F, Args}},
@@ -812,14 +814,16 @@ restart(simple_one_for_one, Child, State) ->
State#state.dynamics)),
case do_start_child_i(M, F, A) of
{ok, Pid} ->
- NState = State#state{dynamics = ?DICTS:store(Pid, A, Dynamics)},
+ DynamicsDb = {dict, ?DICTS:store(Pid, A, Dynamics)},
+ NState = State#state{dynamics = DynamicsDb},
{ok, NState};
{ok, Pid, _Extra} ->
- NState = State#state{dynamics = ?DICTS:store(Pid, A, Dynamics)},
+ DynamicsDb = {dict, ?DICTS:store(Pid, A, Dynamics)},
+ NState = State#state{dynamics = DynamicsDb},
{ok, NState};
{error, Error} ->
- NState = State#state{dynamics = ?DICTS:store(restarting(OldPid), A,
- Dynamics)},
+ DynamicsDb = {dict, ?DICTS:store(restarting(OldPid), A, Dynamics)},
+ NState = State#state{dynamics = DynamicsDb},
report_error(start_error, Error, Child, State#state.name),
{try_again, NState}
end;
@@ -1083,7 +1087,7 @@ wait_dynamic_children(#child{restart_type=RType} = Child, Pids, Sz,
{timeout, TRef, kill} ->
?SETS:fold(fun(P, _) -> exit(P, kill) end, ok, Pids),
- wait_dynamic_children(Child, Pids, Sz-1, undefined, EStack)
+ wait_dynamic_children(Child, Pids, Sz, undefined, EStack)
end.
%%-----------------------------------------------------------------
@@ -1102,31 +1106,32 @@ save_child(Child, #state{children = Children} = State) ->
State#state{children = [Child |Children]}.
save_dynamic_child(temporary, Pid, _, #state{dynamics = Dynamics} = State) ->
- State#state{dynamics = ?SETS:add_element(Pid, dynamics_db(temporary, Dynamics))};
+ DynamicsDb = dynamics_db(temporary, Dynamics),
+ State#state{dynamics = {set, ?SETS:add_element(Pid, DynamicsDb)}};
save_dynamic_child(RestartType, Pid, Args, #state{dynamics = Dynamics} = State) ->
- State#state{dynamics = ?DICTS:store(Pid, Args, dynamics_db(RestartType, Dynamics))}.
+ DynamicsDb = dynamics_db(RestartType, Dynamics),
+ State#state{dynamics = {dict, ?DICTS:store(Pid, Args, DynamicsDb)}}.
dynamics_db(temporary, undefined) ->
?SETS:new();
dynamics_db(_, undefined) ->
?DICTS:new();
-dynamics_db(_,Dynamics) ->
- Dynamics.
-
-dynamic_child_args(Pid, Dynamics) ->
- case ?SETS:is_set(Dynamics) of
- true ->
- {ok, undefined};
- false ->
- ?DICTS:find(Pid, Dynamics)
- end.
+dynamics_db(_, {_Tag, DynamicsDb}) ->
+ DynamicsDb.
+
+dynamic_child_args(_Pid, temporary, _DynamicsDb) ->
+ {ok, undefined};
+dynamic_child_args(Pid, _RT, {dict, DynamicsDb}) ->
+ ?DICTS:find(Pid, DynamicsDb);
+dynamic_child_args(_Pid, _RT, undefined) ->
+ error.
state_del_child(#child{pid = Pid, restart_type = temporary}, State) when ?is_simple(State) ->
NDynamics = ?SETS:del_element(Pid, dynamics_db(temporary, State#state.dynamics)),
- State#state{dynamics = NDynamics};
+ State#state{dynamics = {set, NDynamics}};
state_del_child(#child{pid = Pid, restart_type = RType}, State) when ?is_simple(State) ->
NDynamics = ?DICTS:erase(Pid, dynamics_db(RType, State#state.dynamics)),
- State#state{dynamics = NDynamics};
+ State#state{dynamics = {dict, NDynamics}};
state_del_child(Child, State) ->
NChildren = del_child(Child#child.name, State#state.children),
State#state{children = NChildren}.
@@ -1160,19 +1165,19 @@ split_child(_, [], After) ->
get_child(Name, State) ->
get_child(Name, State, false).
+
get_child(Pid, State, AllowPid) when AllowPid, is_pid(Pid) ->
get_dynamic_child(Pid, State);
get_child(Name, State, _) ->
lists:keysearch(Name, #child.name, State#state.children).
get_dynamic_child(Pid, #state{children=[Child], dynamics=Dynamics}) ->
- DynamicsDb = dynamics_db(Child#child.restart_type, Dynamics),
- case is_dynamic_pid(Pid, DynamicsDb) of
+ case is_dynamic_pid(Pid, Dynamics) of
true ->
{value, Child#child{pid=Pid}};
false ->
RPid = restarting(Pid),
- case is_dynamic_pid(RPid, DynamicsDb) of
+ case is_dynamic_pid(RPid, Dynamics) of
true ->
{value, Child#child{pid=RPid}};
false ->
@@ -1183,13 +1188,12 @@ get_dynamic_child(Pid, #state{children=[Child], dynamics=Dynamics}) ->
end
end.
-is_dynamic_pid(Pid, Dynamics) ->
- case ?SETS:is_set(Dynamics) of
- true ->
- ?SETS:is_element(Pid, Dynamics);
- false ->
- ?DICTS:is_key(Pid, Dynamics)
- end.
+is_dynamic_pid(Pid, {dict, Dynamics}) ->
+ ?DICTS:is_key(Pid, Dynamics);
+is_dynamic_pid(Pid, {set, Dynamics}) ->
+ ?SETS:is_element(Pid, Dynamics);
+is_dynamic_pid(_Pid, undefined) ->
+ false.
replace_child(Child, State) ->
Chs = do_replace_child(Child, State#state.children),
diff --git a/lib/stdlib/test/base64_SUITE.erl b/lib/stdlib/test/base64_SUITE.erl
index cca9b967d5..75eebba6c6 100644
--- a/lib/stdlib/test/base64_SUITE.erl
+++ b/lib/stdlib/test/base64_SUITE.erl
@@ -30,7 +30,8 @@
%% Test cases must be exported.
-export([base64_encode/1, base64_decode/1, base64_otp_5635/1,
base64_otp_6279/1, big/1, illegal/1, mime_decode/1,
- mime_decode_to_string/1, roundtrip/1]).
+ mime_decode_to_string/1,
+ roundtrip_1/1, roundtrip_2/1, roundtrip_3/1, roundtrip_4/1]).
init_per_testcase(_, Config) ->
Dog = test_server:timetrap(?t:minutes(4)),
@@ -50,10 +51,11 @@ suite() -> [{ct_hooks,[ts_install_cth]}].
all() ->
[base64_encode, base64_decode, base64_otp_5635,
base64_otp_6279, big, illegal, mime_decode, mime_decode_to_string,
- roundtrip].
+ {group, roundtrip}].
groups() ->
- [].
+ [{roundtrip, [parallel],
+ [roundtrip_1, roundtrip_2, roundtrip_3, roundtrip_4]}].
init_per_suite(Config) ->
Config.
@@ -242,21 +244,33 @@ mime_decode_to_string(Config) when is_list(Config) ->
%%-------------------------------------------------------------------------
-roundtrip(Config) when is_list(Config) ->
- Sizes = lists:seq(1, 255) ++ lists:seq(2400-5, 2440),
- roundtrip_1(Sizes, []).
+roundtrip_1(Config) when is_list(Config) ->
+ do_roundtrip(1).
-roundtrip_1([NextSize|Sizes], Current) ->
+roundtrip_2(Config) when is_list(Config) ->
+ do_roundtrip(2).
+
+roundtrip_3(Config) when is_list(Config) ->
+ do_roundtrip(3).
+
+roundtrip_4(Config) when is_list(Config) ->
+ do_roundtrip(4).
+
+do_roundtrip(Offset) ->
+ Sizes = lists:seq(Offset, 255, 4) ++ lists:seq(2400-6+Offset, 2440, 4),
+ do_roundtrip_1(Sizes, []).
+
+do_roundtrip_1([NextSize|Sizes], Current) ->
Len = length(Current),
io:format("~p", [Len]),
- do_roundtrip(Current),
+ do_roundtrip_2(Current),
Next = random_byte_list(NextSize - Len, Current),
- roundtrip_1(Sizes, Next);
-roundtrip_1([], Last) ->
+ do_roundtrip_1(Sizes, Next);
+do_roundtrip_1([], Last) ->
io:format("~p", [length(Last)]),
- do_roundtrip(Last).
+ do_roundtrip_2(Last).
-do_roundtrip(List) ->
+do_roundtrip_2(List) ->
Bin = list_to_binary(List),
Base64Bin = base64:encode(List),
Base64Bin = base64:encode(Bin),
diff --git a/lib/stdlib/test/epp_SUITE.erl b/lib/stdlib/test/epp_SUITE.erl
index 4e5df661b3..199d2f193d 100644
--- a/lib/stdlib/test/epp_SUITE.erl
+++ b/lib/stdlib/test/epp_SUITE.erl
@@ -826,14 +826,14 @@ otp_8130(Config) when is_list(Config) ->
"-define(a, 3.14).\n"
"t() -> ?a.\n"),
?line {ok,Epp} = epp:open(File, []),
- ?line ['BASE_MODULE','BASE_MODULE_STRING','BEAM','FILE','LINE',
- 'MACHINE','MODULE','MODULE_STRING'] = macs(Epp),
+ PreDefMacs = macs(Epp),
+ ['BASE_MODULE','BASE_MODULE_STRING','BEAM','FILE','LINE',
+ 'MACHINE','MODULE','MODULE_STRING'] = PreDefMacs,
?line {ok,[{'-',_},{atom,_,file}|_]} = epp:scan_erl_form(Epp),
?line {ok,[{'-',_},{atom,_,module}|_]} = epp:scan_erl_form(Epp),
?line {ok,[{atom,_,t}|_]} = epp:scan_erl_form(Epp),
?line {eof,_} = epp:scan_erl_form(Epp),
- ?line ['BASE_MODULE','BASE_MODULE_STRING','BEAM','FILE','LINE',
- 'MACHINE','MODULE','MODULE_STRING',a] = macs(Epp),
+ [a] = macs(Epp) -- PreDefMacs,
?line epp:close(Epp),
%% escript
@@ -1528,8 +1528,11 @@ compile_test(Config, Test0) ->
warnings(File, Ws) ->
case lists:append([W || {F, W} <- Ws, F =:= File]) of
- [] -> [];
- L -> {warnings, L}
+ [] ->
+ [];
+ L ->
+ call_format_error(L),
+ {warnings, L}
end.
compile_file(File, Opts) ->
@@ -1540,12 +1543,20 @@ compile_file(File, Opts) ->
end.
errs([{File,Es}|L], File) ->
+ call_format_error(Es),
Es ++ errs(L, File);
errs([_|L], File) ->
errs(L, File);
errs([], _File) ->
[].
+%% Smoke test and coverage of format_error/1.
+call_format_error([{_,M,E}|T]) ->
+ _ = M:format_error(E),
+ call_format_error(T);
+call_format_error([]) ->
+ ok.
+
epp_parse_file(File, Opts) ->
case epp:parse_file(File, Opts) of
{ok, Forms} ->
diff --git a/lib/stdlib/test/erl_anno_SUITE.erl b/lib/stdlib/test/erl_anno_SUITE.erl
index 66b02151a0..0369455846 100644
--- a/lib/stdlib/test/erl_anno_SUITE.erl
+++ b/lib/stdlib/test/erl_anno_SUITE.erl
@@ -34,7 +34,7 @@
init_per_testcase/2, end_per_testcase/2]).
-export([new/1, is_anno/1, generated/1, end_location/1, file/1,
- line/1, location/1, record/1, text/1, bad/1, neg_line/1]).
+ line/1, location/1, record/1, text/1, bad/1]).
-export([parse_abstract/1, mapfold_anno/1]).
@@ -43,7 +43,7 @@ all() ->
groups() ->
[{anno, [], [new, is_anno, generated, end_location, file,
- line, location, record, text, bad, neg_line]},
+ line, location, record, text, bad]},
{parse, [], [parse_abstract, mapfold_anno]}].
suite() -> [{ct_hooks,[ts_install_cth]}].
@@ -229,74 +229,6 @@ bad(_Config) ->
(catch erl_anno:record(bad)), % 1st arg not opaque
ok.
-neg_line(doc) ->
- ["Test negative line numbers (OTP 18)"];
-neg_line(_Config) ->
- neg_line1(false),
- neg_line1(true),
- ok.
-
-neg_line1(TextToo) ->
- Minus8_0 = erl_anno:new(-8),
- Plus8_0 = erl_anno:new(8),
- Minus8C_0 = erl_anno:new({-8, 17}),
- Plus8C_0 = erl_anno:new({8, 17}),
-
- [Minus8, Plus8, Minus8C, Plus8C] =
- [case TextToo of
- true ->
- erl_anno:set_text("foo", A);
- false ->
- A
- end || A <- [Minus8_0, Plus8_0, Minus8C_0, Plus8C_0]],
-
- tst(-3, erl_anno:set_location(3, Minus8)),
- tst(-3, erl_anno:set_location(-3, Plus8)),
- tst(-3, erl_anno:set_location(-3, Minus8)),
- tst({-3,9}, erl_anno:set_location({3, 9}, Minus8)),
- tst({-3,9}, erl_anno:set_location({-3, 9}, Plus8)),
- tst({-3,9}, erl_anno:set_location({-3, 9}, Minus8)),
- tst(-3, erl_anno:set_location(3, Minus8C)),
- tst(-3, erl_anno:set_location(-3, Plus8C)),
- tst(-3, erl_anno:set_location(-3, Minus8C)),
- tst({-3,9}, erl_anno:set_location({3, 9}, Minus8C)),
- tst({-3,9}, erl_anno:set_location({-3, 9}, Plus8C)),
- tst({-3,9}, erl_anno:set_location({-3, 9}, Minus8C)),
-
- tst(-8, erl_anno:set_generated(true, Plus8)),
- tst(-8, erl_anno:set_generated(true, Minus8)),
- tst({-8,17}, erl_anno:set_generated(true, Plus8C)),
- tst({-8,17}, erl_anno:set_generated(true, Minus8C)),
- tst(8, erl_anno:set_generated(false, Plus8)),
- tst(8, erl_anno:set_generated(false, Minus8)),
- tst({8,17}, erl_anno:set_generated(false, Plus8C)),
- tst({8,17}, erl_anno:set_generated(false, Minus8C)),
-
- tst(-3, erl_anno:set_line(3, Minus8)),
- tst(-3, erl_anno:set_line(-3, Plus8)),
- tst(-3, erl_anno:set_line(-3, Minus8)),
- tst({-3,17}, erl_anno:set_line(3, Minus8C)),
- tst({-3,17}, erl_anno:set_line(-3, Plus8C)),
- tst({-3,17}, erl_anno:set_line(-3, Minus8C)),
- ok.
-
-tst(Term, Anno) ->
- ?format("Term: ~p\n", [Term]),
- ?format("Anno: ~p\n", [Anno]),
- case anno_to_term(Anno) of
- Term ->
- ok;
- Else ->
- case lists:keyfind(location, 1, Else) of
- {location, Term} ->
- ok;
- _Else2 ->
- ?format("Else2 ~p\n", [_Else2]),
- io:format("expected ~p\n got ~p\n", [Term, Else]),
- exit({Term, Else})
- end
- end.
-
parse_abstract(doc) ->
["Test erl_parse:new_anno/1, erl_parse:anno_to_term/1"
", and erl_parse:anno_from_term/1"];
diff --git a/lib/stdlib/test/erl_lint_SUITE.erl b/lib/stdlib/test/erl_lint_SUITE.erl
index 0424e2b967..6c07dc1ec6 100644
--- a/lib/stdlib/test/erl_lint_SUITE.erl
+++ b/lib/stdlib/test/erl_lint_SUITE.erl
@@ -65,7 +65,7 @@
too_many_arguments/1,
basic_errors/1,bin_syntax_errors/1,
predef/1,
- maps/1,maps_type/1,otp_11851/1,otp_12195/1
+ maps/1,maps_type/1,otp_11851/1
]).
% Default timetrap timeout (set in init_per_testcase).
@@ -94,7 +94,7 @@ all() ->
bif_clash, behaviour_basic, behaviour_multiple, otp_11861,
otp_7550, otp_8051, format_warn, {group, on_load},
too_many_arguments, basic_errors, bin_syntax_errors, predef,
- maps, maps_type, otp_11851, otp_12195].
+ maps, maps_type, otp_11851].
groups() ->
[{unused_vars_warn, [],
@@ -3835,40 +3835,6 @@ otp_11851(Config) when is_list(Config) ->
[] = run(Config, Ts),
ok.
-otp_12195(doc) ->
- "OTP-12195: Check obsolete types (tailor made for OTP 18).";
-otp_12195(Config) when is_list(Config) ->
- Ts = [{otp_12195_1,
- <<"-export_type([r1/0]).
- -type r1() :: erl_scan:line()
- | erl_scan:column()
- | erl_scan:location()
- | erl_anno:line().">>,
- [],
- {warnings,[{2,erl_lint,
- {deprecated_type,{erl_scan,line,0},
- "deprecated (will be removed in OTP 19); "
- "use erl_anno:line() instead"}},
- {3,erl_lint,
- {deprecated_type,{erl_scan,column,0},
- "deprecated (will be removed in OTP 19); use "
- "erl_anno:column() instead"}},
- {4,erl_lint,
- {deprecated_type,{erl_scan,location,0},
- "deprecated (will be removed in OTP 19); "
- "use erl_anno:location() instead"}}]}},
- {otp_12195_2,
- <<"-export_type([r1/0]).
- -compile(nowarn_deprecated_type).
- -type r1() :: erl_scan:line()
- | erl_scan:column()
- | erl_scan:location()
- | erl_anno:line().">>,
- [],
- []}],
- [] = run(Config, Ts),
- ok.
-
run(Config, Tests) ->
F = fun({N,P,Ws,E}, BadL) ->
case catch run_test(Config, P, Ws) of
diff --git a/lib/stdlib/test/erl_pp_SUITE.erl b/lib/stdlib/test/erl_pp_SUITE.erl
index 389fd059f6..9bb193d865 100644
--- a/lib/stdlib/test/erl_pp_SUITE.erl
+++ b/lib/stdlib/test/erl_pp_SUITE.erl
@@ -928,7 +928,9 @@ otp_8522(Config) when is_list(Config) ->
?line {ok, _} = compile:file(FileName, [{outdir,?privdir},debug_info]),
BF = filename("otp_8522", Config),
?line {ok, A} = beam_lib:chunks(BF, [abstract_code]),
- ?line 5 = count_atom(A, undefined),
+ %% OTP-12719: Since 'undefined' is no longer added by the Erlang
+ %% Parser, the number of 'undefined' is 4. It used to be 5.
+ ?line 4 = count_atom(A, undefined),
ok.
count_atom(A, A) ->
@@ -1062,7 +1064,7 @@ otp_9147(Config) when is_list(Config) ->
?line {ok, Bin} = file:read_file(PFileName),
%% The parentheses around "F1 :: a | b" are new (bugfix).
?line true =
- lists:member("-record(undef,{f1 :: undefined | (F1 :: a | b)}).",
+ lists:member("-record(undef,{f1 :: F1 :: a | b}).",
string:tokens(binary_to_list(Bin), "\n")),
ok.
diff --git a/lib/stdlib/test/erl_scan_SUITE.erl b/lib/stdlib/test/erl_scan_SUITE.erl
index 12ea3d128c..db669aae99 100644
--- a/lib/stdlib/test/erl_scan_SUITE.erl
+++ b/lib/stdlib/test/erl_scan_SUITE.erl
@@ -191,8 +191,7 @@ otp_7810(Config) when is_list(Config) ->
?line ok = more_chars(),
?line ok = more_options(),
- ?line ok = attributes_info(),
- ?line ok = set_attribute(),
+ ?line ok = anno_info(),
ok.
@@ -269,7 +268,7 @@ punctuations() ->
comments() ->
?line test("a %%\n b"),
- {ok,[],1} = erl_scan_string("%"),
+ ?line {ok,[],1} = erl_scan_string("%"),
?line test("a %%\n b"),
{ok,[{atom,{1,1},a},{atom,{2,2},b}],{2,3}} =
erl_scan_string("a %%\n b", {1,1}),
@@ -338,7 +337,7 @@ base_integers() ->
erl_scan:string(Str)
end || {BS,S} <- [{"3","3"},{"15","f"}, {"12","c"}] ],
- {ok,[{integer,1,239},{'@',1}],1} = erl_scan_string("16#ef@"),
+ ?line {ok,[{integer,1,239},{'@',1}],1} = erl_scan_string("16#ef@"),
{ok,[{integer,{1,1},239},{'@',{1,6}}],{1,7}} =
erl_scan_string("16#ef@", {1,1}, []),
{ok,[{integer,{1,1},14},{atom,{1,5},g@}],{1,7}} =
@@ -387,20 +386,15 @@ dots() ->
R2 = erl_scan_string(S, {1,1}, [])
end || {S, R, R2} <- Dot],
- ?line {ok,[{dot,_}=T1],{1,2}} = erl_scan:string(".", {1,1}, text),
- ?line [{column,1},{length,1},{line,1},{text,"."}] =
- erl_scan:token_info(T1, [column, length, line, text]),
- ?line {ok,[{dot,_}=T2],{1,3}} = erl_scan:string(".%", {1,1}, text),
- ?line [{column,1},{length,1},{line,1},{text,"."}] =
- erl_scan:token_info(T2, [column, length, line, text]),
- ?line {ok,[{dot,_}=T3],{1,6}} =
+ {ok,[{dot,_}=T1],{1,2}} = erl_scan:string(".", {1,1}, text),
+ [1, 1, "."] = token_info(T1),
+ {ok,[{dot,_}=T2],{1,3}} = erl_scan:string(".%", {1,1}, text),
+ [1, 1, "."] = token_info(T2),
+ {ok,[{dot,_}=T3],{1,6}} =
erl_scan:string(".% öh", {1,1}, text),
- ?line [{column,1},{length,1},{line,1},{text,"."}] =
- erl_scan:token_info(T3, [column, length, line, text]),
- ?line {error,{{1,2},erl_scan,char},{1,3}} =
- erl_scan:string(".$", {1,1}),
- ?line {error,{{1,2},erl_scan,char},{1,4}} =
- erl_scan:string(".$\\", {1,1}),
+ [1, 1, "."] = token_info(T3),
+ {error,{{1,2},erl_scan,char},{1,3}} = erl_scan:string(".$", {1,1}),
+ {error,{{1,2},erl_scan,char},{1,4}} = erl_scan:string(".$\\", {1,1}),
test_string(". ", [{dot,{1,1}}]),
test_string(". ", [{dot,{1,1}}]),
@@ -413,18 +407,18 @@ dots() ->
test_string(".a", [{'.',{1,1}},{atom,{1,2},a}]),
test_string("%. \n. ", [{dot,{2,1}}]),
- ?line {more,C} = erl_scan:tokens([], "%. ",{1,1}, return),
+ {more,C} = erl_scan:tokens([], "%. ",{1,1}, return),
{done,{ok,[{comment,{1,1},"%. "},
{white_space,{1,4},"\n"},
{dot,{2,1}}],
{2,3}}, ""} =
erl_scan_tokens(C, "\n. ", {1,1}, return), % any loc, any options
- ?line [test_string(S, R) ||
- {S, R} <- [{".$\n", [{'.',{1,1}},{char,{1,2},$\n}]},
- {"$\\\n", [{char,{1,1},$\n}]},
- {"'\\\n'", [{atom,{1,1},'\n'}]},
- {"$\n", [{char,{1,1},$\n}]}] ],
+ [test_string(S, R) ||
+ {S, R} <- [{".$\n", [{'.',{1,1}},{char,{1,2},$\n}]},
+ {"$\\\n", [{char,{1,1},$\n}]},
+ {"'\\\n'", [{atom,{1,1},'\n'}]},
+ {"$\n", [{char,{1,1},$\n}]}] ],
ok.
chars() ->
@@ -540,8 +534,8 @@ eof() ->
%% A dot followed by eof is special:
?line {more, C} = erl_scan:tokens([], "a.", 1),
- {done,{ok,[{atom,1,a},{dot,1}],1},eof} = erl_scan_tokens(C,eof,1),
- {ok,[{atom,1,foo},{dot,1}],1} = erl_scan_string("foo."),
+ ?line {done,{ok,[{atom,1,a},{dot,1}],1},eof} = erl_scan_tokens(C,eof,1),
+ ?line {ok,[{atom,1,foo},{dot,1}],1} = erl_scan_string("foo."),
%% With column.
{more, CCol} = erl_scan:tokens([], "a.", {1,1}),
@@ -655,145 +649,72 @@ options() ->
ok.
more_options() ->
- ?line {ok,[{atom,A1,foo}],{19,20}} =
+ {ok,[{atom,_,foo}=T1],{19,20}} =
erl_scan:string("foo", {19,17},[]),
- ?line [{column,17},{line,19}] = erl_scan:attributes_info(A1),
- ?line {done,{ok,[{atom,A2,foo},{dot,_}],{19,22}},[]} =
+ {19,17} = erl_scan:location(T1),
+ {done,{ok,[{atom,_,foo}=T2,{dot,_}],{19,22}},[]} =
erl_scan:tokens([], "foo. ", {19,17}, [bad_opt]), % type error
- ?line [{column,17},{line,19}] = erl_scan:attributes_info(A2),
- ?line {ok,[{atom,A3,foo}],{19,20}} =
+ {19,17} = erl_scan:location(T2),
+ {ok,[{atom,_,foo}=T3],{19,20}} =
erl_scan:string("foo", {19,17},[text]),
- ?line [{column,17},{length,3},{line,19},{text,"foo"}] =
- erl_scan:attributes_info(A3),
+ {19,17} = erl_scan:location(T3),
+ "foo" = erl_scan:text(T3),
- ?line {ok,[{atom,A4,foo}],1} = erl_scan:string("foo", 1, [text]),
- ?line [{length,3},{line,1},{text,"foo"}] = erl_scan:attributes_info(A4),
+ {ok,[{atom,_,foo}=T4],1} = erl_scan:string("foo", 1, [text]),
+ 1 = erl_scan:line(T4),
+ 1 = erl_scan:location(T4),
+ "foo" = erl_scan:text(T4),
ok.
token_info() ->
- ?line {ok,[T1],_} = erl_scan:string("foo", {1,18}, [text]),
+ {ok,[T1],_} = erl_scan:string("foo", {1,18}, [text]),
{'EXIT',{badarg,_}} =
- (catch {foo, erl_scan:token_info(T1, foo)}), % type error
- ?line {line,1} = erl_scan:token_info(T1, line),
- ?line {column,18} = erl_scan:token_info(T1, column),
- ?line {length,3} = erl_scan:token_info(T1, length),
- ?line {text,"foo"} = erl_scan:token_info(T1, text),
- ?line [{category,atom},{column,18},{length,3},{line,1},
- {symbol,foo},{text,"foo"}] =
- erl_scan:token_info(T1),
- ?line [{length,3},{column,18}] =
- erl_scan:token_info(T1, [length, column]),
- ?line [{location,{1,18}}] =
- erl_scan:token_info(T1, [location]),
- ?line {category,atom} = erl_scan:token_info(T1, category),
- ?line [{symbol,foo}] = erl_scan:token_info(T1, [symbol]),
-
- ?line {ok,[T2],_} = erl_scan:string("foo", 1, []),
- ?line {line,1} = erl_scan:token_info(T2, line),
- ?line undefined = erl_scan:token_info(T2, column),
- ?line undefined = erl_scan:token_info(T2, length),
- ?line undefined = erl_scan:token_info(T2, text),
- ?line {location,1} = erl_scan:token_info(T2, location),
- ?line [{category,atom},{line,1},{symbol,foo}] = erl_scan:token_info(T2),
- ?line [{line,1}] = erl_scan:token_info(T2, [length, line]),
-
- ?line {ok,[T3],_} = erl_scan:string("=", 1, []),
- ?line [{line,1}] = erl_scan:token_info(T3, [column, line]),
- ?line {category,'='} = erl_scan:token_info(T3, category),
- ?line [{symbol,'='}] = erl_scan:token_info(T3, [symbol]),
+ (catch {foo, erl_scan:category(foo)}), % type error
+ {'EXIT',{badarg,_}} =
+ (catch {foo, erl_scan:symbol(foo)}), % type error
+ atom = erl_scan:category(T1),
+ foo = erl_scan:symbol(T1),
+
+ {ok,[T2],_} = erl_scan:string("foo", 1, []),
+ 1 = erl_scan:line(T2),
+ undefined = erl_scan:column(T2),
+ undefined = erl_scan:text(T2),
+ 1 = erl_scan:location(T2),
+
+ {ok,[T3],_} = erl_scan:string("=", 1, []),
+ '=' = erl_scan:category(T3),
+ '=' = erl_scan:symbol(T3),
ok.
-attributes_info() ->
- ?line {'EXIT',_} =
- (catch {foo,erl_scan:attributes_info(foo)}), % type error
- [{line,18}] = erl_scan:attributes_info(erl_anno:new(18)),
- {location,19} =
- erl_scan:attributes_info(erl_anno:new(19), location),
- ?line {ok,[{atom,A0,foo}],_} = erl_scan:string("foo", 19, [text]),
- ?line {location,19} = erl_scan:attributes_info(A0, location),
-
- ?line {ok,[{atom,A3,foo}],_} = erl_scan:string("foo", {1,3}, [text]),
- ?line {line,1} = erl_scan:attributes_info(A3, line),
- ?line {column,3} = erl_scan:attributes_info(A3, column),
- ?line {location,{1,3}} = erl_scan:attributes_info(A3, location),
- ?line {text,"foo"} = erl_scan:attributes_info(A3, text),
-
- ?line {ok,[{atom,A4,foo}],_} = erl_scan:string("foo", 2, [text]),
- ?line {line,2} = erl_scan:attributes_info(A4, line),
- ?line undefined = erl_scan:attributes_info(A4, column),
- ?line {location,2} = erl_scan:attributes_info(A4, location),
- ?line {text,"foo"} = erl_scan:attributes_info(A4, text),
-
- ?line {ok,[{atom,A5,foo}],_} = erl_scan:string("foo", {1,3}, []),
- ?line {line,1} = erl_scan:attributes_info(A5, line),
- ?line {column,3} = erl_scan:attributes_info(A5, column),
- ?line {location,{1,3}} = erl_scan:attributes_info(A5, location),
- ?line undefined = erl_scan:attributes_info(A5, text),
-
- ?line undefined = erl_scan:attributes_info([], line), % type error
+anno_info() ->
+ {'EXIT',_} =
+ (catch {foo,erl_scan:line(foo)}), % type error
+ {ok,[{atom,_,foo}=T0],_} = erl_scan:string("foo", 19, [text]),
+ 19 = erl_scan:location(T0),
+ 19 = erl_scan:end_location(T0),
+
+ {ok,[{atom,_,foo}=T3],_} = erl_scan:string("foo", {1,3}, [text]),
+ 1 = erl_scan:line(T3),
+ 3 = erl_scan:column(T3),
+ {1,3} = erl_scan:location(T3),
+ {1,6} = erl_scan:end_location(T3),
+ "foo" = erl_scan:text(T3),
+
+ {ok,[{atom,_,foo}=T4],_} = erl_scan:string("foo", 2, [text]),
+ 2 = erl_scan:line(T4),
+ undefined = erl_scan:column(T4),
+ 2 = erl_scan:location(T4),
+ "foo" = erl_scan:text(T4),
+
+ {ok,[{atom,_,foo}=T5],_} = erl_scan:string("foo", {1,3}, []),
+ 1 = erl_scan:line(T5),
+ 3 = erl_scan:column(T5),
+ {1,3} = erl_scan:location(T5),
+ undefined = erl_scan:text(T5),
ok.
-set_attribute() ->
- F = fun(Line) -> -Line end,
- Anno2 = erl_anno:new(2),
- A0 = erl_scan:set_attribute(line, Anno2, F),
- {line, -2} = erl_scan:attributes_info(A0, line),
- ?line {ok,[{atom,A1,foo}],_} = erl_scan:string("foo", {9,17}),
- ?line A2 = erl_scan:set_attribute(line, A1, F),
- ?line {line,-9} = erl_scan:attributes_info(A2, line),
- ?line {location,{-9,17}} = erl_scan:attributes_info(A2, location),
- ?line [{line,-9},{column,17}] =
- erl_scan:attributes_info(A2, [line,column,text]),
-
- F2 = fun(Line) -> {17,Line} end,
- ?line Attr1 = erl_scan:set_attribute(line, 2, F2),
- ?line {line,{17,2}} = erl_scan:attributes_info(Attr1, line),
- ?line undefined = erl_scan:attributes_info(Attr1, column),
- ?line {location,{17,2}} = % a bit mixed up
- erl_scan:attributes_info(Attr1, location),
-
- ?line A3 = erl_scan:set_attribute(line, A1, F2),
- ?line {line,{17,9}} = erl_scan:attributes_info(A3, line),
- ?line {location,{{17,9},17}} = erl_scan:attributes_info(A3, location),
- ?line [{line,{17,9}},{column,17}] =
- erl_scan:attributes_info(A3, [line,column,text]),
-
- ?line {ok,[{atom,A4,foo}],_} = erl_scan:string("foo", {9,17}, [text]),
- ?line A5 = erl_scan:set_attribute(line, A4, F),
- ?line {line,-9} = erl_scan:attributes_info(A5, line),
- ?line {location,{-9,17}} = erl_scan:attributes_info(A5, location),
- ?line [{line,-9},{column,17},{text,"foo"}] =
- erl_scan:attributes_info(A5, [line,column,text]),
-
- ?line {ok,[{atom,A6,foo}],_} = erl_scan:string("foo", 11, [text]),
- ?line A7 = erl_scan:set_attribute(line, A6, F2),
- %% Incompatible with pre 18:
- %% {line,{17,11}} = erl_scan:attributes_info(A7, line),
- {line,17} = erl_scan:attributes_info(A7, line),
- ?line {location,{17,11}} = % mixed up
- erl_scan:attributes_info(A7, location),
- %% Incompatible with pre 18:
- %% [{line,{17,11}},{text,"foo"}] =
- %% erl_scan:attributes_info(A7, [line,column,text]),
- [{line,17},{column,11},{text,"foo"}] =
- erl_scan:attributes_info(A7, [line,column,text]),
-
- ?line {'EXIT',_} =
- (catch {foo, erl_scan:set_attribute(line, [], F2)}), % type error
- ?line {'EXIT',{badarg,_}} =
- (catch {foo, erl_scan:set_attribute(column, [], F2)}), % type error
-
- Attr10 = erl_anno:new(8),
- Attr20 = erl_scan:set_attribute(line, Attr10,
- fun(L) -> {nos,'X',L} end),
- %% OTP-9412
- Attr30 = erl_scan:set_attribute(line, Attr20,
- fun({nos,_V,VL}) -> VL end),
- 8 = erl_anno:to_term(Attr30),
- ok.
-
column_errors() ->
?line {error,{{1,1},erl_scan,{string,$',""}},{1,3}} = % $'
erl_scan:string("'\\",{1,1}),
@@ -892,14 +813,13 @@ unicode() ->
erl_scan_string(Qs, 1),
{ok,[Q2],{1,9}} =
erl_scan:string("$\\x{aaa}", {1,1}, [text]),
- [{category,char},{column,1},{length,8},
- {line,1},{symbol,16#aaa},{text,Qs}] =
- erl_scan:token_info(Q2),
+ [{category,char},{column,1},{line,1},{symbol,16#aaa},{text,Qs}] =
+ token_info_long(Q2),
U1 = "\"\\x{aaa}\"",
- {ok,[{string,A1,[2730]}],{1,10}} = erl_scan:string(U1, {1,1}, [text]),
- [{line,1},{column,1},{text,"\"\\x{aaa}\""}] =
- erl_scan:attributes_info(A1, [line, column, text]),
+ {ok,[{string,_,[2730]}=T1],{1,10}} = erl_scan:string(U1, {1,1}, [text]),
+ {1,1} = erl_scan:location(T1),
+ "\"\\x{aaa}\"" = erl_scan:text(T1),
{ok,[{string,1,[2730]}],1} = erl_scan_string(U1, 1),
U2 = "\"\\x41\\x{fff}\\x42\"",
@@ -1012,16 +932,13 @@ otp_10302(Config) when is_list(Config) ->
Qs = "$\\x{aaa}",
{ok,[{char,1,2730}],1} = erl_scan_string(Qs, 1),
{ok,[Q2],{1,9}} = erl_scan:string(Qs,{1,1},[text]),
- [{category,char},{column,1},{length,8},
- {line,1},{symbol,16#aaa},{text,Qs}] =
- erl_scan:token_info(Q2),
-
- Tags = [category, column, length, line, symbol, text],
+ [{category,char},{column,1},{line,1},{symbol,16#aaa},{text,Qs}] =
+ token_info_long(Q2),
U1 = "\"\\x{aaa}\"",
{ok,[T1],{1,10}} = erl_scan:string(U1, {1,1}, [text]),
- [{category,string},{column,1},{length,9},{line,1},
- {symbol,[16#aaa]},{text,U1}] = erl_scan:token_info(T1, Tags),
+ [{category,string},{column,1},{line,1},{symbol,[16#aaa]},{text,U1}] =
+ token_info_long(T1),
U2 = "\"\\x41\\x{fff}\\x42\"",
{ok,[{string,1,[65,4095,66]}],1} = erl_scan_string(U2, 1),
@@ -1353,9 +1270,7 @@ test_wsc([], []) ->
ok;
test_wsc([Token|Tokens], [Token2|Tokens2]) ->
[Text, Text2] = [Text ||
- {text, Text} <-
- [erl_scan:token_info(T, text) ||
- T <- [Token, Token2]]],
+ Text <- [erl_scan:text(T) || T <- [Token, Token2]]],
Sz = erts_debug:size(Text),
Sz2 = erts_debug:size({Text, Text2}),
IsCompacted = Sz2 < 2*Sz+erts_debug:size({a,a}),
@@ -1394,7 +1309,7 @@ all_same(L, Char) ->
newlines_first([]) ->
ok;
newlines_first([Token|Tokens]) ->
- {text,Text} = erl_scan:token_info(Token, text),
+ Text = erl_scan:text(Token),
Nnls = length([C || C <- Text, C =:= $\n]),
OK = case Text of
[$\n|_] ->
@@ -1414,7 +1329,7 @@ select_tokens(Tokens, Tags) ->
lists:filter(fun(T) -> lists:member(element(1, T), Tags) end, Tokens).
simplify([Token|Tokens]) ->
- {line,Line} = erl_scan:token_info(Token, line),
+ Line = erl_scan:line(Token),
[setelement(2, Token, erl_anno:new(Line)) | simplify(Tokens)];
simplify([]) ->
[].
@@ -1423,17 +1338,31 @@ get_text(Tokens) ->
lists:flatten(
[T ||
Token <- Tokens,
- ({text,T} = erl_scan:token_info(Token, text)) =/= []]).
+ (T = erl_scan:text(Token)) =/= []]).
test_decorated_tokens(String, Tokens) ->
ToksAttrs = token_attrs(Tokens),
test_strings(ToksAttrs, String, 1, 1).
token_attrs(Tokens) ->
- [{L,C,Len,T} ||
+ [{L,C,length(T),T} ||
Token <- Tokens,
- ([{line,L},{column,C},{length,Len},{text,T}] =
- erl_scan:token_info(Token, [line,column,length,text])) =/= []].
+ ([C,L,T] = token_info(Token)) =/= []].
+
+token_info(T) ->
+ Column = erl_scan:column(T),
+ Line = erl_scan:line(T),
+ Text = erl_scan:text(T),
+ [Column, Line, Text].
+
+token_info_long(T) ->
+ Column = erl_scan:column(T),
+ Line = erl_scan:line(T),
+ Text = erl_scan:text(T),
+ Category = erl_scan:category(T),
+ Symbol = erl_scan:symbol(T),
+ [{category,Category},{column,Column},{line,Line},
+ {symbol,Symbol},{text,Text}].
test_strings([], _S, Line, Column) ->
{Line,Column};
@@ -1514,8 +1443,7 @@ consistent_attributes([Ts | TsL]) ->
L = [T || T <- Ts, is_integer(element(2, T))],
case L of
[] ->
- TagsL = [[Tag || {Tag,_} <-
- erl_scan:attributes_info(element(2, T))] ||
+ TagsL = [[Tag || {Tag,_} <- defined(token_info_long(T))] ||
T <- Ts],
case lists:usort(TagsL) of
[_] ->
@@ -1531,6 +1459,9 @@ consistent_attributes([Ts | TsL]) ->
Ts
end.
+defined(L) ->
+ [{T,V} || {T,V} <- L, V =/= undefined].
+
family_list(L) ->
sofs:to_external(family(L)).
diff --git a/lib/stdlib/test/error_logger_h_SUITE.erl b/lib/stdlib/test/error_logger_h_SUITE.erl
index b0b9c717a1..c82b1b62ef 100644
--- a/lib/stdlib/test/error_logger_h_SUITE.erl
+++ b/lib/stdlib/test/error_logger_h_SUITE.erl
@@ -65,6 +65,12 @@ logfile(Config) ->
error_logger:logfile(close),
analyse_events(Log, Ev, [AtNode], unlimited),
+ [] = [{X, file:pid2name(X)} || X <- processes(), Data <- [process_info(X, [current_function])],
+ Data =/= undefined,
+ element(1, element(2, lists:keyfind(current_function, 1, Data)))
+ =:= file_io_server,
+ file:pid2name(X) =:= {ok, Log}],
+
test_server:stop_node(Node),
cleanup(Log),
diff --git a/lib/stdlib/test/ets_SUITE.erl b/lib/stdlib/test/ets_SUITE.erl
index ae431d66d9..1b80f555d7 100644
--- a/lib/stdlib/test/ets_SUITE.erl
+++ b/lib/stdlib/test/ets_SUITE.erl
@@ -731,10 +731,6 @@ chk_normal_tab_struct_size() ->
% ?line ok
% end.
--define(DB_TREE_STACK_NEED,50). % The static stack for a tree, in halfword pointers are two internal words
- % so the stack gets twice as big
--define(DB_HASH_SIZEOF_EXTSEG,260). % The segment size in words, in halfword this will be twice as large.
-
adjust_xmem([T1,T2,T3,T4], {A0,B0,C0,D0} = _Mem0) ->
%% Adjust for 64-bit, smp, and os:
%% Table struct size may differ.
@@ -748,19 +744,7 @@ adjust_xmem([T1,T2,T3,T4], {A0,B0,C0,D0} = _Mem0) ->
% end,
TabDiff = ?TAB_STRUCT_SZ,
- Mem1 = {A0+TabDiff, B0+TabDiff, C0+TabDiff, D0+TabDiff},
-
- case {erlang:system_info({wordsize,internal}),erlang:system_info({wordsize,external})} of
- %% Halfword, corrections for regular pointers occupying two internal words.
- {4,8} ->
- {A1,B1,C1,D1} = Mem1,
- {A1+4*ets:info(T1, size)+?DB_TREE_STACK_NEED,
- B1+3*ets:info(T2, size)+?DB_HASH_SIZEOF_EXTSEG,
- C1+3*ets:info(T3, size)+?DB_HASH_SIZEOF_EXTSEG,
- D1+3*ets:info(T4, size)+?DB_HASH_SIZEOF_EXTSEG};
- _ ->
- Mem1
- end.
+ {A0+TabDiff, B0+TabDiff, C0+TabDiff, D0+TabDiff}.
t_whitebox(doc) ->
["Diverse whitebox testes"];
diff --git a/lib/stdlib/test/filename_SUITE.erl b/lib/stdlib/test/filename_SUITE.erl
index fd47da8150..4372e77df9 100644
--- a/lib/stdlib/test/filename_SUITE.erl
+++ b/lib/stdlib/test/filename_SUITE.erl
@@ -97,20 +97,11 @@ absname(Config) when is_list(Config) ->
?line file:set_cwd(Cwd),
ok;
- Type ->
- case Type of
- {unix, _} ->
- ?line ok = file:set_cwd("/usr"),
- ?line "/usr/foo" = filename:absname(foo),
- ?line "/usr/foo" = filename:absname("foo"),
- ?line "/usr/../ebin" = filename:absname("../ebin");
- {ose, _} ->
- ?line ok = file:set_cwd("/romfs"),
- ?line "/romfs/foo" = filename:absname(foo),
- ?line "/romfs/foo" = filename:absname("foo"),
- ?line "/romfs/../ebin" = filename:absname("../ebin")
- end,
-
+ {unix, _} ->
+ ?line ok = file:set_cwd("/usr"),
+ ?line "/usr/foo" = filename:absname(foo),
+ ?line "/usr/foo" = filename:absname("foo"),
+ ?line "/usr/../ebin" = filename:absname("../ebin"),
?line file:set_cwd("/"),
?line "/foo" = filename:absname(foo),
?line "/foo" = filename:absname("foo"),
@@ -494,18 +485,10 @@ absname_bin(Config) when is_list(Config) ->
?line file:set_cwd(Cwd),
ok;
- Type ->
- case Type of
- {unix,_} ->
- ?line ok = file:set_cwd(<<"/usr">>),
- ?line <<"/usr/foo">> = filename:absname(<<"foo">>),
- ?line <<"/usr/../ebin">> = filename:absname(<<"../ebin">>);
- {ose,_} ->
- ?line ok = file:set_cwd(<<"/romfs">>),
- ?line <<"/romfs/foo">> = filename:absname(<<"foo">>),
- ?line <<"/romfs/../ebin">> = filename:absname(<<"../ebin">>)
- end,
-
+ {unix, _} ->
+ ?line ok = file:set_cwd(<<"/usr">>),
+ ?line <<"/usr/foo">> = filename:absname(<<"foo">>),
+ ?line <<"/usr/../ebin">> = filename:absname(<<"../ebin">>),
?line file:set_cwd(<<"/">>),
?line <<"/foo">> = filename:absname(<<"foo">>),
?line <<"/../ebin">> = filename:absname(<<"../ebin">>),
diff --git a/lib/stdlib/test/gen_event_SUITE.erl b/lib/stdlib/test/gen_event_SUITE.erl
index 7a6fcba4e5..b019f98b69 100644
--- a/lib/stdlib/test/gen_event_SUITE.erl
+++ b/lib/stdlib/test/gen_event_SUITE.erl
@@ -412,7 +412,6 @@ notify(Config) when is_list(Config) ->
ok
end,
?line ok = gen_event:notify(my_dummy_handler, {swap_event,dummy1_h,swap}),
- ?t:sleep(1000),
?line [dummy1_h] = gen_event:which_handlers(my_dummy_handler),
?line ok = gen_event:notify(my_dummy_handler, Event),
?line receive
@@ -445,7 +444,6 @@ notify(Config) when is_list(Config) ->
end,
?line ok = gen_event:notify(my_dummy_handler,
{swap_event, {dummy1_h, 9}, swap}),
- ?t:sleep(1000),
?line [{dummy1_h,9}] = gen_event:which_handlers(my_dummy_handler),
?line ok = gen_event:notify(my_dummy_handler, Event),
?line receive
@@ -485,7 +483,6 @@ notify(Config) when is_list(Config) ->
?line ok = gen_event:add_sup_handler(my_dummy_handler, dummy_h, [self()]),
?line ok = gen_event:notify(my_dummy_handler, {swap_event,dummy1_h,swap}),
- ?t:sleep(1000),
?line [dummy1_h] = gen_event:which_handlers(my_dummy_handler),
?line ok = gen_event:notify(my_dummy_handler, do_crash),
@@ -496,7 +493,6 @@ notify(Config) when is_list(Config) ->
?line ok = gen_event:add_sup_handler(my_dummy_handler, dummy_h, [self()]),
?line ok = gen_event:notify(my_dummy_handler, {swap_event,dummy1_h,swap}),
- ?t:sleep(1000),
?line [dummy1_h] = gen_event:which_handlers(my_dummy_handler),
?line ok = gen_event:notify(my_dummy_handler, delete_event),
@@ -529,7 +525,6 @@ sync_notify(Config) when is_list(Config) ->
end,
?line ok = gen_event:sync_notify(my_dummy_handler,
{swap_event, dummy1_h, swap}),
- ?t:sleep(1000),
?line [dummy1_h] = gen_event:which_handlers(my_dummy_handler),
?line ok = gen_event:sync_notify(my_dummy_handler, Event),
?line receive
@@ -562,7 +557,6 @@ sync_notify(Config) when is_list(Config) ->
end,
?line ok = gen_event:sync_notify(my_dummy_handler,
{swap_event, {dummy1_h, 9}, swap}),
- ?t:sleep(1000),
?line [{dummy1_h,9}] = gen_event:which_handlers(my_dummy_handler),
?line ok = gen_event:sync_notify(my_dummy_handler, Event),
?line receive
@@ -603,7 +597,6 @@ sync_notify(Config) when is_list(Config) ->
?line ok = gen_event:add_sup_handler(my_dummy_handler, dummy_h, [self()]),
?line ok = gen_event:sync_notify(my_dummy_handler,
{swap_event,dummy1_h,swap}),
- ?t:sleep(1000),
?line [dummy1_h] = gen_event:which_handlers(my_dummy_handler),
?line ok = gen_event:sync_notify(my_dummy_handler, do_crash),
@@ -615,7 +608,6 @@ sync_notify(Config) when is_list(Config) ->
?line ok = gen_event:add_sup_handler(my_dummy_handler, dummy_h, [self()]),
?line ok = gen_event:sync_notify(my_dummy_handler,
{swap_event,dummy1_h,swap}),
- ?t:sleep(1000),
?line [dummy1_h] = gen_event:which_handlers(my_dummy_handler),
?line ok = gen_event:sync_notify(my_dummy_handler, delete_event),
@@ -789,7 +781,6 @@ info(Config) when is_list(Config) ->
ok
end,
?line my_dummy_handler ! {swap_info,dummy1_h,swap},
- ?t:sleep(1000),
?line [dummy1_h] = gen_event:which_handlers(my_dummy_handler),
?line my_dummy_handler ! Info,
?line receive
@@ -821,7 +812,6 @@ info(Config) when is_list(Config) ->
ok
end,
?line my_dummy_handler ! {swap_info,{dummy1_h,2},swap},
- ?t:sleep(1000),
?line [{dummy1_h,2}] = gen_event:which_handlers(my_dummy_handler),
?line my_dummy_handler ! Info,
?line receive
@@ -853,7 +843,6 @@ info(Config) when is_list(Config) ->
ok
end,
?line my_dummy_handler ! {swap_info,dummy1_h,swap},
- ?t:sleep(1000),
?line [dummy1_h] = gen_event:which_handlers(my_dummy_handler),
?line my_dummy_handler ! Info,
?line receive
diff --git a/lib/stdlib/test/id_transform_SUITE.erl b/lib/stdlib/test/id_transform_SUITE.erl
index 41de016f8d..1cff990697 100644
--- a/lib/stdlib/test/id_transform_SUITE.erl
+++ b/lib/stdlib/test/id_transform_SUITE.erl
@@ -56,47 +56,26 @@ end_per_group(_GroupName, Config) ->
id_transform(doc) -> "Test erl_id_trans.";
id_transform(Config) when is_list(Config) ->
- ?line File=filename:join([code:lib_dir(stdlib),"examples",
- "erl_id_trans.erl"]),
- ?line {ok,erl_id_trans,Bin}=compile:file(File,[binary]),
- ?line {module,erl_id_trans}=code:load_binary(erl_id_trans,File,Bin),
- ?line case test_server:purify_is_running() of
- false ->
- Dog = ct:timetrap(?t:hours(1)),
- ?line Res = run_in_test_suite(),
- ?t:timetrap_cancel(Dog),
- Res;
- true ->
- {skip,"Purify (too slow)"}
- end.
+ File = filename:join([code:lib_dir(stdlib),"examples",
+ "erl_id_trans.erl"]),
+ {ok,erl_id_trans,Bin} = compile:file(File,[binary]),
+ {module,erl_id_trans} = code:load_binary(erl_id_trans, File, Bin),
+ case test_server:purify_is_running() of
+ false ->
+ Dog = ct:timetrap(?t:hours(1)),
+ Res = run_in_test_suite(),
+ ?t:timetrap_cancel(Dog),
+ Res;
+ true ->
+ {skip,"Valgrind (too slow)"}
+ end.
run_in_test_suite() ->
- LibDir = code:lib_dir(),
SuperDir = filename:dirname(filename:dirname(code:which(?MODULE))),
TestDirs = filelib:wildcard(filename:join([SuperDir,"*_test"])),
- {All,Res} = case LibDir of
- "/clearcase/otp/erts/lib" ->
- %% Only test_suites 'cause clearcase is too slow...
- {false,run_list(TestDirs)};
- _ ->
- {true,run_codepath_and(TestDirs)}
- end,
- Comment0 = case All of
- true -> [];
- false -> "Only testsuite directories traversed"
- end,
- case Res of
- {error,Reason} when Comment0 =/= [] ->
- {failed,Comment0++"; "++Reason};
- {error,Reason} ->
- {failed,Reason};
- ok ->
- {comment,Comment0}
- end.
-
-run_codepath_and(DirList) ->
AbsDirs = [filename:absname(X) || X <- code:get_path()],
- run_list(ordsets:from_list([X || X <- AbsDirs] ++ DirList)).
+ Dirs = ordsets:from_list(AbsDirs ++ TestDirs),
+ run_list(Dirs).
run_list(PathL) ->
io:format("Where to search for beam files:\n~p\n", [PathL]),
@@ -123,7 +102,7 @@ run_list(PathL) ->
end,
case length(SevereFailures) of
0 -> ok;
- Len -> {error,integer_to_list(Len)++" failures"}
+ Len -> {failed,integer_to_list(Len)++" failures"}
end.
diff --git a/lib/stdlib/test/io_SUITE.erl b/lib/stdlib/test/io_SUITE.erl
index 5df09b6a79..0e897631ff 100644
--- a/lib/stdlib/test/io_SUITE.erl
+++ b/lib/stdlib/test/io_SUITE.erl
@@ -29,10 +29,11 @@
manpage/1, otp_6708/1, otp_7084/1, otp_7421/1,
io_lib_collect_line_3_wb/1, cr_whitespace_in_string/1,
io_fread_newlines/1, otp_8989/1, io_lib_fread_literal/1,
- printable_range/1,
+ printable_range/1, bad_printable_range/1,
io_lib_print_binary_depth_one/1, otp_10302/1, otp_10755/1,
otp_10836/1, io_lib_width_too_small/1,
- io_with_huge_message_queue/1, format_string/1]).
+ io_with_huge_message_queue/1, format_string/1,
+ maps/1, coverage/1]).
-export([pretty/2]).
@@ -70,10 +71,10 @@ all() ->
manpage, otp_6708, otp_7084, otp_7421,
io_lib_collect_line_3_wb, cr_whitespace_in_string,
io_fread_newlines, otp_8989, io_lib_fread_literal,
- printable_range,
+ printable_range, bad_printable_range,
io_lib_print_binary_depth_one, otp_10302, otp_10755, otp_10836,
io_lib_width_too_small, io_with_huge_message_queue,
- format_string].
+ format_string, maps, coverage].
groups() ->
[].
@@ -2062,8 +2063,6 @@ printable_range(Suite) when is_list(Suite) ->
[{args, " +pclatin1 -pa " ++ Pa}]),
unicode = rpc:call(UNode,io,printable_range,[]),
latin1 = rpc:call(LNode,io,printable_range,[]),
- {error, _} = test_server:start_node(printable_range_unnicode, slave,
- [{args, " +pcunnicode -pa " ++ Pa}]),
PrettyOptions = [{column,1},
{line_length,109},
{depth,30},
@@ -2071,48 +2070,69 @@ printable_range(Suite) when is_list(Suite) ->
{record_print_fun,
fun(_,_) -> no end},
{encoding,unicode}],
- 1025 = lists:max(lists:flatten(rpc:call(UNode,io_lib_pretty,print,
- [{hello, [1024,1025]},
- PrettyOptions]))),
- 125 = lists:max(lists:flatten(rpc:call(LNode,io_lib_pretty,print,
- [{hello, [1024,1025]},
- PrettyOptions]))),
- 125 = lists:max(lists:flatten(rpc:call(DNode,io_lib_pretty,print,
- [{hello, [1024,1025]},
- PrettyOptions]))),
- 1025 = lists:max(lists:flatten(rpc:call(UNode,io_lib_pretty,print,
- [{hello, <<1024/utf8,1025/utf8>>},
- PrettyOptions]))),
- 125 = lists:max(lists:flatten(rpc:call(LNode,io_lib_pretty,print,
- [{hello, <<1024/utf8,1025/utf8>>},
- PrettyOptions]))),
- 125 = lists:max(lists:flatten(rpc:call(DNode,io_lib_pretty,print,
- [{hello, <<1024/utf8,1025/utf8>>},
- PrettyOptions]))),
+ PrintableControls = "\t\v\b\f\e\r\n",
+
+ 1025 = print_max(UNode, [{hello, [1024,1025]},
+ PrettyOptions]),
+ 125 = print_max(LNode, [{hello, [1024,1025]},
+ PrettyOptions]),
+ 125 = print_max(DNode, [{hello, [1024,1025]},
+ PrettyOptions]),
+ 1025 = print_max(UNode, [{hello, <<1024/utf8,1025/utf8>>},
+ PrettyOptions]),
+ 125 = print_max(LNode, [{hello, <<1024/utf8,1025/utf8>>},
+ PrettyOptions]),
+ 125 = print_max(DNode, [{hello, <<1024/utf8,1025/utf8>>},
+ PrettyOptions]),
+ $v = print_max(UNode, [PrintableControls,PrettyOptions]),
+ $v = print_max(LNode, [PrintableControls,PrettyOptions]),
+ $v = print_max(DNode, [PrintableControls,PrettyOptions]),
+ 16#10FFFF = print_max(UNode,
+ [<<16#10FFFF/utf8,"\t\v\b\f\e\r\n">>,
+ PrettyOptions]),
+ $> = print_max(LNode,
+ [<<16#10FFFF/utf8,"\t\v\b\f\e\r\n">>,
+ PrettyOptions]),
+ $> = print_max(DNode,
+ [<<16#10FFFF/utf8,"\t\v\b\f\e\r\n">>,
+ PrettyOptions]),
- 1025 = lists:max(lists:flatten(rpc:call(UNode,io_lib,format,
- ["~tp",[{hello, [1024,1025]}]]))),
- 125 = lists:max(lists:flatten(rpc:call(LNode,io_lib,format,
- ["~tp",[{hello, [1024,1025]}]]))),
- 125 = lists:max(lists:flatten(rpc:call(DNode,io_lib,format,
- ["~tp",[{hello, [1024,1025]}]]))),
- 1025 = lists:max(lists:flatten(rpc:call(UNode,io_lib,format,
- ["~tp",
- [{hello,
- <<1024/utf8,1025/utf8>>}]]))),
- 125 = lists:max(lists:flatten(rpc:call(LNode,io_lib,format,
- ["~tp",
- [{hello,
- <<1024/utf8,1025/utf8>>}]]))),
- 125 = lists:max(lists:flatten(rpc:call(DNode,io_lib,format,
- ["~tp",
- [{hello,
- <<1024/utf8,1025/utf8>>}]]))),
+ 1025 = format_max(UNode, ["~tp", [{hello, [1024,1025]}]]),
+ 125 = format_max(LNode, ["~tp", [{hello, [1024,1025]}]]),
+ 125 = format_max(DNode, ["~tp", [{hello, [1024,1025]}]]),
+ 1025 = format_max(UNode, ["~tp", [{hello, <<1024/utf8,1025/utf8>>}]]),
+ 125 = format_max(LNode, ["~tp", [{hello, <<1024/utf8,1025/utf8>>}]]),
+ 125 = format_max(DNode, ["~tp", [{hello, <<1024/utf8,1025/utf8>>}]]),
+
+ $\e = format_max(UNode, ["~ts", [PrintableControls]]),
+ $\e = format_max(LNode, ["~ts", [PrintableControls]]),
+ $\e = format_max(DNode, ["~ts", [PrintableControls]]),
+
test_server:stop_node(UNode),
test_server:stop_node(LNode),
test_server:stop_node(DNode),
ok.
+print_max(Node, Args) ->
+ rpc_call_max(Node, io_lib_pretty, print, Args).
+
+format_max(Node, Args) ->
+ rpc_call_max(Node, io_lib, format, Args).
+
+rpc_call_max(Node, M, F, Args) ->
+ lists:max(lists:flatten(rpc:call(Node, M, F, Args))).
+
+%% Make sure that a bad specification for a printable range is rejected.
+bad_printable_range(Config) when is_list(Config) ->
+ Cmd = lists:concat([lib:progname()," +pcunnnnnicode -run erlang halt"]),
+ case os:cmd(Cmd) of
+ "bad range of printable characters" ++ _ ->
+ ok;
+ String ->
+ io:format("~s\n", [String]),
+ ?t:fail()
+ end.
+
io_lib_print_binary_depth_one(doc) ->
"Test binaries printed with a depth of one behave correctly";
io_lib_print_binary_depth_one(Suite) when is_list(Suite) ->
@@ -2225,7 +2245,7 @@ compile_file(File, Text, Config) ->
after ok %file:delete(Fname)
end.
-io_lib_width_too_small(Config) ->
+io_lib_width_too_small(_Config) ->
"**" = lists:flatten(io_lib:format("~2.3w", [3.14])),
"**" = lists:flatten(io_lib:format("~2.5w", [3.14])),
ok.
@@ -2271,8 +2291,113 @@ writes(N, F1) ->
file:write(F1, "hello\n"),
writes(N - 1, F1).
-format_string(Config) ->
+format_string(_Config) ->
%% All but padding is tested by fmt/2.
"xxxxxxsssx" = fmt("~10.4.xs", ["sss"]),
"xxxxxxsssx" = fmt("~10.4.*s", [$x, "sss"]),
ok.
+
+maps(_Config) ->
+ %% Note that order in which a map is printed is arbitrary. In
+ %% practice, small maps (non-HAMT) are printed in key order, but
+ %% the breakpoint for creating big maps (HAMT) is lower in the
+ %% debug-compiled run-time system than in the optimized run-time
+ %% system.
+ %%
+ %% Therefore, play it completely safe by not assuming any order
+ %% in a map with more than one element.
+
+ "#{}" = fmt("~w", [#{}]),
+ "#{a=>b}" = fmt("~w", [#{a=>b}]),
+ re_fmt(<<"#\\{(a=>b|c=>d),[.][.][.]=>[.][.][.]\\}">>,
+ "~W", [#{a=>b,c=>d},2]),
+ re_fmt(<<"#\\{(a=>b|c=>d|e=>f),[.][.][.]=>[.][.][.],[.][.][.]\\}">>,
+ "~W", [#{a=>b,c=>d,e=>f},2]),
+
+ "#{}" = fmt("~p", [#{}]),
+ "#{a => b}" = fmt("~p", [#{a=>b}]),
+ "#{...}" = fmt("~P", [#{a=>b},1]),
+ re_fmt(<<"#\\{(a => b|c => d),[.][.][.]\\}">>,
+ "~P", [#{a=>b,c=>d},2]),
+ re_fmt(<<"#\\{(a => b|c => d|e => f),[.][.][.]\\}">>,
+ "~P", [#{a=>b,c=>d,e=>f},2]),
+
+ List = [{I,I*I} || I <- lists:seq(1, 20)],
+ Map = maps:from_list(List),
+
+ "#{...}" = fmt("~P", [Map,1]),
+
+ %% Print a map and parse it back to a map.
+ S = fmt("~p\n", [Map]),
+ io:format("~p\n", [S]),
+ Map = parse_map(S),
+
+ %% Smoke test of a map as key.
+ MapAsKey = #{Map => "value"},
+ io:format("~s\n", [fmt("~p", [MapAsKey])]),
+ ok.
+
+re_fmt(Pattern, Format, Args) ->
+ S = list_to_binary(fmt(Format, Args)),
+ case re:run(S, Pattern, [{capture,none}]) of
+ nomatch ->
+ io:format("Pattern: ~s", [Pattern]),
+ io:format("Result: ~s", [S]),
+ ?t:fail();
+ match ->
+ ok
+ end.
+
+%% Parse a map consisting of integer keys and values.
+parse_map(S0) ->
+ S1 = parse_expect(S0, "#{"),
+ {M,S2} = parse_map_1(S1),
+ S = parse_expect(S2, "}"),
+ S = "",
+ M.
+
+parse_map_1(S0) ->
+ {Key,S1} = parse_number(S0),
+ S2 = parse_expect(S1, "=>"),
+ {Val,S3} = parse_number(S2),
+ case S3 of
+ ","++S4 ->
+ S5 = parse_skip_ws(S4),
+ {Map,S} = parse_map_1(S5),
+ {Map#{Key=>Val},S};
+ S ->
+ {#{Key=>Val},S}
+ end.
+
+parse_number(S) ->
+ parse_number(S, none).
+
+parse_number([C|S], Acc0) when $0 =< C, C =< $9 ->
+ Acc = case Acc0 of
+ none -> 0;
+ _ when is_integer(Acc0) -> Acc0
+ end,
+ parse_number(S, Acc*10+C-$0);
+parse_number(S, Acc) ->
+ {Acc,parse_skip_ws(S)}.
+
+parse_expect([H|T1], [H|T2]) ->
+ parse_expect(T1, T2);
+parse_expect(S, []) ->
+ parse_skip_ws(S).
+
+parse_skip_ws([C|S]) when C =< $\s ->
+ parse_skip_ws(S);
+parse_skip_ws(S) ->
+ S.
+
+%% Cover the last uncovered lines for completeness.
+coverage(_Config) ->
+ S1 = io_lib_pretty:print({a,term}, fun(_, _) -> no end),
+ io:format("~s\n", [S1]),
+
+ %% The tuple of arity three will be ignored.
+ S2 = io_lib_pretty:print(lists:seq(1, 100), [{depth,1,1}]),
+ io:format("~s\n", [S2]),
+
+ ok.
diff --git a/lib/stdlib/test/io_proto_SUITE.erl b/lib/stdlib/test/io_proto_SUITE.erl
index 1337b7dde2..811c7ed7bb 100644
--- a/lib/stdlib/test/io_proto_SUITE.erl
+++ b/lib/stdlib/test/io_proto_SUITE.erl
@@ -1378,47 +1378,43 @@ rtnode(C,N) ->
rtnode(Commands,Nodename,ErlPrefix) ->
rtnode(Commands,Nodename,ErlPrefix,[]).
rtnode(Commands,Nodename,ErlPrefix,Extra) ->
- ?line case get_progs() of
- {error,_Reason} ->
- ?line {skip,"No runerl present"};
- {RunErl,ToErl,Erl} ->
- ?line case create_tempdir() of
- {error, Reason2} ->
- ?line {skip, Reason2};
- Tempdir ->
- ?line SPid =
- start_runerl_node(RunErl,ErlPrefix++
- "\\\""++Erl++"\\\"",
- Tempdir,Nodename, Extra),
- ?line CPid = start_toerl_server(ToErl,Tempdir),
- ?line erase(getline_skipped),
- ?line Res =
- (catch get_and_put(CPid, Commands,1)),
- ?line case stop_runerl_node(CPid) of
- {error,_} ->
- ?line CPid2 =
- start_toerl_server
- (ToErl,Tempdir),
- ?line erase(getline_skipped),
- ?line ok = get_and_put
- (CPid2,
- [{putline,[7]},
- {sleep,
- timeout(short)},
- {putline,""},
- {getline," -->"},
- {putline,"s"},
- {putline,"c"},
- {putline,""}],1),
- ?line stop_runerl_node(CPid2);
- _ ->
- ?line ok
- end,
- ?line wait_for_runerl_server(SPid),
- ?line ok = ?RM_RF(Tempdir),
- ?line ok = Res
- end
- end.
+ case get_progs() of
+ {error,_Reason} ->
+ {skip,"No runerl present"};
+ {RunErl,ToErl,Erl} ->
+ case create_tempdir() of
+ {error, Reason2} ->
+ {skip, Reason2};
+ Tempdir ->
+ SPid = start_runerl_node(RunErl, ErlPrefix++
+ "\\\""++Erl++"\\\"",
+ Tempdir, Nodename, Extra),
+ CPid = start_toerl_server(ToErl, Tempdir),
+ put(getline_skipped, []),
+ Res = (catch get_and_put(CPid, Commands, 1)),
+ case stop_runerl_node(CPid) of
+ {error,_} ->
+ CPid2 = start_toerl_server(ToErl, Tempdir),
+ put(getline_skipped, []),
+ ok = get_and_put
+ (CPid2,
+ [{putline,[7]},
+ {sleep,
+ timeout(short)},
+ {putline,""},
+ {getline," -->"},
+ {putline,"s"},
+ {putline,"c"},
+ {putline,""}], 1),
+ stop_runerl_node(CPid2);
+ _ ->
+ ok
+ end,
+ wait_for_runerl_server(SPid),
+ ok = ?RM_RF(Tempdir),
+ ok = Res
+ end
+ end.
timeout(long) ->
2 * timeout(normal);
@@ -1462,57 +1458,51 @@ get_and_put(CPid, [{sleep, X}|T],N) ->
after X ->
get_and_put(CPid,T,N+1)
end;
-get_and_put(CPid, [{getline, Match}|T],N) ->
+get_and_put(CPid, [{getline_pred,Pred,Msg}|T]=T0, N)
+ when is_function(Pred) ->
?dbg({getline, Match}),
CPid ! {self(), {get_line, timeout(normal)}},
receive
{get_line, timeout} ->
error_logger:error_msg("~p: getline timeout waiting for \"~s\" "
"(command number ~p, skipped: ~p)~n",
- [?MODULE, Match,N,get(getline_skipped)]),
+ [?MODULE,Msg,N,get(getline_skipped)]),
{error, timeout};
{get_line, Data} ->
?dbg({data,Data}),
- case lists:prefix(Match, Data) of
- true ->
- erase(getline_skipped),
+ case Pred(Data) of
+ yes ->
+ put(getline_skipped, []),
get_and_put(CPid, T,N+1);
- false ->
- case get(getline_skipped) of
- undefined ->
- put(getline_skipped,[Data]);
- List ->
- put(getline_skipped,List ++ [Data])
- end,
- get_and_put(CPid, [{getline, Match}|T],N)
+ no ->
+ error_logger:error_msg("~p: getline match failure "
+ "\"~s\" "
+ "(command number ~p)\n",
+ [?MODULE,Msg,N]),
+ {error, no_match};
+ maybe ->
+ List = get(getline_skipped),
+ put(getline_skipped, List ++ [Data]),
+ get_and_put(CPid, T0, N)
end
end;
+get_and_put(CPid, [{getline, Match}|T],N) ->
+ ?dbg({getline, Match}),
+ F = fun(Data) ->
+ case lists:prefix(Match, Data) of
+ true -> yes;
+ false -> maybe
+ end
+ end,
+ get_and_put(CPid, [{getline_pred,F,Match}|T], N);
get_and_put(CPid, [{getline_re, Match}|T],N) ->
- ?dbg({getline_re, Match}),
- CPid ! {self(), {get_line, timeout(normal)}},
- receive
- {get_line, timeout} ->
- error_logger:error_msg("~p: getline_re timeout waiting for \"~s\" "
- "(command number ~p, skipped: ~p)~n",
- [?MODULE, Match,N,get(getline_skipped)]),
- {error, timeout};
- {get_line, Data} ->
- ?dbg({data,Data}),
- case re:run(Data, Match,[{capture,none}]) of
- match ->
- erase(getline_skipped),
- get_and_put(CPid, T,N+1);
- _ ->
- case get(getline_skipped) of
- undefined ->
- put(getline_skipped,[Data]);
- List ->
- put(getline_skipped,List ++ [Data])
- end,
- get_and_put(CPid, [{getline_re, Match}|T],N)
- end
- end;
-
+ F = fun(Data) ->
+ case re:run(Data, Match, [{capture,none}]) of
+ match -> yes;
+ _ -> maybe
+ end
+ end,
+ get_and_put(CPid, [{getline_pred,F,Match}|T], N);
get_and_put(CPid, [{putline_raw, Line}|T],N) ->
?dbg({putline_raw, Line}),
CPid ! {self(), {send_line, Line}},
@@ -1801,10 +1791,22 @@ get_data_within(Port, Timeout, Acc) ->
end.
get_default_shell() ->
+ Match = fun(Data) ->
+ case lists:prefix("undefined", Data) of
+ true ->
+ yes;
+ false ->
+ case re:run(Data, "<\\d+[.]\\d+[.]\\d+>",
+ [{capture,none}]) of
+ match -> no;
+ _ -> maybe
+ end
+ end
+ end,
try
rtnode([{putline,""},
{putline, "whereis(user_drv)."},
- {getline, "undefined"}],[]),
+ {getline_pred, Match, "matching of user_drv pid"}], []),
old
catch _E:_R ->
?dbg({_E,_R}),
diff --git a/lib/stdlib/test/lists_SUITE.erl b/lib/stdlib/test/lists_SUITE.erl
index e886a797f0..a0f7fd2744 100644
--- a/lib/stdlib/test/lists_SUITE.erl
+++ b/lib/stdlib/test/lists_SUITE.erl
@@ -38,13 +38,13 @@
% Test cases must be exported.
-export([member/1, reverse/1,
keymember/1, keysearch_keyfind/1,
- keystore/1, keytake/1,
+ keystore/1, keytake/1, keyreplace/1,
append_1/1, append_2/1,
seq_loop/1, seq_2/1, seq_3/1, seq_2_e/1, seq_3_e/1,
sublist_2/1, sublist_3/1, sublist_2_e/1, sublist_3_e/1,
flatten_1/1, flatten_2/1, flatten_1_e/1, flatten_2_e/1,
- dropwhile/1,
+ dropwhile/1, takewhile/1,
sort_1/1, sort_stable/1, merge/1, rmerge/1, sort_rand/1,
usort_1/1, usort_stable/1, umerge/1, rumerge/1,usort_rand/1,
keymerge/1, rkeymerge/1,
@@ -62,7 +62,7 @@
zip_unzip/1, zip_unzip3/1, zipwith/1, zipwith3/1,
filter_partition/1,
otp_5939/1, otp_6023/1, otp_6606/1, otp_7230/1,
- suffix/1, subtract/1, droplast/1]).
+ suffix/1, subtract/1, droplast/1, hof/1]).
%% Sort randomized lists until stopped.
%%
@@ -81,37 +81,51 @@
suite() -> [{ct_hooks,[ts_install_cth]}].
all() ->
- [{group, append}, reverse, member, keymember,
- keysearch_keyfind, keystore, keytake, dropwhile, {group,sort},
- {group, usort}, {group, keysort}, {group, ukeysort},
- {group, funsort}, {group, ufunsort}, {group, sublist},
- {group, flatten}, {group, seq}, zip_unzip, zip_unzip3,
- zipwith, zipwith3, filter_partition, {group, tickets},
- suffix, subtract].
+ [{group, append},
+ {group, key},
+ {group,sort},
+ {group, usort},
+ {group, keysort},
+ {group, ukeysort},
+ {group, funsort},
+ {group, ufunsort},
+ {group, sublist},
+ {group, flatten},
+ {group, seq},
+ {group, tickets},
+ {group, zip},
+ {group, misc}].
groups() ->
- [{append, [], [append_1, append_2]},
- {usort, [],
+ [{append, [parallel], [append_1, append_2]},
+ {usort, [parallel],
[umerge, rumerge, usort_1, usort_rand, usort_stable]},
- {keysort, [],
+ {keysort, [parallel],
[keymerge, rkeymerge, keysort_1, keysort_rand,
keysort_i, keysort_stable, keysort_error]},
- {sort,[],[merge, rmerge, sort_1, sort_rand]},
- {ukeysort, [],
+ {key, [parallel], [keymember, keysearch_keyfind, keystore,
+ keytake, keyreplace]},
+ {sort,[parallel],[merge, rmerge, sort_1, sort_rand]},
+ {ukeysort, [parallel],
[ukeymerge, rukeymerge, ukeysort_1, ukeysort_rand,
ukeysort_i, ukeysort_stable, ukeysort_error]},
- {funsort, [],
+ {funsort, [parallel],
[funmerge, rfunmerge, funsort_1, funsort_stable,
funsort_error, funsort_rand]},
- {ufunsort, [],
+ {ufunsort, [parallel],
[ufunmerge, rufunmerge, ufunsort_1, ufunsort_stable,
ufunsort_error, ufunsort_rand]},
- {seq, [], [seq_loop, seq_2, seq_3, seq_2_e, seq_3_e]},
- {sublist, [],
+ {seq, [parallel], [seq_loop, seq_2, seq_3, seq_2_e, seq_3_e]},
+ {sublist, [parallel],
[sublist_2, sublist_3, sublist_2_e, sublist_3_e]},
- {flatten, [],
+ {flatten, [parallel],
[flatten_1, flatten_2, flatten_1_e, flatten_2_e]},
- {tickets, [], [otp_5939, otp_6023, otp_6606, otp_7230]}].
+ {tickets, [parallel], [otp_5939, otp_6023, otp_6606, otp_7230]},
+ {zip, [parallel], [zip_unzip, zip_unzip3, zipwith, zipwith3]},
+ {misc, [parallel], [reverse, member, dropwhile, takewhile,
+ filter_partition, suffix, subtract,
+ hof]}
+ ].
init_per_suite(Config) ->
Config.
@@ -345,6 +359,33 @@ dropwhile(Config) when is_list(Config) ->
ok.
+takewhile(Config) when is_list(Config) ->
+ F = fun(C) -> C =/= $@ end,
+
+ [] = lists:takewhile(F, []),
+ [a] = lists:takewhile(F, [a]),
+ [a,b] = lists:takewhile(F, [a,b]),
+ [a,b,c] = lists:takewhile(F, [a,b,c]),
+
+ [] = lists:takewhile(F, [$@]),
+ [] = lists:takewhile(F, [$@,$@]),
+ [a] = lists:takewhile(F, [a,$@]),
+
+ [$k] = lists:takewhile(F, [$k,$@]),
+ [$k,$l] = lists:takewhile(F, [$k,$l,$@,$@]),
+ [a] = lists:takewhile(F, [a,$@,$@,$@]),
+
+ [] = lists:takewhile(F, [$@,a,$@,b]),
+ [] = lists:takewhile(F, [$@,$@,a,$@,b]),
+ [] = lists:takewhile(F, [$@,$@,$@,a,$@,b]),
+
+ Long = lists:seq(1, 1024),
+ Shorter = lists:seq(1, 400),
+
+ Shorter = lists:takewhile(fun(E) -> E =< 400 end, Long),
+
+ ok.
+
keystore(doc) ->
["OTP-XXX."];
keystore(suite) -> [];
@@ -382,6 +423,17 @@ keytake(Config) when is_list(Config) ->
?line false = lists:keytake(4, 2, L),
ok.
+%% Test lists:keyreplace/4.
+keyreplace(Config) when is_list(Config) ->
+ [{new,42}] = lists:keyreplace(k, 1, [{k,1}], {new,42}),
+ [atom,{new,a,b}] = lists:keyreplace(k, 1, [atom,{k,1}], {new,a,b}),
+ [a,{x,y,z}] = lists:keyreplace(a, 5, [a,{x,y,z}], {no,use}),
+
+ %% Error cases.
+ {'EXIT',_} = (catch lists:keyreplace(k, 1, [], not_tuple)),
+ {'EXIT',_} = (catch lists:keyreplace(k, 0, [], {a,b})),
+ ok.
+
merge(doc) -> ["merge functions"];
merge(suite) -> [];
merge(Config) when is_list(Config) ->
@@ -2326,19 +2378,25 @@ sublist_3_e(Config) when is_list(Config) ->
-define(flatten_error1(X), ?line {'EXIT', _} = (catch lists:flatten(X))).
-define(flatten_error2(X,Y), ?line {'EXIT', _} = (catch lists:flatten(X,Y))).
-flatten_1(doc) -> ["flatten/1"];
-flatten_1(suite) -> [];
+%% Test lists:flatten/1,2 and lists:flatlength/1.
flatten_1(Config) when is_list(Config) ->
- ?line [] = lists:flatten([]),
- ?line [1,2] = lists:flatten([1,2]),
- ?line [1,2] = lists:flatten([1,[2]]),
- ?line [1,2] = lists:flatten([[1],2]),
- ?line [1,2] = lists:flatten([[1],[2]]),
- ?line [1,2] = lists:flatten([[1,2]]),
- ?line [a,b,c,d] = lists:flatten([[a],[b,c,[d]]]),
+ [] = lists_flatten([]),
+ [1,2] = lists_flatten([1,2]),
+ [1,2] = lists_flatten([1,[2]]),
+ [1,2] = lists_flatten([[1],2]),
+ [1,2] = lists_flatten([[1],[2]]),
+ [1,2] = lists_flatten([[1,2]]),
+ [a,b,c,d] = lists_flatten([[a],[b,c,[d]]]),
ok.
+lists_flatten(List) ->
+ Flat = lists:flatten(List),
+ Flat = lists:flatten(List, []),
+ Len = lists:flatlength(List),
+ Len = length(Flat),
+ Flat.
+
flatten_1_e(doc) -> ["flatten/1 error cases"];
flatten_1_e(suite) -> [];
flatten_1_e(Config) when is_list(Config) ->
@@ -2351,11 +2409,11 @@ flatten_1_e(Config) when is_list(Config) ->
%%% clear-cut. Right now, I think that any term should be allowed.
%%% But I also wish this function didn't exist at all.
-flatten_2(doc) -> ["flatten/2"];
-flatten_2(suite) -> [];
+%% Test lists:flatten/2.
flatten_2(Config) when is_list(Config) ->
- ?line [] = lists:flatten([]),
- ?line [a] = lists:flatten([a]),
+ [] = lists:flatten([], []),
+ [a] = lists:flatten([a], []),
+ [a,b,c,[no,flatten]] = lists:flatten([[a,[b,c]]], [[no,flatten]]),
ok.
flatten_2_e(doc) -> ["flatten/2 error cases"];
@@ -2651,3 +2709,40 @@ droplast(Config) when is_list(Config) ->
?line {'EXIT', {function_clause, _}} = (catch lists:droplast(x)),
ok.
+
+%% Briefly test the common high-order functions to ensure they
+%% are covered.
+hof(Config) when is_list(Config) ->
+ L = [1,2,3],
+ [1,4,9] = lists:map(fun(N) -> N*N end, L),
+ [1,4,5,6] = lists:flatmap(fun(1) -> [1];
+ (2) -> [];
+ (3) -> [4,5,6]
+ end, L),
+ [{1,[a]},{2,[b]},{3,[c]}] =
+ lists:keymap(fun(A) -> [A] end, 2, [{1,a},{2,b},{3,c}]),
+
+ [1,3] = lists:filter(fun(N) -> N rem 2 =:= 1 end, L),
+ FilterMapFun = fun(1) -> true;
+ (2) -> {true,42};
+ (3) -> false
+ end,
+ [1,42] = lists:filtermap(FilterMapFun, L),
+ [1,42] = lists:zf(FilterMapFun, L),
+
+ [3,2,1] = lists:foldl(fun(E, A) -> [E|A] end, [], L),
+ [1,2,3] = lists:foldr(fun(E, A) -> [E|A] end, [], L),
+ {[1,4,9],[3,2,1]} = lists:mapfoldl(fun(E, A) ->
+ {E*E,[E|A]}
+ end, [], L),
+ {[1,4,9],[1,2,3]} = lists:mapfoldr(fun(E, A) ->
+ {E*E,[E|A]}
+ end, [], L),
+
+ true = lists:any(fun(N) -> N =:= 2 end, L),
+ false = lists:any(fun(N) -> N =:= 42 end, L),
+
+ true = lists:all(fun(N) -> is_integer(N) end, L),
+ false = lists:all(fun(N) -> N rem 2 =:= 0 end, L),
+
+ ok.
diff --git a/lib/stdlib/test/proc_lib_SUITE.erl b/lib/stdlib/test/proc_lib_SUITE.erl
index 3a8fa74d36..f7a6a38138 100644
--- a/lib/stdlib/test/proc_lib_SUITE.erl
+++ b/lib/stdlib/test/proc_lib_SUITE.erl
@@ -80,81 +80,123 @@ end_per_group(_GroupName, Config) ->
crash(Config) when is_list(Config) ->
error_logger:add_report_handler(?MODULE, self()),
- Pid = proc_lib:spawn(?MODULE, sp1, []),
- Pid ! die,
- ?line Report = receive
- {crash_report, Pid, Report0} -> Report0
- after 2000 -> test_server:fail(no_crash_report)
- end,
- ?line proc_lib:format(Report),
- ?line [PidRep, []] = Report,
- ?line {value, {initial_call,{?MODULE,sp1,[]}}} =
- lists:keysearch(initial_call, 1, PidRep),
- Self = self(),
- ?line {value, {ancestors,[Self]}} =
- lists:keysearch(ancestors, 1, PidRep),
- ?line {value, {error_info,{exit,die,_StackTrace1}}} =
- lists:keysearch(error_info, 1, PidRep),
-
- F = fun sp1/0,
- Pid1 = proc_lib:spawn(node(), F),
- Pid1 ! die,
- ?line [PidRep1, []] = receive
- {crash_report, Pid1, Report1} -> Report1
- after 2000 -> test_server:fail(no_crash_report)
- end,
- ?line {value, {initial_call,{Fmod,Fname,[]}}} =
- lists:keysearch(initial_call, 1, PidRep1),
- ?line {module,Fmod} = erlang:fun_info(F, module),
- ?line {name,Fname} = erlang:fun_info(F, name),
- ?line {value, {ancestors,[Self]}} =
- lists:keysearch(ancestors, 1, PidRep1),
- ?line {value, {error_info,{exit,die,_StackTrace2}}} =
- lists:keysearch(error_info, 1, PidRep1),
-
- Pid2 = proc_lib:spawn(?MODULE, sp2, []),
- test_server:sleep(100),
- ?line {?MODULE,sp2,[]} = proc_lib:initial_call(Pid2),
- ?line {?MODULE,sp2,0} = proc_lib:translate_initial_call(Pid2),
- Pid2 ! die,
- ?line [Pid2Rep, [{neighbour, LinkRep}]] =
- receive
- {crash_report, Pid2, Report2} -> Report2
- after 2000 -> test_server:fail(no_crash_report)
- end,
- ?line {value, {initial_call,{?MODULE,sp2,[]}}} =
- lists:keysearch(initial_call, 1, Pid2Rep),
- ?line {value, {ancestors,[Self]}} =
- lists:keysearch(ancestors, 1, Pid2Rep),
- ?line {value, {error_info,{exit,die,_StackTrace3}}} =
- lists:keysearch(error_info, 1, Pid2Rep),
- ?line {value, {initial_call,{?MODULE,sp1,[]}}} =
- lists:keysearch(initial_call, 1, LinkRep),
-
%% Make sure that we don't get a crash report if a process
%% terminates with reason 'shutdown' or reason {shutdown,Reason}.
- ?line process_flag(trap_exit, true),
- ?line Pid3 = proc_lib:spawn_link(erlang, apply,
- [fun() -> exit(shutdown) end,[]]),
-
- ?line Pid4 = proc_lib:spawn_link(erlang, apply,
- [fun() -> exit({shutdown,{a,b,c}}) end,[]]),
+ process_flag(trap_exit, true),
+ Pid0 = proc_lib:spawn_link(erlang, apply,
+ [fun() -> exit(shutdown) end,[]]),
+ Pid1 = proc_lib:spawn_link(erlang, apply,
+ [fun() -> exit({shutdown,{a,b,c}}) end,[]]),
+
+ receive {'EXIT',Pid0,shutdown} -> ok end,
+ receive {'EXIT',Pid1,{shutdown,{a,b,c}}} -> ok end,
+ process_flag(trap_exit, false),
+ %% We expect any unexpected messages to be caught below,
+ %% so we don't have explicitly wait some time to be sure.
+
+ %% Spawn export function.
+ Pid2 = proc_lib:spawn(?MODULE, sp1, []),
+ Pid2 ! die,
+ Exp2 = [{initial_call,{?MODULE,sp1,[]}},
+ {ancestors,[self()]},
+ {error_info,{exit,die,{stacktrace}}}],
+ analyse_crash(Pid2, Exp2, []),
- ?line receive {'EXIT',Pid3,shutdown} -> ok end,
- ?line receive {'EXIT',Pid4,{shutdown,{a,b,c}}} -> ok end,
- ?line process_flag(trap_exit, false),
+ %% Spawn fun.
+ F = fun sp1/0,
+ Pid3 = proc_lib:spawn(node(), F),
+ Pid3 ! die,
+ {module,?MODULE} = erlang:fun_info(F, module),
+ {name,Fname} = erlang:fun_info(F, name),
+ Exp3 = [{initial_call,{?MODULE,Fname,[]}},
+ {ancestors,[self()]},
+ {error_info,{exit,die,{stacktrace}}}],
+ analyse_crash(Pid3, Exp3, []),
- receive
- Any ->
- ?line ?t:fail({unexpected_message,Any})
- after 2000 ->
- ok
- end,
+ %% Spawn function with neighbour.
+ Pid4 = proc_lib:spawn(?MODULE, sp2, []),
+ test_server:sleep(100),
+ {?MODULE,sp2,[]} = proc_lib:initial_call(Pid4),
+ {?MODULE,sp2,0} = proc_lib:translate_initial_call(Pid4),
+ Pid4 ! die,
+ Exp4 = [{initial_call,{?MODULE,sp2,[]}},
+ {ancestors,[self()]},
+ {error_info,{exit,die,{stacktrace}}}],
+ Links4 = [[{initial_call,{?MODULE,sp1,[]}},
+ {ancestors,[Pid4,self()]}]],
+ analyse_crash(Pid4, Exp4, Links4),
+
+ %% Make sure that we still get a crash report if the
+ %% process dictionary have been tampered with.
+
+ Pid5 = proc_lib:spawn(erlang, apply,
+ [fun() ->
+ erase(),
+ exit(abnormal)
+ end,[]]),
+ Exp5 = [{initial_call,absent},
+ {ancestors,[]},
+ {error_info,{exit,abnormal,{stacktrace}}}],
+ analyse_crash(Pid5, Exp5, []),
error_logger:delete_report_handler(?MODULE),
ok.
+analyse_crash(Pid, Expected0, ExpLinks) ->
+ Expected = [{pid,Pid}|Expected0],
+ receive
+ {crash_report, Pid, Report} ->
+ _ = proc_lib:format(Report), %Smoke test.
+ [Crash,Links] = Report,
+ analyse_crash_1(Expected, Crash),
+ analyse_links(ExpLinks, Links);
+ Unexpected ->
+ io:format("~p\n", [Unexpected]),
+ test_server:fail(unexpected_message)
+ after 5000 ->
+ test_server:fail(no_crash_report)
+ end.
+
+analyse_links([H|Es], [{neighbour,N}|Links]) ->
+ analyse_crash_1(H, N),
+ analyse_links(Es, Links);
+analyse_links([], []) ->
+ ok.
+analyse_crash_1([{Key,absent}|T], Report) ->
+ false = lists:keymember(Key, 1, Report),
+ analyse_crash_1(T, Report);
+analyse_crash_1([{Key,Pattern}|T], Report) ->
+ case lists:keyfind(Key, 1, Report) of
+ false ->
+ io:format("~p", [Report]),
+ test_server:fail({missing_key,Key});
+ {Key,Info} ->
+ try
+ match_info(Pattern, Info)
+ catch
+ no_match ->
+ io:format("key: ~p", [Key]),
+ io:format("pattern: ~p", [Pattern]),
+ io:format("actual: ~p", [Report]),
+ test_server:fail(no_match)
+ end,
+ analyse_crash_1(T, Report)
+ end;
+analyse_crash_1([], _Report) ->
+ [].
+
+match_info(T, T) ->
+ ok;
+match_info({stacktrace}, Stk) when is_list(Stk) ->
+ ok;
+match_info([H1|T1], [H2|T2]) ->
+ match_info(H1, H2),
+ match_info(T1, T2);
+match_info(Tuple1, Tuple2) when tuple_size(Tuple1) =:= tuple_size(Tuple2) ->
+ match_info(tuple_to_list(Tuple1), tuple_to_list(Tuple2));
+match_info(_, _) ->
+ throw(no_match).
sync_start_nolink(Config) when is_list(Config) ->
_Pid = spawn_link(?MODULE, sp5, [self()]),
@@ -369,7 +411,7 @@ init_dont_hang(Config) when is_list(Config) ->
end.
init_dont_hang_init(_Parent) ->
- 1 = 2.
+ error(bad_init).
%% Test proc_lib:stop/1,3
stop(_Config) ->
@@ -453,7 +495,7 @@ stop(_Config) ->
ok.
system_terminate(crash,_Parent,_Deb,_State) ->
- 1 = 2;
+ error({badmatch,2});
system_terminate(Reason,_Parent,_Deb,_State) ->
exit(Reason).
diff --git a/lib/stdlib/test/rand_SUITE.erl b/lib/stdlib/test/rand_SUITE.erl
index b03caebe91..111bf620de 100644
--- a/lib/stdlib/test/rand_SUITE.erl
+++ b/lib/stdlib/test/rand_SUITE.erl
@@ -25,7 +25,9 @@
]).
-export([interval_int/1, interval_float/1, seed/1,
- api_eq/1, reference/1, basic_stats/1,
+ api_eq/1, reference/1,
+ basic_stats_uniform_1/1, basic_stats_uniform_2/1,
+ basic_stats_normal/1,
plugin/1, measure/1
]).
@@ -51,11 +53,13 @@ all() ->
[seed, interval_int, interval_float,
api_eq,
reference,
- basic_stats,
+ {group, basic_stats},
plugin, measure
].
-groups() -> [].
+groups() ->
+ [{basic_stats, [parallel],
+ [basic_stats_uniform_1, basic_stats_uniform_2, basic_stats_normal]}].
init_per_suite(Config) -> Config.
end_per_suite(_Config) -> ok.
@@ -291,14 +295,19 @@ gen(_, _, Acc) -> lists:reverse(Acc).
%% The algorithms must have good properties to begin with
%%
-basic_stats(doc) -> ["Check that the algorithms generate sound values."];
-basic_stats(suite) -> [];
-basic_stats(Config) when is_list(Config) ->
- io:format("Testing uniform~n",[]),
+%% Check that the algorithms generate sound values.
+
+basic_stats_uniform_1(Config) when is_list(Config) ->
[basic_uniform_1(?LOOP, rand:seed_s(Alg), 0.0, array:new([{default, 0}]))
|| Alg <- algs()],
+ ok.
+
+basic_stats_uniform_2(Config) when is_list(Config) ->
[basic_uniform_2(?LOOP, rand:seed_s(Alg), 0, array:new([{default, 0}]))
|| Alg <- algs()],
+ ok.
+
+basic_stats_normal(Config) when is_list(Config) ->
io:format("Testing normal~n",[]),
[basic_normal_1(?LOOP, rand:seed_s(Alg), 0, 0) || Alg <- algs()],
ok.
diff --git a/lib/stdlib/test/re_SUITE.erl b/lib/stdlib/test/re_SUITE.erl
index b8c20d9745..d78d6153da 100644
--- a/lib/stdlib/test/re_SUITE.erl
+++ b/lib/stdlib/test/re_SUITE.erl
@@ -28,7 +28,7 @@
pcre_compile_workspace_overflow/1,re_infinite_loop/1,
re_backwards_accented/1,opt_dupnames/1,opt_all_names/1,inspect/1,
opt_no_start_optimize/1,opt_never_utf/1,opt_ucp/1,
- match_limit/1,sub_binaries/1]).
+ match_limit/1,sub_binaries/1,copt/1]).
-include_lib("test_server/include/test_server.hrl").
-include_lib("kernel/include/file.hrl").
@@ -319,32 +319,26 @@ replace_return(doc) ->
["Tests return options of replace together with global searching"];
replace_return(Config) when is_list(Config) ->
Dog = ?t:timetrap(?t:minutes(3)),
- ?line {'EXIT',{badarg,_}} = (catch re:replace("na","(a","")),
- ?line <<"nasse">> = re:replace(<<"nisse">>,"i","a",[{return,binary}]),
- ?line <<"ABCÃ…XABCXA">> = re:replace("ABC\305abcdABCabcdA","a(?<FOO>bcd)","X",[global,{return,binary}]),
-
- ?line [<<"ABCÃ…">>,
- <<"X">>,
- <<"ABC">>,
- <<"X">> |
- <<"A">> ] =
- re:replace("ABCÃ…abcdABCabcdA","a(?<FOO>bcd)","X",[global,{return,iodata}]),
- ?line "ABCÃ…XABCXA" = re:replace("ABCÃ…abcdABCabcdA","a(?<FOO>bcd)","X",[global,{return,list},unicode]),
- ?line <<65,66,67,195,133,88,65,66,67,88,65>> = re:replace("ABCÃ…abcdABCabcdA","a(?<FOO>bcd)","X",[global,{return,binary},unicode]),
- ?line <<65,66,67,195,133,88,65,66,67,97,98,99,100,65>> = re:replace("ABCÃ…abcdABCabcdA","a(?<FOO>bcd)","X",[{return,binary},unicode]),
- ?line <<"iXk">> = re:replace("abcdefghijk","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\9X",[{return,binary}]),
- ?line <<"jXk">> = re:replace("abcdefghijk","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\10X",[{return,binary}]),
- ?line <<"Xk">> = re:replace("abcdefghijk","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\11X",[{return,binary}]),
- ?line <<"9X1">> = re:replace("12345678901","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\g9X",[{return,binary}]),
- ?line <<"0X1">> = re:replace("12345678901","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\g10X",[{return,binary}]),
- ?line <<"X1">> = re:replace("12345678901","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\g11X",[{return,binary}]),
- ?line <<"971">> = re:replace("12345678901","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\g{9}7",[{return,binary}]),
- ?line <<"071">> = re:replace("12345678901","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\g{10}7",[{return,binary}]),
- ?line <<"71">> = re:replace("12345678901","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\g{11}7",[{return,binary}]),
- ?line "a\x{400}bcX" = re:replace("a\x{400}bcd","d","X",[global,{return,list},unicode]),
- ?line <<"a",208,128,"bcX">> = re:replace("a\x{400}bcd","d","X",[global,{return,binary},unicode]),
- ?line "a\x{400}bcd" = re:replace("a\x{400}bcd","Z","X",[global,{return,list},unicode]),
- ?line <<"a",208,128,"bcd">> = re:replace("a\x{400}bcd","Z","X",[global,{return,binary},unicode]),
+ {'EXIT',{badarg,_}} = (catch re:replace("na","(a","")),
+ ok = replacetest(<<"nisse">>,"i","a",[{return,binary}],<<"nasse">>),
+ ok = replacetest("ABC\305abcdABCabcdA","a(?<FOO>bcd)","X",[global,{return,binary}],<<"ABCÃ…XABCXA">>),
+ ok = replacetest("ABCÃ…abcdABCabcdA","a(?<FOO>bcd)","X",[global,{return,iodata}],[<<"ABCÃ…">>,<<"X">>,<<"ABC">>,<<"X">>|<<"A">>]),
+ ok = replacetest("ABCÃ…abcdABCabcdA","a(?<FOO>bcd)","X",[global,{return,list},unicode],"ABCÃ…XABCXA"),
+ ok = replacetest("ABCÃ…abcdABCabcdA","a(?<FOO>bcd)","X",[global,{return,binary},unicode],<<65,66,67,195,133,88,65,66,67,88,65>>),
+ ok = replacetest("ABCÃ…abcdABCabcdA","a(?<FOO>bcd)","X",[{return,binary},unicode],<<65,66,67,195,133,88,65,66,67,97,98,99,100,65>>),
+ ok = replacetest("abcdefghijk","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\9X",[{return,binary}],<<"iXk">>),
+ ok = replacetest("abcdefghijk","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\10X",[{return,binary}],<<"jXk">>),
+ ok = replacetest("abcdefghijk","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\11X",[{return,binary}],<<"Xk">>),
+ ok = replacetest("12345678901","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\g9X",[{return,binary}],<<"9X1">>),
+ ok = replacetest("12345678901","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\g10X",[{return,binary}],<<"0X1">>),
+ ok = replacetest("12345678901","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\g11X",[{return,binary}],<<"X1">>),
+ ok = replacetest("12345678901","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\g{9}7",[{return,binary}],<<"971">>),
+ ok = replacetest("12345678901","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\g{10}7",[{return,binary}],<<"071">>),
+ ok = replacetest("12345678901","(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)","\\g{11}7",[{return,binary}],<<"71">>),
+ ok = replacetest("a\x{400}bcd","d","X",[global,{return,list},unicode],"a\x{400}bcX"),
+ ok = replacetest("a\x{400}bcd","d","X",[global,{return,binary},unicode],<<"a",208,128,"bcX">>),
+ ok = replacetest("a\x{400}bcd","Z","X",[global,{return,list},unicode],"a\x{400}bcd"),
+ ok = replacetest("a\x{400}bcd","Z","X",[global,{return,binary},unicode],<<"a",208,128,"bcd">>),
?t:timetrap_cancel(Dog),
ok.
@@ -389,6 +383,35 @@ crtest(Subject,RE,Options,true,Result) ->
error
end.
+replacetest(Subject,RE,Replacement,Options,Result) ->
+ Result = re:replace(Subject,RE,Replacement,Options),
+ {CompileOptions,ReplaceOptions} = lists:partition(fun copt/1, Options),
+ {ok,MP} = re:compile(RE,CompileOptions),
+ Result = re:replace(Subject,MP,Replacement,ReplaceOptions),
+ ok.
+
+splittest(Subject,RE,Options,Result) ->
+ Result = re:split(Subject,RE,Options),
+ {CompileOptions,SplitOptions} = lists:partition(fun copt/1, Options),
+ {ok,MP} = re:compile(RE,CompileOptions),
+ Result = re:split(Subject,MP,SplitOptions),
+ ok.
+
+copt(caseless) -> true;
+copt(no_start_optimize) -> true;
+copt(never_utf) -> true;
+copt(ucp) -> true;
+copt(dollar_endonly) -> true;
+copt(dotall) -> true;
+copt(extended) -> true;
+copt(firstline) -> true;
+copt(multiline) -> true;
+copt(no_auto_capture) -> true;
+copt(dupnames) -> true;
+copt(ungreedy) -> true;
+copt(unicode) -> true;
+copt(_) -> false.
+
split_autogen(doc) ->
["Test split with autogenerated erlang module"];
split_autogen(Config) when is_list(Config) ->
@@ -401,43 +424,23 @@ split_options(doc) ->
["Test special options to split."];
split_options(Config) when is_list(Config) ->
Dog = ?t:timetrap(?t:minutes(1)),
- ?line [[<<"a">>,<<" ">>],[<<"b">>,<<" ">>],[<<"c">>,<<" ">>]] = re:split("a b c ","( )",[group,trim]),
- ?line [[<<"a">>,<<" ">>],[<<"b">>,<<" ">>],[<<"c">>,<<" ">>]] = re:split("a b c ","( )",[group,{parts,0}]),
- ?line [[<<"a">>,<<" ">>],[<<"b">>,<<" ">>],[<<"c">>,<<" ">>],[<<>>]] =
- re:split("a b c ","( )",[{parts,infinity},group]),
- ?line [[<<"a">>,<<" ">>],[<<"b">>,<<" ">>],[<<"c">>,<<" ">>],[<<>>]] =
- re:split("a b c ","( )",[group]),
- ?line [[<<>>,<<" ">>],[<<"a">>,<<" ">>],[<<"b">>,<<" ">>],
- [<<"c">>,<<" ">>],[<<"d">>,<<" ">>]] =
- re:split(" a b c d ","( +)",[group,trim]),
- ?line [[<<>>,<<" ">>],[<<"a">>,<<" ">>],[<<"b">>,<<" ">>],
- [<<"c">>,<<" ">>],[<<"d">>,<<" ">>]] =
- re:split(" a b c d ","( +)",[{parts,0},group]),
- ?line [[<<>>,<<" ">>],[<<"a">>,<<" ">>],[<<"b">>,<<" ">>],
- [<<"c">>,<<" ">>],[<<"d">>,<<" ">>],[<<>>]] =
- re:split(" a b c d ","( +)",[{parts,infinity},group]),
- ?line [[<<"a">>,<<" ">>],[<<"b c d">>]] =
- re:split("a b c d","( +)",[{parts,2},group]),
- ?line [[[967]," "],["b c d"]] =
- re:split([967]++" b c d","( +)",
- [{parts,2},group,{return,list},unicode]),
- ?line [[<<207,135>>,<<" ">>],[<<"b c d">>]] =
- re:split([967]++" b c d","( +)",
- [{parts,2},group,{return,binary},unicode]),
- ?line {'EXIT',{badarg,_}} =
- (catch re:split([967]++" b c d","( +)",
- [{parts,2},group,{return,binary}])),
- ?line {'EXIT',{badarg,_}} =
- (catch re:split("a b c d","( +)",[{parts,-2}])),
- ?line {'EXIT',{badarg,_}} =
- (catch re:split("a b c d","( +)",[{parts,banan}])),
- ?line {'EXIT',{badarg,_}} =
- (catch re:split("a b c d","( +)",[{capture,all}])),
- ?line {'EXIT',{badarg,_}} =
- (catch re:split("a b c d","( +)",[{capture,[],binary}])),
+ ok = splittest("a b c ","( )",[group,trim],[[<<"a">>,<<" ">>],[<<"b">>,<<" ">>],[<<"c">>,<<" ">>]]),
+ ok = splittest("a b c ","( )",[group,{parts,0}],[[<<"a">>,<<" ">>],[<<"b">>,<<" ">>],[<<"c">>,<<" ">>]]),
+ ok = splittest("a b c ","( )",[{parts,infinity},group],[[<<"a">>,<<" ">>],[<<"b">>,<<" ">>],[<<"c">>,<<" ">>],[<<>>]]),
+ ok = splittest("a b c ","( )",[group],[[<<"a">>,<<" ">>],[<<"b">>,<<" ">>],[<<"c">>,<<" ">>],[<<>>]]),
+ ok = splittest(" a b c d ","( +)",[group,trim],[[<<>>,<<" ">>],[<<"a">>,<<" ">>],[<<"b">>,<<" ">>],[<<"c">>,<<" ">>],[<<"d">>,<<" ">>]]),
+ ok = splittest(" a b c d ","( +)",[{parts,0},group],[[<<>>,<<" ">>],[<<"a">>,<<" ">>],[<<"b">>,<<" ">>],[<<"c">>,<<" ">>],[<<"d">>,<<" ">>]]),
+ ok = splittest(" a b c d ","( +)",[{parts,infinity},group],[[<<>>,<<" ">>],[<<"a">>,<<" ">>],[<<"b">>,<<" ">>],[<<"c">>,<<" ">>],[<<"d">>,<<" ">>],[<<>>]]),
+ ok = splittest("a b c d","( +)",[{parts,2},group],[[<<"a">>,<<" ">>],[<<"b c d">>]]),
+ ok = splittest([967]++" b c d","( +)",[{parts,2},group,{return,list},unicode],[[[967]," "],["b c d"]]),
+ ok = splittest([967]++" b c d","( +)",[{parts,2},group,{return,binary},unicode],[[<<207,135>>,<<" ">>],[<<"b c d">>]]),
+ {'EXIT',{badarg,_}} = (catch re:split([967]++" b c d","( +)",[{parts,2},group,{return,binary}])),
+ {'EXIT',{badarg,_}} = (catch re:split("a b c d","( +)",[{parts,-2}])),
+ {'EXIT',{badarg,_}} = (catch re:split("a b c d","( +)",[{parts,banan}])),
+ {'EXIT',{badarg,_}} = (catch re:split("a b c d","( +)",[{capture,all}])),
+ {'EXIT',{badarg,_}} = (catch re:split("a b c d","( +)",[{capture,[],binary}])),
% Parts 0 is equal to no parts specification (implicit strip)
- ?line ["a"," ","b"," ","c"," ","d"] =
- re:split("a b c d","( *)",[{parts,0},{return,list}]),
+ ok = splittest("a b c d","( *)",[{parts,0},{return,list}],["a"," ","b"," ","c"," ","d"]),
?t:timetrap_cancel(Dog),
ok.
diff --git a/lib/stdlib/vsn.mk b/lib/stdlib/vsn.mk
index a1f2a946b1..3387d74e57 100644
--- a/lib/stdlib/vsn.mk
+++ b/lib/stdlib/vsn.mk
@@ -1 +1 @@
-STDLIB_VSN = 2.5
+STDLIB_VSN = 2.6
diff --git a/lib/syntax_tools/src/erl_syntax.erl b/lib/syntax_tools/src/erl_syntax.erl
index 3f2a3e05dd..97b5797b06 100644
--- a/lib/syntax_tools/src/erl_syntax.erl
+++ b/lib/syntax_tools/src/erl_syntax.erl
@@ -355,7 +355,7 @@
%% where `Pos' `Ann' and `Comments' are the corresponding values of a
%% `tree' or `wrapper' record.
--record(attr, {pos = 0 :: term(),
+-record(attr, {pos = erl_anno:new(0) :: term(),
ann = [] :: [term()],
com = none :: 'none' | #com{}}).
-type syntaxTreeAttributes() :: #attr{}.
diff --git a/lib/syntax_tools/src/erl_tidy.erl b/lib/syntax_tools/src/erl_tidy.erl
index db7f0939a3..f2de12b410 100644
--- a/lib/syntax_tools/src/erl_tidy.erl
+++ b/lib/syntax_tools/src/erl_tidy.erl
@@ -937,7 +937,7 @@ hidden_uses_2(Tree, Used) ->
-record(env, {file :: file:filename(),
module :: atom(),
- current :: fa(),
+ current :: fa() | 'undefined',
imports = dict:new() :: dict:dict(atom(), atom()),
context = normal :: context(),
verbosity = 1 :: 0 | 1 | 2,
@@ -949,10 +949,10 @@ hidden_uses_2(Tree, Used) ->
new_guard_tests = true :: boolean(),
old_guard_tests = false :: boolean()}).
--record(st, {varc :: non_neg_integer(),
+-record(st, {varc :: non_neg_integer() | 'undefined',
used = sets:new() :: sets:set({atom(), arity()}),
imported :: sets:set({atom(), arity()}),
- vars :: sets:set(atom()),
+ vars :: sets:set(atom()) | 'undefined',
functions :: sets:set({atom(), arity()}),
new_forms = [] :: [erl_syntax:syntaxTree()],
rename :: dict:dict(mfa(), {atom(), atom()})}).
@@ -1064,13 +1064,13 @@ visit_clause(Tree, Env, St0) ->
visit_infix_expr(Tree, #env{context = guard_test}, St0) ->
%% Detect transition from guard test to guard expression.
- visit_other(Tree, #env{context = guard_expr}, St0);
+ visit_other(Tree, #env{context = guard_expr, file = ""}, St0);
visit_infix_expr(Tree, Env, St0) ->
visit_other(Tree, Env, St0).
visit_prefix_expr(Tree, #env{context = guard_test}, St0) ->
%% Detect transition from guard test to guard expression.
- visit_other(Tree, #env{context = guard_expr}, St0);
+ visit_other(Tree, #env{context = guard_expr, file = ""}, St0);
visit_prefix_expr(Tree, Env, St0) ->
visit_other(Tree, Env, St0).
diff --git a/lib/syntax_tools/src/igor.erl b/lib/syntax_tools/src/igor.erl
index eac5af5540..4557678f9d 100644
--- a/lib/syntax_tools/src/igor.erl
+++ b/lib/syntax_tools/src/igor.erl
@@ -1594,10 +1594,11 @@ alias_expansions_2(Modules, Table) ->
preserved :: boolean(),
no_headers :: boolean(),
notes :: notes(),
- map :: map_fun(),
+ map :: map_fun() | 'undefined',
renaming :: fun((atom()) -> map_fun()),
expand :: dict:dict({atom(), integer()},
- {atom(), {atom(), integer()}}),
+ {atom(), {atom(), integer()}})
+ | 'undefined',
redirect :: dict:dict(atom(), atom())
}).
diff --git a/lib/syntax_tools/src/merl.erl b/lib/syntax_tools/src/merl.erl
index 690306c17b..163ce48bbc 100644
--- a/lib/syntax_tools/src/merl.erl
+++ b/lib/syntax_tools/src/merl.erl
@@ -514,15 +514,17 @@ parse_forms([]) ->
parse_2(Ts) ->
%% one or more comma-separated expressions?
%% (recall that Ts has no dot tokens if we get to this stage)
- case erl_parse:parse_exprs(Ts ++ [{dot,0}]) of
+ A = a0(),
+ case erl_parse:parse_exprs(Ts ++ [{dot,A}]) of
{ok, Exprs} -> Exprs;
{error, E} ->
- parse_3(Ts ++ [{'end',0}, {dot,0}], [E])
+ parse_3(Ts ++ [{'end',A}, {dot,A}], [E])
end.
parse_3(Ts, Es) ->
%% try-clause or clauses?
- case erl_parse:parse_exprs([{'try',0}, {atom,0,true}, {'catch',0} | Ts]) of
+ A = a0(),
+ case erl_parse:parse_exprs([{'try',A}, {atom,A,true}, {'catch',A} | Ts]) of
{ok, [{'try',_,_,_,_,_}=X]} ->
%% get the right kind of qualifiers in the clause patterns
erl_syntax:try_expr_handlers(X);
@@ -533,7 +535,8 @@ parse_3(Ts, Es) ->
parse_4(Ts, Es) ->
%% fun-clause or clauses? (`(a)' is also a pattern, but `(a,b)' isn't,
%% so fun-clauses must be tried before normal case-clauses
- case erl_parse:parse_exprs([{'fun',0} | Ts]) of
+ A = a0(),
+ case erl_parse:parse_exprs([{'fun',A} | Ts]) of
{ok, [{'fun',_,{clauses,Cs}}]} -> Cs;
{error, E} ->
parse_5(Ts, [E|Es])
@@ -541,7 +544,8 @@ parse_4(Ts, Es) ->
parse_5(Ts, Es) ->
%% case-clause or clauses?
- case erl_parse:parse_exprs([{'case',0}, {atom,0,true}, {'of',0} | Ts]) of
+ A = a0(),
+ case erl_parse:parse_exprs([{'case',A}, {atom,A,true}, {'of',A} | Ts]) of
{ok, [{'case',_,_,Cs}]} -> Cs;
{error, E} ->
%% select the best error to report
@@ -1210,7 +1214,7 @@ merge_comments(StartLine, Cs, [], Acc) ->
merge_comments(StartLine, [], [],
[erl_syntax:set_pos(
erl_syntax:comment(Indent, Text),
- StartLine + Line - 1)
+ anno(StartLine + Line - 1))
|| {Line, _, Indent, Text} <- Cs] ++ Acc);
merge_comments(StartLine, [C|Cs], [T|Ts], Acc) ->
{Line, _Col, Indent, Text} = C,
@@ -1228,3 +1232,9 @@ merge_comments(StartLine, [C|Cs], [T|Ts], Acc) ->
[erl_syntax:comment(Indent, Text)], T),
merge_comments(StartLine, Cs, [Tc|Ts], Acc)
end.
+
+a0() ->
+ anno(0).
+
+anno(Location) ->
+ erl_anno:new(Location).
diff --git a/lib/syntax_tools/src/merl_transform.erl b/lib/syntax_tools/src/merl_transform.erl
index 66b06c8137..fe58b6a122 100644
--- a/lib/syntax_tools/src/merl_transform.erl
+++ b/lib/syntax_tools/src/merl_transform.erl
@@ -68,8 +68,7 @@ case_guard([{expr,_}, {text,Text}]) ->
erl_syntax:is_literal(Text).
case_body([{expr,Expr}, {text,_Text}], T) ->
- pre_expand_case(Expr, erl_syntax:case_expr_clauses(T),
- erl_syntax:get_pos(T)).
+ pre_expand_case(Expr, erl_syntax:case_expr_clauses(T), get_location(T)).
post(T) ->
merl:switch(
@@ -79,7 +78,7 @@ post(T) ->
lists:all(fun erl_syntax:is_literal/1, [F|As])
end,
fun ([{args, As}, {function, F}]) ->
- Line = erl_syntax:get_pos(F),
+ Line = get_location(F),
[F1|As1] = lists:map(fun erl_syntax:concrete/1, [F|As]),
eval_call(Line, F1, As1, T)
end},
@@ -118,7 +117,7 @@ expand_qquote(_As, T, _StartPos) ->
expand_template(F, [Pattern | Args], T) ->
case erl_syntax:is_literal(Pattern) of
true ->
- Line = erl_syntax:get_pos(Pattern),
+ Line = get_location(Pattern),
As = [erl_syntax:concrete(Pattern)],
merl:qquote(Line, "merl:_@function(_@pattern, _@args)",
[{function, F},
@@ -260,3 +259,12 @@ is_erlang_var([C|_]) when C >= $A, C =< $Z ; C >= $À, C =< $Þ, C /= $× ->
true;
is_erlang_var(_) ->
false.
+
+get_location(T) ->
+ Pos = erl_syntax:get_pos(T),
+ case erl_anno:is_anno(Pos) of
+ true ->
+ erl_anno:location(Pos);
+ false ->
+ Pos
+ end.
diff --git a/lib/test_server/doc/src/notes.xml b/lib/test_server/doc/src/notes.xml
index 939a07dcef..da956de9ef 100644
--- a/lib/test_server/doc/src/notes.xml
+++ b/lib/test_server/doc/src/notes.xml
@@ -298,7 +298,7 @@
configuration function or test specification term), the
affected test cases get the status <c>user_skipped</c>
instead.</p> <p>This update has meant a few changes that
- may affect Common Test users in various ways: <list>
+ may affect Common Test users in various ways:</p> <list>
<item>The test results and statistics will be affected,
which is important to know when running regression tests
and comparing results to previous test runs.</item>
@@ -318,7 +318,7 @@
<c>auto_skipped</c> rather than <c>user_skipped</c> as
before.</item> <item>The event messages that Common Test
generates during test runs have been affected by this
- update. For details see OTP-11524.</item> </list> </p>
+ update. For details see OTP-11524.</item> </list>
<p>
Own Id: OTP-11305 Aux Id: OTP-11524 </p>
</item>
@@ -445,7 +445,7 @@
that were not opened with the {encoding,utf8} option. If
then the argument contained unicode characters above 255,
the file descriptor would crash. This has been corrected
- by the following modifications: <list> <item> Since the
+ by the following modifications:</p> <list> <item> Since the
'unexpected_io' log file is used only when the test case
HTML file is not available (e.g. between test cases),
this file is now also a HTML file and as other
@@ -467,7 +467,7 @@
path to the last run.&lt;timestamp&gt; directory, is now
dependent on the file name mode of the VM. If file names
are expected to be unicode, then the 'last_name' file is
- UTF-8 encoded, else it is latin1 encoded. </item> </list></p>
+ UTF-8 encoded, else it is latin1 encoded. </item> </list>
<p>
Also, ~tp has been changed back to ~p unless it is
somehow likely that the argument includes strings. It is
@@ -615,7 +615,7 @@
</item>
<item>
<p>
- Update common test modules to handle unicode <list>
+ Update common test modules to handle Unicode:</p> <list>
<item> Use UTF-8 encoding for all HTML files, except the
HTML version of the test suite generated with
erl2html2:convert, which will have the same encoding as
@@ -626,7 +626,7 @@
unicode:characters_to_list and
unicode:characters_to_binary for conversion between
binaries and strings instead of binary_to_list and
- list_to_binary. </item> </list></p>
+ list_to_binary. </item> </list>
</item>
</list>
</section>
diff --git a/lib/test_server/src/erl2html2.erl b/lib/test_server/src/erl2html2.erl
index 2c63103264..e281c9de1b 100644
--- a/lib/test_server/src/erl2html2.erl
+++ b/lib/test_server/src/erl2html2.erl
@@ -170,23 +170,32 @@ get_line(Anno) ->
%%%-----------------------------------------------------------------
%%% Find the line number of the last expression in the function
find_clause_lines([{clause,CL,_Params,_Op,Exprs}], CLs) -> % last clause
- try tuple_to_list(lists:last(Exprs)) of
- [_Type,ExprLine | _] when is_integer(ExprLine) ->
- {lists:reverse([{clause,get_line(CL)}|CLs]), get_line(ExprLine)};
- [tree,_ | Exprs1] ->
+ case classify_exprs(Exprs) of
+ {anno, Anno} ->
+ {lists:reverse([{clause,get_line(CL)}|CLs]), get_line(Anno)};
+ {tree, Exprs1} ->
find_clause_lines([{clause,CL,undefined,undefined,Exprs1}], CLs);
- [macro,{_var,ExprLine,_MACRO} | _] when is_integer(ExprLine) ->
- {lists:reverse([{clause,get_line(CL)}|CLs]), get_line(ExprLine)};
- _ ->
- {lists:reverse([{clause,get_line(CL)}|CLs]), get_line(CL)}
- catch
- _:_ ->
+ unknown ->
{lists:reverse([{clause,get_line(CL)}|CLs]), get_line(CL)}
end;
-
find_clause_lines([{clause,CL,_Params,_Op,_Exprs} | Cs], CLs) ->
find_clause_lines(Cs, [{clause,get_line(CL)}|CLs]).
+classify_exprs(Exprs) ->
+ case tuple_to_list(lists:last(Exprs)) of
+ [macro,{_var,Anno,_MACRO} | _] ->
+ {anno, Anno};
+ [T,ExprAnno | Exprs1] ->
+ case erl_anno:is_anno(ExprAnno) of
+ true ->
+ {anno, ExprAnno};
+ false when T =:= tree ->
+ {tree, Exprs1};
+ false ->
+ unknown
+ end
+ end.
+
%%%-----------------------------------------------------------------
%%% Add a link target for each line and one for each function definition.
build_html(SFd,DFd,Encoding,FuncsAndCs) ->
diff --git a/lib/test_server/src/test_server_gl.erl b/lib/test_server/src/test_server_gl.erl
index c5ec3ccbe6..31098d9726 100644
--- a/lib/test_server/src/test_server_gl.erl
+++ b/lib/test_server/src/test_server_gl.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2012-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2012-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -30,7 +30,7 @@
-export([init/1,handle_call/3,handle_cast/2,handle_info/2,terminate/2]).
-record(st, {tc_supervisor :: 'none'|pid(), %Test case supervisor
- tc :: mfa(), %Current test case MFA
+ tc :: mfa() | 'undefined', %Current test case MFA
minor :: 'none'|pid(), %Minor fd
minor_monitor, %Monitor ref for minor fd
capture :: 'none'|pid(), %Capture output
diff --git a/lib/test_server/src/ts_lib.erl b/lib/test_server/src/ts_lib.erl
index 61bd55a654..7c3f450194 100644
--- a/lib/test_server/src/ts_lib.erl
+++ b/lib/test_server/src/ts_lib.erl
@@ -250,12 +250,10 @@ do_test(Rest, Vars, Test) ->
{Result,Comment,Rest2}.
%% extract an argument
-get_arg([$ |Rest], Vars, Stop, Acc) ->
- get_arg(Rest, Vars, Stop, Acc);
get_arg([$(|Rest], Vars, Stop, _) ->
get_arg(Rest, Vars, Stop, []);
get_arg([Stop|Rest], Vars, Stop, Acc) ->
- Arg = lists:reverse(Acc),
+ Arg = string:strip(lists:reverse(Acc)),
Subst = subst(Arg, Vars),
{Subst,Rest};
get_arg([C|Rest], Vars, Stop, Acc) ->
diff --git a/lib/tools/Makefile b/lib/tools/Makefile
index 2699ffab51..fef33743c0 100644
--- a/lib/tools/Makefile
+++ b/lib/tools/Makefile
@@ -24,7 +24,7 @@ include $(ERL_TOP)/make/$(TARGET)/otp.mk
# Macros
# ----------------------------------------------------
-SUB_DIRECTORIES = c_src src doc/src examples priv emacs
+SUB_DIRECTORIES = c_src src doc/src examples emacs
include vsn.mk
VSN = $(TOOLS_VSN)
diff --git a/lib/tools/c_src/Makefile.in b/lib/tools/c_src/Makefile.in
index 66bba229f6..e8bce149b1 100644
--- a/lib/tools/c_src/Makefile.in
+++ b/lib/tools/c_src/Makefile.in
@@ -97,11 +97,8 @@ DRIVERS=
ifneq ($(strip $(ETHR_LIB_NAME)),)
# Need ethread package for emem
-ifneq ($(findstring ose,$(TARGET)),ose)
-# Do not build on OSE
PROGS += $(BIN_DIR)/emem$(TYPEMARKER)@EXEEXT@
endif
-endif
EMEM_OBJ_DIR=$(OBJ_DIR)/emem
CREATE_DIRS += $(EMEM_OBJ_DIR)
@@ -152,12 +149,7 @@ ERTS_LIB = $(ERL_TOP/erts/lib_src/obj/$(TARGET)/$(TYPE)/MADE
_create_dirs := $(shell mkdir -p $(CREATE_DIRS))
-ifneq ($(findstring ose,$(TARGET)),ose)
all: $(PROGS) $(DRIVERS)
-else
-# Do not build dynamic files on OSE
-all:
-endif
$(ERTS_LIB):
$(make_verbose)cd $(ERL_TOP)/erts/lib_src && $(MAKE) $(TYPE)
diff --git a/lib/tools/doc/src/cover_chapter.xml b/lib/tools/doc/src/cover_chapter.xml
index 2f7f8d8083..c3f1570477 100644
--- a/lib/tools/doc/src/cover_chapter.xml
+++ b/lib/tools/doc/src/cover_chapter.xml
@@ -451,48 +451,5 @@ ok
<p>When Cover is stopped, all Cover compiled modules are unloaded.</p>
</section>
</section>
-
- <section>
- <title>Using the Web Based User Interface to Cover</title>
-
- <section>
- <title>Introduction</title>
- <p>To ease the use of Cover there is a web based user interface
- to Cover called WebCover. WebCover is designed to be started
- and used via WebTool. It is possible to Cover compile Erlang
- modules and to generate printable Cover and Call analyses via
- the web based user interface.</p>
- </section>
-
- <section>
- <title>Start the Web Based User Interface to Cover</title>
- <p>To start WebCover you can either start WebTool, point a
- browser to the start page of WebTool and start WebCover from
- there, or you can use the <c>start_webtool</c> script to start
- Webtool, WebCover and a browser. See WebTool documentation for
- further information.</p>
- <p>Currently WebCover is only compatible
- with Internet Explorer and Netscape Navigator 4.0 and higher.</p>
- </section>
-
- <section>
- <title>Navigating WebCover</title>
- <p>From the menu in the lefthand frame you can select the
- <c>Nodes</c>, <c>Compile</c>, <c>Import</c> or <c>Result</c>
- page.</p>
- <p>From the <c>Nodes</c> page you can add remote nodes to
- participate in the coverage analysis. Coverage data from all
- involved nodes will then be merged during analysis.</p>
- <p>From the <c>Compile</c> page you can Cover compile <c>.erl</c>
- or <c>.beam</c> files.</p>
- <p>From the <c>Import</c> page you can import coverage data from
- a previous analysis. Imported data will then be merged with
- the current coverage data. <em>Note</em> that it is only possible to
- import files with the extension <c>.coverdata</c>.</p>
- <p>From the <c>Result</c> page you can analyse, reset or export
- coverage data.</p>
- <p>Please follow the instructions on each page.</p>
- </section>
- </section>
</chapter>
diff --git a/lib/tools/doc/src/eprof.xml b/lib/tools/doc/src/eprof.xml
index 7dccd927ca..8e37d49c99 100644
--- a/lib/tools/doc/src/eprof.xml
+++ b/lib/tools/doc/src/eprof.xml
@@ -131,13 +131,13 @@
<name>analyze() -> ok</name>
<name>analyze(Type) -> ok</name>
<name>analyze(Type,Options) -> ok</name>
+ <fsummary>Display profiling results per process.</fsummary>
<type>
<v>Type = procs | total</v>
<v>Options = [{filter, Filter} | {sort, Sort}</v>
<v>Filter = [{calls, integer()} | {time, float()}]</v>
<v>Sort = time | calls | mfa</v>
</type>
- <fsummary>Display profiling results per process.</fsummary>
<desc>
<p>Call this function when profiling has been stopped to display
the results per process, that is:</p>
diff --git a/lib/tools/doc/src/notes.xml b/lib/tools/doc/src/notes.xml
index e788814564..bf27d2a3e5 100644
--- a/lib/tools/doc/src/notes.xml
+++ b/lib/tools/doc/src/notes.xml
@@ -31,6 +31,25 @@
</header>
<p>This document describes the changes made to the Tools application.</p>
+<section><title>Tools 2.8.1</title>
+
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <list>
+ <item>
+ <p>
+ If a module includes eunit.hrl, a parse transform adds
+ the function test/0 on line 0 in the module. A bug in
+ OTP-18.0 caused cover:analyse_to_file/1 to fail to insert
+ cover data in the output file when line 0 existed in the
+ cover data table. This is now corrected.</p>
+ <p>
+ Own Id: OTP-12981</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
<section><title>Tools 2.8</title>
<section><title>Fixed Bugs and Malfunctions</title>
diff --git a/lib/tools/emacs/erlang.el b/lib/tools/emacs/erlang.el
index 4aa1ab7d38..466bf139b9 100644
--- a/lib/tools/emacs/erlang.el
+++ b/lib/tools/emacs/erlang.el
@@ -4236,7 +4236,7 @@ This function is designed to be a member of a criteria list."
This function is designed to be a member of a criteria list."
(save-excursion
(beginning-of-line)
- (when (save-match-data (looking-at "-\\(spec\\|type\\)"))
+ (when (save-match-data (looking-at "-\\(spec\\|type\\|callback\\)"))
'stop)))
diff --git a/lib/ose/doc/html/.gitignore b/lib/tools/priv/.gitignore
index e69de29bb2..e69de29bb2 100644
--- a/lib/ose/doc/html/.gitignore
+++ b/lib/tools/priv/.gitignore
diff --git a/lib/tools/priv/Makefile b/lib/tools/priv/Makefile
deleted file mode 100644
index aa4aaa2fc8..0000000000
--- a/lib/tools/priv/Makefile
+++ /dev/null
@@ -1,69 +0,0 @@
-# ``Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# The Initial Developer of the Original Code is Ericsson Utvecklings AB.
-# Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings
-# AB. All Rights Reserved.''
-#
-# $Id$
-#
-include $(ERL_TOP)/make/target.mk
-include $(ERL_TOP)/make/$(TARGET)/otp.mk
-
-# ----------------------------------------------------
-# Application version
-# ----------------------------------------------------
-include ../vsn.mk
-VSN = $(TOOLS_VSN)
-
-# ----------------------------------------------------
-# Release directory specification
-# ----------------------------------------------------
-RELSYSDIR = $(RELEASE_PATH)/lib/tools-$(VSN)
-
-# ----------------------------------------------------
-# Target Specs
-# ----------------------------------------------------
-
-HTDOCS_FILES = index.html
-
-TOOL_FILES = cover.tool
-
-# ----------------------------------------------------
-# FLAGS
-# ----------------------------------------------------
-ERL_COMPILE_FLAGS +=
-
-# ----------------------------------------------------
-# Targets
-# ----------------------------------------------------
-
-debug opt:
-
-clean:
-
-docs:
-
-# ----------------------------------------------------
-# Release Target
-# ----------------------------------------------------
-include $(ERL_TOP)/make/otp_release_targets.mk
-
-release_spec: opt
- $(INSTALL_DIR) "$(RELSYSDIR)/priv"
- $(INSTALL_DATA) $(HTDOCS_FILES) "$(RELSYSDIR)/priv"
- $(INSTALL_DATA) $(TOOL_FILES) "$(RELSYSDIR)/priv"
-
-release_docs_spec:
-
-
-
diff --git a/lib/tools/priv/cover.tool b/lib/tools/priv/cover.tool
deleted file mode 100644
index 9e72f89ff4..0000000000
--- a/lib/tools/priv/cover.tool
+++ /dev/null
@@ -1,2 +0,0 @@
-{version,"1.2"}.
-[{config_func,{cover_web,configData,[]}}].
diff --git a/lib/tools/priv/index.html b/lib/tools/priv/index.html
deleted file mode 100644
index 6b60ef5d0a..0000000000
--- a/lib/tools/priv/index.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<HTML>
-<HEAD>
-<TITLE>Erlang webb tools </TITLE>
-</HEAD>
-<FRAMESET COLS="250,*">
-<FRAME NAME="menu" SRC="/webcover/erl/cover_web/menu_frame">
-<FRAME NAME="main" SRC="/webcover/erl/cover_web/compile_frame">
-</FRAMESET>
-</HTML>
-
diff --git a/lib/tools/src/Makefile b/lib/tools/src/Makefile
index 9fcfb79628..7301ff856a 100644
--- a/lib/tools/src/Makefile
+++ b/lib/tools/src/Makefile
@@ -37,7 +37,6 @@ RELSYSDIR = $(RELEASE_PATH)/lib/tools-$(VSN)
MODULES= \
cover \
- cover_web \
eprof \
fprof \
cprof \
diff --git a/lib/tools/src/cover.erl b/lib/tools/src/cover.erl
index 8d1cb96504..1d7d112c06 100644
--- a/lib/tools/src/cover.erl
+++ b/lib/tools/src/cover.erl
@@ -20,9 +20,7 @@
-module(cover).
%%
-%% This module implements the Erlang coverage tool. The module named
-%% cover_web implements a user interface for the coverage tool to run
-%% under webtool.
+%% This module implements the Erlang coverage tool.
%%
%% ARCHITECTURE
%% The coverage tool consists of one process on each node involved in
@@ -2437,7 +2435,7 @@ do_analyse_to_file1(Module, OutFile, ErlFile, HTML) ->
"\n\n"]),
Pattern = {#bump{module=Module,line='$1',_='_'},'$2'},
- MS = [{Pattern,[],[{{'$1','$2'}}]}],
+ MS = [{Pattern,[{is_integer,'$1'},{'>','$1',0}],[{{'$1','$2'}}]}],
CovLines = lists:keysort(1,ets:select(?COLLECTION_TABLE, MS)),
print_lines(Module, CovLines, InFd, OutFd, 1, HTML),
diff --git a/lib/tools/src/cover_web.erl b/lib/tools/src/cover_web.erl
deleted file mode 100644
index ae8b3f25cf..0000000000
--- a/lib/tools/src/cover_web.erl
+++ /dev/null
@@ -1,1185 +0,0 @@
-%%
-%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2001-2009. All Rights Reserved.
-%%
-%% Licensed under the Apache License, Version 2.0 (the "License");
-%% you may not use this file except in compliance with the License.
-%% You may obtain a copy of the License at
-%%
-%% http://www.apache.org/licenses/LICENSE-2.0
-%%
-%% Unless required by applicable law or agreed to in writing, software
-%% distributed under the License is distributed on an "AS IS" BASIS,
-%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-%% See the License for the specific language governing permissions and
-%% limitations under the License.
-%%
-%% %CopyrightEnd%
-%%
-
--module(cover_web).
--author('[email protected]').
--behaviour(gen_server).
-
-%%Export of configuration function
--export([configData/0]).
-%% External exports
--export([init/1, handle_call/3, handle_cast/2, handle_info/2,
- terminate/2, code_change/3]).
-
--export([start_link/0,start/0,stop/0]).
--export([menu_frame/2,nodes_frame/2,import_frame/2,
- compile_frame/2,result_frame/2]).
--export([list_dir/2,compile/2,add_node/2,remove_node/2,result/2,
- calls/2,coverage/2,import/2]).
-
--record(state,{dir}).
-
--include_lib("kernel/include/file.hrl").
-
-%% Timeouts
--define(DEFAULT_TIME,10000).
--define(MAX_COMPILE_TIME,60000).
--define(MAX_ANALYSE_TIME,30000).
-
-%% Colors
--define(INFO_BG_COLOR,"#C0C0EA").
-
-%%%----------------------------------------------------------------------
-%%% API - called from erlang shell
-%%%----------------------------------------------------------------------
-%% Start webtool and webcover from erlang shell
-start() ->
- webtool:start(),
- webtool:start_tools([],"app=webcover"),
- ok.
-
-%% Stop webtool and webcover from erlang shell
-stop() ->
- webtool:stop_tools([],"app=webcover"),
- webtool:stop().
-
-
-
-%%%----------------------------------------------------------------------
-%%% API - called from webtool
-%%%----------------------------------------------------------------------
-start_link() ->
- gen_server:start_link({local, webcover_server},cover_web, [], []).
-
-
-nodes_frame(Env,Input)->
- call({nodes_frame,Env,Input}).
-
-add_node(Env,Input)->
- call({add_node,Env,Input}).
-
-remove_node(Env,Input)->
- call({remove_node,Env,Input}).
-
-compile_frame(Env,Input)->
- call({compile_frame,Env,Input}).
-
-list_dir(Env,Input) ->
- call({list_dir,Env,Input}).
-
-compile(Env,Input)->
- call({compile,Env,Input},?MAX_COMPILE_TIME).
-
-result_frame(Env,Input)->
- call({result_frame,Env,Input}).
-
-result(Env,Input) ->
- call({result,Env,Input},?MAX_ANALYSE_TIME).
-
-calls(Env,Input) ->
- call({calls,Env,Input}).
-
-coverage(Env,Input) ->
- call({coverage,Env,Input}).
-
-import_frame(Env,Input)->
- call({import_frame,Env,Input}).
-
-import(Env,Input)->
- call({import,Env,Input}).
-
-menu_frame(Env,Input)->
- call({menu_frame,Env,Input}).
-
-call(Msg) ->
- call(Msg,?DEFAULT_TIME).
-call(Msg,Time) ->
- gen_server:call(webcover_server,Msg,Time).
-
-
-
-configData()->
- {webcover,[{web_data,{"WebCover","/webcover"}},
- {alias,{"/webcover",code:priv_dir(tools)}},
- {alias,{erl_alias,"/webcover/erl",[cover_web]}},
- {start,{child,{{local,webcover_server},
- {cover_web,start_link,[]},
- permanent,100,worker,[cover_web]}}}
- ]}.
-
-
-%%%----------------------------------------------------------------------
-%%% Callback functions from gen_server
-%%%----------------------------------------------------------------------
-
-%%----------------------------------------------------------------------
-%% Func: init/1
-%% Returns: {ok, State} |
-%% {ok, State, Timeout} |
-%% ignore |
-%% {stop, Reason}
-%%----------------------------------------------------------------------
-init([]) ->
- cover:start(),
- CS = whereis(cover_server),
- link(CS),
- GL = spawn_link(fun group_leader_proc/0),
- group_leader(GL,CS),
-
- %% Must trap exists in order to have terminate/2 executed when
- %% crashing because of a linked process crash.
- process_flag(trap_exit,true),
- {ok,Cwd} = file:get_cwd(),
- {ok, #state{dir=Cwd}}.
-
-group_leader_proc() ->
- register(cover_group_leader_proc,self()),
- group_leader_loop([]).
-group_leader_loop(Warnings) ->
- receive
- {io_request,From,ReplyAs,{put_chars,io_lib,Func,[Format,Args]}} ->
- Msg = (catch io_lib:Func(Format,Args)),
- From ! {io_reply,ReplyAs,ok},
- case lists:member(Msg,Warnings) of
- true -> group_leader_loop(Warnings);
- false -> group_leader_loop([Msg|Warnings])
- end;
- {io_request,From,ReplyAs,{put_chars,_Encoding,io_lib,Func,[Format,Args]}} ->
- Msg = (catch io_lib:Func(Format,Args)),
- From ! {io_reply,ReplyAs,ok},
- case lists:member(Msg,Warnings) of
- true -> group_leader_loop(Warnings);
- false -> group_leader_loop([Msg|Warnings])
- end;
- IoReq when element(1,IoReq)=:= io_request ->
- group_leader() ! IoReq,
- group_leader_loop(Warnings);
- {From,get_warnings} ->
- Warnings1 =
- receive
- {io_request,From,ReplyAs,
- {put_chars,io_lib,Func,[Format,Args]}} ->
- Msg = (catch io_lib:Func(Format,Args)),
- From ! {io_reply,ReplyAs,ok},
- case lists:member(Msg,Warnings) of
- true -> Warnings;
- false -> [Msg|Warnings]
- end
- after 0 ->
- Warnings
- end,
- From ! {warnings,Warnings1},
- group_leader_loop([])
- end.
-
-%%----------------------------------------------------------------------
-%% Func: handle_call/3
-%% Returns: {reply, Reply, State} |
-%% {reply, Reply, State, Timeout} |
-%% {noreply, State} |
-%% {noreply, State, Timeout} |
-%% {stop, Reason, Reply, State} | (terminate/2 is called)
-%% {stop, Reason, State} (terminate/2 is called)
-%%----------------------------------------------------------------------
-handle_call({nodes_frame,_Env,_Input},_From,State)->
- {reply,nodes_frame1(),State};
-
-handle_call({add_node,_Env,Input},_From,State)->
- {reply,do_add_node(Input),State};
-
-handle_call({remove_node,_Env,Input},_From,State)->
- {reply,do_remove_node(Input),State};
-
-handle_call({compile_frame,_Env,_Input},_From,State)->
- {reply,compile_frame1(State#state.dir),State};
-
-handle_call({list_dir,_Env,Input},_From,State)->
- Dir = get_input_data(Input,"path"),
- case filelib:is_dir(Dir) of
- true ->
- {reply,compile_frame1(Dir),State#state{dir=Dir}};
- false ->
- Err = Dir ++ " is not a directory",
- {reply,compile_frame1(State#state.dir,Err),State}
- end;
-handle_call({compile,_Env,Input},_From,State)->
- {reply,do_compile(Input,State#state.dir),State};
-
-handle_call({result_frame,_Env,_Input},_From,State)->
- {reply,result_frame1(),State};
-
-handle_call({result,_Env,Input},_From,State)->
- {reply,handle_result(Input),State};
-
-handle_call({calls,_Env,Input},_From,State)->
- {reply,call_page(Input),State};
-
-handle_call({coverage,_Env,Input},_From,State)->
- {reply,coverage_page(Input),State};
-
-handle_call({import_frame,_Env,_Input},_From,State)->
- {ok,Cwd} = file:get_cwd(),
- {reply,import_frame1(Cwd),State};
-
-handle_call({import,_Env,Input},_From,State)->
- {reply,do_import(Input),State};
-
-handle_call({menu_frame,_Env,_Input},_From,State)->
- {reply,menu_frame1(),State};
-
-handle_call(_Request, _From, State) ->
- Reply = bad_request,
- {reply, Reply, State}.
-
-
-%%----------------------------------------------------------------------
-%% Func: handle_cast/2
-%% Returns: {noreply, State} |
-%% {noreply, State, Timeout} |
-%% {stop, Reason, State} (terminate/2 is called)
-%%----------------------------------------------------------------------
-handle_cast(_Msg, State) ->
- {noreply, State}.
-
-%%----------------------------------------------------------------------
-%% Func: handle_info/2
-%% Returns: {noreply, State} |
-%% {noreply, State, Timeout} |
-%% {stop, Reason, State} (terminate/2 is called)
-%%----------------------------------------------------------------------
-handle_info({'EXIT',_Pid,Reason}, State) ->
- {stop, Reason, State}.
-
-%%----------------------------------------------------------------------
-%% Func: terminate/2
-%% Purpose: Shutdown the server
-%% Returns: any (ignored by gen_server)
-%%----------------------------------------------------------------------
-terminate(_Reason, _State) ->
- cover:stop(),
- ok.
-
-%%--------------------------------------------------------------------
-%% Func: code_change/3
-%% Purpose: Convert process state when code is changed
-%% Returns: {ok, NewState}
-%%--------------------------------------------------------------------
-code_change(_OldVsn, State, _Extra) ->
- {ok, State}.
-
-%%%----------------------------------------------------------------------
-%%% Internal functions
-%%%----------------------------------------------------------------------
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% %%
-%% The functions that creates the whole pages by collecting all the %%
-%% neccessary data for each page. These functions are the public %%
-%% interface. %%
-%% %%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%----------------------------------------------------------------------
-%% Returns the page to the left frame
-%%----------------------------------------------------------------------
-menu_frame1()->
- [header(),html_header(""),menu_body(),html_end()].
-
-%%----------------------------------------------------------------------
-%% Creates the page where the user can add and remove nodes
-%%----------------------------------------------------------------------
-
-nodes_frame1()->
- nodes_frame1([]).
-nodes_frame1(Err)->
- [header(),html_header("Add/remove nodes"),nodes_body(Err),html_end()].
-
-%%----------------------------------------------------------------------
-%% Creates the page where the user can cover compile modules
-%%----------------------------------------------------------------------
-
-compile_frame1(Dir)->
- compile_frame1(Dir,[]).
-compile_frame1(Dir,Err) ->
- [header(),html_header("Cover compile"),compile_body(Dir,Err),html_end()].
-
-%%----------------------------------------------------------------------
-%% Creates the page where the user can handle results
-%%----------------------------------------------------------------------
-
-result_frame1()->
- result_frame1([]).
-result_frame1(Err) ->
- [header(),html_header("Show cover results"),result_body(Err),html_end()].
-
-%%----------------------------------------------------------------------
-%%The beginning of the page that clear the cover information on a cover
-%%compiled module
-%%----------------------------------------------------------------------
-call_page(Input)->
- [header(),html_header("Code coverage"),call_result(Input),html_end()].
-
-coverage_page(Input)->
- [header(),html_header("Code coverage"),coverage_result(Input),html_end()].
-
-%%----------------------------------------------------------------------
-%% Creates the page where the user an import files
-%%----------------------------------------------------------------------
-import_frame1(Dir) ->
- import_frame1(Dir,"").
-import_frame1(Dir,Err) ->
- [header(),html_header("Import coverdata"),import_body(Dir,Err),html_end()].
-
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% %%
-%% The functions that build the body of the menu frame %%
-%% %%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-menu_body() ->
- Nodes = cover:which_nodes(),
- Modules = cover:modules(),
- Imported = cover:imported(),
- ["<A HREF=\"./nodes_frame\" TARGET=\"main\">Nodes</A><BR>\n",
- "<A HREF=\"./compile_frame\" TARGET=\"main\">Compile</A><BR>\n",
- "<A HREF=\"./import_frame\" TARGET=\"main\">Import</A><BR>\n",
- "<A HREF=\"./result_frame\" TARGET=\"main\">Result</A>\n",
- "<P><B>Nodes:</B>\n",
- "<UL>\n",
- lists:map(fun(N) -> "<LI>"++atom_to_list(N)++"</LI>\n" end,[node()|Nodes]),
- "</UL>\n",
- "<P><B>Compiled modules:</B>\n",
- "<UL>\n",
- lists:map(fun(M) -> "<LI>"++atom_to_list(M)++"</LI>\n" end,Modules),
- "</UL>\n",
- "<P><B>Imported files:</B>\n",
- "<UL>\n",
- "<FONT SIZE=-1>\n",
- lists:map(fun(F) ->
- Short = filename:basename(F),
- "<LI TITLE=\""++F++"\">"++Short++"</LI>\n" end,Imported),
- "</FONT>\n",
- "</UL>\n"].
-
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% %%
-%% The functions that build the body of the nodes frame %%
-%% %%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-nodes_body(Err) ->
- CN = cover:which_nodes(),
- Fun = fun(N) ->
- NStr = atom_to_list(N),
- ["<OPTION VALUE=",NStr,
- " onClick=\"node.value=selected_node.value\">",NStr,
- "</OPTION>\n"]
- end,
- AllNodes = lists:append(lists:map(Fun,nodes()--CN)),
- CoverNodes = lists:append(lists:map(Fun,CN)),
-
- [reload_menu_script(Err),
- "<H1 ALIGN=center>Nodes</H1>\n",
- "<TABLE BORDER=0 WIDTH=600 ALIGN=center>\n",
- "<TR><TD BGCOLOR=",?INFO_BG_COLOR," COLSPAN=2>\n",
- "<P>You can run cover over several nodes simultaneously. Coverage data\n",
- "from all involved nodes will be merged during analysis.\n",
- "<P>Select or enter node names to add or remove here.\n",
- "</TD></TR>\n",
- "<TR><TD COLSPAN=2><BR><BR></TD></TR>\n",
- "<FORM ACTION=\"./add_node\" NAME=add_node>\n",
- "<TR><TD VALIGN=top>Add node:</TD>\n",
- "<TD><INPUT TYPE=text NAME=\"node\" SIZE=40 >",
- "<INPUT TYPE=submit\n",
- " onClick=\"if(!node.value){node.value=selected_node.value};\" VALUE=Add>"
- "<BR><SELECT NAME=selected_node TITLE=\"Select node\">\n",
- AllNodes ++
- "</SELECT>\n",
- "</TD></TR>\n"
- "</FORM>\n",
- "<TR><TD COLSPAN=2><BR><BR></TD></TR>\n",
- "<FORM ACTION=\"./remove_node\" NAME=remove_node>\n",
- "<TR><TD>Remove node:</TD>\n",
- "<TD><SELECT NAME=node TITLE=\"Select node\">\n",
- CoverNodes ++
- "</SELECT>\n",
- "<INPUT TYPE=submit VALUE=Remove>"
- "</TD></TR>\n",
- "</FORM>",
- "</TABLE>"].
-
-
-do_add_node(Input) ->
- NodeStr = get_input_data(Input, "node"),
- Node = list_to_atom(NodeStr),
- case net_adm:ping(Node) of
- pong ->
- cover:start(Node),
- nodes_frame1();
- pang ->
- nodes_frame1("Node \\\'" ++ NodeStr ++ "\\\' is not alive")
- end.
-
-do_remove_node(Input) ->
- Node = list_to_atom(get_input_data(Input, "node")),
- cover:stop(Node),
- nodes_frame1().
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% %
-% The functions that is used when the user wants to compile something %
-% %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-compile_body(Dir,Err) ->
- Erls = filelib:wildcard(filename:join(Dir,"*.erl")),
- Beams = filelib:wildcard(filename:join(Dir,"*.beam")),
-
- [reload_menu_script(Err),
- "<H1 ALIGN=center>Compile</H1>\n",
- "<TABLE WIDTH=600 ALIGN=center BORDER=0>\n",
- "<TR><TD COLSPAN=3 BGCOLOR=",?INFO_BG_COLOR,">\n",
- "Each module which shall be part of the cover analysis must be prepared\n",
- "or 'cover compiled'. On this page you can select .erl files and/or\n",
- ".beam files to include in the analysis. If you select a .erl file it\n",
- "will first be compiled with the Erlang compiler and then prepared for\n",
- "coverage analysis. If you select a .beam file it will be prepared for\n",
- "coverage analysis directly.\n",
- "</TD></TR>\n",
- "<FORM ACTION=\"./list_dir\" NAME=list_dir>\n",
- "<TR><TD WIDTH=30% BGCOLOR=",?INFO_BG_COLOR," ROWSPAN=2>\n",
- "To list a different directory, enter the directory name here.\n",
- "</TD>\n",
- "<TH COLSPAN=2><BR>List directory:<BR></TH>\n",
- "</TR>\n",
- "<TR><TD ALIGN=center COLSPAN=2>\n",
- "<INPUT TYPE=text NAME=\"path\" SIZE=40 VALUE=",Dir,">",
- "<INPUT TYPE=submit VALUE=Ok>",
- "<BR><BR></TD></TR>\n",
- "</FORM>\n",
- "<FORM ACTION=\"./compile\" NAME=compile_selection>\n",
- "<TR><TD BGCOLOR=",?INFO_BG_COLOR," ROWSPAN=2>\n",
- "<P>Select one or more .erl or .beam files to prepare for coverage\n"
- "analysis, and click the \"Compile\" button.\n",
- "<P>To reload the original file after coverage analysis is complete,\n"
- "select one or more files and click the \"Uncompile\" button, or\n",
- "simply click the \"Uncompile all\" button to reload all originals.\n"
- "</TD>\n",
- "<TH>.erl files</TH><TH>.beam files</TH></TR>\n",
- "<TR><TD ALIGN=center VALIGN=top>\n",
- "<SELECT NAME=erl TITLE=\"Select .erl files to compile\" MULTIPLE=true",
- " SIZE=15>\n",
- list_modules(Erls) ++
- "</SELECT></TD>\n",
- "<TD ALIGN=center VALIGN=top>\n",
- "<SELECT NAME=beam TITLE=\"Select .beam files to compile\"MULTIPLE=true",
- " SIZE=15>\n",
- list_modules(Beams) ++
- "</SELECT></TD></TR>\n"
- "<TR><TD BGCOLOR=",?INFO_BG_COLOR," ROWSPAN=2>\n",
- "Compile options are only needed for .erl files. The options must be\n"
- "given e.g. like this: \n"
- "<FONT SIZE=-1>[{i,\"/my/path/include\"},{i,\"/other/path/\"}]</FONT>\n"
- "</TD>\n",
- "<TH COLSPAN=2><BR>Compile options:<BR></TH>\n",
- "</TR>\n",
- "<TR><TD COLSPAN=2 ALIGN=center>\n",
- "<INPUT TYPE=text NAME=\"options\" SIZE=40>\n",
- "<INPUT TYPE=hidden NAME=\"action\"></TD></TR>\n",
- "<TR><TD></TD><TD ALIGN=center COLSPAN=2>\n",
- "<INPUT TYPE=submit onClick=\"action.value=\'compile\';\"VALUE=Compile>",
- "<INPUT TYPE=submit onClick=\"action.value=\'uncompile\';\" ",
- "VALUE=Uncompile>",
- "<INPUT TYPE=submit onClick=\"action.value=\'uncompile_all\';\" ",
- "VALUE=\"Uncompile all\">",
- "<BR><INPUT TYPE=reset VALUE=\"Reset form\"></TD></TR>\n",
- "</FORM>\n",
- "</TABLE>\n"].
-
-list_modules([File|Files]) ->
- Mod = filename:basename(File),
- ["<OPTION VALUE=",File," onDblClick=\"action.value=\'compile\';submit();\">",
- Mod,"</OPTION>\n" | list_modules(Files)];
-list_modules([]) ->
- [].
-
-do_compile(Input,Dir) ->
- {Erls,Beams,Opts,Action} = get_compile_input(parse(Input),[],[]),
- Errs =
- case Action of
- "compile" ->
- do_compile(Erls,Beams,Opts,[]);
- "uncompile" ->
- do_uncompile(Erls++Beams);
- "uncompile_all" ->
- do_uncompile(cover:modules())
- end,
- compile_frame1(Dir,Errs).
-
-get_compile_input([{"erl",File}|Input],Erl,Beam) ->
- get_compile_input(Input,[File|Erl],Beam);
-get_compile_input([{"beam",File}|Input],Erl,Beam) ->
- get_compile_input(Input,Erl,[File|Beam]);
-get_compile_input([{"options",Opts0},{"action",Action}],Erl,Beam) ->
- Opts = parse_options(Opts0),
- {Erl,Beam,Opts,Action}.
-
-do_compile([Erl|Erls],Beams,Opts,Errs) ->
- case cover:compile_module(Erl,Opts) of
- {ok,_} ->
- do_compile(Erls,Beams,Opts,Errs);
- {error,File} ->
- do_compile(Erls,Beams,Opts,["\\n"++File|Errs])
- end;
-do_compile([],[Beam|Beams],Opts,Errs) ->
- case cover:compile_beam(Beam) of
- {ok,_} ->
- do_compile([],Beams,Opts,Errs);
- {error,{no_abstract_code,File}} ->
- do_compile([],Beams,Opts,["\\n"++File++" (no_abstract_code)"|Errs])
- end;
-do_compile([],[],_,[]) ->
- [];
-do_compile([],[],_,Errs) ->
- "Compilation failed for the following files:" ++ Errs.
-
-parse_options(Options)->
- case erl_scan:string(Options ++".") of
- {ok,Tokens,_Line} ->
- case erl_parse:parse_exprs(Tokens) of
- {ok,X}->
- case lists:map(fun erl_parse:normalise/1, X) of
- [List] when is_list(List) -> List;
- List -> List
- end;
- _ ->
- []
- end;
- _ ->
- []
- end.
-
-
-do_uncompile(Files) ->
- lists:foreach(
- fun(File) ->
- Module =
- if is_atom(File) ->
- File;
- true ->
- ModStr = filename:basename(filename:rootname(File)),
- list_to_atom(ModStr)
- end,
- case code:which(Module) of
- cover_compiled ->
- code:purge(Module),
- case code:load_file(Module) of
- {module, Module} ->
- ok;
- {error, _Reason2} ->
- code:delete(Module)
- end;
- _ ->
- ok
- end
- end,
- Files),
- [].
-
-
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% %
-% The functions that builds the body of the page for coverage analysis%
-% %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-result_body(Err) ->
- [reload_menu_script(Err),
- "<H1 ALIGN=center>Result</H1>\n",
- "<TABLE BORDER=0 WIDTH=600 ALIGN=center>\n",
- "<TR><TD BGCOLOR=",?INFO_BG_COLOR,">\n",
- "<P>After executing all your tests you can view the result of the\n",
- "coverage analysis here. For each module you can\n",
- "<DL>\n",
- "<DT><B>Analyse to file</B></DT>\n",
- "<DD>The source code of the module is shown with the number of calls\n",
- "to each line stated in the left margin. Lines which are never called\n",
- "are colored red.</DD>\n",
- "<DT><B>Analyse coverage</B></DT>\n",
- "<DD>Show the number of covered and uncovered lines in the module.</DD>\n",
- "<DT><B>Analyse calls</B></DT>\n",
- "<DD>Show the number of calls in the module.</DD>\n",
- "<DT><B>Reset module</B></DT>\n",
- "<DD>Delete all coverage data for the module.</DD>\n",
- "<DT><B>Export module</B></DT>\n",
- "<DD>Write all coverage data for the module to a file. The data can\n",
- "later be imported from the \"Import\" page.</DD>\n",
- "</DL>\n",
- "<P>You can also reset or export data for all modules with the\n",
- "<B>Reset all</B> and <B>Export all</B> actions respectively. For these\n",
- "two actions there is no need to select a module.\n",
- "<P>Select module and action from the drop down menus below, and click\n",
- "the \"Execute\" button.\n",
- "</TD></TR>\n",
- "<TR><TD><BR><BR>\n",
- result_selections(),
- "</TD></TR></TABLE>"].
-
-result_selections() ->
- ModList = filter_modlist(cover:modules()++cover:imported_modules(),[]),
-
- ["<FORM ACTION=\"./result\" NAME=result_selection>\n",
- "<TABLE WIDTH=\"300\" BORDER=0 ALIGN=center>\n",
- "<TR><TD ALIGN=left>\n",
- "Module:\n",
- "<BR><SELECT NAME=module TITLE=\"Select module\">\n",
- ModList ++
- "</SELECT>\n",
- "</TD>\n",
- "<TD ALIGN=left>\n",
- "Action:\n",
- "<BR><SELECT NAME=action TITLE=\"Select action\">\n",
- "<OPTION VALUE=\"analyse_to_file\">Analyse to file</OPTION>\n"
- "<OPTION VALUE=\"coverage\">Analyse coverage</OPTION>\n"
- "<OPTION VALUE=\"calls\">Analyse calls</OPTION>\n"
- "<OPTION VALUE=\"reset\">Reset module</OPTION>\n"
- "<OPTION VALUE=\"reset_all\">Reset all</OPTION>\n"
- "<OPTION VALUE=\"export\">Export module</OPTION>\n"
- "<OPTION VALUE=\"export_all\">Export all</OPTION>\n"
- "</SELECT>\n",
- "</TD>\n",
- "<TD ALIGN=center VALIGN=bottom><INPUT TYPE=submit VALUE=Execute>\n"
- "</TD></TR>\n"
- "</TABLE>\n",
- "</FORM>\n"].
-
-filter_modlist([M|Ms],Already) ->
- case lists:member(M,Already) of
- true ->
- filter_modlist(Ms,Already);
- false ->
- MStr = atom_to_list(M),
- ["<OPTION VALUE=",MStr,">",MStr,"</OPTION>\n" |
- filter_modlist(Ms,[M|Already])]
- end;
-filter_modlist([],_Already) ->
- [].
-
-
-
-handle_result(Input) ->
- case parse(Input) of
- [{"module",M},{"action",A}] ->
- case A of
- "analyse_to_file" ->
- case cover:analyse_to_file(list_to_atom(M),[html]) of
- {ok,File} ->
- case file:read_file(File) of
- {ok,HTML}->
- file:delete(File),
- [header(),
- reload_menu_script(""),
- binary_to_list(HTML)];
- _ ->
- result_frame1("Can not read file" ++ File)
- end;
- {error,no_source_code_found} ->
- result_frame1("No source code found for \\\'" ++
- M ++ "\\\'")
- end;
- "calls" ->
- call_page(Input);
- "coverage" ->
- coverage_page(Input);
- "reset" ->
- cover:reset(list_to_atom(M)),
- result_frame1("Coverage data for \\\'" ++ M ++
- "\\\' is now reset");
- "reset_all" ->
- cover:reset(),
- result_frame1("All coverage data is now reset");
- "export" ->
- ExportFile = generate_filename(M),
- cover:export(ExportFile,list_to_atom(M)),
- result_frame1("Coverage data for \\\'" ++ M ++
- "\\\' is now exported to file \\\"" ++
- ExportFile ++ "\\\"");
- "export_all" ->
- ExportFile = generate_filename("COVER"),
- cover:export(ExportFile),
- result_frame1(
- "All coverage data is now exported to file \\\"" ++
- ExportFile ++ "\\\"")
- end;
- [{"action",_A}] ->
- result_frame1("No module is selected")
- end.
-
-generate_filename(Prefix) ->
- {ok,Cwd} = file:get_cwd(),
- filename:join(Cwd,Prefix ++ "_" ++ ts() ++ ".coverdata").
-
-ts() ->
- {{Y,M,D},{H,Min,S}} = calendar:now_to_local_time(erlang:timestamp()),
- io_lib:format("~4.4.0w~2.2.0w~2.2.0w-~2.2.0w~2.2.0w~2.2.0w",
- [Y,M,D,H,Min,S]).
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% %
-% The functions that builds the body of the page that shows the calls %
-% %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-call_result(Input)->
- Mod = list_to_atom(get_input_data(Input, "module")),
- case cover:analyse(Mod,calls) of
- {error,_}->
- error_body();
- {ok,_} ->
- call_result2(Mod,Input)
- end.
-
-call_result2(Mod,Input)->
- Result =
- case get_input_data(Input,"what") of
- "mod" ->
- call_result(mod,Mod);
- "func" ->
- call_result(func,Mod);
- "clause" ->
- call_result(clause,Mod);
- _->
- call_result(all,Mod)
- end,
- result_choice("calls",Mod) ++ Result.
-
-result_choice(Level,Mod)->
- ModStr=atom_to_list(Mod),
- [reload_menu_script(""),
- "<TABLE WIDTH=100%><TR>\n",
- "<TD><A HREF=./",Level,"?module=",ModStr,"&what=all>All Data</A></TD>\n",
- "<TD><A HREF=./",Level,"?module=",ModStr,"&what=mod>Module</A></TD>\n",
- "<TD><A HREF=./",Level,"?module=",ModStr,"&what=func>Function</A></TD>\n",
- "<TD><A HREF=./",Level,"?module=",ModStr,"&what=clause>Clause</A></TD>\n",
- "</TR></TABLE><BR>\n"].
-
-call_result(Mode,Module)->
- Content =
- case Mode of
- mod->
- format_cover_call(cover:analyse(Module,calls,module),mod);
- func->
- format_cover_call(cover:analyse(Module,calls,function),func);
- clause->
- format_cover_call(cover:analyse(Module,calls,clause),clause);
- _->
- format_cover_call(cover:analyse(Module,calls,module),mod) ++
- format_cover_call(cover:analyse(Module,calls,function),func)++
- format_cover_call(cover:analyse(Module,calls,clause),clause)
- end,
- getModDate(Module,date())++"<BR>"++
- "<TABLE WIDTH=\"100%\" BORDER=1>"
- ++ Content ++"</TABLE>".
-
-
-format_cover_call({error,_},_)->
- ["<TR><TD>\n",
- "<BR><BR><BR><BR>\n",
- "<FONT SIZE=5>The selected module is not Cover Compiled</FONT>\n",
- "<BR>\n",
- "</TD></TR>\n"];
-
-format_cover_call({ok,{Mod,Calls}},mod)->
- ["<TR BGCOLOR=\"#8899AA\"><TD COLSPAN=5><B>Module calls</B></TD></TR>\n",
- "<TR><TD COLSPAN=4><I>Module</I></TD>",
- "<TD ALIGN=\"right\"><I>Number of calls</I></TD></TR>\n",
- "<TR><TD COLSPAN=4>" ++ atom_to_list(Mod) ++"</TD>"
- "<TD ALIGN=\"right\">" ++ integer_to_list(Calls)++"</TD></TR>\n"];
-
-format_cover_call({ok,Calls},func)->
- ["<TR BGCOLOR=\"#8899AA\"><TD COLSPAN=5><B>Function calls</B></TD></TR>\n",
- "<TR><TD><I>Module</I></TD><TD><I>Function</I></TD>",
- "<TD COLSPAN=2 ALIGN=\"right\"><I>Arity</I></TD>",
- "<TD ALIGN=\"right\"><I>Number of calls </I></TD></TR>\n",
- lists:append(
- lists:map(
- fun({{Mod,Func,Arity},Nr_of_calls})->
- ["<TR><TD WIDTH=\"20%\">"++ atom_to_list(Mod)++"</TD>\n",
- "<TD WIDTH=\"20%\" >" ++ atom_to_list(Func) ++" </TD>\n",
- "<TD COLSPAN=2 WIDTH=\"40%\" ALIGN=\"right\">",
- integer_to_list(Arity),
- "</TD>\n",
- "<TD WIDTH=\"20%\" ALIGN=\"right\">",
- integer_to_list(Nr_of_calls),
- "</TD></TR>\n"]
- end,
- Calls))];
-
-format_cover_call({ok,Calls},clause)->
- ["<TR BGCOLOR=\"#8899AA\"><TD COLSPAN=5><B>Clause calls</B></TD></TR>\n",
- "<TR><TD><I>Module</I></TD><TD><I>Function</I></TD>",
- "<TD ALIGN=\"right\"><I>Arity</I></TD>",
- "<TD ALIGN=\"right\"><I>Ordinal</I></TD>",
- "<TD ALIGN=\"right\"><I>Number of calls</I></TD></TR>\n",
- lists:append(
- lists:map(
- fun({{Mod,Func,Arity,Ord},Nr_of_calls})->
- ["<TR><TD WIDTH=\"20%\" >", atom_to_list(Mod), "</TD>\n",
- "<TD WIDTH=\"20%\" >", atom_to_list(Func), "</TD>\n",
- "<TD WIDTH=\"20%\" ALIGN=\"right\">",
- integer_to_list(Arity),
- "</TD>\n",
- "<TD WIDTH=\"20%\" ALIGN=\"right\">",
- integer_to_list(Ord),
- "</TD>\n",
- "<TD WIDTH=\"20%\" ALIGN=\"right\">",
- integer_to_list(Nr_of_calls),
- "</TD></TR>\n"]
- end,
- Calls))].
-
-
-error_body()->
- ["<TABLE WIDTH=\"100%\" BORDER=1>\n",
- "<TR ALIGN=\"center\">\n",
- "<TD>\n",
- "<BR><BR><BR><BR><BR><BR>\n",
- "<FONT SIZE=5>The selected module is not Cover Compiled</FONT>\n",
- "<BR>\n",
- "</TD>\n",
- "</TR>\n",
- "</TABLE>\n"].
-
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% %
-% The functions that builds the body of the page that shows coverage %
-% %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-coverage_result(Input)->
- Mod = list_to_atom(get_input_data(Input, "module")),
- case cover:analyse(Mod,coverage) of
- {error,_}->
- error_body();
- {ok,_} ->
- coverage_result2(Mod,Input)
- end.
-
-coverage_result2(Mod,Input)->
- Result =
- case get_input_data(Input,"what") of
- "mod" ->
- coverage_result(mod,Mod);
- "func" ->
- coverage_result(func,Mod);
- "clause" ->
- coverage_result(clause,Mod);
- _->
- coverage_result(all,Mod)
- end,
- result_choice("coverage",Mod) ++ Result.
-
-coverage_result(Mode,Module)->
- Content =
- case Mode of
- mod->
- format_cover_coverage(cover:analyse(Module,coverage,module),
- mod);
- func->
- format_cover_coverage(cover:analyse(Module,coverage,function),
- func);
- clause->
- format_cover_coverage(cover:analyse(Module,coverage,clause),
- clause);
- _->
- format_cover_coverage(cover:analyse(Module,coverage,module),
- mod) ++
- format_cover_coverage(cover:analyse(Module,coverage,function),
- func)++
- format_cover_coverage(cover:analyse(Module,coverage,clause),
- clause)
- end,
- getModDate(Module,date())++"<BR>"++
- "<TABLE WIDTH=\"100%\" BORDER=1>"
- ++ Content ++"</TABLE>".
-
-getModDate(Module,{Year,Mon,Day})->
- "<TABLE>
- <TR>
- <TD>Module:</TD>
- <TD>" ++ atom_to_list(Module) ++ "</TD>
- </TR>
- <TR>
- <TD>Date:</TD>
- <TD>" ++ integer_to_list(Day) ++ "/" ++
- integer_to_list(Mon) ++"&nbsp;-&nbsp;"++
- integer_to_list(Year) ++
- "</TD>
- </TR>
- </TABLE>".
-
-
-format_cover_coverage({error,_},_)->
- "<TR><TD>
- <BR><BR><BR><BR>
- <FONT SIZE=5>The selected module is not Cover Compiled</FONT>
- <BR>
- </TD></TR>";
-
-
-format_cover_coverage({ok,{Mod,{Cov,Not_cov}}},mod)->
- ["<TR BGCOLOR=\"#8899AA\"><TD COLSPAN=6><B>Module coverage</B></TD></TR>\n",
- "<TR><TD COLSPAN=4><I>Module</I></TD>\n",
- "<TD ALIGN=\"right\"><I>Covered</I></TD>\n"
- "<TD ALIGN=\"RIGHT\" NOWRAP=\"true\"><I>Not Covered</I></TD>\n",
- "</TR>\n",
- "<TR><TD COLSPAN=4>", atom_to_list(Mod), "</TD>\n"
- "<TD ALIGN=\"right\">", integer_to_list(Cov), "</TD>\n"
- "<TD ALIGN=\"right\" >", integer_to_list(Not_cov), "</TD></TR>\n"];
-
-format_cover_coverage({ok,Cov_res},func)->
- ["<TR BGCOLOR=\"#8899AA\"><TD COLSPAN=6><B>Function coverage</B></TD>\n",
- "</TR>\n",
- "<TR><TD><I>Module</I></TD><TD><I>Function</I></TD>",
- "<TD ALIGN=\"right\"><I>Arity</I></TD>",
- "<TD COLSPAN=2 ALIGN=\"right\"><I>Covered</I></TD>",
- "<TD ALIGN=\"right\" STYLE=\"white-space:nowrap\"><I>Not Covered</I></TD>",
- "</TR>\n",
- lists:append(
- lists:map(
- fun({{Mod,Func,Arity},{Cov,Not_cov}})->
- ["<TR><TD WIDTH=\"20%\" >"++ atom_to_list(Mod) ++" </TD>\n",
- "<TD WIDTH=\"20%\" >" ++ atom_to_list(Func) ++"</TD>\n",
- "<TD WIDTH=\"40%\" ALIGN=\"right\">",
- integer_to_list(Arity),
- "</TD>\n",
- "<TD WIDTH=\"40%\" ALIGN=\"right\" COLSPAN=2>",
- integer_to_list(Cov),
- "</TD>\n"
- "<TD WIDTH=\"20%\" ALIGN=\"right\">",
- integer_to_list(Not_cov),
- "</TD></TR>\n"]
- end,
- Cov_res))];
-
-format_cover_coverage({ok,Cov_res},clause)->
- ["<TR BGCOLOR=\"#8899AA\"><TD COLSPAN=6><B>Clause coverage</B></TD></TR>\n",
- "<TR><TD><I>Module</I></TD><TD><I>Function</I></TD>\n",
- "<TD ALIGN=\"right\"><I>Arity</I></TD>\n",
- "<TD ALIGN=\"right\"><I>Ordinal<I></TD>\n",
- "<TD ALIGN=\"right\">Covered</TD>\n",
- "<TD ALIGN=\"right\" STYLE=\"white-space:nowrap\">Not Covered</TD></TR>\n",
- lists:append(
- lists:map(
- fun({{Mod,Func,Arity,Ord},{Cov,Not_cov}})->
- ["<TR><TD WIDTH=\"20%\" >"++ atom_to_list(Mod) ++"</TD>\n",
- "<TD WIDTH=\"20%\" >" ++ atom_to_list(Func) ++" </TD>\n",
- "<TD WIDTH=\"20%\" ALIGN=\"right\">",
- integer_to_list(Arity),
- "</TD>\n"
- "<TD WIDTH=\"20%\" ALIGN=\"right\">",
- integer_to_list(Ord),
- "</TD>\n"
- "<TD WIDTH=\"20%\" ALIGN=\"right\">",
- integer_to_list(Cov),
- "</TD>\n"
- "<TD WIDTH=\"20%\" ALIGN=\"right\">",
- integer_to_list(Not_cov),
- "</TD></TR>\n"]
- end,
- Cov_res))].
-
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% %
-% The functions that builds the body of the import page %
-% %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-import_body(Dir,Err) ->
- [reload_menu_script(Err),
- "<H1 ALIGN=center>Import</H1>\n",
- "<TABLE BORDER=0 WIDTH=600 ALIGN=center>\n",
- "<TR><TD BGCOLOR=",?INFO_BG_COLOR,">\n",
- "<P>You can import coverage data from a previous analysis. If you do so\n",
- "the imported data will be merged with the current coverage data.\n",
- "<P>You can export data from the current analysis from the \"Result\"\n",
- "page.\n",
- "<P>Select the file to import here.\n",
- "</TD></TR>\n",
- "<TR><TD ALIGN=center><BR><BR>\n",
- "<FORM NAME=change_import_dir METHOD=post ACTION=\"./import\">\n",
- "<B>Change directory:</B><BR>\n",
- "<INPUT TYPE=text NAME=\"file\" SIZE=30 VALUE=",Dir,">",
- "<INPUT TYPE=hidden NAME=dir VALUE=",Dir,">\n",
- "<INPUT TYPE=submit VALUE=Ok><BR>\n",
- "</FORM>\n",
- browse_import(Dir),
- "</TABLE>"].
-
-browse_import(Dir) ->
- {ok,List} = file:list_dir(Dir),
- Sorted = lists:reverse(lists:sort(List)),
- {Dirs,Files} = filter_files(Dir,Sorted,[],[]),
- ["<FORM NAME=browse_import METHOD=post ACTION=\"./import\">\n"
- "<SELECT NAME=file TITLE=\"Select import file\" SIZE=10>\n",
- "<OPTION VALUE=\"..\" onDblClick=submit()>../</OPTION>\n",
- Dirs,
- Files,
- "</SELECT>\n",
- "<INPUT TYPE=hidden NAME=dir VALUE=",Dir,">\n",
- "<BR><INPUT TYPE=submit VALUE=Ok>\n"
- "</FORM>\n"].
-
-filter_files(Dir,[File|Files],Ds,Fs) ->
- case filename:extension(File) of
- ".coverdata" ->
- Fs1 = ["<OPTION VALUE=",File," onDblClick=submit()>",
- File,"</OPTION>\n" | Fs],
- filter_files(Dir,Files,Ds,Fs1);
- _ ->
- FullName = filename:join(Dir,File),
- case filelib:is_dir(FullName) of
- true ->
- Ds1 = ["<OPTION VALUE=",File," onDblClick=submit()>",
- File,"/</OPTION>\n" | Ds],
- filter_files(Dir,Files,Ds1,Fs);
- false ->
- filter_files(Dir,Files,Ds,Fs)
- end
- end;
-filter_files(_Dir,[],Ds,Fs) ->
- {Ds,Fs}.
-
-
-
-
-do_import(Input) ->
- case parse(Input) of
- [{"file",File0},{"dir",Dir}] ->
- File = filename:join(Dir,File0),
- case filelib:is_dir(File) of
- true ->
- import_frame1(File);
- false ->
- case filelib:is_file(File) of
- true ->
- case cover:import(File) of
- ok ->
- import_frame1(Dir);
- {error,{cant_open_file,ExportFile,_Reason}} ->
- import_frame1(Dir,
- "Error importing file\\n\\\""
- ++ ExportFile ++ "\\\"")
- end;
- false ->
- import_frame1(Dir,
- "Error importing file\\n\\\"" ++
- File ++ "\\\"")
- end
- end;
- [{"dir",Dir}] ->
- import_frame1(Dir,"No file is selected")
- end.
-
-
-
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% %
-% Different private helper functions %
-% %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%Create the Header for the page If we now the mimetype use that type %%
-%%otherwise use text %%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-header() ->
- header("text/html").
-header(MimeType) ->
- "Pragma:no-cache\r\n" ++
- "Content-type: " ++ MimeType ++ "\r\n\r\n".
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%Create the Htmlheader set the title of the page %%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-html_header(Title) ->
- "<HTML>\n" ++
- "<HEAD>\n" ++
- "<TITLE>" ++ Title ++ "</TITLE>\n" ++
- "</HEAD>\n"
- "<BODY BGCOLOR=\"#FFFFFF\">\n".
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% Close the body- and Html tags %%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-html_end()->
- "</BODY></HTML>".
-
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% A script which reloads the menu frame and possibly pops up an alert%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-reload_menu_script(Err) ->
- ["<SCRIPT>\n",
- "function reloadMenu()\n",
- " {\n",
- " parent.menu.document.location.href=\"./menu_frame\";\n",
- case Err of
- "" -> "";
- _ -> " alert(\""++Err++"\");\n"
- end,
- case get_warnings() of
- [] ->
- "";
- Warnings ->
- " alert(\""++fix_newline(lists:flatten(Warnings))++"\");\n"
- end,
- " }\n",
- "</SCRIPT>\n",
- "<BODY onLoad=reloadMenu() BGCOLOR=\"#FFFFFF\">"].
-
-fix_newline([$\n|Rest]) ->
- [$\\,$n|fix_newline(Rest)];
-fix_newline([$"|Rest]) ->
- [$\\,$"|fix_newline(Rest)];
-fix_newline([Char|Rest]) ->
- [Char|fix_newline(Rest)];
-fix_newline([]) ->
- [].
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Control the input data and return the intresting values or error %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-get_input_data(Input,Key)->
- case lists:keysearch(Key,1,parse(Input)) of
- {value,{Key,Value}} ->
- Value;
- false ->
- undefined
- end.
-
-parse(Input) ->
- httpd:parse_query(Input).
-
-
-get_warnings() ->
- cover_group_leader_proc ! {self(), get_warnings},
- receive {warnings,Warnings} ->
- Warnings
- end.
diff --git a/lib/tools/src/lcnt.erl b/lib/tools/src/lcnt.erl
index e8b3d242e4..9ee75a688a 100644
--- a/lib/tools/src/lcnt.erl
+++ b/lib/tools/src/lcnt.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2010-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2010-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -94,12 +94,12 @@
-record(stats, {
file :: atom(),
- line :: non_neg_integer(),
+ line :: non_neg_integer() | 'undefined',
tries :: non_neg_integer(),
colls :: non_neg_integer(),
time :: non_neg_integer(), % us
nt :: non_neg_integer(), % #timings collected
- hist :: tuple() % histogram
+ hist :: tuple() | 'undefined' % histogram
}).
-record(lock, {
@@ -757,7 +757,7 @@ list2lock([F|Fs], Ls) ->
stats2stats([]) -> [];
stats2stats([Stat|Stats]) ->
- Sz = tuple_size(#stats{}),
+ Sz = record_info(size, stats),
[stat2stat(Stat,Sz)|stats2stats(Stats)].
stat2stat(Stat,Sz) when tuple_size(Stat) =:= Sz -> Stat;
diff --git a/lib/tools/src/tools.app.src b/lib/tools/src/tools.app.src
index 978b54719c..a00969eabe 100644
--- a/lib/tools/src/tools.app.src
+++ b/lib/tools/src/tools.app.src
@@ -21,7 +21,6 @@
[{description, "DEVTOOLS CXC 138 16"},
{vsn, "%VSN%"},
{modules, [cover,
- cover_web,
eprof,
fprof,
instrument,
@@ -36,12 +35,12 @@
xref_utils
]
},
- {registered,[webcover_server]},
+ {registered, []},
{applications, [kernel, stdlib]},
{env, [{file_util_search_methods,[{"", ""}, {"ebin", "esrc"}, {"ebin", "src"}]}
]
},
- {runtime_dependencies, ["webtool-0.8.10","stdlib-2.5","runtime_tools-1.8.14",
+ {runtime_dependencies, ["stdlib-2.5","runtime_tools-1.8.14",
"kernel-3.0","inets-5.10","erts-7.0",
"compiler-5.0"]}
]
diff --git a/lib/tools/test/cover_SUITE.erl b/lib/tools/test/cover_SUITE.erl
index 931e3e2cfa..25c9317608 100644
--- a/lib/tools/test/cover_SUITE.erl
+++ b/lib/tools/test/cover_SUITE.erl
@@ -31,7 +31,7 @@
otp_5031/1, eif/1, otp_5305/1, otp_5418/1, otp_6115/1, otp_7095/1,
otp_8188/1, otp_8270/1, otp_8273/1, otp_8340/1,
otp_10979_hanging_node/1, compile_beam_opts/1, eep37/1,
- analyse_no_beam/1]).
+ analyse_no_beam/1, line_0/1]).
-export([do_coverage/1]).
@@ -55,7 +55,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}].
all() ->
NoStartStop = [eif,otp_5305,otp_5418,otp_7095,otp_8273,
otp_8340,otp_8188,compile_beam_opts,eep37,
- analyse_no_beam],
+ analyse_no_beam, line_0],
StartStop = [start, compile, analyse, misc, stop,
distribution, reconnect, die_and_reconnect,
dont_reconnect_after_stop, stop_node_after_disconnect,
@@ -1727,6 +1727,26 @@ analyse_no_beam(Config) when is_list(Config) ->
ok = file:set_cwd(Cwd),
ok.
+%% When including eunit.hrl, a parse transform adds the function
+%% test/0 to line 0 in your module. A bug in OTP-18.0 caused
+%% cover:analyse_to_file/1 to fail to insert cover data in the output
+%% file in this situation. The test below tests that this bug is
+%% corrected.
+line_0(Config) ->
+ ok = file:set_cwd(filename:join(?config(data_dir, Config),
+ "include_eunit_hrl")),
+ {ok, cover_inc_eunit} = compile:file(cover_inc_eunit,[debug_info]),
+ {ok, cover_inc_eunit} = cover:compile_beam(cover_inc_eunit),
+ {ok, CovOut} = cover:analyse_to_file(cover_inc_eunit),
+
+ {ok,Bin} = file:read_file(CovOut),
+ Match = <<"0..| ok.\n">>, % "0.." is missing when bug is there
+ S = byte_size(Bin)-byte_size(Match),
+ <<_:S/binary,Match/binary>> = Bin,
+ ok.
+
+
+
%%--Auxiliary------------------------------------------------------------
analyse_expr(Expr, Config) ->
diff --git a/lib/tools/test/cover_SUITE_data/include_eunit_hrl/cover_inc_eunit.erl b/lib/tools/test/cover_SUITE_data/include_eunit_hrl/cover_inc_eunit.erl
new file mode 100644
index 0000000000..c1fe7939d2
--- /dev/null
+++ b/lib/tools/test/cover_SUITE_data/include_eunit_hrl/cover_inc_eunit.erl
@@ -0,0 +1,6 @@
+-module(cover_inc_eunit).
+-compile(export_all).
+-include_lib("eunit/include/eunit.hrl").
+
+func() ->
+ ok.
diff --git a/lib/tools/test/xref_SUITE.erl b/lib/tools/test/xref_SUITE.erl
index ad47b31443..71c8b1a277 100644
--- a/lib/tools/test/xref_SUITE.erl
+++ b/lib/tools/test/xref_SUITE.erl
@@ -1151,17 +1151,13 @@ read_expected(Version) ->
{POS8+4,{FF,{a,b,1}}},
{POS8+4,{FF,{erlang,apply,2}}},
{POS8+5,{FF,{erlang,apply,2}}},
- {POS8+6,{FF,{erlang,apply,3}}},
{POS8+6,{FF,{m,f,1}}},
- {POS8+7,{FF,{erlang,apply,3}}},
- {POS9+1,{FF,{erlang,apply,3}}},
{POS9+1,{FF,{read,bi,0}}},
{POS9+2,{FF,{a,b,1}}},
{POS9+2,{FF,{erlang,apply,2}}},
{POS9+3,{FF,{erlang,apply,2}}},
{POS9+4,{FF,{erlang,apply,2}}},
{POS9+4,{FF,{erlang,not_a_function,1}}},
- {POS9+5,{FF,{erlang,apply,3}}},
{POS9+5,{FF,{mod,func,2}}},
{POS9+6,{FF,{erlang,apply,1}}},
{POS9+7,{FF,{erlang,apply,2}}},
@@ -1169,17 +1165,11 @@ read_expected(Version) ->
{POS9+8,{FF,{q,f,1}}},
{POS10+4,{FF,{erlang,apply,2}}},
{POS10+5,{FF,{mod1,fun1,1}}},
- {POS11+1,{FF,{erlang,apply,3}}},
- {POS11+2,{FF,{erlang,apply,3}}},
- {POS11+3,{FF,{erlang,apply,3}}},
- {POS11+4,{FF,{erlang,apply,3}}},
{POS11+6,{FF,{erlang,apply,2}}},
{POS12+1,{FF,{erlang,apply,2}}},
{POS12+4,{FF,{erlang,apply,2}}},
- {POS12+5,{FF,{erlang,apply,3}}},
{POS12+5,{FF,{m3,f3,2}}},
{POS12+7,{FF,{erlang,apply,2}}},
- {POS12+8,{FF,{erlang,apply,3}}},
{POS13+1,{FF,{dm,df,1}}},
{POS13+6,{{read,bi,0},{foo,module_info,0}}},
{POS13+7,{{read,bi,0},{read,module_info,0}}},
@@ -1189,10 +1179,6 @@ read_expected(Version) ->
OK = case Version of
abstract_v1 ->
- [{POS8+3, {FF,{erlang,apply,3}}},
- {POS10+1, {FF,{erlang,apply,3}}},
- {POS10+6, {FF,{erlang,apply,3}}}]
- ++
[{0,{FF,{read,'$F_EXPR',178}}},
{0,{FF,{modul,'$F_EXPR',179}}}]
++ O1;
@@ -1213,13 +1199,25 @@ read_expected(Version) ->
{POS3+3, {FF,{erlang,spawn_link,3}}},
{POS3+4, {FF,{erlang,spawn_link,3}}},
{POS6+4, {FF,{erlang,spawn,3}}},
+ {POS8+6,{FF,{erlang,apply,3}}},
+ {POS8+7,{FF,{erlang,apply,3}}},
+ {POS9+1,{FF,{erlang,apply,3}}},
+ {POS9+5,{FF,{erlang,apply,3}}},
+ {POS11+1,{FF,{erlang,apply,3}}},
+ {POS11+2,{FF,{erlang,apply,3}}},
+ {POS11+3,{FF,{erlang,apply,3}}},
+ {POS11+4,{FF,{erlang,apply,3}}},
+ {POS12+5,{FF,{erlang,apply,3}}},
+ {POS12+8,{FF,{erlang,apply,3}}},
{POS13+5, {{read,bi,0},{erlang,length,1}}},
{POS14+3, {{read,bi,0},{erlang,length,1}}}],
%% Operators (OTP-8647):
OKB = case Version of
abstract_v1 ->
- [];
+ [{POS8+3, {FF,{erlang,apply,3}}},
+ {POS10+1, {FF,{erlang,apply,3}}},
+ {POS10+6, {FF,{erlang,apply,3}}}];
_ ->
[{POS13+16, {{read,bi,0},{erlang,'!',2}}},
{POS13+16, {{read,bi,0},{erlang,'-',1}}},
diff --git a/lib/tools/vsn.mk b/lib/tools/vsn.mk
index 68c3f6e29c..e4eda213ba 100644
--- a/lib/tools/vsn.mk
+++ b/lib/tools/vsn.mk
@@ -1 +1 @@
-TOOLS_VSN = 2.8
+TOOLS_VSN = 2.8.1
diff --git a/lib/typer/src/typer.erl b/lib/typer/src/typer.erl
index ec00bfaba0..562530c868 100644
--- a/lib/typer/src/typer.erl
+++ b/lib/typer/src/typer.erl
@@ -1012,15 +1012,7 @@ compile_error(Reason) ->
-spec msg(string()) -> 'ok'.
msg(Msg) ->
- case os:type() of
- {unix, _} -> % Output a message on 'stderr', if possible
- P = open_port({fd, 0, 2}, [out]),
- port_command(P, Msg),
- true = port_close(P),
- ok;
- _ -> % win32
- io:format("~s", [Msg])
- end.
+ io:format(standard_error, "~s", [Msg]).
%%--------------------------------------------------------------------
%% Version and help messages.
diff --git a/lib/webtool/AUTHORS b/lib/webtool/AUTHORS
deleted file mode 100644
index 5f173dd264..0000000000
--- a/lib/webtool/AUTHORS
+++ /dev/null
@@ -1,4 +0,0 @@
-Original Authors and Contributors:
-
-Siri Hansen
-Martin Gustafsson
diff --git a/lib/webtool/Makefile b/lib/webtool/Makefile
deleted file mode 100644
index 9afcb87af2..0000000000
--- a/lib/webtool/Makefile
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-# %CopyrightBegin%
-#
-# Copyright Ericsson AB 2001-2009. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# %CopyrightEnd%
-#
-include $(ERL_TOP)/make/target.mk
-include $(ERL_TOP)/make/$(TARGET)/otp.mk
-
-# ----------------------------------------------------
-# Common Macros
-# ----------------------------------------------------
-
-SUB_DIRECTORIES = src priv doc/src
-
-include vsn.mk
-VSN = $(WEBTOOL_VSN)
-
-SPECIAL_TARGETS =
-
-# ----------------------------------------------------
-# Default Subdir Targets
-# ----------------------------------------------------
-include $(ERL_TOP)/make/otp_subdir.mk
-
-
diff --git a/lib/webtool/doc/html/.gitignore b/lib/webtool/doc/html/.gitignore
deleted file mode 100644
index e69de29bb2..0000000000
--- a/lib/webtool/doc/html/.gitignore
+++ /dev/null
diff --git a/lib/webtool/doc/man1/.gitignore b/lib/webtool/doc/man1/.gitignore
deleted file mode 100644
index e69de29bb2..0000000000
--- a/lib/webtool/doc/man1/.gitignore
+++ /dev/null
diff --git a/lib/webtool/doc/man3/.gitignore b/lib/webtool/doc/man3/.gitignore
deleted file mode 100644
index e69de29bb2..0000000000
--- a/lib/webtool/doc/man3/.gitignore
+++ /dev/null
diff --git a/lib/webtool/doc/pdf/.gitignore b/lib/webtool/doc/pdf/.gitignore
deleted file mode 100644
index e69de29bb2..0000000000
--- a/lib/webtool/doc/pdf/.gitignore
+++ /dev/null
diff --git a/lib/webtool/doc/src/Makefile b/lib/webtool/doc/src/Makefile
deleted file mode 100644
index 57de52a616..0000000000
--- a/lib/webtool/doc/src/Makefile
+++ /dev/null
@@ -1,132 +0,0 @@
-# ``Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# The Initial Developer of the Original Code is Ericsson Utvecklings AB.
-# Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings
-# AB. All Rights Reserved.''
-#
-# $Id$
-#
-include $(ERL_TOP)/make/target.mk
-include $(ERL_TOP)/make/$(TARGET)/otp.mk
-
-# ----------------------------------------------------
-# Application version
-# ----------------------------------------------------
-include ../../vsn.mk
-VSN=$(WEBTOOL_VSN)
-APPLICATION=webtool
-
-DOC_EXTRA_FRONT_PAGE_INFO=Important note: \
-The Webtool application is obsolete and will be removed \
-in the next major OTP release
-
-# ----------------------------------------------------
-# Release directory specification
-# ----------------------------------------------------
-RELSYSDIR = $(RELEASE_PATH)/lib/$(APPLICATION)-$(VSN)
-
-# ----------------------------------------------------
-# Target Specs
-# ----------------------------------------------------
-XML_APPLICATION_FILES = ref_man.xml
-
-XML_REF1_FILES = start_webtool.xml
-
-XML_REF3_FILES = webtool.xml
-
-XML_PART_FILES = \
- part.xml \
- part_notes.xml \
- part_notes_history.xml
-
-XML_CHAPTER_FILES = \
- webtool_chapter.xml \
- notes.xml \
- notes_history.xml
-
-BOOK_FILES = book.xml
-
-XML_FILES = \
- $(BOOK_FILES) $(XML_CHAPTER_FILES) \
- $(XML_PART_FILES) $(XML_REF3_FILES) \
- $(XML_REF1_FILES) $(XML_APPLICATION_FILES)
-
-GIF_FILES =
-
-# ----------------------------------------------------
-
-HTML_FILES = $(XML_APPLICATION_FILES:%.xml=$(HTMLDIR)/%.html) \
- $(XML_PART_FILES:%.xml=$(HTMLDIR)/%.html)
-
-INFO_FILE = ../../info
-
-MAN1_FILES = $(XML_REF1_FILES:%.xml=$(MAN1DIR)/%.1)
-MAN3_FILES = $(XML_REF3_FILES:%.xml=$(MAN3DIR)/%.3)
-
-HTML_REF_MAN_FILE = $(HTMLDIR)/index.html
-
-TOP_PDF_FILE = $(PDFDIR)/$(APPLICATION)-$(VSN).pdf
-
-# ----------------------------------------------------
-# FLAGS
-# ----------------------------------------------------
-XML_FLAGS +=
-DVIPS_FLAGS +=
-
-# ----------------------------------------------------
-# Targets
-# ----------------------------------------------------
-$(HTMLDIR)/%.gif: %.gif
- $(INSTALL_DATA) $< $@
-
-docs: pdf html man
-
-$(TOP_PDF_FILE): $(XML_FILES)
-
-pdf: $(TOP_PDF_FILE)
-
-html: gifs $(HTML_REF_MAN_FILE)
-
-
-clean clean_docs:
- rm -rf $(HTMLDIR)/*
- rm -f $(MAN1DIR)/*
- rm -f $(MAN3DIR)/*
- rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo)
- rm -f errs core *~
-
-man: $(MAN1_FILES) $(MAN3_FILES)
-
-gifs: $(GIF_FILES:%=$(HTMLDIR)/%)
-
-debug opt:
-
-# ----------------------------------------------------
-# Release Target
-# ----------------------------------------------------
-include $(ERL_TOP)/make/otp_release_targets.mk
-
-release_docs_spec: docs
- $(INSTALL_DIR) "$(RELSYSDIR)/doc/pdf"
- $(INSTALL_DATA) $(TOP_PDF_FILE) "$(RELSYSDIR)/doc/pdf"
- $(INSTALL_DIR) "$(RELSYSDIR)/doc/html"
- $(INSTALL_DATA) $(HTMLDIR)/* \
- "$(RELSYSDIR)/doc/html"
- $(INSTALL_DATA) $(INFO_FILE) "$(RELSYSDIR)"
- $(INSTALL_DIR) "$(RELEASE_PATH)/man/man1"
- $(INSTALL_DATA) $(MAN1_FILES) "$(RELEASE_PATH)/man/man1"
- $(INSTALL_DIR) "$(RELEASE_PATH)/man/man3"
- $(INSTALL_DATA) $(MAN3_FILES) "$(RELEASE_PATH)/man/man3"
-
-release_spec:
-
diff --git a/lib/webtool/doc/src/book.xml b/lib/webtool/doc/src/book.xml
deleted file mode 100644
index feccee7c62..0000000000
--- a/lib/webtool/doc/src/book.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE book SYSTEM "book.dtd">
-
-<book xmlns:xi="http://www.w3.org/2001/XInclude">
- <header titlestyle="normal">
- <copyright>
- <year>2001</year><year>2013</year>
- <holder>Ericsson AB. All Rights Reserved.</holder>
- </copyright>
- <legalnotice>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- </legalnotice>
-
- <title>WebTool</title>
- <prepared></prepared>
- <docno></docno>
- <date></date>
- <rev>1.0</rev>
- </header>
- <insidecover>
- </insidecover>
- <pagetext>WebTool</pagetext>
- <preamble>
- </preamble>
- <parts lift="no">
- <xi:include href="part.xml"/>
- </parts>
- <applications>
- <xi:include href="ref_man.xml"/>
- </applications>
- <releasenotes>
- <xi:include href="notes.xml"/>
- </releasenotes>
- <listofterms></listofterms>
- <index></index>
-</book>
-
diff --git a/lib/webtool/doc/src/fascicules.xml b/lib/webtool/doc/src/fascicules.xml
deleted file mode 100644
index 37feca543f..0000000000
--- a/lib/webtool/doc/src/fascicules.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE fascicules SYSTEM "fascicules.dtd">
-
-<fascicules>
- <fascicule file="part" href="part_frame.html" entry="no">
- User's Guide
- </fascicule>
- <fascicule file="ref_man" href="ref_man_frame.html" entry="yes">
- Reference Manual
- </fascicule>
- <fascicule file="part_notes" href="part_notes_frame.html" entry="no">
- Release Notes
- </fascicule>
- <fascicule file="" href="../../../../doc/print.html" entry="no">
- Off-Print
- </fascicule>
-</fascicules>
-
diff --git a/lib/webtool/doc/src/notes.xml b/lib/webtool/doc/src/notes.xml
deleted file mode 100644
index 21309261a8..0000000000
--- a/lib/webtool/doc/src/notes.xml
+++ /dev/null
@@ -1,253 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE chapter SYSTEM "chapter.dtd">
-
-<chapter>
- <header>
- <copyright>
- <year>2004</year><year>2013</year>
- <holder>Ericsson AB. All Rights Reserved.</holder>
- </copyright>
- <legalnotice>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- </legalnotice>
-
- <title>Webtool Release Notes</title>
- <prepared>otp_appnotes</prepared>
- <docno>nil</docno>
- <date>nil</date>
- <rev>nil</rev>
- <file>notes.xml</file>
- </header>
- <p>This document describes the changes made to the Webtool
- application.</p>
-
-<section><title>WebTool 0.9</title>
-
- <section><title>Improvements and New Features</title>
- <list>
- <item>
- <p>
- The Webtool application has been marked as obsolete and
- will be removed from OTP in the next major release (OTP
- 19.0).</p>
- <p>
- Own Id: OTP-10922 Aux Id: OTP-12705 </p>
- </item>
- </list>
- </section>
-
-</section>
-
-<section><title>WebTool 0.8.10</title>
-
- <section><title>Fixed Bugs and Malfunctions</title>
- <list>
- <item>
- <p>
- Application upgrade (appup) files are corrected for the
- following applications: </p>
- <p>
- <c>asn1, common_test, compiler, crypto, debugger,
- dialyzer, edoc, eldap, erl_docgen, et, eunit, gs, hipe,
- inets, observer, odbc, os_mon, otp_mibs, parsetools,
- percept, public_key, reltool, runtime_tools, ssh,
- syntax_tools, test_server, tools, typer, webtool, wx,
- xmerl</c></p>
- <p>
- A new test utility for testing appup files is added to
- test_server. This is now used by most applications in
- OTP.</p>
- <p>
- (Thanks to Tobias Schlager)</p>
- <p>
- Own Id: OTP-11744</p>
- </item>
- </list>
- </section>
-
-</section>
-
-<section><title>WebTool 0.8.9.2</title>
-
- <section><title>Improvements and New Features</title>
- <list>
- <item>
- <p>
- Misc build updates</p>
- <p>
- Own Id: OTP-10784</p>
- </item>
- </list>
- </section>
-
-</section>
-
-<section><title>WebTool 0.8.9.1</title>
-
- <section><title>Improvements and New Features</title>
- <list>
- <item>
- <p>
- Miscellaneous documentation build updates</p>
- <p>
- Own Id: OTP-9813</p>
- </item>
- </list>
- </section>
-
-</section>
-
-<section><title>WebTool 0.8.9</title>
-
- <section><title>Fixed Bugs and Malfunctions</title>
- <list>
- <item>
- <p>
- Do not install *.bat files on non-win32 machines (Thanks
- to Hans Ulrich Niedermann)</p>
- <p>
- Own Id: OTP-9515</p>
- </item>
- </list>
- </section>
-
-</section>
-
-<section><title>WebTool 0.8.8</title>
-
- <section><title>Fixed Bugs and Malfunctions</title>
- <list>
- <item>
- <p>
- Various small documentation fixes (Thanks to Bernard
- Duggan)</p>
- <p>
- Own Id: OTP-9172</p>
- </item>
- </list>
- </section>
-
-</section>
-
-<section><title>WebTool 0.8.7</title>
-
- <section><title>Improvements and New Features</title>
- <list>
- <item>
- <p>
- Up until now Netscape has been the default web browser on
- Unix/Linux. Webtool has now been updated to start Firefox
- as default browser instead.</p>
- <p>
- Own Id: OTP-8651 Aux Id: OTP-8650 </p>
- </item>
- </list>
- </section>
-
-</section>
-
-<section><title>WebTool 0.8.6</title>
-
- <section><title>Improvements and New Features</title>
- <list>
- <item>
- <p>
- Misc updates</p>
- <p>
- Own Id: OTP-8456</p>
- </item>
- </list>
- </section>
-
-</section>
-
-<section><title>WebTool 0.8.5</title>
-
- <section><title>Improvements and New Features</title>
- <list>
- <item>
- <p>
- The documentation is now built with open source tools
- (xsltproc and fop) that exists on most platforms. One
- visible change is that the frames are removed.</p>
- <p>
- Own Id: OTP-8201</p>
- </item>
- </list>
- </section>
-
-</section>
-
-<section><title>WebTool 0.8.4</title>
-
- <section><title>Improvements and New Features</title>
- <list>
- <item>
- <p>The copyright notices have been updated.</p>
- <p>
- Own Id: OTP-7851</p>
- </item>
- </list>
- </section>
-
-</section>
-<section><title>WebTool 0.8.3.2</title>
-
- <section><title>Improvements and New Features</title>
- <list>
- <item>
- <p>
- Minor updates.</p>
- <p>
- Own Id: OTP-6998</p>
- </item>
- </list>
- </section>
-
-</section>
-
- <section>
- <title>WebTool 0.8.3.1</title>
-
- <section>
- <title>Improvements and New Features</title>
- <list type="bulleted">
- <item>
- <p>Minor Makefile changes.</p>
- <p>Own Id: OTP-6689</p>
- </item>
- <item>
- <p>Obsolete guard tests (such as list()) have been replaced
- with the modern guard tests (such as is_list()).</p>
- <p>Own Id: OTP-6725</p>
- </item>
- </list>
- </section>
- </section>
-
- <section>
- <title>WebTool 0.8.3</title>
-
- <section>
- <title>Improvements and New Features</title>
- <list type="bulleted">
- <item>
- <p>Removed some dead code discovered by Dialyzer.</p>
- <p>Own Id: OTP-6041</p>
- </item>
- </list>
- </section>
- </section>
-</chapter>
-
diff --git a/lib/webtool/doc/src/notes_history.xml b/lib/webtool/doc/src/notes_history.xml
deleted file mode 100644
index 792475d948..0000000000
--- a/lib/webtool/doc/src/notes_history.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE chapter SYSTEM "chapter.dtd">
-
-<chapter>
- <header>
- <copyright>
- <year>2006</year>
- <year>2013</year>
- <holder>Ericsson AB, All Rights Reserved</holder>
- </copyright>
- <legalnotice>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- The Initial Developer of the Original Code is Ericsson AB.
- </legalnotice>
-
- <title>Webtool Release Notes History</title>
- <prepared>otp_appnotes</prepared>
- <docno>nil</docno>
- <date>nil</date>
- <rev>nil</rev>
- </header>
-
- <section>
- <title>Webtool 0.8.2</title>
-
- <section>
- <title>Fixed Bugs and Malfunctions</title>
- <list type="bulleted">
- <item>
- <p>Bugfix: <c>webtool</c> crashed when trying to find a free
- port number if connection failed with other reason than
- <c>econnrefused</c>.</p>
- <p>Own Id: OTP-5166</p>
- </item>
- </list>
- </section>
-
- <section>
- <title>Improvements and New Features</title>
- <list type="bulleted">
- <item>
- <p>Misc improvements:</p>
- <list type="bulleted">
- <item>The function <c>debug_app/1</c> and some error
- printouts are added to simplify debugging of own
- application.</item>
- <item>Multiple webtool instances can now be started on
- the same host. If the default port (8888) is in use, port
- 8889 is tried. If 8889 is also used, 8890 is tried and so
- on. Max number of ports tried is 256.</item>
- <item><em>Incompatible:</em> If <c>Data</c> is set to
- <c>PortNumber</c> in <c>start(Path,Data)</c>, the default
- data will be used for ip-number (<c>127.0.0.1</c>) and
- server name (<c>localhost</c>).</item>
- </list>
- <p>*** POTENTIAL INCOMPATIBILITY ***</p>
- <p>Own Id: OTP-4724</p>
- </item>
- </list>
- </section>
- </section>
-</chapter>
-
diff --git a/lib/webtool/doc/src/part.xml b/lib/webtool/doc/src/part.xml
deleted file mode 100644
index b0c4ee310d..0000000000
--- a/lib/webtool/doc/src/part.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE part SYSTEM "part.dtd">
-
-<part xmlns:xi="http://www.w3.org/2001/XInclude">
- <header>
- <copyright>
- <year>2001</year><year>2013</year>
- <holder>Ericsson AB. All Rights Reserved.</holder>
- </copyright>
- <legalnotice>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- </legalnotice>
-
- <title>WebTool User's Guide</title>
- <prepared></prepared>
- <docno></docno>
- <date></date>
- <rev></rev>
- </header>
- <description>
- <p><em>WebTool</em> provides a easy way to use web based tools with
- Erlang/OTP. It configures and starts a webserver as well as all
- available tools.</p>
- </description>
- <xi:include href="webtool_chapter.xml"/>
-</part>
-
diff --git a/lib/webtool/doc/src/part_notes.xml b/lib/webtool/doc/src/part_notes.xml
deleted file mode 100644
index db2b790f3f..0000000000
--- a/lib/webtool/doc/src/part_notes.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE part SYSTEM "part.dtd">
-
-<part xmlns:xi="http://www.w3.org/2001/XInclude">
- <header>
- <copyright>
- <year>2004</year><year>2013</year>
- <holder>Ericsson AB. All Rights Reserved.</holder>
- </copyright>
- <legalnotice>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- </legalnotice>
-
- <title>WebTool Release Notes</title>
- <prepared></prepared>
- <docno></docno>
- <date></date>
- <rev></rev>
- </header>
- <description>
- <p><em>WebTool</em> provides an easy way to use web based tools with
- Erlang/OTP. It configures and starts a webserver as well as all
- available tools.</p>
- <p>For information about older versions, see
- <url href="part_notes_history_frame.html">Release Notes History</url>.</p>
- </description>
- <xi:include href="notes"/>
-</part>
-
diff --git a/lib/webtool/doc/src/part_notes_history.xml b/lib/webtool/doc/src/part_notes_history.xml
deleted file mode 100644
index 50ce62e58d..0000000000
--- a/lib/webtool/doc/src/part_notes_history.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE part SYSTEM "part.dtd">
-
-<part>
- <header>
- <copyright>
- <year>2006</year>
- <year>2013</year>
- <holder>Ericsson AB, All Rights Reserved</holder>
- </copyright>
- <legalnotice>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- The Initial Developer of the Original Code is Ericsson AB.
- </legalnotice>
-
- <title>WebTool Release Notes History</title>
- <prepared></prepared>
- <docno></docno>
- <date></date>
- <rev></rev>
- </header>
- <description>
- <p><em>WebTool</em> provides a easy way to use web based tools with
- Erlang/OTP. It configures and starts a webserver as well as all
- available tools.</p>
- </description>
- <include file="notes_history"></include>
-</part>
-
diff --git a/lib/webtool/doc/src/ref_man.xml b/lib/webtool/doc/src/ref_man.xml
deleted file mode 100644
index aa81392b11..0000000000
--- a/lib/webtool/doc/src/ref_man.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE application SYSTEM "application.dtd">
-
-<application xmlns:xi="http://www.w3.org/2001/XInclude">
- <header>
- <copyright>
- <year>2001</year><year>2013</year>
- <holder>Ericsson AB. All Rights Reserved.</holder>
- </copyright>
- <legalnotice>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- </legalnotice>
-
- <title>WebTool Reference Manual</title>
- <prepared></prepared>
- <docno></docno>
- <date></date>
- <rev></rev>
- </header>
- <description>
- <p><em>WebTool</em> provides an easy way to use web based tools with
- Erlang/OTP. It configures and starts a webserver as well as all
- available tools.</p>
- </description>
- <xi:include href="webtool.xml"/>
- <xi:include href="start_webtool.xml"/>
-</application>
-
diff --git a/lib/webtool/doc/src/start_webtool.xml b/lib/webtool/doc/src/start_webtool.xml
deleted file mode 100644
index e9c94c4271..0000000000
--- a/lib/webtool/doc/src/start_webtool.xml
+++ /dev/null
@@ -1,104 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE comref SYSTEM "comref.dtd">
-
-<comref>
- <header>
- <copyright>
- <year>2003</year><year>2013</year>
- <holder>Ericsson AB. All Rights Reserved.</holder>
- </copyright>
- <legalnotice>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- </legalnotice>
-
- <title>start_webtool</title>
- <prepared></prepared>
- <responsible></responsible>
- <docno>1</docno>
- <approved></approved>
- <checked></checked>
- <date>2003-06-18</date>
- <rev></rev>
- <file>start_webtool.sgml</file>
- </header>
- <com>start_webtool</com>
- <comsummary>WebTool Start Script</comsummary>
- <description>
- <p>The <c>start_webtool</c> script starts WebTool, a WebTool
- application and a web browser pointing to this application.</p>
- </description>
- <funcs>
- <func>
- <name>start_webtool application [ browser ]</name>
- <fsummary>Start a WebTool Application</fsummary>
- <desc>
- <p>Starts WebTool, the given WebTool Application and a web
- browser pointing to this application.
- </p>
- <p>If no argument is given, a list of available applications
- is displayed, e.g.</p>
- <pre>
->start_webtool
-Starting webtool...
-WebTool is available at http://localhost:8888/
-Or http://127.0.0.1:8888/
-
-Usage: start_webtool application [ browser ]
-
-Available applications are: [orber,appmon,crashdump_viewer,webcover]
-Default browser is 'iexplore' (Internet Explorer) on Windows or else 'firefox' </pre>
- <p>To start any of the listed applications, give the
- application name as the first argument, e.g.</p>
- <pre>
->start_webtool webcover
-Starting webtool...
-WebTool is available at http://localhost:8888/
-Or http://127.0.0.1:8888/
-Starting webcover...
-Sending URL to netscape...done </pre>
- <p>The WebTool application WebCover is then started and the
- default browser is used. The default browser is Internet
- Explorer on Windows or else Firefox.
- </p>
- <p>To use another browser, give the browser's start command
- as the second argument, e.g.</p>
- <pre>
->start_webtool webcover mozilla
-Starting webtool...
-WebTool is available at http://localhost:8888/
-Or http://127.0.0.1:8888/
-Starting webcover...
-Sending URL to mozilla...done </pre>
- <p>If the given browser name is not known to WebTool, WebTool
- will run it as a command with the start URL as the only
- argument, e.g.</p>
- <pre>
->start_webtool webcover mybrowser
-Starting webtool...
-WebTool is available at http://localhost:8888/
-Or http://127.0.0.1:8888/
-Starting webcover...
-Starting mybrowser... </pre>
- <p>Here the command <c>"mybrowser http://localhost:8888/webcover"</c> is executed.
- </p>
- </desc>
- </func>
- </funcs>
-
- <section>
- <title>See Also</title>
- <p><seealso marker="webtool">webtool(3)</seealso></p>
- </section>
-</comref>
-
diff --git a/lib/webtool/doc/src/webtool.xml b/lib/webtool/doc/src/webtool.xml
deleted file mode 100644
index 2647518dae..0000000000
--- a/lib/webtool/doc/src/webtool.xml
+++ /dev/null
@@ -1,157 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE erlref SYSTEM "erlref.dtd">
-
-<erlref>
- <header>
- <copyright>
- <year>2001</year>
- <year>2013</year>
- <holder>Ericsson AB, All Rights Reserved</holder>
- </copyright>
- <legalnotice>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- The Initial Developer of the Original Code is Ericsson AB.
- </legalnotice>
-
- <title>webtool</title>
- <prepared></prepared>
- <docno></docno>
- <date></date>
- <rev></rev>
- </header>
- <module>webtool</module>
- <modulesummary>WebTool is a tool used to simplify the implementation of web based tools with Erlang/OTP.</modulesummary>
- <description>
- <p>WebTool makes it easy to use web based tools with Erlang/OTP. WebTool
- configures and starts the webserver httpd.</p>
- </description>
- <funcs>
- <func>
- <name>start()-> {ok,Pid}| {stop,Reason}</name>
- <fsummary>Start WebTool.</fsummary>
- <desc>
- <p>Start WebTool with default data, i.e. port 8888, ip-number
- 127.0.0.1, and server-name <c>localhost</c>. If port 8888 is
- in use, port 8889 is tried instead. If 8889 is also in use,
- 8890 is tried and so on. Max number of ports tried is 256.
- </p>
- <p>The <c>mime.types</c> file and WebTool's own HTML files
- are assumed to be in the directory
- <c><![CDATA[webtool-<vsn>/priv/root/conf]]></c>.</p>
- </desc>
- </func>
- <func>
- <name>start(Path,Data)->{ok,Pid}|{stop,Reason}</name>
- <fsummary>Start WebTool with default configuration.</fsummary>
- <type>
- <v>Path = string() | standard_path</v>
- <v>Data = [Port,Address,Name] | PortNumber | standard_data</v>
- <v>Port = {port,PortNumber}</v>
- <v>Address = {bind_address,IpNumber}</v>
- <v>Name = {server_name,ServerName}</v>
- <v>PortNumber = integer()</v>
- <v>IpNumber = tuple(), e.g. {127,0,0,1}</v>
- <v>ServerName = string()</v>
- <v>Pid = pid()</v>
- </type>
- <desc>
- <p>Use this function to start WebTool if the default port,
- ip-number,servername or path can not be used.</p>
- <p><c>Path</c> is the directory where the <c>mime.types</c>
- file and WebTool's own HTML files are located. By default
- this is <c><![CDATA[webtool-<vsn>/priv]]></c>, and in most cases there
- is no need to change this. If <c>Path</c> is set to
- <c>standard_path</c> the default will be used.</p>
- <p>If <c>Data</c> is set to <c>PortNumber</c>, the default data
- will be used for ip-number (<c>127.0.0.1</c>) and server
- name (<c>localhost</c>).</p>
- </desc>
- </func>
- <func>
- <name>stop()->void</name>
- <fsummary>Stop WebTool.</fsummary>
- <desc>
- <p>Stop WebTool and the tools started by WebTool.</p>
- </desc>
- </func>
- <func>
- <name>debug_app(Module)->void</name>
- <fsummary>Debug a WebTool application.</fsummary>
- <type>
- <v>Module = atom()</v>
- </type>
- <desc>
- <p>Debug a WebTool application by tracing all functions in the
- given module which are called from WebTool.</p>
- </desc>
- </func>
- <func>
- <name>stop_debug()->void</name>
- <fsummary>Stop debugging an application and format the trace log.</fsummary>
- <desc>
- <p>Stop the tracing started by <c>debug_app/1</c>, and format
- the trace log.</p>
- </desc>
- </func>
- </funcs>
-
- <section>
- <title>CALLBACK FUNCTIONS</title>
- <p>The following callback function must be implemented by each web
- based tool that will be used via WebTool. When started, WebTool
- searches the Erlang code path for *.tool files to locate all web
- based tools and their callback functions. See the <seealso marker="webtool_chapter">WebTool User's Guide</seealso> for more
- information about the *.tool files.</p>
- </section>
- <funcs>
- <func>
- <name>Module:Func(Data)-> {Name,WebData}|error</name>
- <fsummary>Returns configuration data needed by WebTool to configure and start a tool.</fsummary>
- <type>
- <v>Data = term()</v>
- <v>Name = atom()</v>
- <v>WebData = [WebOptions]</v>
- <v>WebOptions = LinkData | Alias | Start</v>
- <v>LinkData = {web_data,{ToolName,Url}}</v>
- <v>Alias = {alias,{VirtualPath,RealPath}} | {alias,{erl_alias,Path,[Modules]}</v>
- <v>Start = {start,StartData}</v>
- <v>ToolName = Url = VirtualPath = RealPath = Path = string()</v>
- <v>Modules = atom()</v>
- <v>StartData = AppData | ChildSpec | Func</v>
- <v>AppData = {app,AppName}</v>
- <v>ChildSpec = {child,child_spec()}</v>
- <d>See the Reference Manual for the module supervisor in the STDLIB application for details about child_spec().</d>
- <v>Func = {func,{StartMod,StartFunc,StartArg}, {StopMod,StopFunc,StopArg}}</v>
- <v>AppName = StartMod = StartFunc = StopMod = StopFunc =atom()</v>
- <v>StartArg = StopArg = [term()]</v>
- </type>
- <desc>
- <p>This is the configuration function (<c>config_func</c>)
- which must be stated in the <c>*.tool</c> file.</p>
- <p>The function is called by WebTool at startup to retrieve the
- data needed to start and configure the tool. <c>LinkData</c> is
- used by WebTool to create the link to the tool. <c>Alias</c> is
- used to create the aliases needed by the webserver. <c>Start</c>
- is used to start and stop the tool.</p>
- </desc>
- </func>
- </funcs>
-
- <section>
- <title>See Also</title>
- <p><seealso marker="start_webtool">start_webtool(1)</seealso>,
- <seealso marker="webtool_chapter">WebTool User's Guide</seealso></p>
- </section>
-</erlref>
-
diff --git a/lib/webtool/doc/src/webtool_chapter.xml b/lib/webtool/doc/src/webtool_chapter.xml
deleted file mode 100644
index 160a42f855..0000000000
--- a/lib/webtool/doc/src/webtool_chapter.xml
+++ /dev/null
@@ -1,246 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE chapter SYSTEM "chapter.dtd">
-
-<chapter>
- <header>
- <copyright>
- <year>2001</year><year>2013</year>
- <holder>Ericsson AB. All Rights Reserved.</holder>
- </copyright>
- <legalnotice>
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- </legalnotice>
-
- <title>WebTool User Guide</title>
- <prepared></prepared>
- <docno></docno>
- <date></date>
- <rev></rev>
- <file>webtool_chapter.xml</file>
- </header>
-
- <section>
- <title>Introduction </title>
- <p>WebTool provides an easy and efficient way to implement web
- based tools with Erlang/OTP. WebTool configures and starts the
- webserver and the various web based tools.</p>
- <p>All tools that shall run under WebTool must have a *.tool
- file in the code path or in its priv directory. When WebTool
- starts it searches the code path for such files. For each
- <c>ebin</c> directory in the path, the <c>priv</c> directory is
- also searched. The *.tool files contain the configuration data
- for each web based tool.</p>
- </section>
-
- <section>
- <title>Starting WebTool</title>
- <p>Start WebTool by calling the function <c>webtool:start/0</c> or
- <c>webtool:start/2</c>. If <c>webtool:start/0</c> is used the
- start page of WebTool is available at
- <em>http://localhost:8888/</em> or
- <em>http://127.0.0.1:8888/</em>, and the directory containing
- the root directory for the webserver, is assumed to be
- <c><![CDATA[webtool-<vsn>/priv]]></c>.</p>
- <p>Use <c>webtool:start/2</c> if the default path for the root
- directory, port, ip-number or server name can not be used. See
- the Reference Manual for <seealso marker="webtool">webtool</seealso> for more information.</p>
- <p>WebTool, with the default configuration as in <c>start/0</c>,
- can also be started with the <c>start_webtool</c> script which
- is available in the <c>priv</c> directory of the WebTool
- application. See the Reference Manual for <seealso marker="start_webtool">start_webtool</seealso> for further
- information about this script. For Windows users, the batch file
- <c>start_webtool.bat</c> can be used for the same purpose.</p>
- </section>
-
- <section>
- <title>Using WebTool</title>
- <p>Start WebTool and point the browser to the corresponding URL.
- At the top of the page there is a frame with a link named
- <em>WebTool</em>. Click that link and a page where it is
- possible to start the available tools will appear in the main
- frame.</p>
- </section>
-
- <section>
- <title>Start a web based tool</title>
- <p>Click on the link labeled <em>WebTool</em> in the topmost frame,
- select the checkbox for each tool to start and
- click on the button labeled <em>Start</em>. A link to each tool
- that WebTool succeeded to start will appear in the topmost frame.</p>
- </section>
-
- <section>
- <title>Stop a web based tool</title>
- <p>Click on the link labeled <em>WebTool</em> in the topmost
- frame. Select <em>Stop Tools</em> in the left frame. Select the
- checkbox for each tool to stop and click on the button labeled
- <em>Stop</em>.</p>
- </section>
-
- <section>
- <title>Develop new web based tools</title>
- <p>WebTool can be used as a framework when developing new web based
- tools.</p>
- <p>A web based tool running under WebTool will typically consist of
- three parts.</p>
- <list type="bulleted">
- <item>A *.tool file which defines how WebTool can find the tool's
- configuration data</item>
- <item>The Erlang code generating the web interface to the tool (HTML
- code)</item>
- <item>The tool itself.</item>
- </list>
- <p>In most cases it is a good idea to separate the code for
- creation of the html-pages and the code for the logic. This
- increases the readability of the code and the logic might be
- possible to reuse.</p>
-
- <section>
- <title>The *.tool file</title>
- <p>When WebTool starts it searches the current path for
- <c>*.tool</c> files to find all available tools. The *.tool
- file contains a version identifier and a list of tuples which
- is the configuration data. The version identifier specifies
- the *.tool file version, i.e. not the version of
- webtool. Currently the only valid version is "1.2" and the
- only valid configuration tag is
- <c>config_func</c>. <c>config_func</c> specifies which
- function WebTool must call to get further configuration data
- for the tool. This means that a *.tool file generally must
- look like this:</p>
- <code type="none">
- {version,"1.2"}.
- [{config_func,{Module,Function,Arguments}}]. </code>
- <p><c>Module</c> is the name of the module where the callback
- function is defined. <c>Function</c> is the name of the
- callback function, and <c>Arguments</c> is the list of
- arguments to the callback function.</p>
- </section>
-
- <section>
- <title>The configuration function</title>
- <p>The *.tool file points out a configuration function. This
- function must return a list of configuration parameters (see
- the Reference Manual for <seealso marker="webtool">webtool</seealso>).</p>
- <p>The <c>web_data</c> parameter is mandatory and it specifies
- the name of the tool and the link to the tool's start
- page. All other parameters are optional.</p>
- <p>If the tool requires any processes to run, the <c>start</c>
- parameter specifies the function that WebTool must call in
- order to start the process(es).</p>
- <p>The <c>alias</c> parameters are passed directly on to the
- webserver (INETS). The webserver has three ways to create
- dynamic web pages CGI, Eval Scheme and Erl Scheme. All tools
- running under WebTool must use Erl Scheme.</p>
- <p>Erl Scheme tries to resemble plain CGI. The big difference is
- that Erl Scheme can only execute Erlang code. The code will
- furthermore be executed on the same instance as the webserver.</p>
- <p>An URL which calls an Erlang function with Erl Scheme can have
- the following syntax:</p>
- <code type="none"><![CDATA[
-http://Servername:Port/ErlScriptAlias/Mod/Func<?QueryString> ]]></code>
- <p>An <c>alias</c> parameter in the configuration function can be
- an ErlScriptAlias as used in the above URL. The definition of
- an ErlScriptAlias shall be like this:</p>
- <p><c>{alias,{erl_alias,Path,[Modules]}}</c>, e.g.</p>
- <p><c>{alias,{erl_alias,"/testtool",[helloworld]}}</c></p>
- <p>The following URL will then cause a call to the function
- helloworld:helloworld/2 (if WebTool is started with default
- settings i.e. servername "localhost" and port 8888):</p>
- <p><c>http://localhost:8888/testtool/helloworld/helloworld</c></p>
- <p>Note that the module <c>helloworld</c> must be in the code
- path of the node running WebTool.</p>
- <p>Functions that are called via the Erl Scheme must take two
- arguments, <c>Environment</c> and <c>Input</c>.
- </p>
- <list type="bulleted">
- <item><c>Environment</c> is a list of key/value tuples.</item>
- <item><c>Input</c> is the part of the URL after the "?", i.e. the
- part of the URL containing name-value pairs. If the page was
- called with the URL:
- <br></br>
-<c><![CDATA[http://localhost:8888/testtool/helloworld/helloworld?input1=one&amp;input2=two]]></c> <br></br>
-<c>Input</c> will be the string
- <c><![CDATA["input1=one&amp;input2=two"]]></c>. In the module
- <c>httpd</c> in the INETS application there is a function
- <c>parse_query</c> which will parse such a string and return
- a list of key-value tuples.</item>
- </list>
- <p>An <c>alias</c> parameter in the configuration function can
- also be a normal path alias. This can e.g. be used to point
- out a directory where HTML files are stored. The following
- definition states that the URL
- <c>http://localhost:8888/mytool_home/</c> really points to the
- directory <c>/usr/local/otp/lib/myapp-1.0/priv</c>:</p>
- <p><c>{alias,{"/mytool_home","/usr/local/otp/lib/myapp-1.0/priv"}}</c></p>
- <p>See the INETS documentation, especially the module
- <c>mod_esi</c>, for a more in depth coverage of the Erl Scheme.</p>
- </section>
-
- <section>
- <title>A small example</title>
- <p>A Hello World example that uses Erl Scheme would look like
- this. Note that this example does not have a process running
- and thus does not need a <c>start</c> parameter in the
- configuration function.
- </p>
- <p><em>helloworld.erl:</em></p>
- <pre>
- -module(helloworld).
- -export([config_data/0]).
- -export([helloworld/2]).
-
- config_data()->
- {testtool,
- [{web_data,{"TestTool","/testtool/helloworld/helloworld"}},
- {alias,{erl_alias,"/testtool",[helloworld]}}]}.
-
- helloworld(_Env,_Input)-&gt;
- [header(),html_header(),helloworld_body(),html_end()].
-
- header() -&gt;
- header("text/html").
-
- header(MimeType) -&gt;
- "Content-type: " ++ MimeType ++ "\r\n\r\n".
-
- html_header() -&gt;
- "&lt;HTML&gt;
- &lt;HEAD&gt;
- &lt;TITLE&gt;Hello world Example &lt;/TITLE&gt;
- &lt;/HEAD&gt;\n".
-
- helloworld_body()-&gt;
- "&lt;BODY&gt;Hello World&lt;/BODY&gt;".
-
- html_end()-&gt;
- "&lt;/HTML&gt;".
- </pre>
- <p>To use this example with WebTool a *.tool file must be created
- and added to a directory in the current path, e.g. the same
- directory as the compiled <c>helloworld.beam</c>.</p>
- <p><em>testtool.tool:</em></p>
- <code type="none">
- {version,"1.2"}.
- [{config_func, {helloworld,config_data,[]}}].
- </code>
- <p>When <c>helloworld.erl</c> is compiled, start WebTool by
- calling the function <c>webtool:start()</c> and point your
- browser to <em>http://localhost:8888/</em>. Select WebTool in
- the topmost frame and start TestTool from the web page. Click
- on the link labeled <em>TestTool</em> in the topmost frame.</p>
- </section>
- </section>
-</chapter>
-
diff --git a/lib/webtool/ebin/.gitignore b/lib/webtool/ebin/.gitignore
deleted file mode 100644
index e69de29bb2..0000000000
--- a/lib/webtool/ebin/.gitignore
+++ /dev/null
diff --git a/lib/webtool/info b/lib/webtool/info
deleted file mode 100644
index 4d8dc6f2cb..0000000000
--- a/lib/webtool/info
+++ /dev/null
@@ -1,2 +0,0 @@
-group: tools
-short: A tool that simplifying the use of web based Erlang tools
diff --git a/lib/webtool/priv/Makefile b/lib/webtool/priv/Makefile
deleted file mode 100644
index 4963767a4d..0000000000
--- a/lib/webtool/priv/Makefile
+++ /dev/null
@@ -1,82 +0,0 @@
-# ``Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# The Initial Developer of the Original Code is Ericsson Utvecklings AB.
-# Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings
-# AB. All Rights Reserved.''
-#
-# $Id$
-#
-include $(ERL_TOP)/make/target.mk
-include $(ERL_TOP)/make/$(TARGET)/otp.mk
-
-# ----------------------------------------------------
-# Application version
-# ----------------------------------------------------
-include ../vsn.mk
-VSN=$(WEBTOOL_VSN)
-
-# ----------------------------------------------------
-# Release directory specification
-# ----------------------------------------------------
-RELSYSDIR = $(RELEASE_PATH)/lib/webtool-$(VSN)
-
-# ----------------------------------------------------
-# Target Specs
-# ----------------------------------------------------
-
-WEBSERVER_CONFIG_FILES = root/conf/mime.types
-
-HTDOCS_FILES = root/doc/index.html \
- root/doc/tool_management.html \
- root/doc/start_info.html
-
-ifeq ($(findstring win32,$(TARGET)),win32)
-WIN32_SCRIPTS= bin/start_webtool.bat
-else
-WIN32_SCRIPTS=
-endif
-SCRIPTS = bin/start_webtool $(WIN32_SCRIPTS)
-
-# ----------------------------------------------------
-# FLAGS
-# ----------------------------------------------------
-ERL_COMPILE_FLAGS +=
-
-# ----------------------------------------------------
-# Targets
-# ----------------------------------------------------
-
-debug opt:
-
-clean:
-
-docs:
-
-# ----------------------------------------------------
-# Release Target
-# ----------------------------------------------------
-include $(ERL_TOP)/make/otp_release_targets.mk
-
-release_spec: opt
- $(INSTALL_DIR) "$(RELSYSDIR)/priv"
- $(INSTALL_DIR) "$(RELSYSDIR)/priv/root"
- $(INSTALL_DIR) "$(RELSYSDIR)/priv/root/conf"
- $(INSTALL_DIR) "$(RELSYSDIR)/priv/root/doc"
- $(INSTALL_DATA) $(HTDOCS_FILES) "$(RELSYSDIR)/priv/root/doc"
- $(INSTALL_DATA) $(WEBSERVER_CONFIG_FILES) "$(RELSYSDIR)/priv/root/conf"
- $(INSTALL_DIR) "$(RELSYSDIR)/priv/bin"
- $(INSTALL_SCRIPT) $(SCRIPTS) "$(RELSYSDIR)/priv/bin"
-
-release_docs_spec:
-
-
diff --git a/lib/webtool/priv/bin/start_webtool b/lib/webtool/priv/bin/start_webtool
deleted file mode 100755
index e552fb5af0..0000000000
--- a/lib/webtool/priv/bin/start_webtool
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-erl -sname webtool -s webtool script_start $@
diff --git a/lib/webtool/priv/bin/start_webtool.bat b/lib/webtool/priv/bin/start_webtool.bat
deleted file mode 100644
index cd16aa6200..0000000000
--- a/lib/webtool/priv/bin/start_webtool.bat
+++ /dev/null
@@ -1,2 +0,0 @@
-@ECHO OFF
-CALL erl -sname webtool -s webtool script_start %* -s erlang halt \ No newline at end of file
diff --git a/lib/webtool/priv/root/conf/mime.types b/lib/webtool/priv/root/conf/mime.types
deleted file mode 100644
index 32f7cd853c..0000000000
--- a/lib/webtool/priv/root/conf/mime.types
+++ /dev/null
@@ -1,99 +0,0 @@
-# This is a comment. I love comments.
-
-application/activemessage
-application/andrew-inset
-application/applefile
-application/atomicmail
-application/dca-rft
-application/dec-dx
-application/mac-binhex40 hqx
-application/mac-compactpro cpt
-application/macwriteii
-application/msword doc
-application/news-message-id
-application/news-transmission
-application/octet-stream bin dms lha lzh exe class
-application/oda oda
-application/pdf pdf
-application/postscript ai eps ps
-application/powerpoint ppt
-application/remote-printing
-application/rtf rtf
-application/slate
-application/wita
-application/wordperfect5.1
-application/x-bcpio bcpio
-application/x-cdlink vcd
-application/x-compress Z
-application/x-cpio cpio
-application/x-csh csh
-application/x-director dcr dir dxr
-application/x-dvi dvi
-application/x-gtar gtar
-application/x-gzip gz
-application/x-hdf hdf
-application/x-httpd-cgi cgi
-application/x-koan skp skd skt skm
-application/x-latex latex
-application/x-mif mif
-application/x-netcdf nc cdf
-application/x-sh sh
-application/x-shar shar
-application/x-stuffit sit
-application/x-sv4cpio sv4cpio
-application/x-sv4crc sv4crc
-application/x-tar tar
-application/x-tcl tcl
-application/x-tex tex
-application/x-texinfo texinfo texi
-application/x-troff t tr roff
-application/x-troff-man man
-application/x-troff-me me
-application/x-troff-ms ms
-application/x-ustar ustar
-application/x-wais-source src
-application/zip zip
-audio/basic au snd
-audio/mpeg mpga mp2
-audio/x-aiff aif aiff aifc
-audio/x-pn-realaudio ram
-audio/x-pn-realaudio-plugin rpm
-audio/x-realaudio ra
-audio/x-wav wav
-chemical/x-pdb pdb xyz
-image/gif gif
-image/ief ief
-image/jpeg jpeg jpg jpe
-image/png png
-image/tiff tiff tif
-image/x-cmu-raster ras
-image/x-portable-anymap pnm
-image/x-portable-bitmap pbm
-image/x-portable-graymap pgm
-image/x-portable-pixmap ppm
-image/x-rgb rgb
-image/x-xbitmap xbm
-image/x-xpixmap xpm
-image/x-xwindowdump xwd
-message/external-body
-message/news
-message/partial
-message/rfc822
-multipart/alternative
-multipart/appledouble
-multipart/digest
-multipart/mixed
-multipart/parallel
-text/html html htm
-text/x-server-parsed-html shtml
-text/plain txt
-text/richtext rtx
-text/tab-separated-values tsv
-text/x-setext etx
-text/x-sgml sgml sgm
-video/mpeg mpeg mpg mpe
-video/quicktime qt mov
-video/x-msvideo avi
-video/x-sgi-movie movie
-x-conference/x-cooltalk ice
-x-world/x-vrml wrl vrml
diff --git a/lib/webtool/priv/root/doc/index.html b/lib/webtool/priv/root/doc/index.html
deleted file mode 100644
index 9fbb143cc7..0000000000
--- a/lib/webtool/priv/root/doc/index.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<HTML>
-<HEAD>
-<TITLE>Erlang WebTool</TITLE>
-</HEAD>
-<FRAMESET ROWS="60,*">
-<FRAME NAME="top1" SRC="webtool/webtool/started_tools">
-<FRAME NAME="app_frame" SRC="./start_info.html">
-</FRAMESET>
-</HTML>
-
-
diff --git a/lib/webtool/priv/root/doc/start_info.html b/lib/webtool/priv/root/doc/start_info.html
deleted file mode 100644
index fcf44433f1..0000000000
--- a/lib/webtool/priv/root/doc/start_info.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<HTML>
-<HEAD>
-</HEAD>
-<BODY BGCOLOR="#FFFFFF">
-<TABLE WIDTH=100% HEIGHT=100%>
-<TR VALIGN="middle">
-<TD ALIGN="center">
-
-<TABLE WIDTH="60%">
-<TR>
-<TD ALIGN="center"><FONT SIZE=6>Welcome <BR> to<BR> WebTool</FONT></TD>
-</TR>
-
-<TR>
-<TD><BR><BR><BR><BR>
-</TD>
-</TR>
-
-<TR>
-<TD ALIGN="center">Click on the link WebTool on the top of the page, or <A HREF=tool_management.html>here</a> to start the Web based tools.</TD>
-</TR>
-</TABLE>
-
-</TD>
-</TR>
-</TABLE>
-</BODY>
-</HTML> \ No newline at end of file
diff --git a/lib/webtool/priv/root/doc/tool_management.html b/lib/webtool/priv/root/doc/tool_management.html
deleted file mode 100644
index 19d9dbcb9e..0000000000
--- a/lib/webtool/priv/root/doc/tool_management.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<HTML>
-<HEAD>
-<TITLE>Erlang WebTool </TITLE>
-</HEAD>
-<FRAMESET COLS="200,*">
-<FRAME NAME="left" SRC="/webtool/webtool/toolbar">
-<FRAME NAME="right" SRC="/webtool/webtool/start_tools">
-</FRAMESET>
-
diff --git a/lib/webtool/src/Makefile b/lib/webtool/src/Makefile
deleted file mode 100644
index a5a8eaf5dc..0000000000
--- a/lib/webtool/src/Makefile
+++ /dev/null
@@ -1,98 +0,0 @@
-#
-# %CopyrightBegin%
-#
-# Copyright Ericsson AB 2001-2012. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# %CopyrightEnd%
-#
-include $(ERL_TOP)/make/target.mk
-include $(ERL_TOP)/make/$(TARGET)/otp.mk
-
-# ----------------------------------------------------
-# Application version
-# ----------------------------------------------------
-include ../vsn.mk
-VSN=$(WEBTOOL_VSN)
-
-# ----------------------------------------------------
-# Release directory specification
-# ----------------------------------------------------
-RELSYSDIR = $(RELEASE_PATH)/lib/webtool-$(VSN)
-
-# ----------------------------------------------------
-# Target Specs
-# ----------------------------------------------------
-
-MODULES= webtool \
- webtool_sup
-
-
-
-ERL_FILES= $(MODULES:%=%.erl)
-
-TARGET_FILES = $(MODULES:%=$(EBIN)/%.$(EMULATOR))
-
-APP_FILE= webtool.app
-APPUP_FILE= webtool.appup
-
-APP_SRC= $(APP_FILE).src
-APPUP_SRC= $(APPUP_FILE).src
-
-
-APP_TARGET= $(EBIN)/$(APP_FILE)
-APPUP_TARGET= $(EBIN)/$(APPUP_FILE)
-
-# ----------------------------------------------------
-# FLAGS
-# ----------------------------------------------------
-ERL_COMPILE_FLAGS += +warn_obsolete_guard
-
-
-# ----------------------------------------------------
-# Targets
-# ----------------------------------------------------
-
-debug opt: $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET)
-
-clean:
- rm -f $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET)
- rm -f core
-
-docs:
-
-# ----------------------------------------------------
-# Special Build Targets
-# ----------------------------------------------------
-
-$(APP_TARGET): $(APP_SRC) ../vsn.mk
- $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@
-
-$(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk
- $(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@
-
-# ----------------------------------------------------
-# Release Target
-# ----------------------------------------------------
-include $(ERL_TOP)/make/otp_release_targets.mk
-
-release_spec: opt
- $(INSTALL_DIR) "$(RELSYSDIR)/src"
- $(INSTALL_DATA) $(ERL_FILES) $(HRL_FILES) "$(RELSYSDIR)/src"
- $(INSTALL_DIR) "$(RELSYSDIR)/ebin"
- $(INSTALL_DATA) $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) \
- "$(RELSYSDIR)/ebin"
-
-release_docs_spec:
-
diff --git a/lib/webtool/src/webtool.appup.src b/lib/webtool/src/webtool.appup.src
deleted file mode 100644
index 1394d0d6d5..0000000000
--- a/lib/webtool/src/webtool.appup.src
+++ /dev/null
@@ -1,22 +0,0 @@
-%% -*- erlang -*-
-%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2001-2014. All Rights Reserved.
-%%
-%% Licensed under the Apache License, Version 2.0 (the "License");
-%% you may not use this file except in compliance with the License.
-%% You may obtain a copy of the License at
-%%
-%% http://www.apache.org/licenses/LICENSE-2.0
-%%
-%% Unless required by applicable law or agreed to in writing, software
-%% distributed under the License is distributed on an "AS IS" BASIS,
-%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-%% See the License for the specific language governing permissions and
-%% limitations under the License.
-%%
-%% %CopyrightEnd%
-{"%VSN%",
- [{<<".*">>,[{restart_application, webtool}]}],
- [{<<".*">>,[{restart_application, webtool}]}]
-}.
diff --git a/lib/webtool/src/webtool.erl b/lib/webtool/src/webtool.erl
deleted file mode 100644
index 80dad53f8f..0000000000
--- a/lib/webtool/src/webtool.erl
+++ /dev/null
@@ -1,1208 +0,0 @@
-%%
-%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2001-2010. All Rights Reserved.
-%%
-%% Licensed under the Apache License, Version 2.0 (the "License");
-%% you may not use this file except in compliance with the License.
-%% You may obtain a copy of the License at
-%%
-%% http://www.apache.org/licenses/LICENSE-2.0
-%%
-%% Unless required by applicable law or agreed to in writing, software
-%% distributed under the License is distributed on an "AS IS" BASIS,
-%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-%% See the License for the specific language governing permissions and
-%% limitations under the License.
-%%
-%% %CopyrightEnd%
-%%
--module(webtool).
--behaviour(gen_server).
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% %%
-%% The general idea is: %%
-%% %%
-%% %%
-%% 1. Scan through the path for *.tool files and find all the web %%
-%% based tools. Query each tool for configuration data. %%
-%% 2. Add Alias for Erlscript and html for each tool to %%
-%% the webserver configuration data. %%
-%% 3. Start the webserver. %%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%% API functions
--export([start/0, start/2, stop/0]).
-
-%% Starting Webtool from a shell script
--export([script_start/0, script_start/1]).
-
-%% Web api
--export([started_tools/2, toolbar/2, start_tools/2, stop_tools/2]).
-
-%% API against other tools
--export([is_localhost/0]).
-
-%% Debug export s
--export([get_tools1/1]).
--export([debug/1, stop_debug/0, debug_app/1]).
-
-%% gen_server callbacks
--export([init/1, handle_call/3, handle_cast/2, handle_info/2,
- terminate/2, code_change/3]).
-
--include_lib("kernel/include/file.hrl").
--include_lib("stdlib/include/ms_transform.hrl").
-
--record(state,{priv_dir,app_data,supvis,web_data,started=[]}).
-
--define(MAX_NUMBER_OF_WEBTOOLS,256).
--define(DEFAULT_PORT,8888).% must be >1024 or the user must be root on unix
--define(DEFAULT_ADDR,{127,0,0,1}).
-
--define(WEBTOOL_ALIAS,{webtool,[{alias,{erl_alias,"/webtool",[webtool]}}]}).
--define(HEADER,"Pragma:no-cache\r\n Content-type: text/html\r\n\r\n").
--define(HTML_HEADER,"<HTML>\r\n<HEAD>\r\n<TITLE>WebTool</TITLE>\r\n</HEAD>\r\n<BODY BGCOLOR=\"#FFFFFF\">\r\n").
--define(HTML_HEADER_RELOAD,"<HTML>\r\n<HEAD>\r\n<TITLE>WebTool
- </TITLE>\r\n</HEAD>\r\n
- <BODY BGCOLOR=\"#FFFFFF\" onLoad=reloadCompiledList()>\r\n").
-
--define(HTML_END,"</BODY></HTML>").
-
--define(SEND_URL_TIMEOUT,5000).
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% %%
-%% For debugging only. %%
-%% %%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% Start tracing with
-%% debug(Functions).
-%% Functions = local | global | FunctionList
-%% FunctionList = [Function]
-%% Function = {FunctionName,Arity} | FunctionName |
-%% {Module, FunctionName, Arity} | {Module,FunctionName}
-debug(F) ->
- ttb:tracer(all,[{file,"webtool.trc"}]), % tracing all nodes
- ttb:p(all,[call,timestamp]),
- MS = [{'_',[],[{return_trace},{message,{caller}}]}],
- tp(F,MS),
- ttb:ctp(?MODULE,stop_debug), % don't want tracing of the stop_debug func
- ok.
-tp(local,MS) -> % all functions
- ttb:tpl(?MODULE,MS);
-tp(global,MS) -> % all exported functions
- ttb:tp(?MODULE,MS);
-tp([{M,F,A}|T],MS) -> % Other module
- ttb:tpl(M,F,A,MS),
- tp(T,MS);
-tp([{M,F}|T],MS) when is_atom(F) -> % Other module
- ttb:tpl(M,F,MS),
- tp(T,MS);
-tp([{F,A}|T],MS) -> % function/arity
- ttb:tpl(?MODULE,F,A,MS),
- tp(T,MS);
-tp([F|T],MS) -> % function
- ttb:tpl(?MODULE,F,MS),
- tp(T,MS);
-tp([],_MS) ->
- ok.
-stop_debug() ->
- ttb:stop([format]).
-
-debug_app(Mod) ->
- ttb:tracer(all,[{file,"webtool_app.trc"},{handler,{fun out/4,true}}]),
- ttb:p(all,[call,timestamp]),
- MS = [{'_',[],[{return_trace},{message,{caller}}]}],
- ttb:tp(Mod,MS),
- ok.
-
-out(_,{trace_ts,Pid,call,MFA={M,F,A},{W,_,_},TS},_,S)
- when W==webtool;W==mod_esi->
- io:format("~w: (~p)~ncall ~s~n", [TS,Pid,ffunc(MFA)]),
- [{M,F,length(A)}|S];
-out(_,{trace_ts,Pid,return_from,MFA,R,TS},_,[MFA|S]) ->
- io:format("~w: (~p)~nreturned from ~s -> ~p~n", [TS,Pid,ffunc(MFA),R]),
- S;
-out(_,_,_,_) ->
- ok.
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% %%
-%% Functions called via script. %%
-%% %%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-script_start() ->
- usage(),
- halt().
-script_start([App]) ->
- DefaultBrowser =
- case os:type() of
- {win32,_} -> iexplore;
- _ -> firefox
- end,
- script_start([App,DefaultBrowser]);
-script_start([App,Browser]) ->
- io:format("Starting webtool...\n"),
- start(),
- AvailableApps = get_applications(),
- {OSType,_} = os:type(),
- case lists:keysearch(App,1,AvailableApps) of
- {value,{App,StartPage}} ->
- io:format("Starting ~w...\n",[App]),
- start_tools([],"app=" ++ atom_to_list(App)),
- PortStr = integer_to_list(get_port()),
- Url = case StartPage of
- "/" ++ Page ->
- "http://localhost:" ++ PortStr ++ "/" ++ Page;
- _ ->
- "http://localhost:" ++ PortStr ++ "/" ++ StartPage
- end,
- case Browser of
- none ->
- ok;
- iexplore when OSType == win32->
- io:format("Starting internet explorer...\n"),
- {ok,R} = win32reg:open(""),
- Key="\\local_machine\\SOFTWARE\\Microsoft\\IE Setup\\Setup",
- win32reg:change_key(R,Key),
- {ok,Val} = win32reg:value(R,"Path"),
- IExplore=filename:join(win32reg:expand(Val),"iexplore.exe"),
- os:cmd("\"" ++ IExplore ++ "\" " ++ Url);
- _ when OSType == win32 ->
- io:format("Starting ~w...\n",[Browser]),
- os:cmd("\"" ++ atom_to_list(Browser) ++ "\" " ++ Url);
- B when B==firefox; B==mozilla ->
- io:format("Sending URL to ~w...",[Browser]),
- BStr = atom_to_list(Browser),
- SendCmd = BStr ++ " -raise -remote \'openUrl(" ++
- Url ++ ")\'",
- Port = open_port({spawn,SendCmd},[exit_status]),
- receive
- {Port,{exit_status,0}} ->
- io:format("done\n"),
- ok;
- {Port,{exit_status,_Error}} ->
- io:format(" not running, starting ~w...\n",
- [Browser]),
- os:cmd(BStr ++ " " ++ Url),
- ok
- after ?SEND_URL_TIMEOUT ->
- io:format(" failed, starting ~w...\n",[Browser]),
- erlang:port_close(Port),
- os:cmd(BStr ++ " " ++ Url)
- end;
- _ ->
- io:format("Starting ~w...\n",[Browser]),
- os:cmd(atom_to_list(Browser) ++ " " ++ Url)
- end,
- ok;
- false ->
- stop(),
- io:format("\n{error,{unknown_app,~p}}\n",[App]),
- halt()
- end.
-
-usage() ->
- io:format("Starting webtool...\n"),
- start(),
- Apps = lists:map(fun({A,_}) -> A end,get_applications()),
- io:format(
- "\nUsage: start_webtool application [ browser ]\n"
- "\nAvailable applications are: ~p\n"
- "Default browser is \'iexplore\' (Internet Explorer) on Windows "
- "or else \'firefox\'\n",
- [Apps]),
- stop().
-
-
-get_applications() ->
- gen_server:call(web_tool,get_applications).
-
-get_port() ->
- gen_server:call(web_tool,get_port).
-
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% %%
-%% Api functions to the genserver. %%
-%% %%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%----------------------------------------------------------------------
-%
-%----------------------------------------------------------------------
-
-start()->
- start(standard_path,standard_data).
-
-start(Path,standard_data)->
- case get_standard_data() of
- {error,Reason} ->
- {error,Reason};
- Data ->
- start(Path,Data)
- end;
-
-start(standard_path,Data)->
- Path=get_path(),
- start(Path,Data);
-
-start(Path,Port) when is_integer(Port)->
- Data = get_standard_data(Port),
- start(Path,Data);
-
-start(Path,Data0)->
- Data = Data0 ++ rest_of_standard_data(),
- gen_server:start({local,web_tool},webtool,{Path,Data},[]).
-
-stop()->
- gen_server:call(web_tool,stoppit).
-
-%----------------------------------------------------------------------
-%Web Api functions called by the web
-%----------------------------------------------------------------------
-started_tools(Env,Input)->
- gen_server:call(web_tool,{started_tools,Env,Input}).
-
-toolbar(Env,Input)->
- gen_server:call(web_tool,{toolbar,Env,Input}).
-
-start_tools(Env,Input)->
- gen_server:call(web_tool,{start_tools,Env,Input}).
-
-stop_tools(Env,Input)->
- gen_server:call(web_tool,{stop_tools,Env,Input}).
-%----------------------------------------------------------------------
-%Support API for other tools
-%----------------------------------------------------------------------
-
-is_localhost()->
- gen_server:call(web_tool,is_localhost).
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% %%
-%%The gen_server callback functions that builds the webbpages %%
-%% %%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-handle_call(get_applications,_,State)->
- MS = ets:fun2ms(fun({Tool,{web_data,{_,Start}}}) -> {Tool,Start} end),
- Tools = ets:select(State#state.app_data,MS),
- {reply,Tools,State};
-
-handle_call(get_port,_,State)->
- {value,{port,Port}}=lists:keysearch(port,1,State#state.web_data),
- {reply,Port,State};
-
-handle_call({started_tools,_Env,_Input},_,State)->
- {reply,started_tools_page(State),State};
-
-handle_call({toolbar,_Env,_Input},_,State)->
- {reply,toolbar(),State};
-
-handle_call({start_tools,Env,Input},_,State)->
- {NewState,Page}=start_tools_page(Env,Input,State),
- {reply,Page,NewState};
-
-handle_call({stop_tools,Env,Input},_,State)->
- {NewState,Page}=stop_tools_page(Env,Input,State),
- {reply,Page,NewState};
-
-handle_call(stoppit,_From,Data)->
- {stop,normal,ok,Data};
-
-handle_call(is_localhost,_From,Data)->
- Result=case proplists:get_value(bind_address, Data#state.web_data) of
- ?DEFAULT_ADDR ->
- true;
- _IpNumber ->
- false
- end,
- {reply,Result,Data}.
-
-
-handle_info(_Message,State)->
- {noreply,State}.
-
-handle_cast(_Request,State)->
- {noreply,State}.
-
-code_change(_,State,_)->
- {ok,State}.
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% The other functions needed by the gen_server behaviour
-%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%----------------------------------------------------------------------
-% Start the gen_server
-%----------------------------------------------------------------------
-init({Path,Config})->
- case filelib:is_dir(Path) of
- true ->
- {ok, Table} = get_tool_files_data(),
- insert_app(?WEBTOOL_ALIAS, Table),
- case webtool_sup:start_link() of
- {ok, Pid} ->
- case start_webserver(Table, Path, Config) of
- {ok, _} ->
- print_url(Config),
- {ok,#state{priv_dir=Path,
- app_data=Table,
- supvis=Pid,
- web_data=Config}};
- {error, Error} ->
- {stop, {error, Error}}
- end;
- Error ->
- {stop,Error}
- end;
- false ->
- {stop, {error, error_dir}}
- end.
-
-terminate(_Reason,Data)->
- %%shut down the webbserver
- shutdown_server(Data),
- %%Shutdown the different tools that are started with application:start
- shutdown_apps(Data),
- %%Shutdown the supervisor and its children will die
- shutdown_supervisor(Data),
- ok.
-
-print_url(ConfigData)->
- Server=proplists:get_value(server_name,ConfigData,"undefined"),
- Port=proplists:get_value(port,ConfigData,"undefined"),
- {A,B,C,D}=proplists:get_value(bind_address,ConfigData,"undefined"),
- io:format("WebTool is available at http://~s:~w/~n",[Server,Port]),
- io:format("Or http://~w.~w.~w.~w:~w/~n",[A,B,C,D,Port]).
-
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% begin build the pages
-%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%----------------------------------------------------------------------
-%The page that shows the started tools
-%----------------------------------------------------------------------
-started_tools_page(State)->
- [?HEADER,?HTML_HEADER,started_tools(State),?HTML_END].
-
-toolbar()->
- [?HEADER,?HTML_HEADER,toolbar_page(),?HTML_END].
-
-
-start_tools_page(_Env,Input,State)->
- %%io:format("~n======= ~n ~p ~n============~n",[Input]),
- case get_tools(Input) of
- {tools,Tools}->
- %%io:format("~n======= ~n ~p ~n============~n",[Tools]),
- {ok,NewState}=handle_apps(Tools,State,start),
- {NewState,[?HEADER,?HTML_HEADER_RELOAD,reload_started_apps(),
- show_unstarted_apps(NewState),?HTML_END]};
- _ ->
- {State,[?HEADER,?HTML_HEADER,show_unstarted_apps(State),?HTML_END]}
- end.
-
-stop_tools_page(_Env,Input,State)->
- case get_tools(Input) of
- {tools,Tools}->
- {ok,NewState}=handle_apps(Tools,State,stop),
- {NewState,[?HEADER,?HTML_HEADER_RELOAD,reload_started_apps(),
- show_started_apps(NewState),?HTML_END]};
- _ ->
- {State,[?HEADER,?HTML_HEADER,show_started_apps(State),?HTML_END]}
- end.
-
-
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%
-%% Functions that start and config the webserver
-%% 1. Collect the config data
-%% 2. Start webserver
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%----------------------------------------------------------------------
-% Start the webserver
-%----------------------------------------------------------------------
-start_webserver(Data,Path,Config)->
- case get_conf_data(Data,Path,Config) of
- {ok,Conf_data}->
- %%io:format("Conf_data: ~p~n",[Conf_data]),
- start_server(Conf_data);
- {error,Error} ->
- {error,{error_server_conf_file,Error}}
- end.
-
-start_server(Conf_data)->
- case inets:start(httpd, Conf_data, stand_alone) of
- {ok,Pid}->
- {ok,Pid};
- Error->
- {error,{server_error,Error}}
- end.
-
-%----------------------------------------------------------------------
-% Create config data for the webserver
-%----------------------------------------------------------------------
-get_conf_data(Data,Path,Config)->
- Aliases=get_aliases(Data),
- ServerRoot = filename:join([Path,"root"]),
- MimeTypesFile = filename:join([ServerRoot,"conf","mime.types"]),
- case httpd_conf:load_mime_types(MimeTypesFile) of
- {ok,MimeTypes} ->
- Config1 = Config ++ Aliases,
- Config2 = [{server_root,ServerRoot},
- {document_root,filename:join([Path,"root/doc"])},
- {mime_types,MimeTypes} |
- Config1],
- {ok,Config2};
- Error ->
- Error
- end.
-
-%----------------------------------------------------------------------
-% Control the path for *.tools files
-%----------------------------------------------------------------------
-get_tool_files_data()->
- Tools=get_tools1(code:get_path()),
- %%io:format("Data : ~p ~n",[Tools]),
- get_file_content(Tools).
-
-%----------------------------------------------------------------------
-%Control that the data in the file really is erlang terms
-%----------------------------------------------------------------------
-get_file_content(Tools)->
- Get_data=fun({tool,ToolData}) ->
- %%io:format("Data : ~p ~n",[ToolData]),
- case proplists:get_value(config_func,ToolData) of
- {M,F,A}->
- case catch apply(M,F,A) of
- {'EXIT',_} ->
- bad_data;
- Data when is_tuple(Data) ->
- Data;
- _->
- bad_data
- end;
- _ ->
- bad_data
- end
- end,
- insert_file_content([X ||X<-lists:map(Get_data,Tools),X/=bad_data]).
-
-%----------------------------------------------------------------------
-%Insert the data from the file in to the ets:table
-%----------------------------------------------------------------------
-insert_file_content(Content)->
- Table=ets:new(app_data,[bag]),
- lists:foreach(fun(X)->
- insert_app(X,Table)
- end,Content),
- {ok,Table}.
-
-%----------------------------------------------------------------------
-%Control that we got a a tuple of a atom and a list if so add the
-%elements in the list to the ets:table
-%----------------------------------------------------------------------
-insert_app({Name,Key_val_list},Table) when is_list(Key_val_list),is_atom(Name)->
- %%io:format("ToolData: ~p: ~p~n",[Name,Key_val_list]),
- lists:foreach(
- fun({alias,{erl_alias,Alias,Mods}}) ->
- Key_val = {erl_script_alias,{Alias,Mods}},
- %%io:format("Insert: ~p~n",[Key_val]),
- ets:insert(Table,{Name,Key_val});
- (Key_val_pair)->
- %%io:format("Insert: ~p~n",[Key_val_pair]),
- ets:insert(Table,{Name,Key_val_pair})
- end,
- Key_val_list);
-
-insert_app(_,_)->
- ok.
-
-%----------------------------------------------------------------------
-% Select all the alias in the database
-%----------------------------------------------------------------------
-get_aliases(Data)->
- MS = ets:fun2ms(fun({_,{erl_script_alias,Alias}}) ->
- {erl_script_alias,Alias};
- ({_,{alias,Alias}}) ->
- {alias,Alias}
- end),
- ets:select(Data,MS).
-
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% %%
-%% Helper functions %%
-%% %%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-get_standard_data(Port)->
- [
- {port,Port},
- {bind_address,?DEFAULT_ADDR},
- {server_name,"localhost"}
- ].
-
-get_standard_data()->
- case get_free_port(?DEFAULT_PORT,?MAX_NUMBER_OF_WEBTOOLS) of
- {error,Reason} -> {error,Reason};
- Port ->
- [
- {port,Port},
- {bind_address,?DEFAULT_ADDR},
- {server_name,"localhost"}
- ]
- end.
-
-get_free_port(_Port,0) ->
- {error,no_free_port_found};
-get_free_port(Port,N) ->
- case gen_tcp:connect("localhost",Port,[]) of
- {error, _Reason} ->
- Port;
- {ok,Sock} ->
- gen_tcp:close(Sock),
- get_free_port(Port+1,N-1)
- end.
-
-rest_of_standard_data() ->
- [
- %% Do not allow the server to be crashed by malformed http-request
- {max_header_siz,1024},
- {max_header_action,reply414},
- %% Go on a straight ip-socket
- {com_type,ip_comm},
- %% Do not change the order of these module names!!
- {modules,[mod_alias,
- mod_auth,
- mod_esi,
- mod_actions,
- mod_cgi,
- mod_include,
- mod_dir,
- mod_get,
- mod_head,
- mod_log,
- mod_disk_log]},
- {directory_index,["index.html"]},
- {default_type,"text/plain"}
- ].
-
-
-get_path()->
- code:priv_dir(webtool).
-
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% These functions is used to shutdown the webserver
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%----------------------------------------------------------------------
-% Shut down the webbserver
-%----------------------------------------------------------------------
-shutdown_server(State)->
- {Addr,Port} = get_addr_and_port(State#state.web_data),
- inets:stop(httpd,{Addr,Port}).
-
-get_addr_and_port(Config) ->
- Addr = proplists:get_value(bind_address,Config,?DEFAULT_ADDR),
- Port = proplists:get_value(port,Config,?DEFAULT_PORT),
- {Addr,Port}.
-
-%----------------------------------------------------------------------
-% Select all apps in the table and close them
-%----------------------------------------------------------------------
-shutdown_apps(State)->
- Data=State#state.app_data,
- MS = ets:fun2ms(fun({_,{start,HowToStart}}) -> HowToStart end),
- lists:foreach(fun(Start_app)->
- stop_app(Start_app)
- end,
- ets:select(Data,MS)).
-
-%----------------------------------------------------------------------
-%Shuts down the supervisor that supervises tools that is not
-%Designed as applications
-%----------------------------------------------------------------------
-shutdown_supervisor(State)->
- %io:format("~n==================~n"),
- webtool_sup:stop(State#state.supvis).
- %io:format("~n==================~n").
-
-%----------------------------------------------------------------------
-%close the individual apps.
-%----------------------------------------------------------------------
-stop_app({child,_Real_name})->
- ok;
-
-stop_app({app,Real_name})->
- application:stop(Real_name);
-
-stop_app({func,_Start,Stop})->
- case Stop of
- {M,F,A} ->
- catch apply(M,F,A);
- _NoStop ->
- ok
- end.
-
-
-
-
-
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%
-%% These functions creates the webpage where the user can select if
-%% to start apps or to stop apps
-%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-toolbar_page()->
- "<TABLE>
- <TR>
- <TD>
- <B>Select Action</B>
- </TD>
- </TR>
- <TR>
- <TD>
- <A HREF=\"./start_tools\" TARGET=right> Start Tools</A>
- </TD>
- </TR>
- <TR>
- <TD>
- <A HREF=\"./stop_tools\" TARGET=right> Stop Tools</A>
- </TD>
- </TR>
- </TABLE>".
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%
-%% These functions creates the webbpage that shows the started apps
-%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%----------------------------------------------------------------------
-% started_tools(State)->String (html table)
-% State is a record of type state
-%----------------------------------------------------------------------
-started_tools(State)->
- Names=get_started_apps(State#state.app_data,State#state.started),
- "<TABLE BORDER=1 WIDTH=100%>
- "++ make_rows(Names,[],0) ++"
- </TABLE>".
-%----------------------------------------------------------------------
-%get_started_apps(Data,Started)-> [{web_name,link}]
-%selects the started apps from the ets table of apps.
-%----------------------------------------------------------------------
-
-get_started_apps(Data,Started)->
- SelectData=fun({Name,Link}) ->
- {Name,Link}
- end,
- MS = lists:map(fun(A) -> {{A,{web_data,'$1'}},[],['$1']} end,Started),
-
- [{"WebTool","/tool_management.html"} |
- [SelectData(X) || X <- ets:select(Data,MS)]].
-
-%----------------------------------------------------------------------
-% make_rows(List,Result,Fields)-> String (The rows of a htmltable
-% List a list of tupler discibed above
-% Result an accumulator for the result
-% Field, counter that counts the number of cols in each row.
-%----------------------------------------------------------------------
-make_rows([],Result,Fields)->
- Result ++ fill_out(Fields);
-make_rows([Data|Paths],Result,Field)when Field==0->
- make_rows(Paths,Result ++ "<TR>" ++ make_field(Data),Field+1);
-
-make_rows([Path|Paths],Result,Field)when Field==4->
- make_rows(Paths,Result ++ make_field(Path) ++ "</TR>",0);
-
-make_rows([Path|Paths],Result,Field)->
- make_rows(Paths,Result ++ make_field(Path),Field+1).
-
-%----------------------------------------------------------------------
-% make_fields(Path)-> String that is a field i a html table
-% Path is a name url tuple {Name,url}
-%----------------------------------------------------------------------
-make_field(Path)->
- "<TD WIDTH=20%>" ++ get_name(Path) ++ "</TD>".
-
-
-%----------------------------------------------------------------------
-%get_name({Nae,Url})->String that represents a <A> tag in html.
-%----------------------------------------------------------------------
-get_name({Name,Url})->
- "<A HREF=\"" ++ Url ++ "\" TARGET=app_frame>" ++ Name ++ "</A>".
-
-
-%----------------------------------------------------------------------
-% fill_out(Nr)-> String, that represent Nr fields in a html-table.
-%----------------------------------------------------------------------
-fill_out(Nr)when Nr==0->
- [];
-fill_out(Nr)when Nr==4->
- "<TD WIDTH=\"20%\" >&nbsp</TD></TR>";
-
-fill_out(Nr)->
- "<TD WIDTH=\"20%\">&nbsp</TD>" ++ fill_out(Nr+1).
-
-
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%
-%%These functions starts applicatons and builds the page showing tools
-%%to start
-%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%----------------------------------------------------------------------
-%Controls whether the user selected a tool to start
-%----------------------------------------------------------------------
-get_tools(Input)->
- case httpd:parse_query(Input) of
- []->
- no_tools;
- Tools->
- FormatData=fun({_Name,Data}) -> list_to_atom(Data) end,
- SelectData=
- fun({Name,_Data}) -> string:equal(Name,"app") end,
- {tools,[FormatData(X)||X<-Tools,SelectData(X)]}
- end.
-
-%----------------------------------------------------------------------
-% Selects the data to start the applications the user has ordered
-% starting of
-%----------------------------------------------------------------------
-handle_apps([],State,_Cmd)->
- {ok,State};
-
-handle_apps([Tool|Tools],State,Cmd)->
- case ets:match_object(State#state.app_data,{Tool,{start,'_'}}) of
- []->
- Started = case Cmd of
- start ->
- [Tool|State#state.started];
- stop ->
- lists:delete(Tool,State#state.started)
- end,
- {ok,#state{priv_dir=State#state.priv_dir,
- app_data=State#state.app_data,
- supvis=State#state.supvis,
- web_data=State#state.web_data,
- started=Started}};
- ToStart ->
- case handle_apps2(ToStart,State,Cmd) of
- {ok,NewState}->
- handle_apps(Tools,NewState,Cmd);
- _->
- handle_apps(Tools,State,Cmd)
- end
- end.
-
-%----------------------------------------------------------------------
-%execute every start or stop data about a tool.
-%----------------------------------------------------------------------
-handle_apps2([{Name,Start_data}],State,Cmd)->
- case handle_app({Name,Start_data},State#state.app_data,State#state.supvis,Cmd) of
- ok->
- Started = case Cmd of
- start ->
- [Name|State#state.started];
- stop ->
-
- lists:delete(Name,State#state.started)
- end,
- {ok,#state{priv_dir=State#state.priv_dir,
- app_data=State#state.app_data,
- supvis=State#state.supvis,
- web_data=State#state.web_data,
- started=Started}};
- _->
- error
- end;
-
-handle_apps2([{Name,Start_data}|Rest],State,Cmd)->
- case handle_app({Name,Start_data},State#state.app_data,State#state.supvis,Cmd)of
- ok->
- handle_apps2(Rest,State,Cmd);
- _->
- error
- end.
-
-
-%----------------------------------------------------------------------
-% Handle start and stop of applications
-%----------------------------------------------------------------------
-
-handle_app({Name,{start,{func,Start,Stop}}},Data,_Pid,Cmd)->
- Action = case Cmd of
- start ->
- Start;
- _ ->
- Stop
- end,
- case Action of
- {M,F,A} ->
- case catch apply(M,F,A) of
- {'EXIT',_} = Exit->
- %%! Here the tool disappears from the webtool interface!!
- io:format("\n=======ERROR (webtool, line ~w) =======\n"
- "Could not start application \'~p\'\n\n"
- "~w:~w(~s) ->\n"
- "~p\n\n",
- [?LINE,Name,M,F,format_args(A),Exit]),
- ets:delete(Data,Name);
- _OK->
- ok
- end;
- _NoStart ->
- ok
- end;
-
-
-handle_app({Name,{start,{child,ChildSpec}}},Data,Pid,Cmd)->
- case Cmd of
- start ->
- case catch supervisor:start_child(Pid,ChildSpec) of
- {ok,_}->
- ok;
- {ok,_,_}->
- ok;
- {error,Reason}->
- %%! Here the tool disappears from the webtool interface!!
- io:format("\n=======ERROR (webtool, line ~w) =======\n"
- "Could not start application \'~p\'\n\n"
- "supervisor:start_child(~p,~p) ->\n"
- "~p\n\n",
- [?LINE,Name,Pid,ChildSpec,{error,Reason}]),
- ets:delete(Data,Name);
- Error ->
- %%! Here the tool disappears from the webtool interface!!
- io:format("\n=======ERROR (webtool, line ~w) =======\n"
- "Could not start application \'~p\'\n\n"
- "supervisor:start_child(~p,~p) ->\n"
- "~p\n\n",
- [?LINE,Name,Pid,ChildSpec,Error]),
- ets:delete(Data,Name)
- end;
- stop ->
- case catch supervisor:terminate_child(websup,element(1,ChildSpec)) of
- ok ->
- supervisor:delete_child(websup,element(1,ChildSpec));
- _ ->
- error
- end
- end;
-
-
-
-handle_app({Name,{start,{app,Real_name}}},Data,_Pid,Cmd)->
- case Cmd of
- start ->
- case application:start(Real_name,temporary) of
- ok->
- io:write(Name),
- ok;
- {error,{already_started,_}}->
- %% Remove it from the database so we dont start
- %% anything already started
- ets:match_delete(Data,{Name,{start,{app,Real_name}}}),
- ok;
- {error,_Reason}=Error->
- %%! Here the tool disappears from the webtool interface!!
- io:format("\n=======ERROR (webtool, line ~w) =======\n"
- "Could not start application \'~p\'\n\n"
- "application:start(~p,~p) ->\n"
- "~p\n\n",
- [?LINE,Name,Real_name,temporary,Error]),
- ets:delete(Data,Name)
- end;
-
- stop ->
- application:stop(Real_name)
- end;
-
-%----------------------------------------------------------------------
-% If the data is incorrect delete the app
-%----------------------------------------------------------------------
-handle_app({Name,Incorrect},Data,_Pid,Cmd)->
- %%! Here the tool disappears from the webtool interface!!
- io:format("\n=======ERROR (webtool, line ~w) =======\n"
- "Could not ~w application \'~p\'\n\n"
- "Incorrect data: ~p\n\n",
- [?LINE,Cmd,Name,Incorrect]),
- ets:delete(Data,Name).
-
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% %%
-%% this functions creates the page that shows the unstarted tools %%
-%% %%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-reload_started_apps()->
- "<script>
- function reloadCompiledList()
- {
- parent.parent.top1.document.location.href=\"/webtool/webtool/started_tools\";
- }
- </script>".
-
-show_unstarted_apps(State)->
- "<TABLE HEIGHT=100% WIDTH=100% BORDER=0>
- <TR HEIGHT=80%><TD ALIGN=\"center\" VALIGN=\"middle\">
- <FORM NAME=\"stop_apps\" ACTION=\"/webtool/webtool/start_tools\" >
- <TABLE BORDER=1 WIDTH=60%>
- <TR BGCOLOR=\"#8899AA\">
- <TD ALIGN=CENTER COLSPAN=2><FONT SIZE=4>Available Tools<FONT></TD>
- </TR>
- <TR>
- <TD WIDTH=50%>
- <TABLE BORDER=0>
- "++ list_available_apps(State)++"
- <TR><TD COLSPAN=2>&nbsp;</TD></TR>
- <TR>
- <TD COLSPAN=2 ALIGN=\"center\">
- <INPUT TYPE=submit VALUE=\"Start\">
- </TD>
- </TR>
- </TABLE>
- </TD>
- <TD>
- To Start a Tool:
- <UL>
- <LI>Select the
- checkbox for each tool to
- start.</LI>
- <LI>Click on the
- button marked <EM>Start</EM>.</LI></UL>
- </TD>
- </TR>
- </TABLE>
- </FORM>
- </TD></TR>
- <TR><TD>&nbsp;</TD></TR>
- </TABLE>".
-
-
-
-list_available_apps(State)->
- MS = ets:fun2ms(fun({Tool,{web_data,{Name,_}}}) -> {Tool,Name} end),
- Unstarted_apps=
- lists:filter(
- fun({Tool,_})->
- false==lists:member(Tool,State#state.started)
- end,
- ets:select(State#state.app_data,MS)),
- case Unstarted_apps of
- []->
- "<TR><TD>All tools are started</TD></TR>";
- _->
- list_apps(Unstarted_apps)
- end.
-
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% %%
-%% these functions creates the page that shows the started apps %%
-%% the user can select to shutdown %%
-%% %%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-show_started_apps(State)->
- "<TABLE HEIGHT=100% WIDTH=100% BORDER=0>
- <TR HEIGHT=80%><TD ALIGN=\"center\" VALIGN=\"middle\">
- <FORM NAME=\"stop_apps\" ACTION=\"/webtool/webtool/stop_tools\" >
- <TABLE BORDER=1 WIDTH=60%>
- <TR BGCOLOR=\"#8899AA\">
- <TD ALIGN=CENTER COLSPAN=2><FONT SIZE=4>Started Tools<FONT></TD>
- </TR>
- <TR>
- <TD WIDTH=50%>
- <TABLE BORDER=0>
- "++ list_started_apps(State)++"
- <TR><TD COLSPAN=2>&nbsp;</TD></TR>
- <TR>
- <TD COLSPAN=2 ALIGN=\"center\">
- <INPUT TYPE=submit VALUE=\"Stop\">
- </TD>
- </TR>
- </TABLE>
- </TD>
- <TD>
- Stop a Tool:
- <UL>
- <LI>Select the
- checkbox for each tool to
- stop.</LI>
- <LI>Click on the
- button marked <EM>Stop</EM>.</LI></UL>
- </TD>
- </TR>
- </TABLE>
- </FORM>
- </TD></TR>
- <TR><TD>&nbsp;</TD></TR>
- </TABLE>".
-
-list_started_apps(State)->
- MS = lists:map(fun(A) -> {{A,{web_data,{'$1','_'}}},[],[{{A,'$1'}}]} end,
- State#state.started),
- Started_apps= ets:select(State#state.app_data,MS),
- case Started_apps of
- []->
- "<TR><TD>No tool is started yet.</TD></TR>";
- _->
- list_apps(Started_apps)
- end.
-
-
-list_apps(Apps) ->
- lists:map(fun({Tool,Name})->
- "<TR><TD>
- <INPUT TYPE=\"checkbox\" NAME=\"app\" VALUE=\""
- ++ atom_to_list(Tool) ++ "\">
- " ++ Name ++ "
- </TD></TR>"
- end,
- Apps).
-
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% %%
-%% Collecting the data from the *.tool files %%
-%% %%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%----------------------------------------
-% get_tools(Dirs) => [{M,F,A},{M,F,A}...{M,F,A}]
-% Dirs - [string()] Directory names
-% Calls get_tools2/2 recursively for a number of directories
-% to retireve the configuration data for the web based tools.
-%----------------------------------------
-get_tools1(Dirs)->
- get_tools1(Dirs,[]).
-
-get_tools1([Dir|Rest],Data) when is_list(Dir) ->
- Tools=case filename:basename(Dir) of
- %% Dir is an 'ebin' directory, check in '../priv' as well
- "ebin" ->
- [get_tools2(filename:join(filename:dirname(Dir),"priv")) |
- get_tools2(Dir)];
- _ ->
- get_tools2(Dir)
- end,
- get_tools1(Rest,[Tools|Data]);
-
-get_tools1([],Data) ->
- lists:flatten(Data).
-
-%----------------------------------------
-% get_tools2(Directory) => DataList
-% DataList : [WebTuple]|[]
-% WebTuple: {tool,[{web,M,F,A}]}
-%
-%----------------------------------------
-get_tools2(Dir)->
- get_tools2(tool_files(Dir),[]).
-
-get_tools2([ToolFile|Rest],Data) ->
- case get_tools3(ToolFile) of
- {tool,WebData} ->
- get_tools2(Rest,[{tool,WebData}|Data]);
- {error,_Reason} ->
- get_tools2(Rest,Data);
- nodata ->
- get_tools2(Rest,Data)
- end;
-
-get_tools2([],Data) ->
- Data.
-
-%----------------------------------------
-% get_tools3(ToolFile) => {ok,Tool}|{error,Reason}|nodata
-% Tool: {tool,[KeyValTuple]}
-% ToolFile - string() A .tool file
-% Now we have the file get the data and sort it out
-%----------------------------------------
-get_tools3(ToolFile) ->
- case file:consult(ToolFile) of
- {error,open} ->
- {error,nofile};
- {error,read} ->
- {error,format};
- {ok,[{version,"1.2"},ToolInfo]} when is_list(ToolInfo)->
- webdata(ToolInfo);
- {ok,[{version,_Vsn},_Info]} ->
- {error,old_version};
- {ok,_Other} ->
- {error,format}
- end.
-
-
-%----------------------------------------------------------------------
-% webdata(TupleList)-> ToolTuple| nodata
-% ToolTuple: {tool,[{config_func,{M,F,A}}]}
-%
-% There are a little unneccesary work in this format but it is extendable
-%----------------------------------------------------------------------
-webdata(TupleList)->
- case proplists:get_value(config_func,TupleList,nodata) of
- {M,F,A} ->
- {tool,[{config_func,{M,F,A}}]};
- _ ->
- nodata
- end.
-
-
-%=============================================================================
-% Functions for getting *.tool configuration files
-%=============================================================================
-
-%----------------------------------------
-% tool_files(Dir) => ToolFiles
-% Dir - string() Directory name
-% ToolFiles - [string()]
-% Return the list of all files in Dir ending with .tool (appended to Dir)
-%----------------------------------------
-tool_files(Dir) ->
- case file:list_dir(Dir) of
- {ok,Files} ->
- filter_tool_files(Dir,Files);
- {error,_Reason} ->
- []
- end.
-
-%----------------------------------------
-% filter_tool_files(Dir,Files) => ToolFiles
-% Dir - string() Directory name
-% Files, ToolFiles - [string()] File names
-% Filters out the files in Files ending with .tool and append them to Dir
-%----------------------------------------
-filter_tool_files(_Dir,[]) ->
- [];
-filter_tool_files(Dir,[File|Rest]) ->
- case filename:extension(File) of
- ".tool" ->
- [filename:join(Dir,File)|filter_tool_files(Dir,Rest)];
- _ ->
- filter_tool_files(Dir,Rest)
- end.
-
-
-%%%-----------------------------------------------------------------
-%%% format functions
-ffunc({M,F,A}) when is_list(A) ->
- io_lib:format("~w:~w(~s)\n",[M,F,format_args(A)]);
-ffunc({M,F,A}) when is_integer(A) ->
- io_lib:format("~w:~w/~w\n",[M,F,A]).
-
-format_args([]) ->
- "";
-format_args(Args) ->
- Str = lists:append(["~p"|lists:duplicate(length(Args)-1,",~p")]),
- io_lib:format(Str,Args).
diff --git a/lib/webtool/src/webtool_sup.erl b/lib/webtool/src/webtool_sup.erl
deleted file mode 100644
index e4a05c53ae..0000000000
--- a/lib/webtool/src/webtool_sup.erl
+++ /dev/null
@@ -1,75 +0,0 @@
-%%
-%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 2001-2009. All Rights Reserved.
-%%
-%% Licensed under the Apache License, Version 2.0 (the "License");
-%% you may not use this file except in compliance with the License.
-%% You may obtain a copy of the License at
-%%
-%% http://www.apache.org/licenses/LICENSE-2.0
-%%
-%% Unless required by applicable law or agreed to in writing, software
-%% distributed under the License is distributed on an "AS IS" BASIS,
-%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-%% See the License for the specific language governing permissions and
-%% limitations under the License.
-%%
-%% %CopyrightEnd%
-%%
--module(webtool_sup).
-
--behaviour(supervisor).
-
-%% External exports
--export([start_link/0,stop/1]).
-
-%% supervisor callbacks
--export([init/1]).
-
-%%%----------------------------------------------------------------------
-%%% API
-%%%----------------------------------------------------------------------
-start_link() ->
- supervisor:start_link({local,websup},webtool_sup, []).
-
-stop(Pid)->
- exit(Pid,normal).
-%%%----------------------------------------------------------------------
-%%% Callback functions from supervisor
-%%%----------------------------------------------------------------------
-
-%%----------------------------------------------------------------------
-%% Func: init/1
-%% Returns: {ok, {SupFlags, [ChildSpec]}} |
-%% ignore |
-%% {error, Reason}
-%%----------------------------------------------------------------------
-init(_StartArgs) ->
- %%Child1 =
- %%Child2 ={webcover_backend,{webcover_backend,start_link,[]},permanent,2000,worker,[webcover_backend]},
- %%{ok,{{simple_one_for_one,5,10},[Child1]}}.
- {ok,{{one_for_one,100,10},[]}}.
-
-%%%----------------------------------------------------------------------
-%%% Internal functions
-%%%----------------------------------------------------------------------
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/lib/webtool/test/Makefile b/lib/webtool/test/Makefile
deleted file mode 100644
index 93aa1c09eb..0000000000
--- a/lib/webtool/test/Makefile
+++ /dev/null
@@ -1,65 +0,0 @@
-include $(ERL_TOP)/make/target.mk
-include $(ERL_TOP)/make/$(TARGET)/otp.mk
-
-# ----------------------------------------------------
-# Target Specs
-# ----------------------------------------------------
-
-MODULES= \
- webtool_SUITE
-
-ERL_FILES= $(MODULES:%=%.erl)
-
-TARGET_FILES= $(MODULES:%=$(EBIN)/%.$(EMULATOR))
-INSTALL_PROGS= $(TARGET_FILES)
-
-EMAKEFILE=Emakefile
-
-# ----------------------------------------------------
-# Release directory specification
-# ----------------------------------------------------
-RELSYSDIR = $(RELEASE_PATH)/webtool_test
-
-# ----------------------------------------------------
-# FLAGS
-# ----------------------------------------------------
-
-ERL_MAKE_FLAGS +=
-ERL_COMPILE_FLAGS += -I$(ERL_TOP)/lib/test_server/include
-
-EBIN = .
-
-# ----------------------------------------------------
-# Targets
-# ----------------------------------------------------
-
-make_emakefile:
- $(ERL_TOP)/make/make_emakefile $(ERL_COMPILE_FLAGS) -o$(EBIN) $(MODULES) \
- > $(EMAKEFILE)
- $(ERL_TOP)/make/make_emakefile $(ERL_COMPILE_FLAGS) -o$(EBIN) '*_SUITE_make' \
- >> $(EMAKEFILE)
-
-tests debug opt: make_emakefile
- erl $(ERL_MAKE_FLAGS) -make
-
-clean:
- rm -f $(EMAKEFILE)
- rm -f $(TARGET_FILES) $(GEN_FILES)
- rm -f core
-
-docs:
-
-# ----------------------------------------------------
-# Release Target
-# ----------------------------------------------------
-include $(ERL_TOP)/make/otp_release_targets.mk
-
-release_spec: opt
-
-release_tests_spec: make_emakefile
- $(INSTALL_DIR) "$(RELSYSDIR)"
- $(INSTALL_DATA) $(EMAKEFILE) $(ERL_FILES) "$(RELSYSDIR)"
- $(INSTALL_DATA) webtool.spec "$(RELSYSDIR)"
- chmod -R u+w "$(RELSYSDIR)"
-
-release_docs_spec:
diff --git a/lib/webtool/test/webtool.spec b/lib/webtool/test/webtool.spec
deleted file mode 100644
index 134e6ed40c..0000000000
--- a/lib/webtool/test/webtool.spec
+++ /dev/null
@@ -1 +0,0 @@
-{suites,"../webtool_test",all}.
diff --git a/lib/webtool/test/webtool_SUITE.erl b/lib/webtool/test/webtool_SUITE.erl
deleted file mode 100644
index 9e2d9a2e0f..0000000000
--- a/lib/webtool/test/webtool_SUITE.erl
+++ /dev/null
@@ -1,51 +0,0 @@
-%% ``Licensed under the Apache License, Version 2.0 (the "License");
-%% you may not use this file except in compliance with the License.
-%% You may obtain a copy of the License at
-%%
-%% http://www.apache.org/licenses/LICENSE-2.0
-%%
-%% Unless required by applicable law or agreed to in writing, software
-%% distributed under the License is distributed on an "AS IS" BASIS,
-%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-%% See the License for the specific language governing permissions and
-%% limitations under the License.
-%%
-%% The Initial Developer of the Original Code is Ericsson Utvecklings AB.
-%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings
-%% AB. All Rights Reserved.''
-%%
--module(webtool_SUITE).
-
--compile([export_all]).
--include_lib("common_test/include/ct.hrl").
-
-suite() ->
- [{ct_hooks, [ts_install_cth]}].
-
-all() ->
- [app, appup].
-
-groups() ->
- [].
-
-init_per_suite(Config) ->
- Config.
-
-end_per_suite(_Config) ->
- ok.
-
-init_per_group(_GroupName, Config) ->
- Config.
-
-end_per_group(_GroupName, Config) ->
- Config.
-
-app() ->
- [{doc, "Test that the webtool app file is ok"}].
-app(Config) when is_list(Config) ->
- ok = ?t:app_test(webtool).
-
-appup() ->
- [{doc, "Test that the webtool appup file is ok"}].
-appup(Config) when is_list(Config) ->
- ok = ?t:appup_test(webtool).
diff --git a/lib/webtool/vsn.mk b/lib/webtool/vsn.mk
deleted file mode 100644
index 4a701ae6e0..0000000000
--- a/lib/webtool/vsn.mk
+++ /dev/null
@@ -1 +0,0 @@
-WEBTOOL_VSN=0.9
diff --git a/lib/wx/api_gen/Makefile b/lib/wx/api_gen/Makefile
index d605f3d8d8..3fa8f1feee 100644
--- a/lib/wx/api_gen/Makefile
+++ b/lib/wx/api_gen/Makefile
@@ -49,7 +49,7 @@ opt: $(WX) $(GL)
$(WX): wxxml_generated $(COMPILER_T) wxapi.conf $(wildcard wx_extra/wx*.c_src) $(wildcard wx_extra/wx*.erl)
erl -noshell -run wx_gen code && touch wx_code_generated
-wxxml_generated: wx_doxygen.conf wx_extra/bugs.h wx_extra/wxe_evth.h
+wxxml_generated: wx_doxygen.conf wx_extra/bugs.h wx_extra/wxe_evth.h wx_extra/added_func.h
sed -e 's|@WXGTK_DIR@|$(WXGTK_DIR)|g' wx_doxygen.conf > wx_doxygen
doxygen wx_doxygen && touch wxxml_generated
diff --git a/lib/wx/api_gen/wx_extra/added_func.h b/lib/wx/api_gen/wx_extra/added_func.h
new file mode 100644
index 0000000000..2323529368
--- /dev/null
+++ b/lib/wx/api_gen/wx_extra/added_func.h
@@ -0,0 +1,28 @@
+// Added 3.0 functionality
+
+class WXDLLIMPEXP_AUI wxAuiTabArt
+{
+public:
+ virtual void SetColour(const wxColour& colour) = 0;
+ virtual void SetActiveColour(const wxColour& colour) = 0;
+};
+
+// Api to get data out of paneinfo
+class WXDLLIMPEXP_AUI wxAuiPaneInfo
+{
+ public:
+ wxString GetName();
+ wxString GetCaption();
+ wxIcon GetIcon();
+
+ wxWindow* GetWindow();
+ wxFrame* GetFrame();
+
+ int GetDirection();
+ int GetLayer();
+ int GetRow();
+ int GetPosition();
+
+ wxPoint GetFloatingPosition();
+ wxSize GetFloatingSize();
+};
diff --git a/lib/wx/api_gen/wx_gen.erl b/lib/wx/api_gen/wx_gen.erl
index 114b3e561e..5cf09e5eee 100644
--- a/lib/wx/api_gen/wx_gen.erl
+++ b/lib/wx/api_gen/wx_gen.erl
@@ -771,14 +771,19 @@ parse_type2([N="wxGridCellCoordsArray"|R],Info,Opts,T) ->
parse_type2(R,Info,Opts,T#type{name=N,base={comp,"wxGridCellCoords",
[{int,"R"},{int,"C"}]},
single=array});
+parse_type2([N="wxAuiPaneInfoArray"|R],Info,Opts,T) ->
+ parse_type2(R,Info,Opts,T#type{name=N,base={class,"wxAuiPaneInfo"},
+ single=array});
+
parse_type2([N="wxRect"|R],Info,Opts,T) ->
parse_type2(R,Info,Opts,T#type{name=N,base={comp,N,[{int,"X"},{int,"Y"},
{int,"W"},{int,"H"}]}});
parse_type2([N="wxColour"|R],Info,Opts,T) ->
parse_type2(R,Info,Opts,T#type{name=N,
base={comp,N,[{int,"R"},{int,"G"},{int,"B"},{int,"A"}]}});
-parse_type2([N="wxColor"|R],Info,Opts,T) ->
- parse_type2(R,Info,Opts,T#type{name="wxColour",
+parse_type2(["wxColor"|R],Info,Opts,T) ->
+ N = "wxColour",
+ parse_type2(R,Info,Opts,T#type{name=N,
base={comp,N,[{int,"R"},{int,"G"},{int,"B"},{int,"A"}]}});
parse_type2([N="wxPoint2DDouble"|R],Info,Opts,T) ->
diff --git a/lib/wx/api_gen/wx_gen_cpp.erl b/lib/wx/api_gen/wx_gen_cpp.erl
index 2ce6295078..5649336b5d 100644
--- a/lib/wx/api_gen/wx_gen_cpp.erl
+++ b/lib/wx/api_gen/wx_gen_cpp.erl
@@ -235,7 +235,8 @@ gen_funcs(Defs) ->
w("}} /* The End */~n~n~n"),
UglySkipList = ["wxCaret", "wxCalendarDateAttr",
- "wxFileDataObject", "wxTextDataObject", "wxBitmapDataObject"
+ "wxFileDataObject", "wxTextDataObject", "wxBitmapDataObject",
+ "wxAuiSimpleTabArt"
],
w("bool WxeApp::delete_object(void *ptr, wxeRefData *refd) {~n", []),
@@ -323,12 +324,8 @@ gen_method(CName, M=#method{name=N,params=Ps0,type=T,method_type=MT,id=MethodId
put(current_func, N),
put(bin_count,-1),
?WTC("gen_method"),
- Endif = case lists:keysearch(deprecated, 1, FOpts) of
- {value, {deprecated, IfDef}} ->
- w("#if ~s~n", [IfDef]),
- true;
- _ -> false
- end,
+ Endif1 = gen_if(deprecated, FOpts),
+ Endif2 = gen_if(test_if, FOpts),
w("case ~s: { // ~s::~s~n", [wx_gen_erl:get_unique_name(MethodId),CName,N]),
Ps1 = declare_variables(void, Ps0),
{Ps2,Align} = decode_arguments(Ps1),
@@ -347,10 +344,19 @@ gen_method(CName, M=#method{name=N,params=Ps0,type=T,method_type=MT,id=MethodId
free_args(),
build_return_vals(T,Ps3),
w(" break;~n}~n", []),
- Endif andalso w("#endif~n", []),
+ Endif1 andalso w("#endif~n", []),
+ Endif2 andalso w("#endif~n", []),
erase(current_func),
M.
+gen_if(What, Opts) ->
+ case lists:keysearch(What, 1, Opts) of
+ {value, {What, IfDef}} ->
+ w("#if ~s~n", [IfDef]),
+ true;
+ _ -> false
+ end.
+
declare_variables(void,Ps) ->
[declare_var(P) || P <- Ps];
declare_variables(T, Ps) ->
@@ -1014,6 +1020,10 @@ build_ret(Name,_,#type{base={comp,_,_},single=array}) ->
w(" for(unsigned int i=0; i < ~s.GetCount(); i++) {~n", [Name]),
w(" rt.add(~s[i]);~n }~n",[Name]),
w(" rt.endList(~s.GetCount());~n",[Name]);
+build_ret(Name,_,#type{base={class,Class},single=array}) ->
+ w(" for(unsigned int i=0; i < ~s.GetCount(); i++) {~n", [Name]),
+ w(" rt.addRef(getRef((void *) &~s.Item(i), memenv), \"~s\");~n }~n",[Name, Class]),
+ w(" rt.endList(~s.GetCount());~n",[Name]);
build_ret(Name,_,#type{name=List,single=list,base={class,Class}}) ->
w(" int i=0;~n"),
w(" for(~s::const_iterator it = ~s.begin(); it != ~s.end(); ++it) {~n",
diff --git a/lib/wx/api_gen/wxapi.conf b/lib/wx/api_gen/wxapi.conf
index 0d1fef6272..f076323bea 100644
--- a/lib/wx/api_gen/wxapi.conf
+++ b/lib/wx/api_gen/wxapi.conf
@@ -1246,7 +1246,8 @@
'SetArtProvider','SetDockSizeConstraint','SetFlags','SetManagedWindow',
'ShowHint','UnInit','Update']}.
-{class, wxAuiPaneInfo, root, [{ifdef, wxUSE_AUI}],
+{class, wxAuiPaneInfo, root,
+ [{ifdef, wxUSE_AUI}],
[
wxAuiPaneInfo,'~wxAuiPaneInfo',
'BestSize','Bottom','BottomDockable','Caption','CaptionVisible',
@@ -1263,7 +1264,44 @@
'MinSize','MinimizeButton','Movable','Name',
'PaneBorder','PinButton','Position','Resizable','Right',
'RightDockable','Row','SafeSet','SetFlag','Show','ToolbarPane',
- 'Top','TopDockable','Window']}.
+ 'Top','TopDockable','Window',
+ %% Extended func
+ %% These are not initilized by default and thus cause crashes
+ %% {'GetName',
+ %% [{pre_hook, [{c, "#if 0\n"}]},
+ %% {post_hook, [{c, "#endif\n if(!This) throw wxe_badarg(0);\n wxString Result = This->name"}]}]},
+ %% {'GetCaption',
+ %% [{pre_hook, [{c, "#if 0\n"}]},
+ %% {post_hook, [{c, "#endif\n if(!This) throw wxe_badarg(0);\n wxString Result = This->caption"}]}]},
+ %% {'GetIcon',
+ %% [{pre_hook, [{c, "#if 0\n"}]},
+ %% {post_hook, [{c, "#endif\n if(!This) throw wxe_badarg(0);\n wxIcon Result = This->icon"}]}]},
+ {'GetWindow',
+ [{pre_hook, [{c, "#if 0\n"}]},
+ {post_hook, [{c, "#endif\n if(!This) throw wxe_badarg(0);\n wxWindow* Result = This->window"}]}]},
+ {'GetFrame',
+ [{pre_hook, [{c, "#if 0\n"}]},
+ {post_hook, [{c, "#endif\n if(!This) throw wxe_badarg(0);\n wxFrame* Result = This->frame"}]}]},
+ {'GetDirection',
+ [{pre_hook, [{c, "#if 0\n"}]},
+ {post_hook, [{c, "#endif\n if(!This) throw wxe_badarg(0);\n int Result = This->dock_direction"}]}]},
+ {'GetLayer',
+ [{pre_hook, [{c, "#if 0\n"}]},
+ {post_hook, [{c, "#endif\n if(!This) throw wxe_badarg(0);\n int Result = This->dock_layer"}]}]},
+ {'GetRow',
+ [{pre_hook, [{c, "#if 0\n"}]},
+ {post_hook, [{c, "#endif\n if(!This) throw wxe_badarg(0);\n int Result = This->dock_row"}]}]},
+ {'GetPosition',
+ [{pre_hook, [{c, "#if 0\n"}]},
+ {post_hook, [{c, "#endif\n if(!This) throw wxe_badarg(0);\n int Result = This->dock_pos"}]}]},
+ {'GetFloatingPosition',
+ [{pre_hook, [{c, "#if 0\n"}]},
+ {post_hook, [{c, "#endif\n if(!This) throw wxe_badarg(0);\n wxPoint Result = This->floating_pos"}]}]},
+ {'GetFloatingSize',
+ [{pre_hook, [{c, "#if 0\n"}]},
+ {post_hook, [{c, "#endif\n if(!This) throw wxe_badarg(0);\n wxSize Result = This->floating_size"}]}]}
+
+]}.
{class, wxAuiNotebook, wxControl, [{ifdef, wxUSE_AUI}],
['wxAuiNotebook','AddPage',%'AdvanceSelection',
@@ -1282,15 +1320,22 @@
%'Clone','DrawBackground','DrawButton','DrawTab','GetBestTabCtrlSize',
%'GetIndentSize','GetTabSize','SetFlags','SetMeasuringFont',
%'SetNormalFont','SetSelectedFont','SetSizingInfo'%,'ShowWindowList'
+ 'SetFlags', 'SetMeasuringFont', 'SetNormalFont', 'SetSelectedFont',
+ {'SetColour', [{test_if, "wxCHECK_VERSION(3,0,0)"}]},
+ {'SetActiveColour', [{test_if, "wxCHECK_VERSION(3,0,0)"}]}
]}.
{class,wxAuiDockArt, root, [{ifdef, wxUSE_AUI}],
[%% 'wxAuiDockArt','~wxAuiDockArt' %,
%%'DrawBackground','DrawBorder','DrawCaption', %% Pure virtual funcs
%%'DrawGripper','DrawPaneButton','DrawSash',
- %%'GetColor','GetColour','GetFont','GetMetric','SetColor','SetColour','SetFont','SetMetric'
+ 'GetColour','GetFont','GetMetric','SetColour','SetFont','SetMetric'
]}.
+{class,wxAuiSimpleTabArt, wxAuiTabArt, [{ifdef, wxUSE_AUI}],
+ [wxAuiSimpleTabArt]}.
+
+
{class, wxMDIParentFrame, wxFrame, [],
[
'wxMDIParentFrame',
@@ -1870,7 +1915,7 @@
]}.
-{class, wxAuiManagerEvent, wxEvent,
+{class, wxAuiManagerEvent, wxEvent,
[{acc, [{button, "GetButton()"},
{dc, "GetDC()"},
{pane, "GetPane()"},
@@ -1880,6 +1925,7 @@
wxEVT_AUI_PANE_CLOSE,
wxEVT_AUI_PANE_MAXIMIZE,
wxEVT_AUI_PANE_RESTORE,
+ {wxEVT_AUI_PANE_ACTIVATED, {test_if, "wxCHECK_VERSION(2,9,5)"}},
wxEVT_AUI_RENDER,
wxEVT_AUI_FIND_MANAGER
]}],
diff --git a/lib/wx/c_src/gen/wxe_events.cpp b/lib/wx/c_src/gen/wxe_events.cpp
index f6a5868b48..a532ee985d 100644
--- a/lib/wx/c_src/gen/wxe_events.cpp
+++ b/lib/wx/c_src/gen/wxe_events.cpp
@@ -54,255 +54,258 @@ void initEventTable()
struct { int ev_type; int class_id; const char * ev_name;} event_types[] =
{
{wxEVT_NULL, 0, "null"},
- {wxEVT_COMMAND_BUTTON_CLICKED, 164, "command_button_clicked"},
- {wxEVT_COMMAND_CHECKBOX_CLICKED, 164, "command_checkbox_clicked"},
- {wxEVT_COMMAND_CHOICE_SELECTED, 164, "command_choice_selected"},
- {wxEVT_COMMAND_LISTBOX_SELECTED, 164, "command_listbox_selected"},
- {wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, 164, "command_listbox_doubleclicked"},
- {wxEVT_COMMAND_TEXT_UPDATED, 164, "command_text_updated"},
- {wxEVT_COMMAND_TEXT_ENTER, 164, "command_text_enter"},
- {wxEVT_COMMAND_MENU_SELECTED, 164, "command_menu_selected"},
- {wxEVT_COMMAND_SLIDER_UPDATED, 164, "command_slider_updated"},
- {wxEVT_COMMAND_RADIOBOX_SELECTED, 164, "command_radiobox_selected"},
- {wxEVT_COMMAND_RADIOBUTTON_SELECTED, 164, "command_radiobutton_selected"},
- {wxEVT_COMMAND_SCROLLBAR_UPDATED, 164, "command_scrollbar_updated"},
- {wxEVT_COMMAND_VLBOX_SELECTED, 164, "command_vlbox_selected"},
- {wxEVT_COMMAND_COMBOBOX_SELECTED, 164, "command_combobox_selected"},
- {wxEVT_COMMAND_TOOL_RCLICKED, 164, "command_tool_rclicked"},
- {wxEVT_COMMAND_TOOL_ENTER, 164, "command_tool_enter"},
- {wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, 164, "command_checklistbox_toggled"},
- {wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, 164, "command_togglebutton_clicked"},
- {wxEVT_COMMAND_LEFT_CLICK, 164, "command_left_click"},
- {wxEVT_COMMAND_LEFT_DCLICK, 164, "command_left_dclick"},
- {wxEVT_COMMAND_RIGHT_CLICK, 164, "command_right_click"},
- {wxEVT_COMMAND_SET_FOCUS, 164, "command_set_focus"},
- {wxEVT_COMMAND_KILL_FOCUS, 164, "command_kill_focus"},
- {wxEVT_COMMAND_ENTER, 164, "command_enter"},
- {wxEVT_SCROLL_TOP, 165, "scroll_top"},
- {wxEVT_SCROLL_BOTTOM, 165, "scroll_bottom"},
- {wxEVT_SCROLL_LINEUP, 165, "scroll_lineup"},
- {wxEVT_SCROLL_LINEDOWN, 165, "scroll_linedown"},
- {wxEVT_SCROLL_PAGEUP, 165, "scroll_pageup"},
- {wxEVT_SCROLL_PAGEDOWN, 165, "scroll_pagedown"},
- {wxEVT_SCROLL_THUMBTRACK, 165, "scroll_thumbtrack"},
- {wxEVT_SCROLL_THUMBRELEASE, 165, "scroll_thumbrelease"},
- {wxEVT_SCROLL_CHANGED, 165, "scroll_changed"},
- {wxEVT_SCROLLWIN_TOP, 166, "scrollwin_top"},
- {wxEVT_SCROLLWIN_BOTTOM, 166, "scrollwin_bottom"},
- {wxEVT_SCROLLWIN_LINEUP, 166, "scrollwin_lineup"},
- {wxEVT_SCROLLWIN_LINEDOWN, 166, "scrollwin_linedown"},
- {wxEVT_SCROLLWIN_PAGEUP, 166, "scrollwin_pageup"},
- {wxEVT_SCROLLWIN_PAGEDOWN, 166, "scrollwin_pagedown"},
- {wxEVT_SCROLLWIN_THUMBTRACK, 166, "scrollwin_thumbtrack"},
- {wxEVT_SCROLLWIN_THUMBRELEASE, 166, "scrollwin_thumbrelease"},
- {wxEVT_LEFT_DOWN, 167, "left_down"},
- {wxEVT_LEFT_UP, 167, "left_up"},
- {wxEVT_MIDDLE_DOWN, 167, "middle_down"},
- {wxEVT_MIDDLE_UP, 167, "middle_up"},
- {wxEVT_RIGHT_DOWN, 167, "right_down"},
- {wxEVT_RIGHT_UP, 167, "right_up"},
- {wxEVT_MOTION, 167, "motion"},
- {wxEVT_ENTER_WINDOW, 167, "enter_window"},
- {wxEVT_LEAVE_WINDOW, 167, "leave_window"},
- {wxEVT_LEFT_DCLICK, 167, "left_dclick"},
- {wxEVT_MIDDLE_DCLICK, 167, "middle_dclick"},
- {wxEVT_RIGHT_DCLICK, 167, "right_dclick"},
- {wxEVT_MOUSEWHEEL, 167, "mousewheel"},
- {wxEVT_SET_CURSOR, 168, "set_cursor"},
- {wxEVT_CHAR, 169, "char"},
- {wxEVT_CHAR_HOOK, 169, "char_hook"},
- {wxEVT_KEY_DOWN, 169, "key_down"},
- {wxEVT_KEY_UP, 169, "key_up"},
- {wxEVT_SIZE, 170, "size"},
- {wxEVT_MOVE, 171, "move"},
- {wxEVT_PAINT, 172, "paint"},
- {wxEVT_ERASE_BACKGROUND, 173, "erase_background"},
- {wxEVT_SET_FOCUS, 174, "set_focus"},
- {wxEVT_KILL_FOCUS, 174, "kill_focus"},
- {wxEVT_CHILD_FOCUS, 175, "child_focus"},
- {wxEVT_MENU_OPEN, 176, "menu_open"},
- {wxEVT_MENU_CLOSE, 176, "menu_close"},
- {wxEVT_MENU_HIGHLIGHT, 176, "menu_highlight"},
- {wxEVT_CLOSE_WINDOW, 177, "close_window"},
- {wxEVT_END_SESSION, 177, "end_session"},
- {wxEVT_QUERY_END_SESSION, 177, "query_end_session"},
- {wxEVT_SHOW, 178, "show"},
- {wxEVT_ICONIZE, 179, "iconize"},
- {wxEVT_MAXIMIZE, 180, "maximize"},
- {wxEVT_JOY_BUTTON_DOWN, 181, "joy_button_down"},
- {wxEVT_JOY_BUTTON_UP, 181, "joy_button_up"},
- {wxEVT_JOY_MOVE, 181, "joy_move"},
- {wxEVT_JOY_ZMOVE, 181, "joy_zmove"},
- {wxEVT_UPDATE_UI, 182, "update_ui"},
- {wxEVT_SYS_COLOUR_CHANGED, 183, "sys_colour_changed"},
- {wxEVT_MOUSE_CAPTURE_CHANGED, 184, "mouse_capture_changed"},
- {wxEVT_DISPLAY_CHANGED, 185, "display_changed"},
- {wxEVT_PALETTE_CHANGED, 186, "palette_changed"},
- {wxEVT_QUERY_NEW_PALETTE, 187, "query_new_palette"},
- {wxEVT_NAVIGATION_KEY, 188, "navigation_key"},
- {wxEVT_CREATE, 189, "create"},
- {wxEVT_DESTROY, 190, "destroy"},
- {wxEVT_HELP, 191, "help"},
- {wxEVT_DETAILED_HELP, 191, "detailed_help"},
- {wxEVT_CONTEXT_MENU, 192, "context_menu"},
- {wxEVT_IDLE, 193, "idle"},
- {wxEVT_GRID_CELL_LEFT_CLICK, 194, "grid_cell_left_click"},
- {wxEVT_GRID_CELL_RIGHT_CLICK, 194, "grid_cell_right_click"},
- {wxEVT_GRID_CELL_LEFT_DCLICK, 194, "grid_cell_left_dclick"},
- {wxEVT_GRID_CELL_RIGHT_DCLICK, 194, "grid_cell_right_dclick"},
- {wxEVT_GRID_LABEL_LEFT_CLICK, 194, "grid_label_left_click"},
- {wxEVT_GRID_LABEL_RIGHT_CLICK, 194, "grid_label_right_click"},
- {wxEVT_GRID_LABEL_LEFT_DCLICK, 194, "grid_label_left_dclick"},
- {wxEVT_GRID_LABEL_RIGHT_DCLICK, 194, "grid_label_right_dclick"},
- {wxEVT_GRID_ROW_SIZE, 194, "grid_row_size"},
- {wxEVT_GRID_COL_SIZE, 194, "grid_col_size"},
- {wxEVT_GRID_RANGE_SELECT, 194, "grid_range_select"},
- {wxEVT_GRID_CELL_CHANGE, 194, "grid_cell_change"},
- {wxEVT_GRID_SELECT_CELL, 194, "grid_select_cell"},
- {wxEVT_GRID_EDITOR_SHOWN, 194, "grid_editor_shown"},
- {wxEVT_GRID_EDITOR_HIDDEN, 194, "grid_editor_hidden"},
- {wxEVT_GRID_EDITOR_CREATED, 194, "grid_editor_created"},
- {wxEVT_GRID_CELL_BEGIN_DRAG, 194, "grid_cell_begin_drag"},
- {wxEVT_SASH_DRAGGED, 196, "sash_dragged"},
- {wxEVT_COMMAND_LIST_BEGIN_DRAG, 197, "command_list_begin_drag"},
- {wxEVT_COMMAND_LIST_BEGIN_RDRAG, 197, "command_list_begin_rdrag"},
- {wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT, 197, "command_list_begin_label_edit"},
- {wxEVT_COMMAND_LIST_END_LABEL_EDIT, 197, "command_list_end_label_edit"},
- {wxEVT_COMMAND_LIST_DELETE_ITEM, 197, "command_list_delete_item"},
- {wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, 197, "command_list_delete_all_items"},
- {wxEVT_COMMAND_LIST_KEY_DOWN, 197, "command_list_key_down"},
- {wxEVT_COMMAND_LIST_INSERT_ITEM, 197, "command_list_insert_item"},
- {wxEVT_COMMAND_LIST_COL_CLICK, 197, "command_list_col_click"},
- {wxEVT_COMMAND_LIST_COL_RIGHT_CLICK, 197, "command_list_col_right_click"},
- {wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, 197, "command_list_col_begin_drag"},
- {wxEVT_COMMAND_LIST_COL_DRAGGING, 197, "command_list_col_dragging"},
- {wxEVT_COMMAND_LIST_COL_END_DRAG, 197, "command_list_col_end_drag"},
- {wxEVT_COMMAND_LIST_ITEM_SELECTED, 197, "command_list_item_selected"},
- {wxEVT_COMMAND_LIST_ITEM_DESELECTED, 197, "command_list_item_deselected"},
- {wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, 197, "command_list_item_right_click"},
- {wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK, 197, "command_list_item_middle_click"},
- {wxEVT_COMMAND_LIST_ITEM_ACTIVATED, 197, "command_list_item_activated"},
- {wxEVT_COMMAND_LIST_ITEM_FOCUSED, 197, "command_list_item_focused"},
- {wxEVT_COMMAND_LIST_CACHE_HINT, 197, "command_list_cache_hint"},
- {wxEVT_DATE_CHANGED, 198, "date_changed"},
- {wxEVT_CALENDAR_SEL_CHANGED, 199, "calendar_sel_changed"},
- {wxEVT_CALENDAR_DAY_CHANGED, 199, "calendar_day_changed"},
- {wxEVT_CALENDAR_MONTH_CHANGED, 199, "calendar_month_changed"},
- {wxEVT_CALENDAR_YEAR_CHANGED, 199, "calendar_year_changed"},
- {wxEVT_CALENDAR_DOUBLECLICKED, 199, "calendar_doubleclicked"},
- {wxEVT_CALENDAR_WEEKDAY_CLICKED, 199, "calendar_weekday_clicked"},
- {wxEVT_COMMAND_FILEPICKER_CHANGED, 200, "command_filepicker_changed"},
- {wxEVT_COMMAND_DIRPICKER_CHANGED, 200, "command_dirpicker_changed"},
- {wxEVT_COMMAND_COLOURPICKER_CHANGED, 201, "command_colourpicker_changed"},
- {wxEVT_COMMAND_FONTPICKER_CHANGED, 202, "command_fontpicker_changed"},
- {wxEVT_STC_CHANGE, 203, "stc_change"},
- {wxEVT_STC_STYLENEEDED, 203, "stc_styleneeded"},
- {wxEVT_STC_CHARADDED, 203, "stc_charadded"},
- {wxEVT_STC_SAVEPOINTREACHED, 203, "stc_savepointreached"},
- {wxEVT_STC_SAVEPOINTLEFT, 203, "stc_savepointleft"},
- {wxEVT_STC_ROMODIFYATTEMPT, 203, "stc_romodifyattempt"},
- {wxEVT_STC_KEY, 203, "stc_key"},
- {wxEVT_STC_DOUBLECLICK, 203, "stc_doubleclick"},
- {wxEVT_STC_UPDATEUI, 203, "stc_updateui"},
- {wxEVT_STC_MODIFIED, 203, "stc_modified"},
- {wxEVT_STC_MACRORECORD, 203, "stc_macrorecord"},
- {wxEVT_STC_MARGINCLICK, 203, "stc_marginclick"},
- {wxEVT_STC_NEEDSHOWN, 203, "stc_needshown"},
- {wxEVT_STC_PAINTED, 203, "stc_painted"},
- {wxEVT_STC_USERLISTSELECTION, 203, "stc_userlistselection"},
- {wxEVT_STC_URIDROPPED, 203, "stc_uridropped"},
- {wxEVT_STC_DWELLSTART, 203, "stc_dwellstart"},
- {wxEVT_STC_DWELLEND, 203, "stc_dwellend"},
- {wxEVT_STC_START_DRAG, 203, "stc_start_drag"},
- {wxEVT_STC_DRAG_OVER, 203, "stc_drag_over"},
- {wxEVT_STC_DO_DROP, 203, "stc_do_drop"},
- {wxEVT_STC_ZOOM, 203, "stc_zoom"},
- {wxEVT_STC_HOTSPOT_CLICK, 203, "stc_hotspot_click"},
- {wxEVT_STC_HOTSPOT_DCLICK, 203, "stc_hotspot_dclick"},
- {wxEVT_STC_CALLTIP_CLICK, 203, "stc_calltip_click"},
- {wxEVT_STC_AUTOCOMP_SELECTION, 203, "stc_autocomp_selection"},
- {wxEVT_COMMAND_TREE_BEGIN_DRAG, 209, "command_tree_begin_drag"},
- {wxEVT_COMMAND_TREE_BEGIN_RDRAG, 209, "command_tree_begin_rdrag"},
- {wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, 209, "command_tree_begin_label_edit"},
- {wxEVT_COMMAND_TREE_END_LABEL_EDIT, 209, "command_tree_end_label_edit"},
- {wxEVT_COMMAND_TREE_DELETE_ITEM, 209, "command_tree_delete_item"},
- {wxEVT_COMMAND_TREE_GET_INFO, 209, "command_tree_get_info"},
- {wxEVT_COMMAND_TREE_SET_INFO, 209, "command_tree_set_info"},
- {wxEVT_COMMAND_TREE_ITEM_EXPANDED, 209, "command_tree_item_expanded"},
- {wxEVT_COMMAND_TREE_ITEM_EXPANDING, 209, "command_tree_item_expanding"},
- {wxEVT_COMMAND_TREE_ITEM_COLLAPSED, 209, "command_tree_item_collapsed"},
- {wxEVT_COMMAND_TREE_ITEM_COLLAPSING, 209, "command_tree_item_collapsing"},
- {wxEVT_COMMAND_TREE_SEL_CHANGED, 209, "command_tree_sel_changed"},
- {wxEVT_COMMAND_TREE_SEL_CHANGING, 209, "command_tree_sel_changing"},
- {wxEVT_COMMAND_TREE_KEY_DOWN, 209, "command_tree_key_down"},
- {wxEVT_COMMAND_TREE_ITEM_ACTIVATED, 209, "command_tree_item_activated"},
- {wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, 209, "command_tree_item_right_click"},
- {wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK, 209, "command_tree_item_middle_click"},
- {wxEVT_COMMAND_TREE_END_DRAG, 209, "command_tree_end_drag"},
- {wxEVT_COMMAND_TREE_STATE_IMAGE_CLICK, 209, "command_tree_state_image_click"},
- {wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP, 209, "command_tree_item_gettooltip"},
- {wxEVT_COMMAND_TREE_ITEM_MENU, 209, "command_tree_item_menu"},
- {wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, 210, "command_notebook_page_changed"},
- {wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, 210, "command_notebook_page_changing"},
- {wxEVT_COMMAND_TEXT_COPY, 216, "command_text_copy"},
- {wxEVT_COMMAND_TEXT_CUT, 216, "command_text_cut"},
- {wxEVT_COMMAND_TEXT_PASTE, 216, "command_text_paste"},
- {wxEVT_COMMAND_SPINCTRL_UPDATED, 217, "command_spinctrl_updated"},
- {wxEVT_SCROLL_LINEUP + wxEVT_USER_FIRST, 165, "spin_up"},
- {wxEVT_SCROLL_LINEDOWN + wxEVT_USER_FIRST, 165, "spin_down"},
- {wxEVT_SCROLL_THUMBTRACK + wxEVT_USER_FIRST, 165, "spin"},
- {wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, 219, "command_splitter_sash_pos_changed"},
- {wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING, 219, "command_splitter_sash_pos_changing"},
- {wxEVT_COMMAND_SPLITTER_DOUBLECLICKED, 219, "command_splitter_doubleclicked"},
- {wxEVT_COMMAND_SPLITTER_UNSPLIT, 219, "command_splitter_unsplit"},
- {wxEVT_COMMAND_HTML_LINK_CLICKED, 221, "command_html_link_clicked"},
- {wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, 224, "command_auinotebook_page_close"},
- {wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, 224, "command_auinotebook_page_changed"},
- {wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, 224, "command_auinotebook_page_changing"},
- {wxEVT_COMMAND_AUINOTEBOOK_BUTTON, 224, "command_auinotebook_button"},
- {wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG, 224, "command_auinotebook_begin_drag"},
- {wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, 224, "command_auinotebook_end_drag"},
- {wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION, 224, "command_auinotebook_drag_motion"},
- {wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND, 224, "command_auinotebook_allow_dnd"},
+ {wxEVT_COMMAND_BUTTON_CLICKED, 165, "command_button_clicked"},
+ {wxEVT_COMMAND_CHECKBOX_CLICKED, 165, "command_checkbox_clicked"},
+ {wxEVT_COMMAND_CHOICE_SELECTED, 165, "command_choice_selected"},
+ {wxEVT_COMMAND_LISTBOX_SELECTED, 165, "command_listbox_selected"},
+ {wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, 165, "command_listbox_doubleclicked"},
+ {wxEVT_COMMAND_TEXT_UPDATED, 165, "command_text_updated"},
+ {wxEVT_COMMAND_TEXT_ENTER, 165, "command_text_enter"},
+ {wxEVT_COMMAND_MENU_SELECTED, 165, "command_menu_selected"},
+ {wxEVT_COMMAND_SLIDER_UPDATED, 165, "command_slider_updated"},
+ {wxEVT_COMMAND_RADIOBOX_SELECTED, 165, "command_radiobox_selected"},
+ {wxEVT_COMMAND_RADIOBUTTON_SELECTED, 165, "command_radiobutton_selected"},
+ {wxEVT_COMMAND_SCROLLBAR_UPDATED, 165, "command_scrollbar_updated"},
+ {wxEVT_COMMAND_VLBOX_SELECTED, 165, "command_vlbox_selected"},
+ {wxEVT_COMMAND_COMBOBOX_SELECTED, 165, "command_combobox_selected"},
+ {wxEVT_COMMAND_TOOL_RCLICKED, 165, "command_tool_rclicked"},
+ {wxEVT_COMMAND_TOOL_ENTER, 165, "command_tool_enter"},
+ {wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, 165, "command_checklistbox_toggled"},
+ {wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, 165, "command_togglebutton_clicked"},
+ {wxEVT_COMMAND_LEFT_CLICK, 165, "command_left_click"},
+ {wxEVT_COMMAND_LEFT_DCLICK, 165, "command_left_dclick"},
+ {wxEVT_COMMAND_RIGHT_CLICK, 165, "command_right_click"},
+ {wxEVT_COMMAND_SET_FOCUS, 165, "command_set_focus"},
+ {wxEVT_COMMAND_KILL_FOCUS, 165, "command_kill_focus"},
+ {wxEVT_COMMAND_ENTER, 165, "command_enter"},
+ {wxEVT_SCROLL_TOP, 166, "scroll_top"},
+ {wxEVT_SCROLL_BOTTOM, 166, "scroll_bottom"},
+ {wxEVT_SCROLL_LINEUP, 166, "scroll_lineup"},
+ {wxEVT_SCROLL_LINEDOWN, 166, "scroll_linedown"},
+ {wxEVT_SCROLL_PAGEUP, 166, "scroll_pageup"},
+ {wxEVT_SCROLL_PAGEDOWN, 166, "scroll_pagedown"},
+ {wxEVT_SCROLL_THUMBTRACK, 166, "scroll_thumbtrack"},
+ {wxEVT_SCROLL_THUMBRELEASE, 166, "scroll_thumbrelease"},
+ {wxEVT_SCROLL_CHANGED, 166, "scroll_changed"},
+ {wxEVT_SCROLLWIN_TOP, 167, "scrollwin_top"},
+ {wxEVT_SCROLLWIN_BOTTOM, 167, "scrollwin_bottom"},
+ {wxEVT_SCROLLWIN_LINEUP, 167, "scrollwin_lineup"},
+ {wxEVT_SCROLLWIN_LINEDOWN, 167, "scrollwin_linedown"},
+ {wxEVT_SCROLLWIN_PAGEUP, 167, "scrollwin_pageup"},
+ {wxEVT_SCROLLWIN_PAGEDOWN, 167, "scrollwin_pagedown"},
+ {wxEVT_SCROLLWIN_THUMBTRACK, 167, "scrollwin_thumbtrack"},
+ {wxEVT_SCROLLWIN_THUMBRELEASE, 167, "scrollwin_thumbrelease"},
+ {wxEVT_LEFT_DOWN, 168, "left_down"},
+ {wxEVT_LEFT_UP, 168, "left_up"},
+ {wxEVT_MIDDLE_DOWN, 168, "middle_down"},
+ {wxEVT_MIDDLE_UP, 168, "middle_up"},
+ {wxEVT_RIGHT_DOWN, 168, "right_down"},
+ {wxEVT_RIGHT_UP, 168, "right_up"},
+ {wxEVT_MOTION, 168, "motion"},
+ {wxEVT_ENTER_WINDOW, 168, "enter_window"},
+ {wxEVT_LEAVE_WINDOW, 168, "leave_window"},
+ {wxEVT_LEFT_DCLICK, 168, "left_dclick"},
+ {wxEVT_MIDDLE_DCLICK, 168, "middle_dclick"},
+ {wxEVT_RIGHT_DCLICK, 168, "right_dclick"},
+ {wxEVT_MOUSEWHEEL, 168, "mousewheel"},
+ {wxEVT_SET_CURSOR, 169, "set_cursor"},
+ {wxEVT_CHAR, 170, "char"},
+ {wxEVT_CHAR_HOOK, 170, "char_hook"},
+ {wxEVT_KEY_DOWN, 170, "key_down"},
+ {wxEVT_KEY_UP, 170, "key_up"},
+ {wxEVT_SIZE, 171, "size"},
+ {wxEVT_MOVE, 172, "move"},
+ {wxEVT_PAINT, 173, "paint"},
+ {wxEVT_ERASE_BACKGROUND, 174, "erase_background"},
+ {wxEVT_SET_FOCUS, 175, "set_focus"},
+ {wxEVT_KILL_FOCUS, 175, "kill_focus"},
+ {wxEVT_CHILD_FOCUS, 176, "child_focus"},
+ {wxEVT_MENU_OPEN, 177, "menu_open"},
+ {wxEVT_MENU_CLOSE, 177, "menu_close"},
+ {wxEVT_MENU_HIGHLIGHT, 177, "menu_highlight"},
+ {wxEVT_CLOSE_WINDOW, 178, "close_window"},
+ {wxEVT_END_SESSION, 178, "end_session"},
+ {wxEVT_QUERY_END_SESSION, 178, "query_end_session"},
+ {wxEVT_SHOW, 179, "show"},
+ {wxEVT_ICONIZE, 180, "iconize"},
+ {wxEVT_MAXIMIZE, 181, "maximize"},
+ {wxEVT_JOY_BUTTON_DOWN, 182, "joy_button_down"},
+ {wxEVT_JOY_BUTTON_UP, 182, "joy_button_up"},
+ {wxEVT_JOY_MOVE, 182, "joy_move"},
+ {wxEVT_JOY_ZMOVE, 182, "joy_zmove"},
+ {wxEVT_UPDATE_UI, 183, "update_ui"},
+ {wxEVT_SYS_COLOUR_CHANGED, 184, "sys_colour_changed"},
+ {wxEVT_MOUSE_CAPTURE_CHANGED, 185, "mouse_capture_changed"},
+ {wxEVT_DISPLAY_CHANGED, 186, "display_changed"},
+ {wxEVT_PALETTE_CHANGED, 187, "palette_changed"},
+ {wxEVT_QUERY_NEW_PALETTE, 188, "query_new_palette"},
+ {wxEVT_NAVIGATION_KEY, 189, "navigation_key"},
+ {wxEVT_CREATE, 190, "create"},
+ {wxEVT_DESTROY, 191, "destroy"},
+ {wxEVT_HELP, 192, "help"},
+ {wxEVT_DETAILED_HELP, 192, "detailed_help"},
+ {wxEVT_CONTEXT_MENU, 193, "context_menu"},
+ {wxEVT_IDLE, 194, "idle"},
+ {wxEVT_GRID_CELL_LEFT_CLICK, 195, "grid_cell_left_click"},
+ {wxEVT_GRID_CELL_RIGHT_CLICK, 195, "grid_cell_right_click"},
+ {wxEVT_GRID_CELL_LEFT_DCLICK, 195, "grid_cell_left_dclick"},
+ {wxEVT_GRID_CELL_RIGHT_DCLICK, 195, "grid_cell_right_dclick"},
+ {wxEVT_GRID_LABEL_LEFT_CLICK, 195, "grid_label_left_click"},
+ {wxEVT_GRID_LABEL_RIGHT_CLICK, 195, "grid_label_right_click"},
+ {wxEVT_GRID_LABEL_LEFT_DCLICK, 195, "grid_label_left_dclick"},
+ {wxEVT_GRID_LABEL_RIGHT_DCLICK, 195, "grid_label_right_dclick"},
+ {wxEVT_GRID_ROW_SIZE, 195, "grid_row_size"},
+ {wxEVT_GRID_COL_SIZE, 195, "grid_col_size"},
+ {wxEVT_GRID_RANGE_SELECT, 195, "grid_range_select"},
+ {wxEVT_GRID_CELL_CHANGE, 195, "grid_cell_change"},
+ {wxEVT_GRID_SELECT_CELL, 195, "grid_select_cell"},
+ {wxEVT_GRID_EDITOR_SHOWN, 195, "grid_editor_shown"},
+ {wxEVT_GRID_EDITOR_HIDDEN, 195, "grid_editor_hidden"},
+ {wxEVT_GRID_EDITOR_CREATED, 195, "grid_editor_created"},
+ {wxEVT_GRID_CELL_BEGIN_DRAG, 195, "grid_cell_begin_drag"},
+ {wxEVT_SASH_DRAGGED, 197, "sash_dragged"},
+ {wxEVT_COMMAND_LIST_BEGIN_DRAG, 198, "command_list_begin_drag"},
+ {wxEVT_COMMAND_LIST_BEGIN_RDRAG, 198, "command_list_begin_rdrag"},
+ {wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT, 198, "command_list_begin_label_edit"},
+ {wxEVT_COMMAND_LIST_END_LABEL_EDIT, 198, "command_list_end_label_edit"},
+ {wxEVT_COMMAND_LIST_DELETE_ITEM, 198, "command_list_delete_item"},
+ {wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, 198, "command_list_delete_all_items"},
+ {wxEVT_COMMAND_LIST_KEY_DOWN, 198, "command_list_key_down"},
+ {wxEVT_COMMAND_LIST_INSERT_ITEM, 198, "command_list_insert_item"},
+ {wxEVT_COMMAND_LIST_COL_CLICK, 198, "command_list_col_click"},
+ {wxEVT_COMMAND_LIST_COL_RIGHT_CLICK, 198, "command_list_col_right_click"},
+ {wxEVT_COMMAND_LIST_COL_BEGIN_DRAG, 198, "command_list_col_begin_drag"},
+ {wxEVT_COMMAND_LIST_COL_DRAGGING, 198, "command_list_col_dragging"},
+ {wxEVT_COMMAND_LIST_COL_END_DRAG, 198, "command_list_col_end_drag"},
+ {wxEVT_COMMAND_LIST_ITEM_SELECTED, 198, "command_list_item_selected"},
+ {wxEVT_COMMAND_LIST_ITEM_DESELECTED, 198, "command_list_item_deselected"},
+ {wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, 198, "command_list_item_right_click"},
+ {wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK, 198, "command_list_item_middle_click"},
+ {wxEVT_COMMAND_LIST_ITEM_ACTIVATED, 198, "command_list_item_activated"},
+ {wxEVT_COMMAND_LIST_ITEM_FOCUSED, 198, "command_list_item_focused"},
+ {wxEVT_COMMAND_LIST_CACHE_HINT, 198, "command_list_cache_hint"},
+ {wxEVT_DATE_CHANGED, 199, "date_changed"},
+ {wxEVT_CALENDAR_SEL_CHANGED, 200, "calendar_sel_changed"},
+ {wxEVT_CALENDAR_DAY_CHANGED, 200, "calendar_day_changed"},
+ {wxEVT_CALENDAR_MONTH_CHANGED, 200, "calendar_month_changed"},
+ {wxEVT_CALENDAR_YEAR_CHANGED, 200, "calendar_year_changed"},
+ {wxEVT_CALENDAR_DOUBLECLICKED, 200, "calendar_doubleclicked"},
+ {wxEVT_CALENDAR_WEEKDAY_CLICKED, 200, "calendar_weekday_clicked"},
+ {wxEVT_COMMAND_FILEPICKER_CHANGED, 201, "command_filepicker_changed"},
+ {wxEVT_COMMAND_DIRPICKER_CHANGED, 201, "command_dirpicker_changed"},
+ {wxEVT_COMMAND_COLOURPICKER_CHANGED, 202, "command_colourpicker_changed"},
+ {wxEVT_COMMAND_FONTPICKER_CHANGED, 203, "command_fontpicker_changed"},
+ {wxEVT_STC_CHANGE, 204, "stc_change"},
+ {wxEVT_STC_STYLENEEDED, 204, "stc_styleneeded"},
+ {wxEVT_STC_CHARADDED, 204, "stc_charadded"},
+ {wxEVT_STC_SAVEPOINTREACHED, 204, "stc_savepointreached"},
+ {wxEVT_STC_SAVEPOINTLEFT, 204, "stc_savepointleft"},
+ {wxEVT_STC_ROMODIFYATTEMPT, 204, "stc_romodifyattempt"},
+ {wxEVT_STC_KEY, 204, "stc_key"},
+ {wxEVT_STC_DOUBLECLICK, 204, "stc_doubleclick"},
+ {wxEVT_STC_UPDATEUI, 204, "stc_updateui"},
+ {wxEVT_STC_MODIFIED, 204, "stc_modified"},
+ {wxEVT_STC_MACRORECORD, 204, "stc_macrorecord"},
+ {wxEVT_STC_MARGINCLICK, 204, "stc_marginclick"},
+ {wxEVT_STC_NEEDSHOWN, 204, "stc_needshown"},
+ {wxEVT_STC_PAINTED, 204, "stc_painted"},
+ {wxEVT_STC_USERLISTSELECTION, 204, "stc_userlistselection"},
+ {wxEVT_STC_URIDROPPED, 204, "stc_uridropped"},
+ {wxEVT_STC_DWELLSTART, 204, "stc_dwellstart"},
+ {wxEVT_STC_DWELLEND, 204, "stc_dwellend"},
+ {wxEVT_STC_START_DRAG, 204, "stc_start_drag"},
+ {wxEVT_STC_DRAG_OVER, 204, "stc_drag_over"},
+ {wxEVT_STC_DO_DROP, 204, "stc_do_drop"},
+ {wxEVT_STC_ZOOM, 204, "stc_zoom"},
+ {wxEVT_STC_HOTSPOT_CLICK, 204, "stc_hotspot_click"},
+ {wxEVT_STC_HOTSPOT_DCLICK, 204, "stc_hotspot_dclick"},
+ {wxEVT_STC_CALLTIP_CLICK, 204, "stc_calltip_click"},
+ {wxEVT_STC_AUTOCOMP_SELECTION, 204, "stc_autocomp_selection"},
+ {wxEVT_COMMAND_TREE_BEGIN_DRAG, 210, "command_tree_begin_drag"},
+ {wxEVT_COMMAND_TREE_BEGIN_RDRAG, 210, "command_tree_begin_rdrag"},
+ {wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, 210, "command_tree_begin_label_edit"},
+ {wxEVT_COMMAND_TREE_END_LABEL_EDIT, 210, "command_tree_end_label_edit"},
+ {wxEVT_COMMAND_TREE_DELETE_ITEM, 210, "command_tree_delete_item"},
+ {wxEVT_COMMAND_TREE_GET_INFO, 210, "command_tree_get_info"},
+ {wxEVT_COMMAND_TREE_SET_INFO, 210, "command_tree_set_info"},
+ {wxEVT_COMMAND_TREE_ITEM_EXPANDED, 210, "command_tree_item_expanded"},
+ {wxEVT_COMMAND_TREE_ITEM_EXPANDING, 210, "command_tree_item_expanding"},
+ {wxEVT_COMMAND_TREE_ITEM_COLLAPSED, 210, "command_tree_item_collapsed"},
+ {wxEVT_COMMAND_TREE_ITEM_COLLAPSING, 210, "command_tree_item_collapsing"},
+ {wxEVT_COMMAND_TREE_SEL_CHANGED, 210, "command_tree_sel_changed"},
+ {wxEVT_COMMAND_TREE_SEL_CHANGING, 210, "command_tree_sel_changing"},
+ {wxEVT_COMMAND_TREE_KEY_DOWN, 210, "command_tree_key_down"},
+ {wxEVT_COMMAND_TREE_ITEM_ACTIVATED, 210, "command_tree_item_activated"},
+ {wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, 210, "command_tree_item_right_click"},
+ {wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK, 210, "command_tree_item_middle_click"},
+ {wxEVT_COMMAND_TREE_END_DRAG, 210, "command_tree_end_drag"},
+ {wxEVT_COMMAND_TREE_STATE_IMAGE_CLICK, 210, "command_tree_state_image_click"},
+ {wxEVT_COMMAND_TREE_ITEM_GETTOOLTIP, 210, "command_tree_item_gettooltip"},
+ {wxEVT_COMMAND_TREE_ITEM_MENU, 210, "command_tree_item_menu"},
+ {wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, 211, "command_notebook_page_changed"},
+ {wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, 211, "command_notebook_page_changing"},
+ {wxEVT_COMMAND_TEXT_COPY, 217, "command_text_copy"},
+ {wxEVT_COMMAND_TEXT_CUT, 217, "command_text_cut"},
+ {wxEVT_COMMAND_TEXT_PASTE, 217, "command_text_paste"},
+ {wxEVT_COMMAND_SPINCTRL_UPDATED, 218, "command_spinctrl_updated"},
+ {wxEVT_SCROLL_LINEUP + wxEVT_USER_FIRST, 166, "spin_up"},
+ {wxEVT_SCROLL_LINEDOWN + wxEVT_USER_FIRST, 166, "spin_down"},
+ {wxEVT_SCROLL_THUMBTRACK + wxEVT_USER_FIRST, 166, "spin"},
+ {wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, 220, "command_splitter_sash_pos_changed"},
+ {wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING, 220, "command_splitter_sash_pos_changing"},
+ {wxEVT_COMMAND_SPLITTER_DOUBLECLICKED, 220, "command_splitter_doubleclicked"},
+ {wxEVT_COMMAND_SPLITTER_UNSPLIT, 220, "command_splitter_unsplit"},
+ {wxEVT_COMMAND_HTML_LINK_CLICKED, 222, "command_html_link_clicked"},
+ {wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, 225, "command_auinotebook_page_close"},
+ {wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, 225, "command_auinotebook_page_changed"},
+ {wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, 225, "command_auinotebook_page_changing"},
+ {wxEVT_COMMAND_AUINOTEBOOK_BUTTON, 225, "command_auinotebook_button"},
+ {wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG, 225, "command_auinotebook_begin_drag"},
+ {wxEVT_COMMAND_AUINOTEBOOK_END_DRAG, 225, "command_auinotebook_end_drag"},
+ {wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION, 225, "command_auinotebook_drag_motion"},
+ {wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND, 225, "command_auinotebook_allow_dnd"},
#if wxCHECK_VERSION(2,8,5)
- {wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_DOWN, 224, "command_auinotebook_tab_middle_down"},
+ {wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_DOWN, 225, "command_auinotebook_tab_middle_down"},
#endif
#if wxCHECK_VERSION(2,8,5)
- {wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_UP, 224, "command_auinotebook_tab_middle_up"},
+ {wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_UP, 225, "command_auinotebook_tab_middle_up"},
#endif
#if wxCHECK_VERSION(2,8,5)
- {wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_DOWN, 224, "command_auinotebook_tab_right_down"},
+ {wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_DOWN, 225, "command_auinotebook_tab_right_down"},
#endif
#if wxCHECK_VERSION(2,8,5)
- {wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_UP, 224, "command_auinotebook_tab_right_up"},
+ {wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_UP, 225, "command_auinotebook_tab_right_up"},
#endif
#if wxCHECK_VERSION(2,8,5)
- {wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED, 224, "command_auinotebook_page_closed"},
+ {wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED, 225, "command_auinotebook_page_closed"},
#endif
#if wxCHECK_VERSION(2,8,5)
- {wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE, 224, "command_auinotebook_drag_done"},
+ {wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE, 225, "command_auinotebook_drag_done"},
#endif
#if wxCHECK_VERSION(2,8,5)
- {wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK, 224, "command_auinotebook_bg_dclick"},
+ {wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK, 225, "command_auinotebook_bg_dclick"},
#endif
- {wxEVT_AUI_PANE_BUTTON, 225, "aui_pane_button"},
- {wxEVT_AUI_PANE_CLOSE, 225, "aui_pane_close"},
- {wxEVT_AUI_PANE_MAXIMIZE, 225, "aui_pane_maximize"},
- {wxEVT_AUI_PANE_RESTORE, 225, "aui_pane_restore"},
- {wxEVT_AUI_RENDER, 225, "aui_render"},
- {wxEVT_AUI_FIND_MANAGER, 225, "aui_find_manager"},
- {wxEVT_TASKBAR_MOVE, 228, "taskbar_move"},
- {wxEVT_TASKBAR_LEFT_DOWN, 228, "taskbar_left_down"},
- {wxEVT_TASKBAR_LEFT_UP, 228, "taskbar_left_up"},
- {wxEVT_TASKBAR_RIGHT_DOWN, 228, "taskbar_right_down"},
- {wxEVT_TASKBAR_RIGHT_UP, 228, "taskbar_right_up"},
- {wxEVT_TASKBAR_LEFT_DCLICK, 228, "taskbar_left_dclick"},
- {wxEVT_TASKBAR_RIGHT_DCLICK, 228, "taskbar_right_dclick"},
- {wxEVT_INIT_DIALOG, 229, "init_dialog"},
- {wxEVT_ACTIVATE, 231, "activate"},
- {wxEVT_ACTIVATE_APP, 231, "activate_app"},
- {wxEVT_HIBERNATE, 231, "hibernate"},
- {wxEVT_MOUSE_CAPTURE_LOST, 234, "mouse_capture_lost"},
+ {wxEVT_AUI_PANE_BUTTON, 226, "aui_pane_button"},
+ {wxEVT_AUI_PANE_CLOSE, 226, "aui_pane_close"},
+ {wxEVT_AUI_PANE_MAXIMIZE, 226, "aui_pane_maximize"},
+ {wxEVT_AUI_PANE_RESTORE, 226, "aui_pane_restore"},
+#if wxCHECK_VERSION(2,9,5)
+ {wxEVT_AUI_PANE_ACTIVATED, 226, "aui_pane_activated"},
+#endif
+ {wxEVT_AUI_RENDER, 226, "aui_render"},
+ {wxEVT_AUI_FIND_MANAGER, 226, "aui_find_manager"},
+ {wxEVT_TASKBAR_MOVE, 229, "taskbar_move"},
+ {wxEVT_TASKBAR_LEFT_DOWN, 229, "taskbar_left_down"},
+ {wxEVT_TASKBAR_LEFT_UP, 229, "taskbar_left_up"},
+ {wxEVT_TASKBAR_RIGHT_DOWN, 229, "taskbar_right_down"},
+ {wxEVT_TASKBAR_RIGHT_UP, 229, "taskbar_right_up"},
+ {wxEVT_TASKBAR_LEFT_DCLICK, 229, "taskbar_left_dclick"},
+ {wxEVT_TASKBAR_RIGHT_DCLICK, 229, "taskbar_right_dclick"},
+ {wxEVT_INIT_DIALOG, 230, "init_dialog"},
+ {wxEVT_ACTIVATE, 232, "activate"},
+ {wxEVT_ACTIVATE_APP, 232, "activate_app"},
+ {wxEVT_HIBERNATE, 232, "hibernate"},
+ {wxEVT_MOUSE_CAPTURE_LOST, 235, "mouse_capture_lost"},
{-1, 0, }
};
for(int i=0; event_types[i].ev_type != -1; i++) {
@@ -345,7 +348,7 @@ bool sendevent(wxEvent *event, ErlDrvTermData port)
rt.addRef(cb->obj, cb->class_name);
rt.addExt2Term(cb->user_data);
switch(Etype->cID) {
-case 164: {// wxCommandEvent
+case 165: {// wxCommandEvent
wxCommandEvent * ev = (wxCommandEvent *) event;
evClass = (char*)"wxCommandEvent";
rt.addAtom((char*)"wxCommand");
@@ -356,7 +359,7 @@ case 164: {// wxCommandEvent
rt.addTupleCount(5);
break;
}
-case 165: {// wxScrollEvent or wxSpinEvent
+case 166: {// wxScrollEvent or wxSpinEvent
if(event->IsKindOf(CLASSINFO(wxScrollEvent))) {
wxScrollEvent * ev = (wxScrollEvent *) event;
evClass = (char*)"wxScrollEvent";
@@ -376,7 +379,7 @@ case 165: {// wxScrollEvent or wxSpinEvent
}
break;
}
-case 166: {// wxScrollWinEvent
+case 167: {// wxScrollWinEvent
wxScrollWinEvent * ev = (wxScrollWinEvent *) event;
evClass = (char*)"wxScrollWinEvent";
rt.addAtom((char*)"wxScrollWin");
@@ -386,7 +389,7 @@ case 166: {// wxScrollWinEvent
rt.addTupleCount(4);
break;
}
-case 167: {// wxMouseEvent
+case 168: {// wxMouseEvent
wxMouseEvent * ev = (wxMouseEvent *) event;
evClass = (char*)"wxMouseEvent";
rt.addAtom((char*)"wxMouse");
@@ -410,7 +413,7 @@ case 167: {// wxMouseEvent
rt.addTupleCount(14);
break;
}
-case 168: {// wxSetCursorEvent
+case 169: {// wxSetCursorEvent
wxSetCursorEvent * ev = (wxSetCursorEvent *) event;
wxCursor * GetCursor = new wxCursor(ev->GetCursor());
app->newPtr((void *) GetCursor,3, memenv);
@@ -423,7 +426,7 @@ case 168: {// wxSetCursorEvent
rt.addTupleCount(5);
break;
}
-case 169: {// wxKeyEvent
+case 170: {// wxKeyEvent
wxKeyEvent * ev = (wxKeyEvent *) event;
evClass = (char*)"wxKeyEvent";
rt.addAtom((char*)"wxKey");
@@ -450,7 +453,7 @@ case 169: {// wxKeyEvent
rt.addTupleCount(13);
break;
}
-case 170: {// wxSizeEvent
+case 171: {// wxSizeEvent
wxSizeEvent * ev = (wxSizeEvent *) event;
evClass = (char*)"wxSizeEvent";
rt.addAtom((char*)"wxSize");
@@ -460,7 +463,7 @@ case 170: {// wxSizeEvent
rt.addTupleCount(4);
break;
}
-case 171: {// wxMoveEvent
+case 172: {// wxMoveEvent
wxMoveEvent * ev = (wxMoveEvent *) event;
evClass = (char*)"wxMoveEvent";
rt.addAtom((char*)"wxMove");
@@ -470,14 +473,14 @@ case 171: {// wxMoveEvent
rt.addTupleCount(4);
break;
}
-case 172: {// wxPaintEvent
+case 173: {// wxPaintEvent
evClass = (char*)"wxPaintEvent";
rt.addAtom((char*)"wxPaint");
rt.addAtom(Etype->eName);
rt.addTupleCount(2);
break;
}
-case 173: {// wxEraseEvent
+case 174: {// wxEraseEvent
wxEraseEvent * ev = (wxEraseEvent *) event;
wxDC * GetDC = ev->GetDC();
evClass = (char*)"wxEraseEvent";
@@ -487,7 +490,7 @@ case 173: {// wxEraseEvent
rt.addTupleCount(3);
break;
}
-case 174: {// wxFocusEvent
+case 175: {// wxFocusEvent
wxFocusEvent * ev = (wxFocusEvent *) event;
wxWindow * GetWindow = ev->GetWindow();
evClass = (char*)"wxFocusEvent";
@@ -497,14 +500,14 @@ case 174: {// wxFocusEvent
rt.addTupleCount(3);
break;
}
-case 175: {// wxChildFocusEvent
+case 176: {// wxChildFocusEvent
evClass = (char*)"wxChildFocusEvent";
rt.addAtom((char*)"wxChildFocus");
rt.addAtom(Etype->eName);
rt.addTupleCount(2);
break;
}
-case 176: {// wxMenuEvent
+case 177: {// wxMenuEvent
wxMenuEvent * ev = (wxMenuEvent *) event;
wxMenu * GetMenu = ev->GetMenu();
evClass = (char*)"wxMenuEvent";
@@ -515,14 +518,14 @@ case 176: {// wxMenuEvent
rt.addTupleCount(4);
break;
}
-case 177: {// wxCloseEvent
+case 178: {// wxCloseEvent
evClass = (char*)"wxCloseEvent";
rt.addAtom((char*)"wxClose");
rt.addAtom(Etype->eName);
rt.addTupleCount(2);
break;
}
-case 178: {// wxShowEvent
+case 179: {// wxShowEvent
wxShowEvent * ev = (wxShowEvent *) event;
evClass = (char*)"wxShowEvent";
rt.addAtom((char*)"wxShow");
@@ -531,7 +534,7 @@ case 178: {// wxShowEvent
rt.addTupleCount(3);
break;
}
-case 179: {// wxIconizeEvent
+case 180: {// wxIconizeEvent
wxIconizeEvent * ev = (wxIconizeEvent *) event;
evClass = (char*)"wxIconizeEvent";
rt.addAtom((char*)"wxIconize");
@@ -540,14 +543,14 @@ case 179: {// wxIconizeEvent
rt.addTupleCount(3);
break;
}
-case 180: {// wxMaximizeEvent
+case 181: {// wxMaximizeEvent
evClass = (char*)"wxMaximizeEvent";
rt.addAtom((char*)"wxMaximize");
rt.addAtom(Etype->eName);
rt.addTupleCount(2);
break;
}
-case 181: {// wxJoystickEvent
+case 182: {// wxJoystickEvent
wxJoystickEvent * ev = (wxJoystickEvent *) event;
evClass = (char*)"wxJoystickEvent";
rt.addAtom((char*)"wxJoystick");
@@ -560,49 +563,49 @@ case 181: {// wxJoystickEvent
rt.addTupleCount(7);
break;
}
-case 182: {// wxUpdateUIEvent
+case 183: {// wxUpdateUIEvent
evClass = (char*)"wxUpdateUIEvent";
rt.addAtom((char*)"wxUpdateUI");
rt.addAtom(Etype->eName);
rt.addTupleCount(2);
break;
}
-case 183: {// wxSysColourChangedEvent
+case 184: {// wxSysColourChangedEvent
evClass = (char*)"wxSysColourChangedEvent";
rt.addAtom((char*)"wxSysColourChanged");
rt.addAtom(Etype->eName);
rt.addTupleCount(2);
break;
}
-case 184: {// wxMouseCaptureChangedEvent
+case 185: {// wxMouseCaptureChangedEvent
evClass = (char*)"wxMouseCaptureChangedEvent";
rt.addAtom((char*)"wxMouseCaptureChanged");
rt.addAtom(Etype->eName);
rt.addTupleCount(2);
break;
}
-case 185: {// wxDisplayChangedEvent
+case 186: {// wxDisplayChangedEvent
evClass = (char*)"wxDisplayChangedEvent";
rt.addAtom((char*)"wxDisplayChanged");
rt.addAtom(Etype->eName);
rt.addTupleCount(2);
break;
}
-case 186: {// wxPaletteChangedEvent
+case 187: {// wxPaletteChangedEvent
evClass = (char*)"wxPaletteChangedEvent";
rt.addAtom((char*)"wxPaletteChanged");
rt.addAtom(Etype->eName);
rt.addTupleCount(2);
break;
}
-case 187: {// wxQueryNewPaletteEvent
+case 188: {// wxQueryNewPaletteEvent
evClass = (char*)"wxQueryNewPaletteEvent";
rt.addAtom((char*)"wxQueryNewPalette");
rt.addAtom(Etype->eName);
rt.addTupleCount(2);
break;
}
-case 188: {// wxNavigationKeyEvent
+case 189: {// wxNavigationKeyEvent
wxNavigationKeyEvent * ev = (wxNavigationKeyEvent *) event;
evClass = (char*)"wxNavigationKeyEvent";
rt.addAtom((char*)"wxNavigationKey");
@@ -612,28 +615,28 @@ case 188: {// wxNavigationKeyEvent
rt.addTupleCount(4);
break;
}
-case 189: {// wxWindowCreateEvent
+case 190: {// wxWindowCreateEvent
evClass = (char*)"wxWindowCreateEvent";
rt.addAtom((char*)"wxWindowCreate");
rt.addAtom(Etype->eName);
rt.addTupleCount(2);
break;
}
-case 190: {// wxWindowDestroyEvent
+case 191: {// wxWindowDestroyEvent
evClass = (char*)"wxWindowDestroyEvent";
rt.addAtom((char*)"wxWindowDestroy");
rt.addAtom(Etype->eName);
rt.addTupleCount(2);
break;
}
-case 191: {// wxHelpEvent
+case 192: {// wxHelpEvent
evClass = (char*)"wxHelpEvent";
rt.addAtom((char*)"wxHelp");
rt.addAtom(Etype->eName);
rt.addTupleCount(2);
break;
}
-case 192: {// wxContextMenuEvent
+case 193: {// wxContextMenuEvent
wxContextMenuEvent * ev = (wxContextMenuEvent *) event;
evClass = (char*)"wxContextMenuEvent";
rt.addAtom((char*)"wxContextMenu");
@@ -642,14 +645,14 @@ case 192: {// wxContextMenuEvent
rt.addTupleCount(3);
break;
}
-case 193: {// wxIdleEvent
+case 194: {// wxIdleEvent
evClass = (char*)"wxIdleEvent";
rt.addAtom((char*)"wxIdle");
rt.addAtom(Etype->eName);
rt.addTupleCount(2);
break;
}
-case 194: {// wxGridEvent
+case 195: {// wxGridEvent
wxGridEvent * ev = (wxGridEvent *) event;
evClass = (char*)"wxGridEvent";
rt.addAtom((char*)"wxGrid");
@@ -666,7 +669,7 @@ case 194: {// wxGridEvent
rt.addTupleCount(11);
break;
}
-case 196: {// wxSashEvent
+case 197: {// wxSashEvent
wxSashEvent * ev = (wxSashEvent *) event;
evClass = (char*)"wxSashEvent";
rt.addAtom((char*)"wxSash");
@@ -677,7 +680,7 @@ case 196: {// wxSashEvent
rt.addTupleCount(5);
break;
}
-case 197: {// wxListEvent
+case 198: {// wxListEvent
wxListEvent * ev = (wxListEvent *) event;
evClass = (char*)"wxListEvent";
rt.addAtom((char*)"wxList");
@@ -690,7 +693,7 @@ case 197: {// wxListEvent
rt.addTupleCount(7);
break;
}
-case 198: {// wxDateEvent
+case 199: {// wxDateEvent
wxDateEvent * ev = (wxDateEvent *) event;
evClass = (char*)"wxDateEvent";
rt.addAtom((char*)"wxDate");
@@ -699,7 +702,7 @@ case 198: {// wxDateEvent
rt.addTupleCount(3);
break;
}
-case 199: {// wxCalendarEvent
+case 200: {// wxCalendarEvent
wxCalendarEvent * ev = (wxCalendarEvent *) event;
evClass = (char*)"wxCalendarEvent";
rt.addAtom((char*)"wxCalendar");
@@ -709,7 +712,7 @@ case 199: {// wxCalendarEvent
rt.addTupleCount(4);
break;
}
-case 200: {// wxFileDirPickerEvent
+case 201: {// wxFileDirPickerEvent
wxFileDirPickerEvent * ev = (wxFileDirPickerEvent *) event;
evClass = (char*)"wxFileDirPickerEvent";
rt.addAtom((char*)"wxFileDirPicker");
@@ -718,7 +721,7 @@ case 200: {// wxFileDirPickerEvent
rt.addTupleCount(3);
break;
}
-case 201: {// wxColourPickerEvent
+case 202: {// wxColourPickerEvent
wxColourPickerEvent * ev = (wxColourPickerEvent *) event;
evClass = (char*)"wxColourPickerEvent";
rt.addAtom((char*)"wxColourPicker");
@@ -727,7 +730,7 @@ case 201: {// wxColourPickerEvent
rt.addTupleCount(3);
break;
}
-case 202: {// wxFontPickerEvent
+case 203: {// wxFontPickerEvent
wxFontPickerEvent * ev = (wxFontPickerEvent *) event;
wxFont * GetFont = new wxFont(ev->GetFont());
app->newPtr((void *) GetFont,3, memenv);
@@ -738,7 +741,7 @@ case 202: {// wxFontPickerEvent
rt.addTupleCount(3);
break;
}
-case 203: {// wxStyledTextEvent
+case 204: {// wxStyledTextEvent
wxStyledTextEvent * ev = (wxStyledTextEvent *) event;
evClass = (char*)"wxStyledTextEvent";
rt.addAtom((char*)"wxStyledText");
@@ -766,7 +769,7 @@ case 203: {// wxStyledTextEvent
rt.addTupleCount(22);
break;
}
-case 209: {// wxTreeEvent
+case 210: {// wxTreeEvent
wxTreeEvent * ev = (wxTreeEvent *) event;
evClass = (char*)"wxTreeEvent";
rt.addAtom((char*)"wxTree");
@@ -777,7 +780,7 @@ case 209: {// wxTreeEvent
rt.addTupleCount(5);
break;
}
-case 210: {// wxNotebookEvent
+case 211: {// wxNotebookEvent
wxNotebookEvent * ev = (wxNotebookEvent *) event;
evClass = (char*)"wxNotebookEvent";
rt.addAtom((char*)"wxNotebook");
@@ -787,14 +790,14 @@ case 210: {// wxNotebookEvent
rt.addTupleCount(4);
break;
}
-case 216: {// wxClipboardTextEvent
+case 217: {// wxClipboardTextEvent
evClass = (char*)"wxClipboardTextEvent";
rt.addAtom((char*)"wxClipboardText");
rt.addAtom(Etype->eName);
rt.addTupleCount(2);
break;
}
-case 217: {// wxSpinEvent
+case 218: {// wxSpinEvent
wxSpinEvent * ev = (wxSpinEvent *) event;
evClass = (char*)"wxSpinEvent";
rt.addAtom((char*)"wxSpin");
@@ -803,14 +806,14 @@ case 217: {// wxSpinEvent
rt.addTupleCount(3);
break;
}
-case 219: {// wxSplitterEvent
+case 220: {// wxSplitterEvent
evClass = (char*)"wxSplitterEvent";
rt.addAtom((char*)"wxSplitter");
rt.addAtom(Etype->eName);
rt.addTupleCount(2);
break;
}
-case 221: {// wxHtmlLinkEvent
+case 222: {// wxHtmlLinkEvent
wxHtmlLinkEvent * ev = (wxHtmlLinkEvent *) event;
evClass = (char*)"wxHtmlLinkEvent";
rt.addAtom((char*)"wxHtmlLink");
@@ -819,7 +822,7 @@ case 221: {// wxHtmlLinkEvent
rt.addTupleCount(3);
break;
}
-case 224: {// wxAuiNotebookEvent
+case 225: {// wxAuiNotebookEvent
wxAuiNotebookEvent * ev = (wxAuiNotebookEvent *) event;
wxAuiNotebook * GetDragSource = ev->GetDragSource();
evClass = (char*)"wxAuiNotebookEvent";
@@ -831,7 +834,7 @@ case 224: {// wxAuiNotebookEvent
rt.addTupleCount(5);
break;
}
-case 225: {// wxAuiManagerEvent
+case 226: {// wxAuiManagerEvent
wxAuiManagerEvent * ev = (wxAuiManagerEvent *) event;
wxAuiManager * GetManager = ev->GetManager();
wxAuiPaneInfo * GetPane = ev->GetPane();
@@ -848,21 +851,21 @@ case 225: {// wxAuiManagerEvent
rt.addTupleCount(8);
break;
}
-case 228: {// wxTaskBarIconEvent
+case 229: {// wxTaskBarIconEvent
evClass = (char*)"wxTaskBarIconEvent";
rt.addAtom((char*)"wxTaskBarIcon");
rt.addAtom(Etype->eName);
rt.addTupleCount(2);
break;
}
-case 229: {// wxInitDialogEvent
+case 230: {// wxInitDialogEvent
evClass = (char*)"wxInitDialogEvent";
rt.addAtom((char*)"wxInitDialog");
rt.addAtom(Etype->eName);
rt.addTupleCount(2);
break;
}
-case 231: {// wxActivateEvent
+case 232: {// wxActivateEvent
wxActivateEvent * ev = (wxActivateEvent *) event;
evClass = (char*)"wxActivateEvent";
rt.addAtom((char*)"wxActivate");
@@ -871,7 +874,7 @@ case 231: {// wxActivateEvent
rt.addTupleCount(3);
break;
}
-case 234: {// wxMouseCaptureLostEvent
+case 235: {// wxMouseCaptureLostEvent
evClass = (char*)"wxMouseCaptureLostEvent";
rt.addAtom((char*)"wxMouseCaptureLost");
rt.addAtom(Etype->eName);
diff --git a/lib/wx/c_src/gen/wxe_funcs.cpp b/lib/wx/c_src/gen/wxe_funcs.cpp
index b440de6cae..3211664499 100644
--- a/lib/wx/c_src/gen/wxe_funcs.cpp
+++ b/lib/wx/c_src/gen/wxe_funcs.cpp
@@ -23735,8 +23735,11 @@ case wxAuiManager_DetachPane: { // wxAuiManager::DetachPane
case wxAuiManager_GetAllPanes: { // wxAuiManager::GetAllPanes
wxAuiManager *This = (wxAuiManager *) getPtr(bp,memenv); bp += 4;
if(!This) throw wxe_badarg(0);
- wxAuiPaneInfoArray * Result = &This->GetAllPanes();
- rt.addRef(getRef((void *)Result,memenv), "wxAuiPaneInfoArray");
+ wxAuiPaneInfoArray Result = This->GetAllPanes();
+ for(unsigned int i=0; i < Result.GetCount(); i++) {
+ rt.addRef(getRef((void *) &Result.Item(i), memenv), "wxAuiPaneInfo");
+ }
+ rt.endList(Result.GetCount());
break;
}
case wxAuiManager_GetArtProvider: { // wxAuiManager::GetArtProvider
@@ -24595,6 +24598,102 @@ case wxAuiPaneInfo_Window: { // wxAuiPaneInfo::Window
rt.addRef(getRef((void *)Result,memenv), "wxAuiPaneInfo");
break;
}
+case wxAuiPaneInfo_GetWindow: { // wxAuiPaneInfo::GetWindow
+ wxAuiPaneInfo *This = (wxAuiPaneInfo *) getPtr(bp,memenv); bp += 4;
+ #if 0
+;
+ if(!This) throw wxe_badarg(0);
+ wxWindow * Result = (wxWindow*)This->GetWindow();
+ #endif
+ if(!This) throw wxe_badarg(0);
+ wxWindow* Result = This->window;
+ rt.addRef(getRef((void *)Result,memenv), "wxWindow");
+ break;
+}
+case wxAuiPaneInfo_GetFrame: { // wxAuiPaneInfo::GetFrame
+ wxAuiPaneInfo *This = (wxAuiPaneInfo *) getPtr(bp,memenv); bp += 4;
+ #if 0
+;
+ if(!This) throw wxe_badarg(0);
+ wxFrame * Result = (wxFrame*)This->GetFrame();
+ #endif
+ if(!This) throw wxe_badarg(0);
+ wxFrame* Result = This->frame;
+ rt.addRef(getRef((void *)Result,memenv), "wxFrame");
+ break;
+}
+case wxAuiPaneInfo_GetDirection: { // wxAuiPaneInfo::GetDirection
+ wxAuiPaneInfo *This = (wxAuiPaneInfo *) getPtr(bp,memenv); bp += 4;
+ #if 0
+;
+ if(!This) throw wxe_badarg(0);
+ int Result = This->GetDirection();
+ #endif
+ if(!This) throw wxe_badarg(0);
+ int Result = This->dock_direction;
+ rt.addInt(Result);
+ break;
+}
+case wxAuiPaneInfo_GetLayer: { // wxAuiPaneInfo::GetLayer
+ wxAuiPaneInfo *This = (wxAuiPaneInfo *) getPtr(bp,memenv); bp += 4;
+ #if 0
+;
+ if(!This) throw wxe_badarg(0);
+ int Result = This->GetLayer();
+ #endif
+ if(!This) throw wxe_badarg(0);
+ int Result = This->dock_layer;
+ rt.addInt(Result);
+ break;
+}
+case wxAuiPaneInfo_GetRow: { // wxAuiPaneInfo::GetRow
+ wxAuiPaneInfo *This = (wxAuiPaneInfo *) getPtr(bp,memenv); bp += 4;
+ #if 0
+;
+ if(!This) throw wxe_badarg(0);
+ int Result = This->GetRow();
+ #endif
+ if(!This) throw wxe_badarg(0);
+ int Result = This->dock_row;
+ rt.addInt(Result);
+ break;
+}
+case wxAuiPaneInfo_GetPosition: { // wxAuiPaneInfo::GetPosition
+ wxAuiPaneInfo *This = (wxAuiPaneInfo *) getPtr(bp,memenv); bp += 4;
+ #if 0
+;
+ if(!This) throw wxe_badarg(0);
+ int Result = This->GetPosition();
+ #endif
+ if(!This) throw wxe_badarg(0);
+ int Result = This->dock_pos;
+ rt.addInt(Result);
+ break;
+}
+case wxAuiPaneInfo_GetFloatingPosition: { // wxAuiPaneInfo::GetFloatingPosition
+ wxAuiPaneInfo *This = (wxAuiPaneInfo *) getPtr(bp,memenv); bp += 4;
+ #if 0
+;
+ if(!This) throw wxe_badarg(0);
+ wxPoint Result = This->GetFloatingPosition();
+ #endif
+ if(!This) throw wxe_badarg(0);
+ wxPoint Result = This->floating_pos;
+ rt.add(Result);
+ break;
+}
+case wxAuiPaneInfo_GetFloatingSize: { // wxAuiPaneInfo::GetFloatingSize
+ wxAuiPaneInfo *This = (wxAuiPaneInfo *) getPtr(bp,memenv); bp += 4;
+ #if 0
+;
+ if(!This) throw wxe_badarg(0);
+ wxSize Result = This->GetFloatingSize();
+ #endif
+ if(!This) throw wxe_badarg(0);
+ wxSize Result = This->floating_size;
+ rt.add(Result);
+ break;
+}
#endif // wxUSE_AUI
#if wxUSE_AUI
case wxAuiNotebook_new_0: { // wxAuiNotebook::wxAuiNotebook
@@ -24840,8 +24939,128 @@ case wxAuiNotebook_SetUniformBitmapSize: { // wxAuiNotebook::SetUniformBitmapSiz
}
#endif // wxUSE_AUI
#if wxUSE_AUI
+case wxAuiTabArt_SetFlags: { // wxAuiTabArt::SetFlags
+ wxAuiTabArt *This = (wxAuiTabArt *) getPtr(bp,memenv); bp += 4;
+ unsigned int * flags = (unsigned int *) bp; bp += 4;
+ if(!This) throw wxe_badarg(0);
+ This->SetFlags(*flags);
+ break;
+}
+case wxAuiTabArt_SetMeasuringFont: { // wxAuiTabArt::SetMeasuringFont
+ wxAuiTabArt *This = (wxAuiTabArt *) getPtr(bp,memenv); bp += 4;
+ wxFont *font = (wxFont *) getPtr(bp,memenv); bp += 4;
+ if(!This) throw wxe_badarg(0);
+ This->SetMeasuringFont(*font);
+ break;
+}
+case wxAuiTabArt_SetNormalFont: { // wxAuiTabArt::SetNormalFont
+ wxAuiTabArt *This = (wxAuiTabArt *) getPtr(bp,memenv); bp += 4;
+ wxFont *font = (wxFont *) getPtr(bp,memenv); bp += 4;
+ if(!This) throw wxe_badarg(0);
+ This->SetNormalFont(*font);
+ break;
+}
+case wxAuiTabArt_SetSelectedFont: { // wxAuiTabArt::SetSelectedFont
+ wxAuiTabArt *This = (wxAuiTabArt *) getPtr(bp,memenv); bp += 4;
+ wxFont *font = (wxFont *) getPtr(bp,memenv); bp += 4;
+ if(!This) throw wxe_badarg(0);
+ This->SetSelectedFont(*font);
+ break;
+}
+#if wxCHECK_VERSION(3,0,0)
+case wxAuiTabArt_SetColour: { // wxAuiTabArt::SetColour
+ wxAuiTabArt *This = (wxAuiTabArt *) getPtr(bp,memenv); bp += 4;
+ int * colourR = (int *) bp; bp += 4;
+ int * colourG = (int *) bp; bp += 4;
+ int * colourB = (int *) bp; bp += 4;
+ int * colourA = (int *) bp; bp += 4;
+ wxColour colour = wxColour(*colourR,*colourG,*colourB,*colourA);
+ if(!This) throw wxe_badarg(0);
+ This->SetColour(colour);
+ break;
+}
+#endif
+#if wxCHECK_VERSION(3,0,0)
+case wxAuiTabArt_SetActiveColour: { // wxAuiTabArt::SetActiveColour
+ wxAuiTabArt *This = (wxAuiTabArt *) getPtr(bp,memenv); bp += 4;
+ int * colourR = (int *) bp; bp += 4;
+ int * colourG = (int *) bp; bp += 4;
+ int * colourB = (int *) bp; bp += 4;
+ int * colourA = (int *) bp; bp += 4;
+ wxColour colour = wxColour(*colourR,*colourG,*colourB,*colourA);
+ if(!This) throw wxe_badarg(0);
+ This->SetActiveColour(colour);
+ break;
+}
+#endif
+#endif // wxUSE_AUI
+#if wxUSE_AUI
+case wxAuiDockArt_GetColour: { // wxAuiDockArt::GetColour
+ wxAuiDockArt *This = (wxAuiDockArt *) getPtr(bp,memenv); bp += 4;
+ int * id = (int *) bp; bp += 4;
+ if(!This) throw wxe_badarg(0);
+ wxColour Result = This->GetColour(*id);
+ rt.add(Result);
+ break;
+}
+case wxAuiDockArt_GetFont: { // wxAuiDockArt::GetFont
+ wxAuiDockArt *This = (wxAuiDockArt *) getPtr(bp,memenv); bp += 4;
+ int * id = (int *) bp; bp += 4;
+ if(!This) throw wxe_badarg(0);
+ wxFont * Result = new wxFont(This->GetFont(*id)); newPtr((void *) Result,3, memenv);;
+ rt.addRef(getRef((void *)Result,memenv), "wxFont");
+ break;
+}
+case wxAuiDockArt_GetMetric: { // wxAuiDockArt::GetMetric
+ wxAuiDockArt *This = (wxAuiDockArt *) getPtr(bp,memenv); bp += 4;
+ int * id = (int *) bp; bp += 4;
+ if(!This) throw wxe_badarg(0);
+ int Result = This->GetMetric(*id);
+ rt.addInt(Result);
+ break;
+}
+case wxAuiDockArt_SetColour: { // wxAuiDockArt::SetColour
+ wxAuiDockArt *This = (wxAuiDockArt *) getPtr(bp,memenv); bp += 4;
+ int * id = (int *) bp; bp += 4;
+ int * colourR = (int *) bp; bp += 4;
+ int * colourG = (int *) bp; bp += 4;
+ int * colourB = (int *) bp; bp += 4;
+ int * colourA = (int *) bp; bp += 4;
+ wxColour colour = wxColour(*colourR,*colourG,*colourB,*colourA);
+ if(!This) throw wxe_badarg(0);
+ This->SetColour(*id,colour);
+ break;
+}
+case wxAuiDockArt_SetFont: { // wxAuiDockArt::SetFont
+ wxAuiDockArt *This = (wxAuiDockArt *) getPtr(bp,memenv); bp += 4;
+ int * id = (int *) bp; bp += 4;
+ wxFont *font = (wxFont *) getPtr(bp,memenv); bp += 4;
+ if(!This) throw wxe_badarg(0);
+ This->SetFont(*id,*font);
+ break;
+}
+case wxAuiDockArt_SetMetric: { // wxAuiDockArt::SetMetric
+ wxAuiDockArt *This = (wxAuiDockArt *) getPtr(bp,memenv); bp += 4;
+ int * id = (int *) bp; bp += 4;
+ int * new_val = (int *) bp; bp += 4;
+ if(!This) throw wxe_badarg(0);
+ This->SetMetric(*id,*new_val);
+ break;
+}
#endif // wxUSE_AUI
#if wxUSE_AUI
+case wxAuiSimpleTabArt_new: { // wxAuiSimpleTabArt::wxAuiSimpleTabArt
+ wxAuiSimpleTabArt * Result = new wxAuiSimpleTabArt();
+ newPtr((void *) Result, 159, memenv);
+ rt.addRef(getRef((void *)Result,memenv), "wxAuiSimpleTabArt");
+ break;
+}
+case wxAuiSimpleTabArt_destroy: { // wxAuiSimpleTabArt::destroy
+ wxAuiSimpleTabArt *This = (wxAuiSimpleTabArt *) getPtr(bp,memenv); bp += 4;
+ if(This) { ((WxeApp *) wxTheApp)->clearPtr((void *) This);
+ delete This;}
+ break;
+}
#endif // wxUSE_AUI
case wxMDIParentFrame_new_0: { // wxMDIParentFrame::wxMDIParentFrame
wxMDIParentFrame * Result = new EwxMDIParentFrame();
@@ -30473,7 +30692,7 @@ case wxNotebookEvent_SetSelection: { // wxNotebookEvent::SetSelection
}
case wxFileDataObject_new: { // wxFileDataObject::wxFileDataObject
wxFileDataObject * Result = new wxFileDataObject();
- newPtr((void *) Result, 212, memenv);
+ newPtr((void *) Result, 213, memenv);
rt.addRef(getRef((void *)Result,memenv), "wxFileDataObject");
break;
}
@@ -30509,7 +30728,7 @@ case wxTextDataObject_new: { // wxTextDataObject::wxTextDataObject
} break;
}};
wxTextDataObject * Result = new wxTextDataObject(text);
- newPtr((void *) Result, 213, memenv);
+ newPtr((void *) Result, 214, memenv);
rt.addRef(getRef((void *)Result,memenv), "wxTextDataObject");
break;
}
@@ -30545,7 +30764,7 @@ case wxTextDataObject_destroy: { // wxTextDataObject::destroy
case wxBitmapDataObject_new_1_1: { // wxBitmapDataObject::wxBitmapDataObject
wxBitmap *bitmap = (wxBitmap *) getPtr(bp,memenv); bp += 4;
wxBitmapDataObject * Result = new wxBitmapDataObject(*bitmap);
- newPtr((void *) Result, 214, memenv);
+ newPtr((void *) Result, 215, memenv);
rt.addRef(getRef((void *)Result,memenv), "wxBitmapDataObject");
break;
}
@@ -30557,7 +30776,7 @@ bitmap = (wxBitmap *) getPtr(bp,memenv); bp += 4;
} break;
}};
wxBitmapDataObject * Result = new wxBitmapDataObject(*bitmap);
- newPtr((void *) Result, 214, memenv);
+ newPtr((void *) Result, 215, memenv);
rt.addRef(getRef((void *)Result,memenv), "wxBitmapDataObject");
break;
}
@@ -31390,7 +31609,7 @@ case wxAuiManagerEvent_CanVeto: { // wxAuiManagerEvent::CanVeto
}
case wxLogNull_new: { // wxLogNull::wxLogNull
wxLogNull * Result = new wxLogNull();
- newPtr((void *) Result, 226, memenv);
+ newPtr((void *) Result, 227, memenv);
rt.addRef(getRef((void *)Result,memenv), "wxLogNull");
break;
}
@@ -31439,7 +31658,7 @@ case wxTaskBarIcon_SetIcon: { // wxTaskBarIcon::SetIcon
}
case wxLocale_new_0: { // wxLocale::wxLocale
wxLocale * Result = new EwxLocale();
- newPtr((void *) Result, 230, memenv);
+ newPtr((void *) Result, 231, memenv);
rt.addRef(getRef((void *)Result,memenv), "wxLocale");
break;
}
@@ -31453,7 +31672,7 @@ case wxLocale_new_2: { // wxLocale::wxLocale
} break;
}};
wxLocale * Result = new EwxLocale(*language,flags);
- newPtr((void *) Result, 230, memenv);
+ newPtr((void *) Result, 231, memenv);
rt.addRef(getRef((void *)Result,memenv), "wxLocale");
break;
}
@@ -31780,11 +31999,12 @@ bool WxeApp::delete_object(void *ptr, wxeRefData *refd) {
case 101: delete (wxListItemAttr *) ptr; break;
case 103: delete (wxTextAttr *) ptr; break;
case 155: delete (wxAuiPaneInfo *) ptr; break;
- case 212: /* delete (wxFileDataObject *) ptr;These objects must be deleted by owner object */ break;
- case 213: /* delete (wxTextDataObject *) ptr;These objects must be deleted by owner object */ break;
- case 214: /* delete (wxBitmapDataObject *) ptr;These objects must be deleted by owner object */ break;
- case 226: delete (wxLogNull *) ptr; break;
- case 230: delete (EwxLocale *) ptr; return false;
+ case 159: /* delete (wxAuiSimpleTabArt *) ptr;These objects must be deleted by owner object */ break;
+ case 213: /* delete (wxFileDataObject *) ptr;These objects must be deleted by owner object */ break;
+ case 214: /* delete (wxTextDataObject *) ptr;These objects must be deleted by owner object */ break;
+ case 215: /* delete (wxBitmapDataObject *) ptr;These objects must be deleted by owner object */ break;
+ case 227: delete (wxLogNull *) ptr; break;
+ case 231: delete (EwxLocale *) ptr; return false;
default: delete (wxObject *) ptr; return false;
}
return true;
diff --git a/lib/wx/c_src/gen/wxe_macros.h b/lib/wx/c_src/gen/wxe_macros.h
index 50ceb01623..59f9c7054e 100644
--- a/lib/wx/c_src/gen/wxe_macros.h
+++ b/lib/wx/c_src/gen/wxe_macros.h
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 2008-2014. All Rights Reserved.
+ * Copyright Ericsson AB 2008-2015. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -2488,906 +2488,928 @@
#define wxAuiPaneInfo_Top 2650
#define wxAuiPaneInfo_TopDockable 2651
#define wxAuiPaneInfo_Window 2652
-#define wxAuiNotebook_new_0 2653
-#define wxAuiNotebook_new_2 2654
-#define wxAuiNotebook_AddPage 2655
-#define wxAuiNotebook_Create 2656
-#define wxAuiNotebook_DeletePage 2657
-#define wxAuiNotebook_GetArtProvider 2658
-#define wxAuiNotebook_GetPage 2659
-#define wxAuiNotebook_GetPageBitmap 2660
-#define wxAuiNotebook_GetPageCount 2661
-#define wxAuiNotebook_GetPageIndex 2662
-#define wxAuiNotebook_GetPageText 2663
-#define wxAuiNotebook_GetSelection 2664
-#define wxAuiNotebook_InsertPage 2665
-#define wxAuiNotebook_RemovePage 2666
-#define wxAuiNotebook_SetArtProvider 2667
-#define wxAuiNotebook_SetFont 2668
-#define wxAuiNotebook_SetPageBitmap 2669
-#define wxAuiNotebook_SetPageText 2670
-#define wxAuiNotebook_SetSelection 2671
-#define wxAuiNotebook_SetTabCtrlHeight 2672
-#define wxAuiNotebook_SetUniformBitmapSize 2673
-#define wxAuiNotebook_destroy 2674
-#define wxMDIParentFrame_new_0 2675
-#define wxMDIParentFrame_new_4 2676
-#define wxMDIParentFrame_destruct 2677
-#define wxMDIParentFrame_ActivateNext 2678
-#define wxMDIParentFrame_ActivatePrevious 2679
-#define wxMDIParentFrame_ArrangeIcons 2680
-#define wxMDIParentFrame_Cascade 2681
-#define wxMDIParentFrame_Create 2682
-#define wxMDIParentFrame_GetActiveChild 2683
-#define wxMDIParentFrame_GetClientWindow 2684
-#define wxMDIParentFrame_Tile 2685
-#define wxMDIChildFrame_new_0 2686
-#define wxMDIChildFrame_new_4 2687
-#define wxMDIChildFrame_destruct 2688
-#define wxMDIChildFrame_Activate 2689
-#define wxMDIChildFrame_Create 2690
-#define wxMDIChildFrame_Maximize 2691
-#define wxMDIChildFrame_Restore 2692
-#define wxMDIClientWindow_new_0 2693
-#define wxMDIClientWindow_new_2 2694
-#define wxMDIClientWindow_destruct 2695
-#define wxMDIClientWindow_CreateClient 2696
-#define wxLayoutAlgorithm_new 2697
-#define wxLayoutAlgorithm_LayoutFrame 2698
-#define wxLayoutAlgorithm_LayoutMDIFrame 2699
-#define wxLayoutAlgorithm_LayoutWindow 2700
-#define wxLayoutAlgorithm_destroy 2701
-#define wxEvent_GetId 2702
-#define wxEvent_GetSkipped 2703
-#define wxEvent_GetTimestamp 2704
-#define wxEvent_IsCommandEvent 2705
-#define wxEvent_ResumePropagation 2706
-#define wxEvent_ShouldPropagate 2707
-#define wxEvent_Skip 2708
-#define wxEvent_StopPropagation 2709
-#define wxCommandEvent_getClientData 2710
-#define wxCommandEvent_GetExtraLong 2711
-#define wxCommandEvent_GetInt 2712
-#define wxCommandEvent_GetSelection 2713
-#define wxCommandEvent_GetString 2714
-#define wxCommandEvent_IsChecked 2715
-#define wxCommandEvent_IsSelection 2716
-#define wxCommandEvent_SetInt 2717
-#define wxCommandEvent_SetString 2718
-#define wxScrollEvent_GetOrientation 2719
-#define wxScrollEvent_GetPosition 2720
-#define wxScrollWinEvent_GetOrientation 2721
-#define wxScrollWinEvent_GetPosition 2722
-#define wxMouseEvent_AltDown 2723
-#define wxMouseEvent_Button 2724
-#define wxMouseEvent_ButtonDClick 2725
-#define wxMouseEvent_ButtonDown 2726
-#define wxMouseEvent_ButtonUp 2727
-#define wxMouseEvent_CmdDown 2728
-#define wxMouseEvent_ControlDown 2729
-#define wxMouseEvent_Dragging 2730
-#define wxMouseEvent_Entering 2731
-#define wxMouseEvent_GetButton 2732
-#define wxMouseEvent_GetPosition 2735
-#define wxMouseEvent_GetLogicalPosition 2736
-#define wxMouseEvent_GetLinesPerAction 2737
-#define wxMouseEvent_GetWheelRotation 2738
-#define wxMouseEvent_GetWheelDelta 2739
-#define wxMouseEvent_GetX 2740
-#define wxMouseEvent_GetY 2741
-#define wxMouseEvent_IsButton 2742
-#define wxMouseEvent_IsPageScroll 2743
-#define wxMouseEvent_Leaving 2744
-#define wxMouseEvent_LeftDClick 2745
-#define wxMouseEvent_LeftDown 2746
-#define wxMouseEvent_LeftIsDown 2747
-#define wxMouseEvent_LeftUp 2748
-#define wxMouseEvent_MetaDown 2749
-#define wxMouseEvent_MiddleDClick 2750
-#define wxMouseEvent_MiddleDown 2751
-#define wxMouseEvent_MiddleIsDown 2752
-#define wxMouseEvent_MiddleUp 2753
-#define wxMouseEvent_Moving 2754
-#define wxMouseEvent_RightDClick 2755
-#define wxMouseEvent_RightDown 2756
-#define wxMouseEvent_RightIsDown 2757
-#define wxMouseEvent_RightUp 2758
-#define wxMouseEvent_ShiftDown 2759
-#define wxSetCursorEvent_GetCursor 2760
-#define wxSetCursorEvent_GetX 2761
-#define wxSetCursorEvent_GetY 2762
-#define wxSetCursorEvent_HasCursor 2763
-#define wxSetCursorEvent_SetCursor 2764
-#define wxKeyEvent_AltDown 2765
-#define wxKeyEvent_CmdDown 2766
-#define wxKeyEvent_ControlDown 2767
-#define wxKeyEvent_GetKeyCode 2768
-#define wxKeyEvent_GetModifiers 2769
-#define wxKeyEvent_GetPosition 2772
-#define wxKeyEvent_GetRawKeyCode 2773
-#define wxKeyEvent_GetRawKeyFlags 2774
-#define wxKeyEvent_GetUnicodeKey 2775
-#define wxKeyEvent_GetX 2776
-#define wxKeyEvent_GetY 2777
-#define wxKeyEvent_HasModifiers 2778
-#define wxKeyEvent_MetaDown 2779
-#define wxKeyEvent_ShiftDown 2780
-#define wxSizeEvent_GetSize 2781
-#define wxMoveEvent_GetPosition 2782
-#define wxEraseEvent_GetDC 2783
-#define wxFocusEvent_GetWindow 2784
-#define wxChildFocusEvent_GetWindow 2785
-#define wxMenuEvent_GetMenu 2786
-#define wxMenuEvent_GetMenuId 2787
-#define wxMenuEvent_IsPopup 2788
-#define wxCloseEvent_CanVeto 2789
-#define wxCloseEvent_GetLoggingOff 2790
-#define wxCloseEvent_SetCanVeto 2791
-#define wxCloseEvent_SetLoggingOff 2792
-#define wxCloseEvent_Veto 2793
-#define wxShowEvent_SetShow 2794
-#define wxShowEvent_GetShow 2795
-#define wxIconizeEvent_Iconized 2796
-#define wxJoystickEvent_ButtonDown 2797
-#define wxJoystickEvent_ButtonIsDown 2798
-#define wxJoystickEvent_ButtonUp 2799
-#define wxJoystickEvent_GetButtonChange 2800
-#define wxJoystickEvent_GetButtonState 2801
-#define wxJoystickEvent_GetJoystick 2802
-#define wxJoystickEvent_GetPosition 2803
-#define wxJoystickEvent_GetZPosition 2804
-#define wxJoystickEvent_IsButton 2805
-#define wxJoystickEvent_IsMove 2806
-#define wxJoystickEvent_IsZMove 2807
-#define wxUpdateUIEvent_CanUpdate 2808
-#define wxUpdateUIEvent_Check 2809
-#define wxUpdateUIEvent_Enable 2810
-#define wxUpdateUIEvent_Show 2811
-#define wxUpdateUIEvent_GetChecked 2812
-#define wxUpdateUIEvent_GetEnabled 2813
-#define wxUpdateUIEvent_GetShown 2814
-#define wxUpdateUIEvent_GetSetChecked 2815
-#define wxUpdateUIEvent_GetSetEnabled 2816
-#define wxUpdateUIEvent_GetSetShown 2817
-#define wxUpdateUIEvent_GetSetText 2818
-#define wxUpdateUIEvent_GetText 2819
-#define wxUpdateUIEvent_GetMode 2820
-#define wxUpdateUIEvent_GetUpdateInterval 2821
-#define wxUpdateUIEvent_ResetUpdateTime 2822
-#define wxUpdateUIEvent_SetMode 2823
-#define wxUpdateUIEvent_SetText 2824
-#define wxUpdateUIEvent_SetUpdateInterval 2825
-#define wxMouseCaptureChangedEvent_GetCapturedWindow 2826
-#define wxPaletteChangedEvent_SetChangedWindow 2827
-#define wxPaletteChangedEvent_GetChangedWindow 2828
-#define wxQueryNewPaletteEvent_SetPaletteRealized 2829
-#define wxQueryNewPaletteEvent_GetPaletteRealized 2830
-#define wxNavigationKeyEvent_GetDirection 2831
-#define wxNavigationKeyEvent_SetDirection 2832
-#define wxNavigationKeyEvent_IsWindowChange 2833
-#define wxNavigationKeyEvent_SetWindowChange 2834
-#define wxNavigationKeyEvent_IsFromTab 2835
-#define wxNavigationKeyEvent_SetFromTab 2836
-#define wxNavigationKeyEvent_GetCurrentFocus 2837
-#define wxNavigationKeyEvent_SetCurrentFocus 2838
-#define wxHelpEvent_GetOrigin 2839
-#define wxHelpEvent_GetPosition 2840
-#define wxHelpEvent_SetOrigin 2841
-#define wxHelpEvent_SetPosition 2842
-#define wxContextMenuEvent_GetPosition 2843
-#define wxContextMenuEvent_SetPosition 2844
-#define wxIdleEvent_CanSend 2845
-#define wxIdleEvent_GetMode 2846
-#define wxIdleEvent_RequestMore 2847
-#define wxIdleEvent_MoreRequested 2848
-#define wxIdleEvent_SetMode 2849
-#define wxGridEvent_AltDown 2850
-#define wxGridEvent_ControlDown 2851
-#define wxGridEvent_GetCol 2852
-#define wxGridEvent_GetPosition 2853
-#define wxGridEvent_GetRow 2854
-#define wxGridEvent_MetaDown 2855
-#define wxGridEvent_Selecting 2856
-#define wxGridEvent_ShiftDown 2857
-#define wxNotifyEvent_Allow 2858
-#define wxNotifyEvent_IsAllowed 2859
-#define wxNotifyEvent_Veto 2860
-#define wxSashEvent_GetEdge 2861
-#define wxSashEvent_GetDragRect 2862
-#define wxSashEvent_GetDragStatus 2863
-#define wxListEvent_GetCacheFrom 2864
-#define wxListEvent_GetCacheTo 2865
-#define wxListEvent_GetKeyCode 2866
-#define wxListEvent_GetIndex 2867
-#define wxListEvent_GetColumn 2868
-#define wxListEvent_GetPoint 2869
-#define wxListEvent_GetLabel 2870
-#define wxListEvent_GetText 2871
-#define wxListEvent_GetImage 2872
-#define wxListEvent_GetData 2873
-#define wxListEvent_GetMask 2874
-#define wxListEvent_GetItem 2875
-#define wxListEvent_IsEditCancelled 2876
-#define wxDateEvent_GetDate 2877
-#define wxCalendarEvent_GetWeekDay 2878
-#define wxFileDirPickerEvent_GetPath 2879
-#define wxColourPickerEvent_GetColour 2880
-#define wxFontPickerEvent_GetFont 2881
-#define wxStyledTextEvent_GetPosition 2882
-#define wxStyledTextEvent_GetKey 2883
-#define wxStyledTextEvent_GetModifiers 2884
-#define wxStyledTextEvent_GetModificationType 2885
-#define wxStyledTextEvent_GetText 2886
-#define wxStyledTextEvent_GetLength 2887
-#define wxStyledTextEvent_GetLinesAdded 2888
-#define wxStyledTextEvent_GetLine 2889
-#define wxStyledTextEvent_GetFoldLevelNow 2890
-#define wxStyledTextEvent_GetFoldLevelPrev 2891
-#define wxStyledTextEvent_GetMargin 2892
-#define wxStyledTextEvent_GetMessage 2893
-#define wxStyledTextEvent_GetWParam 2894
-#define wxStyledTextEvent_GetLParam 2895
-#define wxStyledTextEvent_GetListType 2896
-#define wxStyledTextEvent_GetX 2897
-#define wxStyledTextEvent_GetY 2898
-#define wxStyledTextEvent_GetDragText 2899
-#define wxStyledTextEvent_GetDragAllowMove 2900
-#define wxStyledTextEvent_GetDragResult 2901
-#define wxStyledTextEvent_GetShift 2902
-#define wxStyledTextEvent_GetControl 2903
-#define wxStyledTextEvent_GetAlt 2904
-#define utils_wxGetKeyState 2905
-#define utils_wxGetMousePosition 2906
-#define utils_wxGetMouseState 2907
-#define utils_wxSetDetectableAutoRepeat 2908
-#define utils_wxBell 2909
-#define utils_wxFindMenuItemId 2910
-#define utils_wxGenericFindWindowAtPoint 2911
-#define utils_wxFindWindowAtPoint 2912
-#define utils_wxBeginBusyCursor 2913
-#define utils_wxEndBusyCursor 2914
-#define utils_wxIsBusy 2915
-#define utils_wxShutdown 2916
-#define utils_wxShell 2917
-#define utils_wxLaunchDefaultBrowser 2918
-#define utils_wxGetEmailAddress 2919
-#define utils_wxGetUserId 2920
-#define utils_wxGetHomeDir 2921
-#define utils_wxNewId 2922
-#define utils_wxRegisterId 2923
-#define utils_wxGetCurrentId 2924
-#define utils_wxGetOsDescription 2925
-#define utils_wxIsPlatformLittleEndian 2926
-#define utils_wxIsPlatform64Bit 2927
-#define gdicmn_wxDisplaySize 2928
-#define gdicmn_wxSetCursor 2929
-#define wxPrintout_new 2930
-#define wxPrintout_destruct 2931
-#define wxPrintout_GetDC 2932
-#define wxPrintout_GetPageSizeMM 2933
-#define wxPrintout_GetPageSizePixels 2934
-#define wxPrintout_GetPaperRectPixels 2935
-#define wxPrintout_GetPPIPrinter 2936
-#define wxPrintout_GetPPIScreen 2937
-#define wxPrintout_GetTitle 2938
-#define wxPrintout_IsPreview 2939
-#define wxPrintout_FitThisSizeToPaper 2940
-#define wxPrintout_FitThisSizeToPage 2941
-#define wxPrintout_FitThisSizeToPageMargins 2942
-#define wxPrintout_MapScreenSizeToPaper 2943
-#define wxPrintout_MapScreenSizeToPage 2944
-#define wxPrintout_MapScreenSizeToPageMargins 2945
-#define wxPrintout_MapScreenSizeToDevice 2946
-#define wxPrintout_GetLogicalPaperRect 2947
-#define wxPrintout_GetLogicalPageRect 2948
-#define wxPrintout_GetLogicalPageMarginsRect 2949
-#define wxPrintout_SetLogicalOrigin 2950
-#define wxPrintout_OffsetLogicalOrigin 2951
-#define wxStyledTextCtrl_new_2 2952
-#define wxStyledTextCtrl_new_0 2953
-#define wxStyledTextCtrl_destruct 2954
-#define wxStyledTextCtrl_Create 2955
-#define wxStyledTextCtrl_AddText 2956
-#define wxStyledTextCtrl_AddStyledText 2957
-#define wxStyledTextCtrl_InsertText 2958
-#define wxStyledTextCtrl_ClearAll 2959
-#define wxStyledTextCtrl_ClearDocumentStyle 2960
-#define wxStyledTextCtrl_GetLength 2961
-#define wxStyledTextCtrl_GetCharAt 2962
-#define wxStyledTextCtrl_GetCurrentPos 2963
-#define wxStyledTextCtrl_GetAnchor 2964
-#define wxStyledTextCtrl_GetStyleAt 2965
-#define wxStyledTextCtrl_Redo 2966
-#define wxStyledTextCtrl_SetUndoCollection 2967
-#define wxStyledTextCtrl_SelectAll 2968
-#define wxStyledTextCtrl_SetSavePoint 2969
-#define wxStyledTextCtrl_GetStyledText 2970
-#define wxStyledTextCtrl_CanRedo 2971
-#define wxStyledTextCtrl_MarkerLineFromHandle 2972
-#define wxStyledTextCtrl_MarkerDeleteHandle 2973
-#define wxStyledTextCtrl_GetUndoCollection 2974
-#define wxStyledTextCtrl_GetViewWhiteSpace 2975
-#define wxStyledTextCtrl_SetViewWhiteSpace 2976
-#define wxStyledTextCtrl_PositionFromPoint 2977
-#define wxStyledTextCtrl_PositionFromPointClose 2978
-#define wxStyledTextCtrl_GotoLine 2979
-#define wxStyledTextCtrl_GotoPos 2980
-#define wxStyledTextCtrl_SetAnchor 2981
-#define wxStyledTextCtrl_GetCurLine 2982
-#define wxStyledTextCtrl_GetEndStyled 2983
-#define wxStyledTextCtrl_ConvertEOLs 2984
-#define wxStyledTextCtrl_GetEOLMode 2985
-#define wxStyledTextCtrl_SetEOLMode 2986
-#define wxStyledTextCtrl_StartStyling 2987
-#define wxStyledTextCtrl_SetStyling 2988
-#define wxStyledTextCtrl_GetBufferedDraw 2989
-#define wxStyledTextCtrl_SetBufferedDraw 2990
-#define wxStyledTextCtrl_SetTabWidth 2991
-#define wxStyledTextCtrl_GetTabWidth 2992
-#define wxStyledTextCtrl_SetCodePage 2993
-#define wxStyledTextCtrl_MarkerDefine 2994
-#define wxStyledTextCtrl_MarkerSetForeground 2995
-#define wxStyledTextCtrl_MarkerSetBackground 2996
-#define wxStyledTextCtrl_MarkerAdd 2997
-#define wxStyledTextCtrl_MarkerDelete 2998
-#define wxStyledTextCtrl_MarkerDeleteAll 2999
-#define wxStyledTextCtrl_MarkerGet 3000
-#define wxStyledTextCtrl_MarkerNext 3001
-#define wxStyledTextCtrl_MarkerPrevious 3002
-#define wxStyledTextCtrl_MarkerDefineBitmap 3003
-#define wxStyledTextCtrl_MarkerAddSet 3004
-#define wxStyledTextCtrl_MarkerSetAlpha 3005
-#define wxStyledTextCtrl_SetMarginType 3006
-#define wxStyledTextCtrl_GetMarginType 3007
-#define wxStyledTextCtrl_SetMarginWidth 3008
-#define wxStyledTextCtrl_GetMarginWidth 3009
-#define wxStyledTextCtrl_SetMarginMask 3010
-#define wxStyledTextCtrl_GetMarginMask 3011
-#define wxStyledTextCtrl_SetMarginSensitive 3012
-#define wxStyledTextCtrl_GetMarginSensitive 3013
-#define wxStyledTextCtrl_StyleClearAll 3014
-#define wxStyledTextCtrl_StyleSetForeground 3015
-#define wxStyledTextCtrl_StyleSetBackground 3016
-#define wxStyledTextCtrl_StyleSetBold 3017
-#define wxStyledTextCtrl_StyleSetItalic 3018
-#define wxStyledTextCtrl_StyleSetSize 3019
-#define wxStyledTextCtrl_StyleSetFaceName 3020
-#define wxStyledTextCtrl_StyleSetEOLFilled 3021
-#define wxStyledTextCtrl_StyleResetDefault 3022
-#define wxStyledTextCtrl_StyleSetUnderline 3023
-#define wxStyledTextCtrl_StyleSetCase 3024
-#define wxStyledTextCtrl_StyleSetHotSpot 3025
-#define wxStyledTextCtrl_SetSelForeground 3026
-#define wxStyledTextCtrl_SetSelBackground 3027
-#define wxStyledTextCtrl_GetSelAlpha 3028
-#define wxStyledTextCtrl_SetSelAlpha 3029
-#define wxStyledTextCtrl_SetCaretForeground 3030
-#define wxStyledTextCtrl_CmdKeyAssign 3031
-#define wxStyledTextCtrl_CmdKeyClear 3032
-#define wxStyledTextCtrl_CmdKeyClearAll 3033
-#define wxStyledTextCtrl_SetStyleBytes 3034
-#define wxStyledTextCtrl_StyleSetVisible 3035
-#define wxStyledTextCtrl_GetCaretPeriod 3036
-#define wxStyledTextCtrl_SetCaretPeriod 3037
-#define wxStyledTextCtrl_SetWordChars 3038
-#define wxStyledTextCtrl_BeginUndoAction 3039
-#define wxStyledTextCtrl_EndUndoAction 3040
-#define wxStyledTextCtrl_IndicatorSetStyle 3041
-#define wxStyledTextCtrl_IndicatorGetStyle 3042
-#define wxStyledTextCtrl_IndicatorSetForeground 3043
-#define wxStyledTextCtrl_IndicatorGetForeground 3044
-#define wxStyledTextCtrl_SetWhitespaceForeground 3045
-#define wxStyledTextCtrl_SetWhitespaceBackground 3046
-#define wxStyledTextCtrl_GetStyleBits 3047
-#define wxStyledTextCtrl_SetLineState 3048
-#define wxStyledTextCtrl_GetLineState 3049
-#define wxStyledTextCtrl_GetMaxLineState 3050
-#define wxStyledTextCtrl_GetCaretLineVisible 3051
-#define wxStyledTextCtrl_SetCaretLineVisible 3052
-#define wxStyledTextCtrl_GetCaretLineBackground 3053
-#define wxStyledTextCtrl_SetCaretLineBackground 3054
-#define wxStyledTextCtrl_AutoCompShow 3055
-#define wxStyledTextCtrl_AutoCompCancel 3056
-#define wxStyledTextCtrl_AutoCompActive 3057
-#define wxStyledTextCtrl_AutoCompPosStart 3058
-#define wxStyledTextCtrl_AutoCompComplete 3059
-#define wxStyledTextCtrl_AutoCompStops 3060
-#define wxStyledTextCtrl_AutoCompSetSeparator 3061
-#define wxStyledTextCtrl_AutoCompGetSeparator 3062
-#define wxStyledTextCtrl_AutoCompSelect 3063
-#define wxStyledTextCtrl_AutoCompSetCancelAtStart 3064
-#define wxStyledTextCtrl_AutoCompGetCancelAtStart 3065
-#define wxStyledTextCtrl_AutoCompSetFillUps 3066
-#define wxStyledTextCtrl_AutoCompSetChooseSingle 3067
-#define wxStyledTextCtrl_AutoCompGetChooseSingle 3068
-#define wxStyledTextCtrl_AutoCompSetIgnoreCase 3069
-#define wxStyledTextCtrl_AutoCompGetIgnoreCase 3070
-#define wxStyledTextCtrl_UserListShow 3071
-#define wxStyledTextCtrl_AutoCompSetAutoHide 3072
-#define wxStyledTextCtrl_AutoCompGetAutoHide 3073
-#define wxStyledTextCtrl_AutoCompSetDropRestOfWord 3074
-#define wxStyledTextCtrl_AutoCompGetDropRestOfWord 3075
-#define wxStyledTextCtrl_RegisterImage 3076
-#define wxStyledTextCtrl_ClearRegisteredImages 3077
-#define wxStyledTextCtrl_AutoCompGetTypeSeparator 3078
-#define wxStyledTextCtrl_AutoCompSetTypeSeparator 3079
-#define wxStyledTextCtrl_AutoCompSetMaxWidth 3080
-#define wxStyledTextCtrl_AutoCompGetMaxWidth 3081
-#define wxStyledTextCtrl_AutoCompSetMaxHeight 3082
-#define wxStyledTextCtrl_AutoCompGetMaxHeight 3083
-#define wxStyledTextCtrl_SetIndent 3084
-#define wxStyledTextCtrl_GetIndent 3085
-#define wxStyledTextCtrl_SetUseTabs 3086
-#define wxStyledTextCtrl_GetUseTabs 3087
-#define wxStyledTextCtrl_SetLineIndentation 3088
-#define wxStyledTextCtrl_GetLineIndentation 3089
-#define wxStyledTextCtrl_GetLineIndentPosition 3090
-#define wxStyledTextCtrl_GetColumn 3091
-#define wxStyledTextCtrl_SetUseHorizontalScrollBar 3092
-#define wxStyledTextCtrl_GetUseHorizontalScrollBar 3093
-#define wxStyledTextCtrl_SetIndentationGuides 3094
-#define wxStyledTextCtrl_GetIndentationGuides 3095
-#define wxStyledTextCtrl_SetHighlightGuide 3096
-#define wxStyledTextCtrl_GetHighlightGuide 3097
-#define wxStyledTextCtrl_GetLineEndPosition 3098
-#define wxStyledTextCtrl_GetCodePage 3099
-#define wxStyledTextCtrl_GetCaretForeground 3100
-#define wxStyledTextCtrl_GetReadOnly 3101
-#define wxStyledTextCtrl_SetCurrentPos 3102
-#define wxStyledTextCtrl_SetSelectionStart 3103
-#define wxStyledTextCtrl_GetSelectionStart 3104
-#define wxStyledTextCtrl_SetSelectionEnd 3105
-#define wxStyledTextCtrl_GetSelectionEnd 3106
-#define wxStyledTextCtrl_SetPrintMagnification 3107
-#define wxStyledTextCtrl_GetPrintMagnification 3108
-#define wxStyledTextCtrl_SetPrintColourMode 3109
-#define wxStyledTextCtrl_GetPrintColourMode 3110
-#define wxStyledTextCtrl_FindText 3111
-#define wxStyledTextCtrl_FormatRange 3112
-#define wxStyledTextCtrl_GetFirstVisibleLine 3113
-#define wxStyledTextCtrl_GetLine 3114
-#define wxStyledTextCtrl_GetLineCount 3115
-#define wxStyledTextCtrl_SetMarginLeft 3116
-#define wxStyledTextCtrl_GetMarginLeft 3117
-#define wxStyledTextCtrl_SetMarginRight 3118
-#define wxStyledTextCtrl_GetMarginRight 3119
-#define wxStyledTextCtrl_GetModify 3120
-#define wxStyledTextCtrl_SetSelection 3121
-#define wxStyledTextCtrl_GetSelectedText 3122
-#define wxStyledTextCtrl_GetTextRange 3123
-#define wxStyledTextCtrl_HideSelection 3124
-#define wxStyledTextCtrl_LineFromPosition 3125
-#define wxStyledTextCtrl_PositionFromLine 3126
-#define wxStyledTextCtrl_LineScroll 3127
-#define wxStyledTextCtrl_EnsureCaretVisible 3128
-#define wxStyledTextCtrl_ReplaceSelection 3129
-#define wxStyledTextCtrl_SetReadOnly 3130
-#define wxStyledTextCtrl_CanPaste 3131
-#define wxStyledTextCtrl_CanUndo 3132
-#define wxStyledTextCtrl_EmptyUndoBuffer 3133
-#define wxStyledTextCtrl_Undo 3134
-#define wxStyledTextCtrl_Cut 3135
-#define wxStyledTextCtrl_Copy 3136
-#define wxStyledTextCtrl_Paste 3137
-#define wxStyledTextCtrl_Clear 3138
-#define wxStyledTextCtrl_SetText 3139
-#define wxStyledTextCtrl_GetText 3140
-#define wxStyledTextCtrl_GetTextLength 3141
-#define wxStyledTextCtrl_GetOvertype 3142
-#define wxStyledTextCtrl_SetCaretWidth 3143
-#define wxStyledTextCtrl_GetCaretWidth 3144
-#define wxStyledTextCtrl_SetTargetStart 3145
-#define wxStyledTextCtrl_GetTargetStart 3146
-#define wxStyledTextCtrl_SetTargetEnd 3147
-#define wxStyledTextCtrl_GetTargetEnd 3148
-#define wxStyledTextCtrl_ReplaceTarget 3149
-#define wxStyledTextCtrl_SearchInTarget 3150
-#define wxStyledTextCtrl_SetSearchFlags 3151
-#define wxStyledTextCtrl_GetSearchFlags 3152
-#define wxStyledTextCtrl_CallTipShow 3153
-#define wxStyledTextCtrl_CallTipCancel 3154
-#define wxStyledTextCtrl_CallTipActive 3155
-#define wxStyledTextCtrl_CallTipPosAtStart 3156
-#define wxStyledTextCtrl_CallTipSetHighlight 3157
-#define wxStyledTextCtrl_CallTipSetBackground 3158
-#define wxStyledTextCtrl_CallTipSetForeground 3159
-#define wxStyledTextCtrl_CallTipSetForegroundHighlight 3160
-#define wxStyledTextCtrl_CallTipUseStyle 3161
-#define wxStyledTextCtrl_VisibleFromDocLine 3162
-#define wxStyledTextCtrl_DocLineFromVisible 3163
-#define wxStyledTextCtrl_WrapCount 3164
-#define wxStyledTextCtrl_SetFoldLevel 3165
-#define wxStyledTextCtrl_GetFoldLevel 3166
-#define wxStyledTextCtrl_GetLastChild 3167
-#define wxStyledTextCtrl_GetFoldParent 3168
-#define wxStyledTextCtrl_ShowLines 3169
-#define wxStyledTextCtrl_HideLines 3170
-#define wxStyledTextCtrl_GetLineVisible 3171
-#define wxStyledTextCtrl_SetFoldExpanded 3172
-#define wxStyledTextCtrl_GetFoldExpanded 3173
-#define wxStyledTextCtrl_ToggleFold 3174
-#define wxStyledTextCtrl_EnsureVisible 3175
-#define wxStyledTextCtrl_SetFoldFlags 3176
-#define wxStyledTextCtrl_EnsureVisibleEnforcePolicy 3177
-#define wxStyledTextCtrl_SetTabIndents 3178
-#define wxStyledTextCtrl_GetTabIndents 3179
-#define wxStyledTextCtrl_SetBackSpaceUnIndents 3180
-#define wxStyledTextCtrl_GetBackSpaceUnIndents 3181
-#define wxStyledTextCtrl_SetMouseDwellTime 3182
-#define wxStyledTextCtrl_GetMouseDwellTime 3183
-#define wxStyledTextCtrl_WordStartPosition 3184
-#define wxStyledTextCtrl_WordEndPosition 3185
-#define wxStyledTextCtrl_SetWrapMode 3186
-#define wxStyledTextCtrl_GetWrapMode 3187
-#define wxStyledTextCtrl_SetWrapVisualFlags 3188
-#define wxStyledTextCtrl_GetWrapVisualFlags 3189
-#define wxStyledTextCtrl_SetWrapVisualFlagsLocation 3190
-#define wxStyledTextCtrl_GetWrapVisualFlagsLocation 3191
-#define wxStyledTextCtrl_SetWrapStartIndent 3192
-#define wxStyledTextCtrl_GetWrapStartIndent 3193
-#define wxStyledTextCtrl_SetLayoutCache 3194
-#define wxStyledTextCtrl_GetLayoutCache 3195
-#define wxStyledTextCtrl_SetScrollWidth 3196
-#define wxStyledTextCtrl_GetScrollWidth 3197
-#define wxStyledTextCtrl_TextWidth 3198
-#define wxStyledTextCtrl_GetEndAtLastLine 3199
-#define wxStyledTextCtrl_TextHeight 3200
-#define wxStyledTextCtrl_SetUseVerticalScrollBar 3201
-#define wxStyledTextCtrl_GetUseVerticalScrollBar 3202
-#define wxStyledTextCtrl_AppendText 3203
-#define wxStyledTextCtrl_GetTwoPhaseDraw 3204
-#define wxStyledTextCtrl_SetTwoPhaseDraw 3205
-#define wxStyledTextCtrl_TargetFromSelection 3206
-#define wxStyledTextCtrl_LinesJoin 3207
-#define wxStyledTextCtrl_LinesSplit 3208
-#define wxStyledTextCtrl_SetFoldMarginColour 3209
-#define wxStyledTextCtrl_SetFoldMarginHiColour 3210
-#define wxStyledTextCtrl_LineDown 3211
-#define wxStyledTextCtrl_LineDownExtend 3212
-#define wxStyledTextCtrl_LineUp 3213
-#define wxStyledTextCtrl_LineUpExtend 3214
-#define wxStyledTextCtrl_CharLeft 3215
-#define wxStyledTextCtrl_CharLeftExtend 3216
-#define wxStyledTextCtrl_CharRight 3217
-#define wxStyledTextCtrl_CharRightExtend 3218
-#define wxStyledTextCtrl_WordLeft 3219
-#define wxStyledTextCtrl_WordLeftExtend 3220
-#define wxStyledTextCtrl_WordRight 3221
-#define wxStyledTextCtrl_WordRightExtend 3222
-#define wxStyledTextCtrl_Home 3223
-#define wxStyledTextCtrl_HomeExtend 3224
-#define wxStyledTextCtrl_LineEnd 3225
-#define wxStyledTextCtrl_LineEndExtend 3226
-#define wxStyledTextCtrl_DocumentStart 3227
-#define wxStyledTextCtrl_DocumentStartExtend 3228
-#define wxStyledTextCtrl_DocumentEnd 3229
-#define wxStyledTextCtrl_DocumentEndExtend 3230
-#define wxStyledTextCtrl_PageUp 3231
-#define wxStyledTextCtrl_PageUpExtend 3232
-#define wxStyledTextCtrl_PageDown 3233
-#define wxStyledTextCtrl_PageDownExtend 3234
-#define wxStyledTextCtrl_EditToggleOvertype 3235
-#define wxStyledTextCtrl_Cancel 3236
-#define wxStyledTextCtrl_DeleteBack 3237
-#define wxStyledTextCtrl_Tab 3238
-#define wxStyledTextCtrl_BackTab 3239
-#define wxStyledTextCtrl_NewLine 3240
-#define wxStyledTextCtrl_FormFeed 3241
-#define wxStyledTextCtrl_VCHome 3242
-#define wxStyledTextCtrl_VCHomeExtend 3243
-#define wxStyledTextCtrl_ZoomIn 3244
-#define wxStyledTextCtrl_ZoomOut 3245
-#define wxStyledTextCtrl_DelWordLeft 3246
-#define wxStyledTextCtrl_DelWordRight 3247
-#define wxStyledTextCtrl_LineCut 3248
-#define wxStyledTextCtrl_LineDelete 3249
-#define wxStyledTextCtrl_LineTranspose 3250
-#define wxStyledTextCtrl_LineDuplicate 3251
-#define wxStyledTextCtrl_LowerCase 3252
-#define wxStyledTextCtrl_UpperCase 3253
-#define wxStyledTextCtrl_LineScrollDown 3254
-#define wxStyledTextCtrl_LineScrollUp 3255
-#define wxStyledTextCtrl_DeleteBackNotLine 3256
-#define wxStyledTextCtrl_HomeDisplay 3257
-#define wxStyledTextCtrl_HomeDisplayExtend 3258
-#define wxStyledTextCtrl_LineEndDisplay 3259
-#define wxStyledTextCtrl_LineEndDisplayExtend 3260
-#define wxStyledTextCtrl_HomeWrapExtend 3261
-#define wxStyledTextCtrl_LineEndWrap 3262
-#define wxStyledTextCtrl_LineEndWrapExtend 3263
-#define wxStyledTextCtrl_VCHomeWrap 3264
-#define wxStyledTextCtrl_VCHomeWrapExtend 3265
-#define wxStyledTextCtrl_LineCopy 3266
-#define wxStyledTextCtrl_MoveCaretInsideView 3267
-#define wxStyledTextCtrl_LineLength 3268
-#define wxStyledTextCtrl_BraceHighlight 3269
-#define wxStyledTextCtrl_BraceBadLight 3270
-#define wxStyledTextCtrl_BraceMatch 3271
-#define wxStyledTextCtrl_GetViewEOL 3272
-#define wxStyledTextCtrl_SetViewEOL 3273
-#define wxStyledTextCtrl_SetModEventMask 3274
-#define wxStyledTextCtrl_GetEdgeColumn 3275
-#define wxStyledTextCtrl_SetEdgeColumn 3276
-#define wxStyledTextCtrl_SetEdgeMode 3277
-#define wxStyledTextCtrl_GetEdgeMode 3278
-#define wxStyledTextCtrl_GetEdgeColour 3279
-#define wxStyledTextCtrl_SetEdgeColour 3280
-#define wxStyledTextCtrl_SearchAnchor 3281
-#define wxStyledTextCtrl_SearchNext 3282
-#define wxStyledTextCtrl_SearchPrev 3283
-#define wxStyledTextCtrl_LinesOnScreen 3284
-#define wxStyledTextCtrl_UsePopUp 3285
-#define wxStyledTextCtrl_SelectionIsRectangle 3286
-#define wxStyledTextCtrl_SetZoom 3287
-#define wxStyledTextCtrl_GetZoom 3288
-#define wxStyledTextCtrl_GetModEventMask 3289
-#define wxStyledTextCtrl_SetSTCFocus 3290
-#define wxStyledTextCtrl_GetSTCFocus 3291
-#define wxStyledTextCtrl_SetStatus 3292
-#define wxStyledTextCtrl_GetStatus 3293
-#define wxStyledTextCtrl_SetMouseDownCaptures 3294
-#define wxStyledTextCtrl_GetMouseDownCaptures 3295
-#define wxStyledTextCtrl_SetSTCCursor 3296
-#define wxStyledTextCtrl_GetSTCCursor 3297
-#define wxStyledTextCtrl_SetControlCharSymbol 3298
-#define wxStyledTextCtrl_GetControlCharSymbol 3299
-#define wxStyledTextCtrl_WordPartLeft 3300
-#define wxStyledTextCtrl_WordPartLeftExtend 3301
-#define wxStyledTextCtrl_WordPartRight 3302
-#define wxStyledTextCtrl_WordPartRightExtend 3303
-#define wxStyledTextCtrl_SetVisiblePolicy 3304
-#define wxStyledTextCtrl_DelLineLeft 3305
-#define wxStyledTextCtrl_DelLineRight 3306
-#define wxStyledTextCtrl_GetXOffset 3307
-#define wxStyledTextCtrl_ChooseCaretX 3308
-#define wxStyledTextCtrl_SetXCaretPolicy 3309
-#define wxStyledTextCtrl_SetYCaretPolicy 3310
-#define wxStyledTextCtrl_GetPrintWrapMode 3311
-#define wxStyledTextCtrl_SetHotspotActiveForeground 3312
-#define wxStyledTextCtrl_SetHotspotActiveBackground 3313
-#define wxStyledTextCtrl_SetHotspotActiveUnderline 3314
-#define wxStyledTextCtrl_SetHotspotSingleLine 3315
-#define wxStyledTextCtrl_ParaDownExtend 3316
-#define wxStyledTextCtrl_ParaUp 3317
-#define wxStyledTextCtrl_ParaUpExtend 3318
-#define wxStyledTextCtrl_PositionBefore 3319
-#define wxStyledTextCtrl_PositionAfter 3320
-#define wxStyledTextCtrl_CopyRange 3321
-#define wxStyledTextCtrl_CopyText 3322
-#define wxStyledTextCtrl_SetSelectionMode 3323
-#define wxStyledTextCtrl_GetSelectionMode 3324
-#define wxStyledTextCtrl_LineDownRectExtend 3325
-#define wxStyledTextCtrl_LineUpRectExtend 3326
-#define wxStyledTextCtrl_CharLeftRectExtend 3327
-#define wxStyledTextCtrl_CharRightRectExtend 3328
-#define wxStyledTextCtrl_HomeRectExtend 3329
-#define wxStyledTextCtrl_VCHomeRectExtend 3330
-#define wxStyledTextCtrl_LineEndRectExtend 3331
-#define wxStyledTextCtrl_PageUpRectExtend 3332
-#define wxStyledTextCtrl_PageDownRectExtend 3333
-#define wxStyledTextCtrl_StutteredPageUp 3334
-#define wxStyledTextCtrl_StutteredPageUpExtend 3335
-#define wxStyledTextCtrl_StutteredPageDown 3336
-#define wxStyledTextCtrl_StutteredPageDownExtend 3337
-#define wxStyledTextCtrl_WordLeftEnd 3338
-#define wxStyledTextCtrl_WordLeftEndExtend 3339
-#define wxStyledTextCtrl_WordRightEnd 3340
-#define wxStyledTextCtrl_WordRightEndExtend 3341
-#define wxStyledTextCtrl_SetWhitespaceChars 3342
-#define wxStyledTextCtrl_SetCharsDefault 3343
-#define wxStyledTextCtrl_AutoCompGetCurrent 3344
-#define wxStyledTextCtrl_Allocate 3345
-#define wxStyledTextCtrl_FindColumn 3346
-#define wxStyledTextCtrl_GetCaretSticky 3347
-#define wxStyledTextCtrl_SetCaretSticky 3348
-#define wxStyledTextCtrl_ToggleCaretSticky 3349
-#define wxStyledTextCtrl_SetPasteConvertEndings 3350
-#define wxStyledTextCtrl_GetPasteConvertEndings 3351
-#define wxStyledTextCtrl_SelectionDuplicate 3352
-#define wxStyledTextCtrl_SetCaretLineBackAlpha 3353
-#define wxStyledTextCtrl_GetCaretLineBackAlpha 3354
-#define wxStyledTextCtrl_StartRecord 3355
-#define wxStyledTextCtrl_StopRecord 3356
-#define wxStyledTextCtrl_SetLexer 3357
-#define wxStyledTextCtrl_GetLexer 3358
-#define wxStyledTextCtrl_Colourise 3359
-#define wxStyledTextCtrl_SetProperty 3360
-#define wxStyledTextCtrl_SetKeyWords 3361
-#define wxStyledTextCtrl_SetLexerLanguage 3362
-#define wxStyledTextCtrl_GetProperty 3363
-#define wxStyledTextCtrl_GetStyleBitsNeeded 3364
-#define wxStyledTextCtrl_GetCurrentLine 3365
-#define wxStyledTextCtrl_StyleSetSpec 3366
-#define wxStyledTextCtrl_StyleSetFont 3367
-#define wxStyledTextCtrl_StyleSetFontAttr 3368
-#define wxStyledTextCtrl_StyleSetCharacterSet 3369
-#define wxStyledTextCtrl_StyleSetFontEncoding 3370
-#define wxStyledTextCtrl_CmdKeyExecute 3371
-#define wxStyledTextCtrl_SetMargins 3372
-#define wxStyledTextCtrl_GetSelection 3373
-#define wxStyledTextCtrl_PointFromPosition 3374
-#define wxStyledTextCtrl_ScrollToLine 3375
-#define wxStyledTextCtrl_ScrollToColumn 3376
-#define wxStyledTextCtrl_SetVScrollBar 3377
-#define wxStyledTextCtrl_SetHScrollBar 3378
-#define wxStyledTextCtrl_GetLastKeydownProcessed 3379
-#define wxStyledTextCtrl_SetLastKeydownProcessed 3380
-#define wxStyledTextCtrl_SaveFile 3381
-#define wxStyledTextCtrl_LoadFile 3382
-#define wxStyledTextCtrl_DoDragOver 3383
-#define wxStyledTextCtrl_DoDropText 3384
-#define wxStyledTextCtrl_GetUseAntiAliasing 3385
-#define wxStyledTextCtrl_AddTextRaw 3386
-#define wxStyledTextCtrl_InsertTextRaw 3387
-#define wxStyledTextCtrl_GetCurLineRaw 3388
-#define wxStyledTextCtrl_GetLineRaw 3389
-#define wxStyledTextCtrl_GetSelectedTextRaw 3390
-#define wxStyledTextCtrl_GetTextRangeRaw 3391
-#define wxStyledTextCtrl_SetTextRaw 3392
-#define wxStyledTextCtrl_GetTextRaw 3393
-#define wxStyledTextCtrl_AppendTextRaw 3394
-#define wxArtProvider_GetBitmap 3395
-#define wxArtProvider_GetIcon 3396
-#define wxTreeEvent_GetKeyCode 3397
-#define wxTreeEvent_GetItem 3398
-#define wxTreeEvent_GetKeyEvent 3399
-#define wxTreeEvent_GetLabel 3400
-#define wxTreeEvent_GetOldItem 3401
-#define wxTreeEvent_GetPoint 3402
-#define wxTreeEvent_IsEditCancelled 3403
-#define wxTreeEvent_SetToolTip 3404
-#define wxNotebookEvent_GetOldSelection 3405
-#define wxNotebookEvent_GetSelection 3406
-#define wxNotebookEvent_SetOldSelection 3407
-#define wxNotebookEvent_SetSelection 3408
-#define wxFileDataObject_new 3409
-#define wxFileDataObject_AddFile 3410
-#define wxFileDataObject_GetFilenames 3411
-#define wxFileDataObject_destroy 3412
-#define wxTextDataObject_new 3413
-#define wxTextDataObject_GetTextLength 3414
-#define wxTextDataObject_GetText 3415
-#define wxTextDataObject_SetText 3416
-#define wxTextDataObject_destroy 3417
-#define wxBitmapDataObject_new_1_1 3418
-#define wxBitmapDataObject_new_1_0 3419
-#define wxBitmapDataObject_GetBitmap 3420
-#define wxBitmapDataObject_SetBitmap 3421
-#define wxBitmapDataObject_destroy 3422
-#define wxClipboard_new 3424
-#define wxClipboard_destruct 3425
-#define wxClipboard_AddData 3426
-#define wxClipboard_Clear 3427
-#define wxClipboard_Close 3428
-#define wxClipboard_Flush 3429
-#define wxClipboard_GetData 3430
-#define wxClipboard_IsOpened 3431
-#define wxClipboard_Open 3432
-#define wxClipboard_SetData 3433
-#define wxClipboard_UsePrimarySelection 3435
-#define wxClipboard_IsSupported 3436
-#define wxClipboard_Get 3437
-#define wxSpinEvent_GetPosition 3438
-#define wxSpinEvent_SetPosition 3439
-#define wxSplitterWindow_new_0 3440
-#define wxSplitterWindow_new_2 3441
-#define wxSplitterWindow_destruct 3442
-#define wxSplitterWindow_Create 3443
-#define wxSplitterWindow_GetMinimumPaneSize 3444
-#define wxSplitterWindow_GetSashGravity 3445
-#define wxSplitterWindow_GetSashPosition 3446
-#define wxSplitterWindow_GetSplitMode 3447
-#define wxSplitterWindow_GetWindow1 3448
-#define wxSplitterWindow_GetWindow2 3449
-#define wxSplitterWindow_Initialize 3450
-#define wxSplitterWindow_IsSplit 3451
-#define wxSplitterWindow_ReplaceWindow 3452
-#define wxSplitterWindow_SetSashGravity 3453
-#define wxSplitterWindow_SetSashPosition 3454
-#define wxSplitterWindow_SetSashSize 3455
-#define wxSplitterWindow_SetMinimumPaneSize 3456
-#define wxSplitterWindow_SetSplitMode 3457
-#define wxSplitterWindow_SplitHorizontally 3458
-#define wxSplitterWindow_SplitVertically 3459
-#define wxSplitterWindow_Unsplit 3460
-#define wxSplitterWindow_UpdateSize 3461
-#define wxSplitterEvent_GetSashPosition 3462
-#define wxSplitterEvent_GetX 3463
-#define wxSplitterEvent_GetY 3464
-#define wxSplitterEvent_GetWindowBeingRemoved 3465
-#define wxSplitterEvent_SetSashPosition 3466
-#define wxHtmlWindow_new_0 3467
-#define wxHtmlWindow_new_2 3468
-#define wxHtmlWindow_AppendToPage 3469
-#define wxHtmlWindow_GetOpenedAnchor 3470
-#define wxHtmlWindow_GetOpenedPage 3471
-#define wxHtmlWindow_GetOpenedPageTitle 3472
-#define wxHtmlWindow_GetRelatedFrame 3473
-#define wxHtmlWindow_HistoryBack 3474
-#define wxHtmlWindow_HistoryCanBack 3475
-#define wxHtmlWindow_HistoryCanForward 3476
-#define wxHtmlWindow_HistoryClear 3477
-#define wxHtmlWindow_HistoryForward 3478
-#define wxHtmlWindow_LoadFile 3479
-#define wxHtmlWindow_LoadPage 3480
-#define wxHtmlWindow_SelectAll 3481
-#define wxHtmlWindow_SelectionToText 3482
-#define wxHtmlWindow_SelectLine 3483
-#define wxHtmlWindow_SelectWord 3484
-#define wxHtmlWindow_SetBorders 3485
-#define wxHtmlWindow_SetFonts 3486
-#define wxHtmlWindow_SetPage 3487
-#define wxHtmlWindow_SetRelatedFrame 3488
-#define wxHtmlWindow_SetRelatedStatusBar 3489
-#define wxHtmlWindow_ToText 3490
-#define wxHtmlWindow_destroy 3491
-#define wxHtmlLinkEvent_GetLinkInfo 3492
-#define wxSystemSettings_GetColour 3493
-#define wxSystemSettings_GetFont 3494
-#define wxSystemSettings_GetMetric 3495
-#define wxSystemSettings_GetScreenType 3496
-#define wxSystemOptions_GetOption 3497
-#define wxSystemOptions_GetOptionInt 3498
-#define wxSystemOptions_HasOption 3499
-#define wxSystemOptions_IsFalse 3500
-#define wxSystemOptions_SetOption_2_1 3501
-#define wxSystemOptions_SetOption_2_0 3502
-#define wxAuiNotebookEvent_SetSelection 3503
-#define wxAuiNotebookEvent_GetSelection 3504
-#define wxAuiNotebookEvent_SetOldSelection 3505
-#define wxAuiNotebookEvent_GetOldSelection 3506
-#define wxAuiNotebookEvent_SetDragSource 3507
-#define wxAuiNotebookEvent_GetDragSource 3508
-#define wxAuiManagerEvent_SetManager 3509
-#define wxAuiManagerEvent_GetManager 3510
-#define wxAuiManagerEvent_SetPane 3511
-#define wxAuiManagerEvent_GetPane 3512
-#define wxAuiManagerEvent_SetButton 3513
-#define wxAuiManagerEvent_GetButton 3514
-#define wxAuiManagerEvent_SetDC 3515
-#define wxAuiManagerEvent_GetDC 3516
-#define wxAuiManagerEvent_Veto 3517
-#define wxAuiManagerEvent_GetVeto 3518
-#define wxAuiManagerEvent_SetCanVeto 3519
-#define wxAuiManagerEvent_CanVeto 3520
-#define wxLogNull_new 3521
-#define wxLogNull_destroy 3522
-#define wxTaskBarIcon_new 3523
-#define wxTaskBarIcon_destruct 3524
-#define wxTaskBarIcon_PopupMenu 3525
-#define wxTaskBarIcon_RemoveIcon 3526
-#define wxTaskBarIcon_SetIcon 3527
-#define wxLocale_new_0 3528
-#define wxLocale_new_2 3530
-#define wxLocale_destruct 3531
-#define wxLocale_Init 3533
-#define wxLocale_AddCatalog_1 3534
-#define wxLocale_AddCatalog_3 3535
-#define wxLocale_AddCatalogLookupPathPrefix 3536
-#define wxLocale_GetCanonicalName 3537
-#define wxLocale_GetLanguage 3538
-#define wxLocale_GetLanguageName 3539
-#define wxLocale_GetLocale 3540
-#define wxLocale_GetName 3541
-#define wxLocale_GetString_2 3542
-#define wxLocale_GetString_4 3543
-#define wxLocale_GetHeaderValue 3544
-#define wxLocale_GetSysName 3545
-#define wxLocale_GetSystemEncoding 3546
-#define wxLocale_GetSystemEncodingName 3547
-#define wxLocale_GetSystemLanguage 3548
-#define wxLocale_IsLoaded 3549
-#define wxLocale_IsOk 3550
-#define wxActivateEvent_GetActive 3551
-#define wxPopupWindow_new_2 3553
-#define wxPopupWindow_new_0 3554
-#define wxPopupWindow_destruct 3556
-#define wxPopupWindow_Create 3557
-#define wxPopupWindow_Position 3558
-#define wxPopupTransientWindow_new_0 3559
-#define wxPopupTransientWindow_new_2 3560
-#define wxPopupTransientWindow_destruct 3561
-#define wxPopupTransientWindow_Popup 3562
-#define wxPopupTransientWindow_Dismiss 3563
+#define wxAuiPaneInfo_GetWindow 2653
+#define wxAuiPaneInfo_GetFrame 2654
+#define wxAuiPaneInfo_GetDirection 2655
+#define wxAuiPaneInfo_GetLayer 2656
+#define wxAuiPaneInfo_GetRow 2657
+#define wxAuiPaneInfo_GetPosition 2658
+#define wxAuiPaneInfo_GetFloatingPosition 2659
+#define wxAuiPaneInfo_GetFloatingSize 2660
+#define wxAuiNotebook_new_0 2661
+#define wxAuiNotebook_new_2 2662
+#define wxAuiNotebook_AddPage 2663
+#define wxAuiNotebook_Create 2664
+#define wxAuiNotebook_DeletePage 2665
+#define wxAuiNotebook_GetArtProvider 2666
+#define wxAuiNotebook_GetPage 2667
+#define wxAuiNotebook_GetPageBitmap 2668
+#define wxAuiNotebook_GetPageCount 2669
+#define wxAuiNotebook_GetPageIndex 2670
+#define wxAuiNotebook_GetPageText 2671
+#define wxAuiNotebook_GetSelection 2672
+#define wxAuiNotebook_InsertPage 2673
+#define wxAuiNotebook_RemovePage 2674
+#define wxAuiNotebook_SetArtProvider 2675
+#define wxAuiNotebook_SetFont 2676
+#define wxAuiNotebook_SetPageBitmap 2677
+#define wxAuiNotebook_SetPageText 2678
+#define wxAuiNotebook_SetSelection 2679
+#define wxAuiNotebook_SetTabCtrlHeight 2680
+#define wxAuiNotebook_SetUniformBitmapSize 2681
+#define wxAuiNotebook_destroy 2682
+#define wxAuiTabArt_SetFlags 2683
+#define wxAuiTabArt_SetMeasuringFont 2684
+#define wxAuiTabArt_SetNormalFont 2685
+#define wxAuiTabArt_SetSelectedFont 2686
+#define wxAuiTabArt_SetColour 2687
+#define wxAuiTabArt_SetActiveColour 2688
+#define wxAuiDockArt_GetColour 2689
+#define wxAuiDockArt_GetFont 2690
+#define wxAuiDockArt_GetMetric 2691
+#define wxAuiDockArt_SetColour 2692
+#define wxAuiDockArt_SetFont 2693
+#define wxAuiDockArt_SetMetric 2694
+#define wxAuiSimpleTabArt_new 2695
+#define wxAuiSimpleTabArt_destroy 2696
+#define wxMDIParentFrame_new_0 2697
+#define wxMDIParentFrame_new_4 2698
+#define wxMDIParentFrame_destruct 2699
+#define wxMDIParentFrame_ActivateNext 2700
+#define wxMDIParentFrame_ActivatePrevious 2701
+#define wxMDIParentFrame_ArrangeIcons 2702
+#define wxMDIParentFrame_Cascade 2703
+#define wxMDIParentFrame_Create 2704
+#define wxMDIParentFrame_GetActiveChild 2705
+#define wxMDIParentFrame_GetClientWindow 2706
+#define wxMDIParentFrame_Tile 2707
+#define wxMDIChildFrame_new_0 2708
+#define wxMDIChildFrame_new_4 2709
+#define wxMDIChildFrame_destruct 2710
+#define wxMDIChildFrame_Activate 2711
+#define wxMDIChildFrame_Create 2712
+#define wxMDIChildFrame_Maximize 2713
+#define wxMDIChildFrame_Restore 2714
+#define wxMDIClientWindow_new_0 2715
+#define wxMDIClientWindow_new_2 2716
+#define wxMDIClientWindow_destruct 2717
+#define wxMDIClientWindow_CreateClient 2718
+#define wxLayoutAlgorithm_new 2719
+#define wxLayoutAlgorithm_LayoutFrame 2720
+#define wxLayoutAlgorithm_LayoutMDIFrame 2721
+#define wxLayoutAlgorithm_LayoutWindow 2722
+#define wxLayoutAlgorithm_destroy 2723
+#define wxEvent_GetId 2724
+#define wxEvent_GetSkipped 2725
+#define wxEvent_GetTimestamp 2726
+#define wxEvent_IsCommandEvent 2727
+#define wxEvent_ResumePropagation 2728
+#define wxEvent_ShouldPropagate 2729
+#define wxEvent_Skip 2730
+#define wxEvent_StopPropagation 2731
+#define wxCommandEvent_getClientData 2732
+#define wxCommandEvent_GetExtraLong 2733
+#define wxCommandEvent_GetInt 2734
+#define wxCommandEvent_GetSelection 2735
+#define wxCommandEvent_GetString 2736
+#define wxCommandEvent_IsChecked 2737
+#define wxCommandEvent_IsSelection 2738
+#define wxCommandEvent_SetInt 2739
+#define wxCommandEvent_SetString 2740
+#define wxScrollEvent_GetOrientation 2741
+#define wxScrollEvent_GetPosition 2742
+#define wxScrollWinEvent_GetOrientation 2743
+#define wxScrollWinEvent_GetPosition 2744
+#define wxMouseEvent_AltDown 2745
+#define wxMouseEvent_Button 2746
+#define wxMouseEvent_ButtonDClick 2747
+#define wxMouseEvent_ButtonDown 2748
+#define wxMouseEvent_ButtonUp 2749
+#define wxMouseEvent_CmdDown 2750
+#define wxMouseEvent_ControlDown 2751
+#define wxMouseEvent_Dragging 2752
+#define wxMouseEvent_Entering 2753
+#define wxMouseEvent_GetButton 2754
+#define wxMouseEvent_GetPosition 2757
+#define wxMouseEvent_GetLogicalPosition 2758
+#define wxMouseEvent_GetLinesPerAction 2759
+#define wxMouseEvent_GetWheelRotation 2760
+#define wxMouseEvent_GetWheelDelta 2761
+#define wxMouseEvent_GetX 2762
+#define wxMouseEvent_GetY 2763
+#define wxMouseEvent_IsButton 2764
+#define wxMouseEvent_IsPageScroll 2765
+#define wxMouseEvent_Leaving 2766
+#define wxMouseEvent_LeftDClick 2767
+#define wxMouseEvent_LeftDown 2768
+#define wxMouseEvent_LeftIsDown 2769
+#define wxMouseEvent_LeftUp 2770
+#define wxMouseEvent_MetaDown 2771
+#define wxMouseEvent_MiddleDClick 2772
+#define wxMouseEvent_MiddleDown 2773
+#define wxMouseEvent_MiddleIsDown 2774
+#define wxMouseEvent_MiddleUp 2775
+#define wxMouseEvent_Moving 2776
+#define wxMouseEvent_RightDClick 2777
+#define wxMouseEvent_RightDown 2778
+#define wxMouseEvent_RightIsDown 2779
+#define wxMouseEvent_RightUp 2780
+#define wxMouseEvent_ShiftDown 2781
+#define wxSetCursorEvent_GetCursor 2782
+#define wxSetCursorEvent_GetX 2783
+#define wxSetCursorEvent_GetY 2784
+#define wxSetCursorEvent_HasCursor 2785
+#define wxSetCursorEvent_SetCursor 2786
+#define wxKeyEvent_AltDown 2787
+#define wxKeyEvent_CmdDown 2788
+#define wxKeyEvent_ControlDown 2789
+#define wxKeyEvent_GetKeyCode 2790
+#define wxKeyEvent_GetModifiers 2791
+#define wxKeyEvent_GetPosition 2794
+#define wxKeyEvent_GetRawKeyCode 2795
+#define wxKeyEvent_GetRawKeyFlags 2796
+#define wxKeyEvent_GetUnicodeKey 2797
+#define wxKeyEvent_GetX 2798
+#define wxKeyEvent_GetY 2799
+#define wxKeyEvent_HasModifiers 2800
+#define wxKeyEvent_MetaDown 2801
+#define wxKeyEvent_ShiftDown 2802
+#define wxSizeEvent_GetSize 2803
+#define wxMoveEvent_GetPosition 2804
+#define wxEraseEvent_GetDC 2805
+#define wxFocusEvent_GetWindow 2806
+#define wxChildFocusEvent_GetWindow 2807
+#define wxMenuEvent_GetMenu 2808
+#define wxMenuEvent_GetMenuId 2809
+#define wxMenuEvent_IsPopup 2810
+#define wxCloseEvent_CanVeto 2811
+#define wxCloseEvent_GetLoggingOff 2812
+#define wxCloseEvent_SetCanVeto 2813
+#define wxCloseEvent_SetLoggingOff 2814
+#define wxCloseEvent_Veto 2815
+#define wxShowEvent_SetShow 2816
+#define wxShowEvent_GetShow 2817
+#define wxIconizeEvent_Iconized 2818
+#define wxJoystickEvent_ButtonDown 2819
+#define wxJoystickEvent_ButtonIsDown 2820
+#define wxJoystickEvent_ButtonUp 2821
+#define wxJoystickEvent_GetButtonChange 2822
+#define wxJoystickEvent_GetButtonState 2823
+#define wxJoystickEvent_GetJoystick 2824
+#define wxJoystickEvent_GetPosition 2825
+#define wxJoystickEvent_GetZPosition 2826
+#define wxJoystickEvent_IsButton 2827
+#define wxJoystickEvent_IsMove 2828
+#define wxJoystickEvent_IsZMove 2829
+#define wxUpdateUIEvent_CanUpdate 2830
+#define wxUpdateUIEvent_Check 2831
+#define wxUpdateUIEvent_Enable 2832
+#define wxUpdateUIEvent_Show 2833
+#define wxUpdateUIEvent_GetChecked 2834
+#define wxUpdateUIEvent_GetEnabled 2835
+#define wxUpdateUIEvent_GetShown 2836
+#define wxUpdateUIEvent_GetSetChecked 2837
+#define wxUpdateUIEvent_GetSetEnabled 2838
+#define wxUpdateUIEvent_GetSetShown 2839
+#define wxUpdateUIEvent_GetSetText 2840
+#define wxUpdateUIEvent_GetText 2841
+#define wxUpdateUIEvent_GetMode 2842
+#define wxUpdateUIEvent_GetUpdateInterval 2843
+#define wxUpdateUIEvent_ResetUpdateTime 2844
+#define wxUpdateUIEvent_SetMode 2845
+#define wxUpdateUIEvent_SetText 2846
+#define wxUpdateUIEvent_SetUpdateInterval 2847
+#define wxMouseCaptureChangedEvent_GetCapturedWindow 2848
+#define wxPaletteChangedEvent_SetChangedWindow 2849
+#define wxPaletteChangedEvent_GetChangedWindow 2850
+#define wxQueryNewPaletteEvent_SetPaletteRealized 2851
+#define wxQueryNewPaletteEvent_GetPaletteRealized 2852
+#define wxNavigationKeyEvent_GetDirection 2853
+#define wxNavigationKeyEvent_SetDirection 2854
+#define wxNavigationKeyEvent_IsWindowChange 2855
+#define wxNavigationKeyEvent_SetWindowChange 2856
+#define wxNavigationKeyEvent_IsFromTab 2857
+#define wxNavigationKeyEvent_SetFromTab 2858
+#define wxNavigationKeyEvent_GetCurrentFocus 2859
+#define wxNavigationKeyEvent_SetCurrentFocus 2860
+#define wxHelpEvent_GetOrigin 2861
+#define wxHelpEvent_GetPosition 2862
+#define wxHelpEvent_SetOrigin 2863
+#define wxHelpEvent_SetPosition 2864
+#define wxContextMenuEvent_GetPosition 2865
+#define wxContextMenuEvent_SetPosition 2866
+#define wxIdleEvent_CanSend 2867
+#define wxIdleEvent_GetMode 2868
+#define wxIdleEvent_RequestMore 2869
+#define wxIdleEvent_MoreRequested 2870
+#define wxIdleEvent_SetMode 2871
+#define wxGridEvent_AltDown 2872
+#define wxGridEvent_ControlDown 2873
+#define wxGridEvent_GetCol 2874
+#define wxGridEvent_GetPosition 2875
+#define wxGridEvent_GetRow 2876
+#define wxGridEvent_MetaDown 2877
+#define wxGridEvent_Selecting 2878
+#define wxGridEvent_ShiftDown 2879
+#define wxNotifyEvent_Allow 2880
+#define wxNotifyEvent_IsAllowed 2881
+#define wxNotifyEvent_Veto 2882
+#define wxSashEvent_GetEdge 2883
+#define wxSashEvent_GetDragRect 2884
+#define wxSashEvent_GetDragStatus 2885
+#define wxListEvent_GetCacheFrom 2886
+#define wxListEvent_GetCacheTo 2887
+#define wxListEvent_GetKeyCode 2888
+#define wxListEvent_GetIndex 2889
+#define wxListEvent_GetColumn 2890
+#define wxListEvent_GetPoint 2891
+#define wxListEvent_GetLabel 2892
+#define wxListEvent_GetText 2893
+#define wxListEvent_GetImage 2894
+#define wxListEvent_GetData 2895
+#define wxListEvent_GetMask 2896
+#define wxListEvent_GetItem 2897
+#define wxListEvent_IsEditCancelled 2898
+#define wxDateEvent_GetDate 2899
+#define wxCalendarEvent_GetWeekDay 2900
+#define wxFileDirPickerEvent_GetPath 2901
+#define wxColourPickerEvent_GetColour 2902
+#define wxFontPickerEvent_GetFont 2903
+#define wxStyledTextEvent_GetPosition 2904
+#define wxStyledTextEvent_GetKey 2905
+#define wxStyledTextEvent_GetModifiers 2906
+#define wxStyledTextEvent_GetModificationType 2907
+#define wxStyledTextEvent_GetText 2908
+#define wxStyledTextEvent_GetLength 2909
+#define wxStyledTextEvent_GetLinesAdded 2910
+#define wxStyledTextEvent_GetLine 2911
+#define wxStyledTextEvent_GetFoldLevelNow 2912
+#define wxStyledTextEvent_GetFoldLevelPrev 2913
+#define wxStyledTextEvent_GetMargin 2914
+#define wxStyledTextEvent_GetMessage 2915
+#define wxStyledTextEvent_GetWParam 2916
+#define wxStyledTextEvent_GetLParam 2917
+#define wxStyledTextEvent_GetListType 2918
+#define wxStyledTextEvent_GetX 2919
+#define wxStyledTextEvent_GetY 2920
+#define wxStyledTextEvent_GetDragText 2921
+#define wxStyledTextEvent_GetDragAllowMove 2922
+#define wxStyledTextEvent_GetDragResult 2923
+#define wxStyledTextEvent_GetShift 2924
+#define wxStyledTextEvent_GetControl 2925
+#define wxStyledTextEvent_GetAlt 2926
+#define utils_wxGetKeyState 2927
+#define utils_wxGetMousePosition 2928
+#define utils_wxGetMouseState 2929
+#define utils_wxSetDetectableAutoRepeat 2930
+#define utils_wxBell 2931
+#define utils_wxFindMenuItemId 2932
+#define utils_wxGenericFindWindowAtPoint 2933
+#define utils_wxFindWindowAtPoint 2934
+#define utils_wxBeginBusyCursor 2935
+#define utils_wxEndBusyCursor 2936
+#define utils_wxIsBusy 2937
+#define utils_wxShutdown 2938
+#define utils_wxShell 2939
+#define utils_wxLaunchDefaultBrowser 2940
+#define utils_wxGetEmailAddress 2941
+#define utils_wxGetUserId 2942
+#define utils_wxGetHomeDir 2943
+#define utils_wxNewId 2944
+#define utils_wxRegisterId 2945
+#define utils_wxGetCurrentId 2946
+#define utils_wxGetOsDescription 2947
+#define utils_wxIsPlatformLittleEndian 2948
+#define utils_wxIsPlatform64Bit 2949
+#define gdicmn_wxDisplaySize 2950
+#define gdicmn_wxSetCursor 2951
+#define wxPrintout_new 2952
+#define wxPrintout_destruct 2953
+#define wxPrintout_GetDC 2954
+#define wxPrintout_GetPageSizeMM 2955
+#define wxPrintout_GetPageSizePixels 2956
+#define wxPrintout_GetPaperRectPixels 2957
+#define wxPrintout_GetPPIPrinter 2958
+#define wxPrintout_GetPPIScreen 2959
+#define wxPrintout_GetTitle 2960
+#define wxPrintout_IsPreview 2961
+#define wxPrintout_FitThisSizeToPaper 2962
+#define wxPrintout_FitThisSizeToPage 2963
+#define wxPrintout_FitThisSizeToPageMargins 2964
+#define wxPrintout_MapScreenSizeToPaper 2965
+#define wxPrintout_MapScreenSizeToPage 2966
+#define wxPrintout_MapScreenSizeToPageMargins 2967
+#define wxPrintout_MapScreenSizeToDevice 2968
+#define wxPrintout_GetLogicalPaperRect 2969
+#define wxPrintout_GetLogicalPageRect 2970
+#define wxPrintout_GetLogicalPageMarginsRect 2971
+#define wxPrintout_SetLogicalOrigin 2972
+#define wxPrintout_OffsetLogicalOrigin 2973
+#define wxStyledTextCtrl_new_2 2974
+#define wxStyledTextCtrl_new_0 2975
+#define wxStyledTextCtrl_destruct 2976
+#define wxStyledTextCtrl_Create 2977
+#define wxStyledTextCtrl_AddText 2978
+#define wxStyledTextCtrl_AddStyledText 2979
+#define wxStyledTextCtrl_InsertText 2980
+#define wxStyledTextCtrl_ClearAll 2981
+#define wxStyledTextCtrl_ClearDocumentStyle 2982
+#define wxStyledTextCtrl_GetLength 2983
+#define wxStyledTextCtrl_GetCharAt 2984
+#define wxStyledTextCtrl_GetCurrentPos 2985
+#define wxStyledTextCtrl_GetAnchor 2986
+#define wxStyledTextCtrl_GetStyleAt 2987
+#define wxStyledTextCtrl_Redo 2988
+#define wxStyledTextCtrl_SetUndoCollection 2989
+#define wxStyledTextCtrl_SelectAll 2990
+#define wxStyledTextCtrl_SetSavePoint 2991
+#define wxStyledTextCtrl_GetStyledText 2992
+#define wxStyledTextCtrl_CanRedo 2993
+#define wxStyledTextCtrl_MarkerLineFromHandle 2994
+#define wxStyledTextCtrl_MarkerDeleteHandle 2995
+#define wxStyledTextCtrl_GetUndoCollection 2996
+#define wxStyledTextCtrl_GetViewWhiteSpace 2997
+#define wxStyledTextCtrl_SetViewWhiteSpace 2998
+#define wxStyledTextCtrl_PositionFromPoint 2999
+#define wxStyledTextCtrl_PositionFromPointClose 3000
+#define wxStyledTextCtrl_GotoLine 3001
+#define wxStyledTextCtrl_GotoPos 3002
+#define wxStyledTextCtrl_SetAnchor 3003
+#define wxStyledTextCtrl_GetCurLine 3004
+#define wxStyledTextCtrl_GetEndStyled 3005
+#define wxStyledTextCtrl_ConvertEOLs 3006
+#define wxStyledTextCtrl_GetEOLMode 3007
+#define wxStyledTextCtrl_SetEOLMode 3008
+#define wxStyledTextCtrl_StartStyling 3009
+#define wxStyledTextCtrl_SetStyling 3010
+#define wxStyledTextCtrl_GetBufferedDraw 3011
+#define wxStyledTextCtrl_SetBufferedDraw 3012
+#define wxStyledTextCtrl_SetTabWidth 3013
+#define wxStyledTextCtrl_GetTabWidth 3014
+#define wxStyledTextCtrl_SetCodePage 3015
+#define wxStyledTextCtrl_MarkerDefine 3016
+#define wxStyledTextCtrl_MarkerSetForeground 3017
+#define wxStyledTextCtrl_MarkerSetBackground 3018
+#define wxStyledTextCtrl_MarkerAdd 3019
+#define wxStyledTextCtrl_MarkerDelete 3020
+#define wxStyledTextCtrl_MarkerDeleteAll 3021
+#define wxStyledTextCtrl_MarkerGet 3022
+#define wxStyledTextCtrl_MarkerNext 3023
+#define wxStyledTextCtrl_MarkerPrevious 3024
+#define wxStyledTextCtrl_MarkerDefineBitmap 3025
+#define wxStyledTextCtrl_MarkerAddSet 3026
+#define wxStyledTextCtrl_MarkerSetAlpha 3027
+#define wxStyledTextCtrl_SetMarginType 3028
+#define wxStyledTextCtrl_GetMarginType 3029
+#define wxStyledTextCtrl_SetMarginWidth 3030
+#define wxStyledTextCtrl_GetMarginWidth 3031
+#define wxStyledTextCtrl_SetMarginMask 3032
+#define wxStyledTextCtrl_GetMarginMask 3033
+#define wxStyledTextCtrl_SetMarginSensitive 3034
+#define wxStyledTextCtrl_GetMarginSensitive 3035
+#define wxStyledTextCtrl_StyleClearAll 3036
+#define wxStyledTextCtrl_StyleSetForeground 3037
+#define wxStyledTextCtrl_StyleSetBackground 3038
+#define wxStyledTextCtrl_StyleSetBold 3039
+#define wxStyledTextCtrl_StyleSetItalic 3040
+#define wxStyledTextCtrl_StyleSetSize 3041
+#define wxStyledTextCtrl_StyleSetFaceName 3042
+#define wxStyledTextCtrl_StyleSetEOLFilled 3043
+#define wxStyledTextCtrl_StyleResetDefault 3044
+#define wxStyledTextCtrl_StyleSetUnderline 3045
+#define wxStyledTextCtrl_StyleSetCase 3046
+#define wxStyledTextCtrl_StyleSetHotSpot 3047
+#define wxStyledTextCtrl_SetSelForeground 3048
+#define wxStyledTextCtrl_SetSelBackground 3049
+#define wxStyledTextCtrl_GetSelAlpha 3050
+#define wxStyledTextCtrl_SetSelAlpha 3051
+#define wxStyledTextCtrl_SetCaretForeground 3052
+#define wxStyledTextCtrl_CmdKeyAssign 3053
+#define wxStyledTextCtrl_CmdKeyClear 3054
+#define wxStyledTextCtrl_CmdKeyClearAll 3055
+#define wxStyledTextCtrl_SetStyleBytes 3056
+#define wxStyledTextCtrl_StyleSetVisible 3057
+#define wxStyledTextCtrl_GetCaretPeriod 3058
+#define wxStyledTextCtrl_SetCaretPeriod 3059
+#define wxStyledTextCtrl_SetWordChars 3060
+#define wxStyledTextCtrl_BeginUndoAction 3061
+#define wxStyledTextCtrl_EndUndoAction 3062
+#define wxStyledTextCtrl_IndicatorSetStyle 3063
+#define wxStyledTextCtrl_IndicatorGetStyle 3064
+#define wxStyledTextCtrl_IndicatorSetForeground 3065
+#define wxStyledTextCtrl_IndicatorGetForeground 3066
+#define wxStyledTextCtrl_SetWhitespaceForeground 3067
+#define wxStyledTextCtrl_SetWhitespaceBackground 3068
+#define wxStyledTextCtrl_GetStyleBits 3069
+#define wxStyledTextCtrl_SetLineState 3070
+#define wxStyledTextCtrl_GetLineState 3071
+#define wxStyledTextCtrl_GetMaxLineState 3072
+#define wxStyledTextCtrl_GetCaretLineVisible 3073
+#define wxStyledTextCtrl_SetCaretLineVisible 3074
+#define wxStyledTextCtrl_GetCaretLineBackground 3075
+#define wxStyledTextCtrl_SetCaretLineBackground 3076
+#define wxStyledTextCtrl_AutoCompShow 3077
+#define wxStyledTextCtrl_AutoCompCancel 3078
+#define wxStyledTextCtrl_AutoCompActive 3079
+#define wxStyledTextCtrl_AutoCompPosStart 3080
+#define wxStyledTextCtrl_AutoCompComplete 3081
+#define wxStyledTextCtrl_AutoCompStops 3082
+#define wxStyledTextCtrl_AutoCompSetSeparator 3083
+#define wxStyledTextCtrl_AutoCompGetSeparator 3084
+#define wxStyledTextCtrl_AutoCompSelect 3085
+#define wxStyledTextCtrl_AutoCompSetCancelAtStart 3086
+#define wxStyledTextCtrl_AutoCompGetCancelAtStart 3087
+#define wxStyledTextCtrl_AutoCompSetFillUps 3088
+#define wxStyledTextCtrl_AutoCompSetChooseSingle 3089
+#define wxStyledTextCtrl_AutoCompGetChooseSingle 3090
+#define wxStyledTextCtrl_AutoCompSetIgnoreCase 3091
+#define wxStyledTextCtrl_AutoCompGetIgnoreCase 3092
+#define wxStyledTextCtrl_UserListShow 3093
+#define wxStyledTextCtrl_AutoCompSetAutoHide 3094
+#define wxStyledTextCtrl_AutoCompGetAutoHide 3095
+#define wxStyledTextCtrl_AutoCompSetDropRestOfWord 3096
+#define wxStyledTextCtrl_AutoCompGetDropRestOfWord 3097
+#define wxStyledTextCtrl_RegisterImage 3098
+#define wxStyledTextCtrl_ClearRegisteredImages 3099
+#define wxStyledTextCtrl_AutoCompGetTypeSeparator 3100
+#define wxStyledTextCtrl_AutoCompSetTypeSeparator 3101
+#define wxStyledTextCtrl_AutoCompSetMaxWidth 3102
+#define wxStyledTextCtrl_AutoCompGetMaxWidth 3103
+#define wxStyledTextCtrl_AutoCompSetMaxHeight 3104
+#define wxStyledTextCtrl_AutoCompGetMaxHeight 3105
+#define wxStyledTextCtrl_SetIndent 3106
+#define wxStyledTextCtrl_GetIndent 3107
+#define wxStyledTextCtrl_SetUseTabs 3108
+#define wxStyledTextCtrl_GetUseTabs 3109
+#define wxStyledTextCtrl_SetLineIndentation 3110
+#define wxStyledTextCtrl_GetLineIndentation 3111
+#define wxStyledTextCtrl_GetLineIndentPosition 3112
+#define wxStyledTextCtrl_GetColumn 3113
+#define wxStyledTextCtrl_SetUseHorizontalScrollBar 3114
+#define wxStyledTextCtrl_GetUseHorizontalScrollBar 3115
+#define wxStyledTextCtrl_SetIndentationGuides 3116
+#define wxStyledTextCtrl_GetIndentationGuides 3117
+#define wxStyledTextCtrl_SetHighlightGuide 3118
+#define wxStyledTextCtrl_GetHighlightGuide 3119
+#define wxStyledTextCtrl_GetLineEndPosition 3120
+#define wxStyledTextCtrl_GetCodePage 3121
+#define wxStyledTextCtrl_GetCaretForeground 3122
+#define wxStyledTextCtrl_GetReadOnly 3123
+#define wxStyledTextCtrl_SetCurrentPos 3124
+#define wxStyledTextCtrl_SetSelectionStart 3125
+#define wxStyledTextCtrl_GetSelectionStart 3126
+#define wxStyledTextCtrl_SetSelectionEnd 3127
+#define wxStyledTextCtrl_GetSelectionEnd 3128
+#define wxStyledTextCtrl_SetPrintMagnification 3129
+#define wxStyledTextCtrl_GetPrintMagnification 3130
+#define wxStyledTextCtrl_SetPrintColourMode 3131
+#define wxStyledTextCtrl_GetPrintColourMode 3132
+#define wxStyledTextCtrl_FindText 3133
+#define wxStyledTextCtrl_FormatRange 3134
+#define wxStyledTextCtrl_GetFirstVisibleLine 3135
+#define wxStyledTextCtrl_GetLine 3136
+#define wxStyledTextCtrl_GetLineCount 3137
+#define wxStyledTextCtrl_SetMarginLeft 3138
+#define wxStyledTextCtrl_GetMarginLeft 3139
+#define wxStyledTextCtrl_SetMarginRight 3140
+#define wxStyledTextCtrl_GetMarginRight 3141
+#define wxStyledTextCtrl_GetModify 3142
+#define wxStyledTextCtrl_SetSelection 3143
+#define wxStyledTextCtrl_GetSelectedText 3144
+#define wxStyledTextCtrl_GetTextRange 3145
+#define wxStyledTextCtrl_HideSelection 3146
+#define wxStyledTextCtrl_LineFromPosition 3147
+#define wxStyledTextCtrl_PositionFromLine 3148
+#define wxStyledTextCtrl_LineScroll 3149
+#define wxStyledTextCtrl_EnsureCaretVisible 3150
+#define wxStyledTextCtrl_ReplaceSelection 3151
+#define wxStyledTextCtrl_SetReadOnly 3152
+#define wxStyledTextCtrl_CanPaste 3153
+#define wxStyledTextCtrl_CanUndo 3154
+#define wxStyledTextCtrl_EmptyUndoBuffer 3155
+#define wxStyledTextCtrl_Undo 3156
+#define wxStyledTextCtrl_Cut 3157
+#define wxStyledTextCtrl_Copy 3158
+#define wxStyledTextCtrl_Paste 3159
+#define wxStyledTextCtrl_Clear 3160
+#define wxStyledTextCtrl_SetText 3161
+#define wxStyledTextCtrl_GetText 3162
+#define wxStyledTextCtrl_GetTextLength 3163
+#define wxStyledTextCtrl_GetOvertype 3164
+#define wxStyledTextCtrl_SetCaretWidth 3165
+#define wxStyledTextCtrl_GetCaretWidth 3166
+#define wxStyledTextCtrl_SetTargetStart 3167
+#define wxStyledTextCtrl_GetTargetStart 3168
+#define wxStyledTextCtrl_SetTargetEnd 3169
+#define wxStyledTextCtrl_GetTargetEnd 3170
+#define wxStyledTextCtrl_ReplaceTarget 3171
+#define wxStyledTextCtrl_SearchInTarget 3172
+#define wxStyledTextCtrl_SetSearchFlags 3173
+#define wxStyledTextCtrl_GetSearchFlags 3174
+#define wxStyledTextCtrl_CallTipShow 3175
+#define wxStyledTextCtrl_CallTipCancel 3176
+#define wxStyledTextCtrl_CallTipActive 3177
+#define wxStyledTextCtrl_CallTipPosAtStart 3178
+#define wxStyledTextCtrl_CallTipSetHighlight 3179
+#define wxStyledTextCtrl_CallTipSetBackground 3180
+#define wxStyledTextCtrl_CallTipSetForeground 3181
+#define wxStyledTextCtrl_CallTipSetForegroundHighlight 3182
+#define wxStyledTextCtrl_CallTipUseStyle 3183
+#define wxStyledTextCtrl_VisibleFromDocLine 3184
+#define wxStyledTextCtrl_DocLineFromVisible 3185
+#define wxStyledTextCtrl_WrapCount 3186
+#define wxStyledTextCtrl_SetFoldLevel 3187
+#define wxStyledTextCtrl_GetFoldLevel 3188
+#define wxStyledTextCtrl_GetLastChild 3189
+#define wxStyledTextCtrl_GetFoldParent 3190
+#define wxStyledTextCtrl_ShowLines 3191
+#define wxStyledTextCtrl_HideLines 3192
+#define wxStyledTextCtrl_GetLineVisible 3193
+#define wxStyledTextCtrl_SetFoldExpanded 3194
+#define wxStyledTextCtrl_GetFoldExpanded 3195
+#define wxStyledTextCtrl_ToggleFold 3196
+#define wxStyledTextCtrl_EnsureVisible 3197
+#define wxStyledTextCtrl_SetFoldFlags 3198
+#define wxStyledTextCtrl_EnsureVisibleEnforcePolicy 3199
+#define wxStyledTextCtrl_SetTabIndents 3200
+#define wxStyledTextCtrl_GetTabIndents 3201
+#define wxStyledTextCtrl_SetBackSpaceUnIndents 3202
+#define wxStyledTextCtrl_GetBackSpaceUnIndents 3203
+#define wxStyledTextCtrl_SetMouseDwellTime 3204
+#define wxStyledTextCtrl_GetMouseDwellTime 3205
+#define wxStyledTextCtrl_WordStartPosition 3206
+#define wxStyledTextCtrl_WordEndPosition 3207
+#define wxStyledTextCtrl_SetWrapMode 3208
+#define wxStyledTextCtrl_GetWrapMode 3209
+#define wxStyledTextCtrl_SetWrapVisualFlags 3210
+#define wxStyledTextCtrl_GetWrapVisualFlags 3211
+#define wxStyledTextCtrl_SetWrapVisualFlagsLocation 3212
+#define wxStyledTextCtrl_GetWrapVisualFlagsLocation 3213
+#define wxStyledTextCtrl_SetWrapStartIndent 3214
+#define wxStyledTextCtrl_GetWrapStartIndent 3215
+#define wxStyledTextCtrl_SetLayoutCache 3216
+#define wxStyledTextCtrl_GetLayoutCache 3217
+#define wxStyledTextCtrl_SetScrollWidth 3218
+#define wxStyledTextCtrl_GetScrollWidth 3219
+#define wxStyledTextCtrl_TextWidth 3220
+#define wxStyledTextCtrl_GetEndAtLastLine 3221
+#define wxStyledTextCtrl_TextHeight 3222
+#define wxStyledTextCtrl_SetUseVerticalScrollBar 3223
+#define wxStyledTextCtrl_GetUseVerticalScrollBar 3224
+#define wxStyledTextCtrl_AppendText 3225
+#define wxStyledTextCtrl_GetTwoPhaseDraw 3226
+#define wxStyledTextCtrl_SetTwoPhaseDraw 3227
+#define wxStyledTextCtrl_TargetFromSelection 3228
+#define wxStyledTextCtrl_LinesJoin 3229
+#define wxStyledTextCtrl_LinesSplit 3230
+#define wxStyledTextCtrl_SetFoldMarginColour 3231
+#define wxStyledTextCtrl_SetFoldMarginHiColour 3232
+#define wxStyledTextCtrl_LineDown 3233
+#define wxStyledTextCtrl_LineDownExtend 3234
+#define wxStyledTextCtrl_LineUp 3235
+#define wxStyledTextCtrl_LineUpExtend 3236
+#define wxStyledTextCtrl_CharLeft 3237
+#define wxStyledTextCtrl_CharLeftExtend 3238
+#define wxStyledTextCtrl_CharRight 3239
+#define wxStyledTextCtrl_CharRightExtend 3240
+#define wxStyledTextCtrl_WordLeft 3241
+#define wxStyledTextCtrl_WordLeftExtend 3242
+#define wxStyledTextCtrl_WordRight 3243
+#define wxStyledTextCtrl_WordRightExtend 3244
+#define wxStyledTextCtrl_Home 3245
+#define wxStyledTextCtrl_HomeExtend 3246
+#define wxStyledTextCtrl_LineEnd 3247
+#define wxStyledTextCtrl_LineEndExtend 3248
+#define wxStyledTextCtrl_DocumentStart 3249
+#define wxStyledTextCtrl_DocumentStartExtend 3250
+#define wxStyledTextCtrl_DocumentEnd 3251
+#define wxStyledTextCtrl_DocumentEndExtend 3252
+#define wxStyledTextCtrl_PageUp 3253
+#define wxStyledTextCtrl_PageUpExtend 3254
+#define wxStyledTextCtrl_PageDown 3255
+#define wxStyledTextCtrl_PageDownExtend 3256
+#define wxStyledTextCtrl_EditToggleOvertype 3257
+#define wxStyledTextCtrl_Cancel 3258
+#define wxStyledTextCtrl_DeleteBack 3259
+#define wxStyledTextCtrl_Tab 3260
+#define wxStyledTextCtrl_BackTab 3261
+#define wxStyledTextCtrl_NewLine 3262
+#define wxStyledTextCtrl_FormFeed 3263
+#define wxStyledTextCtrl_VCHome 3264
+#define wxStyledTextCtrl_VCHomeExtend 3265
+#define wxStyledTextCtrl_ZoomIn 3266
+#define wxStyledTextCtrl_ZoomOut 3267
+#define wxStyledTextCtrl_DelWordLeft 3268
+#define wxStyledTextCtrl_DelWordRight 3269
+#define wxStyledTextCtrl_LineCut 3270
+#define wxStyledTextCtrl_LineDelete 3271
+#define wxStyledTextCtrl_LineTranspose 3272
+#define wxStyledTextCtrl_LineDuplicate 3273
+#define wxStyledTextCtrl_LowerCase 3274
+#define wxStyledTextCtrl_UpperCase 3275
+#define wxStyledTextCtrl_LineScrollDown 3276
+#define wxStyledTextCtrl_LineScrollUp 3277
+#define wxStyledTextCtrl_DeleteBackNotLine 3278
+#define wxStyledTextCtrl_HomeDisplay 3279
+#define wxStyledTextCtrl_HomeDisplayExtend 3280
+#define wxStyledTextCtrl_LineEndDisplay 3281
+#define wxStyledTextCtrl_LineEndDisplayExtend 3282
+#define wxStyledTextCtrl_HomeWrapExtend 3283
+#define wxStyledTextCtrl_LineEndWrap 3284
+#define wxStyledTextCtrl_LineEndWrapExtend 3285
+#define wxStyledTextCtrl_VCHomeWrap 3286
+#define wxStyledTextCtrl_VCHomeWrapExtend 3287
+#define wxStyledTextCtrl_LineCopy 3288
+#define wxStyledTextCtrl_MoveCaretInsideView 3289
+#define wxStyledTextCtrl_LineLength 3290
+#define wxStyledTextCtrl_BraceHighlight 3291
+#define wxStyledTextCtrl_BraceBadLight 3292
+#define wxStyledTextCtrl_BraceMatch 3293
+#define wxStyledTextCtrl_GetViewEOL 3294
+#define wxStyledTextCtrl_SetViewEOL 3295
+#define wxStyledTextCtrl_SetModEventMask 3296
+#define wxStyledTextCtrl_GetEdgeColumn 3297
+#define wxStyledTextCtrl_SetEdgeColumn 3298
+#define wxStyledTextCtrl_SetEdgeMode 3299
+#define wxStyledTextCtrl_GetEdgeMode 3300
+#define wxStyledTextCtrl_GetEdgeColour 3301
+#define wxStyledTextCtrl_SetEdgeColour 3302
+#define wxStyledTextCtrl_SearchAnchor 3303
+#define wxStyledTextCtrl_SearchNext 3304
+#define wxStyledTextCtrl_SearchPrev 3305
+#define wxStyledTextCtrl_LinesOnScreen 3306
+#define wxStyledTextCtrl_UsePopUp 3307
+#define wxStyledTextCtrl_SelectionIsRectangle 3308
+#define wxStyledTextCtrl_SetZoom 3309
+#define wxStyledTextCtrl_GetZoom 3310
+#define wxStyledTextCtrl_GetModEventMask 3311
+#define wxStyledTextCtrl_SetSTCFocus 3312
+#define wxStyledTextCtrl_GetSTCFocus 3313
+#define wxStyledTextCtrl_SetStatus 3314
+#define wxStyledTextCtrl_GetStatus 3315
+#define wxStyledTextCtrl_SetMouseDownCaptures 3316
+#define wxStyledTextCtrl_GetMouseDownCaptures 3317
+#define wxStyledTextCtrl_SetSTCCursor 3318
+#define wxStyledTextCtrl_GetSTCCursor 3319
+#define wxStyledTextCtrl_SetControlCharSymbol 3320
+#define wxStyledTextCtrl_GetControlCharSymbol 3321
+#define wxStyledTextCtrl_WordPartLeft 3322
+#define wxStyledTextCtrl_WordPartLeftExtend 3323
+#define wxStyledTextCtrl_WordPartRight 3324
+#define wxStyledTextCtrl_WordPartRightExtend 3325
+#define wxStyledTextCtrl_SetVisiblePolicy 3326
+#define wxStyledTextCtrl_DelLineLeft 3327
+#define wxStyledTextCtrl_DelLineRight 3328
+#define wxStyledTextCtrl_GetXOffset 3329
+#define wxStyledTextCtrl_ChooseCaretX 3330
+#define wxStyledTextCtrl_SetXCaretPolicy 3331
+#define wxStyledTextCtrl_SetYCaretPolicy 3332
+#define wxStyledTextCtrl_GetPrintWrapMode 3333
+#define wxStyledTextCtrl_SetHotspotActiveForeground 3334
+#define wxStyledTextCtrl_SetHotspotActiveBackground 3335
+#define wxStyledTextCtrl_SetHotspotActiveUnderline 3336
+#define wxStyledTextCtrl_SetHotspotSingleLine 3337
+#define wxStyledTextCtrl_ParaDownExtend 3338
+#define wxStyledTextCtrl_ParaUp 3339
+#define wxStyledTextCtrl_ParaUpExtend 3340
+#define wxStyledTextCtrl_PositionBefore 3341
+#define wxStyledTextCtrl_PositionAfter 3342
+#define wxStyledTextCtrl_CopyRange 3343
+#define wxStyledTextCtrl_CopyText 3344
+#define wxStyledTextCtrl_SetSelectionMode 3345
+#define wxStyledTextCtrl_GetSelectionMode 3346
+#define wxStyledTextCtrl_LineDownRectExtend 3347
+#define wxStyledTextCtrl_LineUpRectExtend 3348
+#define wxStyledTextCtrl_CharLeftRectExtend 3349
+#define wxStyledTextCtrl_CharRightRectExtend 3350
+#define wxStyledTextCtrl_HomeRectExtend 3351
+#define wxStyledTextCtrl_VCHomeRectExtend 3352
+#define wxStyledTextCtrl_LineEndRectExtend 3353
+#define wxStyledTextCtrl_PageUpRectExtend 3354
+#define wxStyledTextCtrl_PageDownRectExtend 3355
+#define wxStyledTextCtrl_StutteredPageUp 3356
+#define wxStyledTextCtrl_StutteredPageUpExtend 3357
+#define wxStyledTextCtrl_StutteredPageDown 3358
+#define wxStyledTextCtrl_StutteredPageDownExtend 3359
+#define wxStyledTextCtrl_WordLeftEnd 3360
+#define wxStyledTextCtrl_WordLeftEndExtend 3361
+#define wxStyledTextCtrl_WordRightEnd 3362
+#define wxStyledTextCtrl_WordRightEndExtend 3363
+#define wxStyledTextCtrl_SetWhitespaceChars 3364
+#define wxStyledTextCtrl_SetCharsDefault 3365
+#define wxStyledTextCtrl_AutoCompGetCurrent 3366
+#define wxStyledTextCtrl_Allocate 3367
+#define wxStyledTextCtrl_FindColumn 3368
+#define wxStyledTextCtrl_GetCaretSticky 3369
+#define wxStyledTextCtrl_SetCaretSticky 3370
+#define wxStyledTextCtrl_ToggleCaretSticky 3371
+#define wxStyledTextCtrl_SetPasteConvertEndings 3372
+#define wxStyledTextCtrl_GetPasteConvertEndings 3373
+#define wxStyledTextCtrl_SelectionDuplicate 3374
+#define wxStyledTextCtrl_SetCaretLineBackAlpha 3375
+#define wxStyledTextCtrl_GetCaretLineBackAlpha 3376
+#define wxStyledTextCtrl_StartRecord 3377
+#define wxStyledTextCtrl_StopRecord 3378
+#define wxStyledTextCtrl_SetLexer 3379
+#define wxStyledTextCtrl_GetLexer 3380
+#define wxStyledTextCtrl_Colourise 3381
+#define wxStyledTextCtrl_SetProperty 3382
+#define wxStyledTextCtrl_SetKeyWords 3383
+#define wxStyledTextCtrl_SetLexerLanguage 3384
+#define wxStyledTextCtrl_GetProperty 3385
+#define wxStyledTextCtrl_GetStyleBitsNeeded 3386
+#define wxStyledTextCtrl_GetCurrentLine 3387
+#define wxStyledTextCtrl_StyleSetSpec 3388
+#define wxStyledTextCtrl_StyleSetFont 3389
+#define wxStyledTextCtrl_StyleSetFontAttr 3390
+#define wxStyledTextCtrl_StyleSetCharacterSet 3391
+#define wxStyledTextCtrl_StyleSetFontEncoding 3392
+#define wxStyledTextCtrl_CmdKeyExecute 3393
+#define wxStyledTextCtrl_SetMargins 3394
+#define wxStyledTextCtrl_GetSelection 3395
+#define wxStyledTextCtrl_PointFromPosition 3396
+#define wxStyledTextCtrl_ScrollToLine 3397
+#define wxStyledTextCtrl_ScrollToColumn 3398
+#define wxStyledTextCtrl_SetVScrollBar 3399
+#define wxStyledTextCtrl_SetHScrollBar 3400
+#define wxStyledTextCtrl_GetLastKeydownProcessed 3401
+#define wxStyledTextCtrl_SetLastKeydownProcessed 3402
+#define wxStyledTextCtrl_SaveFile 3403
+#define wxStyledTextCtrl_LoadFile 3404
+#define wxStyledTextCtrl_DoDragOver 3405
+#define wxStyledTextCtrl_DoDropText 3406
+#define wxStyledTextCtrl_GetUseAntiAliasing 3407
+#define wxStyledTextCtrl_AddTextRaw 3408
+#define wxStyledTextCtrl_InsertTextRaw 3409
+#define wxStyledTextCtrl_GetCurLineRaw 3410
+#define wxStyledTextCtrl_GetLineRaw 3411
+#define wxStyledTextCtrl_GetSelectedTextRaw 3412
+#define wxStyledTextCtrl_GetTextRangeRaw 3413
+#define wxStyledTextCtrl_SetTextRaw 3414
+#define wxStyledTextCtrl_GetTextRaw 3415
+#define wxStyledTextCtrl_AppendTextRaw 3416
+#define wxArtProvider_GetBitmap 3417
+#define wxArtProvider_GetIcon 3418
+#define wxTreeEvent_GetKeyCode 3419
+#define wxTreeEvent_GetItem 3420
+#define wxTreeEvent_GetKeyEvent 3421
+#define wxTreeEvent_GetLabel 3422
+#define wxTreeEvent_GetOldItem 3423
+#define wxTreeEvent_GetPoint 3424
+#define wxTreeEvent_IsEditCancelled 3425
+#define wxTreeEvent_SetToolTip 3426
+#define wxNotebookEvent_GetOldSelection 3427
+#define wxNotebookEvent_GetSelection 3428
+#define wxNotebookEvent_SetOldSelection 3429
+#define wxNotebookEvent_SetSelection 3430
+#define wxFileDataObject_new 3431
+#define wxFileDataObject_AddFile 3432
+#define wxFileDataObject_GetFilenames 3433
+#define wxFileDataObject_destroy 3434
+#define wxTextDataObject_new 3435
+#define wxTextDataObject_GetTextLength 3436
+#define wxTextDataObject_GetText 3437
+#define wxTextDataObject_SetText 3438
+#define wxTextDataObject_destroy 3439
+#define wxBitmapDataObject_new_1_1 3440
+#define wxBitmapDataObject_new_1_0 3441
+#define wxBitmapDataObject_GetBitmap 3442
+#define wxBitmapDataObject_SetBitmap 3443
+#define wxBitmapDataObject_destroy 3444
+#define wxClipboard_new 3446
+#define wxClipboard_destruct 3447
+#define wxClipboard_AddData 3448
+#define wxClipboard_Clear 3449
+#define wxClipboard_Close 3450
+#define wxClipboard_Flush 3451
+#define wxClipboard_GetData 3452
+#define wxClipboard_IsOpened 3453
+#define wxClipboard_Open 3454
+#define wxClipboard_SetData 3455
+#define wxClipboard_UsePrimarySelection 3457
+#define wxClipboard_IsSupported 3458
+#define wxClipboard_Get 3459
+#define wxSpinEvent_GetPosition 3460
+#define wxSpinEvent_SetPosition 3461
+#define wxSplitterWindow_new_0 3462
+#define wxSplitterWindow_new_2 3463
+#define wxSplitterWindow_destruct 3464
+#define wxSplitterWindow_Create 3465
+#define wxSplitterWindow_GetMinimumPaneSize 3466
+#define wxSplitterWindow_GetSashGravity 3467
+#define wxSplitterWindow_GetSashPosition 3468
+#define wxSplitterWindow_GetSplitMode 3469
+#define wxSplitterWindow_GetWindow1 3470
+#define wxSplitterWindow_GetWindow2 3471
+#define wxSplitterWindow_Initialize 3472
+#define wxSplitterWindow_IsSplit 3473
+#define wxSplitterWindow_ReplaceWindow 3474
+#define wxSplitterWindow_SetSashGravity 3475
+#define wxSplitterWindow_SetSashPosition 3476
+#define wxSplitterWindow_SetSashSize 3477
+#define wxSplitterWindow_SetMinimumPaneSize 3478
+#define wxSplitterWindow_SetSplitMode 3479
+#define wxSplitterWindow_SplitHorizontally 3480
+#define wxSplitterWindow_SplitVertically 3481
+#define wxSplitterWindow_Unsplit 3482
+#define wxSplitterWindow_UpdateSize 3483
+#define wxSplitterEvent_GetSashPosition 3484
+#define wxSplitterEvent_GetX 3485
+#define wxSplitterEvent_GetY 3486
+#define wxSplitterEvent_GetWindowBeingRemoved 3487
+#define wxSplitterEvent_SetSashPosition 3488
+#define wxHtmlWindow_new_0 3489
+#define wxHtmlWindow_new_2 3490
+#define wxHtmlWindow_AppendToPage 3491
+#define wxHtmlWindow_GetOpenedAnchor 3492
+#define wxHtmlWindow_GetOpenedPage 3493
+#define wxHtmlWindow_GetOpenedPageTitle 3494
+#define wxHtmlWindow_GetRelatedFrame 3495
+#define wxHtmlWindow_HistoryBack 3496
+#define wxHtmlWindow_HistoryCanBack 3497
+#define wxHtmlWindow_HistoryCanForward 3498
+#define wxHtmlWindow_HistoryClear 3499
+#define wxHtmlWindow_HistoryForward 3500
+#define wxHtmlWindow_LoadFile 3501
+#define wxHtmlWindow_LoadPage 3502
+#define wxHtmlWindow_SelectAll 3503
+#define wxHtmlWindow_SelectionToText 3504
+#define wxHtmlWindow_SelectLine 3505
+#define wxHtmlWindow_SelectWord 3506
+#define wxHtmlWindow_SetBorders 3507
+#define wxHtmlWindow_SetFonts 3508
+#define wxHtmlWindow_SetPage 3509
+#define wxHtmlWindow_SetRelatedFrame 3510
+#define wxHtmlWindow_SetRelatedStatusBar 3511
+#define wxHtmlWindow_ToText 3512
+#define wxHtmlWindow_destroy 3513
+#define wxHtmlLinkEvent_GetLinkInfo 3514
+#define wxSystemSettings_GetColour 3515
+#define wxSystemSettings_GetFont 3516
+#define wxSystemSettings_GetMetric 3517
+#define wxSystemSettings_GetScreenType 3518
+#define wxSystemOptions_GetOption 3519
+#define wxSystemOptions_GetOptionInt 3520
+#define wxSystemOptions_HasOption 3521
+#define wxSystemOptions_IsFalse 3522
+#define wxSystemOptions_SetOption_2_1 3523
+#define wxSystemOptions_SetOption_2_0 3524
+#define wxAuiNotebookEvent_SetSelection 3525
+#define wxAuiNotebookEvent_GetSelection 3526
+#define wxAuiNotebookEvent_SetOldSelection 3527
+#define wxAuiNotebookEvent_GetOldSelection 3528
+#define wxAuiNotebookEvent_SetDragSource 3529
+#define wxAuiNotebookEvent_GetDragSource 3530
+#define wxAuiManagerEvent_SetManager 3531
+#define wxAuiManagerEvent_GetManager 3532
+#define wxAuiManagerEvent_SetPane 3533
+#define wxAuiManagerEvent_GetPane 3534
+#define wxAuiManagerEvent_SetButton 3535
+#define wxAuiManagerEvent_GetButton 3536
+#define wxAuiManagerEvent_SetDC 3537
+#define wxAuiManagerEvent_GetDC 3538
+#define wxAuiManagerEvent_Veto 3539
+#define wxAuiManagerEvent_GetVeto 3540
+#define wxAuiManagerEvent_SetCanVeto 3541
+#define wxAuiManagerEvent_CanVeto 3542
+#define wxLogNull_new 3543
+#define wxLogNull_destroy 3544
+#define wxTaskBarIcon_new 3545
+#define wxTaskBarIcon_destruct 3546
+#define wxTaskBarIcon_PopupMenu 3547
+#define wxTaskBarIcon_RemoveIcon 3548
+#define wxTaskBarIcon_SetIcon 3549
+#define wxLocale_new_0 3550
+#define wxLocale_new_2 3552
+#define wxLocale_destruct 3553
+#define wxLocale_Init 3555
+#define wxLocale_AddCatalog_1 3556
+#define wxLocale_AddCatalog_3 3557
+#define wxLocale_AddCatalogLookupPathPrefix 3558
+#define wxLocale_GetCanonicalName 3559
+#define wxLocale_GetLanguage 3560
+#define wxLocale_GetLanguageName 3561
+#define wxLocale_GetLocale 3562
+#define wxLocale_GetName 3563
+#define wxLocale_GetString_2 3564
+#define wxLocale_GetString_4 3565
+#define wxLocale_GetHeaderValue 3566
+#define wxLocale_GetSysName 3567
+#define wxLocale_GetSystemEncoding 3568
+#define wxLocale_GetSystemEncodingName 3569
+#define wxLocale_GetSystemLanguage 3570
+#define wxLocale_IsLoaded 3571
+#define wxLocale_IsOk 3572
+#define wxActivateEvent_GetActive 3573
+#define wxPopupWindow_new_2 3575
+#define wxPopupWindow_new_0 3576
+#define wxPopupWindow_destruct 3578
+#define wxPopupWindow_Create 3579
+#define wxPopupWindow_Position 3580
+#define wxPopupTransientWindow_new_0 3581
+#define wxPopupTransientWindow_new_2 3582
+#define wxPopupTransientWindow_destruct 3583
+#define wxPopupTransientWindow_Popup 3584
+#define wxPopupTransientWindow_Dismiss 3585
diff --git a/lib/wx/doc/src/notes.xml b/lib/wx/doc/src/notes.xml
index 0f00309f1b..6a0dd898e3 100644
--- a/lib/wx/doc/src/notes.xml
+++ b/lib/wx/doc/src/notes.xml
@@ -32,6 +32,21 @@
<p>This document describes the changes made to the wxErlang
application.</p>
+<section><title>Wx 1.5</title>
+
+ <section><title>Improvements and New Features</title>
+ <list>
+ <item>
+ <p>
+ Extend AUI functionality.</p>
+ <p>
+ Own Id: OTP-12961</p>
+ </item>
+ </list>
+ </section>
+
+</section>
+
<section><title>Wx 1.4</title>
<section><title>Fixed Bugs and Malfunctions</title>
diff --git a/lib/wx/examples/demo/ex_aui.erl b/lib/wx/examples/demo/ex_aui.erl
index e0841da670..7fbf841d16 100644
--- a/lib/wx/examples/demo/ex_aui.erl
+++ b/lib/wx/examples/demo/ex_aui.erl
@@ -47,40 +47,54 @@ init(Config) ->
-define(pi, wxAuiPaneInfo).
do_init(Config) ->
- Parent = proplists:get_value(parent, Config),
+ Parent = proplists:get_value(parent, Config),
Panel = wxPanel:new(Parent, []),
%% Setup sizers
MainSizer = wxBoxSizer:new(?wxVERTICAL),
Manager = wxAuiManager:new([{managed_wnd, Panel}]),
-
- Pane = ?pi:new(),
- ?pi:closeButton(Pane),
- ?pi:right(Pane),
- ?pi:dockable(Pane, [{b, true}]),
- ?pi:floatingSize(Pane, 300,200),
- ?pi:minSize(Pane, {50,50}),
- ?pi:paneBorder(Pane),
- ?pi:floatable(Pane, [{b, true}]),
-
- create_pane(Panel, Manager, Pane),
- create_pane(Panel, Manager,
- ?pi:caption(?pi:top(?pi:new(Pane)), "One")),
- create_pane(Panel, Manager,
- ?pi:caption(?pi:left(?pi:new(Pane)), "two")),
- create_pane(Panel, Manager,
- ?pi:caption(?pi:bottom(?pi:new(Pane)), "Three")),
- Pane2 = wxAuiPaneInfo:new(Pane),
- ?pi:centrePane(Pane2),
- create_notebook(Panel, Manager, ?pi:new(Pane2)),
-
- wxPanel:setSizer(Panel, MainSizer),
-
- wxAuiManager:connect(Manager, aui_pane_button, [{skip,true}]),
- wxAuiManager:connect(Manager, aui_pane_maximize, [{skip,true}]),
- wxAuiManager:update(Manager),
- process_flag(trap_exit, true),
- {Panel, #state{parent=Panel, config=Config, aui=Manager}}.
+ try
+ Art = wxAuiManager:getArtProvider(Manager),
+ wxAuiDockArt:setColour(Art, ?wxAUI_DOCKART_BACKGROUND_COLOUR, {200, 100, 100}),
+ wxAuiDockArt:setColour(Art, ?wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR, {200, 100, 100}),
+ wxAuiDockArt:setColour(Art, ?wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR, {100, 200, 100}),
+
+
+ Pane = ?pi:new(),
+ ?pi:closeButton(Pane),
+ ?pi:right(Pane),
+ ?pi:dockable(Pane, [{b, true}]),
+ ?pi:floatingSize(Pane, 300,200),
+ ?pi:minSize(Pane, {50,50}),
+ ?pi:paneBorder(Pane),
+ ?pi:floatable(Pane, [{b, true}]),
+
+ create_pane(Panel, Manager, Pane),
+ create_pane(Panel, Manager,
+ ?pi:caption(?pi:top(?pi:new(Pane)), "One")),
+ create_pane(Panel, Manager,
+ ?pi:caption(?pi:left(?pi:new(Pane)), "two")),
+ create_pane(Panel, Manager,
+ ?pi:caption(?pi:bottom(?pi:new(Pane)), "Three")),
+ Pane2 = wxAuiPaneInfo:new(Pane),
+ ?pi:centrePane(Pane2),
+ create_notebook(Panel, Manager, ?pi:new(Pane2)),
+
+ wxPanel:setSizer(Panel, MainSizer),
+
+ wxAuiManager:connect(Manager, aui_pane_button, [{skip,true}]),
+ wxAuiManager:connect(Manager, aui_pane_maximize, [{skip,true}]),
+ wxAuiManager:update(Manager),
+ process_flag(trap_exit, true),
+ {Panel, #state{parent=Panel, config=Config, aui=Manager}}
+ catch Class:Reason ->
+ ST = erlang:get_stacktrace(),
+ io:format("AUI Crashed ~p ~p~n",[Reason, ST]),
+ wxAuiManager:unInit(Manager),
+ wxAuiManager:destroy(Manager),
+ wxPanel:destroy(Panel),
+ erlang:raise(Class, Reason, ST)
+ end.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Callbacks handled as normal gen_server callbacks
@@ -163,6 +177,15 @@ create_notebook(Parent, Manager, Pane) ->
Notebook = wxAuiNotebook:new(Parent, [{style, Style}]),
+ Art = wxAuiSimpleTabArt:new(),
+ case ?wxMAJOR_VERSION > 2 of
+ true ->
+ wxAuiSimpleTabArt:setColour(Art, {200, 0, 0}),
+ wxAuiSimpleTabArt:setActiveColour(Art, {0, 0, 200});
+ false -> ignore
+ end,
+ ok = wxAuiNotebook:setArtProvider(Notebook, Art),
+
Tab1 = wxPanel:new(Notebook, []),
wxPanel:setBackgroundColour(Tab1, ?wxBLACK),
wxButton:new(Tab1, ?wxID_ANY, [{label,"New tab"}]),
diff --git a/lib/wx/include/wx.hrl b/lib/wx/include/wx.hrl
index 69ca13aca1..1bc00ca235 100644
--- a/lib/wx/include/wx.hrl
+++ b/lib/wx/include/wx.hrl
@@ -295,7 +295,7 @@
veto_flag :: boolean(),
canveto_flag :: boolean(),
dc :: wxDC:wxDC()}).
--type wxAuiManagerEventType() :: aui_pane_button | aui_pane_close | aui_pane_maximize | aui_pane_restore | aui_render | aui_find_manager.
+-type wxAuiManagerEventType() :: aui_pane_button | aui_pane_close | aui_pane_maximize | aui_pane_restore | aui_pane_activated | aui_render | aui_find_manager.
-type wxAuiManager() :: #wxAuiManager{}. %% Callback event: {@link wxAuiManagerEvent}
-record(wxInitDialog, {type :: wxInitDialogEventType()}). %% Callback event: {@link wxInitDialogEvent}
diff --git a/lib/wx/src/gen/wxAuiDockArt.erl b/lib/wx/src/gen/wxAuiDockArt.erl
index 499fbd9a23..4149b1d424 100644
--- a/lib/wx/src/gen/wxAuiDockArt.erl
+++ b/lib/wx/src/gen/wxAuiDockArt.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@
-module(wxAuiDockArt).
-include("wxe.hrl").
--export([]).
+-export([getColour/2,getFont/2,getMetric/2,setColour/3,setFont/3,setMetric/3]).
%% inherited exports
-export([parent_class/1]).
@@ -35,3 +35,58 @@
parent_class(_Class) -> erlang:error({badtype, ?MODULE}).
-type wxAuiDockArt() :: wx:wx_object().
+%% @doc See <a href="http://www.wxwidgets.org/manuals/2.8.12/wx_wxauidockart.html#wxauidockartgetcolour">external documentation</a>.
+-spec getColour(This, Id) -> wx:wx_colour4() when
+ This::wxAuiDockArt(), Id::integer().
+getColour(#wx_ref{type=ThisT,ref=ThisRef},Id)
+ when is_integer(Id) ->
+ ?CLASS(ThisT,wxAuiDockArt),
+ wxe_util:call(?wxAuiDockArt_GetColour,
+ <<ThisRef:32/?UI,Id:32/?UI>>).
+
+%% @doc See <a href="http://www.wxwidgets.org/manuals/2.8.12/wx_wxauidockart.html#wxauidockartgetfont">external documentation</a>.
+-spec getFont(This, Id) -> wxFont:wxFont() when
+ This::wxAuiDockArt(), Id::integer().
+getFont(#wx_ref{type=ThisT,ref=ThisRef},Id)
+ when is_integer(Id) ->
+ ?CLASS(ThisT,wxAuiDockArt),
+ wxe_util:call(?wxAuiDockArt_GetFont,
+ <<ThisRef:32/?UI,Id:32/?UI>>).
+
+%% @doc See <a href="http://www.wxwidgets.org/manuals/2.8.12/wx_wxauidockart.html#wxauidockartgetmetric">external documentation</a>.
+-spec getMetric(This, Id) -> integer() when
+ This::wxAuiDockArt(), Id::integer().
+getMetric(#wx_ref{type=ThisT,ref=ThisRef},Id)
+ when is_integer(Id) ->
+ ?CLASS(ThisT,wxAuiDockArt),
+ wxe_util:call(?wxAuiDockArt_GetMetric,
+ <<ThisRef:32/?UI,Id:32/?UI>>).
+
+%% @doc See <a href="http://www.wxwidgets.org/manuals/2.8.12/wx_wxauidockart.html#wxauidockartsetcolour">external documentation</a>.
+-spec setColour(This, Id, Colour) -> ok when
+ This::wxAuiDockArt(), Id::integer(), Colour::wx:wx_colour().
+setColour(#wx_ref{type=ThisT,ref=ThisRef},Id,Colour)
+ when is_integer(Id),tuple_size(Colour) =:= 3; tuple_size(Colour) =:= 4 ->
+ ?CLASS(ThisT,wxAuiDockArt),
+ wxe_util:cast(?wxAuiDockArt_SetColour,
+ <<ThisRef:32/?UI,Id:32/?UI,(wxe_util:colour_bin(Colour)):16/binary>>).
+
+%% @doc See <a href="http://www.wxwidgets.org/manuals/2.8.12/wx_wxauidockart.html#wxauidockartsetfont">external documentation</a>.
+-spec setFont(This, Id, Font) -> ok when
+ This::wxAuiDockArt(), Id::integer(), Font::wxFont:wxFont().
+setFont(#wx_ref{type=ThisT,ref=ThisRef},Id,#wx_ref{type=FontT,ref=FontRef})
+ when is_integer(Id) ->
+ ?CLASS(ThisT,wxAuiDockArt),
+ ?CLASS(FontT,wxFont),
+ wxe_util:cast(?wxAuiDockArt_SetFont,
+ <<ThisRef:32/?UI,Id:32/?UI,FontRef:32/?UI>>).
+
+%% @doc See <a href="http://www.wxwidgets.org/manuals/2.8.12/wx_wxauidockart.html#wxauidockartsetmetric">external documentation</a>.
+-spec setMetric(This, Id, New_val) -> ok when
+ This::wxAuiDockArt(), Id::integer(), New_val::integer().
+setMetric(#wx_ref{type=ThisT,ref=ThisRef},Id,New_val)
+ when is_integer(Id),is_integer(New_val) ->
+ ?CLASS(ThisT,wxAuiDockArt),
+ wxe_util:cast(?wxAuiDockArt_SetMetric,
+ <<ThisRef:32/?UI,Id:32/?UI,New_val:32/?UI>>).
+
diff --git a/lib/wx/src/gen/wxAuiManager.erl b/lib/wx/src/gen/wxAuiManager.erl
index 5a945f59e8..bf22e3091d 100644
--- a/lib/wx/src/gen/wxAuiManager.erl
+++ b/lib/wx/src/gen/wxAuiManager.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -120,7 +120,7 @@ detachPane(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=WindowT,ref=WindowRef})
<<ThisRef:32/?UI,WindowRef:32/?UI>>).
%% @doc See <a href="http://www.wxwidgets.org/manuals/2.8.12/wx_wxauimanager.html#wxauimanagergetallpanes">external documentation</a>.
--spec getAllPanes(This) -> wx:wx_object() when
+-spec getAllPanes(This) -> [wxAuiPaneInfo:wxAuiPaneInfo()] when
This::wxAuiManager().
getAllPanes(#wx_ref{type=ThisT,ref=ThisRef}) ->
?CLASS(ThisT,wxAuiManager),
diff --git a/lib/wx/src/gen/wxAuiManagerEvent.erl b/lib/wx/src/gen/wxAuiManagerEvent.erl
index 51ad211e10..88e4433f24 100644
--- a/lib/wx/src/gen/wxAuiManagerEvent.erl
+++ b/lib/wx/src/gen/wxAuiManagerEvent.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2009-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2009-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@
%% @doc See external documentation: <a href="http://www.wxwidgets.org/manuals/2.8.12/wx_wxauimanagerevent.html">wxAuiManagerEvent</a>.
%% <dl><dt>Use {@link wxEvtHandler:connect/3.} with EventType:</dt>
-%% <dd><em>aui_pane_button</em>, <em>aui_pane_close</em>, <em>aui_pane_maximize</em>, <em>aui_pane_restore</em>, <em>aui_render</em>, <em>aui_find_manager</em></dd></dl>
+%% <dd><em>aui_pane_button</em>, <em>aui_pane_close</em>, <em>aui_pane_maximize</em>, <em>aui_pane_restore</em>, <em>aui_pane_activated</em>, <em>aui_render</em>, <em>aui_find_manager</em></dd></dl>
%% See also the message variant {@link wxEvtHandler:wxAuiManager(). #wxAuiManager{}} event record type.
%%
%% <p>This class is derived (and can use functions) from:
diff --git a/lib/wx/src/gen/wxAuiPaneInfo.erl b/lib/wx/src/gen/wxAuiPaneInfo.erl
index 2b31df09fe..1f15e9cd39 100644
--- a/lib/wx/src/gen/wxAuiPaneInfo.erl
+++ b/lib/wx/src/gen/wxAuiPaneInfo.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -30,17 +30,19 @@
closeButton/2,defaultPane/1,destroy/1,destroyOnClose/1,destroyOnClose/2,
direction/2,dock/1,dockable/1,dockable/2,fixed/1,float/1,floatable/1,
floatable/2,floatingPosition/2,floatingPosition/3,floatingSize/2,
- floatingSize/3,gripper/1,gripper/2,gripperTop/1,gripperTop/2,hasBorder/1,
- hasCaption/1,hasCloseButton/1,hasFlag/2,hasGripper/1,hasGripperTop/1,
- hasMaximizeButton/1,hasMinimizeButton/1,hasPinButton/1,hide/1,isBottomDockable/1,
- isDocked/1,isFixed/1,isFloatable/1,isFloating/1,isLeftDockable/1,isMovable/1,
- isOk/1,isResizable/1,isRightDockable/1,isShown/1,isToolbar/1,isTopDockable/1,
- layer/2,left/1,leftDockable/1,leftDockable/2,maxSize/2,maxSize/3,maximizeButton/1,
- maximizeButton/2,minSize/2,minSize/3,minimizeButton/1,minimizeButton/2,
- movable/1,movable/2,name/2,new/0,new/1,paneBorder/1,paneBorder/2,pinButton/1,
- pinButton/2,position/2,resizable/1,resizable/2,right/1,rightDockable/1,
- rightDockable/2,row/2,safeSet/2,setFlag/3,show/1,show/2,toolbarPane/1,
- top/1,topDockable/1,topDockable/2,window/2]).
+ floatingSize/3,getDirection/1,getFloatingPosition/1,getFloatingSize/1,
+ getFrame/1,getLayer/1,getPosition/1,getRow/1,getWindow/1,gripper/1,
+ gripper/2,gripperTop/1,gripperTop/2,hasBorder/1,hasCaption/1,hasCloseButton/1,
+ hasFlag/2,hasGripper/1,hasGripperTop/1,hasMaximizeButton/1,hasMinimizeButton/1,
+ hasPinButton/1,hide/1,isBottomDockable/1,isDocked/1,isFixed/1,isFloatable/1,
+ isFloating/1,isLeftDockable/1,isMovable/1,isOk/1,isResizable/1,isRightDockable/1,
+ isShown/1,isToolbar/1,isTopDockable/1,layer/2,left/1,leftDockable/1,
+ leftDockable/2,maxSize/2,maxSize/3,maximizeButton/1,maximizeButton/2,
+ minSize/2,minSize/3,minimizeButton/1,minimizeButton/2,movable/1,movable/2,
+ name/2,new/0,new/1,paneBorder/1,paneBorder/2,pinButton/1,pinButton/2,
+ position/2,resizable/1,resizable/2,right/1,rightDockable/1,rightDockable/2,
+ row/2,safeSet/2,setFlag/3,show/1,show/2,toolbarPane/1,top/1,topDockable/1,
+ topDockable/2,window/2]).
%% inherited exports
-export([parent_class/1]).
@@ -888,6 +890,70 @@ window(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=WT,ref=WRef}) ->
wxe_util:call(?wxAuiPaneInfo_Window,
<<ThisRef:32/?UI,WRef:32/?UI>>).
+%% @doc See <a href="http://www.wxwidgets.org/manuals/2.8.12/wx_wxauipaneinfo.html#wxauipaneinfogetwindow">external documentation</a>.
+-spec getWindow(This) -> wxWindow:wxWindow() when
+ This::wxAuiPaneInfo().
+getWindow(#wx_ref{type=ThisT,ref=ThisRef}) ->
+ ?CLASS(ThisT,wxAuiPaneInfo),
+ wxe_util:call(?wxAuiPaneInfo_GetWindow,
+ <<ThisRef:32/?UI>>).
+
+%% @doc See <a href="http://www.wxwidgets.org/manuals/2.8.12/wx_wxauipaneinfo.html#wxauipaneinfogetframe">external documentation</a>.
+-spec getFrame(This) -> wxFrame:wxFrame() when
+ This::wxAuiPaneInfo().
+getFrame(#wx_ref{type=ThisT,ref=ThisRef}) ->
+ ?CLASS(ThisT,wxAuiPaneInfo),
+ wxe_util:call(?wxAuiPaneInfo_GetFrame,
+ <<ThisRef:32/?UI>>).
+
+%% @doc See <a href="http://www.wxwidgets.org/manuals/2.8.12/wx_wxauipaneinfo.html#wxauipaneinfogetdirection">external documentation</a>.
+-spec getDirection(This) -> integer() when
+ This::wxAuiPaneInfo().
+getDirection(#wx_ref{type=ThisT,ref=ThisRef}) ->
+ ?CLASS(ThisT,wxAuiPaneInfo),
+ wxe_util:call(?wxAuiPaneInfo_GetDirection,
+ <<ThisRef:32/?UI>>).
+
+%% @doc See <a href="http://www.wxwidgets.org/manuals/2.8.12/wx_wxauipaneinfo.html#wxauipaneinfogetlayer">external documentation</a>.
+-spec getLayer(This) -> integer() when
+ This::wxAuiPaneInfo().
+getLayer(#wx_ref{type=ThisT,ref=ThisRef}) ->
+ ?CLASS(ThisT,wxAuiPaneInfo),
+ wxe_util:call(?wxAuiPaneInfo_GetLayer,
+ <<ThisRef:32/?UI>>).
+
+%% @doc See <a href="http://www.wxwidgets.org/manuals/2.8.12/wx_wxauipaneinfo.html#wxauipaneinfogetrow">external documentation</a>.
+-spec getRow(This) -> integer() when
+ This::wxAuiPaneInfo().
+getRow(#wx_ref{type=ThisT,ref=ThisRef}) ->
+ ?CLASS(ThisT,wxAuiPaneInfo),
+ wxe_util:call(?wxAuiPaneInfo_GetRow,
+ <<ThisRef:32/?UI>>).
+
+%% @doc See <a href="http://www.wxwidgets.org/manuals/2.8.12/wx_wxauipaneinfo.html#wxauipaneinfogetposition">external documentation</a>.
+-spec getPosition(This) -> integer() when
+ This::wxAuiPaneInfo().
+getPosition(#wx_ref{type=ThisT,ref=ThisRef}) ->
+ ?CLASS(ThisT,wxAuiPaneInfo),
+ wxe_util:call(?wxAuiPaneInfo_GetPosition,
+ <<ThisRef:32/?UI>>).
+
+%% @doc See <a href="http://www.wxwidgets.org/manuals/2.8.12/wx_wxauipaneinfo.html#wxauipaneinfogetfloatingposition">external documentation</a>.
+-spec getFloatingPosition(This) -> {X::integer(), Y::integer()} when
+ This::wxAuiPaneInfo().
+getFloatingPosition(#wx_ref{type=ThisT,ref=ThisRef}) ->
+ ?CLASS(ThisT,wxAuiPaneInfo),
+ wxe_util:call(?wxAuiPaneInfo_GetFloatingPosition,
+ <<ThisRef:32/?UI>>).
+
+%% @doc See <a href="http://www.wxwidgets.org/manuals/2.8.12/wx_wxauipaneinfo.html#wxauipaneinfogetfloatingsize">external documentation</a>.
+-spec getFloatingSize(This) -> {W::integer(), H::integer()} when
+ This::wxAuiPaneInfo().
+getFloatingSize(#wx_ref{type=ThisT,ref=ThisRef}) ->
+ ?CLASS(ThisT,wxAuiPaneInfo),
+ wxe_util:call(?wxAuiPaneInfo_GetFloatingSize,
+ <<ThisRef:32/?UI>>).
+
%% @doc Destroys this object, do not use object again
-spec destroy(This::wxAuiPaneInfo()) -> ok.
destroy(Obj=#wx_ref{type=Type}) ->
diff --git a/lib/wx/src/gen/wxAuiSimpleTabArt.erl b/lib/wx/src/gen/wxAuiSimpleTabArt.erl
new file mode 100644
index 0000000000..57d12e2eb4
--- /dev/null
+++ b/lib/wx/src/gen/wxAuiSimpleTabArt.erl
@@ -0,0 +1,67 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2008-2015. All Rights Reserved.
+%%
+%% Licensed under the Apache License, Version 2.0 (the "License");
+%% you may not use this file except in compliance with the License.
+%% You may obtain a copy of the License at
+%%
+%% http://www.apache.org/licenses/LICENSE-2.0
+%%
+%% Unless required by applicable law or agreed to in writing, software
+%% distributed under the License is distributed on an "AS IS" BASIS,
+%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+%% See the License for the specific language governing permissions and
+%% limitations under the License.
+%%
+%% %CopyrightEnd%
+%% This file is generated DO NOT EDIT
+
+%% @doc See external documentation: <a href="http://www.wxwidgets.org/manuals/2.8.12/wx_wxauisimpletabart.html">wxAuiSimpleTabArt</a>.
+%% <p>This class is derived (and can use functions) from:
+%% <br />{@link wxAuiTabArt}
+%% </p>
+%% @type wxAuiSimpleTabArt(). An object reference, The representation is internal
+%% and can be changed without notice. It can't be used for comparsion
+%% stored on disc or distributed for use on other nodes.
+
+-module(wxAuiSimpleTabArt).
+-include("wxe.hrl").
+-export([destroy/1,new/0]).
+
+%% inherited exports
+-export([parent_class/1,setActiveColour/2,setColour/2,setFlags/2,setMeasuringFont/2,
+ setNormalFont/2,setSelectedFont/2]).
+
+-export_type([wxAuiSimpleTabArt/0]).
+%% @hidden
+parent_class(wxAuiTabArt) -> true;
+parent_class(_Class) -> erlang:error({badtype, ?MODULE}).
+
+-type wxAuiSimpleTabArt() :: wx:wx_object().
+%% @doc See <a href="http://www.wxwidgets.org/manuals/2.8.12/wx_wxauisimpletabart.html#wxauisimpletabartwxauisimpletabart">external documentation</a>.
+-spec new() -> wxAuiSimpleTabArt().
+new() ->
+ wxe_util:construct(?wxAuiSimpleTabArt_new,
+ <<>>).
+
+%% @doc Destroys this object, do not use object again
+-spec destroy(This::wxAuiSimpleTabArt()) -> ok.
+destroy(Obj=#wx_ref{type=Type}) ->
+ ?CLASS(Type,wxAuiSimpleTabArt),
+ wxe_util:destroy(?wxAuiSimpleTabArt_destroy,Obj),
+ ok.
+ %% From wxAuiTabArt
+%% @hidden
+setActiveColour(This,Colour) -> wxAuiTabArt:setActiveColour(This,Colour).
+%% @hidden
+setColour(This,Colour) -> wxAuiTabArt:setColour(This,Colour).
+%% @hidden
+setSelectedFont(This,Font) -> wxAuiTabArt:setSelectedFont(This,Font).
+%% @hidden
+setNormalFont(This,Font) -> wxAuiTabArt:setNormalFont(This,Font).
+%% @hidden
+setMeasuringFont(This,Font) -> wxAuiTabArt:setMeasuringFont(This,Font).
+%% @hidden
+setFlags(This,Flags) -> wxAuiTabArt:setFlags(This,Flags).
diff --git a/lib/wx/src/gen/wxAuiTabArt.erl b/lib/wx/src/gen/wxAuiTabArt.erl
index 0386ef9dce..80924c0269 100644
--- a/lib/wx/src/gen/wxAuiTabArt.erl
+++ b/lib/wx/src/gen/wxAuiTabArt.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2013. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -25,7 +25,8 @@
-module(wxAuiTabArt).
-include("wxe.hrl").
--export([]).
+-export([setActiveColour/2,setColour/2,setFlags/2,setMeasuringFont/2,setNormalFont/2,
+ setSelectedFont/2]).
%% inherited exports
-export([parent_class/1]).
@@ -35,3 +36,57 @@
parent_class(_Class) -> erlang:error({badtype, ?MODULE}).
-type wxAuiTabArt() :: wx:wx_object().
+%% @doc See <a href="http://www.wxwidgets.org/manuals/2.8.12/wx_wxauitabart.html#wxauitabartsetflags">external documentation</a>.
+-spec setFlags(This, Flags) -> ok when
+ This::wxAuiTabArt(), Flags::integer().
+setFlags(#wx_ref{type=ThisT,ref=ThisRef},Flags)
+ when is_integer(Flags) ->
+ ?CLASS(ThisT,wxAuiTabArt),
+ wxe_util:cast(?wxAuiTabArt_SetFlags,
+ <<ThisRef:32/?UI,Flags:32/?UI>>).
+
+%% @doc See <a href="http://www.wxwidgets.org/manuals/2.8.12/wx_wxauitabart.html#wxauitabartsetmeasuringfont">external documentation</a>.
+-spec setMeasuringFont(This, Font) -> ok when
+ This::wxAuiTabArt(), Font::wxFont:wxFont().
+setMeasuringFont(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=FontT,ref=FontRef}) ->
+ ?CLASS(ThisT,wxAuiTabArt),
+ ?CLASS(FontT,wxFont),
+ wxe_util:cast(?wxAuiTabArt_SetMeasuringFont,
+ <<ThisRef:32/?UI,FontRef:32/?UI>>).
+
+%% @doc See <a href="http://www.wxwidgets.org/manuals/2.8.12/wx_wxauitabart.html#wxauitabartsetnormalfont">external documentation</a>.
+-spec setNormalFont(This, Font) -> ok when
+ This::wxAuiTabArt(), Font::wxFont:wxFont().
+setNormalFont(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=FontT,ref=FontRef}) ->
+ ?CLASS(ThisT,wxAuiTabArt),
+ ?CLASS(FontT,wxFont),
+ wxe_util:cast(?wxAuiTabArt_SetNormalFont,
+ <<ThisRef:32/?UI,FontRef:32/?UI>>).
+
+%% @doc See <a href="http://www.wxwidgets.org/manuals/2.8.12/wx_wxauitabart.html#wxauitabartsetselectedfont">external documentation</a>.
+-spec setSelectedFont(This, Font) -> ok when
+ This::wxAuiTabArt(), Font::wxFont:wxFont().
+setSelectedFont(#wx_ref{type=ThisT,ref=ThisRef},#wx_ref{type=FontT,ref=FontRef}) ->
+ ?CLASS(ThisT,wxAuiTabArt),
+ ?CLASS(FontT,wxFont),
+ wxe_util:cast(?wxAuiTabArt_SetSelectedFont,
+ <<ThisRef:32/?UI,FontRef:32/?UI>>).
+
+%% @doc See <a href="http://www.wxwidgets.org/manuals/2.8.12/wx_wxauitabart.html#wxauitabartsetcolour">external documentation</a>.
+-spec setColour(This, Colour) -> ok when
+ This::wxAuiTabArt(), Colour::wx:wx_colour().
+setColour(#wx_ref{type=ThisT,ref=ThisRef},Colour)
+ when tuple_size(Colour) =:= 3; tuple_size(Colour) =:= 4 ->
+ ?CLASS(ThisT,wxAuiTabArt),
+ wxe_util:cast(?wxAuiTabArt_SetColour,
+ <<ThisRef:32/?UI,(wxe_util:colour_bin(Colour)):16/binary>>).
+
+%% @doc See <a href="http://www.wxwidgets.org/manuals/2.8.12/wx_wxauitabart.html#wxauitabartsetactivecolour">external documentation</a>.
+-spec setActiveColour(This, Colour) -> ok when
+ This::wxAuiTabArt(), Colour::wx:wx_colour().
+setActiveColour(#wx_ref{type=ThisT,ref=ThisRef},Colour)
+ when tuple_size(Colour) =:= 3; tuple_size(Colour) =:= 4 ->
+ ?CLASS(ThisT,wxAuiTabArt),
+ wxe_util:cast(?wxAuiTabArt_SetActiveColour,
+ <<ThisRef:32/?UI,(wxe_util:colour_bin(Colour)):16/binary>>).
+
diff --git a/lib/wx/src/gen/wxe_debug.hrl b/lib/wx/src/gen/wxe_debug.hrl
index 58fbe8d061..2cb73c0fed 100644
--- a/lib/wx/src/gen/wxe_debug.hrl
+++ b/lib/wx/src/gen/wxe_debug.hrl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2014. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -2440,907 +2440,929 @@ wxdebug_table() ->
{2650, {wxAuiPaneInfo, top, 0}},
{2651, {wxAuiPaneInfo, topDockable, 1}},
{2652, {wxAuiPaneInfo, window, 1}},
- {2653, {wxAuiNotebook, new_0, 0}},
- {2654, {wxAuiNotebook, new_2, 2}},
- {2655, {wxAuiNotebook, addPage, 3}},
- {2656, {wxAuiNotebook, create, 2}},
- {2657, {wxAuiNotebook, deletePage, 1}},
- {2658, {wxAuiNotebook, getArtProvider, 0}},
- {2659, {wxAuiNotebook, getPage, 1}},
- {2660, {wxAuiNotebook, getPageBitmap, 1}},
- {2661, {wxAuiNotebook, getPageCount, 0}},
- {2662, {wxAuiNotebook, getPageIndex, 1}},
- {2663, {wxAuiNotebook, getPageText, 1}},
- {2664, {wxAuiNotebook, getSelection, 0}},
- {2665, {wxAuiNotebook, insertPage, 4}},
- {2666, {wxAuiNotebook, removePage, 1}},
- {2667, {wxAuiNotebook, setArtProvider, 1}},
- {2668, {wxAuiNotebook, setFont, 1}},
- {2669, {wxAuiNotebook, setPageBitmap, 2}},
- {2670, {wxAuiNotebook, setPageText, 2}},
- {2671, {wxAuiNotebook, setSelection, 1}},
- {2672, {wxAuiNotebook, setTabCtrlHeight, 1}},
- {2673, {wxAuiNotebook, setUniformBitmapSize, 1}},
- {2674, {wxAuiNotebook, 'Destroy', undefined}},
- {2675, {wxMDIParentFrame, new_0, 0}},
- {2676, {wxMDIParentFrame, new_4, 4}},
- {2677, {wxMDIParentFrame, destruct, 0}},
- {2678, {wxMDIParentFrame, activateNext, 0}},
- {2679, {wxMDIParentFrame, activatePrevious, 0}},
- {2680, {wxMDIParentFrame, arrangeIcons, 0}},
- {2681, {wxMDIParentFrame, cascade, 0}},
- {2682, {wxMDIParentFrame, create, 4}},
- {2683, {wxMDIParentFrame, getActiveChild, 0}},
- {2684, {wxMDIParentFrame, getClientWindow, 0}},
- {2685, {wxMDIParentFrame, tile, 1}},
- {2686, {wxMDIChildFrame, new_0, 0}},
- {2687, {wxMDIChildFrame, new_4, 4}},
- {2688, {wxMDIChildFrame, destruct, 0}},
- {2689, {wxMDIChildFrame, activate, 0}},
- {2690, {wxMDIChildFrame, create, 4}},
- {2691, {wxMDIChildFrame, maximize, 1}},
- {2692, {wxMDIChildFrame, restore, 0}},
- {2693, {wxMDIClientWindow, new_0, 0}},
- {2694, {wxMDIClientWindow, new_2, 2}},
- {2695, {wxMDIClientWindow, destruct, 0}},
- {2696, {wxMDIClientWindow, createClient, 2}},
- {2697, {wxLayoutAlgorithm, new, 0}},
- {2698, {wxLayoutAlgorithm, layoutFrame, 2}},
- {2699, {wxLayoutAlgorithm, layoutMDIFrame, 2}},
- {2700, {wxLayoutAlgorithm, layoutWindow, 2}},
- {2701, {wxLayoutAlgorithm, 'Destroy', undefined}},
- {2702, {wxEvent, getId, 0}},
- {2703, {wxEvent, getSkipped, 0}},
- {2704, {wxEvent, getTimestamp, 0}},
- {2705, {wxEvent, isCommandEvent, 0}},
- {2706, {wxEvent, resumePropagation, 1}},
- {2707, {wxEvent, shouldPropagate, 0}},
- {2708, {wxEvent, skip, 1}},
- {2709, {wxEvent, stopPropagation, 0}},
- {2710, {wxCommandEvent, getClientData, 0}},
- {2711, {wxCommandEvent, getExtraLong, 0}},
- {2712, {wxCommandEvent, getInt, 0}},
- {2713, {wxCommandEvent, getSelection, 0}},
- {2714, {wxCommandEvent, getString, 0}},
- {2715, {wxCommandEvent, isChecked, 0}},
- {2716, {wxCommandEvent, isSelection, 0}},
- {2717, {wxCommandEvent, setInt, 1}},
- {2718, {wxCommandEvent, setString, 1}},
- {2719, {wxScrollEvent, getOrientation, 0}},
- {2720, {wxScrollEvent, getPosition, 0}},
- {2721, {wxScrollWinEvent, getOrientation, 0}},
- {2722, {wxScrollWinEvent, getPosition, 0}},
- {2723, {wxMouseEvent, altDown, 0}},
- {2724, {wxMouseEvent, button, 1}},
- {2725, {wxMouseEvent, buttonDClick, 1}},
- {2726, {wxMouseEvent, buttonDown, 1}},
- {2727, {wxMouseEvent, buttonUp, 1}},
- {2728, {wxMouseEvent, cmdDown, 0}},
- {2729, {wxMouseEvent, controlDown, 0}},
- {2730, {wxMouseEvent, dragging, 0}},
- {2731, {wxMouseEvent, entering, 0}},
- {2732, {wxMouseEvent, getButton, 0}},
- {2735, {wxMouseEvent, getPosition, 0}},
- {2736, {wxMouseEvent, getLogicalPosition, 1}},
- {2737, {wxMouseEvent, getLinesPerAction, 0}},
- {2738, {wxMouseEvent, getWheelRotation, 0}},
- {2739, {wxMouseEvent, getWheelDelta, 0}},
- {2740, {wxMouseEvent, getX, 0}},
- {2741, {wxMouseEvent, getY, 0}},
- {2742, {wxMouseEvent, isButton, 0}},
- {2743, {wxMouseEvent, isPageScroll, 0}},
- {2744, {wxMouseEvent, leaving, 0}},
- {2745, {wxMouseEvent, leftDClick, 0}},
- {2746, {wxMouseEvent, leftDown, 0}},
- {2747, {wxMouseEvent, leftIsDown, 0}},
- {2748, {wxMouseEvent, leftUp, 0}},
- {2749, {wxMouseEvent, metaDown, 0}},
- {2750, {wxMouseEvent, middleDClick, 0}},
- {2751, {wxMouseEvent, middleDown, 0}},
- {2752, {wxMouseEvent, middleIsDown, 0}},
- {2753, {wxMouseEvent, middleUp, 0}},
- {2754, {wxMouseEvent, moving, 0}},
- {2755, {wxMouseEvent, rightDClick, 0}},
- {2756, {wxMouseEvent, rightDown, 0}},
- {2757, {wxMouseEvent, rightIsDown, 0}},
- {2758, {wxMouseEvent, rightUp, 0}},
- {2759, {wxMouseEvent, shiftDown, 0}},
- {2760, {wxSetCursorEvent, getCursor, 0}},
- {2761, {wxSetCursorEvent, getX, 0}},
- {2762, {wxSetCursorEvent, getY, 0}},
- {2763, {wxSetCursorEvent, hasCursor, 0}},
- {2764, {wxSetCursorEvent, setCursor, 1}},
- {2765, {wxKeyEvent, altDown, 0}},
- {2766, {wxKeyEvent, cmdDown, 0}},
- {2767, {wxKeyEvent, controlDown, 0}},
- {2768, {wxKeyEvent, getKeyCode, 0}},
- {2769, {wxKeyEvent, getModifiers, 0}},
- {2772, {wxKeyEvent, getPosition, 0}},
- {2773, {wxKeyEvent, getRawKeyCode, 0}},
- {2774, {wxKeyEvent, getRawKeyFlags, 0}},
- {2775, {wxKeyEvent, getUnicodeKey, 0}},
- {2776, {wxKeyEvent, getX, 0}},
- {2777, {wxKeyEvent, getY, 0}},
- {2778, {wxKeyEvent, hasModifiers, 0}},
- {2779, {wxKeyEvent, metaDown, 0}},
- {2780, {wxKeyEvent, shiftDown, 0}},
- {2781, {wxSizeEvent, getSize, 0}},
- {2782, {wxMoveEvent, getPosition, 0}},
- {2783, {wxEraseEvent, getDC, 0}},
- {2784, {wxFocusEvent, getWindow, 0}},
- {2785, {wxChildFocusEvent, getWindow, 0}},
- {2786, {wxMenuEvent, getMenu, 0}},
- {2787, {wxMenuEvent, getMenuId, 0}},
- {2788, {wxMenuEvent, isPopup, 0}},
- {2789, {wxCloseEvent, canVeto, 0}},
- {2790, {wxCloseEvent, getLoggingOff, 0}},
- {2791, {wxCloseEvent, setCanVeto, 1}},
- {2792, {wxCloseEvent, setLoggingOff, 1}},
- {2793, {wxCloseEvent, veto, 1}},
- {2794, {wxShowEvent, setShow, 1}},
- {2795, {wxShowEvent, getShow, 0}},
- {2796, {wxIconizeEvent, iconized, 0}},
- {2797, {wxJoystickEvent, buttonDown, 1}},
- {2798, {wxJoystickEvent, buttonIsDown, 1}},
- {2799, {wxJoystickEvent, buttonUp, 1}},
- {2800, {wxJoystickEvent, getButtonChange, 0}},
- {2801, {wxJoystickEvent, getButtonState, 0}},
- {2802, {wxJoystickEvent, getJoystick, 0}},
- {2803, {wxJoystickEvent, getPosition, 0}},
- {2804, {wxJoystickEvent, getZPosition, 0}},
- {2805, {wxJoystickEvent, isButton, 0}},
- {2806, {wxJoystickEvent, isMove, 0}},
- {2807, {wxJoystickEvent, isZMove, 0}},
- {2808, {wxUpdateUIEvent, canUpdate, 1}},
- {2809, {wxUpdateUIEvent, check, 1}},
- {2810, {wxUpdateUIEvent, enable, 1}},
- {2811, {wxUpdateUIEvent, show, 1}},
- {2812, {wxUpdateUIEvent, getChecked, 0}},
- {2813, {wxUpdateUIEvent, getEnabled, 0}},
- {2814, {wxUpdateUIEvent, getShown, 0}},
- {2815, {wxUpdateUIEvent, getSetChecked, 0}},
- {2816, {wxUpdateUIEvent, getSetEnabled, 0}},
- {2817, {wxUpdateUIEvent, getSetShown, 0}},
- {2818, {wxUpdateUIEvent, getSetText, 0}},
- {2819, {wxUpdateUIEvent, getText, 0}},
- {2820, {wxUpdateUIEvent, getMode, 0}},
- {2821, {wxUpdateUIEvent, getUpdateInterval, 0}},
- {2822, {wxUpdateUIEvent, resetUpdateTime, 0}},
- {2823, {wxUpdateUIEvent, setMode, 1}},
- {2824, {wxUpdateUIEvent, setText, 1}},
- {2825, {wxUpdateUIEvent, setUpdateInterval, 1}},
- {2826, {wxMouseCaptureChangedEvent, getCapturedWindow, 0}},
- {2827, {wxPaletteChangedEvent, setChangedWindow, 1}},
- {2828, {wxPaletteChangedEvent, getChangedWindow, 0}},
- {2829, {wxQueryNewPaletteEvent, setPaletteRealized, 1}},
- {2830, {wxQueryNewPaletteEvent, getPaletteRealized, 0}},
- {2831, {wxNavigationKeyEvent, getDirection, 0}},
- {2832, {wxNavigationKeyEvent, setDirection, 1}},
- {2833, {wxNavigationKeyEvent, isWindowChange, 0}},
- {2834, {wxNavigationKeyEvent, setWindowChange, 1}},
- {2835, {wxNavigationKeyEvent, isFromTab, 0}},
- {2836, {wxNavigationKeyEvent, setFromTab, 1}},
- {2837, {wxNavigationKeyEvent, getCurrentFocus, 0}},
- {2838, {wxNavigationKeyEvent, setCurrentFocus, 1}},
- {2839, {wxHelpEvent, getOrigin, 0}},
- {2840, {wxHelpEvent, getPosition, 0}},
- {2841, {wxHelpEvent, setOrigin, 1}},
- {2842, {wxHelpEvent, setPosition, 1}},
- {2843, {wxContextMenuEvent, getPosition, 0}},
- {2844, {wxContextMenuEvent, setPosition, 1}},
- {2845, {wxIdleEvent, canSend, 1}},
- {2846, {wxIdleEvent, getMode, 0}},
- {2847, {wxIdleEvent, requestMore, 1}},
- {2848, {wxIdleEvent, moreRequested, 0}},
- {2849, {wxIdleEvent, setMode, 1}},
- {2850, {wxGridEvent, altDown, 0}},
- {2851, {wxGridEvent, controlDown, 0}},
- {2852, {wxGridEvent, getCol, 0}},
- {2853, {wxGridEvent, getPosition, 0}},
- {2854, {wxGridEvent, getRow, 0}},
- {2855, {wxGridEvent, metaDown, 0}},
- {2856, {wxGridEvent, selecting, 0}},
- {2857, {wxGridEvent, shiftDown, 0}},
- {2858, {wxNotifyEvent, allow, 0}},
- {2859, {wxNotifyEvent, isAllowed, 0}},
- {2860, {wxNotifyEvent, veto, 0}},
- {2861, {wxSashEvent, getEdge, 0}},
- {2862, {wxSashEvent, getDragRect, 0}},
- {2863, {wxSashEvent, getDragStatus, 0}},
- {2864, {wxListEvent, getCacheFrom, 0}},
- {2865, {wxListEvent, getCacheTo, 0}},
- {2866, {wxListEvent, getKeyCode, 0}},
- {2867, {wxListEvent, getIndex, 0}},
- {2868, {wxListEvent, getColumn, 0}},
- {2869, {wxListEvent, getPoint, 0}},
- {2870, {wxListEvent, getLabel, 0}},
- {2871, {wxListEvent, getText, 0}},
- {2872, {wxListEvent, getImage, 0}},
- {2873, {wxListEvent, getData, 0}},
- {2874, {wxListEvent, getMask, 0}},
- {2875, {wxListEvent, getItem, 0}},
- {2876, {wxListEvent, isEditCancelled, 0}},
- {2877, {wxDateEvent, getDate, 0}},
- {2878, {wxCalendarEvent, getWeekDay, 0}},
- {2879, {wxFileDirPickerEvent, getPath, 0}},
- {2880, {wxColourPickerEvent, getColour, 0}},
- {2881, {wxFontPickerEvent, getFont, 0}},
- {2882, {wxStyledTextEvent, getPosition, 0}},
- {2883, {wxStyledTextEvent, getKey, 0}},
- {2884, {wxStyledTextEvent, getModifiers, 0}},
- {2885, {wxStyledTextEvent, getModificationType, 0}},
- {2886, {wxStyledTextEvent, getText, 0}},
- {2887, {wxStyledTextEvent, getLength, 0}},
- {2888, {wxStyledTextEvent, getLinesAdded, 0}},
- {2889, {wxStyledTextEvent, getLine, 0}},
- {2890, {wxStyledTextEvent, getFoldLevelNow, 0}},
- {2891, {wxStyledTextEvent, getFoldLevelPrev, 0}},
- {2892, {wxStyledTextEvent, getMargin, 0}},
- {2893, {wxStyledTextEvent, getMessage, 0}},
- {2894, {wxStyledTextEvent, getWParam, 0}},
- {2895, {wxStyledTextEvent, getLParam, 0}},
- {2896, {wxStyledTextEvent, getListType, 0}},
- {2897, {wxStyledTextEvent, getX, 0}},
- {2898, {wxStyledTextEvent, getY, 0}},
- {2899, {wxStyledTextEvent, getDragText, 0}},
- {2900, {wxStyledTextEvent, getDragAllowMove, 0}},
- {2901, {wxStyledTextEvent, getDragResult, 0}},
- {2902, {wxStyledTextEvent, getShift, 0}},
- {2903, {wxStyledTextEvent, getControl, 0}},
- {2904, {wxStyledTextEvent, getAlt, 0}},
- {2905, {utils, getKeyState, 1}},
- {2906, {utils, getMousePosition, 2}},
- {2907, {utils, getMouseState, 0}},
- {2908, {utils, setDetectableAutoRepeat, 1}},
- {2909, {utils, bell, 0}},
- {2910, {utils, findMenuItemId, 3}},
- {2911, {utils, genericFindWindowAtPoint, 1}},
- {2912, {utils, findWindowAtPoint, 1}},
- {2913, {utils, beginBusyCursor, 1}},
- {2914, {utils, endBusyCursor, 0}},
- {2915, {utils, isBusy, 0}},
- {2916, {utils, shutdown, 1}},
- {2917, {utils, shell, 1}},
- {2918, {utils, launchDefaultBrowser, 2}},
- {2919, {utils, getEmailAddress, 0}},
- {2920, {utils, getUserId, 0}},
- {2921, {utils, getHomeDir, 0}},
- {2922, {utils, newId, 0}},
- {2923, {utils, registerId, 1}},
- {2924, {utils, getCurrentId, 0}},
- {2925, {utils, getOsDescription, 0}},
- {2926, {utils, isPlatformLittleEndian, 0}},
- {2927, {utils, isPlatform64Bit, 0}},
- {2928, {gdicmn, displaySize, 2}},
- {2929, {gdicmn, setCursor, 1}},
- {2930, {wxPrintout, new, 1}},
- {2931, {wxPrintout, destruct, 0}},
- {2932, {wxPrintout, getDC, 0}},
- {2933, {wxPrintout, getPageSizeMM, 2}},
- {2934, {wxPrintout, getPageSizePixels, 2}},
- {2935, {wxPrintout, getPaperRectPixels, 0}},
- {2936, {wxPrintout, getPPIPrinter, 2}},
- {2937, {wxPrintout, getPPIScreen, 2}},
- {2938, {wxPrintout, getTitle, 0}},
- {2939, {wxPrintout, isPreview, 0}},
- {2940, {wxPrintout, fitThisSizeToPaper, 1}},
- {2941, {wxPrintout, fitThisSizeToPage, 1}},
- {2942, {wxPrintout, fitThisSizeToPageMargins, 2}},
- {2943, {wxPrintout, mapScreenSizeToPaper, 0}},
- {2944, {wxPrintout, mapScreenSizeToPage, 0}},
- {2945, {wxPrintout, mapScreenSizeToPageMargins, 1}},
- {2946, {wxPrintout, mapScreenSizeToDevice, 0}},
- {2947, {wxPrintout, getLogicalPaperRect, 0}},
- {2948, {wxPrintout, getLogicalPageRect, 0}},
- {2949, {wxPrintout, getLogicalPageMarginsRect, 1}},
- {2950, {wxPrintout, setLogicalOrigin, 2}},
- {2951, {wxPrintout, offsetLogicalOrigin, 2}},
- {2952, {wxStyledTextCtrl, new_2, 2}},
- {2953, {wxStyledTextCtrl, new_0, 0}},
- {2954, {wxStyledTextCtrl, destruct, 0}},
- {2955, {wxStyledTextCtrl, create, 2}},
- {2956, {wxStyledTextCtrl, addText, 1}},
- {2957, {wxStyledTextCtrl, addStyledText, 1}},
- {2958, {wxStyledTextCtrl, insertText, 2}},
- {2959, {wxStyledTextCtrl, clearAll, 0}},
- {2960, {wxStyledTextCtrl, clearDocumentStyle, 0}},
- {2961, {wxStyledTextCtrl, getLength, 0}},
- {2962, {wxStyledTextCtrl, getCharAt, 1}},
- {2963, {wxStyledTextCtrl, getCurrentPos, 0}},
- {2964, {wxStyledTextCtrl, getAnchor, 0}},
- {2965, {wxStyledTextCtrl, getStyleAt, 1}},
- {2966, {wxStyledTextCtrl, redo, 0}},
- {2967, {wxStyledTextCtrl, setUndoCollection, 1}},
- {2968, {wxStyledTextCtrl, selectAll, 0}},
- {2969, {wxStyledTextCtrl, setSavePoint, 0}},
- {2970, {wxStyledTextCtrl, getStyledText, 2}},
- {2971, {wxStyledTextCtrl, canRedo, 0}},
- {2972, {wxStyledTextCtrl, markerLineFromHandle, 1}},
- {2973, {wxStyledTextCtrl, markerDeleteHandle, 1}},
- {2974, {wxStyledTextCtrl, getUndoCollection, 0}},
- {2975, {wxStyledTextCtrl, getViewWhiteSpace, 0}},
- {2976, {wxStyledTextCtrl, setViewWhiteSpace, 1}},
- {2977, {wxStyledTextCtrl, positionFromPoint, 1}},
- {2978, {wxStyledTextCtrl, positionFromPointClose, 2}},
- {2979, {wxStyledTextCtrl, gotoLine, 1}},
- {2980, {wxStyledTextCtrl, gotoPos, 1}},
- {2981, {wxStyledTextCtrl, setAnchor, 1}},
- {2982, {wxStyledTextCtrl, getCurLine, 1}},
- {2983, {wxStyledTextCtrl, getEndStyled, 0}},
- {2984, {wxStyledTextCtrl, convertEOLs, 1}},
- {2985, {wxStyledTextCtrl, getEOLMode, 0}},
- {2986, {wxStyledTextCtrl, setEOLMode, 1}},
- {2987, {wxStyledTextCtrl, startStyling, 2}},
- {2988, {wxStyledTextCtrl, setStyling, 2}},
- {2989, {wxStyledTextCtrl, getBufferedDraw, 0}},
- {2990, {wxStyledTextCtrl, setBufferedDraw, 1}},
- {2991, {wxStyledTextCtrl, setTabWidth, 1}},
- {2992, {wxStyledTextCtrl, getTabWidth, 0}},
- {2993, {wxStyledTextCtrl, setCodePage, 1}},
- {2994, {wxStyledTextCtrl, markerDefine, 3}},
- {2995, {wxStyledTextCtrl, markerSetForeground, 2}},
- {2996, {wxStyledTextCtrl, markerSetBackground, 2}},
- {2997, {wxStyledTextCtrl, markerAdd, 2}},
- {2998, {wxStyledTextCtrl, markerDelete, 2}},
- {2999, {wxStyledTextCtrl, markerDeleteAll, 1}},
- {3000, {wxStyledTextCtrl, markerGet, 1}},
- {3001, {wxStyledTextCtrl, markerNext, 2}},
- {3002, {wxStyledTextCtrl, markerPrevious, 2}},
- {3003, {wxStyledTextCtrl, markerDefineBitmap, 2}},
- {3004, {wxStyledTextCtrl, markerAddSet, 2}},
- {3005, {wxStyledTextCtrl, markerSetAlpha, 2}},
- {3006, {wxStyledTextCtrl, setMarginType, 2}},
- {3007, {wxStyledTextCtrl, getMarginType, 1}},
- {3008, {wxStyledTextCtrl, setMarginWidth, 2}},
- {3009, {wxStyledTextCtrl, getMarginWidth, 1}},
- {3010, {wxStyledTextCtrl, setMarginMask, 2}},
- {3011, {wxStyledTextCtrl, getMarginMask, 1}},
- {3012, {wxStyledTextCtrl, setMarginSensitive, 2}},
- {3013, {wxStyledTextCtrl, getMarginSensitive, 1}},
- {3014, {wxStyledTextCtrl, styleClearAll, 0}},
- {3015, {wxStyledTextCtrl, styleSetForeground, 2}},
- {3016, {wxStyledTextCtrl, styleSetBackground, 2}},
- {3017, {wxStyledTextCtrl, styleSetBold, 2}},
- {3018, {wxStyledTextCtrl, styleSetItalic, 2}},
- {3019, {wxStyledTextCtrl, styleSetSize, 2}},
- {3020, {wxStyledTextCtrl, styleSetFaceName, 2}},
- {3021, {wxStyledTextCtrl, styleSetEOLFilled, 2}},
- {3022, {wxStyledTextCtrl, styleResetDefault, 0}},
- {3023, {wxStyledTextCtrl, styleSetUnderline, 2}},
- {3024, {wxStyledTextCtrl, styleSetCase, 2}},
- {3025, {wxStyledTextCtrl, styleSetHotSpot, 2}},
- {3026, {wxStyledTextCtrl, setSelForeground, 2}},
- {3027, {wxStyledTextCtrl, setSelBackground, 2}},
- {3028, {wxStyledTextCtrl, getSelAlpha, 0}},
- {3029, {wxStyledTextCtrl, setSelAlpha, 1}},
- {3030, {wxStyledTextCtrl, setCaretForeground, 1}},
- {3031, {wxStyledTextCtrl, cmdKeyAssign, 3}},
- {3032, {wxStyledTextCtrl, cmdKeyClear, 2}},
- {3033, {wxStyledTextCtrl, cmdKeyClearAll, 0}},
- {3034, {wxStyledTextCtrl, setStyleBytes, 2}},
- {3035, {wxStyledTextCtrl, styleSetVisible, 2}},
- {3036, {wxStyledTextCtrl, getCaretPeriod, 0}},
- {3037, {wxStyledTextCtrl, setCaretPeriod, 1}},
- {3038, {wxStyledTextCtrl, setWordChars, 1}},
- {3039, {wxStyledTextCtrl, beginUndoAction, 0}},
- {3040, {wxStyledTextCtrl, endUndoAction, 0}},
- {3041, {wxStyledTextCtrl, indicatorSetStyle, 2}},
- {3042, {wxStyledTextCtrl, indicatorGetStyle, 1}},
- {3043, {wxStyledTextCtrl, indicatorSetForeground, 2}},
- {3044, {wxStyledTextCtrl, indicatorGetForeground, 1}},
- {3045, {wxStyledTextCtrl, setWhitespaceForeground, 2}},
- {3046, {wxStyledTextCtrl, setWhitespaceBackground, 2}},
- {3047, {wxStyledTextCtrl, getStyleBits, 0}},
- {3048, {wxStyledTextCtrl, setLineState, 2}},
- {3049, {wxStyledTextCtrl, getLineState, 1}},
- {3050, {wxStyledTextCtrl, getMaxLineState, 0}},
- {3051, {wxStyledTextCtrl, getCaretLineVisible, 0}},
- {3052, {wxStyledTextCtrl, setCaretLineVisible, 1}},
- {3053, {wxStyledTextCtrl, getCaretLineBackground, 0}},
- {3054, {wxStyledTextCtrl, setCaretLineBackground, 1}},
- {3055, {wxStyledTextCtrl, autoCompShow, 2}},
- {3056, {wxStyledTextCtrl, autoCompCancel, 0}},
- {3057, {wxStyledTextCtrl, autoCompActive, 0}},
- {3058, {wxStyledTextCtrl, autoCompPosStart, 0}},
- {3059, {wxStyledTextCtrl, autoCompComplete, 0}},
- {3060, {wxStyledTextCtrl, autoCompStops, 1}},
- {3061, {wxStyledTextCtrl, autoCompSetSeparator, 1}},
- {3062, {wxStyledTextCtrl, autoCompGetSeparator, 0}},
- {3063, {wxStyledTextCtrl, autoCompSelect, 1}},
- {3064, {wxStyledTextCtrl, autoCompSetCancelAtStart, 1}},
- {3065, {wxStyledTextCtrl, autoCompGetCancelAtStart, 0}},
- {3066, {wxStyledTextCtrl, autoCompSetFillUps, 1}},
- {3067, {wxStyledTextCtrl, autoCompSetChooseSingle, 1}},
- {3068, {wxStyledTextCtrl, autoCompGetChooseSingle, 0}},
- {3069, {wxStyledTextCtrl, autoCompSetIgnoreCase, 1}},
- {3070, {wxStyledTextCtrl, autoCompGetIgnoreCase, 0}},
- {3071, {wxStyledTextCtrl, userListShow, 2}},
- {3072, {wxStyledTextCtrl, autoCompSetAutoHide, 1}},
- {3073, {wxStyledTextCtrl, autoCompGetAutoHide, 0}},
- {3074, {wxStyledTextCtrl, autoCompSetDropRestOfWord, 1}},
- {3075, {wxStyledTextCtrl, autoCompGetDropRestOfWord, 0}},
- {3076, {wxStyledTextCtrl, registerImage, 2}},
- {3077, {wxStyledTextCtrl, clearRegisteredImages, 0}},
- {3078, {wxStyledTextCtrl, autoCompGetTypeSeparator, 0}},
- {3079, {wxStyledTextCtrl, autoCompSetTypeSeparator, 1}},
- {3080, {wxStyledTextCtrl, autoCompSetMaxWidth, 1}},
- {3081, {wxStyledTextCtrl, autoCompGetMaxWidth, 0}},
- {3082, {wxStyledTextCtrl, autoCompSetMaxHeight, 1}},
- {3083, {wxStyledTextCtrl, autoCompGetMaxHeight, 0}},
- {3084, {wxStyledTextCtrl, setIndent, 1}},
- {3085, {wxStyledTextCtrl, getIndent, 0}},
- {3086, {wxStyledTextCtrl, setUseTabs, 1}},
- {3087, {wxStyledTextCtrl, getUseTabs, 0}},
- {3088, {wxStyledTextCtrl, setLineIndentation, 2}},
- {3089, {wxStyledTextCtrl, getLineIndentation, 1}},
- {3090, {wxStyledTextCtrl, getLineIndentPosition, 1}},
- {3091, {wxStyledTextCtrl, getColumn, 1}},
- {3092, {wxStyledTextCtrl, setUseHorizontalScrollBar, 1}},
- {3093, {wxStyledTextCtrl, getUseHorizontalScrollBar, 0}},
- {3094, {wxStyledTextCtrl, setIndentationGuides, 1}},
- {3095, {wxStyledTextCtrl, getIndentationGuides, 0}},
- {3096, {wxStyledTextCtrl, setHighlightGuide, 1}},
- {3097, {wxStyledTextCtrl, getHighlightGuide, 0}},
- {3098, {wxStyledTextCtrl, getLineEndPosition, 1}},
- {3099, {wxStyledTextCtrl, getCodePage, 0}},
- {3100, {wxStyledTextCtrl, getCaretForeground, 0}},
- {3101, {wxStyledTextCtrl, getReadOnly, 0}},
- {3102, {wxStyledTextCtrl, setCurrentPos, 1}},
- {3103, {wxStyledTextCtrl, setSelectionStart, 1}},
- {3104, {wxStyledTextCtrl, getSelectionStart, 0}},
- {3105, {wxStyledTextCtrl, setSelectionEnd, 1}},
- {3106, {wxStyledTextCtrl, getSelectionEnd, 0}},
- {3107, {wxStyledTextCtrl, setPrintMagnification, 1}},
- {3108, {wxStyledTextCtrl, getPrintMagnification, 0}},
- {3109, {wxStyledTextCtrl, setPrintColourMode, 1}},
- {3110, {wxStyledTextCtrl, getPrintColourMode, 0}},
- {3111, {wxStyledTextCtrl, findText, 4}},
- {3112, {wxStyledTextCtrl, formatRange, 7}},
- {3113, {wxStyledTextCtrl, getFirstVisibleLine, 0}},
- {3114, {wxStyledTextCtrl, getLine, 1}},
- {3115, {wxStyledTextCtrl, getLineCount, 0}},
- {3116, {wxStyledTextCtrl, setMarginLeft, 1}},
- {3117, {wxStyledTextCtrl, getMarginLeft, 0}},
- {3118, {wxStyledTextCtrl, setMarginRight, 1}},
- {3119, {wxStyledTextCtrl, getMarginRight, 0}},
- {3120, {wxStyledTextCtrl, getModify, 0}},
- {3121, {wxStyledTextCtrl, setSelection, 2}},
- {3122, {wxStyledTextCtrl, getSelectedText, 0}},
- {3123, {wxStyledTextCtrl, getTextRange, 2}},
- {3124, {wxStyledTextCtrl, hideSelection, 1}},
- {3125, {wxStyledTextCtrl, lineFromPosition, 1}},
- {3126, {wxStyledTextCtrl, positionFromLine, 1}},
- {3127, {wxStyledTextCtrl, lineScroll, 2}},
- {3128, {wxStyledTextCtrl, ensureCaretVisible, 0}},
- {3129, {wxStyledTextCtrl, replaceSelection, 1}},
- {3130, {wxStyledTextCtrl, setReadOnly, 1}},
- {3131, {wxStyledTextCtrl, canPaste, 0}},
- {3132, {wxStyledTextCtrl, canUndo, 0}},
- {3133, {wxStyledTextCtrl, emptyUndoBuffer, 0}},
- {3134, {wxStyledTextCtrl, undo, 0}},
- {3135, {wxStyledTextCtrl, cut, 0}},
- {3136, {wxStyledTextCtrl, copy, 0}},
- {3137, {wxStyledTextCtrl, paste, 0}},
- {3138, {wxStyledTextCtrl, clear, 0}},
- {3139, {wxStyledTextCtrl, setText, 1}},
- {3140, {wxStyledTextCtrl, getText, 0}},
- {3141, {wxStyledTextCtrl, getTextLength, 0}},
- {3142, {wxStyledTextCtrl, getOvertype, 0}},
- {3143, {wxStyledTextCtrl, setCaretWidth, 1}},
- {3144, {wxStyledTextCtrl, getCaretWidth, 0}},
- {3145, {wxStyledTextCtrl, setTargetStart, 1}},
- {3146, {wxStyledTextCtrl, getTargetStart, 0}},
- {3147, {wxStyledTextCtrl, setTargetEnd, 1}},
- {3148, {wxStyledTextCtrl, getTargetEnd, 0}},
- {3149, {wxStyledTextCtrl, replaceTarget, 1}},
- {3150, {wxStyledTextCtrl, searchInTarget, 1}},
- {3151, {wxStyledTextCtrl, setSearchFlags, 1}},
- {3152, {wxStyledTextCtrl, getSearchFlags, 0}},
- {3153, {wxStyledTextCtrl, callTipShow, 2}},
- {3154, {wxStyledTextCtrl, callTipCancel, 0}},
- {3155, {wxStyledTextCtrl, callTipActive, 0}},
- {3156, {wxStyledTextCtrl, callTipPosAtStart, 0}},
- {3157, {wxStyledTextCtrl, callTipSetHighlight, 2}},
- {3158, {wxStyledTextCtrl, callTipSetBackground, 1}},
- {3159, {wxStyledTextCtrl, callTipSetForeground, 1}},
- {3160, {wxStyledTextCtrl, callTipSetForegroundHighlight, 1}},
- {3161, {wxStyledTextCtrl, callTipUseStyle, 1}},
- {3162, {wxStyledTextCtrl, visibleFromDocLine, 1}},
- {3163, {wxStyledTextCtrl, docLineFromVisible, 1}},
- {3164, {wxStyledTextCtrl, wrapCount, 1}},
- {3165, {wxStyledTextCtrl, setFoldLevel, 2}},
- {3166, {wxStyledTextCtrl, getFoldLevel, 1}},
- {3167, {wxStyledTextCtrl, getLastChild, 2}},
- {3168, {wxStyledTextCtrl, getFoldParent, 1}},
- {3169, {wxStyledTextCtrl, showLines, 2}},
- {3170, {wxStyledTextCtrl, hideLines, 2}},
- {3171, {wxStyledTextCtrl, getLineVisible, 1}},
- {3172, {wxStyledTextCtrl, setFoldExpanded, 2}},
- {3173, {wxStyledTextCtrl, getFoldExpanded, 1}},
- {3174, {wxStyledTextCtrl, toggleFold, 1}},
- {3175, {wxStyledTextCtrl, ensureVisible, 1}},
- {3176, {wxStyledTextCtrl, setFoldFlags, 1}},
- {3177, {wxStyledTextCtrl, ensureVisibleEnforcePolicy, 1}},
- {3178, {wxStyledTextCtrl, setTabIndents, 1}},
- {3179, {wxStyledTextCtrl, getTabIndents, 0}},
- {3180, {wxStyledTextCtrl, setBackSpaceUnIndents, 1}},
- {3181, {wxStyledTextCtrl, getBackSpaceUnIndents, 0}},
- {3182, {wxStyledTextCtrl, setMouseDwellTime, 1}},
- {3183, {wxStyledTextCtrl, getMouseDwellTime, 0}},
- {3184, {wxStyledTextCtrl, wordStartPosition, 2}},
- {3185, {wxStyledTextCtrl, wordEndPosition, 2}},
- {3186, {wxStyledTextCtrl, setWrapMode, 1}},
- {3187, {wxStyledTextCtrl, getWrapMode, 0}},
- {3188, {wxStyledTextCtrl, setWrapVisualFlags, 1}},
- {3189, {wxStyledTextCtrl, getWrapVisualFlags, 0}},
- {3190, {wxStyledTextCtrl, setWrapVisualFlagsLocation, 1}},
- {3191, {wxStyledTextCtrl, getWrapVisualFlagsLocation, 0}},
- {3192, {wxStyledTextCtrl, setWrapStartIndent, 1}},
- {3193, {wxStyledTextCtrl, getWrapStartIndent, 0}},
- {3194, {wxStyledTextCtrl, setLayoutCache, 1}},
- {3195, {wxStyledTextCtrl, getLayoutCache, 0}},
- {3196, {wxStyledTextCtrl, setScrollWidth, 1}},
- {3197, {wxStyledTextCtrl, getScrollWidth, 0}},
- {3198, {wxStyledTextCtrl, textWidth, 2}},
- {3199, {wxStyledTextCtrl, getEndAtLastLine, 0}},
- {3200, {wxStyledTextCtrl, textHeight, 1}},
- {3201, {wxStyledTextCtrl, setUseVerticalScrollBar, 1}},
- {3202, {wxStyledTextCtrl, getUseVerticalScrollBar, 0}},
- {3203, {wxStyledTextCtrl, appendText, 1}},
- {3204, {wxStyledTextCtrl, getTwoPhaseDraw, 0}},
- {3205, {wxStyledTextCtrl, setTwoPhaseDraw, 1}},
- {3206, {wxStyledTextCtrl, targetFromSelection, 0}},
- {3207, {wxStyledTextCtrl, linesJoin, 0}},
- {3208, {wxStyledTextCtrl, linesSplit, 1}},
- {3209, {wxStyledTextCtrl, setFoldMarginColour, 2}},
- {3210, {wxStyledTextCtrl, setFoldMarginHiColour, 2}},
- {3211, {wxStyledTextCtrl, lineDown, 0}},
- {3212, {wxStyledTextCtrl, lineDownExtend, 0}},
- {3213, {wxStyledTextCtrl, lineUp, 0}},
- {3214, {wxStyledTextCtrl, lineUpExtend, 0}},
- {3215, {wxStyledTextCtrl, charLeft, 0}},
- {3216, {wxStyledTextCtrl, charLeftExtend, 0}},
- {3217, {wxStyledTextCtrl, charRight, 0}},
- {3218, {wxStyledTextCtrl, charRightExtend, 0}},
- {3219, {wxStyledTextCtrl, wordLeft, 0}},
- {3220, {wxStyledTextCtrl, wordLeftExtend, 0}},
- {3221, {wxStyledTextCtrl, wordRight, 0}},
- {3222, {wxStyledTextCtrl, wordRightExtend, 0}},
- {3223, {wxStyledTextCtrl, home, 0}},
- {3224, {wxStyledTextCtrl, homeExtend, 0}},
- {3225, {wxStyledTextCtrl, lineEnd, 0}},
- {3226, {wxStyledTextCtrl, lineEndExtend, 0}},
- {3227, {wxStyledTextCtrl, documentStart, 0}},
- {3228, {wxStyledTextCtrl, documentStartExtend, 0}},
- {3229, {wxStyledTextCtrl, documentEnd, 0}},
- {3230, {wxStyledTextCtrl, documentEndExtend, 0}},
- {3231, {wxStyledTextCtrl, pageUp, 0}},
- {3232, {wxStyledTextCtrl, pageUpExtend, 0}},
- {3233, {wxStyledTextCtrl, pageDown, 0}},
- {3234, {wxStyledTextCtrl, pageDownExtend, 0}},
- {3235, {wxStyledTextCtrl, editToggleOvertype, 0}},
- {3236, {wxStyledTextCtrl, cancel, 0}},
- {3237, {wxStyledTextCtrl, deleteBack, 0}},
- {3238, {wxStyledTextCtrl, tab, 0}},
- {3239, {wxStyledTextCtrl, backTab, 0}},
- {3240, {wxStyledTextCtrl, newLine, 0}},
- {3241, {wxStyledTextCtrl, formFeed, 0}},
- {3242, {wxStyledTextCtrl, vCHome, 0}},
- {3243, {wxStyledTextCtrl, vCHomeExtend, 0}},
- {3244, {wxStyledTextCtrl, zoomIn, 0}},
- {3245, {wxStyledTextCtrl, zoomOut, 0}},
- {3246, {wxStyledTextCtrl, delWordLeft, 0}},
- {3247, {wxStyledTextCtrl, delWordRight, 0}},
- {3248, {wxStyledTextCtrl, lineCut, 0}},
- {3249, {wxStyledTextCtrl, lineDelete, 0}},
- {3250, {wxStyledTextCtrl, lineTranspose, 0}},
- {3251, {wxStyledTextCtrl, lineDuplicate, 0}},
- {3252, {wxStyledTextCtrl, lowerCase, 0}},
- {3253, {wxStyledTextCtrl, upperCase, 0}},
- {3254, {wxStyledTextCtrl, lineScrollDown, 0}},
- {3255, {wxStyledTextCtrl, lineScrollUp, 0}},
- {3256, {wxStyledTextCtrl, deleteBackNotLine, 0}},
- {3257, {wxStyledTextCtrl, homeDisplay, 0}},
- {3258, {wxStyledTextCtrl, homeDisplayExtend, 0}},
- {3259, {wxStyledTextCtrl, lineEndDisplay, 0}},
- {3260, {wxStyledTextCtrl, lineEndDisplayExtend, 0}},
- {3261, {wxStyledTextCtrl, homeWrapExtend, 0}},
- {3262, {wxStyledTextCtrl, lineEndWrap, 0}},
- {3263, {wxStyledTextCtrl, lineEndWrapExtend, 0}},
- {3264, {wxStyledTextCtrl, vCHomeWrap, 0}},
- {3265, {wxStyledTextCtrl, vCHomeWrapExtend, 0}},
- {3266, {wxStyledTextCtrl, lineCopy, 0}},
- {3267, {wxStyledTextCtrl, moveCaretInsideView, 0}},
- {3268, {wxStyledTextCtrl, lineLength, 1}},
- {3269, {wxStyledTextCtrl, braceHighlight, 2}},
- {3270, {wxStyledTextCtrl, braceBadLight, 1}},
- {3271, {wxStyledTextCtrl, braceMatch, 1}},
- {3272, {wxStyledTextCtrl, getViewEOL, 0}},
- {3273, {wxStyledTextCtrl, setViewEOL, 1}},
- {3274, {wxStyledTextCtrl, setModEventMask, 1}},
- {3275, {wxStyledTextCtrl, getEdgeColumn, 0}},
- {3276, {wxStyledTextCtrl, setEdgeColumn, 1}},
- {3277, {wxStyledTextCtrl, setEdgeMode, 1}},
- {3278, {wxStyledTextCtrl, getEdgeMode, 0}},
- {3279, {wxStyledTextCtrl, getEdgeColour, 0}},
- {3280, {wxStyledTextCtrl, setEdgeColour, 1}},
- {3281, {wxStyledTextCtrl, searchAnchor, 0}},
- {3282, {wxStyledTextCtrl, searchNext, 2}},
- {3283, {wxStyledTextCtrl, searchPrev, 2}},
- {3284, {wxStyledTextCtrl, linesOnScreen, 0}},
- {3285, {wxStyledTextCtrl, usePopUp, 1}},
- {3286, {wxStyledTextCtrl, selectionIsRectangle, 0}},
- {3287, {wxStyledTextCtrl, setZoom, 1}},
- {3288, {wxStyledTextCtrl, getZoom, 0}},
- {3289, {wxStyledTextCtrl, getModEventMask, 0}},
- {3290, {wxStyledTextCtrl, setSTCFocus, 1}},
- {3291, {wxStyledTextCtrl, getSTCFocus, 0}},
- {3292, {wxStyledTextCtrl, setStatus, 1}},
- {3293, {wxStyledTextCtrl, getStatus, 0}},
- {3294, {wxStyledTextCtrl, setMouseDownCaptures, 1}},
- {3295, {wxStyledTextCtrl, getMouseDownCaptures, 0}},
- {3296, {wxStyledTextCtrl, setSTCCursor, 1}},
- {3297, {wxStyledTextCtrl, getSTCCursor, 0}},
- {3298, {wxStyledTextCtrl, setControlCharSymbol, 1}},
- {3299, {wxStyledTextCtrl, getControlCharSymbol, 0}},
- {3300, {wxStyledTextCtrl, wordPartLeft, 0}},
- {3301, {wxStyledTextCtrl, wordPartLeftExtend, 0}},
- {3302, {wxStyledTextCtrl, wordPartRight, 0}},
- {3303, {wxStyledTextCtrl, wordPartRightExtend, 0}},
- {3304, {wxStyledTextCtrl, setVisiblePolicy, 2}},
- {3305, {wxStyledTextCtrl, delLineLeft, 0}},
- {3306, {wxStyledTextCtrl, delLineRight, 0}},
- {3307, {wxStyledTextCtrl, getXOffset, 0}},
- {3308, {wxStyledTextCtrl, chooseCaretX, 0}},
- {3309, {wxStyledTextCtrl, setXCaretPolicy, 2}},
- {3310, {wxStyledTextCtrl, setYCaretPolicy, 2}},
- {3311, {wxStyledTextCtrl, getPrintWrapMode, 0}},
- {3312, {wxStyledTextCtrl, setHotspotActiveForeground, 2}},
- {3313, {wxStyledTextCtrl, setHotspotActiveBackground, 2}},
- {3314, {wxStyledTextCtrl, setHotspotActiveUnderline, 1}},
- {3315, {wxStyledTextCtrl, setHotspotSingleLine, 1}},
- {3316, {wxStyledTextCtrl, paraDownExtend, 0}},
- {3317, {wxStyledTextCtrl, paraUp, 0}},
- {3318, {wxStyledTextCtrl, paraUpExtend, 0}},
- {3319, {wxStyledTextCtrl, positionBefore, 1}},
- {3320, {wxStyledTextCtrl, positionAfter, 1}},
- {3321, {wxStyledTextCtrl, copyRange, 2}},
- {3322, {wxStyledTextCtrl, copyText, 2}},
- {3323, {wxStyledTextCtrl, setSelectionMode, 1}},
- {3324, {wxStyledTextCtrl, getSelectionMode, 0}},
- {3325, {wxStyledTextCtrl, lineDownRectExtend, 0}},
- {3326, {wxStyledTextCtrl, lineUpRectExtend, 0}},
- {3327, {wxStyledTextCtrl, charLeftRectExtend, 0}},
- {3328, {wxStyledTextCtrl, charRightRectExtend, 0}},
- {3329, {wxStyledTextCtrl, homeRectExtend, 0}},
- {3330, {wxStyledTextCtrl, vCHomeRectExtend, 0}},
- {3331, {wxStyledTextCtrl, lineEndRectExtend, 0}},
- {3332, {wxStyledTextCtrl, pageUpRectExtend, 0}},
- {3333, {wxStyledTextCtrl, pageDownRectExtend, 0}},
- {3334, {wxStyledTextCtrl, stutteredPageUp, 0}},
- {3335, {wxStyledTextCtrl, stutteredPageUpExtend, 0}},
- {3336, {wxStyledTextCtrl, stutteredPageDown, 0}},
- {3337, {wxStyledTextCtrl, stutteredPageDownExtend, 0}},
- {3338, {wxStyledTextCtrl, wordLeftEnd, 0}},
- {3339, {wxStyledTextCtrl, wordLeftEndExtend, 0}},
- {3340, {wxStyledTextCtrl, wordRightEnd, 0}},
- {3341, {wxStyledTextCtrl, wordRightEndExtend, 0}},
- {3342, {wxStyledTextCtrl, setWhitespaceChars, 1}},
- {3343, {wxStyledTextCtrl, setCharsDefault, 0}},
- {3344, {wxStyledTextCtrl, autoCompGetCurrent, 0}},
- {3345, {wxStyledTextCtrl, allocate, 1}},
- {3346, {wxStyledTextCtrl, findColumn, 2}},
- {3347, {wxStyledTextCtrl, getCaretSticky, 0}},
- {3348, {wxStyledTextCtrl, setCaretSticky, 1}},
- {3349, {wxStyledTextCtrl, toggleCaretSticky, 0}},
- {3350, {wxStyledTextCtrl, setPasteConvertEndings, 1}},
- {3351, {wxStyledTextCtrl, getPasteConvertEndings, 0}},
- {3352, {wxStyledTextCtrl, selectionDuplicate, 0}},
- {3353, {wxStyledTextCtrl, setCaretLineBackAlpha, 1}},
- {3354, {wxStyledTextCtrl, getCaretLineBackAlpha, 0}},
- {3355, {wxStyledTextCtrl, startRecord, 0}},
- {3356, {wxStyledTextCtrl, stopRecord, 0}},
- {3357, {wxStyledTextCtrl, setLexer, 1}},
- {3358, {wxStyledTextCtrl, getLexer, 0}},
- {3359, {wxStyledTextCtrl, colourise, 2}},
- {3360, {wxStyledTextCtrl, setProperty, 2}},
- {3361, {wxStyledTextCtrl, setKeyWords, 2}},
- {3362, {wxStyledTextCtrl, setLexerLanguage, 1}},
- {3363, {wxStyledTextCtrl, getProperty, 1}},
- {3364, {wxStyledTextCtrl, getStyleBitsNeeded, 0}},
- {3365, {wxStyledTextCtrl, getCurrentLine, 0}},
- {3366, {wxStyledTextCtrl, styleSetSpec, 2}},
- {3367, {wxStyledTextCtrl, styleSetFont, 2}},
- {3368, {wxStyledTextCtrl, styleSetFontAttr, 7}},
- {3369, {wxStyledTextCtrl, styleSetCharacterSet, 2}},
- {3370, {wxStyledTextCtrl, styleSetFontEncoding, 2}},
- {3371, {wxStyledTextCtrl, cmdKeyExecute, 1}},
- {3372, {wxStyledTextCtrl, setMargins, 2}},
- {3373, {wxStyledTextCtrl, getSelection, 2}},
- {3374, {wxStyledTextCtrl, pointFromPosition, 1}},
- {3375, {wxStyledTextCtrl, scrollToLine, 1}},
- {3376, {wxStyledTextCtrl, scrollToColumn, 1}},
- {3377, {wxStyledTextCtrl, setVScrollBar, 1}},
- {3378, {wxStyledTextCtrl, setHScrollBar, 1}},
- {3379, {wxStyledTextCtrl, getLastKeydownProcessed, 0}},
- {3380, {wxStyledTextCtrl, setLastKeydownProcessed, 1}},
- {3381, {wxStyledTextCtrl, saveFile, 1}},
- {3382, {wxStyledTextCtrl, loadFile, 1}},
- {3383, {wxStyledTextCtrl, doDragOver, 3}},
- {3384, {wxStyledTextCtrl, doDropText, 3}},
- {3385, {wxStyledTextCtrl, getUseAntiAliasing, 0}},
- {3386, {wxStyledTextCtrl, addTextRaw, 1}},
- {3387, {wxStyledTextCtrl, insertTextRaw, 2}},
- {3388, {wxStyledTextCtrl, getCurLineRaw, 1}},
- {3389, {wxStyledTextCtrl, getLineRaw, 1}},
- {3390, {wxStyledTextCtrl, getSelectedTextRaw, 0}},
- {3391, {wxStyledTextCtrl, getTextRangeRaw, 2}},
- {3392, {wxStyledTextCtrl, setTextRaw, 1}},
- {3393, {wxStyledTextCtrl, getTextRaw, 0}},
- {3394, {wxStyledTextCtrl, appendTextRaw, 1}},
- {3395, {wxArtProvider, getBitmap, 2}},
- {3396, {wxArtProvider, getIcon, 2}},
- {3397, {wxTreeEvent, getKeyCode, 0}},
- {3398, {wxTreeEvent, getItem, 0}},
- {3399, {wxTreeEvent, getKeyEvent, 0}},
- {3400, {wxTreeEvent, getLabel, 0}},
- {3401, {wxTreeEvent, getOldItem, 0}},
- {3402, {wxTreeEvent, getPoint, 0}},
- {3403, {wxTreeEvent, isEditCancelled, 0}},
- {3404, {wxTreeEvent, setToolTip, 1}},
- {3405, {wxNotebookEvent, getOldSelection, 0}},
- {3406, {wxNotebookEvent, getSelection, 0}},
- {3407, {wxNotebookEvent, setOldSelection, 1}},
- {3408, {wxNotebookEvent, setSelection, 1}},
- {3409, {wxFileDataObject, new, 0}},
- {3410, {wxFileDataObject, addFile, 1}},
- {3411, {wxFileDataObject, getFilenames, 0}},
- {3412, {wxFileDataObject, 'Destroy', undefined}},
- {3413, {wxTextDataObject, new, 1}},
- {3414, {wxTextDataObject, getTextLength, 0}},
- {3415, {wxTextDataObject, getText, 0}},
- {3416, {wxTextDataObject, setText, 1}},
- {3417, {wxTextDataObject, 'Destroy', undefined}},
- {3418, {wxBitmapDataObject, new_1_1, 1}},
- {3419, {wxBitmapDataObject, new_1_0, 1}},
- {3420, {wxBitmapDataObject, getBitmap, 0}},
- {3421, {wxBitmapDataObject, setBitmap, 1}},
- {3422, {wxBitmapDataObject, 'Destroy', undefined}},
- {3424, {wxClipboard, new, 0}},
- {3425, {wxClipboard, destruct, 0}},
- {3426, {wxClipboard, addData, 1}},
- {3427, {wxClipboard, clear, 0}},
- {3428, {wxClipboard, close, 0}},
- {3429, {wxClipboard, flush, 0}},
- {3430, {wxClipboard, getData, 1}},
- {3431, {wxClipboard, isOpened, 0}},
- {3432, {wxClipboard, open, 0}},
- {3433, {wxClipboard, setData, 1}},
- {3435, {wxClipboard, usePrimarySelection, 1}},
- {3436, {wxClipboard, isSupported, 1}},
- {3437, {wxClipboard, get, 0}},
- {3438, {wxSpinEvent, getPosition, 0}},
- {3439, {wxSpinEvent, setPosition, 1}},
- {3440, {wxSplitterWindow, new_0, 0}},
- {3441, {wxSplitterWindow, new_2, 2}},
- {3442, {wxSplitterWindow, destruct, 0}},
- {3443, {wxSplitterWindow, create, 2}},
- {3444, {wxSplitterWindow, getMinimumPaneSize, 0}},
- {3445, {wxSplitterWindow, getSashGravity, 0}},
- {3446, {wxSplitterWindow, getSashPosition, 0}},
- {3447, {wxSplitterWindow, getSplitMode, 0}},
- {3448, {wxSplitterWindow, getWindow1, 0}},
- {3449, {wxSplitterWindow, getWindow2, 0}},
- {3450, {wxSplitterWindow, initialize, 1}},
- {3451, {wxSplitterWindow, isSplit, 0}},
- {3452, {wxSplitterWindow, replaceWindow, 2}},
- {3453, {wxSplitterWindow, setSashGravity, 1}},
- {3454, {wxSplitterWindow, setSashPosition, 2}},
- {3455, {wxSplitterWindow, setSashSize, 1}},
- {3456, {wxSplitterWindow, setMinimumPaneSize, 1}},
- {3457, {wxSplitterWindow, setSplitMode, 1}},
- {3458, {wxSplitterWindow, splitHorizontally, 3}},
- {3459, {wxSplitterWindow, splitVertically, 3}},
- {3460, {wxSplitterWindow, unsplit, 1}},
- {3461, {wxSplitterWindow, updateSize, 0}},
- {3462, {wxSplitterEvent, getSashPosition, 0}},
- {3463, {wxSplitterEvent, getX, 0}},
- {3464, {wxSplitterEvent, getY, 0}},
- {3465, {wxSplitterEvent, getWindowBeingRemoved, 0}},
- {3466, {wxSplitterEvent, setSashPosition, 1}},
- {3467, {wxHtmlWindow, new_0, 0}},
- {3468, {wxHtmlWindow, new_2, 2}},
- {3469, {wxHtmlWindow, appendToPage, 1}},
- {3470, {wxHtmlWindow, getOpenedAnchor, 0}},
- {3471, {wxHtmlWindow, getOpenedPage, 0}},
- {3472, {wxHtmlWindow, getOpenedPageTitle, 0}},
- {3473, {wxHtmlWindow, getRelatedFrame, 0}},
- {3474, {wxHtmlWindow, historyBack, 0}},
- {3475, {wxHtmlWindow, historyCanBack, 0}},
- {3476, {wxHtmlWindow, historyCanForward, 0}},
- {3477, {wxHtmlWindow, historyClear, 0}},
- {3478, {wxHtmlWindow, historyForward, 0}},
- {3479, {wxHtmlWindow, loadFile, 1}},
- {3480, {wxHtmlWindow, loadPage, 1}},
- {3481, {wxHtmlWindow, selectAll, 0}},
- {3482, {wxHtmlWindow, selectionToText, 0}},
- {3483, {wxHtmlWindow, selectLine, 1}},
- {3484, {wxHtmlWindow, selectWord, 1}},
- {3485, {wxHtmlWindow, setBorders, 1}},
- {3486, {wxHtmlWindow, setFonts, 3}},
- {3487, {wxHtmlWindow, setPage, 1}},
- {3488, {wxHtmlWindow, setRelatedFrame, 2}},
- {3489, {wxHtmlWindow, setRelatedStatusBar, 1}},
- {3490, {wxHtmlWindow, toText, 0}},
- {3491, {wxHtmlWindow, 'Destroy', undefined}},
- {3492, {wxHtmlLinkEvent, getLinkInfo, 0}},
- {3493, {wxSystemSettings, getColour, 1}},
- {3494, {wxSystemSettings, getFont, 1}},
- {3495, {wxSystemSettings, getMetric, 2}},
- {3496, {wxSystemSettings, getScreenType, 0}},
- {3497, {wxSystemOptions, getOption, 1}},
- {3498, {wxSystemOptions, getOptionInt, 1}},
- {3499, {wxSystemOptions, hasOption, 1}},
- {3500, {wxSystemOptions, isFalse, 1}},
- {3501, {wxSystemOptions, setOption_2_1, 2}},
- {3502, {wxSystemOptions, setOption_2_0, 2}},
- {3503, {wxAuiNotebookEvent, setSelection, 1}},
- {3504, {wxAuiNotebookEvent, getSelection, 0}},
- {3505, {wxAuiNotebookEvent, setOldSelection, 1}},
- {3506, {wxAuiNotebookEvent, getOldSelection, 0}},
- {3507, {wxAuiNotebookEvent, setDragSource, 1}},
- {3508, {wxAuiNotebookEvent, getDragSource, 0}},
- {3509, {wxAuiManagerEvent, setManager, 1}},
- {3510, {wxAuiManagerEvent, getManager, 0}},
- {3511, {wxAuiManagerEvent, setPane, 1}},
- {3512, {wxAuiManagerEvent, getPane, 0}},
- {3513, {wxAuiManagerEvent, setButton, 1}},
- {3514, {wxAuiManagerEvent, getButton, 0}},
- {3515, {wxAuiManagerEvent, setDC, 1}},
- {3516, {wxAuiManagerEvent, getDC, 0}},
- {3517, {wxAuiManagerEvent, veto, 1}},
- {3518, {wxAuiManagerEvent, getVeto, 0}},
- {3519, {wxAuiManagerEvent, setCanVeto, 1}},
- {3520, {wxAuiManagerEvent, canVeto, 0}},
- {3521, {wxLogNull, new, 0}},
- {3522, {wxLogNull, 'Destroy', undefined}},
- {3523, {wxTaskBarIcon, new, 0}},
- {3524, {wxTaskBarIcon, destruct, 0}},
- {3525, {wxTaskBarIcon, popupMenu, 1}},
- {3526, {wxTaskBarIcon, removeIcon, 0}},
- {3527, {wxTaskBarIcon, setIcon, 2}},
- {3528, {wxLocale, new_0, 0}},
- {3530, {wxLocale, new_2, 2}},
- {3531, {wxLocale, destruct, 0}},
- {3533, {wxLocale, init, 1}},
- {3534, {wxLocale, addCatalog_1, 1}},
- {3535, {wxLocale, addCatalog_3, 3}},
- {3536, {wxLocale, addCatalogLookupPathPrefix, 1}},
- {3537, {wxLocale, getCanonicalName, 0}},
- {3538, {wxLocale, getLanguage, 0}},
- {3539, {wxLocale, getLanguageName, 1}},
- {3540, {wxLocale, getLocale, 0}},
- {3541, {wxLocale, getName, 0}},
- {3542, {wxLocale, getString_2, 2}},
- {3543, {wxLocale, getString_4, 4}},
- {3544, {wxLocale, getHeaderValue, 2}},
- {3545, {wxLocale, getSysName, 0}},
- {3546, {wxLocale, getSystemEncoding, 0}},
- {3547, {wxLocale, getSystemEncodingName, 0}},
- {3548, {wxLocale, getSystemLanguage, 0}},
- {3549, {wxLocale, isLoaded, 1}},
- {3550, {wxLocale, isOk, 0}},
- {3551, {wxActivateEvent, getActive, 0}},
- {3553, {wxPopupWindow, new_2, 2}},
- {3554, {wxPopupWindow, new_0, 0}},
- {3556, {wxPopupWindow, destruct, 0}},
- {3557, {wxPopupWindow, create, 2}},
- {3558, {wxPopupWindow, position, 2}},
- {3559, {wxPopupTransientWindow, new_0, 0}},
- {3560, {wxPopupTransientWindow, new_2, 2}},
- {3561, {wxPopupTransientWindow, destruct, 0}},
- {3562, {wxPopupTransientWindow, popup, 1}},
- {3563, {wxPopupTransientWindow, dismiss, 0}},
+ {2653, {wxAuiPaneInfo, getWindow, 0}},
+ {2654, {wxAuiPaneInfo, getFrame, 0}},
+ {2655, {wxAuiPaneInfo, getDirection, 0}},
+ {2656, {wxAuiPaneInfo, getLayer, 0}},
+ {2657, {wxAuiPaneInfo, getRow, 0}},
+ {2658, {wxAuiPaneInfo, getPosition, 0}},
+ {2659, {wxAuiPaneInfo, getFloatingPosition, 0}},
+ {2660, {wxAuiPaneInfo, getFloatingSize, 0}},
+ {2661, {wxAuiNotebook, new_0, 0}},
+ {2662, {wxAuiNotebook, new_2, 2}},
+ {2663, {wxAuiNotebook, addPage, 3}},
+ {2664, {wxAuiNotebook, create, 2}},
+ {2665, {wxAuiNotebook, deletePage, 1}},
+ {2666, {wxAuiNotebook, getArtProvider, 0}},
+ {2667, {wxAuiNotebook, getPage, 1}},
+ {2668, {wxAuiNotebook, getPageBitmap, 1}},
+ {2669, {wxAuiNotebook, getPageCount, 0}},
+ {2670, {wxAuiNotebook, getPageIndex, 1}},
+ {2671, {wxAuiNotebook, getPageText, 1}},
+ {2672, {wxAuiNotebook, getSelection, 0}},
+ {2673, {wxAuiNotebook, insertPage, 4}},
+ {2674, {wxAuiNotebook, removePage, 1}},
+ {2675, {wxAuiNotebook, setArtProvider, 1}},
+ {2676, {wxAuiNotebook, setFont, 1}},
+ {2677, {wxAuiNotebook, setPageBitmap, 2}},
+ {2678, {wxAuiNotebook, setPageText, 2}},
+ {2679, {wxAuiNotebook, setSelection, 1}},
+ {2680, {wxAuiNotebook, setTabCtrlHeight, 1}},
+ {2681, {wxAuiNotebook, setUniformBitmapSize, 1}},
+ {2682, {wxAuiNotebook, 'Destroy', undefined}},
+ {2683, {wxAuiTabArt, setFlags, 1}},
+ {2684, {wxAuiTabArt, setMeasuringFont, 1}},
+ {2685, {wxAuiTabArt, setNormalFont, 1}},
+ {2686, {wxAuiTabArt, setSelectedFont, 1}},
+ {2687, {wxAuiTabArt, setColour, 1}},
+ {2688, {wxAuiTabArt, setActiveColour, 1}},
+ {2689, {wxAuiDockArt, getColour, 1}},
+ {2690, {wxAuiDockArt, getFont, 1}},
+ {2691, {wxAuiDockArt, getMetric, 1}},
+ {2692, {wxAuiDockArt, setColour, 2}},
+ {2693, {wxAuiDockArt, setFont, 2}},
+ {2694, {wxAuiDockArt, setMetric, 2}},
+ {2695, {wxAuiSimpleTabArt, new, 0}},
+ {2696, {wxAuiSimpleTabArt, 'Destroy', undefined}},
+ {2697, {wxMDIParentFrame, new_0, 0}},
+ {2698, {wxMDIParentFrame, new_4, 4}},
+ {2699, {wxMDIParentFrame, destruct, 0}},
+ {2700, {wxMDIParentFrame, activateNext, 0}},
+ {2701, {wxMDIParentFrame, activatePrevious, 0}},
+ {2702, {wxMDIParentFrame, arrangeIcons, 0}},
+ {2703, {wxMDIParentFrame, cascade, 0}},
+ {2704, {wxMDIParentFrame, create, 4}},
+ {2705, {wxMDIParentFrame, getActiveChild, 0}},
+ {2706, {wxMDIParentFrame, getClientWindow, 0}},
+ {2707, {wxMDIParentFrame, tile, 1}},
+ {2708, {wxMDIChildFrame, new_0, 0}},
+ {2709, {wxMDIChildFrame, new_4, 4}},
+ {2710, {wxMDIChildFrame, destruct, 0}},
+ {2711, {wxMDIChildFrame, activate, 0}},
+ {2712, {wxMDIChildFrame, create, 4}},
+ {2713, {wxMDIChildFrame, maximize, 1}},
+ {2714, {wxMDIChildFrame, restore, 0}},
+ {2715, {wxMDIClientWindow, new_0, 0}},
+ {2716, {wxMDIClientWindow, new_2, 2}},
+ {2717, {wxMDIClientWindow, destruct, 0}},
+ {2718, {wxMDIClientWindow, createClient, 2}},
+ {2719, {wxLayoutAlgorithm, new, 0}},
+ {2720, {wxLayoutAlgorithm, layoutFrame, 2}},
+ {2721, {wxLayoutAlgorithm, layoutMDIFrame, 2}},
+ {2722, {wxLayoutAlgorithm, layoutWindow, 2}},
+ {2723, {wxLayoutAlgorithm, 'Destroy', undefined}},
+ {2724, {wxEvent, getId, 0}},
+ {2725, {wxEvent, getSkipped, 0}},
+ {2726, {wxEvent, getTimestamp, 0}},
+ {2727, {wxEvent, isCommandEvent, 0}},
+ {2728, {wxEvent, resumePropagation, 1}},
+ {2729, {wxEvent, shouldPropagate, 0}},
+ {2730, {wxEvent, skip, 1}},
+ {2731, {wxEvent, stopPropagation, 0}},
+ {2732, {wxCommandEvent, getClientData, 0}},
+ {2733, {wxCommandEvent, getExtraLong, 0}},
+ {2734, {wxCommandEvent, getInt, 0}},
+ {2735, {wxCommandEvent, getSelection, 0}},
+ {2736, {wxCommandEvent, getString, 0}},
+ {2737, {wxCommandEvent, isChecked, 0}},
+ {2738, {wxCommandEvent, isSelection, 0}},
+ {2739, {wxCommandEvent, setInt, 1}},
+ {2740, {wxCommandEvent, setString, 1}},
+ {2741, {wxScrollEvent, getOrientation, 0}},
+ {2742, {wxScrollEvent, getPosition, 0}},
+ {2743, {wxScrollWinEvent, getOrientation, 0}},
+ {2744, {wxScrollWinEvent, getPosition, 0}},
+ {2745, {wxMouseEvent, altDown, 0}},
+ {2746, {wxMouseEvent, button, 1}},
+ {2747, {wxMouseEvent, buttonDClick, 1}},
+ {2748, {wxMouseEvent, buttonDown, 1}},
+ {2749, {wxMouseEvent, buttonUp, 1}},
+ {2750, {wxMouseEvent, cmdDown, 0}},
+ {2751, {wxMouseEvent, controlDown, 0}},
+ {2752, {wxMouseEvent, dragging, 0}},
+ {2753, {wxMouseEvent, entering, 0}},
+ {2754, {wxMouseEvent, getButton, 0}},
+ {2757, {wxMouseEvent, getPosition, 0}},
+ {2758, {wxMouseEvent, getLogicalPosition, 1}},
+ {2759, {wxMouseEvent, getLinesPerAction, 0}},
+ {2760, {wxMouseEvent, getWheelRotation, 0}},
+ {2761, {wxMouseEvent, getWheelDelta, 0}},
+ {2762, {wxMouseEvent, getX, 0}},
+ {2763, {wxMouseEvent, getY, 0}},
+ {2764, {wxMouseEvent, isButton, 0}},
+ {2765, {wxMouseEvent, isPageScroll, 0}},
+ {2766, {wxMouseEvent, leaving, 0}},
+ {2767, {wxMouseEvent, leftDClick, 0}},
+ {2768, {wxMouseEvent, leftDown, 0}},
+ {2769, {wxMouseEvent, leftIsDown, 0}},
+ {2770, {wxMouseEvent, leftUp, 0}},
+ {2771, {wxMouseEvent, metaDown, 0}},
+ {2772, {wxMouseEvent, middleDClick, 0}},
+ {2773, {wxMouseEvent, middleDown, 0}},
+ {2774, {wxMouseEvent, middleIsDown, 0}},
+ {2775, {wxMouseEvent, middleUp, 0}},
+ {2776, {wxMouseEvent, moving, 0}},
+ {2777, {wxMouseEvent, rightDClick, 0}},
+ {2778, {wxMouseEvent, rightDown, 0}},
+ {2779, {wxMouseEvent, rightIsDown, 0}},
+ {2780, {wxMouseEvent, rightUp, 0}},
+ {2781, {wxMouseEvent, shiftDown, 0}},
+ {2782, {wxSetCursorEvent, getCursor, 0}},
+ {2783, {wxSetCursorEvent, getX, 0}},
+ {2784, {wxSetCursorEvent, getY, 0}},
+ {2785, {wxSetCursorEvent, hasCursor, 0}},
+ {2786, {wxSetCursorEvent, setCursor, 1}},
+ {2787, {wxKeyEvent, altDown, 0}},
+ {2788, {wxKeyEvent, cmdDown, 0}},
+ {2789, {wxKeyEvent, controlDown, 0}},
+ {2790, {wxKeyEvent, getKeyCode, 0}},
+ {2791, {wxKeyEvent, getModifiers, 0}},
+ {2794, {wxKeyEvent, getPosition, 0}},
+ {2795, {wxKeyEvent, getRawKeyCode, 0}},
+ {2796, {wxKeyEvent, getRawKeyFlags, 0}},
+ {2797, {wxKeyEvent, getUnicodeKey, 0}},
+ {2798, {wxKeyEvent, getX, 0}},
+ {2799, {wxKeyEvent, getY, 0}},
+ {2800, {wxKeyEvent, hasModifiers, 0}},
+ {2801, {wxKeyEvent, metaDown, 0}},
+ {2802, {wxKeyEvent, shiftDown, 0}},
+ {2803, {wxSizeEvent, getSize, 0}},
+ {2804, {wxMoveEvent, getPosition, 0}},
+ {2805, {wxEraseEvent, getDC, 0}},
+ {2806, {wxFocusEvent, getWindow, 0}},
+ {2807, {wxChildFocusEvent, getWindow, 0}},
+ {2808, {wxMenuEvent, getMenu, 0}},
+ {2809, {wxMenuEvent, getMenuId, 0}},
+ {2810, {wxMenuEvent, isPopup, 0}},
+ {2811, {wxCloseEvent, canVeto, 0}},
+ {2812, {wxCloseEvent, getLoggingOff, 0}},
+ {2813, {wxCloseEvent, setCanVeto, 1}},
+ {2814, {wxCloseEvent, setLoggingOff, 1}},
+ {2815, {wxCloseEvent, veto, 1}},
+ {2816, {wxShowEvent, setShow, 1}},
+ {2817, {wxShowEvent, getShow, 0}},
+ {2818, {wxIconizeEvent, iconized, 0}},
+ {2819, {wxJoystickEvent, buttonDown, 1}},
+ {2820, {wxJoystickEvent, buttonIsDown, 1}},
+ {2821, {wxJoystickEvent, buttonUp, 1}},
+ {2822, {wxJoystickEvent, getButtonChange, 0}},
+ {2823, {wxJoystickEvent, getButtonState, 0}},
+ {2824, {wxJoystickEvent, getJoystick, 0}},
+ {2825, {wxJoystickEvent, getPosition, 0}},
+ {2826, {wxJoystickEvent, getZPosition, 0}},
+ {2827, {wxJoystickEvent, isButton, 0}},
+ {2828, {wxJoystickEvent, isMove, 0}},
+ {2829, {wxJoystickEvent, isZMove, 0}},
+ {2830, {wxUpdateUIEvent, canUpdate, 1}},
+ {2831, {wxUpdateUIEvent, check, 1}},
+ {2832, {wxUpdateUIEvent, enable, 1}},
+ {2833, {wxUpdateUIEvent, show, 1}},
+ {2834, {wxUpdateUIEvent, getChecked, 0}},
+ {2835, {wxUpdateUIEvent, getEnabled, 0}},
+ {2836, {wxUpdateUIEvent, getShown, 0}},
+ {2837, {wxUpdateUIEvent, getSetChecked, 0}},
+ {2838, {wxUpdateUIEvent, getSetEnabled, 0}},
+ {2839, {wxUpdateUIEvent, getSetShown, 0}},
+ {2840, {wxUpdateUIEvent, getSetText, 0}},
+ {2841, {wxUpdateUIEvent, getText, 0}},
+ {2842, {wxUpdateUIEvent, getMode, 0}},
+ {2843, {wxUpdateUIEvent, getUpdateInterval, 0}},
+ {2844, {wxUpdateUIEvent, resetUpdateTime, 0}},
+ {2845, {wxUpdateUIEvent, setMode, 1}},
+ {2846, {wxUpdateUIEvent, setText, 1}},
+ {2847, {wxUpdateUIEvent, setUpdateInterval, 1}},
+ {2848, {wxMouseCaptureChangedEvent, getCapturedWindow, 0}},
+ {2849, {wxPaletteChangedEvent, setChangedWindow, 1}},
+ {2850, {wxPaletteChangedEvent, getChangedWindow, 0}},
+ {2851, {wxQueryNewPaletteEvent, setPaletteRealized, 1}},
+ {2852, {wxQueryNewPaletteEvent, getPaletteRealized, 0}},
+ {2853, {wxNavigationKeyEvent, getDirection, 0}},
+ {2854, {wxNavigationKeyEvent, setDirection, 1}},
+ {2855, {wxNavigationKeyEvent, isWindowChange, 0}},
+ {2856, {wxNavigationKeyEvent, setWindowChange, 1}},
+ {2857, {wxNavigationKeyEvent, isFromTab, 0}},
+ {2858, {wxNavigationKeyEvent, setFromTab, 1}},
+ {2859, {wxNavigationKeyEvent, getCurrentFocus, 0}},
+ {2860, {wxNavigationKeyEvent, setCurrentFocus, 1}},
+ {2861, {wxHelpEvent, getOrigin, 0}},
+ {2862, {wxHelpEvent, getPosition, 0}},
+ {2863, {wxHelpEvent, setOrigin, 1}},
+ {2864, {wxHelpEvent, setPosition, 1}},
+ {2865, {wxContextMenuEvent, getPosition, 0}},
+ {2866, {wxContextMenuEvent, setPosition, 1}},
+ {2867, {wxIdleEvent, canSend, 1}},
+ {2868, {wxIdleEvent, getMode, 0}},
+ {2869, {wxIdleEvent, requestMore, 1}},
+ {2870, {wxIdleEvent, moreRequested, 0}},
+ {2871, {wxIdleEvent, setMode, 1}},
+ {2872, {wxGridEvent, altDown, 0}},
+ {2873, {wxGridEvent, controlDown, 0}},
+ {2874, {wxGridEvent, getCol, 0}},
+ {2875, {wxGridEvent, getPosition, 0}},
+ {2876, {wxGridEvent, getRow, 0}},
+ {2877, {wxGridEvent, metaDown, 0}},
+ {2878, {wxGridEvent, selecting, 0}},
+ {2879, {wxGridEvent, shiftDown, 0}},
+ {2880, {wxNotifyEvent, allow, 0}},
+ {2881, {wxNotifyEvent, isAllowed, 0}},
+ {2882, {wxNotifyEvent, veto, 0}},
+ {2883, {wxSashEvent, getEdge, 0}},
+ {2884, {wxSashEvent, getDragRect, 0}},
+ {2885, {wxSashEvent, getDragStatus, 0}},
+ {2886, {wxListEvent, getCacheFrom, 0}},
+ {2887, {wxListEvent, getCacheTo, 0}},
+ {2888, {wxListEvent, getKeyCode, 0}},
+ {2889, {wxListEvent, getIndex, 0}},
+ {2890, {wxListEvent, getColumn, 0}},
+ {2891, {wxListEvent, getPoint, 0}},
+ {2892, {wxListEvent, getLabel, 0}},
+ {2893, {wxListEvent, getText, 0}},
+ {2894, {wxListEvent, getImage, 0}},
+ {2895, {wxListEvent, getData, 0}},
+ {2896, {wxListEvent, getMask, 0}},
+ {2897, {wxListEvent, getItem, 0}},
+ {2898, {wxListEvent, isEditCancelled, 0}},
+ {2899, {wxDateEvent, getDate, 0}},
+ {2900, {wxCalendarEvent, getWeekDay, 0}},
+ {2901, {wxFileDirPickerEvent, getPath, 0}},
+ {2902, {wxColourPickerEvent, getColour, 0}},
+ {2903, {wxFontPickerEvent, getFont, 0}},
+ {2904, {wxStyledTextEvent, getPosition, 0}},
+ {2905, {wxStyledTextEvent, getKey, 0}},
+ {2906, {wxStyledTextEvent, getModifiers, 0}},
+ {2907, {wxStyledTextEvent, getModificationType, 0}},
+ {2908, {wxStyledTextEvent, getText, 0}},
+ {2909, {wxStyledTextEvent, getLength, 0}},
+ {2910, {wxStyledTextEvent, getLinesAdded, 0}},
+ {2911, {wxStyledTextEvent, getLine, 0}},
+ {2912, {wxStyledTextEvent, getFoldLevelNow, 0}},
+ {2913, {wxStyledTextEvent, getFoldLevelPrev, 0}},
+ {2914, {wxStyledTextEvent, getMargin, 0}},
+ {2915, {wxStyledTextEvent, getMessage, 0}},
+ {2916, {wxStyledTextEvent, getWParam, 0}},
+ {2917, {wxStyledTextEvent, getLParam, 0}},
+ {2918, {wxStyledTextEvent, getListType, 0}},
+ {2919, {wxStyledTextEvent, getX, 0}},
+ {2920, {wxStyledTextEvent, getY, 0}},
+ {2921, {wxStyledTextEvent, getDragText, 0}},
+ {2922, {wxStyledTextEvent, getDragAllowMove, 0}},
+ {2923, {wxStyledTextEvent, getDragResult, 0}},
+ {2924, {wxStyledTextEvent, getShift, 0}},
+ {2925, {wxStyledTextEvent, getControl, 0}},
+ {2926, {wxStyledTextEvent, getAlt, 0}},
+ {2927, {utils, getKeyState, 1}},
+ {2928, {utils, getMousePosition, 2}},
+ {2929, {utils, getMouseState, 0}},
+ {2930, {utils, setDetectableAutoRepeat, 1}},
+ {2931, {utils, bell, 0}},
+ {2932, {utils, findMenuItemId, 3}},
+ {2933, {utils, genericFindWindowAtPoint, 1}},
+ {2934, {utils, findWindowAtPoint, 1}},
+ {2935, {utils, beginBusyCursor, 1}},
+ {2936, {utils, endBusyCursor, 0}},
+ {2937, {utils, isBusy, 0}},
+ {2938, {utils, shutdown, 1}},
+ {2939, {utils, shell, 1}},
+ {2940, {utils, launchDefaultBrowser, 2}},
+ {2941, {utils, getEmailAddress, 0}},
+ {2942, {utils, getUserId, 0}},
+ {2943, {utils, getHomeDir, 0}},
+ {2944, {utils, newId, 0}},
+ {2945, {utils, registerId, 1}},
+ {2946, {utils, getCurrentId, 0}},
+ {2947, {utils, getOsDescription, 0}},
+ {2948, {utils, isPlatformLittleEndian, 0}},
+ {2949, {utils, isPlatform64Bit, 0}},
+ {2950, {gdicmn, displaySize, 2}},
+ {2951, {gdicmn, setCursor, 1}},
+ {2952, {wxPrintout, new, 1}},
+ {2953, {wxPrintout, destruct, 0}},
+ {2954, {wxPrintout, getDC, 0}},
+ {2955, {wxPrintout, getPageSizeMM, 2}},
+ {2956, {wxPrintout, getPageSizePixels, 2}},
+ {2957, {wxPrintout, getPaperRectPixels, 0}},
+ {2958, {wxPrintout, getPPIPrinter, 2}},
+ {2959, {wxPrintout, getPPIScreen, 2}},
+ {2960, {wxPrintout, getTitle, 0}},
+ {2961, {wxPrintout, isPreview, 0}},
+ {2962, {wxPrintout, fitThisSizeToPaper, 1}},
+ {2963, {wxPrintout, fitThisSizeToPage, 1}},
+ {2964, {wxPrintout, fitThisSizeToPageMargins, 2}},
+ {2965, {wxPrintout, mapScreenSizeToPaper, 0}},
+ {2966, {wxPrintout, mapScreenSizeToPage, 0}},
+ {2967, {wxPrintout, mapScreenSizeToPageMargins, 1}},
+ {2968, {wxPrintout, mapScreenSizeToDevice, 0}},
+ {2969, {wxPrintout, getLogicalPaperRect, 0}},
+ {2970, {wxPrintout, getLogicalPageRect, 0}},
+ {2971, {wxPrintout, getLogicalPageMarginsRect, 1}},
+ {2972, {wxPrintout, setLogicalOrigin, 2}},
+ {2973, {wxPrintout, offsetLogicalOrigin, 2}},
+ {2974, {wxStyledTextCtrl, new_2, 2}},
+ {2975, {wxStyledTextCtrl, new_0, 0}},
+ {2976, {wxStyledTextCtrl, destruct, 0}},
+ {2977, {wxStyledTextCtrl, create, 2}},
+ {2978, {wxStyledTextCtrl, addText, 1}},
+ {2979, {wxStyledTextCtrl, addStyledText, 1}},
+ {2980, {wxStyledTextCtrl, insertText, 2}},
+ {2981, {wxStyledTextCtrl, clearAll, 0}},
+ {2982, {wxStyledTextCtrl, clearDocumentStyle, 0}},
+ {2983, {wxStyledTextCtrl, getLength, 0}},
+ {2984, {wxStyledTextCtrl, getCharAt, 1}},
+ {2985, {wxStyledTextCtrl, getCurrentPos, 0}},
+ {2986, {wxStyledTextCtrl, getAnchor, 0}},
+ {2987, {wxStyledTextCtrl, getStyleAt, 1}},
+ {2988, {wxStyledTextCtrl, redo, 0}},
+ {2989, {wxStyledTextCtrl, setUndoCollection, 1}},
+ {2990, {wxStyledTextCtrl, selectAll, 0}},
+ {2991, {wxStyledTextCtrl, setSavePoint, 0}},
+ {2992, {wxStyledTextCtrl, getStyledText, 2}},
+ {2993, {wxStyledTextCtrl, canRedo, 0}},
+ {2994, {wxStyledTextCtrl, markerLineFromHandle, 1}},
+ {2995, {wxStyledTextCtrl, markerDeleteHandle, 1}},
+ {2996, {wxStyledTextCtrl, getUndoCollection, 0}},
+ {2997, {wxStyledTextCtrl, getViewWhiteSpace, 0}},
+ {2998, {wxStyledTextCtrl, setViewWhiteSpace, 1}},
+ {2999, {wxStyledTextCtrl, positionFromPoint, 1}},
+ {3000, {wxStyledTextCtrl, positionFromPointClose, 2}},
+ {3001, {wxStyledTextCtrl, gotoLine, 1}},
+ {3002, {wxStyledTextCtrl, gotoPos, 1}},
+ {3003, {wxStyledTextCtrl, setAnchor, 1}},
+ {3004, {wxStyledTextCtrl, getCurLine, 1}},
+ {3005, {wxStyledTextCtrl, getEndStyled, 0}},
+ {3006, {wxStyledTextCtrl, convertEOLs, 1}},
+ {3007, {wxStyledTextCtrl, getEOLMode, 0}},
+ {3008, {wxStyledTextCtrl, setEOLMode, 1}},
+ {3009, {wxStyledTextCtrl, startStyling, 2}},
+ {3010, {wxStyledTextCtrl, setStyling, 2}},
+ {3011, {wxStyledTextCtrl, getBufferedDraw, 0}},
+ {3012, {wxStyledTextCtrl, setBufferedDraw, 1}},
+ {3013, {wxStyledTextCtrl, setTabWidth, 1}},
+ {3014, {wxStyledTextCtrl, getTabWidth, 0}},
+ {3015, {wxStyledTextCtrl, setCodePage, 1}},
+ {3016, {wxStyledTextCtrl, markerDefine, 3}},
+ {3017, {wxStyledTextCtrl, markerSetForeground, 2}},
+ {3018, {wxStyledTextCtrl, markerSetBackground, 2}},
+ {3019, {wxStyledTextCtrl, markerAdd, 2}},
+ {3020, {wxStyledTextCtrl, markerDelete, 2}},
+ {3021, {wxStyledTextCtrl, markerDeleteAll, 1}},
+ {3022, {wxStyledTextCtrl, markerGet, 1}},
+ {3023, {wxStyledTextCtrl, markerNext, 2}},
+ {3024, {wxStyledTextCtrl, markerPrevious, 2}},
+ {3025, {wxStyledTextCtrl, markerDefineBitmap, 2}},
+ {3026, {wxStyledTextCtrl, markerAddSet, 2}},
+ {3027, {wxStyledTextCtrl, markerSetAlpha, 2}},
+ {3028, {wxStyledTextCtrl, setMarginType, 2}},
+ {3029, {wxStyledTextCtrl, getMarginType, 1}},
+ {3030, {wxStyledTextCtrl, setMarginWidth, 2}},
+ {3031, {wxStyledTextCtrl, getMarginWidth, 1}},
+ {3032, {wxStyledTextCtrl, setMarginMask, 2}},
+ {3033, {wxStyledTextCtrl, getMarginMask, 1}},
+ {3034, {wxStyledTextCtrl, setMarginSensitive, 2}},
+ {3035, {wxStyledTextCtrl, getMarginSensitive, 1}},
+ {3036, {wxStyledTextCtrl, styleClearAll, 0}},
+ {3037, {wxStyledTextCtrl, styleSetForeground, 2}},
+ {3038, {wxStyledTextCtrl, styleSetBackground, 2}},
+ {3039, {wxStyledTextCtrl, styleSetBold, 2}},
+ {3040, {wxStyledTextCtrl, styleSetItalic, 2}},
+ {3041, {wxStyledTextCtrl, styleSetSize, 2}},
+ {3042, {wxStyledTextCtrl, styleSetFaceName, 2}},
+ {3043, {wxStyledTextCtrl, styleSetEOLFilled, 2}},
+ {3044, {wxStyledTextCtrl, styleResetDefault, 0}},
+ {3045, {wxStyledTextCtrl, styleSetUnderline, 2}},
+ {3046, {wxStyledTextCtrl, styleSetCase, 2}},
+ {3047, {wxStyledTextCtrl, styleSetHotSpot, 2}},
+ {3048, {wxStyledTextCtrl, setSelForeground, 2}},
+ {3049, {wxStyledTextCtrl, setSelBackground, 2}},
+ {3050, {wxStyledTextCtrl, getSelAlpha, 0}},
+ {3051, {wxStyledTextCtrl, setSelAlpha, 1}},
+ {3052, {wxStyledTextCtrl, setCaretForeground, 1}},
+ {3053, {wxStyledTextCtrl, cmdKeyAssign, 3}},
+ {3054, {wxStyledTextCtrl, cmdKeyClear, 2}},
+ {3055, {wxStyledTextCtrl, cmdKeyClearAll, 0}},
+ {3056, {wxStyledTextCtrl, setStyleBytes, 2}},
+ {3057, {wxStyledTextCtrl, styleSetVisible, 2}},
+ {3058, {wxStyledTextCtrl, getCaretPeriod, 0}},
+ {3059, {wxStyledTextCtrl, setCaretPeriod, 1}},
+ {3060, {wxStyledTextCtrl, setWordChars, 1}},
+ {3061, {wxStyledTextCtrl, beginUndoAction, 0}},
+ {3062, {wxStyledTextCtrl, endUndoAction, 0}},
+ {3063, {wxStyledTextCtrl, indicatorSetStyle, 2}},
+ {3064, {wxStyledTextCtrl, indicatorGetStyle, 1}},
+ {3065, {wxStyledTextCtrl, indicatorSetForeground, 2}},
+ {3066, {wxStyledTextCtrl, indicatorGetForeground, 1}},
+ {3067, {wxStyledTextCtrl, setWhitespaceForeground, 2}},
+ {3068, {wxStyledTextCtrl, setWhitespaceBackground, 2}},
+ {3069, {wxStyledTextCtrl, getStyleBits, 0}},
+ {3070, {wxStyledTextCtrl, setLineState, 2}},
+ {3071, {wxStyledTextCtrl, getLineState, 1}},
+ {3072, {wxStyledTextCtrl, getMaxLineState, 0}},
+ {3073, {wxStyledTextCtrl, getCaretLineVisible, 0}},
+ {3074, {wxStyledTextCtrl, setCaretLineVisible, 1}},
+ {3075, {wxStyledTextCtrl, getCaretLineBackground, 0}},
+ {3076, {wxStyledTextCtrl, setCaretLineBackground, 1}},
+ {3077, {wxStyledTextCtrl, autoCompShow, 2}},
+ {3078, {wxStyledTextCtrl, autoCompCancel, 0}},
+ {3079, {wxStyledTextCtrl, autoCompActive, 0}},
+ {3080, {wxStyledTextCtrl, autoCompPosStart, 0}},
+ {3081, {wxStyledTextCtrl, autoCompComplete, 0}},
+ {3082, {wxStyledTextCtrl, autoCompStops, 1}},
+ {3083, {wxStyledTextCtrl, autoCompSetSeparator, 1}},
+ {3084, {wxStyledTextCtrl, autoCompGetSeparator, 0}},
+ {3085, {wxStyledTextCtrl, autoCompSelect, 1}},
+ {3086, {wxStyledTextCtrl, autoCompSetCancelAtStart, 1}},
+ {3087, {wxStyledTextCtrl, autoCompGetCancelAtStart, 0}},
+ {3088, {wxStyledTextCtrl, autoCompSetFillUps, 1}},
+ {3089, {wxStyledTextCtrl, autoCompSetChooseSingle, 1}},
+ {3090, {wxStyledTextCtrl, autoCompGetChooseSingle, 0}},
+ {3091, {wxStyledTextCtrl, autoCompSetIgnoreCase, 1}},
+ {3092, {wxStyledTextCtrl, autoCompGetIgnoreCase, 0}},
+ {3093, {wxStyledTextCtrl, userListShow, 2}},
+ {3094, {wxStyledTextCtrl, autoCompSetAutoHide, 1}},
+ {3095, {wxStyledTextCtrl, autoCompGetAutoHide, 0}},
+ {3096, {wxStyledTextCtrl, autoCompSetDropRestOfWord, 1}},
+ {3097, {wxStyledTextCtrl, autoCompGetDropRestOfWord, 0}},
+ {3098, {wxStyledTextCtrl, registerImage, 2}},
+ {3099, {wxStyledTextCtrl, clearRegisteredImages, 0}},
+ {3100, {wxStyledTextCtrl, autoCompGetTypeSeparator, 0}},
+ {3101, {wxStyledTextCtrl, autoCompSetTypeSeparator, 1}},
+ {3102, {wxStyledTextCtrl, autoCompSetMaxWidth, 1}},
+ {3103, {wxStyledTextCtrl, autoCompGetMaxWidth, 0}},
+ {3104, {wxStyledTextCtrl, autoCompSetMaxHeight, 1}},
+ {3105, {wxStyledTextCtrl, autoCompGetMaxHeight, 0}},
+ {3106, {wxStyledTextCtrl, setIndent, 1}},
+ {3107, {wxStyledTextCtrl, getIndent, 0}},
+ {3108, {wxStyledTextCtrl, setUseTabs, 1}},
+ {3109, {wxStyledTextCtrl, getUseTabs, 0}},
+ {3110, {wxStyledTextCtrl, setLineIndentation, 2}},
+ {3111, {wxStyledTextCtrl, getLineIndentation, 1}},
+ {3112, {wxStyledTextCtrl, getLineIndentPosition, 1}},
+ {3113, {wxStyledTextCtrl, getColumn, 1}},
+ {3114, {wxStyledTextCtrl, setUseHorizontalScrollBar, 1}},
+ {3115, {wxStyledTextCtrl, getUseHorizontalScrollBar, 0}},
+ {3116, {wxStyledTextCtrl, setIndentationGuides, 1}},
+ {3117, {wxStyledTextCtrl, getIndentationGuides, 0}},
+ {3118, {wxStyledTextCtrl, setHighlightGuide, 1}},
+ {3119, {wxStyledTextCtrl, getHighlightGuide, 0}},
+ {3120, {wxStyledTextCtrl, getLineEndPosition, 1}},
+ {3121, {wxStyledTextCtrl, getCodePage, 0}},
+ {3122, {wxStyledTextCtrl, getCaretForeground, 0}},
+ {3123, {wxStyledTextCtrl, getReadOnly, 0}},
+ {3124, {wxStyledTextCtrl, setCurrentPos, 1}},
+ {3125, {wxStyledTextCtrl, setSelectionStart, 1}},
+ {3126, {wxStyledTextCtrl, getSelectionStart, 0}},
+ {3127, {wxStyledTextCtrl, setSelectionEnd, 1}},
+ {3128, {wxStyledTextCtrl, getSelectionEnd, 0}},
+ {3129, {wxStyledTextCtrl, setPrintMagnification, 1}},
+ {3130, {wxStyledTextCtrl, getPrintMagnification, 0}},
+ {3131, {wxStyledTextCtrl, setPrintColourMode, 1}},
+ {3132, {wxStyledTextCtrl, getPrintColourMode, 0}},
+ {3133, {wxStyledTextCtrl, findText, 4}},
+ {3134, {wxStyledTextCtrl, formatRange, 7}},
+ {3135, {wxStyledTextCtrl, getFirstVisibleLine, 0}},
+ {3136, {wxStyledTextCtrl, getLine, 1}},
+ {3137, {wxStyledTextCtrl, getLineCount, 0}},
+ {3138, {wxStyledTextCtrl, setMarginLeft, 1}},
+ {3139, {wxStyledTextCtrl, getMarginLeft, 0}},
+ {3140, {wxStyledTextCtrl, setMarginRight, 1}},
+ {3141, {wxStyledTextCtrl, getMarginRight, 0}},
+ {3142, {wxStyledTextCtrl, getModify, 0}},
+ {3143, {wxStyledTextCtrl, setSelection, 2}},
+ {3144, {wxStyledTextCtrl, getSelectedText, 0}},
+ {3145, {wxStyledTextCtrl, getTextRange, 2}},
+ {3146, {wxStyledTextCtrl, hideSelection, 1}},
+ {3147, {wxStyledTextCtrl, lineFromPosition, 1}},
+ {3148, {wxStyledTextCtrl, positionFromLine, 1}},
+ {3149, {wxStyledTextCtrl, lineScroll, 2}},
+ {3150, {wxStyledTextCtrl, ensureCaretVisible, 0}},
+ {3151, {wxStyledTextCtrl, replaceSelection, 1}},
+ {3152, {wxStyledTextCtrl, setReadOnly, 1}},
+ {3153, {wxStyledTextCtrl, canPaste, 0}},
+ {3154, {wxStyledTextCtrl, canUndo, 0}},
+ {3155, {wxStyledTextCtrl, emptyUndoBuffer, 0}},
+ {3156, {wxStyledTextCtrl, undo, 0}},
+ {3157, {wxStyledTextCtrl, cut, 0}},
+ {3158, {wxStyledTextCtrl, copy, 0}},
+ {3159, {wxStyledTextCtrl, paste, 0}},
+ {3160, {wxStyledTextCtrl, clear, 0}},
+ {3161, {wxStyledTextCtrl, setText, 1}},
+ {3162, {wxStyledTextCtrl, getText, 0}},
+ {3163, {wxStyledTextCtrl, getTextLength, 0}},
+ {3164, {wxStyledTextCtrl, getOvertype, 0}},
+ {3165, {wxStyledTextCtrl, setCaretWidth, 1}},
+ {3166, {wxStyledTextCtrl, getCaretWidth, 0}},
+ {3167, {wxStyledTextCtrl, setTargetStart, 1}},
+ {3168, {wxStyledTextCtrl, getTargetStart, 0}},
+ {3169, {wxStyledTextCtrl, setTargetEnd, 1}},
+ {3170, {wxStyledTextCtrl, getTargetEnd, 0}},
+ {3171, {wxStyledTextCtrl, replaceTarget, 1}},
+ {3172, {wxStyledTextCtrl, searchInTarget, 1}},
+ {3173, {wxStyledTextCtrl, setSearchFlags, 1}},
+ {3174, {wxStyledTextCtrl, getSearchFlags, 0}},
+ {3175, {wxStyledTextCtrl, callTipShow, 2}},
+ {3176, {wxStyledTextCtrl, callTipCancel, 0}},
+ {3177, {wxStyledTextCtrl, callTipActive, 0}},
+ {3178, {wxStyledTextCtrl, callTipPosAtStart, 0}},
+ {3179, {wxStyledTextCtrl, callTipSetHighlight, 2}},
+ {3180, {wxStyledTextCtrl, callTipSetBackground, 1}},
+ {3181, {wxStyledTextCtrl, callTipSetForeground, 1}},
+ {3182, {wxStyledTextCtrl, callTipSetForegroundHighlight, 1}},
+ {3183, {wxStyledTextCtrl, callTipUseStyle, 1}},
+ {3184, {wxStyledTextCtrl, visibleFromDocLine, 1}},
+ {3185, {wxStyledTextCtrl, docLineFromVisible, 1}},
+ {3186, {wxStyledTextCtrl, wrapCount, 1}},
+ {3187, {wxStyledTextCtrl, setFoldLevel, 2}},
+ {3188, {wxStyledTextCtrl, getFoldLevel, 1}},
+ {3189, {wxStyledTextCtrl, getLastChild, 2}},
+ {3190, {wxStyledTextCtrl, getFoldParent, 1}},
+ {3191, {wxStyledTextCtrl, showLines, 2}},
+ {3192, {wxStyledTextCtrl, hideLines, 2}},
+ {3193, {wxStyledTextCtrl, getLineVisible, 1}},
+ {3194, {wxStyledTextCtrl, setFoldExpanded, 2}},
+ {3195, {wxStyledTextCtrl, getFoldExpanded, 1}},
+ {3196, {wxStyledTextCtrl, toggleFold, 1}},
+ {3197, {wxStyledTextCtrl, ensureVisible, 1}},
+ {3198, {wxStyledTextCtrl, setFoldFlags, 1}},
+ {3199, {wxStyledTextCtrl, ensureVisibleEnforcePolicy, 1}},
+ {3200, {wxStyledTextCtrl, setTabIndents, 1}},
+ {3201, {wxStyledTextCtrl, getTabIndents, 0}},
+ {3202, {wxStyledTextCtrl, setBackSpaceUnIndents, 1}},
+ {3203, {wxStyledTextCtrl, getBackSpaceUnIndents, 0}},
+ {3204, {wxStyledTextCtrl, setMouseDwellTime, 1}},
+ {3205, {wxStyledTextCtrl, getMouseDwellTime, 0}},
+ {3206, {wxStyledTextCtrl, wordStartPosition, 2}},
+ {3207, {wxStyledTextCtrl, wordEndPosition, 2}},
+ {3208, {wxStyledTextCtrl, setWrapMode, 1}},
+ {3209, {wxStyledTextCtrl, getWrapMode, 0}},
+ {3210, {wxStyledTextCtrl, setWrapVisualFlags, 1}},
+ {3211, {wxStyledTextCtrl, getWrapVisualFlags, 0}},
+ {3212, {wxStyledTextCtrl, setWrapVisualFlagsLocation, 1}},
+ {3213, {wxStyledTextCtrl, getWrapVisualFlagsLocation, 0}},
+ {3214, {wxStyledTextCtrl, setWrapStartIndent, 1}},
+ {3215, {wxStyledTextCtrl, getWrapStartIndent, 0}},
+ {3216, {wxStyledTextCtrl, setLayoutCache, 1}},
+ {3217, {wxStyledTextCtrl, getLayoutCache, 0}},
+ {3218, {wxStyledTextCtrl, setScrollWidth, 1}},
+ {3219, {wxStyledTextCtrl, getScrollWidth, 0}},
+ {3220, {wxStyledTextCtrl, textWidth, 2}},
+ {3221, {wxStyledTextCtrl, getEndAtLastLine, 0}},
+ {3222, {wxStyledTextCtrl, textHeight, 1}},
+ {3223, {wxStyledTextCtrl, setUseVerticalScrollBar, 1}},
+ {3224, {wxStyledTextCtrl, getUseVerticalScrollBar, 0}},
+ {3225, {wxStyledTextCtrl, appendText, 1}},
+ {3226, {wxStyledTextCtrl, getTwoPhaseDraw, 0}},
+ {3227, {wxStyledTextCtrl, setTwoPhaseDraw, 1}},
+ {3228, {wxStyledTextCtrl, targetFromSelection, 0}},
+ {3229, {wxStyledTextCtrl, linesJoin, 0}},
+ {3230, {wxStyledTextCtrl, linesSplit, 1}},
+ {3231, {wxStyledTextCtrl, setFoldMarginColour, 2}},
+ {3232, {wxStyledTextCtrl, setFoldMarginHiColour, 2}},
+ {3233, {wxStyledTextCtrl, lineDown, 0}},
+ {3234, {wxStyledTextCtrl, lineDownExtend, 0}},
+ {3235, {wxStyledTextCtrl, lineUp, 0}},
+ {3236, {wxStyledTextCtrl, lineUpExtend, 0}},
+ {3237, {wxStyledTextCtrl, charLeft, 0}},
+ {3238, {wxStyledTextCtrl, charLeftExtend, 0}},
+ {3239, {wxStyledTextCtrl, charRight, 0}},
+ {3240, {wxStyledTextCtrl, charRightExtend, 0}},
+ {3241, {wxStyledTextCtrl, wordLeft, 0}},
+ {3242, {wxStyledTextCtrl, wordLeftExtend, 0}},
+ {3243, {wxStyledTextCtrl, wordRight, 0}},
+ {3244, {wxStyledTextCtrl, wordRightExtend, 0}},
+ {3245, {wxStyledTextCtrl, home, 0}},
+ {3246, {wxStyledTextCtrl, homeExtend, 0}},
+ {3247, {wxStyledTextCtrl, lineEnd, 0}},
+ {3248, {wxStyledTextCtrl, lineEndExtend, 0}},
+ {3249, {wxStyledTextCtrl, documentStart, 0}},
+ {3250, {wxStyledTextCtrl, documentStartExtend, 0}},
+ {3251, {wxStyledTextCtrl, documentEnd, 0}},
+ {3252, {wxStyledTextCtrl, documentEndExtend, 0}},
+ {3253, {wxStyledTextCtrl, pageUp, 0}},
+ {3254, {wxStyledTextCtrl, pageUpExtend, 0}},
+ {3255, {wxStyledTextCtrl, pageDown, 0}},
+ {3256, {wxStyledTextCtrl, pageDownExtend, 0}},
+ {3257, {wxStyledTextCtrl, editToggleOvertype, 0}},
+ {3258, {wxStyledTextCtrl, cancel, 0}},
+ {3259, {wxStyledTextCtrl, deleteBack, 0}},
+ {3260, {wxStyledTextCtrl, tab, 0}},
+ {3261, {wxStyledTextCtrl, backTab, 0}},
+ {3262, {wxStyledTextCtrl, newLine, 0}},
+ {3263, {wxStyledTextCtrl, formFeed, 0}},
+ {3264, {wxStyledTextCtrl, vCHome, 0}},
+ {3265, {wxStyledTextCtrl, vCHomeExtend, 0}},
+ {3266, {wxStyledTextCtrl, zoomIn, 0}},
+ {3267, {wxStyledTextCtrl, zoomOut, 0}},
+ {3268, {wxStyledTextCtrl, delWordLeft, 0}},
+ {3269, {wxStyledTextCtrl, delWordRight, 0}},
+ {3270, {wxStyledTextCtrl, lineCut, 0}},
+ {3271, {wxStyledTextCtrl, lineDelete, 0}},
+ {3272, {wxStyledTextCtrl, lineTranspose, 0}},
+ {3273, {wxStyledTextCtrl, lineDuplicate, 0}},
+ {3274, {wxStyledTextCtrl, lowerCase, 0}},
+ {3275, {wxStyledTextCtrl, upperCase, 0}},
+ {3276, {wxStyledTextCtrl, lineScrollDown, 0}},
+ {3277, {wxStyledTextCtrl, lineScrollUp, 0}},
+ {3278, {wxStyledTextCtrl, deleteBackNotLine, 0}},
+ {3279, {wxStyledTextCtrl, homeDisplay, 0}},
+ {3280, {wxStyledTextCtrl, homeDisplayExtend, 0}},
+ {3281, {wxStyledTextCtrl, lineEndDisplay, 0}},
+ {3282, {wxStyledTextCtrl, lineEndDisplayExtend, 0}},
+ {3283, {wxStyledTextCtrl, homeWrapExtend, 0}},
+ {3284, {wxStyledTextCtrl, lineEndWrap, 0}},
+ {3285, {wxStyledTextCtrl, lineEndWrapExtend, 0}},
+ {3286, {wxStyledTextCtrl, vCHomeWrap, 0}},
+ {3287, {wxStyledTextCtrl, vCHomeWrapExtend, 0}},
+ {3288, {wxStyledTextCtrl, lineCopy, 0}},
+ {3289, {wxStyledTextCtrl, moveCaretInsideView, 0}},
+ {3290, {wxStyledTextCtrl, lineLength, 1}},
+ {3291, {wxStyledTextCtrl, braceHighlight, 2}},
+ {3292, {wxStyledTextCtrl, braceBadLight, 1}},
+ {3293, {wxStyledTextCtrl, braceMatch, 1}},
+ {3294, {wxStyledTextCtrl, getViewEOL, 0}},
+ {3295, {wxStyledTextCtrl, setViewEOL, 1}},
+ {3296, {wxStyledTextCtrl, setModEventMask, 1}},
+ {3297, {wxStyledTextCtrl, getEdgeColumn, 0}},
+ {3298, {wxStyledTextCtrl, setEdgeColumn, 1}},
+ {3299, {wxStyledTextCtrl, setEdgeMode, 1}},
+ {3300, {wxStyledTextCtrl, getEdgeMode, 0}},
+ {3301, {wxStyledTextCtrl, getEdgeColour, 0}},
+ {3302, {wxStyledTextCtrl, setEdgeColour, 1}},
+ {3303, {wxStyledTextCtrl, searchAnchor, 0}},
+ {3304, {wxStyledTextCtrl, searchNext, 2}},
+ {3305, {wxStyledTextCtrl, searchPrev, 2}},
+ {3306, {wxStyledTextCtrl, linesOnScreen, 0}},
+ {3307, {wxStyledTextCtrl, usePopUp, 1}},
+ {3308, {wxStyledTextCtrl, selectionIsRectangle, 0}},
+ {3309, {wxStyledTextCtrl, setZoom, 1}},
+ {3310, {wxStyledTextCtrl, getZoom, 0}},
+ {3311, {wxStyledTextCtrl, getModEventMask, 0}},
+ {3312, {wxStyledTextCtrl, setSTCFocus, 1}},
+ {3313, {wxStyledTextCtrl, getSTCFocus, 0}},
+ {3314, {wxStyledTextCtrl, setStatus, 1}},
+ {3315, {wxStyledTextCtrl, getStatus, 0}},
+ {3316, {wxStyledTextCtrl, setMouseDownCaptures, 1}},
+ {3317, {wxStyledTextCtrl, getMouseDownCaptures, 0}},
+ {3318, {wxStyledTextCtrl, setSTCCursor, 1}},
+ {3319, {wxStyledTextCtrl, getSTCCursor, 0}},
+ {3320, {wxStyledTextCtrl, setControlCharSymbol, 1}},
+ {3321, {wxStyledTextCtrl, getControlCharSymbol, 0}},
+ {3322, {wxStyledTextCtrl, wordPartLeft, 0}},
+ {3323, {wxStyledTextCtrl, wordPartLeftExtend, 0}},
+ {3324, {wxStyledTextCtrl, wordPartRight, 0}},
+ {3325, {wxStyledTextCtrl, wordPartRightExtend, 0}},
+ {3326, {wxStyledTextCtrl, setVisiblePolicy, 2}},
+ {3327, {wxStyledTextCtrl, delLineLeft, 0}},
+ {3328, {wxStyledTextCtrl, delLineRight, 0}},
+ {3329, {wxStyledTextCtrl, getXOffset, 0}},
+ {3330, {wxStyledTextCtrl, chooseCaretX, 0}},
+ {3331, {wxStyledTextCtrl, setXCaretPolicy, 2}},
+ {3332, {wxStyledTextCtrl, setYCaretPolicy, 2}},
+ {3333, {wxStyledTextCtrl, getPrintWrapMode, 0}},
+ {3334, {wxStyledTextCtrl, setHotspotActiveForeground, 2}},
+ {3335, {wxStyledTextCtrl, setHotspotActiveBackground, 2}},
+ {3336, {wxStyledTextCtrl, setHotspotActiveUnderline, 1}},
+ {3337, {wxStyledTextCtrl, setHotspotSingleLine, 1}},
+ {3338, {wxStyledTextCtrl, paraDownExtend, 0}},
+ {3339, {wxStyledTextCtrl, paraUp, 0}},
+ {3340, {wxStyledTextCtrl, paraUpExtend, 0}},
+ {3341, {wxStyledTextCtrl, positionBefore, 1}},
+ {3342, {wxStyledTextCtrl, positionAfter, 1}},
+ {3343, {wxStyledTextCtrl, copyRange, 2}},
+ {3344, {wxStyledTextCtrl, copyText, 2}},
+ {3345, {wxStyledTextCtrl, setSelectionMode, 1}},
+ {3346, {wxStyledTextCtrl, getSelectionMode, 0}},
+ {3347, {wxStyledTextCtrl, lineDownRectExtend, 0}},
+ {3348, {wxStyledTextCtrl, lineUpRectExtend, 0}},
+ {3349, {wxStyledTextCtrl, charLeftRectExtend, 0}},
+ {3350, {wxStyledTextCtrl, charRightRectExtend, 0}},
+ {3351, {wxStyledTextCtrl, homeRectExtend, 0}},
+ {3352, {wxStyledTextCtrl, vCHomeRectExtend, 0}},
+ {3353, {wxStyledTextCtrl, lineEndRectExtend, 0}},
+ {3354, {wxStyledTextCtrl, pageUpRectExtend, 0}},
+ {3355, {wxStyledTextCtrl, pageDownRectExtend, 0}},
+ {3356, {wxStyledTextCtrl, stutteredPageUp, 0}},
+ {3357, {wxStyledTextCtrl, stutteredPageUpExtend, 0}},
+ {3358, {wxStyledTextCtrl, stutteredPageDown, 0}},
+ {3359, {wxStyledTextCtrl, stutteredPageDownExtend, 0}},
+ {3360, {wxStyledTextCtrl, wordLeftEnd, 0}},
+ {3361, {wxStyledTextCtrl, wordLeftEndExtend, 0}},
+ {3362, {wxStyledTextCtrl, wordRightEnd, 0}},
+ {3363, {wxStyledTextCtrl, wordRightEndExtend, 0}},
+ {3364, {wxStyledTextCtrl, setWhitespaceChars, 1}},
+ {3365, {wxStyledTextCtrl, setCharsDefault, 0}},
+ {3366, {wxStyledTextCtrl, autoCompGetCurrent, 0}},
+ {3367, {wxStyledTextCtrl, allocate, 1}},
+ {3368, {wxStyledTextCtrl, findColumn, 2}},
+ {3369, {wxStyledTextCtrl, getCaretSticky, 0}},
+ {3370, {wxStyledTextCtrl, setCaretSticky, 1}},
+ {3371, {wxStyledTextCtrl, toggleCaretSticky, 0}},
+ {3372, {wxStyledTextCtrl, setPasteConvertEndings, 1}},
+ {3373, {wxStyledTextCtrl, getPasteConvertEndings, 0}},
+ {3374, {wxStyledTextCtrl, selectionDuplicate, 0}},
+ {3375, {wxStyledTextCtrl, setCaretLineBackAlpha, 1}},
+ {3376, {wxStyledTextCtrl, getCaretLineBackAlpha, 0}},
+ {3377, {wxStyledTextCtrl, startRecord, 0}},
+ {3378, {wxStyledTextCtrl, stopRecord, 0}},
+ {3379, {wxStyledTextCtrl, setLexer, 1}},
+ {3380, {wxStyledTextCtrl, getLexer, 0}},
+ {3381, {wxStyledTextCtrl, colourise, 2}},
+ {3382, {wxStyledTextCtrl, setProperty, 2}},
+ {3383, {wxStyledTextCtrl, setKeyWords, 2}},
+ {3384, {wxStyledTextCtrl, setLexerLanguage, 1}},
+ {3385, {wxStyledTextCtrl, getProperty, 1}},
+ {3386, {wxStyledTextCtrl, getStyleBitsNeeded, 0}},
+ {3387, {wxStyledTextCtrl, getCurrentLine, 0}},
+ {3388, {wxStyledTextCtrl, styleSetSpec, 2}},
+ {3389, {wxStyledTextCtrl, styleSetFont, 2}},
+ {3390, {wxStyledTextCtrl, styleSetFontAttr, 7}},
+ {3391, {wxStyledTextCtrl, styleSetCharacterSet, 2}},
+ {3392, {wxStyledTextCtrl, styleSetFontEncoding, 2}},
+ {3393, {wxStyledTextCtrl, cmdKeyExecute, 1}},
+ {3394, {wxStyledTextCtrl, setMargins, 2}},
+ {3395, {wxStyledTextCtrl, getSelection, 2}},
+ {3396, {wxStyledTextCtrl, pointFromPosition, 1}},
+ {3397, {wxStyledTextCtrl, scrollToLine, 1}},
+ {3398, {wxStyledTextCtrl, scrollToColumn, 1}},
+ {3399, {wxStyledTextCtrl, setVScrollBar, 1}},
+ {3400, {wxStyledTextCtrl, setHScrollBar, 1}},
+ {3401, {wxStyledTextCtrl, getLastKeydownProcessed, 0}},
+ {3402, {wxStyledTextCtrl, setLastKeydownProcessed, 1}},
+ {3403, {wxStyledTextCtrl, saveFile, 1}},
+ {3404, {wxStyledTextCtrl, loadFile, 1}},
+ {3405, {wxStyledTextCtrl, doDragOver, 3}},
+ {3406, {wxStyledTextCtrl, doDropText, 3}},
+ {3407, {wxStyledTextCtrl, getUseAntiAliasing, 0}},
+ {3408, {wxStyledTextCtrl, addTextRaw, 1}},
+ {3409, {wxStyledTextCtrl, insertTextRaw, 2}},
+ {3410, {wxStyledTextCtrl, getCurLineRaw, 1}},
+ {3411, {wxStyledTextCtrl, getLineRaw, 1}},
+ {3412, {wxStyledTextCtrl, getSelectedTextRaw, 0}},
+ {3413, {wxStyledTextCtrl, getTextRangeRaw, 2}},
+ {3414, {wxStyledTextCtrl, setTextRaw, 1}},
+ {3415, {wxStyledTextCtrl, getTextRaw, 0}},
+ {3416, {wxStyledTextCtrl, appendTextRaw, 1}},
+ {3417, {wxArtProvider, getBitmap, 2}},
+ {3418, {wxArtProvider, getIcon, 2}},
+ {3419, {wxTreeEvent, getKeyCode, 0}},
+ {3420, {wxTreeEvent, getItem, 0}},
+ {3421, {wxTreeEvent, getKeyEvent, 0}},
+ {3422, {wxTreeEvent, getLabel, 0}},
+ {3423, {wxTreeEvent, getOldItem, 0}},
+ {3424, {wxTreeEvent, getPoint, 0}},
+ {3425, {wxTreeEvent, isEditCancelled, 0}},
+ {3426, {wxTreeEvent, setToolTip, 1}},
+ {3427, {wxNotebookEvent, getOldSelection, 0}},
+ {3428, {wxNotebookEvent, getSelection, 0}},
+ {3429, {wxNotebookEvent, setOldSelection, 1}},
+ {3430, {wxNotebookEvent, setSelection, 1}},
+ {3431, {wxFileDataObject, new, 0}},
+ {3432, {wxFileDataObject, addFile, 1}},
+ {3433, {wxFileDataObject, getFilenames, 0}},
+ {3434, {wxFileDataObject, 'Destroy', undefined}},
+ {3435, {wxTextDataObject, new, 1}},
+ {3436, {wxTextDataObject, getTextLength, 0}},
+ {3437, {wxTextDataObject, getText, 0}},
+ {3438, {wxTextDataObject, setText, 1}},
+ {3439, {wxTextDataObject, 'Destroy', undefined}},
+ {3440, {wxBitmapDataObject, new_1_1, 1}},
+ {3441, {wxBitmapDataObject, new_1_0, 1}},
+ {3442, {wxBitmapDataObject, getBitmap, 0}},
+ {3443, {wxBitmapDataObject, setBitmap, 1}},
+ {3444, {wxBitmapDataObject, 'Destroy', undefined}},
+ {3446, {wxClipboard, new, 0}},
+ {3447, {wxClipboard, destruct, 0}},
+ {3448, {wxClipboard, addData, 1}},
+ {3449, {wxClipboard, clear, 0}},
+ {3450, {wxClipboard, close, 0}},
+ {3451, {wxClipboard, flush, 0}},
+ {3452, {wxClipboard, getData, 1}},
+ {3453, {wxClipboard, isOpened, 0}},
+ {3454, {wxClipboard, open, 0}},
+ {3455, {wxClipboard, setData, 1}},
+ {3457, {wxClipboard, usePrimarySelection, 1}},
+ {3458, {wxClipboard, isSupported, 1}},
+ {3459, {wxClipboard, get, 0}},
+ {3460, {wxSpinEvent, getPosition, 0}},
+ {3461, {wxSpinEvent, setPosition, 1}},
+ {3462, {wxSplitterWindow, new_0, 0}},
+ {3463, {wxSplitterWindow, new_2, 2}},
+ {3464, {wxSplitterWindow, destruct, 0}},
+ {3465, {wxSplitterWindow, create, 2}},
+ {3466, {wxSplitterWindow, getMinimumPaneSize, 0}},
+ {3467, {wxSplitterWindow, getSashGravity, 0}},
+ {3468, {wxSplitterWindow, getSashPosition, 0}},
+ {3469, {wxSplitterWindow, getSplitMode, 0}},
+ {3470, {wxSplitterWindow, getWindow1, 0}},
+ {3471, {wxSplitterWindow, getWindow2, 0}},
+ {3472, {wxSplitterWindow, initialize, 1}},
+ {3473, {wxSplitterWindow, isSplit, 0}},
+ {3474, {wxSplitterWindow, replaceWindow, 2}},
+ {3475, {wxSplitterWindow, setSashGravity, 1}},
+ {3476, {wxSplitterWindow, setSashPosition, 2}},
+ {3477, {wxSplitterWindow, setSashSize, 1}},
+ {3478, {wxSplitterWindow, setMinimumPaneSize, 1}},
+ {3479, {wxSplitterWindow, setSplitMode, 1}},
+ {3480, {wxSplitterWindow, splitHorizontally, 3}},
+ {3481, {wxSplitterWindow, splitVertically, 3}},
+ {3482, {wxSplitterWindow, unsplit, 1}},
+ {3483, {wxSplitterWindow, updateSize, 0}},
+ {3484, {wxSplitterEvent, getSashPosition, 0}},
+ {3485, {wxSplitterEvent, getX, 0}},
+ {3486, {wxSplitterEvent, getY, 0}},
+ {3487, {wxSplitterEvent, getWindowBeingRemoved, 0}},
+ {3488, {wxSplitterEvent, setSashPosition, 1}},
+ {3489, {wxHtmlWindow, new_0, 0}},
+ {3490, {wxHtmlWindow, new_2, 2}},
+ {3491, {wxHtmlWindow, appendToPage, 1}},
+ {3492, {wxHtmlWindow, getOpenedAnchor, 0}},
+ {3493, {wxHtmlWindow, getOpenedPage, 0}},
+ {3494, {wxHtmlWindow, getOpenedPageTitle, 0}},
+ {3495, {wxHtmlWindow, getRelatedFrame, 0}},
+ {3496, {wxHtmlWindow, historyBack, 0}},
+ {3497, {wxHtmlWindow, historyCanBack, 0}},
+ {3498, {wxHtmlWindow, historyCanForward, 0}},
+ {3499, {wxHtmlWindow, historyClear, 0}},
+ {3500, {wxHtmlWindow, historyForward, 0}},
+ {3501, {wxHtmlWindow, loadFile, 1}},
+ {3502, {wxHtmlWindow, loadPage, 1}},
+ {3503, {wxHtmlWindow, selectAll, 0}},
+ {3504, {wxHtmlWindow, selectionToText, 0}},
+ {3505, {wxHtmlWindow, selectLine, 1}},
+ {3506, {wxHtmlWindow, selectWord, 1}},
+ {3507, {wxHtmlWindow, setBorders, 1}},
+ {3508, {wxHtmlWindow, setFonts, 3}},
+ {3509, {wxHtmlWindow, setPage, 1}},
+ {3510, {wxHtmlWindow, setRelatedFrame, 2}},
+ {3511, {wxHtmlWindow, setRelatedStatusBar, 1}},
+ {3512, {wxHtmlWindow, toText, 0}},
+ {3513, {wxHtmlWindow, 'Destroy', undefined}},
+ {3514, {wxHtmlLinkEvent, getLinkInfo, 0}},
+ {3515, {wxSystemSettings, getColour, 1}},
+ {3516, {wxSystemSettings, getFont, 1}},
+ {3517, {wxSystemSettings, getMetric, 2}},
+ {3518, {wxSystemSettings, getScreenType, 0}},
+ {3519, {wxSystemOptions, getOption, 1}},
+ {3520, {wxSystemOptions, getOptionInt, 1}},
+ {3521, {wxSystemOptions, hasOption, 1}},
+ {3522, {wxSystemOptions, isFalse, 1}},
+ {3523, {wxSystemOptions, setOption_2_1, 2}},
+ {3524, {wxSystemOptions, setOption_2_0, 2}},
+ {3525, {wxAuiNotebookEvent, setSelection, 1}},
+ {3526, {wxAuiNotebookEvent, getSelection, 0}},
+ {3527, {wxAuiNotebookEvent, setOldSelection, 1}},
+ {3528, {wxAuiNotebookEvent, getOldSelection, 0}},
+ {3529, {wxAuiNotebookEvent, setDragSource, 1}},
+ {3530, {wxAuiNotebookEvent, getDragSource, 0}},
+ {3531, {wxAuiManagerEvent, setManager, 1}},
+ {3532, {wxAuiManagerEvent, getManager, 0}},
+ {3533, {wxAuiManagerEvent, setPane, 1}},
+ {3534, {wxAuiManagerEvent, getPane, 0}},
+ {3535, {wxAuiManagerEvent, setButton, 1}},
+ {3536, {wxAuiManagerEvent, getButton, 0}},
+ {3537, {wxAuiManagerEvent, setDC, 1}},
+ {3538, {wxAuiManagerEvent, getDC, 0}},
+ {3539, {wxAuiManagerEvent, veto, 1}},
+ {3540, {wxAuiManagerEvent, getVeto, 0}},
+ {3541, {wxAuiManagerEvent, setCanVeto, 1}},
+ {3542, {wxAuiManagerEvent, canVeto, 0}},
+ {3543, {wxLogNull, new, 0}},
+ {3544, {wxLogNull, 'Destroy', undefined}},
+ {3545, {wxTaskBarIcon, new, 0}},
+ {3546, {wxTaskBarIcon, destruct, 0}},
+ {3547, {wxTaskBarIcon, popupMenu, 1}},
+ {3548, {wxTaskBarIcon, removeIcon, 0}},
+ {3549, {wxTaskBarIcon, setIcon, 2}},
+ {3550, {wxLocale, new_0, 0}},
+ {3552, {wxLocale, new_2, 2}},
+ {3553, {wxLocale, destruct, 0}},
+ {3555, {wxLocale, init, 1}},
+ {3556, {wxLocale, addCatalog_1, 1}},
+ {3557, {wxLocale, addCatalog_3, 3}},
+ {3558, {wxLocale, addCatalogLookupPathPrefix, 1}},
+ {3559, {wxLocale, getCanonicalName, 0}},
+ {3560, {wxLocale, getLanguage, 0}},
+ {3561, {wxLocale, getLanguageName, 1}},
+ {3562, {wxLocale, getLocale, 0}},
+ {3563, {wxLocale, getName, 0}},
+ {3564, {wxLocale, getString_2, 2}},
+ {3565, {wxLocale, getString_4, 4}},
+ {3566, {wxLocale, getHeaderValue, 2}},
+ {3567, {wxLocale, getSysName, 0}},
+ {3568, {wxLocale, getSystemEncoding, 0}},
+ {3569, {wxLocale, getSystemEncodingName, 0}},
+ {3570, {wxLocale, getSystemLanguage, 0}},
+ {3571, {wxLocale, isLoaded, 1}},
+ {3572, {wxLocale, isOk, 0}},
+ {3573, {wxActivateEvent, getActive, 0}},
+ {3575, {wxPopupWindow, new_2, 2}},
+ {3576, {wxPopupWindow, new_0, 0}},
+ {3578, {wxPopupWindow, destruct, 0}},
+ {3579, {wxPopupWindow, create, 2}},
+ {3580, {wxPopupWindow, position, 2}},
+ {3581, {wxPopupTransientWindow, new_0, 0}},
+ {3582, {wxPopupTransientWindow, new_2, 2}},
+ {3583, {wxPopupTransientWindow, destruct, 0}},
+ {3584, {wxPopupTransientWindow, popup, 1}},
+ {3585, {wxPopupTransientWindow, dismiss, 0}},
{-1, {mod, func, -1}}
].
diff --git a/lib/wx/src/gen/wxe_funcs.hrl b/lib/wx/src/gen/wxe_funcs.hrl
index faab72184d..d8c2ba9171 100644
--- a/lib/wx/src/gen/wxe_funcs.hrl
+++ b/lib/wx/src/gen/wxe_funcs.hrl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2014. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -2437,904 +2437,926 @@
-define(wxAuiPaneInfo_Top, 2650).
-define(wxAuiPaneInfo_TopDockable, 2651).
-define(wxAuiPaneInfo_Window, 2652).
--define(wxAuiNotebook_new_0, 2653).
--define(wxAuiNotebook_new_2, 2654).
--define(wxAuiNotebook_AddPage, 2655).
--define(wxAuiNotebook_Create, 2656).
--define(wxAuiNotebook_DeletePage, 2657).
--define(wxAuiNotebook_GetArtProvider, 2658).
--define(wxAuiNotebook_GetPage, 2659).
--define(wxAuiNotebook_GetPageBitmap, 2660).
--define(wxAuiNotebook_GetPageCount, 2661).
--define(wxAuiNotebook_GetPageIndex, 2662).
--define(wxAuiNotebook_GetPageText, 2663).
--define(wxAuiNotebook_GetSelection, 2664).
--define(wxAuiNotebook_InsertPage, 2665).
--define(wxAuiNotebook_RemovePage, 2666).
--define(wxAuiNotebook_SetArtProvider, 2667).
--define(wxAuiNotebook_SetFont, 2668).
--define(wxAuiNotebook_SetPageBitmap, 2669).
--define(wxAuiNotebook_SetPageText, 2670).
--define(wxAuiNotebook_SetSelection, 2671).
--define(wxAuiNotebook_SetTabCtrlHeight, 2672).
--define(wxAuiNotebook_SetUniformBitmapSize, 2673).
--define(wxAuiNotebook_destroy, 2674).
--define(wxMDIParentFrame_new_0, 2675).
--define(wxMDIParentFrame_new_4, 2676).
--define(wxMDIParentFrame_destruct, 2677).
--define(wxMDIParentFrame_ActivateNext, 2678).
--define(wxMDIParentFrame_ActivatePrevious, 2679).
--define(wxMDIParentFrame_ArrangeIcons, 2680).
--define(wxMDIParentFrame_Cascade, 2681).
--define(wxMDIParentFrame_Create, 2682).
--define(wxMDIParentFrame_GetActiveChild, 2683).
--define(wxMDIParentFrame_GetClientWindow, 2684).
--define(wxMDIParentFrame_Tile, 2685).
--define(wxMDIChildFrame_new_0, 2686).
--define(wxMDIChildFrame_new_4, 2687).
--define(wxMDIChildFrame_destruct, 2688).
--define(wxMDIChildFrame_Activate, 2689).
--define(wxMDIChildFrame_Create, 2690).
--define(wxMDIChildFrame_Maximize, 2691).
--define(wxMDIChildFrame_Restore, 2692).
--define(wxMDIClientWindow_new_0, 2693).
--define(wxMDIClientWindow_new_2, 2694).
--define(wxMDIClientWindow_destruct, 2695).
--define(wxMDIClientWindow_CreateClient, 2696).
--define(wxLayoutAlgorithm_new, 2697).
--define(wxLayoutAlgorithm_LayoutFrame, 2698).
--define(wxLayoutAlgorithm_LayoutMDIFrame, 2699).
--define(wxLayoutAlgorithm_LayoutWindow, 2700).
--define(wxLayoutAlgorithm_destroy, 2701).
--define(wxEvent_GetId, 2702).
--define(wxEvent_GetSkipped, 2703).
--define(wxEvent_GetTimestamp, 2704).
--define(wxEvent_IsCommandEvent, 2705).
--define(wxEvent_ResumePropagation, 2706).
--define(wxEvent_ShouldPropagate, 2707).
--define(wxEvent_Skip, 2708).
--define(wxEvent_StopPropagation, 2709).
--define(wxCommandEvent_getClientData, 2710).
--define(wxCommandEvent_GetExtraLong, 2711).
--define(wxCommandEvent_GetInt, 2712).
--define(wxCommandEvent_GetSelection, 2713).
--define(wxCommandEvent_GetString, 2714).
--define(wxCommandEvent_IsChecked, 2715).
--define(wxCommandEvent_IsSelection, 2716).
--define(wxCommandEvent_SetInt, 2717).
--define(wxCommandEvent_SetString, 2718).
--define(wxScrollEvent_GetOrientation, 2719).
--define(wxScrollEvent_GetPosition, 2720).
--define(wxScrollWinEvent_GetOrientation, 2721).
--define(wxScrollWinEvent_GetPosition, 2722).
--define(wxMouseEvent_AltDown, 2723).
--define(wxMouseEvent_Button, 2724).
--define(wxMouseEvent_ButtonDClick, 2725).
--define(wxMouseEvent_ButtonDown, 2726).
--define(wxMouseEvent_ButtonUp, 2727).
--define(wxMouseEvent_CmdDown, 2728).
--define(wxMouseEvent_ControlDown, 2729).
--define(wxMouseEvent_Dragging, 2730).
--define(wxMouseEvent_Entering, 2731).
--define(wxMouseEvent_GetButton, 2732).
--define(wxMouseEvent_GetPosition, 2735).
--define(wxMouseEvent_GetLogicalPosition, 2736).
--define(wxMouseEvent_GetLinesPerAction, 2737).
--define(wxMouseEvent_GetWheelRotation, 2738).
--define(wxMouseEvent_GetWheelDelta, 2739).
--define(wxMouseEvent_GetX, 2740).
--define(wxMouseEvent_GetY, 2741).
--define(wxMouseEvent_IsButton, 2742).
--define(wxMouseEvent_IsPageScroll, 2743).
--define(wxMouseEvent_Leaving, 2744).
--define(wxMouseEvent_LeftDClick, 2745).
--define(wxMouseEvent_LeftDown, 2746).
--define(wxMouseEvent_LeftIsDown, 2747).
--define(wxMouseEvent_LeftUp, 2748).
--define(wxMouseEvent_MetaDown, 2749).
--define(wxMouseEvent_MiddleDClick, 2750).
--define(wxMouseEvent_MiddleDown, 2751).
--define(wxMouseEvent_MiddleIsDown, 2752).
--define(wxMouseEvent_MiddleUp, 2753).
--define(wxMouseEvent_Moving, 2754).
--define(wxMouseEvent_RightDClick, 2755).
--define(wxMouseEvent_RightDown, 2756).
--define(wxMouseEvent_RightIsDown, 2757).
--define(wxMouseEvent_RightUp, 2758).
--define(wxMouseEvent_ShiftDown, 2759).
--define(wxSetCursorEvent_GetCursor, 2760).
--define(wxSetCursorEvent_GetX, 2761).
--define(wxSetCursorEvent_GetY, 2762).
--define(wxSetCursorEvent_HasCursor, 2763).
--define(wxSetCursorEvent_SetCursor, 2764).
--define(wxKeyEvent_AltDown, 2765).
--define(wxKeyEvent_CmdDown, 2766).
--define(wxKeyEvent_ControlDown, 2767).
--define(wxKeyEvent_GetKeyCode, 2768).
--define(wxKeyEvent_GetModifiers, 2769).
--define(wxKeyEvent_GetPosition, 2772).
--define(wxKeyEvent_GetRawKeyCode, 2773).
--define(wxKeyEvent_GetRawKeyFlags, 2774).
--define(wxKeyEvent_GetUnicodeKey, 2775).
--define(wxKeyEvent_GetX, 2776).
--define(wxKeyEvent_GetY, 2777).
--define(wxKeyEvent_HasModifiers, 2778).
--define(wxKeyEvent_MetaDown, 2779).
--define(wxKeyEvent_ShiftDown, 2780).
--define(wxSizeEvent_GetSize, 2781).
--define(wxMoveEvent_GetPosition, 2782).
--define(wxEraseEvent_GetDC, 2783).
--define(wxFocusEvent_GetWindow, 2784).
--define(wxChildFocusEvent_GetWindow, 2785).
--define(wxMenuEvent_GetMenu, 2786).
--define(wxMenuEvent_GetMenuId, 2787).
--define(wxMenuEvent_IsPopup, 2788).
--define(wxCloseEvent_CanVeto, 2789).
--define(wxCloseEvent_GetLoggingOff, 2790).
--define(wxCloseEvent_SetCanVeto, 2791).
--define(wxCloseEvent_SetLoggingOff, 2792).
--define(wxCloseEvent_Veto, 2793).
--define(wxShowEvent_SetShow, 2794).
--define(wxShowEvent_GetShow, 2795).
--define(wxIconizeEvent_Iconized, 2796).
--define(wxJoystickEvent_ButtonDown, 2797).
--define(wxJoystickEvent_ButtonIsDown, 2798).
--define(wxJoystickEvent_ButtonUp, 2799).
--define(wxJoystickEvent_GetButtonChange, 2800).
--define(wxJoystickEvent_GetButtonState, 2801).
--define(wxJoystickEvent_GetJoystick, 2802).
--define(wxJoystickEvent_GetPosition, 2803).
--define(wxJoystickEvent_GetZPosition, 2804).
--define(wxJoystickEvent_IsButton, 2805).
--define(wxJoystickEvent_IsMove, 2806).
--define(wxJoystickEvent_IsZMove, 2807).
--define(wxUpdateUIEvent_CanUpdate, 2808).
--define(wxUpdateUIEvent_Check, 2809).
--define(wxUpdateUIEvent_Enable, 2810).
--define(wxUpdateUIEvent_Show, 2811).
--define(wxUpdateUIEvent_GetChecked, 2812).
--define(wxUpdateUIEvent_GetEnabled, 2813).
--define(wxUpdateUIEvent_GetShown, 2814).
--define(wxUpdateUIEvent_GetSetChecked, 2815).
--define(wxUpdateUIEvent_GetSetEnabled, 2816).
--define(wxUpdateUIEvent_GetSetShown, 2817).
--define(wxUpdateUIEvent_GetSetText, 2818).
--define(wxUpdateUIEvent_GetText, 2819).
--define(wxUpdateUIEvent_GetMode, 2820).
--define(wxUpdateUIEvent_GetUpdateInterval, 2821).
--define(wxUpdateUIEvent_ResetUpdateTime, 2822).
--define(wxUpdateUIEvent_SetMode, 2823).
--define(wxUpdateUIEvent_SetText, 2824).
--define(wxUpdateUIEvent_SetUpdateInterval, 2825).
--define(wxMouseCaptureChangedEvent_GetCapturedWindow, 2826).
--define(wxPaletteChangedEvent_SetChangedWindow, 2827).
--define(wxPaletteChangedEvent_GetChangedWindow, 2828).
--define(wxQueryNewPaletteEvent_SetPaletteRealized, 2829).
--define(wxQueryNewPaletteEvent_GetPaletteRealized, 2830).
--define(wxNavigationKeyEvent_GetDirection, 2831).
--define(wxNavigationKeyEvent_SetDirection, 2832).
--define(wxNavigationKeyEvent_IsWindowChange, 2833).
--define(wxNavigationKeyEvent_SetWindowChange, 2834).
--define(wxNavigationKeyEvent_IsFromTab, 2835).
--define(wxNavigationKeyEvent_SetFromTab, 2836).
--define(wxNavigationKeyEvent_GetCurrentFocus, 2837).
--define(wxNavigationKeyEvent_SetCurrentFocus, 2838).
--define(wxHelpEvent_GetOrigin, 2839).
--define(wxHelpEvent_GetPosition, 2840).
--define(wxHelpEvent_SetOrigin, 2841).
--define(wxHelpEvent_SetPosition, 2842).
--define(wxContextMenuEvent_GetPosition, 2843).
--define(wxContextMenuEvent_SetPosition, 2844).
--define(wxIdleEvent_CanSend, 2845).
--define(wxIdleEvent_GetMode, 2846).
--define(wxIdleEvent_RequestMore, 2847).
--define(wxIdleEvent_MoreRequested, 2848).
--define(wxIdleEvent_SetMode, 2849).
--define(wxGridEvent_AltDown, 2850).
--define(wxGridEvent_ControlDown, 2851).
--define(wxGridEvent_GetCol, 2852).
--define(wxGridEvent_GetPosition, 2853).
--define(wxGridEvent_GetRow, 2854).
--define(wxGridEvent_MetaDown, 2855).
--define(wxGridEvent_Selecting, 2856).
--define(wxGridEvent_ShiftDown, 2857).
--define(wxNotifyEvent_Allow, 2858).
--define(wxNotifyEvent_IsAllowed, 2859).
--define(wxNotifyEvent_Veto, 2860).
--define(wxSashEvent_GetEdge, 2861).
--define(wxSashEvent_GetDragRect, 2862).
--define(wxSashEvent_GetDragStatus, 2863).
--define(wxListEvent_GetCacheFrom, 2864).
--define(wxListEvent_GetCacheTo, 2865).
--define(wxListEvent_GetKeyCode, 2866).
--define(wxListEvent_GetIndex, 2867).
--define(wxListEvent_GetColumn, 2868).
--define(wxListEvent_GetPoint, 2869).
--define(wxListEvent_GetLabel, 2870).
--define(wxListEvent_GetText, 2871).
--define(wxListEvent_GetImage, 2872).
--define(wxListEvent_GetData, 2873).
--define(wxListEvent_GetMask, 2874).
--define(wxListEvent_GetItem, 2875).
--define(wxListEvent_IsEditCancelled, 2876).
--define(wxDateEvent_GetDate, 2877).
--define(wxCalendarEvent_GetWeekDay, 2878).
--define(wxFileDirPickerEvent_GetPath, 2879).
--define(wxColourPickerEvent_GetColour, 2880).
--define(wxFontPickerEvent_GetFont, 2881).
--define(wxStyledTextEvent_GetPosition, 2882).
--define(wxStyledTextEvent_GetKey, 2883).
--define(wxStyledTextEvent_GetModifiers, 2884).
--define(wxStyledTextEvent_GetModificationType, 2885).
--define(wxStyledTextEvent_GetText, 2886).
--define(wxStyledTextEvent_GetLength, 2887).
--define(wxStyledTextEvent_GetLinesAdded, 2888).
--define(wxStyledTextEvent_GetLine, 2889).
--define(wxStyledTextEvent_GetFoldLevelNow, 2890).
--define(wxStyledTextEvent_GetFoldLevelPrev, 2891).
--define(wxStyledTextEvent_GetMargin, 2892).
--define(wxStyledTextEvent_GetMessage, 2893).
--define(wxStyledTextEvent_GetWParam, 2894).
--define(wxStyledTextEvent_GetLParam, 2895).
--define(wxStyledTextEvent_GetListType, 2896).
--define(wxStyledTextEvent_GetX, 2897).
--define(wxStyledTextEvent_GetY, 2898).
--define(wxStyledTextEvent_GetDragText, 2899).
--define(wxStyledTextEvent_GetDragAllowMove, 2900).
--define(wxStyledTextEvent_GetDragResult, 2901).
--define(wxStyledTextEvent_GetShift, 2902).
--define(wxStyledTextEvent_GetControl, 2903).
--define(wxStyledTextEvent_GetAlt, 2904).
--define(utils_wxGetKeyState, 2905).
--define(utils_wxGetMousePosition, 2906).
--define(utils_wxGetMouseState, 2907).
--define(utils_wxSetDetectableAutoRepeat, 2908).
--define(utils_wxBell, 2909).
--define(utils_wxFindMenuItemId, 2910).
--define(utils_wxGenericFindWindowAtPoint, 2911).
--define(utils_wxFindWindowAtPoint, 2912).
--define(utils_wxBeginBusyCursor, 2913).
--define(utils_wxEndBusyCursor, 2914).
--define(utils_wxIsBusy, 2915).
--define(utils_wxShutdown, 2916).
--define(utils_wxShell, 2917).
--define(utils_wxLaunchDefaultBrowser, 2918).
--define(utils_wxGetEmailAddress, 2919).
--define(utils_wxGetUserId, 2920).
--define(utils_wxGetHomeDir, 2921).
--define(utils_wxNewId, 2922).
--define(utils_wxRegisterId, 2923).
--define(utils_wxGetCurrentId, 2924).
--define(utils_wxGetOsDescription, 2925).
--define(utils_wxIsPlatformLittleEndian, 2926).
--define(utils_wxIsPlatform64Bit, 2927).
--define(gdicmn_wxDisplaySize, 2928).
--define(gdicmn_wxSetCursor, 2929).
--define(wxPrintout_new, 2930).
--define(wxPrintout_destruct, 2931).
--define(wxPrintout_GetDC, 2932).
--define(wxPrintout_GetPageSizeMM, 2933).
--define(wxPrintout_GetPageSizePixels, 2934).
--define(wxPrintout_GetPaperRectPixels, 2935).
--define(wxPrintout_GetPPIPrinter, 2936).
--define(wxPrintout_GetPPIScreen, 2937).
--define(wxPrintout_GetTitle, 2938).
--define(wxPrintout_IsPreview, 2939).
--define(wxPrintout_FitThisSizeToPaper, 2940).
--define(wxPrintout_FitThisSizeToPage, 2941).
--define(wxPrintout_FitThisSizeToPageMargins, 2942).
--define(wxPrintout_MapScreenSizeToPaper, 2943).
--define(wxPrintout_MapScreenSizeToPage, 2944).
--define(wxPrintout_MapScreenSizeToPageMargins, 2945).
--define(wxPrintout_MapScreenSizeToDevice, 2946).
--define(wxPrintout_GetLogicalPaperRect, 2947).
--define(wxPrintout_GetLogicalPageRect, 2948).
--define(wxPrintout_GetLogicalPageMarginsRect, 2949).
--define(wxPrintout_SetLogicalOrigin, 2950).
--define(wxPrintout_OffsetLogicalOrigin, 2951).
--define(wxStyledTextCtrl_new_2, 2952).
--define(wxStyledTextCtrl_new_0, 2953).
--define(wxStyledTextCtrl_destruct, 2954).
--define(wxStyledTextCtrl_Create, 2955).
--define(wxStyledTextCtrl_AddText, 2956).
--define(wxStyledTextCtrl_AddStyledText, 2957).
--define(wxStyledTextCtrl_InsertText, 2958).
--define(wxStyledTextCtrl_ClearAll, 2959).
--define(wxStyledTextCtrl_ClearDocumentStyle, 2960).
--define(wxStyledTextCtrl_GetLength, 2961).
--define(wxStyledTextCtrl_GetCharAt, 2962).
--define(wxStyledTextCtrl_GetCurrentPos, 2963).
--define(wxStyledTextCtrl_GetAnchor, 2964).
--define(wxStyledTextCtrl_GetStyleAt, 2965).
--define(wxStyledTextCtrl_Redo, 2966).
--define(wxStyledTextCtrl_SetUndoCollection, 2967).
--define(wxStyledTextCtrl_SelectAll, 2968).
--define(wxStyledTextCtrl_SetSavePoint, 2969).
--define(wxStyledTextCtrl_GetStyledText, 2970).
--define(wxStyledTextCtrl_CanRedo, 2971).
--define(wxStyledTextCtrl_MarkerLineFromHandle, 2972).
--define(wxStyledTextCtrl_MarkerDeleteHandle, 2973).
--define(wxStyledTextCtrl_GetUndoCollection, 2974).
--define(wxStyledTextCtrl_GetViewWhiteSpace, 2975).
--define(wxStyledTextCtrl_SetViewWhiteSpace, 2976).
--define(wxStyledTextCtrl_PositionFromPoint, 2977).
--define(wxStyledTextCtrl_PositionFromPointClose, 2978).
--define(wxStyledTextCtrl_GotoLine, 2979).
--define(wxStyledTextCtrl_GotoPos, 2980).
--define(wxStyledTextCtrl_SetAnchor, 2981).
--define(wxStyledTextCtrl_GetCurLine, 2982).
--define(wxStyledTextCtrl_GetEndStyled, 2983).
--define(wxStyledTextCtrl_ConvertEOLs, 2984).
--define(wxStyledTextCtrl_GetEOLMode, 2985).
--define(wxStyledTextCtrl_SetEOLMode, 2986).
--define(wxStyledTextCtrl_StartStyling, 2987).
--define(wxStyledTextCtrl_SetStyling, 2988).
--define(wxStyledTextCtrl_GetBufferedDraw, 2989).
--define(wxStyledTextCtrl_SetBufferedDraw, 2990).
--define(wxStyledTextCtrl_SetTabWidth, 2991).
--define(wxStyledTextCtrl_GetTabWidth, 2992).
--define(wxStyledTextCtrl_SetCodePage, 2993).
--define(wxStyledTextCtrl_MarkerDefine, 2994).
--define(wxStyledTextCtrl_MarkerSetForeground, 2995).
--define(wxStyledTextCtrl_MarkerSetBackground, 2996).
--define(wxStyledTextCtrl_MarkerAdd, 2997).
--define(wxStyledTextCtrl_MarkerDelete, 2998).
--define(wxStyledTextCtrl_MarkerDeleteAll, 2999).
--define(wxStyledTextCtrl_MarkerGet, 3000).
--define(wxStyledTextCtrl_MarkerNext, 3001).
--define(wxStyledTextCtrl_MarkerPrevious, 3002).
--define(wxStyledTextCtrl_MarkerDefineBitmap, 3003).
--define(wxStyledTextCtrl_MarkerAddSet, 3004).
--define(wxStyledTextCtrl_MarkerSetAlpha, 3005).
--define(wxStyledTextCtrl_SetMarginType, 3006).
--define(wxStyledTextCtrl_GetMarginType, 3007).
--define(wxStyledTextCtrl_SetMarginWidth, 3008).
--define(wxStyledTextCtrl_GetMarginWidth, 3009).
--define(wxStyledTextCtrl_SetMarginMask, 3010).
--define(wxStyledTextCtrl_GetMarginMask, 3011).
--define(wxStyledTextCtrl_SetMarginSensitive, 3012).
--define(wxStyledTextCtrl_GetMarginSensitive, 3013).
--define(wxStyledTextCtrl_StyleClearAll, 3014).
--define(wxStyledTextCtrl_StyleSetForeground, 3015).
--define(wxStyledTextCtrl_StyleSetBackground, 3016).
--define(wxStyledTextCtrl_StyleSetBold, 3017).
--define(wxStyledTextCtrl_StyleSetItalic, 3018).
--define(wxStyledTextCtrl_StyleSetSize, 3019).
--define(wxStyledTextCtrl_StyleSetFaceName, 3020).
--define(wxStyledTextCtrl_StyleSetEOLFilled, 3021).
--define(wxStyledTextCtrl_StyleResetDefault, 3022).
--define(wxStyledTextCtrl_StyleSetUnderline, 3023).
--define(wxStyledTextCtrl_StyleSetCase, 3024).
--define(wxStyledTextCtrl_StyleSetHotSpot, 3025).
--define(wxStyledTextCtrl_SetSelForeground, 3026).
--define(wxStyledTextCtrl_SetSelBackground, 3027).
--define(wxStyledTextCtrl_GetSelAlpha, 3028).
--define(wxStyledTextCtrl_SetSelAlpha, 3029).
--define(wxStyledTextCtrl_SetCaretForeground, 3030).
--define(wxStyledTextCtrl_CmdKeyAssign, 3031).
--define(wxStyledTextCtrl_CmdKeyClear, 3032).
--define(wxStyledTextCtrl_CmdKeyClearAll, 3033).
--define(wxStyledTextCtrl_SetStyleBytes, 3034).
--define(wxStyledTextCtrl_StyleSetVisible, 3035).
--define(wxStyledTextCtrl_GetCaretPeriod, 3036).
--define(wxStyledTextCtrl_SetCaretPeriod, 3037).
--define(wxStyledTextCtrl_SetWordChars, 3038).
--define(wxStyledTextCtrl_BeginUndoAction, 3039).
--define(wxStyledTextCtrl_EndUndoAction, 3040).
--define(wxStyledTextCtrl_IndicatorSetStyle, 3041).
--define(wxStyledTextCtrl_IndicatorGetStyle, 3042).
--define(wxStyledTextCtrl_IndicatorSetForeground, 3043).
--define(wxStyledTextCtrl_IndicatorGetForeground, 3044).
--define(wxStyledTextCtrl_SetWhitespaceForeground, 3045).
--define(wxStyledTextCtrl_SetWhitespaceBackground, 3046).
--define(wxStyledTextCtrl_GetStyleBits, 3047).
--define(wxStyledTextCtrl_SetLineState, 3048).
--define(wxStyledTextCtrl_GetLineState, 3049).
--define(wxStyledTextCtrl_GetMaxLineState, 3050).
--define(wxStyledTextCtrl_GetCaretLineVisible, 3051).
--define(wxStyledTextCtrl_SetCaretLineVisible, 3052).
--define(wxStyledTextCtrl_GetCaretLineBackground, 3053).
--define(wxStyledTextCtrl_SetCaretLineBackground, 3054).
--define(wxStyledTextCtrl_AutoCompShow, 3055).
--define(wxStyledTextCtrl_AutoCompCancel, 3056).
--define(wxStyledTextCtrl_AutoCompActive, 3057).
--define(wxStyledTextCtrl_AutoCompPosStart, 3058).
--define(wxStyledTextCtrl_AutoCompComplete, 3059).
--define(wxStyledTextCtrl_AutoCompStops, 3060).
--define(wxStyledTextCtrl_AutoCompSetSeparator, 3061).
--define(wxStyledTextCtrl_AutoCompGetSeparator, 3062).
--define(wxStyledTextCtrl_AutoCompSelect, 3063).
--define(wxStyledTextCtrl_AutoCompSetCancelAtStart, 3064).
--define(wxStyledTextCtrl_AutoCompGetCancelAtStart, 3065).
--define(wxStyledTextCtrl_AutoCompSetFillUps, 3066).
--define(wxStyledTextCtrl_AutoCompSetChooseSingle, 3067).
--define(wxStyledTextCtrl_AutoCompGetChooseSingle, 3068).
--define(wxStyledTextCtrl_AutoCompSetIgnoreCase, 3069).
--define(wxStyledTextCtrl_AutoCompGetIgnoreCase, 3070).
--define(wxStyledTextCtrl_UserListShow, 3071).
--define(wxStyledTextCtrl_AutoCompSetAutoHide, 3072).
--define(wxStyledTextCtrl_AutoCompGetAutoHide, 3073).
--define(wxStyledTextCtrl_AutoCompSetDropRestOfWord, 3074).
--define(wxStyledTextCtrl_AutoCompGetDropRestOfWord, 3075).
--define(wxStyledTextCtrl_RegisterImage, 3076).
--define(wxStyledTextCtrl_ClearRegisteredImages, 3077).
--define(wxStyledTextCtrl_AutoCompGetTypeSeparator, 3078).
--define(wxStyledTextCtrl_AutoCompSetTypeSeparator, 3079).
--define(wxStyledTextCtrl_AutoCompSetMaxWidth, 3080).
--define(wxStyledTextCtrl_AutoCompGetMaxWidth, 3081).
--define(wxStyledTextCtrl_AutoCompSetMaxHeight, 3082).
--define(wxStyledTextCtrl_AutoCompGetMaxHeight, 3083).
--define(wxStyledTextCtrl_SetIndent, 3084).
--define(wxStyledTextCtrl_GetIndent, 3085).
--define(wxStyledTextCtrl_SetUseTabs, 3086).
--define(wxStyledTextCtrl_GetUseTabs, 3087).
--define(wxStyledTextCtrl_SetLineIndentation, 3088).
--define(wxStyledTextCtrl_GetLineIndentation, 3089).
--define(wxStyledTextCtrl_GetLineIndentPosition, 3090).
--define(wxStyledTextCtrl_GetColumn, 3091).
--define(wxStyledTextCtrl_SetUseHorizontalScrollBar, 3092).
--define(wxStyledTextCtrl_GetUseHorizontalScrollBar, 3093).
--define(wxStyledTextCtrl_SetIndentationGuides, 3094).
--define(wxStyledTextCtrl_GetIndentationGuides, 3095).
--define(wxStyledTextCtrl_SetHighlightGuide, 3096).
--define(wxStyledTextCtrl_GetHighlightGuide, 3097).
--define(wxStyledTextCtrl_GetLineEndPosition, 3098).
--define(wxStyledTextCtrl_GetCodePage, 3099).
--define(wxStyledTextCtrl_GetCaretForeground, 3100).
--define(wxStyledTextCtrl_GetReadOnly, 3101).
--define(wxStyledTextCtrl_SetCurrentPos, 3102).
--define(wxStyledTextCtrl_SetSelectionStart, 3103).
--define(wxStyledTextCtrl_GetSelectionStart, 3104).
--define(wxStyledTextCtrl_SetSelectionEnd, 3105).
--define(wxStyledTextCtrl_GetSelectionEnd, 3106).
--define(wxStyledTextCtrl_SetPrintMagnification, 3107).
--define(wxStyledTextCtrl_GetPrintMagnification, 3108).
--define(wxStyledTextCtrl_SetPrintColourMode, 3109).
--define(wxStyledTextCtrl_GetPrintColourMode, 3110).
--define(wxStyledTextCtrl_FindText, 3111).
--define(wxStyledTextCtrl_FormatRange, 3112).
--define(wxStyledTextCtrl_GetFirstVisibleLine, 3113).
--define(wxStyledTextCtrl_GetLine, 3114).
--define(wxStyledTextCtrl_GetLineCount, 3115).
--define(wxStyledTextCtrl_SetMarginLeft, 3116).
--define(wxStyledTextCtrl_GetMarginLeft, 3117).
--define(wxStyledTextCtrl_SetMarginRight, 3118).
--define(wxStyledTextCtrl_GetMarginRight, 3119).
--define(wxStyledTextCtrl_GetModify, 3120).
--define(wxStyledTextCtrl_SetSelection, 3121).
--define(wxStyledTextCtrl_GetSelectedText, 3122).
--define(wxStyledTextCtrl_GetTextRange, 3123).
--define(wxStyledTextCtrl_HideSelection, 3124).
--define(wxStyledTextCtrl_LineFromPosition, 3125).
--define(wxStyledTextCtrl_PositionFromLine, 3126).
--define(wxStyledTextCtrl_LineScroll, 3127).
--define(wxStyledTextCtrl_EnsureCaretVisible, 3128).
--define(wxStyledTextCtrl_ReplaceSelection, 3129).
--define(wxStyledTextCtrl_SetReadOnly, 3130).
--define(wxStyledTextCtrl_CanPaste, 3131).
--define(wxStyledTextCtrl_CanUndo, 3132).
--define(wxStyledTextCtrl_EmptyUndoBuffer, 3133).
--define(wxStyledTextCtrl_Undo, 3134).
--define(wxStyledTextCtrl_Cut, 3135).
--define(wxStyledTextCtrl_Copy, 3136).
--define(wxStyledTextCtrl_Paste, 3137).
--define(wxStyledTextCtrl_Clear, 3138).
--define(wxStyledTextCtrl_SetText, 3139).
--define(wxStyledTextCtrl_GetText, 3140).
--define(wxStyledTextCtrl_GetTextLength, 3141).
--define(wxStyledTextCtrl_GetOvertype, 3142).
--define(wxStyledTextCtrl_SetCaretWidth, 3143).
--define(wxStyledTextCtrl_GetCaretWidth, 3144).
--define(wxStyledTextCtrl_SetTargetStart, 3145).
--define(wxStyledTextCtrl_GetTargetStart, 3146).
--define(wxStyledTextCtrl_SetTargetEnd, 3147).
--define(wxStyledTextCtrl_GetTargetEnd, 3148).
--define(wxStyledTextCtrl_ReplaceTarget, 3149).
--define(wxStyledTextCtrl_SearchInTarget, 3150).
--define(wxStyledTextCtrl_SetSearchFlags, 3151).
--define(wxStyledTextCtrl_GetSearchFlags, 3152).
--define(wxStyledTextCtrl_CallTipShow, 3153).
--define(wxStyledTextCtrl_CallTipCancel, 3154).
--define(wxStyledTextCtrl_CallTipActive, 3155).
--define(wxStyledTextCtrl_CallTipPosAtStart, 3156).
--define(wxStyledTextCtrl_CallTipSetHighlight, 3157).
--define(wxStyledTextCtrl_CallTipSetBackground, 3158).
--define(wxStyledTextCtrl_CallTipSetForeground, 3159).
--define(wxStyledTextCtrl_CallTipSetForegroundHighlight, 3160).
--define(wxStyledTextCtrl_CallTipUseStyle, 3161).
--define(wxStyledTextCtrl_VisibleFromDocLine, 3162).
--define(wxStyledTextCtrl_DocLineFromVisible, 3163).
--define(wxStyledTextCtrl_WrapCount, 3164).
--define(wxStyledTextCtrl_SetFoldLevel, 3165).
--define(wxStyledTextCtrl_GetFoldLevel, 3166).
--define(wxStyledTextCtrl_GetLastChild, 3167).
--define(wxStyledTextCtrl_GetFoldParent, 3168).
--define(wxStyledTextCtrl_ShowLines, 3169).
--define(wxStyledTextCtrl_HideLines, 3170).
--define(wxStyledTextCtrl_GetLineVisible, 3171).
--define(wxStyledTextCtrl_SetFoldExpanded, 3172).
--define(wxStyledTextCtrl_GetFoldExpanded, 3173).
--define(wxStyledTextCtrl_ToggleFold, 3174).
--define(wxStyledTextCtrl_EnsureVisible, 3175).
--define(wxStyledTextCtrl_SetFoldFlags, 3176).
--define(wxStyledTextCtrl_EnsureVisibleEnforcePolicy, 3177).
--define(wxStyledTextCtrl_SetTabIndents, 3178).
--define(wxStyledTextCtrl_GetTabIndents, 3179).
--define(wxStyledTextCtrl_SetBackSpaceUnIndents, 3180).
--define(wxStyledTextCtrl_GetBackSpaceUnIndents, 3181).
--define(wxStyledTextCtrl_SetMouseDwellTime, 3182).
--define(wxStyledTextCtrl_GetMouseDwellTime, 3183).
--define(wxStyledTextCtrl_WordStartPosition, 3184).
--define(wxStyledTextCtrl_WordEndPosition, 3185).
--define(wxStyledTextCtrl_SetWrapMode, 3186).
--define(wxStyledTextCtrl_GetWrapMode, 3187).
--define(wxStyledTextCtrl_SetWrapVisualFlags, 3188).
--define(wxStyledTextCtrl_GetWrapVisualFlags, 3189).
--define(wxStyledTextCtrl_SetWrapVisualFlagsLocation, 3190).
--define(wxStyledTextCtrl_GetWrapVisualFlagsLocation, 3191).
--define(wxStyledTextCtrl_SetWrapStartIndent, 3192).
--define(wxStyledTextCtrl_GetWrapStartIndent, 3193).
--define(wxStyledTextCtrl_SetLayoutCache, 3194).
--define(wxStyledTextCtrl_GetLayoutCache, 3195).
--define(wxStyledTextCtrl_SetScrollWidth, 3196).
--define(wxStyledTextCtrl_GetScrollWidth, 3197).
--define(wxStyledTextCtrl_TextWidth, 3198).
--define(wxStyledTextCtrl_GetEndAtLastLine, 3199).
--define(wxStyledTextCtrl_TextHeight, 3200).
--define(wxStyledTextCtrl_SetUseVerticalScrollBar, 3201).
--define(wxStyledTextCtrl_GetUseVerticalScrollBar, 3202).
--define(wxStyledTextCtrl_AppendText, 3203).
--define(wxStyledTextCtrl_GetTwoPhaseDraw, 3204).
--define(wxStyledTextCtrl_SetTwoPhaseDraw, 3205).
--define(wxStyledTextCtrl_TargetFromSelection, 3206).
--define(wxStyledTextCtrl_LinesJoin, 3207).
--define(wxStyledTextCtrl_LinesSplit, 3208).
--define(wxStyledTextCtrl_SetFoldMarginColour, 3209).
--define(wxStyledTextCtrl_SetFoldMarginHiColour, 3210).
--define(wxStyledTextCtrl_LineDown, 3211).
--define(wxStyledTextCtrl_LineDownExtend, 3212).
--define(wxStyledTextCtrl_LineUp, 3213).
--define(wxStyledTextCtrl_LineUpExtend, 3214).
--define(wxStyledTextCtrl_CharLeft, 3215).
--define(wxStyledTextCtrl_CharLeftExtend, 3216).
--define(wxStyledTextCtrl_CharRight, 3217).
--define(wxStyledTextCtrl_CharRightExtend, 3218).
--define(wxStyledTextCtrl_WordLeft, 3219).
--define(wxStyledTextCtrl_WordLeftExtend, 3220).
--define(wxStyledTextCtrl_WordRight, 3221).
--define(wxStyledTextCtrl_WordRightExtend, 3222).
--define(wxStyledTextCtrl_Home, 3223).
--define(wxStyledTextCtrl_HomeExtend, 3224).
--define(wxStyledTextCtrl_LineEnd, 3225).
--define(wxStyledTextCtrl_LineEndExtend, 3226).
--define(wxStyledTextCtrl_DocumentStart, 3227).
--define(wxStyledTextCtrl_DocumentStartExtend, 3228).
--define(wxStyledTextCtrl_DocumentEnd, 3229).
--define(wxStyledTextCtrl_DocumentEndExtend, 3230).
--define(wxStyledTextCtrl_PageUp, 3231).
--define(wxStyledTextCtrl_PageUpExtend, 3232).
--define(wxStyledTextCtrl_PageDown, 3233).
--define(wxStyledTextCtrl_PageDownExtend, 3234).
--define(wxStyledTextCtrl_EditToggleOvertype, 3235).
--define(wxStyledTextCtrl_Cancel, 3236).
--define(wxStyledTextCtrl_DeleteBack, 3237).
--define(wxStyledTextCtrl_Tab, 3238).
--define(wxStyledTextCtrl_BackTab, 3239).
--define(wxStyledTextCtrl_NewLine, 3240).
--define(wxStyledTextCtrl_FormFeed, 3241).
--define(wxStyledTextCtrl_VCHome, 3242).
--define(wxStyledTextCtrl_VCHomeExtend, 3243).
--define(wxStyledTextCtrl_ZoomIn, 3244).
--define(wxStyledTextCtrl_ZoomOut, 3245).
--define(wxStyledTextCtrl_DelWordLeft, 3246).
--define(wxStyledTextCtrl_DelWordRight, 3247).
--define(wxStyledTextCtrl_LineCut, 3248).
--define(wxStyledTextCtrl_LineDelete, 3249).
--define(wxStyledTextCtrl_LineTranspose, 3250).
--define(wxStyledTextCtrl_LineDuplicate, 3251).
--define(wxStyledTextCtrl_LowerCase, 3252).
--define(wxStyledTextCtrl_UpperCase, 3253).
--define(wxStyledTextCtrl_LineScrollDown, 3254).
--define(wxStyledTextCtrl_LineScrollUp, 3255).
--define(wxStyledTextCtrl_DeleteBackNotLine, 3256).
--define(wxStyledTextCtrl_HomeDisplay, 3257).
--define(wxStyledTextCtrl_HomeDisplayExtend, 3258).
--define(wxStyledTextCtrl_LineEndDisplay, 3259).
--define(wxStyledTextCtrl_LineEndDisplayExtend, 3260).
--define(wxStyledTextCtrl_HomeWrapExtend, 3261).
--define(wxStyledTextCtrl_LineEndWrap, 3262).
--define(wxStyledTextCtrl_LineEndWrapExtend, 3263).
--define(wxStyledTextCtrl_VCHomeWrap, 3264).
--define(wxStyledTextCtrl_VCHomeWrapExtend, 3265).
--define(wxStyledTextCtrl_LineCopy, 3266).
--define(wxStyledTextCtrl_MoveCaretInsideView, 3267).
--define(wxStyledTextCtrl_LineLength, 3268).
--define(wxStyledTextCtrl_BraceHighlight, 3269).
--define(wxStyledTextCtrl_BraceBadLight, 3270).
--define(wxStyledTextCtrl_BraceMatch, 3271).
--define(wxStyledTextCtrl_GetViewEOL, 3272).
--define(wxStyledTextCtrl_SetViewEOL, 3273).
--define(wxStyledTextCtrl_SetModEventMask, 3274).
--define(wxStyledTextCtrl_GetEdgeColumn, 3275).
--define(wxStyledTextCtrl_SetEdgeColumn, 3276).
--define(wxStyledTextCtrl_SetEdgeMode, 3277).
--define(wxStyledTextCtrl_GetEdgeMode, 3278).
--define(wxStyledTextCtrl_GetEdgeColour, 3279).
--define(wxStyledTextCtrl_SetEdgeColour, 3280).
--define(wxStyledTextCtrl_SearchAnchor, 3281).
--define(wxStyledTextCtrl_SearchNext, 3282).
--define(wxStyledTextCtrl_SearchPrev, 3283).
--define(wxStyledTextCtrl_LinesOnScreen, 3284).
--define(wxStyledTextCtrl_UsePopUp, 3285).
--define(wxStyledTextCtrl_SelectionIsRectangle, 3286).
--define(wxStyledTextCtrl_SetZoom, 3287).
--define(wxStyledTextCtrl_GetZoom, 3288).
--define(wxStyledTextCtrl_GetModEventMask, 3289).
--define(wxStyledTextCtrl_SetSTCFocus, 3290).
--define(wxStyledTextCtrl_GetSTCFocus, 3291).
--define(wxStyledTextCtrl_SetStatus, 3292).
--define(wxStyledTextCtrl_GetStatus, 3293).
--define(wxStyledTextCtrl_SetMouseDownCaptures, 3294).
--define(wxStyledTextCtrl_GetMouseDownCaptures, 3295).
--define(wxStyledTextCtrl_SetSTCCursor, 3296).
--define(wxStyledTextCtrl_GetSTCCursor, 3297).
--define(wxStyledTextCtrl_SetControlCharSymbol, 3298).
--define(wxStyledTextCtrl_GetControlCharSymbol, 3299).
--define(wxStyledTextCtrl_WordPartLeft, 3300).
--define(wxStyledTextCtrl_WordPartLeftExtend, 3301).
--define(wxStyledTextCtrl_WordPartRight, 3302).
--define(wxStyledTextCtrl_WordPartRightExtend, 3303).
--define(wxStyledTextCtrl_SetVisiblePolicy, 3304).
--define(wxStyledTextCtrl_DelLineLeft, 3305).
--define(wxStyledTextCtrl_DelLineRight, 3306).
--define(wxStyledTextCtrl_GetXOffset, 3307).
--define(wxStyledTextCtrl_ChooseCaretX, 3308).
--define(wxStyledTextCtrl_SetXCaretPolicy, 3309).
--define(wxStyledTextCtrl_SetYCaretPolicy, 3310).
--define(wxStyledTextCtrl_GetPrintWrapMode, 3311).
--define(wxStyledTextCtrl_SetHotspotActiveForeground, 3312).
--define(wxStyledTextCtrl_SetHotspotActiveBackground, 3313).
--define(wxStyledTextCtrl_SetHotspotActiveUnderline, 3314).
--define(wxStyledTextCtrl_SetHotspotSingleLine, 3315).
--define(wxStyledTextCtrl_ParaDownExtend, 3316).
--define(wxStyledTextCtrl_ParaUp, 3317).
--define(wxStyledTextCtrl_ParaUpExtend, 3318).
--define(wxStyledTextCtrl_PositionBefore, 3319).
--define(wxStyledTextCtrl_PositionAfter, 3320).
--define(wxStyledTextCtrl_CopyRange, 3321).
--define(wxStyledTextCtrl_CopyText, 3322).
--define(wxStyledTextCtrl_SetSelectionMode, 3323).
--define(wxStyledTextCtrl_GetSelectionMode, 3324).
--define(wxStyledTextCtrl_LineDownRectExtend, 3325).
--define(wxStyledTextCtrl_LineUpRectExtend, 3326).
--define(wxStyledTextCtrl_CharLeftRectExtend, 3327).
--define(wxStyledTextCtrl_CharRightRectExtend, 3328).
--define(wxStyledTextCtrl_HomeRectExtend, 3329).
--define(wxStyledTextCtrl_VCHomeRectExtend, 3330).
--define(wxStyledTextCtrl_LineEndRectExtend, 3331).
--define(wxStyledTextCtrl_PageUpRectExtend, 3332).
--define(wxStyledTextCtrl_PageDownRectExtend, 3333).
--define(wxStyledTextCtrl_StutteredPageUp, 3334).
--define(wxStyledTextCtrl_StutteredPageUpExtend, 3335).
--define(wxStyledTextCtrl_StutteredPageDown, 3336).
--define(wxStyledTextCtrl_StutteredPageDownExtend, 3337).
--define(wxStyledTextCtrl_WordLeftEnd, 3338).
--define(wxStyledTextCtrl_WordLeftEndExtend, 3339).
--define(wxStyledTextCtrl_WordRightEnd, 3340).
--define(wxStyledTextCtrl_WordRightEndExtend, 3341).
--define(wxStyledTextCtrl_SetWhitespaceChars, 3342).
--define(wxStyledTextCtrl_SetCharsDefault, 3343).
--define(wxStyledTextCtrl_AutoCompGetCurrent, 3344).
--define(wxStyledTextCtrl_Allocate, 3345).
--define(wxStyledTextCtrl_FindColumn, 3346).
--define(wxStyledTextCtrl_GetCaretSticky, 3347).
--define(wxStyledTextCtrl_SetCaretSticky, 3348).
--define(wxStyledTextCtrl_ToggleCaretSticky, 3349).
--define(wxStyledTextCtrl_SetPasteConvertEndings, 3350).
--define(wxStyledTextCtrl_GetPasteConvertEndings, 3351).
--define(wxStyledTextCtrl_SelectionDuplicate, 3352).
--define(wxStyledTextCtrl_SetCaretLineBackAlpha, 3353).
--define(wxStyledTextCtrl_GetCaretLineBackAlpha, 3354).
--define(wxStyledTextCtrl_StartRecord, 3355).
--define(wxStyledTextCtrl_StopRecord, 3356).
--define(wxStyledTextCtrl_SetLexer, 3357).
--define(wxStyledTextCtrl_GetLexer, 3358).
--define(wxStyledTextCtrl_Colourise, 3359).
--define(wxStyledTextCtrl_SetProperty, 3360).
--define(wxStyledTextCtrl_SetKeyWords, 3361).
--define(wxStyledTextCtrl_SetLexerLanguage, 3362).
--define(wxStyledTextCtrl_GetProperty, 3363).
--define(wxStyledTextCtrl_GetStyleBitsNeeded, 3364).
--define(wxStyledTextCtrl_GetCurrentLine, 3365).
--define(wxStyledTextCtrl_StyleSetSpec, 3366).
--define(wxStyledTextCtrl_StyleSetFont, 3367).
--define(wxStyledTextCtrl_StyleSetFontAttr, 3368).
--define(wxStyledTextCtrl_StyleSetCharacterSet, 3369).
--define(wxStyledTextCtrl_StyleSetFontEncoding, 3370).
--define(wxStyledTextCtrl_CmdKeyExecute, 3371).
--define(wxStyledTextCtrl_SetMargins, 3372).
--define(wxStyledTextCtrl_GetSelection, 3373).
--define(wxStyledTextCtrl_PointFromPosition, 3374).
--define(wxStyledTextCtrl_ScrollToLine, 3375).
--define(wxStyledTextCtrl_ScrollToColumn, 3376).
--define(wxStyledTextCtrl_SetVScrollBar, 3377).
--define(wxStyledTextCtrl_SetHScrollBar, 3378).
--define(wxStyledTextCtrl_GetLastKeydownProcessed, 3379).
--define(wxStyledTextCtrl_SetLastKeydownProcessed, 3380).
--define(wxStyledTextCtrl_SaveFile, 3381).
--define(wxStyledTextCtrl_LoadFile, 3382).
--define(wxStyledTextCtrl_DoDragOver, 3383).
--define(wxStyledTextCtrl_DoDropText, 3384).
--define(wxStyledTextCtrl_GetUseAntiAliasing, 3385).
--define(wxStyledTextCtrl_AddTextRaw, 3386).
--define(wxStyledTextCtrl_InsertTextRaw, 3387).
--define(wxStyledTextCtrl_GetCurLineRaw, 3388).
--define(wxStyledTextCtrl_GetLineRaw, 3389).
--define(wxStyledTextCtrl_GetSelectedTextRaw, 3390).
--define(wxStyledTextCtrl_GetTextRangeRaw, 3391).
--define(wxStyledTextCtrl_SetTextRaw, 3392).
--define(wxStyledTextCtrl_GetTextRaw, 3393).
--define(wxStyledTextCtrl_AppendTextRaw, 3394).
--define(wxArtProvider_GetBitmap, 3395).
--define(wxArtProvider_GetIcon, 3396).
--define(wxTreeEvent_GetKeyCode, 3397).
--define(wxTreeEvent_GetItem, 3398).
--define(wxTreeEvent_GetKeyEvent, 3399).
--define(wxTreeEvent_GetLabel, 3400).
--define(wxTreeEvent_GetOldItem, 3401).
--define(wxTreeEvent_GetPoint, 3402).
--define(wxTreeEvent_IsEditCancelled, 3403).
--define(wxTreeEvent_SetToolTip, 3404).
--define(wxNotebookEvent_GetOldSelection, 3405).
--define(wxNotebookEvent_GetSelection, 3406).
--define(wxNotebookEvent_SetOldSelection, 3407).
--define(wxNotebookEvent_SetSelection, 3408).
--define(wxFileDataObject_new, 3409).
--define(wxFileDataObject_AddFile, 3410).
--define(wxFileDataObject_GetFilenames, 3411).
--define(wxFileDataObject_destroy, 3412).
--define(wxTextDataObject_new, 3413).
--define(wxTextDataObject_GetTextLength, 3414).
--define(wxTextDataObject_GetText, 3415).
--define(wxTextDataObject_SetText, 3416).
--define(wxTextDataObject_destroy, 3417).
--define(wxBitmapDataObject_new_1_1, 3418).
--define(wxBitmapDataObject_new_1_0, 3419).
--define(wxBitmapDataObject_GetBitmap, 3420).
--define(wxBitmapDataObject_SetBitmap, 3421).
--define(wxBitmapDataObject_destroy, 3422).
--define(wxClipboard_new, 3424).
--define(wxClipboard_destruct, 3425).
--define(wxClipboard_AddData, 3426).
--define(wxClipboard_Clear, 3427).
--define(wxClipboard_Close, 3428).
--define(wxClipboard_Flush, 3429).
--define(wxClipboard_GetData, 3430).
--define(wxClipboard_IsOpened, 3431).
--define(wxClipboard_Open, 3432).
--define(wxClipboard_SetData, 3433).
--define(wxClipboard_UsePrimarySelection, 3435).
--define(wxClipboard_IsSupported, 3436).
--define(wxClipboard_Get, 3437).
--define(wxSpinEvent_GetPosition, 3438).
--define(wxSpinEvent_SetPosition, 3439).
--define(wxSplitterWindow_new_0, 3440).
--define(wxSplitterWindow_new_2, 3441).
--define(wxSplitterWindow_destruct, 3442).
--define(wxSplitterWindow_Create, 3443).
--define(wxSplitterWindow_GetMinimumPaneSize, 3444).
--define(wxSplitterWindow_GetSashGravity, 3445).
--define(wxSplitterWindow_GetSashPosition, 3446).
--define(wxSplitterWindow_GetSplitMode, 3447).
--define(wxSplitterWindow_GetWindow1, 3448).
--define(wxSplitterWindow_GetWindow2, 3449).
--define(wxSplitterWindow_Initialize, 3450).
--define(wxSplitterWindow_IsSplit, 3451).
--define(wxSplitterWindow_ReplaceWindow, 3452).
--define(wxSplitterWindow_SetSashGravity, 3453).
--define(wxSplitterWindow_SetSashPosition, 3454).
--define(wxSplitterWindow_SetSashSize, 3455).
--define(wxSplitterWindow_SetMinimumPaneSize, 3456).
--define(wxSplitterWindow_SetSplitMode, 3457).
--define(wxSplitterWindow_SplitHorizontally, 3458).
--define(wxSplitterWindow_SplitVertically, 3459).
--define(wxSplitterWindow_Unsplit, 3460).
--define(wxSplitterWindow_UpdateSize, 3461).
--define(wxSplitterEvent_GetSashPosition, 3462).
--define(wxSplitterEvent_GetX, 3463).
--define(wxSplitterEvent_GetY, 3464).
--define(wxSplitterEvent_GetWindowBeingRemoved, 3465).
--define(wxSplitterEvent_SetSashPosition, 3466).
--define(wxHtmlWindow_new_0, 3467).
--define(wxHtmlWindow_new_2, 3468).
--define(wxHtmlWindow_AppendToPage, 3469).
--define(wxHtmlWindow_GetOpenedAnchor, 3470).
--define(wxHtmlWindow_GetOpenedPage, 3471).
--define(wxHtmlWindow_GetOpenedPageTitle, 3472).
--define(wxHtmlWindow_GetRelatedFrame, 3473).
--define(wxHtmlWindow_HistoryBack, 3474).
--define(wxHtmlWindow_HistoryCanBack, 3475).
--define(wxHtmlWindow_HistoryCanForward, 3476).
--define(wxHtmlWindow_HistoryClear, 3477).
--define(wxHtmlWindow_HistoryForward, 3478).
--define(wxHtmlWindow_LoadFile, 3479).
--define(wxHtmlWindow_LoadPage, 3480).
--define(wxHtmlWindow_SelectAll, 3481).
--define(wxHtmlWindow_SelectionToText, 3482).
--define(wxHtmlWindow_SelectLine, 3483).
--define(wxHtmlWindow_SelectWord, 3484).
--define(wxHtmlWindow_SetBorders, 3485).
--define(wxHtmlWindow_SetFonts, 3486).
--define(wxHtmlWindow_SetPage, 3487).
--define(wxHtmlWindow_SetRelatedFrame, 3488).
--define(wxHtmlWindow_SetRelatedStatusBar, 3489).
--define(wxHtmlWindow_ToText, 3490).
--define(wxHtmlWindow_destroy, 3491).
--define(wxHtmlLinkEvent_GetLinkInfo, 3492).
--define(wxSystemSettings_GetColour, 3493).
--define(wxSystemSettings_GetFont, 3494).
--define(wxSystemSettings_GetMetric, 3495).
--define(wxSystemSettings_GetScreenType, 3496).
--define(wxSystemOptions_GetOption, 3497).
--define(wxSystemOptions_GetOptionInt, 3498).
--define(wxSystemOptions_HasOption, 3499).
--define(wxSystemOptions_IsFalse, 3500).
--define(wxSystemOptions_SetOption_2_1, 3501).
--define(wxSystemOptions_SetOption_2_0, 3502).
--define(wxAuiNotebookEvent_SetSelection, 3503).
--define(wxAuiNotebookEvent_GetSelection, 3504).
--define(wxAuiNotebookEvent_SetOldSelection, 3505).
--define(wxAuiNotebookEvent_GetOldSelection, 3506).
--define(wxAuiNotebookEvent_SetDragSource, 3507).
--define(wxAuiNotebookEvent_GetDragSource, 3508).
--define(wxAuiManagerEvent_SetManager, 3509).
--define(wxAuiManagerEvent_GetManager, 3510).
--define(wxAuiManagerEvent_SetPane, 3511).
--define(wxAuiManagerEvent_GetPane, 3512).
--define(wxAuiManagerEvent_SetButton, 3513).
--define(wxAuiManagerEvent_GetButton, 3514).
--define(wxAuiManagerEvent_SetDC, 3515).
--define(wxAuiManagerEvent_GetDC, 3516).
--define(wxAuiManagerEvent_Veto, 3517).
--define(wxAuiManagerEvent_GetVeto, 3518).
--define(wxAuiManagerEvent_SetCanVeto, 3519).
--define(wxAuiManagerEvent_CanVeto, 3520).
--define(wxLogNull_new, 3521).
--define(wxLogNull_destroy, 3522).
--define(wxTaskBarIcon_new, 3523).
--define(wxTaskBarIcon_destruct, 3524).
--define(wxTaskBarIcon_PopupMenu, 3525).
--define(wxTaskBarIcon_RemoveIcon, 3526).
--define(wxTaskBarIcon_SetIcon, 3527).
--define(wxLocale_new_0, 3528).
--define(wxLocale_new_2, 3530).
--define(wxLocale_destruct, 3531).
--define(wxLocale_Init, 3533).
--define(wxLocale_AddCatalog_1, 3534).
--define(wxLocale_AddCatalog_3, 3535).
--define(wxLocale_AddCatalogLookupPathPrefix, 3536).
--define(wxLocale_GetCanonicalName, 3537).
--define(wxLocale_GetLanguage, 3538).
--define(wxLocale_GetLanguageName, 3539).
--define(wxLocale_GetLocale, 3540).
--define(wxLocale_GetName, 3541).
--define(wxLocale_GetString_2, 3542).
--define(wxLocale_GetString_4, 3543).
--define(wxLocale_GetHeaderValue, 3544).
--define(wxLocale_GetSysName, 3545).
--define(wxLocale_GetSystemEncoding, 3546).
--define(wxLocale_GetSystemEncodingName, 3547).
--define(wxLocale_GetSystemLanguage, 3548).
--define(wxLocale_IsLoaded, 3549).
--define(wxLocale_IsOk, 3550).
--define(wxActivateEvent_GetActive, 3551).
--define(wxPopupWindow_new_2, 3553).
--define(wxPopupWindow_new_0, 3554).
--define(wxPopupWindow_destruct, 3556).
--define(wxPopupWindow_Create, 3557).
--define(wxPopupWindow_Position, 3558).
--define(wxPopupTransientWindow_new_0, 3559).
--define(wxPopupTransientWindow_new_2, 3560).
--define(wxPopupTransientWindow_destruct, 3561).
--define(wxPopupTransientWindow_Popup, 3562).
--define(wxPopupTransientWindow_Dismiss, 3563).
+-define(wxAuiPaneInfo_GetWindow, 2653).
+-define(wxAuiPaneInfo_GetFrame, 2654).
+-define(wxAuiPaneInfo_GetDirection, 2655).
+-define(wxAuiPaneInfo_GetLayer, 2656).
+-define(wxAuiPaneInfo_GetRow, 2657).
+-define(wxAuiPaneInfo_GetPosition, 2658).
+-define(wxAuiPaneInfo_GetFloatingPosition, 2659).
+-define(wxAuiPaneInfo_GetFloatingSize, 2660).
+-define(wxAuiNotebook_new_0, 2661).
+-define(wxAuiNotebook_new_2, 2662).
+-define(wxAuiNotebook_AddPage, 2663).
+-define(wxAuiNotebook_Create, 2664).
+-define(wxAuiNotebook_DeletePage, 2665).
+-define(wxAuiNotebook_GetArtProvider, 2666).
+-define(wxAuiNotebook_GetPage, 2667).
+-define(wxAuiNotebook_GetPageBitmap, 2668).
+-define(wxAuiNotebook_GetPageCount, 2669).
+-define(wxAuiNotebook_GetPageIndex, 2670).
+-define(wxAuiNotebook_GetPageText, 2671).
+-define(wxAuiNotebook_GetSelection, 2672).
+-define(wxAuiNotebook_InsertPage, 2673).
+-define(wxAuiNotebook_RemovePage, 2674).
+-define(wxAuiNotebook_SetArtProvider, 2675).
+-define(wxAuiNotebook_SetFont, 2676).
+-define(wxAuiNotebook_SetPageBitmap, 2677).
+-define(wxAuiNotebook_SetPageText, 2678).
+-define(wxAuiNotebook_SetSelection, 2679).
+-define(wxAuiNotebook_SetTabCtrlHeight, 2680).
+-define(wxAuiNotebook_SetUniformBitmapSize, 2681).
+-define(wxAuiNotebook_destroy, 2682).
+-define(wxAuiTabArt_SetFlags, 2683).
+-define(wxAuiTabArt_SetMeasuringFont, 2684).
+-define(wxAuiTabArt_SetNormalFont, 2685).
+-define(wxAuiTabArt_SetSelectedFont, 2686).
+-define(wxAuiTabArt_SetColour, 2687).
+-define(wxAuiTabArt_SetActiveColour, 2688).
+-define(wxAuiDockArt_GetColour, 2689).
+-define(wxAuiDockArt_GetFont, 2690).
+-define(wxAuiDockArt_GetMetric, 2691).
+-define(wxAuiDockArt_SetColour, 2692).
+-define(wxAuiDockArt_SetFont, 2693).
+-define(wxAuiDockArt_SetMetric, 2694).
+-define(wxAuiSimpleTabArt_new, 2695).
+-define(wxAuiSimpleTabArt_destroy, 2696).
+-define(wxMDIParentFrame_new_0, 2697).
+-define(wxMDIParentFrame_new_4, 2698).
+-define(wxMDIParentFrame_destruct, 2699).
+-define(wxMDIParentFrame_ActivateNext, 2700).
+-define(wxMDIParentFrame_ActivatePrevious, 2701).
+-define(wxMDIParentFrame_ArrangeIcons, 2702).
+-define(wxMDIParentFrame_Cascade, 2703).
+-define(wxMDIParentFrame_Create, 2704).
+-define(wxMDIParentFrame_GetActiveChild, 2705).
+-define(wxMDIParentFrame_GetClientWindow, 2706).
+-define(wxMDIParentFrame_Tile, 2707).
+-define(wxMDIChildFrame_new_0, 2708).
+-define(wxMDIChildFrame_new_4, 2709).
+-define(wxMDIChildFrame_destruct, 2710).
+-define(wxMDIChildFrame_Activate, 2711).
+-define(wxMDIChildFrame_Create, 2712).
+-define(wxMDIChildFrame_Maximize, 2713).
+-define(wxMDIChildFrame_Restore, 2714).
+-define(wxMDIClientWindow_new_0, 2715).
+-define(wxMDIClientWindow_new_2, 2716).
+-define(wxMDIClientWindow_destruct, 2717).
+-define(wxMDIClientWindow_CreateClient, 2718).
+-define(wxLayoutAlgorithm_new, 2719).
+-define(wxLayoutAlgorithm_LayoutFrame, 2720).
+-define(wxLayoutAlgorithm_LayoutMDIFrame, 2721).
+-define(wxLayoutAlgorithm_LayoutWindow, 2722).
+-define(wxLayoutAlgorithm_destroy, 2723).
+-define(wxEvent_GetId, 2724).
+-define(wxEvent_GetSkipped, 2725).
+-define(wxEvent_GetTimestamp, 2726).
+-define(wxEvent_IsCommandEvent, 2727).
+-define(wxEvent_ResumePropagation, 2728).
+-define(wxEvent_ShouldPropagate, 2729).
+-define(wxEvent_Skip, 2730).
+-define(wxEvent_StopPropagation, 2731).
+-define(wxCommandEvent_getClientData, 2732).
+-define(wxCommandEvent_GetExtraLong, 2733).
+-define(wxCommandEvent_GetInt, 2734).
+-define(wxCommandEvent_GetSelection, 2735).
+-define(wxCommandEvent_GetString, 2736).
+-define(wxCommandEvent_IsChecked, 2737).
+-define(wxCommandEvent_IsSelection, 2738).
+-define(wxCommandEvent_SetInt, 2739).
+-define(wxCommandEvent_SetString, 2740).
+-define(wxScrollEvent_GetOrientation, 2741).
+-define(wxScrollEvent_GetPosition, 2742).
+-define(wxScrollWinEvent_GetOrientation, 2743).
+-define(wxScrollWinEvent_GetPosition, 2744).
+-define(wxMouseEvent_AltDown, 2745).
+-define(wxMouseEvent_Button, 2746).
+-define(wxMouseEvent_ButtonDClick, 2747).
+-define(wxMouseEvent_ButtonDown, 2748).
+-define(wxMouseEvent_ButtonUp, 2749).
+-define(wxMouseEvent_CmdDown, 2750).
+-define(wxMouseEvent_ControlDown, 2751).
+-define(wxMouseEvent_Dragging, 2752).
+-define(wxMouseEvent_Entering, 2753).
+-define(wxMouseEvent_GetButton, 2754).
+-define(wxMouseEvent_GetPosition, 2757).
+-define(wxMouseEvent_GetLogicalPosition, 2758).
+-define(wxMouseEvent_GetLinesPerAction, 2759).
+-define(wxMouseEvent_GetWheelRotation, 2760).
+-define(wxMouseEvent_GetWheelDelta, 2761).
+-define(wxMouseEvent_GetX, 2762).
+-define(wxMouseEvent_GetY, 2763).
+-define(wxMouseEvent_IsButton, 2764).
+-define(wxMouseEvent_IsPageScroll, 2765).
+-define(wxMouseEvent_Leaving, 2766).
+-define(wxMouseEvent_LeftDClick, 2767).
+-define(wxMouseEvent_LeftDown, 2768).
+-define(wxMouseEvent_LeftIsDown, 2769).
+-define(wxMouseEvent_LeftUp, 2770).
+-define(wxMouseEvent_MetaDown, 2771).
+-define(wxMouseEvent_MiddleDClick, 2772).
+-define(wxMouseEvent_MiddleDown, 2773).
+-define(wxMouseEvent_MiddleIsDown, 2774).
+-define(wxMouseEvent_MiddleUp, 2775).
+-define(wxMouseEvent_Moving, 2776).
+-define(wxMouseEvent_RightDClick, 2777).
+-define(wxMouseEvent_RightDown, 2778).
+-define(wxMouseEvent_RightIsDown, 2779).
+-define(wxMouseEvent_RightUp, 2780).
+-define(wxMouseEvent_ShiftDown, 2781).
+-define(wxSetCursorEvent_GetCursor, 2782).
+-define(wxSetCursorEvent_GetX, 2783).
+-define(wxSetCursorEvent_GetY, 2784).
+-define(wxSetCursorEvent_HasCursor, 2785).
+-define(wxSetCursorEvent_SetCursor, 2786).
+-define(wxKeyEvent_AltDown, 2787).
+-define(wxKeyEvent_CmdDown, 2788).
+-define(wxKeyEvent_ControlDown, 2789).
+-define(wxKeyEvent_GetKeyCode, 2790).
+-define(wxKeyEvent_GetModifiers, 2791).
+-define(wxKeyEvent_GetPosition, 2794).
+-define(wxKeyEvent_GetRawKeyCode, 2795).
+-define(wxKeyEvent_GetRawKeyFlags, 2796).
+-define(wxKeyEvent_GetUnicodeKey, 2797).
+-define(wxKeyEvent_GetX, 2798).
+-define(wxKeyEvent_GetY, 2799).
+-define(wxKeyEvent_HasModifiers, 2800).
+-define(wxKeyEvent_MetaDown, 2801).
+-define(wxKeyEvent_ShiftDown, 2802).
+-define(wxSizeEvent_GetSize, 2803).
+-define(wxMoveEvent_GetPosition, 2804).
+-define(wxEraseEvent_GetDC, 2805).
+-define(wxFocusEvent_GetWindow, 2806).
+-define(wxChildFocusEvent_GetWindow, 2807).
+-define(wxMenuEvent_GetMenu, 2808).
+-define(wxMenuEvent_GetMenuId, 2809).
+-define(wxMenuEvent_IsPopup, 2810).
+-define(wxCloseEvent_CanVeto, 2811).
+-define(wxCloseEvent_GetLoggingOff, 2812).
+-define(wxCloseEvent_SetCanVeto, 2813).
+-define(wxCloseEvent_SetLoggingOff, 2814).
+-define(wxCloseEvent_Veto, 2815).
+-define(wxShowEvent_SetShow, 2816).
+-define(wxShowEvent_GetShow, 2817).
+-define(wxIconizeEvent_Iconized, 2818).
+-define(wxJoystickEvent_ButtonDown, 2819).
+-define(wxJoystickEvent_ButtonIsDown, 2820).
+-define(wxJoystickEvent_ButtonUp, 2821).
+-define(wxJoystickEvent_GetButtonChange, 2822).
+-define(wxJoystickEvent_GetButtonState, 2823).
+-define(wxJoystickEvent_GetJoystick, 2824).
+-define(wxJoystickEvent_GetPosition, 2825).
+-define(wxJoystickEvent_GetZPosition, 2826).
+-define(wxJoystickEvent_IsButton, 2827).
+-define(wxJoystickEvent_IsMove, 2828).
+-define(wxJoystickEvent_IsZMove, 2829).
+-define(wxUpdateUIEvent_CanUpdate, 2830).
+-define(wxUpdateUIEvent_Check, 2831).
+-define(wxUpdateUIEvent_Enable, 2832).
+-define(wxUpdateUIEvent_Show, 2833).
+-define(wxUpdateUIEvent_GetChecked, 2834).
+-define(wxUpdateUIEvent_GetEnabled, 2835).
+-define(wxUpdateUIEvent_GetShown, 2836).
+-define(wxUpdateUIEvent_GetSetChecked, 2837).
+-define(wxUpdateUIEvent_GetSetEnabled, 2838).
+-define(wxUpdateUIEvent_GetSetShown, 2839).
+-define(wxUpdateUIEvent_GetSetText, 2840).
+-define(wxUpdateUIEvent_GetText, 2841).
+-define(wxUpdateUIEvent_GetMode, 2842).
+-define(wxUpdateUIEvent_GetUpdateInterval, 2843).
+-define(wxUpdateUIEvent_ResetUpdateTime, 2844).
+-define(wxUpdateUIEvent_SetMode, 2845).
+-define(wxUpdateUIEvent_SetText, 2846).
+-define(wxUpdateUIEvent_SetUpdateInterval, 2847).
+-define(wxMouseCaptureChangedEvent_GetCapturedWindow, 2848).
+-define(wxPaletteChangedEvent_SetChangedWindow, 2849).
+-define(wxPaletteChangedEvent_GetChangedWindow, 2850).
+-define(wxQueryNewPaletteEvent_SetPaletteRealized, 2851).
+-define(wxQueryNewPaletteEvent_GetPaletteRealized, 2852).
+-define(wxNavigationKeyEvent_GetDirection, 2853).
+-define(wxNavigationKeyEvent_SetDirection, 2854).
+-define(wxNavigationKeyEvent_IsWindowChange, 2855).
+-define(wxNavigationKeyEvent_SetWindowChange, 2856).
+-define(wxNavigationKeyEvent_IsFromTab, 2857).
+-define(wxNavigationKeyEvent_SetFromTab, 2858).
+-define(wxNavigationKeyEvent_GetCurrentFocus, 2859).
+-define(wxNavigationKeyEvent_SetCurrentFocus, 2860).
+-define(wxHelpEvent_GetOrigin, 2861).
+-define(wxHelpEvent_GetPosition, 2862).
+-define(wxHelpEvent_SetOrigin, 2863).
+-define(wxHelpEvent_SetPosition, 2864).
+-define(wxContextMenuEvent_GetPosition, 2865).
+-define(wxContextMenuEvent_SetPosition, 2866).
+-define(wxIdleEvent_CanSend, 2867).
+-define(wxIdleEvent_GetMode, 2868).
+-define(wxIdleEvent_RequestMore, 2869).
+-define(wxIdleEvent_MoreRequested, 2870).
+-define(wxIdleEvent_SetMode, 2871).
+-define(wxGridEvent_AltDown, 2872).
+-define(wxGridEvent_ControlDown, 2873).
+-define(wxGridEvent_GetCol, 2874).
+-define(wxGridEvent_GetPosition, 2875).
+-define(wxGridEvent_GetRow, 2876).
+-define(wxGridEvent_MetaDown, 2877).
+-define(wxGridEvent_Selecting, 2878).
+-define(wxGridEvent_ShiftDown, 2879).
+-define(wxNotifyEvent_Allow, 2880).
+-define(wxNotifyEvent_IsAllowed, 2881).
+-define(wxNotifyEvent_Veto, 2882).
+-define(wxSashEvent_GetEdge, 2883).
+-define(wxSashEvent_GetDragRect, 2884).
+-define(wxSashEvent_GetDragStatus, 2885).
+-define(wxListEvent_GetCacheFrom, 2886).
+-define(wxListEvent_GetCacheTo, 2887).
+-define(wxListEvent_GetKeyCode, 2888).
+-define(wxListEvent_GetIndex, 2889).
+-define(wxListEvent_GetColumn, 2890).
+-define(wxListEvent_GetPoint, 2891).
+-define(wxListEvent_GetLabel, 2892).
+-define(wxListEvent_GetText, 2893).
+-define(wxListEvent_GetImage, 2894).
+-define(wxListEvent_GetData, 2895).
+-define(wxListEvent_GetMask, 2896).
+-define(wxListEvent_GetItem, 2897).
+-define(wxListEvent_IsEditCancelled, 2898).
+-define(wxDateEvent_GetDate, 2899).
+-define(wxCalendarEvent_GetWeekDay, 2900).
+-define(wxFileDirPickerEvent_GetPath, 2901).
+-define(wxColourPickerEvent_GetColour, 2902).
+-define(wxFontPickerEvent_GetFont, 2903).
+-define(wxStyledTextEvent_GetPosition, 2904).
+-define(wxStyledTextEvent_GetKey, 2905).
+-define(wxStyledTextEvent_GetModifiers, 2906).
+-define(wxStyledTextEvent_GetModificationType, 2907).
+-define(wxStyledTextEvent_GetText, 2908).
+-define(wxStyledTextEvent_GetLength, 2909).
+-define(wxStyledTextEvent_GetLinesAdded, 2910).
+-define(wxStyledTextEvent_GetLine, 2911).
+-define(wxStyledTextEvent_GetFoldLevelNow, 2912).
+-define(wxStyledTextEvent_GetFoldLevelPrev, 2913).
+-define(wxStyledTextEvent_GetMargin, 2914).
+-define(wxStyledTextEvent_GetMessage, 2915).
+-define(wxStyledTextEvent_GetWParam, 2916).
+-define(wxStyledTextEvent_GetLParam, 2917).
+-define(wxStyledTextEvent_GetListType, 2918).
+-define(wxStyledTextEvent_GetX, 2919).
+-define(wxStyledTextEvent_GetY, 2920).
+-define(wxStyledTextEvent_GetDragText, 2921).
+-define(wxStyledTextEvent_GetDragAllowMove, 2922).
+-define(wxStyledTextEvent_GetDragResult, 2923).
+-define(wxStyledTextEvent_GetShift, 2924).
+-define(wxStyledTextEvent_GetControl, 2925).
+-define(wxStyledTextEvent_GetAlt, 2926).
+-define(utils_wxGetKeyState, 2927).
+-define(utils_wxGetMousePosition, 2928).
+-define(utils_wxGetMouseState, 2929).
+-define(utils_wxSetDetectableAutoRepeat, 2930).
+-define(utils_wxBell, 2931).
+-define(utils_wxFindMenuItemId, 2932).
+-define(utils_wxGenericFindWindowAtPoint, 2933).
+-define(utils_wxFindWindowAtPoint, 2934).
+-define(utils_wxBeginBusyCursor, 2935).
+-define(utils_wxEndBusyCursor, 2936).
+-define(utils_wxIsBusy, 2937).
+-define(utils_wxShutdown, 2938).
+-define(utils_wxShell, 2939).
+-define(utils_wxLaunchDefaultBrowser, 2940).
+-define(utils_wxGetEmailAddress, 2941).
+-define(utils_wxGetUserId, 2942).
+-define(utils_wxGetHomeDir, 2943).
+-define(utils_wxNewId, 2944).
+-define(utils_wxRegisterId, 2945).
+-define(utils_wxGetCurrentId, 2946).
+-define(utils_wxGetOsDescription, 2947).
+-define(utils_wxIsPlatformLittleEndian, 2948).
+-define(utils_wxIsPlatform64Bit, 2949).
+-define(gdicmn_wxDisplaySize, 2950).
+-define(gdicmn_wxSetCursor, 2951).
+-define(wxPrintout_new, 2952).
+-define(wxPrintout_destruct, 2953).
+-define(wxPrintout_GetDC, 2954).
+-define(wxPrintout_GetPageSizeMM, 2955).
+-define(wxPrintout_GetPageSizePixels, 2956).
+-define(wxPrintout_GetPaperRectPixels, 2957).
+-define(wxPrintout_GetPPIPrinter, 2958).
+-define(wxPrintout_GetPPIScreen, 2959).
+-define(wxPrintout_GetTitle, 2960).
+-define(wxPrintout_IsPreview, 2961).
+-define(wxPrintout_FitThisSizeToPaper, 2962).
+-define(wxPrintout_FitThisSizeToPage, 2963).
+-define(wxPrintout_FitThisSizeToPageMargins, 2964).
+-define(wxPrintout_MapScreenSizeToPaper, 2965).
+-define(wxPrintout_MapScreenSizeToPage, 2966).
+-define(wxPrintout_MapScreenSizeToPageMargins, 2967).
+-define(wxPrintout_MapScreenSizeToDevice, 2968).
+-define(wxPrintout_GetLogicalPaperRect, 2969).
+-define(wxPrintout_GetLogicalPageRect, 2970).
+-define(wxPrintout_GetLogicalPageMarginsRect, 2971).
+-define(wxPrintout_SetLogicalOrigin, 2972).
+-define(wxPrintout_OffsetLogicalOrigin, 2973).
+-define(wxStyledTextCtrl_new_2, 2974).
+-define(wxStyledTextCtrl_new_0, 2975).
+-define(wxStyledTextCtrl_destruct, 2976).
+-define(wxStyledTextCtrl_Create, 2977).
+-define(wxStyledTextCtrl_AddText, 2978).
+-define(wxStyledTextCtrl_AddStyledText, 2979).
+-define(wxStyledTextCtrl_InsertText, 2980).
+-define(wxStyledTextCtrl_ClearAll, 2981).
+-define(wxStyledTextCtrl_ClearDocumentStyle, 2982).
+-define(wxStyledTextCtrl_GetLength, 2983).
+-define(wxStyledTextCtrl_GetCharAt, 2984).
+-define(wxStyledTextCtrl_GetCurrentPos, 2985).
+-define(wxStyledTextCtrl_GetAnchor, 2986).
+-define(wxStyledTextCtrl_GetStyleAt, 2987).
+-define(wxStyledTextCtrl_Redo, 2988).
+-define(wxStyledTextCtrl_SetUndoCollection, 2989).
+-define(wxStyledTextCtrl_SelectAll, 2990).
+-define(wxStyledTextCtrl_SetSavePoint, 2991).
+-define(wxStyledTextCtrl_GetStyledText, 2992).
+-define(wxStyledTextCtrl_CanRedo, 2993).
+-define(wxStyledTextCtrl_MarkerLineFromHandle, 2994).
+-define(wxStyledTextCtrl_MarkerDeleteHandle, 2995).
+-define(wxStyledTextCtrl_GetUndoCollection, 2996).
+-define(wxStyledTextCtrl_GetViewWhiteSpace, 2997).
+-define(wxStyledTextCtrl_SetViewWhiteSpace, 2998).
+-define(wxStyledTextCtrl_PositionFromPoint, 2999).
+-define(wxStyledTextCtrl_PositionFromPointClose, 3000).
+-define(wxStyledTextCtrl_GotoLine, 3001).
+-define(wxStyledTextCtrl_GotoPos, 3002).
+-define(wxStyledTextCtrl_SetAnchor, 3003).
+-define(wxStyledTextCtrl_GetCurLine, 3004).
+-define(wxStyledTextCtrl_GetEndStyled, 3005).
+-define(wxStyledTextCtrl_ConvertEOLs, 3006).
+-define(wxStyledTextCtrl_GetEOLMode, 3007).
+-define(wxStyledTextCtrl_SetEOLMode, 3008).
+-define(wxStyledTextCtrl_StartStyling, 3009).
+-define(wxStyledTextCtrl_SetStyling, 3010).
+-define(wxStyledTextCtrl_GetBufferedDraw, 3011).
+-define(wxStyledTextCtrl_SetBufferedDraw, 3012).
+-define(wxStyledTextCtrl_SetTabWidth, 3013).
+-define(wxStyledTextCtrl_GetTabWidth, 3014).
+-define(wxStyledTextCtrl_SetCodePage, 3015).
+-define(wxStyledTextCtrl_MarkerDefine, 3016).
+-define(wxStyledTextCtrl_MarkerSetForeground, 3017).
+-define(wxStyledTextCtrl_MarkerSetBackground, 3018).
+-define(wxStyledTextCtrl_MarkerAdd, 3019).
+-define(wxStyledTextCtrl_MarkerDelete, 3020).
+-define(wxStyledTextCtrl_MarkerDeleteAll, 3021).
+-define(wxStyledTextCtrl_MarkerGet, 3022).
+-define(wxStyledTextCtrl_MarkerNext, 3023).
+-define(wxStyledTextCtrl_MarkerPrevious, 3024).
+-define(wxStyledTextCtrl_MarkerDefineBitmap, 3025).
+-define(wxStyledTextCtrl_MarkerAddSet, 3026).
+-define(wxStyledTextCtrl_MarkerSetAlpha, 3027).
+-define(wxStyledTextCtrl_SetMarginType, 3028).
+-define(wxStyledTextCtrl_GetMarginType, 3029).
+-define(wxStyledTextCtrl_SetMarginWidth, 3030).
+-define(wxStyledTextCtrl_GetMarginWidth, 3031).
+-define(wxStyledTextCtrl_SetMarginMask, 3032).
+-define(wxStyledTextCtrl_GetMarginMask, 3033).
+-define(wxStyledTextCtrl_SetMarginSensitive, 3034).
+-define(wxStyledTextCtrl_GetMarginSensitive, 3035).
+-define(wxStyledTextCtrl_StyleClearAll, 3036).
+-define(wxStyledTextCtrl_StyleSetForeground, 3037).
+-define(wxStyledTextCtrl_StyleSetBackground, 3038).
+-define(wxStyledTextCtrl_StyleSetBold, 3039).
+-define(wxStyledTextCtrl_StyleSetItalic, 3040).
+-define(wxStyledTextCtrl_StyleSetSize, 3041).
+-define(wxStyledTextCtrl_StyleSetFaceName, 3042).
+-define(wxStyledTextCtrl_StyleSetEOLFilled, 3043).
+-define(wxStyledTextCtrl_StyleResetDefault, 3044).
+-define(wxStyledTextCtrl_StyleSetUnderline, 3045).
+-define(wxStyledTextCtrl_StyleSetCase, 3046).
+-define(wxStyledTextCtrl_StyleSetHotSpot, 3047).
+-define(wxStyledTextCtrl_SetSelForeground, 3048).
+-define(wxStyledTextCtrl_SetSelBackground, 3049).
+-define(wxStyledTextCtrl_GetSelAlpha, 3050).
+-define(wxStyledTextCtrl_SetSelAlpha, 3051).
+-define(wxStyledTextCtrl_SetCaretForeground, 3052).
+-define(wxStyledTextCtrl_CmdKeyAssign, 3053).
+-define(wxStyledTextCtrl_CmdKeyClear, 3054).
+-define(wxStyledTextCtrl_CmdKeyClearAll, 3055).
+-define(wxStyledTextCtrl_SetStyleBytes, 3056).
+-define(wxStyledTextCtrl_StyleSetVisible, 3057).
+-define(wxStyledTextCtrl_GetCaretPeriod, 3058).
+-define(wxStyledTextCtrl_SetCaretPeriod, 3059).
+-define(wxStyledTextCtrl_SetWordChars, 3060).
+-define(wxStyledTextCtrl_BeginUndoAction, 3061).
+-define(wxStyledTextCtrl_EndUndoAction, 3062).
+-define(wxStyledTextCtrl_IndicatorSetStyle, 3063).
+-define(wxStyledTextCtrl_IndicatorGetStyle, 3064).
+-define(wxStyledTextCtrl_IndicatorSetForeground, 3065).
+-define(wxStyledTextCtrl_IndicatorGetForeground, 3066).
+-define(wxStyledTextCtrl_SetWhitespaceForeground, 3067).
+-define(wxStyledTextCtrl_SetWhitespaceBackground, 3068).
+-define(wxStyledTextCtrl_GetStyleBits, 3069).
+-define(wxStyledTextCtrl_SetLineState, 3070).
+-define(wxStyledTextCtrl_GetLineState, 3071).
+-define(wxStyledTextCtrl_GetMaxLineState, 3072).
+-define(wxStyledTextCtrl_GetCaretLineVisible, 3073).
+-define(wxStyledTextCtrl_SetCaretLineVisible, 3074).
+-define(wxStyledTextCtrl_GetCaretLineBackground, 3075).
+-define(wxStyledTextCtrl_SetCaretLineBackground, 3076).
+-define(wxStyledTextCtrl_AutoCompShow, 3077).
+-define(wxStyledTextCtrl_AutoCompCancel, 3078).
+-define(wxStyledTextCtrl_AutoCompActive, 3079).
+-define(wxStyledTextCtrl_AutoCompPosStart, 3080).
+-define(wxStyledTextCtrl_AutoCompComplete, 3081).
+-define(wxStyledTextCtrl_AutoCompStops, 3082).
+-define(wxStyledTextCtrl_AutoCompSetSeparator, 3083).
+-define(wxStyledTextCtrl_AutoCompGetSeparator, 3084).
+-define(wxStyledTextCtrl_AutoCompSelect, 3085).
+-define(wxStyledTextCtrl_AutoCompSetCancelAtStart, 3086).
+-define(wxStyledTextCtrl_AutoCompGetCancelAtStart, 3087).
+-define(wxStyledTextCtrl_AutoCompSetFillUps, 3088).
+-define(wxStyledTextCtrl_AutoCompSetChooseSingle, 3089).
+-define(wxStyledTextCtrl_AutoCompGetChooseSingle, 3090).
+-define(wxStyledTextCtrl_AutoCompSetIgnoreCase, 3091).
+-define(wxStyledTextCtrl_AutoCompGetIgnoreCase, 3092).
+-define(wxStyledTextCtrl_UserListShow, 3093).
+-define(wxStyledTextCtrl_AutoCompSetAutoHide, 3094).
+-define(wxStyledTextCtrl_AutoCompGetAutoHide, 3095).
+-define(wxStyledTextCtrl_AutoCompSetDropRestOfWord, 3096).
+-define(wxStyledTextCtrl_AutoCompGetDropRestOfWord, 3097).
+-define(wxStyledTextCtrl_RegisterImage, 3098).
+-define(wxStyledTextCtrl_ClearRegisteredImages, 3099).
+-define(wxStyledTextCtrl_AutoCompGetTypeSeparator, 3100).
+-define(wxStyledTextCtrl_AutoCompSetTypeSeparator, 3101).
+-define(wxStyledTextCtrl_AutoCompSetMaxWidth, 3102).
+-define(wxStyledTextCtrl_AutoCompGetMaxWidth, 3103).
+-define(wxStyledTextCtrl_AutoCompSetMaxHeight, 3104).
+-define(wxStyledTextCtrl_AutoCompGetMaxHeight, 3105).
+-define(wxStyledTextCtrl_SetIndent, 3106).
+-define(wxStyledTextCtrl_GetIndent, 3107).
+-define(wxStyledTextCtrl_SetUseTabs, 3108).
+-define(wxStyledTextCtrl_GetUseTabs, 3109).
+-define(wxStyledTextCtrl_SetLineIndentation, 3110).
+-define(wxStyledTextCtrl_GetLineIndentation, 3111).
+-define(wxStyledTextCtrl_GetLineIndentPosition, 3112).
+-define(wxStyledTextCtrl_GetColumn, 3113).
+-define(wxStyledTextCtrl_SetUseHorizontalScrollBar, 3114).
+-define(wxStyledTextCtrl_GetUseHorizontalScrollBar, 3115).
+-define(wxStyledTextCtrl_SetIndentationGuides, 3116).
+-define(wxStyledTextCtrl_GetIndentationGuides, 3117).
+-define(wxStyledTextCtrl_SetHighlightGuide, 3118).
+-define(wxStyledTextCtrl_GetHighlightGuide, 3119).
+-define(wxStyledTextCtrl_GetLineEndPosition, 3120).
+-define(wxStyledTextCtrl_GetCodePage, 3121).
+-define(wxStyledTextCtrl_GetCaretForeground, 3122).
+-define(wxStyledTextCtrl_GetReadOnly, 3123).
+-define(wxStyledTextCtrl_SetCurrentPos, 3124).
+-define(wxStyledTextCtrl_SetSelectionStart, 3125).
+-define(wxStyledTextCtrl_GetSelectionStart, 3126).
+-define(wxStyledTextCtrl_SetSelectionEnd, 3127).
+-define(wxStyledTextCtrl_GetSelectionEnd, 3128).
+-define(wxStyledTextCtrl_SetPrintMagnification, 3129).
+-define(wxStyledTextCtrl_GetPrintMagnification, 3130).
+-define(wxStyledTextCtrl_SetPrintColourMode, 3131).
+-define(wxStyledTextCtrl_GetPrintColourMode, 3132).
+-define(wxStyledTextCtrl_FindText, 3133).
+-define(wxStyledTextCtrl_FormatRange, 3134).
+-define(wxStyledTextCtrl_GetFirstVisibleLine, 3135).
+-define(wxStyledTextCtrl_GetLine, 3136).
+-define(wxStyledTextCtrl_GetLineCount, 3137).
+-define(wxStyledTextCtrl_SetMarginLeft, 3138).
+-define(wxStyledTextCtrl_GetMarginLeft, 3139).
+-define(wxStyledTextCtrl_SetMarginRight, 3140).
+-define(wxStyledTextCtrl_GetMarginRight, 3141).
+-define(wxStyledTextCtrl_GetModify, 3142).
+-define(wxStyledTextCtrl_SetSelection, 3143).
+-define(wxStyledTextCtrl_GetSelectedText, 3144).
+-define(wxStyledTextCtrl_GetTextRange, 3145).
+-define(wxStyledTextCtrl_HideSelection, 3146).
+-define(wxStyledTextCtrl_LineFromPosition, 3147).
+-define(wxStyledTextCtrl_PositionFromLine, 3148).
+-define(wxStyledTextCtrl_LineScroll, 3149).
+-define(wxStyledTextCtrl_EnsureCaretVisible, 3150).
+-define(wxStyledTextCtrl_ReplaceSelection, 3151).
+-define(wxStyledTextCtrl_SetReadOnly, 3152).
+-define(wxStyledTextCtrl_CanPaste, 3153).
+-define(wxStyledTextCtrl_CanUndo, 3154).
+-define(wxStyledTextCtrl_EmptyUndoBuffer, 3155).
+-define(wxStyledTextCtrl_Undo, 3156).
+-define(wxStyledTextCtrl_Cut, 3157).
+-define(wxStyledTextCtrl_Copy, 3158).
+-define(wxStyledTextCtrl_Paste, 3159).
+-define(wxStyledTextCtrl_Clear, 3160).
+-define(wxStyledTextCtrl_SetText, 3161).
+-define(wxStyledTextCtrl_GetText, 3162).
+-define(wxStyledTextCtrl_GetTextLength, 3163).
+-define(wxStyledTextCtrl_GetOvertype, 3164).
+-define(wxStyledTextCtrl_SetCaretWidth, 3165).
+-define(wxStyledTextCtrl_GetCaretWidth, 3166).
+-define(wxStyledTextCtrl_SetTargetStart, 3167).
+-define(wxStyledTextCtrl_GetTargetStart, 3168).
+-define(wxStyledTextCtrl_SetTargetEnd, 3169).
+-define(wxStyledTextCtrl_GetTargetEnd, 3170).
+-define(wxStyledTextCtrl_ReplaceTarget, 3171).
+-define(wxStyledTextCtrl_SearchInTarget, 3172).
+-define(wxStyledTextCtrl_SetSearchFlags, 3173).
+-define(wxStyledTextCtrl_GetSearchFlags, 3174).
+-define(wxStyledTextCtrl_CallTipShow, 3175).
+-define(wxStyledTextCtrl_CallTipCancel, 3176).
+-define(wxStyledTextCtrl_CallTipActive, 3177).
+-define(wxStyledTextCtrl_CallTipPosAtStart, 3178).
+-define(wxStyledTextCtrl_CallTipSetHighlight, 3179).
+-define(wxStyledTextCtrl_CallTipSetBackground, 3180).
+-define(wxStyledTextCtrl_CallTipSetForeground, 3181).
+-define(wxStyledTextCtrl_CallTipSetForegroundHighlight, 3182).
+-define(wxStyledTextCtrl_CallTipUseStyle, 3183).
+-define(wxStyledTextCtrl_VisibleFromDocLine, 3184).
+-define(wxStyledTextCtrl_DocLineFromVisible, 3185).
+-define(wxStyledTextCtrl_WrapCount, 3186).
+-define(wxStyledTextCtrl_SetFoldLevel, 3187).
+-define(wxStyledTextCtrl_GetFoldLevel, 3188).
+-define(wxStyledTextCtrl_GetLastChild, 3189).
+-define(wxStyledTextCtrl_GetFoldParent, 3190).
+-define(wxStyledTextCtrl_ShowLines, 3191).
+-define(wxStyledTextCtrl_HideLines, 3192).
+-define(wxStyledTextCtrl_GetLineVisible, 3193).
+-define(wxStyledTextCtrl_SetFoldExpanded, 3194).
+-define(wxStyledTextCtrl_GetFoldExpanded, 3195).
+-define(wxStyledTextCtrl_ToggleFold, 3196).
+-define(wxStyledTextCtrl_EnsureVisible, 3197).
+-define(wxStyledTextCtrl_SetFoldFlags, 3198).
+-define(wxStyledTextCtrl_EnsureVisibleEnforcePolicy, 3199).
+-define(wxStyledTextCtrl_SetTabIndents, 3200).
+-define(wxStyledTextCtrl_GetTabIndents, 3201).
+-define(wxStyledTextCtrl_SetBackSpaceUnIndents, 3202).
+-define(wxStyledTextCtrl_GetBackSpaceUnIndents, 3203).
+-define(wxStyledTextCtrl_SetMouseDwellTime, 3204).
+-define(wxStyledTextCtrl_GetMouseDwellTime, 3205).
+-define(wxStyledTextCtrl_WordStartPosition, 3206).
+-define(wxStyledTextCtrl_WordEndPosition, 3207).
+-define(wxStyledTextCtrl_SetWrapMode, 3208).
+-define(wxStyledTextCtrl_GetWrapMode, 3209).
+-define(wxStyledTextCtrl_SetWrapVisualFlags, 3210).
+-define(wxStyledTextCtrl_GetWrapVisualFlags, 3211).
+-define(wxStyledTextCtrl_SetWrapVisualFlagsLocation, 3212).
+-define(wxStyledTextCtrl_GetWrapVisualFlagsLocation, 3213).
+-define(wxStyledTextCtrl_SetWrapStartIndent, 3214).
+-define(wxStyledTextCtrl_GetWrapStartIndent, 3215).
+-define(wxStyledTextCtrl_SetLayoutCache, 3216).
+-define(wxStyledTextCtrl_GetLayoutCache, 3217).
+-define(wxStyledTextCtrl_SetScrollWidth, 3218).
+-define(wxStyledTextCtrl_GetScrollWidth, 3219).
+-define(wxStyledTextCtrl_TextWidth, 3220).
+-define(wxStyledTextCtrl_GetEndAtLastLine, 3221).
+-define(wxStyledTextCtrl_TextHeight, 3222).
+-define(wxStyledTextCtrl_SetUseVerticalScrollBar, 3223).
+-define(wxStyledTextCtrl_GetUseVerticalScrollBar, 3224).
+-define(wxStyledTextCtrl_AppendText, 3225).
+-define(wxStyledTextCtrl_GetTwoPhaseDraw, 3226).
+-define(wxStyledTextCtrl_SetTwoPhaseDraw, 3227).
+-define(wxStyledTextCtrl_TargetFromSelection, 3228).
+-define(wxStyledTextCtrl_LinesJoin, 3229).
+-define(wxStyledTextCtrl_LinesSplit, 3230).
+-define(wxStyledTextCtrl_SetFoldMarginColour, 3231).
+-define(wxStyledTextCtrl_SetFoldMarginHiColour, 3232).
+-define(wxStyledTextCtrl_LineDown, 3233).
+-define(wxStyledTextCtrl_LineDownExtend, 3234).
+-define(wxStyledTextCtrl_LineUp, 3235).
+-define(wxStyledTextCtrl_LineUpExtend, 3236).
+-define(wxStyledTextCtrl_CharLeft, 3237).
+-define(wxStyledTextCtrl_CharLeftExtend, 3238).
+-define(wxStyledTextCtrl_CharRight, 3239).
+-define(wxStyledTextCtrl_CharRightExtend, 3240).
+-define(wxStyledTextCtrl_WordLeft, 3241).
+-define(wxStyledTextCtrl_WordLeftExtend, 3242).
+-define(wxStyledTextCtrl_WordRight, 3243).
+-define(wxStyledTextCtrl_WordRightExtend, 3244).
+-define(wxStyledTextCtrl_Home, 3245).
+-define(wxStyledTextCtrl_HomeExtend, 3246).
+-define(wxStyledTextCtrl_LineEnd, 3247).
+-define(wxStyledTextCtrl_LineEndExtend, 3248).
+-define(wxStyledTextCtrl_DocumentStart, 3249).
+-define(wxStyledTextCtrl_DocumentStartExtend, 3250).
+-define(wxStyledTextCtrl_DocumentEnd, 3251).
+-define(wxStyledTextCtrl_DocumentEndExtend, 3252).
+-define(wxStyledTextCtrl_PageUp, 3253).
+-define(wxStyledTextCtrl_PageUpExtend, 3254).
+-define(wxStyledTextCtrl_PageDown, 3255).
+-define(wxStyledTextCtrl_PageDownExtend, 3256).
+-define(wxStyledTextCtrl_EditToggleOvertype, 3257).
+-define(wxStyledTextCtrl_Cancel, 3258).
+-define(wxStyledTextCtrl_DeleteBack, 3259).
+-define(wxStyledTextCtrl_Tab, 3260).
+-define(wxStyledTextCtrl_BackTab, 3261).
+-define(wxStyledTextCtrl_NewLine, 3262).
+-define(wxStyledTextCtrl_FormFeed, 3263).
+-define(wxStyledTextCtrl_VCHome, 3264).
+-define(wxStyledTextCtrl_VCHomeExtend, 3265).
+-define(wxStyledTextCtrl_ZoomIn, 3266).
+-define(wxStyledTextCtrl_ZoomOut, 3267).
+-define(wxStyledTextCtrl_DelWordLeft, 3268).
+-define(wxStyledTextCtrl_DelWordRight, 3269).
+-define(wxStyledTextCtrl_LineCut, 3270).
+-define(wxStyledTextCtrl_LineDelete, 3271).
+-define(wxStyledTextCtrl_LineTranspose, 3272).
+-define(wxStyledTextCtrl_LineDuplicate, 3273).
+-define(wxStyledTextCtrl_LowerCase, 3274).
+-define(wxStyledTextCtrl_UpperCase, 3275).
+-define(wxStyledTextCtrl_LineScrollDown, 3276).
+-define(wxStyledTextCtrl_LineScrollUp, 3277).
+-define(wxStyledTextCtrl_DeleteBackNotLine, 3278).
+-define(wxStyledTextCtrl_HomeDisplay, 3279).
+-define(wxStyledTextCtrl_HomeDisplayExtend, 3280).
+-define(wxStyledTextCtrl_LineEndDisplay, 3281).
+-define(wxStyledTextCtrl_LineEndDisplayExtend, 3282).
+-define(wxStyledTextCtrl_HomeWrapExtend, 3283).
+-define(wxStyledTextCtrl_LineEndWrap, 3284).
+-define(wxStyledTextCtrl_LineEndWrapExtend, 3285).
+-define(wxStyledTextCtrl_VCHomeWrap, 3286).
+-define(wxStyledTextCtrl_VCHomeWrapExtend, 3287).
+-define(wxStyledTextCtrl_LineCopy, 3288).
+-define(wxStyledTextCtrl_MoveCaretInsideView, 3289).
+-define(wxStyledTextCtrl_LineLength, 3290).
+-define(wxStyledTextCtrl_BraceHighlight, 3291).
+-define(wxStyledTextCtrl_BraceBadLight, 3292).
+-define(wxStyledTextCtrl_BraceMatch, 3293).
+-define(wxStyledTextCtrl_GetViewEOL, 3294).
+-define(wxStyledTextCtrl_SetViewEOL, 3295).
+-define(wxStyledTextCtrl_SetModEventMask, 3296).
+-define(wxStyledTextCtrl_GetEdgeColumn, 3297).
+-define(wxStyledTextCtrl_SetEdgeColumn, 3298).
+-define(wxStyledTextCtrl_SetEdgeMode, 3299).
+-define(wxStyledTextCtrl_GetEdgeMode, 3300).
+-define(wxStyledTextCtrl_GetEdgeColour, 3301).
+-define(wxStyledTextCtrl_SetEdgeColour, 3302).
+-define(wxStyledTextCtrl_SearchAnchor, 3303).
+-define(wxStyledTextCtrl_SearchNext, 3304).
+-define(wxStyledTextCtrl_SearchPrev, 3305).
+-define(wxStyledTextCtrl_LinesOnScreen, 3306).
+-define(wxStyledTextCtrl_UsePopUp, 3307).
+-define(wxStyledTextCtrl_SelectionIsRectangle, 3308).
+-define(wxStyledTextCtrl_SetZoom, 3309).
+-define(wxStyledTextCtrl_GetZoom, 3310).
+-define(wxStyledTextCtrl_GetModEventMask, 3311).
+-define(wxStyledTextCtrl_SetSTCFocus, 3312).
+-define(wxStyledTextCtrl_GetSTCFocus, 3313).
+-define(wxStyledTextCtrl_SetStatus, 3314).
+-define(wxStyledTextCtrl_GetStatus, 3315).
+-define(wxStyledTextCtrl_SetMouseDownCaptures, 3316).
+-define(wxStyledTextCtrl_GetMouseDownCaptures, 3317).
+-define(wxStyledTextCtrl_SetSTCCursor, 3318).
+-define(wxStyledTextCtrl_GetSTCCursor, 3319).
+-define(wxStyledTextCtrl_SetControlCharSymbol, 3320).
+-define(wxStyledTextCtrl_GetControlCharSymbol, 3321).
+-define(wxStyledTextCtrl_WordPartLeft, 3322).
+-define(wxStyledTextCtrl_WordPartLeftExtend, 3323).
+-define(wxStyledTextCtrl_WordPartRight, 3324).
+-define(wxStyledTextCtrl_WordPartRightExtend, 3325).
+-define(wxStyledTextCtrl_SetVisiblePolicy, 3326).
+-define(wxStyledTextCtrl_DelLineLeft, 3327).
+-define(wxStyledTextCtrl_DelLineRight, 3328).
+-define(wxStyledTextCtrl_GetXOffset, 3329).
+-define(wxStyledTextCtrl_ChooseCaretX, 3330).
+-define(wxStyledTextCtrl_SetXCaretPolicy, 3331).
+-define(wxStyledTextCtrl_SetYCaretPolicy, 3332).
+-define(wxStyledTextCtrl_GetPrintWrapMode, 3333).
+-define(wxStyledTextCtrl_SetHotspotActiveForeground, 3334).
+-define(wxStyledTextCtrl_SetHotspotActiveBackground, 3335).
+-define(wxStyledTextCtrl_SetHotspotActiveUnderline, 3336).
+-define(wxStyledTextCtrl_SetHotspotSingleLine, 3337).
+-define(wxStyledTextCtrl_ParaDownExtend, 3338).
+-define(wxStyledTextCtrl_ParaUp, 3339).
+-define(wxStyledTextCtrl_ParaUpExtend, 3340).
+-define(wxStyledTextCtrl_PositionBefore, 3341).
+-define(wxStyledTextCtrl_PositionAfter, 3342).
+-define(wxStyledTextCtrl_CopyRange, 3343).
+-define(wxStyledTextCtrl_CopyText, 3344).
+-define(wxStyledTextCtrl_SetSelectionMode, 3345).
+-define(wxStyledTextCtrl_GetSelectionMode, 3346).
+-define(wxStyledTextCtrl_LineDownRectExtend, 3347).
+-define(wxStyledTextCtrl_LineUpRectExtend, 3348).
+-define(wxStyledTextCtrl_CharLeftRectExtend, 3349).
+-define(wxStyledTextCtrl_CharRightRectExtend, 3350).
+-define(wxStyledTextCtrl_HomeRectExtend, 3351).
+-define(wxStyledTextCtrl_VCHomeRectExtend, 3352).
+-define(wxStyledTextCtrl_LineEndRectExtend, 3353).
+-define(wxStyledTextCtrl_PageUpRectExtend, 3354).
+-define(wxStyledTextCtrl_PageDownRectExtend, 3355).
+-define(wxStyledTextCtrl_StutteredPageUp, 3356).
+-define(wxStyledTextCtrl_StutteredPageUpExtend, 3357).
+-define(wxStyledTextCtrl_StutteredPageDown, 3358).
+-define(wxStyledTextCtrl_StutteredPageDownExtend, 3359).
+-define(wxStyledTextCtrl_WordLeftEnd, 3360).
+-define(wxStyledTextCtrl_WordLeftEndExtend, 3361).
+-define(wxStyledTextCtrl_WordRightEnd, 3362).
+-define(wxStyledTextCtrl_WordRightEndExtend, 3363).
+-define(wxStyledTextCtrl_SetWhitespaceChars, 3364).
+-define(wxStyledTextCtrl_SetCharsDefault, 3365).
+-define(wxStyledTextCtrl_AutoCompGetCurrent, 3366).
+-define(wxStyledTextCtrl_Allocate, 3367).
+-define(wxStyledTextCtrl_FindColumn, 3368).
+-define(wxStyledTextCtrl_GetCaretSticky, 3369).
+-define(wxStyledTextCtrl_SetCaretSticky, 3370).
+-define(wxStyledTextCtrl_ToggleCaretSticky, 3371).
+-define(wxStyledTextCtrl_SetPasteConvertEndings, 3372).
+-define(wxStyledTextCtrl_GetPasteConvertEndings, 3373).
+-define(wxStyledTextCtrl_SelectionDuplicate, 3374).
+-define(wxStyledTextCtrl_SetCaretLineBackAlpha, 3375).
+-define(wxStyledTextCtrl_GetCaretLineBackAlpha, 3376).
+-define(wxStyledTextCtrl_StartRecord, 3377).
+-define(wxStyledTextCtrl_StopRecord, 3378).
+-define(wxStyledTextCtrl_SetLexer, 3379).
+-define(wxStyledTextCtrl_GetLexer, 3380).
+-define(wxStyledTextCtrl_Colourise, 3381).
+-define(wxStyledTextCtrl_SetProperty, 3382).
+-define(wxStyledTextCtrl_SetKeyWords, 3383).
+-define(wxStyledTextCtrl_SetLexerLanguage, 3384).
+-define(wxStyledTextCtrl_GetProperty, 3385).
+-define(wxStyledTextCtrl_GetStyleBitsNeeded, 3386).
+-define(wxStyledTextCtrl_GetCurrentLine, 3387).
+-define(wxStyledTextCtrl_StyleSetSpec, 3388).
+-define(wxStyledTextCtrl_StyleSetFont, 3389).
+-define(wxStyledTextCtrl_StyleSetFontAttr, 3390).
+-define(wxStyledTextCtrl_StyleSetCharacterSet, 3391).
+-define(wxStyledTextCtrl_StyleSetFontEncoding, 3392).
+-define(wxStyledTextCtrl_CmdKeyExecute, 3393).
+-define(wxStyledTextCtrl_SetMargins, 3394).
+-define(wxStyledTextCtrl_GetSelection, 3395).
+-define(wxStyledTextCtrl_PointFromPosition, 3396).
+-define(wxStyledTextCtrl_ScrollToLine, 3397).
+-define(wxStyledTextCtrl_ScrollToColumn, 3398).
+-define(wxStyledTextCtrl_SetVScrollBar, 3399).
+-define(wxStyledTextCtrl_SetHScrollBar, 3400).
+-define(wxStyledTextCtrl_GetLastKeydownProcessed, 3401).
+-define(wxStyledTextCtrl_SetLastKeydownProcessed, 3402).
+-define(wxStyledTextCtrl_SaveFile, 3403).
+-define(wxStyledTextCtrl_LoadFile, 3404).
+-define(wxStyledTextCtrl_DoDragOver, 3405).
+-define(wxStyledTextCtrl_DoDropText, 3406).
+-define(wxStyledTextCtrl_GetUseAntiAliasing, 3407).
+-define(wxStyledTextCtrl_AddTextRaw, 3408).
+-define(wxStyledTextCtrl_InsertTextRaw, 3409).
+-define(wxStyledTextCtrl_GetCurLineRaw, 3410).
+-define(wxStyledTextCtrl_GetLineRaw, 3411).
+-define(wxStyledTextCtrl_GetSelectedTextRaw, 3412).
+-define(wxStyledTextCtrl_GetTextRangeRaw, 3413).
+-define(wxStyledTextCtrl_SetTextRaw, 3414).
+-define(wxStyledTextCtrl_GetTextRaw, 3415).
+-define(wxStyledTextCtrl_AppendTextRaw, 3416).
+-define(wxArtProvider_GetBitmap, 3417).
+-define(wxArtProvider_GetIcon, 3418).
+-define(wxTreeEvent_GetKeyCode, 3419).
+-define(wxTreeEvent_GetItem, 3420).
+-define(wxTreeEvent_GetKeyEvent, 3421).
+-define(wxTreeEvent_GetLabel, 3422).
+-define(wxTreeEvent_GetOldItem, 3423).
+-define(wxTreeEvent_GetPoint, 3424).
+-define(wxTreeEvent_IsEditCancelled, 3425).
+-define(wxTreeEvent_SetToolTip, 3426).
+-define(wxNotebookEvent_GetOldSelection, 3427).
+-define(wxNotebookEvent_GetSelection, 3428).
+-define(wxNotebookEvent_SetOldSelection, 3429).
+-define(wxNotebookEvent_SetSelection, 3430).
+-define(wxFileDataObject_new, 3431).
+-define(wxFileDataObject_AddFile, 3432).
+-define(wxFileDataObject_GetFilenames, 3433).
+-define(wxFileDataObject_destroy, 3434).
+-define(wxTextDataObject_new, 3435).
+-define(wxTextDataObject_GetTextLength, 3436).
+-define(wxTextDataObject_GetText, 3437).
+-define(wxTextDataObject_SetText, 3438).
+-define(wxTextDataObject_destroy, 3439).
+-define(wxBitmapDataObject_new_1_1, 3440).
+-define(wxBitmapDataObject_new_1_0, 3441).
+-define(wxBitmapDataObject_GetBitmap, 3442).
+-define(wxBitmapDataObject_SetBitmap, 3443).
+-define(wxBitmapDataObject_destroy, 3444).
+-define(wxClipboard_new, 3446).
+-define(wxClipboard_destruct, 3447).
+-define(wxClipboard_AddData, 3448).
+-define(wxClipboard_Clear, 3449).
+-define(wxClipboard_Close, 3450).
+-define(wxClipboard_Flush, 3451).
+-define(wxClipboard_GetData, 3452).
+-define(wxClipboard_IsOpened, 3453).
+-define(wxClipboard_Open, 3454).
+-define(wxClipboard_SetData, 3455).
+-define(wxClipboard_UsePrimarySelection, 3457).
+-define(wxClipboard_IsSupported, 3458).
+-define(wxClipboard_Get, 3459).
+-define(wxSpinEvent_GetPosition, 3460).
+-define(wxSpinEvent_SetPosition, 3461).
+-define(wxSplitterWindow_new_0, 3462).
+-define(wxSplitterWindow_new_2, 3463).
+-define(wxSplitterWindow_destruct, 3464).
+-define(wxSplitterWindow_Create, 3465).
+-define(wxSplitterWindow_GetMinimumPaneSize, 3466).
+-define(wxSplitterWindow_GetSashGravity, 3467).
+-define(wxSplitterWindow_GetSashPosition, 3468).
+-define(wxSplitterWindow_GetSplitMode, 3469).
+-define(wxSplitterWindow_GetWindow1, 3470).
+-define(wxSplitterWindow_GetWindow2, 3471).
+-define(wxSplitterWindow_Initialize, 3472).
+-define(wxSplitterWindow_IsSplit, 3473).
+-define(wxSplitterWindow_ReplaceWindow, 3474).
+-define(wxSplitterWindow_SetSashGravity, 3475).
+-define(wxSplitterWindow_SetSashPosition, 3476).
+-define(wxSplitterWindow_SetSashSize, 3477).
+-define(wxSplitterWindow_SetMinimumPaneSize, 3478).
+-define(wxSplitterWindow_SetSplitMode, 3479).
+-define(wxSplitterWindow_SplitHorizontally, 3480).
+-define(wxSplitterWindow_SplitVertically, 3481).
+-define(wxSplitterWindow_Unsplit, 3482).
+-define(wxSplitterWindow_UpdateSize, 3483).
+-define(wxSplitterEvent_GetSashPosition, 3484).
+-define(wxSplitterEvent_GetX, 3485).
+-define(wxSplitterEvent_GetY, 3486).
+-define(wxSplitterEvent_GetWindowBeingRemoved, 3487).
+-define(wxSplitterEvent_SetSashPosition, 3488).
+-define(wxHtmlWindow_new_0, 3489).
+-define(wxHtmlWindow_new_2, 3490).
+-define(wxHtmlWindow_AppendToPage, 3491).
+-define(wxHtmlWindow_GetOpenedAnchor, 3492).
+-define(wxHtmlWindow_GetOpenedPage, 3493).
+-define(wxHtmlWindow_GetOpenedPageTitle, 3494).
+-define(wxHtmlWindow_GetRelatedFrame, 3495).
+-define(wxHtmlWindow_HistoryBack, 3496).
+-define(wxHtmlWindow_HistoryCanBack, 3497).
+-define(wxHtmlWindow_HistoryCanForward, 3498).
+-define(wxHtmlWindow_HistoryClear, 3499).
+-define(wxHtmlWindow_HistoryForward, 3500).
+-define(wxHtmlWindow_LoadFile, 3501).
+-define(wxHtmlWindow_LoadPage, 3502).
+-define(wxHtmlWindow_SelectAll, 3503).
+-define(wxHtmlWindow_SelectionToText, 3504).
+-define(wxHtmlWindow_SelectLine, 3505).
+-define(wxHtmlWindow_SelectWord, 3506).
+-define(wxHtmlWindow_SetBorders, 3507).
+-define(wxHtmlWindow_SetFonts, 3508).
+-define(wxHtmlWindow_SetPage, 3509).
+-define(wxHtmlWindow_SetRelatedFrame, 3510).
+-define(wxHtmlWindow_SetRelatedStatusBar, 3511).
+-define(wxHtmlWindow_ToText, 3512).
+-define(wxHtmlWindow_destroy, 3513).
+-define(wxHtmlLinkEvent_GetLinkInfo, 3514).
+-define(wxSystemSettings_GetColour, 3515).
+-define(wxSystemSettings_GetFont, 3516).
+-define(wxSystemSettings_GetMetric, 3517).
+-define(wxSystemSettings_GetScreenType, 3518).
+-define(wxSystemOptions_GetOption, 3519).
+-define(wxSystemOptions_GetOptionInt, 3520).
+-define(wxSystemOptions_HasOption, 3521).
+-define(wxSystemOptions_IsFalse, 3522).
+-define(wxSystemOptions_SetOption_2_1, 3523).
+-define(wxSystemOptions_SetOption_2_0, 3524).
+-define(wxAuiNotebookEvent_SetSelection, 3525).
+-define(wxAuiNotebookEvent_GetSelection, 3526).
+-define(wxAuiNotebookEvent_SetOldSelection, 3527).
+-define(wxAuiNotebookEvent_GetOldSelection, 3528).
+-define(wxAuiNotebookEvent_SetDragSource, 3529).
+-define(wxAuiNotebookEvent_GetDragSource, 3530).
+-define(wxAuiManagerEvent_SetManager, 3531).
+-define(wxAuiManagerEvent_GetManager, 3532).
+-define(wxAuiManagerEvent_SetPane, 3533).
+-define(wxAuiManagerEvent_GetPane, 3534).
+-define(wxAuiManagerEvent_SetButton, 3535).
+-define(wxAuiManagerEvent_GetButton, 3536).
+-define(wxAuiManagerEvent_SetDC, 3537).
+-define(wxAuiManagerEvent_GetDC, 3538).
+-define(wxAuiManagerEvent_Veto, 3539).
+-define(wxAuiManagerEvent_GetVeto, 3540).
+-define(wxAuiManagerEvent_SetCanVeto, 3541).
+-define(wxAuiManagerEvent_CanVeto, 3542).
+-define(wxLogNull_new, 3543).
+-define(wxLogNull_destroy, 3544).
+-define(wxTaskBarIcon_new, 3545).
+-define(wxTaskBarIcon_destruct, 3546).
+-define(wxTaskBarIcon_PopupMenu, 3547).
+-define(wxTaskBarIcon_RemoveIcon, 3548).
+-define(wxTaskBarIcon_SetIcon, 3549).
+-define(wxLocale_new_0, 3550).
+-define(wxLocale_new_2, 3552).
+-define(wxLocale_destruct, 3553).
+-define(wxLocale_Init, 3555).
+-define(wxLocale_AddCatalog_1, 3556).
+-define(wxLocale_AddCatalog_3, 3557).
+-define(wxLocale_AddCatalogLookupPathPrefix, 3558).
+-define(wxLocale_GetCanonicalName, 3559).
+-define(wxLocale_GetLanguage, 3560).
+-define(wxLocale_GetLanguageName, 3561).
+-define(wxLocale_GetLocale, 3562).
+-define(wxLocale_GetName, 3563).
+-define(wxLocale_GetString_2, 3564).
+-define(wxLocale_GetString_4, 3565).
+-define(wxLocale_GetHeaderValue, 3566).
+-define(wxLocale_GetSysName, 3567).
+-define(wxLocale_GetSystemEncoding, 3568).
+-define(wxLocale_GetSystemEncodingName, 3569).
+-define(wxLocale_GetSystemLanguage, 3570).
+-define(wxLocale_IsLoaded, 3571).
+-define(wxLocale_IsOk, 3572).
+-define(wxActivateEvent_GetActive, 3573).
+-define(wxPopupWindow_new_2, 3575).
+-define(wxPopupWindow_new_0, 3576).
+-define(wxPopupWindow_destruct, 3578).
+-define(wxPopupWindow_Create, 3579).
+-define(wxPopupWindow_Position, 3580).
+-define(wxPopupTransientWindow_new_0, 3581).
+-define(wxPopupTransientWindow_new_2, 3582).
+-define(wxPopupTransientWindow_destruct, 3583).
+-define(wxPopupTransientWindow_Popup, 3584).
+-define(wxPopupTransientWindow_Dismiss, 3585).
diff --git a/lib/wx/vsn.mk b/lib/wx/vsn.mk
index 09fb9f384c..7608bb3014 100644
--- a/lib/wx/vsn.mk
+++ b/lib/wx/vsn.mk
@@ -1 +1 @@
-WX_VSN = 1.4
+WX_VSN = 1.5
diff --git a/lib/xmerl/src/xmerl_xsd.erl b/lib/xmerl/src/xmerl_xsd.erl
index 847161e844..3038a54ee6 100644
--- a/lib/xmerl/src/xmerl_xsd.erl
+++ b/lib/xmerl/src/xmerl_xsd.erl
@@ -4888,7 +4888,6 @@ mk_EII_Att_QName(AttName,XMLEl,S) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
create_tables(S=#xsd_state{table=undefined}) ->
Tid=ets:new(xmerl_schema_tab,[]),
- initial_tab_data(Tid),
S#xsd_state{table=Tid};
create_tables(S) ->
S.
@@ -5617,131 +5616,5 @@ format_error(Err) ->
%% {shema_el_pathname(SchemaE,Env),
%% xml_el_pathname(E)}.
-initial_tab_data(Tab) ->
- ets:insert(Tab,
- binary_to_term(
- <<131,108,0,0,0,9,104,2,104,2,100,0,9,97,116,116,114,105,98,117,116,
- 101,104,3,100,0,5,115,112,97,99,101,106,100,0,36,104,116,116,112,58,
- 47,47,119,119,119,46,119,51,46,111,114,103,47,88,77,76,47,49,57,57,
- 56,47,110,97,109,101,115,112,97,99,101,104,9,100,0,16,115,99,104,101,
- 109,97,95,97,116,116,114,105,98,117,116,101,104,3,100,0,5,115,112,97,
- 99,101,106,100,0,36,104,116,116,112,58,47,47,119,119,119,46,119,51,
- 46,111,114,103,47,88,77,76,47,49,57,57,56,47,110,97,109,101,115,112,
- 97,99,101,108,0,0,0,1,104,2,100,0,10,115,105,109,112,108,101,84,121,
- 112,101,104,3,100,0,15,95,120,109,101,114,108,95,110,111,95,110,97,
- 109,101,95,108,0,0,0,1,100,0,5,115,112,97,99,101,106,106,106,100,0,5,
- 102,97,108,115,101,106,100,0,8,111,112,116,105,111,110,97,108,100,0,9,
- 117,110,100,101,102,105,110,101,100,100,0,9,117,110,100,101,102,105,
- 110,101,100,100,0,9,117,110,100,101,102,105,110,101,100,104,2,104,2,
- 100,0,6,115,99,104,101,109,97,107,0,7,120,109,108,46,120,115,100,104,
- 7,100,0,6,115,99,104,101,109,97,100,0,11,117,110,113,117,97,108,105,
- 102,105,101,100,100,0,11,117,110,113,117,97,108,105,102,105,101,100,
- 100,0,36,104,116,116,112,58,47,47,119,119,119,46,119,51,46,111,114,
- 103,47,88,77,76,47,49,57,57,56,47,110,97,109,101,115,112,97,99,101,
- 106,106,106,104,2,104,2,100,0,9,97,116,116,114,105,98,117,116,101,
- 104,3,100,0,4,98,97,115,101,106,100,0,36,104,116,116,112,58,47,47,
- 119,119,119,46,119,51,46,111,114,103,47,88,77,76,47,49,57,57,56,47,
- 110,97,109,101,115,112,97,99,101,104,9,100,0,16,115,99,104,101,109,
- 97,95,97,116,116,114,105,98,117,116,101,104,3,100,0,4,98,97,115,101,
- 106,100,0,36,104,116,116,112,58,47,47,119,119,119,46,119,51,46,111,
- 114,103,47,88,77,76,47,49,57,57,56,47,110,97,109,101,115,112,97,99,
- 101,108,0,0,0,1,104,2,100,0,10,115,105,109,112,108,101,84,121,112,101,
- 104,3,100,0,6,97,110,121,85,82,73,106,100,0,32,104,116,116,112,58,47,
- 47,119,119,119,46,119,51,46,111,114,103,47,50,48,48,49,47,88,77,76,83,
- 99,104,101,109,97,106,100,0,5,102,97,108,115,101,106,100,0,8,111,112,
- 116,105,111,110,97,108,100,0,9,117,110,100,101,102,105,110,101,100,
- 100,0,9,117,110,100,101,102,105,110,101,100,100,0,9,117,110,100,101,
- 102,105,110,101,100,104,2,104,2,100,0,14,97,116,116,114,105,98,117,
- 116,101,71,114,111,117,112,104,3,100,0,12,115,112,101,99,105,97,108,
- 65,116,116,114,115,106,100,0,36,104,116,116,112,58,47,47,119,119,119,
- 46,119,51,46,111,114,103,47,88,77,76,47,49,57,57,56,47,110,97,109,101,
- 115,112,97,99,101,104,5,100,0,22,115,99,104,101,109,97,95,97,116,116,
- 114,105,98,117,116,101,95,103,114,111,117,112,104,3,100,0,12,115,112,
- 101,99,105,97,108,65,116,116,114,115,106,100,0,36,104,116,116,112,58,
- 47,47,119,119,119,46,119,51,46,111,114,103,47,88,77,76,47,49,57,57,
- 56,47,110,97,109,101,115,112,97,99,101,100,0,9,117,110,100,101,102,
- 105,110,101,100,100,0,9,117,110,100,101,102,105,110,101,100,108,0,0,
- 0,3,104,2,100,0,9,97,116,116,114,105,98,117,116,101,104,3,100,0,4,98,
- 97,115,101,106,106,104,2,100,0,9,97,116,116,114,105,98,117,116,101,
- 104,3,100,0,4,108,97,110,103,106,106,104,2,100,0,9,97,116,116,114,
- 105,98,117,116,101,104,3,100,0,5,115,112,97,99,101,106,106,106,104,
- 2,104,2,100,0,10,115,105,109,112,108,101,84,121,112,101,104,3,100,0,
- 15,95,120,109,101,114,108,95,110,111,95,110,97,109,101,95,108,0,0,0,
- 1,100,0,5,115,112,97,99,101,106,106,104,9,100,0,18,115,99,104,101,
- 109,97,95,115,105,109,112,108,101,95,116,121,112,101,104,3,100,0,15,
- 95,120,109,101,114,108,95,110,111,95,110,97,109,101,95,108,0,0,0,1,
- 100,0,5,115,112,97,99,101,106,106,108,0,0,0,1,100,0,5,115,112,97,99,
- 101,106,104,3,100,0,6,78,67,78,97,109,101,106,100,0,32,104,116,116,
- 112,58,47,47,119,119,119,46,119,51,46,111,114,103,47,50,48,48,49,47,
- 88,77,76,83,99,104,101,109,97,100,0,5,102,97,108,115,101,106,108,0,0,
- 0,1,104,2,100,0,11,101,110,117,109,101,114,97,116,105,111,110,108,0,0,
- 0,2,107,0,7,100,101,102,97,117,108,116,107,0,8,112,114,101,115,101,
- 114,118,101,106,106,100,0,6,97,116,111,109,105,99,108,0,0,0,1,104,2,
- 100,0,11,114,101,115,116,114,105,99,116,105,111,110,104,2,104,3,100,
- 0,6,78,67,78,97,109,101,106,100,0,32,104,116,116,112,58,47,47,119,
- 119,119,46,119,51,46,111,114,103,47,50,48,48,49,47,88,77,76,83,99,
- 104,101,109,97,108,0,0,0,2,104,2,100,0,11,101,110,117,109,101,114,
- 97,116,105,111,110,107,0,7,100,101,102,97,117,108,116,104,2,100,0,
- 11,101,110,117,109,101,114,97,116,105,111,110,107,0,8,112,114,101,
- 115,101,114,118,101,106,106,104,2,104,2,100,0,10,115,105,109,112,
- 108,101,84,121,112,101,104,3,100,0,15,95,120,109,101,114,108,95,110,
- 111,95,110,97,109,101,95,108,0,0,0,1,100,0,4,108,97,110,103,106,106,
- 104,9,100,0,18,115,99,104,101,109,97,95,115,105,109,112,108,101,95,
- 116,121,112,101,104,3,100,0,15,95,120,109,101,114,108,95,110,111,95,
- 110,97,109,101,95,108,0,0,0,1,100,0,4,108,97,110,103,106,106,108,0,0,
- 0,1,100,0,4,108,97,110,103,106,100,0,9,117,110,100,101,102,105,110,
- 101,100,100,0,5,102,97,108,115,101,106,106,100,0,6,97,116,111,109,
- 105,99,108,0,0,0,1,104,2,100,0,5,117,110,105,111,110,108,0,0,0,2,104,
- 2,100,0,10,115,105,109,112,108,101,84,121,112,101,104,3,100,0,8,108,
- 97,110,103,117,97,103,101,106,100,0,32,104,116,116,112,58,47,47,119,
- 119,119,46,119,51,46,111,114,103,47,50,48,48,49,47,88,77,76,83,99,104,
- 101,109,97,104,2,100,0,10,115,105,109,112,108,101,84,121,112,101,104,
- 3,100,0,15,95,120,109,101,114,108,95,110,111,95,110,97,109,101,95,108,
- 0,0,0,2,100,0,15,95,120,109,101,114,108,95,110,111,95,110,97,109,101,
- 95,100,0,4,108,97,110,103,106,106,106,106,104,2,104,2,100,0,9,97,116,
- 116,114,105,98,117,116,101,104,3,100,0,2,105,100,106,100,0,36,104,116,
- 116,112,58,47,47,119,119,119,46,119,51,46,111,114,103,47,88,77,76,47,
- 49,57,57,56,47,110,97,109,101,115,112,97,99,101,104,9,100,0,16,115,99,
- 104,101,109,97,95,97,116,116,114,105,98,117,116,101,104,3,100,0,2,105,
- 100,106,100,0,36,104,116,116,112,58,47,47,119,119,119,46,119,51,46,
- 111,114,103,47,88,77,76,47,49,57,57,56,47,110,97,109,101,115,112,97,
- 99,101,108,0,0,0,1,104,2,100,0,10,115,105,109,112,108,101,84,121,112,
- 101,104,3,100,0,2,73,68,106,100,0,32,104,116,116,112,58,47,47,119,119,
- 119,46,119,51,46,111,114,103,47,50,48,48,49,47,88,77,76,83,99,104,101,
- 109,97,106,100,0,5,102,97,108,115,101,106,100,0,8,111,112,116,105,111,
- 110,97,108,100,0,9,117,110,100,101,102,105,110,101,100,100,0,9,117,
- 110,100,101,102,105,110,101,100,100,0,9,117,110,100,101,102,105,110,
- 101,100,104,2,104,2,100,0,9,97,116,116,114,105,98,117,116,101,104,3,
- 100,0,4,108,97,110,103,106,100,0,36,104,116,116,112,58,47,47,119,119,
- 119,46,119,51,46,111,114,103,47,88,77,76,47,49,57,57,56,47,110,97,109,
- 101,115,112,97,99,101,104,9,100,0,16,115,99,104,101,109,97,95,97,116,
- 116,114,105,98,117,116,101,104,3,100,0,4,108,97,110,103,106,100,0,36,
- 104,116,116,112,58,47,47,119,119,119,46,119,51,46,111,114,103,47,88,
- 77,76,47,49,57,57,56,47,110,97,109,101,115,112,97,99,101,108,0,0,0,1,
- 104,2,100,0,10,115,105,109,112,108,101,84,121,112,101,104,3,100,0,15,
- 95,120,109,101,114,108,95,110,111,95,110,97,109,101,95,108,0,0,0,1,
- 100,0,4,108,97,110,103,106,106,106,100,0,5,102,97,108,115,101,106,
- 100,0,8,111,112,116,105,111,110,97,108,100,0,9,117,110,100,101,102,
- 105,110,101,100,100,0,9,117,110,100,101,102,105,110,101,100,100,0,9,
- 117,110,100,101,102,105,110,101,100,104,2,104,2,100,0,10,115,105,109,
- 112,108,101,84,121,112,101,104,3,100,0,15,95,120,109,101,114,108,95,
- 110,111,95,110,97,109,101,95,108,0,0,0,2,100,0,15,95,120,109,101,114,
- 108,95,110,111,95,110,97,109,101,95,100,0,4,108,97,110,103,106,106,
- 104,9,100,0,18,115,99,104,101,109,97,95,115,105,109,112,108,101,95,
- 116,121,112,101,104,3,100,0,15,95,120,109,101,114,108,95,110,111,95,
- 110,97,109,101,95,108,0,0,0,2,100,0,15,95,120,109,101,114,108,95,110,
- 111,95,110,97,109,101,95,100,0,4,108,97,110,103,106,106,108,0,0,0,2,
- 100,0,15,95,120,109,101,114,108,95,110,111,95,110,97,109,101,95,100,
- 0,4,108,97,110,103,106,104,3,100,0,6,115,116,114,105,110,103,106,100,
- 0,32,104,116,116,112,58,47,47,119,119,119,46,119,51,46,111,114,103,47,
- 50,48,48,49,47,88,77,76,83,99,104,101,109,97,100,0,5,102,97,108,115,
- 101,106,108,0,0,0,1,104,2,100,0,11,101,110,117,109,101,114,97,116,105,
- 111,110,108,0,0,0,1,106,106,106,100,0,6,97,116,111,109,105,99,108,0,0,
- 0,1,104,2,100,0,11,114,101,115,116,114,105,99,116,105,111,110,104,2,
- 104,3,100,0,6,115,116,114,105,110,103,106,100,0,32,104,116,116,112,58,
- 47,47,119,119,119,46,119,51,46,111,114,103,47,50,48,48,49,47,88,77,76,
- 83,99,104,101,109,97,108,0,0,0,1,104,2,100,0,11,101,110,117,109,101,
- 114,97,116,105,111,110,106,106,106,106>>)).
-
default_namespace_by_convention() ->
[{xml,'http://www.w3.org/XML/1998/namespace'}].
diff --git a/lib/xmerl/test/xmerl_xsd_SUITE.erl b/lib/xmerl/test/xmerl_xsd_SUITE.erl
index 101fbcd50f..92c8287782 100644
--- a/lib/xmerl/test/xmerl_xsd_SUITE.erl
+++ b/lib/xmerl/test/xmerl_xsd_SUITE.erl
@@ -41,7 +41,8 @@ groups() ->
[{group, primitive_datatypes},
{group, derived_datatypes}]},
{validation_tests, [],
- [{group, xmlSchemaPrimerExamples},
+ [{group, xmlXsdAndExample},
+ {group, xmlSchemaPrimerExamples},
{group, miscXMLexamples}]},
{primitive_datatypes, [],
[string, boolean, decimal, float, double, duration,
@@ -55,6 +56,8 @@ groups() ->
negativeInteger, long, int, short, byte,
nonNegativeInteger, unsignedLong, unsignedInt,
unsignedShort, unsignedByte, positiveInteger]},
+ {xmlXsdAndExample, [],
+ [xml_xsd, xml_lang_attr]},
{xmlSchemaPrimerExamples, [],
[po, po1, po2, ipo, ipo_redefine, '4Q99']},
{miscXMLexamples, [],
@@ -863,6 +866,19 @@ compare_duration(_Config) ->
?line indefinite = xmerl_xsd_type:compare_durations("P5M","P153D"),
?line lt = xmerl_xsd_type:compare_durations("P5M","P154D").
+xml_xsd(suite) -> [];
+xml_xsd(Config) ->
+ DataDir = ?config(data_dir, Config),
+ Options = [{fetch_path, [DataDir]}],
+ {ok, _} = xmerl_xsd:process_schema("xml.xsd", Options).
+
+xml_lang_attr(suite) -> [];
+xml_lang_attr(Config) ->
+ DataDir = ?config(data_dir, Config),
+ {Element, _} = xmerl_scan:file(filename:join([DataDir, "book.xml"])),
+ Options = [{fetch_path, [DataDir]}],
+ {ok, Schema} = xmerl_xsd:process_schema("book.xsd", Options),
+ {Element, _} = xmerl_xsd:validate(Element, Schema).
po(suite) -> [];
po(Config) ->
diff --git a/lib/xmerl/test/xmerl_xsd_SUITE_data/book.xml b/lib/xmerl/test/xmerl_xsd_SUITE_data/book.xml
new file mode 100644
index 0000000000..17d7ceffee
--- /dev/null
+++ b/lib/xmerl/test/xmerl_xsd_SUITE_data/book.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<book title="Title" xml:lang="EN">
+ <author>Author1</author>
+ <author>Author2</author>
+</book>
diff --git a/lib/xmerl/test/xmerl_xsd_SUITE_data/book.xsd b/lib/xmerl/test/xmerl_xsd_SUITE_data/book.xsd
new file mode 100644
index 0000000000..830951ec1b
--- /dev/null
+++ b/lib/xmerl/test/xmerl_xsd_SUITE_data/book.xsd
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+ <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd"/>
+ <xs:element name="book">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="author" type="xs:string" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="title" type="xs:string"/>
+ <xs:attribute ref="xml:lang"/>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
diff --git a/lib/xmerl/test/xmerl_xsd_SUITE_data/xml.xsd b/lib/xmerl/test/xmerl_xsd_SUITE_data/xml.xsd
new file mode 100644
index 0000000000..aea7d0db0a
--- /dev/null
+++ b/lib/xmerl/test/xmerl_xsd_SUITE_data/xml.xsd
@@ -0,0 +1,287 @@
+<?xml version='1.0'?>
+<?xml-stylesheet href="../2008/09/xsd.xsl" type="text/xsl"?>
+<xs:schema targetNamespace="http://www.w3.org/XML/1998/namespace"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns ="http://www.w3.org/1999/xhtml"
+ xml:lang="en">
+
+ <xs:annotation>
+ <xs:documentation>
+ <div>
+ <h1>About the XML namespace</h1>
+
+ <div class="bodytext">
+ <p>
+ This schema document describes the XML namespace, in a form
+ suitable for import by other schema documents.
+ </p>
+ <p>
+ See <a href="http://www.w3.org/XML/1998/namespace.html">
+ http://www.w3.org/XML/1998/namespace.html</a> and
+ <a href="http://www.w3.org/TR/REC-xml">
+ http://www.w3.org/TR/REC-xml</a> for information
+ about this namespace.
+ </p>
+ <p>
+ Note that local names in this namespace are intended to be
+ defined only by the World Wide Web Consortium or its subgroups.
+ The names currently defined in this namespace are listed below.
+ They should not be used with conflicting semantics by any Working
+ Group, specification, or document instance.
+ </p>
+ <p>
+ See further below in this document for more information about <a
+ href="#usage">how to refer to this schema document from your own
+ XSD schema documents</a> and about <a href="#nsversioning">the
+ namespace-versioning policy governing this schema document</a>.
+ </p>
+ </div>
+ </div>
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:attribute name="lang">
+ <xs:annotation>
+ <xs:documentation>
+ <div>
+
+ <h3>lang (as an attribute name)</h3>
+ <p>
+ denotes an attribute whose value
+ is a language code for the natural language of the content of
+ any element; its value is inherited. This name is reserved
+ by virtue of its definition in the XML specification.</p>
+
+ </div>
+ <div>
+ <h4>Notes</h4>
+ <p>
+ Attempting to install the relevant ISO 2- and 3-letter
+ codes as the enumerated possible values is probably never
+ going to be a realistic possibility.
+ </p>
+ <p>
+ See BCP 47 at <a href="http://www.rfc-editor.org/rfc/bcp/bcp47.txt">
+ http://www.rfc-editor.org/rfc/bcp/bcp47.txt</a>
+ and the IANA language subtag registry at
+ <a href="http://www.iana.org/assignments/language-subtag-registry">
+ http://www.iana.org/assignments/language-subtag-registry</a>
+ for further information.
+ </p>
+ <p>
+ The union allows for the 'un-declaration' of xml:lang with
+ the empty string.
+ </p>
+ </div>
+ </xs:documentation>
+ </xs:annotation>
+ <xs:simpleType>
+ <xs:union memberTypes="xs:language">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value=""/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+ </xs:attribute>
+
+ <xs:attribute name="space">
+ <xs:annotation>
+ <xs:documentation>
+ <div>
+
+ <h3>space (as an attribute name)</h3>
+ <p>
+ denotes an attribute whose
+ value is a keyword indicating what whitespace processing
+ discipline is intended for the content of the element; its
+ value is inherited. This name is reserved by virtue of its
+ definition in the XML specification.</p>
+
+ </div>
+ </xs:documentation>
+ </xs:annotation>
+ <xs:simpleType>
+ <xs:restriction base="xs:NCName">
+ <xs:enumeration value="default"/>
+ <xs:enumeration value="preserve"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+
+ <xs:attribute name="base" type="xs:anyURI"> <xs:annotation>
+ <xs:documentation>
+ <div>
+
+ <h3>base (as an attribute name)</h3>
+ <p>
+ denotes an attribute whose value
+ provides a URI to be used as the base for interpreting any
+ relative URIs in the scope of the element on which it
+ appears; its value is inherited. This name is reserved
+ by virtue of its definition in the XML Base specification.</p>
+
+ <p>
+ See <a
+ href="http://www.w3.org/TR/xmlbase/">http://www.w3.org/TR/xmlbase/</a>
+ for information about this attribute.
+ </p>
+ </div>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+
+ <xs:attribute name="id" type="xs:ID">
+ <xs:annotation>
+ <xs:documentation>
+ <div>
+
+ <h3>id (as an attribute name)</h3>
+ <p>
+ denotes an attribute whose value
+ should be interpreted as if declared to be of type ID.
+ This name is reserved by virtue of its definition in the
+ xml:id specification.</p>
+
+ <p>
+ See <a
+ href="http://www.w3.org/TR/xml-id/">http://www.w3.org/TR/xml-id/</a>
+ for information about this attribute.
+ </p>
+ </div>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+
+ <xs:attributeGroup name="specialAttrs">
+ <xs:attribute ref="xml:base"/>
+ <xs:attribute ref="xml:lang"/>
+ <xs:attribute ref="xml:space"/>
+ <xs:attribute ref="xml:id"/>
+ </xs:attributeGroup>
+
+ <xs:annotation>
+ <xs:documentation>
+ <div>
+
+ <h3>Father (in any context at all)</h3>
+
+ <div class="bodytext">
+ <p>
+ denotes Jon Bosak, the chair of
+ the original XML Working Group. This name is reserved by
+ the following decision of the W3C XML Plenary and
+ XML Coordination groups:
+ </p>
+ <blockquote>
+ <p>
+ In appreciation for his vision, leadership and
+ dedication the W3C XML Plenary on this 10th day of
+ February, 2000, reserves for Jon Bosak in perpetuity
+ the XML name "xml:Father".
+ </p>
+ </blockquote>
+ </div>
+ </div>
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:annotation>
+ <xs:documentation>
+ <div xml:id="usage" id="usage">
+ <h2><a name="usage">About this schema document</a></h2>
+
+ <div class="bodytext">
+ <p>
+ This schema defines attributes and an attribute group suitable
+ for use by schemas wishing to allow <code>xml:base</code>,
+ <code>xml:lang</code>, <code>xml:space</code> or
+ <code>xml:id</code> attributes on elements they define.
+ </p>
+ <p>
+ To enable this, such a schema must import this schema for
+ the XML namespace, e.g. as follows:
+ </p>
+ <pre>
+ &lt;schema . . .>
+ . . .
+ &lt;import namespace="http://www.w3.org/XML/1998/namespace"
+ schemaLocation="http://www.w3.org/2001/xml.xsd"/>
+ </pre>
+ <p>
+ or
+ </p>
+ <pre>
+ &lt;import namespace="http://www.w3.org/XML/1998/namespace"
+ schemaLocation="http://www.w3.org/2009/01/xml.xsd"/>
+ </pre>
+ <p>
+ Subsequently, qualified reference to any of the attributes or the
+ group defined below will have the desired effect, e.g.
+ </p>
+ <pre>
+ &lt;type . . .>
+ . . .
+ &lt;attributeGroup ref="xml:specialAttrs"/>
+ </pre>
+ <p>
+ will define a type which will schema-validate an instance element
+ with any of those attributes.
+ </p>
+ </div>
+ </div>
+ </xs:documentation>
+ </xs:annotation>
+
+ <xs:annotation>
+ <xs:documentation>
+ <div id="nsversioning" xml:id="nsversioning">
+ <h2><a name="nsversioning">Versioning policy for this schema document</a></h2>
+ <div class="bodytext">
+ <p>
+ In keeping with the XML Schema WG's standard versioning
+ policy, this schema document will persist at
+ <a href="http://www.w3.org/2009/01/xml.xsd">
+ http://www.w3.org/2009/01/xml.xsd</a>.
+ </p>
+ <p>
+ At the date of issue it can also be found at
+ <a href="http://www.w3.org/2001/xml.xsd">
+ http://www.w3.org/2001/xml.xsd</a>.
+ </p>
+ <p>
+ The schema document at that URI may however change in the future,
+ in order to remain compatible with the latest version of XML
+ Schema itself, or with the XML namespace itself. In other words,
+ if the XML Schema or XML namespaces change, the version of this
+ document at <a href="http://www.w3.org/2001/xml.xsd">
+ http://www.w3.org/2001/xml.xsd
+ </a>
+ will change accordingly; the version at
+ <a href="http://www.w3.org/2009/01/xml.xsd">
+ http://www.w3.org/2009/01/xml.xsd
+ </a>
+ will not change.
+ </p>
+ <p>
+ Previous dated (and unchanging) versions of this schema
+ document are at:
+ </p>
+ <ul>
+ <li><a href="http://www.w3.org/2009/01/xml.xsd">
+ http://www.w3.org/2009/01/xml.xsd</a></li>
+ <li><a href="http://www.w3.org/2007/08/xml.xsd">
+ http://www.w3.org/2007/08/xml.xsd</a></li>
+ <li><a href="http://www.w3.org/2004/10/xml.xsd">
+ http://www.w3.org/2004/10/xml.xsd</a></li>
+ <li><a href="http://www.w3.org/2001/03/xml.xsd">
+ http://www.w3.org/2001/03/xml.xsd</a></li>
+ </ul>
+ </div>
+ </div>
+ </xs:documentation>
+ </xs:annotation>
+
+</xs:schema>
+
diff --git a/make/ose_lm.mk.in b/make/ose_lm.mk.in
deleted file mode 100644
index de8d351af3..0000000000
--- a/make/ose_lm.mk.in
+++ /dev/null
@@ -1,76 +0,0 @@
-#-*-makefile-*- ; force emacs to enter makefile-mode
-# ----------------------------------------------------
-# Template target for generating an OSE5 load module
-#
-# %CopyrightBegin%
-#
-# Copyright Ericsson AB 2013. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# %CopyrightEnd%
-#
-# Author: Petre Pircalabu
-# ----------------------------------------------------
-
-# ----------------------------------------------------
-# build-ose-load-module
-# Creates an OSE5 load module
-# params:
-# $(1) - The output target
-# $(2) - Objects
-# $(3) - Libraries
-# $(4) - LM configuration file
-# ----------------------------------------------------
-
-ifeq ($(findstring ose,$(TARGET)),ose)
-LDR1FLAGS = @erl_xcomp_ose_ldflags_pass1@
-LDR2FLAGS = @erl_xcomp_ose_ldflags_pass2@
-OSEROOT = @erl_xcomp_ose_OSEROOT@
-LCF = @erl_xcomp_ose_LM_LCF@
-BEAM_LMCONF = @erl_xcomp_ose_BEAM_LM_CONF@
-EPMD_LMCONF = @erl_xcomp_ose_EPMD_LM_CONF@
-RUN_ERL_LMCONF = @erl_xcomp_ose_RUN_ERL_LM_CONF@
-STRIP = @erl_xcomp_ose_STRIP@
-LM_POST_LINK = @erl_xcomp_ose_LM_POST_LINK@
-LM_SET_CONF = @erl_xcomp_ose_LM_SET_CONF@
-LM_ELF_SIZE = @erl_xcomp_ose_LM_ELF_SIZE@
-OSE_CONFD = @erl_xcomp_ose_CONFD@
-CRT0_LM = @erl_xcomp_ose_CRT0_LM@
-endif
-
-define build-ose-load-module
- @echo " --- Linking $(1)"
-
- @echo " --- Linking $(1) (pass 1)"
- $(ld_verbose)$(PURIFY) $(LD) -o $(1)_unconfigured_ro -r \
- $(2) --start-group $(3) --end-group --cref --discard-none -M > $(1)_1.map
-
- @echo " --- Linking $(1) (pass 2)"
- $(ld_verbose)$(PURIFY) $(LD) -o $(1)_unconfigured \
- $(1)_unconfigured_ro -T $(LCF) -n --emit-relocs -e crt0_lm --cref \
- --discard-none -M > $(1)_2.map
-
- @echo " --- Inserting configuration"
- $(ld_verbose) $(LM_SET_CONF) $(1)_unconfigured < $(4)
-
- @echo " --- Striping $(1)"
-# $(ld_verbose) $(STRIP) $(1)_unconfigured
-
- @echo " --- Postlinking $(1)"
- $(ld_verbose) $(LM_POST_LINK) $(1)_unconfigured
-
- @echo " --- Sizing $(1)"
- $(ld_verbose) $(LM_ELF_SIZE) $(1)_unconfigured
- mv $(1)_unconfigured $(1)
-endef
diff --git a/make/otp.mk.in b/make/otp.mk.in
index 723f83cb45..c05c499d66 100644
--- a/make/otp.mk.in
+++ b/make/otp.mk.in
@@ -90,14 +90,10 @@ OTP_RELEASE = @OTP_RELEASE@
# Erlang language section
# ----------------------------------------------------
EMULATOR = beam
-ifeq ($(findstring ose_ppc750,$(TARGET)),ose_ppc750)
-ERL_COMPILE_FLAGS += +compressed
+ifdef BOOTSTRAP
+ ERL_COMPILE_FLAGS += +slim
else
- ifdef BOOTSTRAP
- ERL_COMPILE_FLAGS += +slim
- else
- ERL_COMPILE_FLAGS += +debug_info
- endif
+ ERL_COMPILE_FLAGS += +debug_info
endif
ERLC_WFLAGS = -W
ERLC = erlc $(ERLC_WFLAGS) $(ERLC_FLAGS)
diff --git a/otp_build b/otp_build
index e6eb048a14..ac99ced42a 100755
--- a/otp_build
+++ b/otp_build
@@ -1443,13 +1443,13 @@ case "$1" in
do_debuginfo_win32 "$2";;
env_win32)
if [ x"$2" = x"x64" -o x"$2" = x"amd64" ]; then
- if [ -x /usr/bin/msysinfo ]; then
+ if [ -x /usr/bin/msys-?.0.dll ]; then
echo_env_msys64
else
echo_env_win64
fi
else
- if [ -x /usr/bin/msysinfo ]; then
+ if [ -x /usr/bin/msys-?.0.dll ]; then
echo_env_msys32
else
echo_env_win32
diff --git a/otp_versions.table b/otp_versions.table
index 52035d7b9d..f68c7a60e7 100644
--- a/otp_versions.table
+++ b/otp_versions.table
@@ -1,7 +1,12 @@
+OTP-18.1.3 : ssh-4.1.2 # asn1-4.0 common_test-1.11 compiler-6.0.1 cosEvent-2.2 cosEventDomain-1.2 cosFileTransfer-1.2 cosNotification-1.2 cosProperty-1.2 cosTime-1.2 cosTransactions-1.3 crypto-3.6.1 debugger-4.1.1 dialyzer-2.8.1 diameter-1.11 edoc-0.7.17 eldap-1.2 erl_docgen-0.4 erl_interface-3.8 erts-7.1 et-1.5.1 eunit-2.2.11 gs-1.6 hipe-3.13 ic-4.4 inets-6.0.2 jinterface-1.6 kernel-4.1 megaco-3.18 mnesia-4.13.2 observer-2.1 odbc-2.11.1 orber-3.8 os_mon-2.4 ose-1.1 otp_mibs-1.1 parsetools-2.1 percept-0.8.11 public_key-1.0.1 reltool-0.7 runtime_tools-1.9.1 sasl-2.6 snmp-5.2 ssl-7.1 stdlib-2.6 syntax_tools-1.7 test_server-3.9 tools-2.8.1 typer-0.9.9 webtool-0.9 wx-1.5 xmerl-1.3.8 :
+OTP-18.1.2 : ssh-4.1.1 # asn1-4.0 common_test-1.11 compiler-6.0.1 cosEvent-2.2 cosEventDomain-1.2 cosFileTransfer-1.2 cosNotification-1.2 cosProperty-1.2 cosTime-1.2 cosTransactions-1.3 crypto-3.6.1 debugger-4.1.1 dialyzer-2.8.1 diameter-1.11 edoc-0.7.17 eldap-1.2 erl_docgen-0.4 erl_interface-3.8 erts-7.1 et-1.5.1 eunit-2.2.11 gs-1.6 hipe-3.13 ic-4.4 inets-6.0.2 jinterface-1.6 kernel-4.1 megaco-3.18 mnesia-4.13.2 observer-2.1 odbc-2.11.1 orber-3.8 os_mon-2.4 ose-1.1 otp_mibs-1.1 parsetools-2.1 percept-0.8.11 public_key-1.0.1 reltool-0.7 runtime_tools-1.9.1 sasl-2.6 snmp-5.2 ssl-7.1 stdlib-2.6 syntax_tools-1.7 test_server-3.9 tools-2.8.1 typer-0.9.9 webtool-0.9 wx-1.5 xmerl-1.3.8 :
+OTP-18.1.1 : inets-6.0.2 mnesia-4.13.2 # asn1-4.0 common_test-1.11 compiler-6.0.1 cosEvent-2.2 cosEventDomain-1.2 cosFileTransfer-1.2 cosNotification-1.2 cosProperty-1.2 cosTime-1.2 cosTransactions-1.3 crypto-3.6.1 debugger-4.1.1 dialyzer-2.8.1 diameter-1.11 edoc-0.7.17 eldap-1.2 erl_docgen-0.4 erl_interface-3.8 erts-7.1 et-1.5.1 eunit-2.2.11 gs-1.6 hipe-3.13 ic-4.4 jinterface-1.6 kernel-4.1 megaco-3.18 observer-2.1 odbc-2.11.1 orber-3.8 os_mon-2.4 ose-1.1 otp_mibs-1.1 parsetools-2.1 percept-0.8.11 public_key-1.0.1 reltool-0.7 runtime_tools-1.9.1 sasl-2.6 snmp-5.2 ssh-4.1 ssl-7.1 stdlib-2.6 syntax_tools-1.7 test_server-3.9 tools-2.8.1 typer-0.9.9 webtool-0.9 wx-1.5 xmerl-1.3.8 :
+OTP-18.1 : compiler-6.0.1 crypto-3.6.1 debugger-4.1.1 dialyzer-2.8.1 diameter-1.11 erts-7.1 eunit-2.2.11 hipe-3.13 inets-6.0.1 kernel-4.1 mnesia-4.13.1 odbc-2.11.1 public_key-1.0.1 sasl-2.6 ssh-4.1 ssl-7.1 stdlib-2.6 tools-2.8.1 wx-1.5 # asn1-4.0 common_test-1.11 cosEvent-2.2 cosEventDomain-1.2 cosFileTransfer-1.2 cosNotification-1.2 cosProperty-1.2 cosTime-1.2 cosTransactions-1.3 edoc-0.7.17 eldap-1.2 erl_docgen-0.4 erl_interface-3.8 et-1.5.1 gs-1.6 ic-4.4 jinterface-1.6 megaco-3.18 observer-2.1 orber-3.8 os_mon-2.4 ose-1.1 otp_mibs-1.1 parsetools-2.1 percept-0.8.11 reltool-0.7 runtime_tools-1.9.1 snmp-5.2 syntax_tools-1.7 test_server-3.9 typer-0.9.9 webtool-0.9 xmerl-1.3.8 :
OTP-18.0.3 : erts-7.0.3 # asn1-4.0 common_test-1.11 compiler-6.0 cosEvent-2.2 cosEventDomain-1.2 cosFileTransfer-1.2 cosNotification-1.2 cosProperty-1.2 cosTime-1.2 cosTransactions-1.3 crypto-3.6 debugger-4.1 dialyzer-2.8 diameter-1.10 edoc-0.7.17 eldap-1.2 erl_docgen-0.4 erl_interface-3.8 et-1.5.1 eunit-2.2.10 gs-1.6 hipe-3.12 ic-4.4 inets-6.0 jinterface-1.6 kernel-4.0 megaco-3.18 mnesia-4.13 observer-2.1 odbc-2.11 orber-3.8 os_mon-2.4 ose-1.1 otp_mibs-1.1 parsetools-2.1 percept-0.8.11 public_key-1.0 reltool-0.7 runtime_tools-1.9.1 sasl-2.5 snmp-5.2 ssh-4.0 ssl-7.0 stdlib-2.5 syntax_tools-1.7 test_server-3.9 tools-2.8 typer-0.9.9 webtool-0.9 wx-1.4 xmerl-1.3.8 :
OTP-18.0.2 : erts-7.0.2 runtime_tools-1.9.1 # asn1-4.0 common_test-1.11 compiler-6.0 cosEvent-2.2 cosEventDomain-1.2 cosFileTransfer-1.2 cosNotification-1.2 cosProperty-1.2 cosTime-1.2 cosTransactions-1.3 crypto-3.6 debugger-4.1 dialyzer-2.8 diameter-1.10 edoc-0.7.17 eldap-1.2 erl_docgen-0.4 erl_interface-3.8 et-1.5.1 eunit-2.2.10 gs-1.6 hipe-3.12 ic-4.4 inets-6.0 jinterface-1.6 kernel-4.0 megaco-3.18 mnesia-4.13 observer-2.1 odbc-2.11 orber-3.8 os_mon-2.4 ose-1.1 otp_mibs-1.1 parsetools-2.1 percept-0.8.11 public_key-1.0 reltool-0.7 sasl-2.5 snmp-5.2 ssh-4.0 ssl-7.0 stdlib-2.5 syntax_tools-1.7 test_server-3.9 tools-2.8 typer-0.9.9 webtool-0.9 wx-1.4 xmerl-1.3.8 :
OTP-18.0.1 : erts-7.0.1 # asn1-4.0 common_test-1.11 compiler-6.0 cosEvent-2.2 cosEventDomain-1.2 cosFileTransfer-1.2 cosNotification-1.2 cosProperty-1.2 cosTime-1.2 cosTransactions-1.3 crypto-3.6 debugger-4.1 dialyzer-2.8 diameter-1.10 edoc-0.7.17 eldap-1.2 erl_docgen-0.4 erl_interface-3.8 et-1.5.1 eunit-2.2.10 gs-1.6 hipe-3.12 ic-4.4 inets-6.0 jinterface-1.6 kernel-4.0 megaco-3.18 mnesia-4.13 observer-2.1 odbc-2.11 orber-3.8 os_mon-2.4 ose-1.1 otp_mibs-1.1 parsetools-2.1 percept-0.8.11 public_key-1.0 reltool-0.7 runtime_tools-1.9 sasl-2.5 snmp-5.2 ssh-4.0 ssl-7.0 stdlib-2.5 syntax_tools-1.7 test_server-3.9 tools-2.8 typer-0.9.9 webtool-0.9 wx-1.4 xmerl-1.3.8 :
OTP-18.0 : asn1-4.0 common_test-1.11 compiler-6.0 cosEvent-2.2 cosEventDomain-1.2 cosFileTransfer-1.2 cosNotification-1.2 cosProperty-1.2 cosTime-1.2 cosTransactions-1.3 crypto-3.6 debugger-4.1 dialyzer-2.8 diameter-1.10 edoc-0.7.17 eldap-1.2 erl_docgen-0.4 erl_interface-3.8 erts-7.0 et-1.5.1 eunit-2.2.10 gs-1.6 hipe-3.12 ic-4.4 inets-6.0 jinterface-1.6 kernel-4.0 megaco-3.18 mnesia-4.13 observer-2.1 odbc-2.11 orber-3.8 os_mon-2.4 ose-1.1 otp_mibs-1.1 parsetools-2.1 percept-0.8.11 public_key-1.0 reltool-0.7 runtime_tools-1.9 sasl-2.5 snmp-5.2 ssh-4.0 ssl-7.0 stdlib-2.5 syntax_tools-1.7 test_server-3.9 tools-2.8 typer-0.9.9 webtool-0.9 wx-1.4 xmerl-1.3.8 # :
+OTP-17.5.6.4 : debugger-4.0.3.1 erts-6.4.1.3 # asn1-3.0.4 common_test-1.10.1 compiler-5.0.4 cosEvent-2.1.15 cosEventDomain-1.1.14 cosFileTransfer-1.1.16 cosNotification-1.1.21 cosProperty-1.1.17 cosTime-1.1.14 cosTransactions-1.2.14 crypto-3.5 dialyzer-2.7.4 diameter-1.9.2.1 edoc-0.7.16 eldap-1.1.1 erl_docgen-0.3.7 erl_interface-3.7.20 et-1.5 eunit-2.2.9 gs-1.5.16 hipe-3.11.3 ic-4.3.6 inets-5.10.9 jinterface-1.5.12 kernel-3.2 megaco-3.17.3 mnesia-4.12.5 observer-2.0.4 odbc-2.10.22 orber-3.7.1 os_mon-2.3.1 ose-1.0.2 otp_mibs-1.0.10 parsetools-2.0.12 percept-0.8.10 public_key-0.23 reltool-0.6.6 runtime_tools-1.8.16.1 sasl-2.4.1 snmp-5.1.2 ssh-3.2.4 ssl-6.0.1 stdlib-2.4 syntax_tools-1.6.18 test_server-3.8.1 tools-2.7.2 typer-0.9.8 webtool-0.8.10 wx-1.3.3 xmerl-1.3.7 :
OTP-17.5.6.3 : diameter-1.9.2.1 # asn1-3.0.4 common_test-1.10.1 compiler-5.0.4 cosEvent-2.1.15 cosEventDomain-1.1.14 cosFileTransfer-1.1.16 cosNotification-1.1.21 cosProperty-1.1.17 cosTime-1.1.14 cosTransactions-1.2.14 crypto-3.5 debugger-4.0.3 dialyzer-2.7.4 edoc-0.7.16 eldap-1.1.1 erl_docgen-0.3.7 erl_interface-3.7.20 erts-6.4.1.2 et-1.5 eunit-2.2.9 gs-1.5.16 hipe-3.11.3 ic-4.3.6 inets-5.10.9 jinterface-1.5.12 kernel-3.2 megaco-3.17.3 mnesia-4.12.5 observer-2.0.4 odbc-2.10.22 orber-3.7.1 os_mon-2.3.1 ose-1.0.2 otp_mibs-1.0.10 parsetools-2.0.12 percept-0.8.10 public_key-0.23 reltool-0.6.6 runtime_tools-1.8.16.1 sasl-2.4.1 snmp-5.1.2 ssh-3.2.4 ssl-6.0.1 stdlib-2.4 syntax_tools-1.6.18 test_server-3.8.1 tools-2.7.2 typer-0.9.8 webtool-0.8.10 wx-1.3.3 xmerl-1.3.7 :
OTP-17.5.6.2 : erts-6.4.1.2 runtime_tools-1.8.16.1 # asn1-3.0.4 common_test-1.10.1 compiler-5.0.4 cosEvent-2.1.15 cosEventDomain-1.1.14 cosFileTransfer-1.1.16 cosNotification-1.1.21 cosProperty-1.1.17 cosTime-1.1.14 cosTransactions-1.2.14 crypto-3.5 debugger-4.0.3 dialyzer-2.7.4 diameter-1.9.2 edoc-0.7.16 eldap-1.1.1 erl_docgen-0.3.7 erl_interface-3.7.20 et-1.5 eunit-2.2.9 gs-1.5.16 hipe-3.11.3 ic-4.3.6 inets-5.10.9 jinterface-1.5.12 kernel-3.2 megaco-3.17.3 mnesia-4.12.5 observer-2.0.4 odbc-2.10.22 orber-3.7.1 os_mon-2.3.1 ose-1.0.2 otp_mibs-1.0.10 parsetools-2.0.12 percept-0.8.10 public_key-0.23 reltool-0.6.6 sasl-2.4.1 snmp-5.1.2 ssh-3.2.4 ssl-6.0.1 stdlib-2.4 syntax_tools-1.6.18 test_server-3.8.1 tools-2.7.2 typer-0.9.8 webtool-0.8.10 wx-1.3.3 xmerl-1.3.7 :
OTP-17.5.6.1 : erts-6.4.1.1 # asn1-3.0.4 common_test-1.10.1 compiler-5.0.4 cosEvent-2.1.15 cosEventDomain-1.1.14 cosFileTransfer-1.1.16 cosNotification-1.1.21 cosProperty-1.1.17 cosTime-1.1.14 cosTransactions-1.2.14 crypto-3.5 debugger-4.0.3 dialyzer-2.7.4 diameter-1.9.2 edoc-0.7.16 eldap-1.1.1 erl_docgen-0.3.7 erl_interface-3.7.20 et-1.5 eunit-2.2.9 gs-1.5.16 hipe-3.11.3 ic-4.3.6 inets-5.10.9 jinterface-1.5.12 kernel-3.2 megaco-3.17.3 mnesia-4.12.5 observer-2.0.4 odbc-2.10.22 orber-3.7.1 os_mon-2.3.1 ose-1.0.2 otp_mibs-1.0.10 parsetools-2.0.12 percept-0.8.10 public_key-0.23 reltool-0.6.6 runtime_tools-1.8.16 sasl-2.4.1 snmp-5.1.2 ssh-3.2.4 ssl-6.0.1 stdlib-2.4 syntax_tools-1.6.18 test_server-3.8.1 tools-2.7.2 typer-0.9.8 webtool-0.8.10 wx-1.3.3 xmerl-1.3.7 :
diff --git a/system/doc/design_principles/des_princ.xml b/system/doc/design_principles/des_princ.xml
index ba67a49585..0e087cf843 100644
--- a/system/doc/design_principles/des_princ.xml
+++ b/system/doc/design_principles/des_princ.xml
@@ -183,7 +183,7 @@ handle_cast({free, Ch}, Chs) ->
<item>The server name, in this example the atom
<c>ch2</c>, is hidden from the users of the client functions. This
means that the name can be changed without affecting them.</item>
- <item>The protcol (messages sent to and received from the server)
+ <item>The protocol (messages sent to and received from the server)
is also hidden. This is good programming practice and allows
one to change the protocol without changing the code using
the interface functions.</item>
diff --git a/system/doc/efficiency_guide/binaryhandling.xml b/system/doc/efficiency_guide/binaryhandling.xml
index 51f8c4ebf0..0964b759d8 100644
--- a/system/doc/efficiency_guide/binaryhandling.xml
+++ b/system/doc/efficiency_guide/binaryhandling.xml
@@ -190,15 +190,15 @@ Bin4 = <<Bin1/binary,17>>, %% 5 !!!
its size set to the size of the data stored in the binary, while
the binary object has extra space allocated.
The size of the binary object is either twice the
- size of <c>Bin0</c> or 256, whichever is larger. In this case
+ size of <c>Bin1</c> or 256, whichever is larger. In this case
it is 256.</item>
<item>Line 3 is more interesting.
<c>Bin1</c> <em>has</em> been used in an append operation,
- and it has 255 bytes of unused storage at the end, so the 3 new
+ and it has 252 bytes of unused storage at the end, so the 3 new
bytes are stored there.</item>
- <item>Line 4. The same applies here. There are 252 bytes left,
+ <item>Line 4. The same applies here. There are 249 bytes left,
so there is no problem storing another 3 bytes.</item>
<item>Line 5. Here, something <em>interesting</em> happens. Notice
diff --git a/system/doc/tutorial/ei.c b/system/doc/tutorial/ei.c
index b234a00768..c33e3fb78e 100644
--- a/system/doc/tutorial/ei.c
+++ b/system/doc/tutorial/ei.c
@@ -21,7 +21,7 @@ int main() {
if (strncmp(ERL_ATOM_PTR(fnp), "foo", 3) == 0) {
res = foo(ERL_INT_VALUE(argp));
- } else if (strncmp(ERL_ATOM_PTR(fnp), "bar", 17) == 0) {
+ } else if (strncmp(ERL_ATOM_PTR(fnp), "bar", 3) == 0) {
res = bar(ERL_INT_VALUE(argp));
}
diff --git a/system/doc/tutorial/example.xmlsrc b/system/doc/tutorial/example.xmlsrc
index d49c7fe88c..91f09ec522 100644
--- a/system/doc/tutorial/example.xmlsrc
+++ b/system/doc/tutorial/example.xmlsrc
@@ -11,7 +11,7 @@
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
-
+
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@@ -19,7 +19,7 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-
+
</legalnotice>
<title>Problem Example</title>
@@ -39,7 +39,7 @@
<codeinclude file="complex.c" tag="" type="none"></codeinclude>
<p>The functions are deliberately kept as simple as possible, for
readability reasons.</p>
- <p>From an Erlang perspektive, it is preferable to be able to call
+ <p>From an Erlang perspective, it is preferable to be able to call
<c>foo</c> and <c>bar</c> without having to bother about that
they are C functions:</p>
<pre>
diff --git a/xcomp/erl-xcomp-powerpc-ose5.conf b/xcomp/erl-xcomp-powerpc-ose5.conf
deleted file mode 100644
index 88b2135593..0000000000
--- a/xcomp/erl-xcomp-powerpc-ose5.conf
+++ /dev/null
@@ -1,358 +0,0 @@
-## -*-shell-script-*-
-##
-## %CopyrightBegin%
-##
-## Copyright Ericsson AB 2009-2012. All Rights Reserved.
-##
-## Licensed under the Apache License, Version 2.0 (the "License");
-## you may not use this file except in compliance with the License.
-## You may obtain a copy of the License at
-##
-## http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS,
-## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-## See the License for the specific language governing permissions and
-## limitations under the License.
-##
-## %CopyrightEnd%
-##
-## File: erl-xcomp-sfk-linux-ose5.conf
-## Author: Petre Pircalabu
-##
-## -----------------------------------------------------------------------------
-## When cross compiling Erlang/OTP using `otp_build', copy this file and set
-## the variables needed below. Then pass the path to the copy of this file as
-## an argument to `otp_build' in the configure stage:
-## `otp_build configure --xcomp-conf=<FILE>'
-## -----------------------------------------------------------------------------
-
-## Note that you cannot define arbitrary variables in a cross compilation
-## configuration file. Only the ones listed below will be guaranteed to be
-## visible throughout the whole execution of all `configure' scripts. Other
-## variables needs to be defined as arguments to `configure' or exported in
-## the environment.
-
-## -- Variables needed for an OSE5 build ---------------------------------------
-OSEROOT="/vobs/ose5/system"
-HOST="linux"
-
-GCCVERSION="4.4.3"
-GCCROOT="${OSEROOT}/gcc_linux_powerpc_${GCCVERSION}"
-
-OSEDEBUG="no"
-OSESSL="no"
-
-case ${GCCVERSION} in
-4.4.3)
- GCCTARGET="powerpc-eabi"
- ;;
-4.6.3)
- GCCTARGET="powerpc-ose-eabi"
- ;;
-*)
- echo "Error: Unknown GCCVERSION: ${GCCVERSION}"
- exit 1
-esac
-
-if [ ${OSEDEBUG} != "yes" ];
-then
-OPT_LEVEL="-O2"
-else
-OPT_LEVEL=""
-fi
-
-if [ ${OSESSL} = "yes" ];
-then
-## If your crypto is not in OSEROOT then you have to use --with-ssl to
-## point to the correct place. Also CRYPTO_LIB_PATH has to be modified to
-## point there as well.
-CRYPTO_CONFIG_OPTION="--disable-dynamic-ssl-lib"
-CRYPTO_NIF_PATH=",$ERL_TOP/lib/crypto/priv/lib/powerpc-unknown-ose/crypto.a"
-CRYPTO_LIB_PATH="${OSEROOT}/lib/powerpc/libsslcrypto.a"
-else
-CRYPTO_CONFIG_OPTION="--without-ssl"
-CRYPTO_NIF_PATH=""
-CRYPTO_LIB_PATH=""
-fi
-
-
-## -- Variables for `otp_build' Only -------------------------------------------
-
-## Variables in this section are only used, when configuring Erlang/OTP for
-## cross compilation using `$ERL_TOP/otp_build configure'.
-
-## *NOTE*! These variables currently have *no* effect if you configure using
-## the `configure' script directly.
-
-# * `erl_xcomp_build' - The build system used. This value will be passed as
-# `--build=$erl_xcomp_build' argument to the `configure' script. It does
-# not have to be a full `CPU-VENDOR-OS' triplet, but can be. The full
-# `CPU-VENDOR-OS' triplet will be created by
-# `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_build'. If set to `guess',
-# the build system will be guessed using
-# `$ERL_TOP/erts/autoconf/config.guess'.
-erl_xcomp_build=guess
-
-# * `erl_xcomp_host' - Cross host/target system to build for. This value will
-# be passed as `--host=$erl_xcomp_host' argument to the `configure' script.
-# It does not have to be a full `CPU-VENDOR-OS' triplet, but can be. The
-# full `CPU-VENDOR-OS' triplet will be created by
-# `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_host'.
-erl_xcomp_host="powerpc-ose"
-
-disabled_apps="--without-erl_interface --without-os_mon --without-megaco --without-observer --without-wx --without-appmon --without-cosEvent --without-cosEventDomain --without-cosFileTransfer --without-cosNotification --without-cosProperty --without-cosTime --without-cosTransactions --without-debugger --without-dialyzer --without-edoc --without-erl_docgen --without-eunit --without-gs --without-hipe --without-ic --without-orber --without-pman --without-toolbar --without-tv --without-webtool --without-typer"
-
-# * `erl_xcomp_configure_flags' - Extra configure flags to pass to the
-# `configure' script.
-erl_xcomp_configure_flags="${CRYPTO_CONFIG_OPTION} --disable-kernel-poll --disable-hipe --without-termcap --without-javac ${disabled_apps} --enable-static-nifs=$ERL_TOP/lib/asn1/priv/lib/powerpc-unknown-ose/asn1rt_nif.a${CRYPTO_NIF_PATH}"
-
-## -- Cross Compiler and Other Tools -------------------------------------------
-
-## If the cross compilation tools are prefixed by `<HOST>-' you probably do
-## not need to set these variables (where `<HOST>' is what has been passed as
-## `--host=<HOST>' argument to `configure').
-
-## All variables in this section can also be used when native compiling.
-
-# * `CC' - C compiler.
-CC="$GCCROOT/bin/$GCCTARGET-gcc"
-
-# * `CFLAGS' - C compiler flags.
-CFLAGS="-msoft-float -g -fno-strict-aliasing -fno-builtin -fshort-wchar -Wall -Wno-unknown-pragmas -mpowerpc -nostdlib -I$GCCROOT/include/c++/$GCCVERSION -I$OSEROOT/include -I$OSEROOT/include/ose_spi -I$OSEROOT/include/gcc -MD -MP -D__OSE__ -DBIG_ENDIAN -DCF_CONF_SIZE=0x800 ${OPT_LEVEL}"
-
-
-# * `STATIC_CFLAGS' - Static C compiler flags.
-#STATIC_CFLAGS=
-
-# * `CFLAG_RUNTIME_LIBRARY_PATH' - This flag should set runtime library
-# search path for the shared libraries. Note that this actually is a
-# linker flag, but it needs to be passed via the compiler.
-#CFLAG_RUNTIME_LIBRARY_PATH=
-
-# * `CPP' - C pre-processor.
-CPP="$GCCROOT/bin/$GCCTARGET-cpp"
-
-# * `CPPFLAGS' - C pre-processor flags.
-CPPFLAGS="-msoft-float -g -fno-strict-aliasing -fno-builtin -fshort-wchar -Wall -Wno-unknown-pragmas -mpowerpc -nostdlib -I$GCCROOT/include/c++/$GCCVERSION -I$OSEROOT/include -I$OSEROOT/include/ose_spi -I$OSEROOT/include/gcc -MD -MP -D__OSE__ -DBIG_ENDIAN -DCF_CONF_SIZE=0x800 ${OPT_LEVEL}"
-
-
-# * `CXX' - C++ compiler.
-CXX="$GCCROOT/bin/$GCCTARGET-g++"
-
-# * `CXXFLAGS' - C++ compiler flags.
-CXXFLAGS="-msoft-float -g -fno-strict-aliasing -ansi -I$GCCROOT/include/c++/$GCCVERSION -I$OSEROOT/include -I$OSEROOT/include/gcc ${OPT_LEVEL}"
-
-# * `LD' - Linker.
-LD="${GCCROOT}/bin/${GCCTARGET}-ld"
-
-# * `LDFLAGS' - Linker flags.
-LDFLAGS="-Wl,-ecrt0_lm -Wl,-T,${ERL_TOP}/erts/emulator/sys/ose/gcc_${GCCVERSION}_lm_ppc.lcf"
-
-# * `LIBS' - Libraries.
-LIBS="${OSEROOT}/lib/powerpc/libcrt.a ${OSEROOT}/lib/powerpc/libm.a ${GCCROOT}/lib/gcc/${GCCTARGET}/${GCCVERSION}/nof/libgcc.a ${CRYPTO_LIB_PATH}"
-
-## -- *D*ynamic *E*rlang *D*river Linking --
-
-## *NOTE*! Either set all or none of the `DED_LD*' variables.
-
-# * `DED_LD' - Linker for Dynamically loaded Erlang Drivers.
-DED_LD=
-
-# * `DED_LDFLAGS' - Linker flags to use with `DED_LD'.
-DED_LDFLAGS=
-
-# * `DED_LD_FLAG_RUNTIME_LIBRARY_PATH' - This flag should set runtime library
-# search path for shared libraries when linking with `DED_LD'.
-DED_LD_FLAG_RUNTIME_LIBRARY_PATH=
-
-## -- Large File Support --
-
-## *NOTE*! Either set all or none of the `LFS_*' variables.
-
-# * `LFS_CFLAGS' - Large file support C compiler flags.
-#LFS_CFLAGS=
-
-# * `LFS_LDFLAGS' - Large file support linker flags.
-#LFS_LDFLAGS=
-
-# * `LFS_LIBS' - Large file support libraries.
-#LFS_LIBS=
-
-## -- Other Tools --
-
-# * `RANLIB' - `ranlib' archive index tool.
-RANLIB="$GCCROOT/bin/$GCCTARGET-ranlib"
-
-# * `AR' - `ar' archiving tool.
-AR="$GCCROOT/bin/$GCCTARGET-ar"
-
-# * `STRIP' - `strip
-STRIP="$GCCROOT/bin/$GCCTARGET-strip"
-
-# * `GETCONF' - `getconf' system configuration inspection tool. `getconf' is
-# currently used for finding out large file support flags to use, and
-# on Linux systems for finding out if we have an NPTL thread library or
-# not.
-#GETCONF=
-
-## -- Cross System Root Locations ----------------------------------------------
-
-# * `erl_xcomp_sysroot' - The absolute path to the system root of the cross
-# compilation environment. Currently, the `crypto', `odbc', `ssh' and
-# `ssl' applications need the system root. These applications will be
-# skipped if the system root has not been set. The system root might be
-# needed for other things too. If this is the case and the system root
-# has not been set, `configure' will fail and request you to set it.
-erl_xcomp_sysroot="$OSEROOT"
-
-# * `erl_xcomp_isysroot' - The absolute path to the system root for includes
-# of the cross compilation environment. If not set, this value defaults
-# to `$erl_xcomp_sysroot', i.e., only set this value if the include system
-# root path is not the same as the system root path.
-#erl_xcomp_isysroot="$OSEROOT"
-
-## -- Optional Feature, and Bug Tests ------------------------------------------
-
-## These tests cannot (always) be done automatically when cross compiling. You
-## usually do not need to set these variables. Only set these if you really
-## know what you are doing.
-
-## Note that some of these values will override results of tests performed
-## by `configure', and some will not be used until `configure' is sure that
-## it cannot figure the result out.
-
-## The `configure' script will issue a warning when a default value is used.
-## When a variable has been set, no warning will be issued.
-
-# * `erl_xcomp_after_morecore_hook' - `yes|no'. Defaults to `no'. If `yes',
-# the target system must have a working `__after_morecore_hook' that can be
-# used for tracking used `malloc()' implementations core memory usage.
-# This is currently only used by unsupported features.
-#erl_xcomp_after_morecore_hook=
-
-# * `erl_xcomp_bigendian' - `yes|no'. No default. If `yes', the target system
-# must be big endian. If `no', little endian. This can often be
-# automatically detected, but not always. If not automatically detected,
-# `configure' will fail unless this variable is set. Since no default
-# value is used, `configure' will try to figure this out automatically.
-#erl_xcomp_bigendian=
-
-# * `erl_xcomp_double_middle` - `yes|no`. No default. If `yes`, the
-# target system must have doubles in "middle-endian" format. If
-# `no`, it has "regular" endianness. This can often be automatically
-# detected, but not always. If not automatically detected,
-# `configure` will fail unless this variable is set. Since no
-# default value is used, `configure` will try to figure this out
-# automatically.
-#erl_xcomp_double_middle_endian
-
-# * `erl_xcomp_clock_gettime_cpu_time' - `yes|no'. Defaults to `no'. If `yes',
-# the target system must have a working `clock_gettime()' implementation
-# that can be used for retrieving process CPU time.
-#erl_xcomp_clock_gettime_cpu_time=
-
-# * `erl_xcomp_getaddrinfo' - `yes|no'. Defaults to `no'. If `yes', the target
-# system must have a working `getaddrinfo()' implementation that can
-# handle both IPv4 and IPv6.
-#erl_xcomp_getaddrinfo=
-
-# * `erl_xcomp_gethrvtime_procfs_ioctl' - `yes|no'. Defaults to `no'. If `yes',
-# the target system must have a working `gethrvtime()' implementation and
-# is used with procfs `ioctl()'.
-#erl_xcomp_gethrvtime_procfs_ioctl=
-
-# * `erl_xcomp_dlsym_brk_wrappers' - `yes|no'. Defaults to `no'. If `yes', the
-# target system must have a working `dlsym(RTLD_NEXT, <S>)' implementation
-# that can be used on `brk' and `sbrk' symbols used by the `malloc()'
-# implementation in use, and by this track the `malloc()' implementations
-# core memory usage. This is currently only used by unsupported features.
-#erl_xcomp_dlsym_brk_wrappers=
-
-# * `erl_xcomp_kqueue' - `yes|no'. Defaults to `no'. If `yes', the target
-# system must have a working `kqueue()' implementation that returns a file
-# descriptor which can be used by `poll()' and/or `select()'. If `no' and
-# the target system has not got `epoll()' or `/dev/poll', the kernel-poll
-# feature will be disabled.
-#erl_xcomp_kqueue=
-
-# * `erl_xcomp_linux_clock_gettime_correction' - `yes|no'. Defaults to `yes' on
-# Linux; otherwise, `no'. If `yes', `clock_gettime(CLOCK_MONOTONIC, _)' on
-# the target system must work. This variable is recommended to be set to
-# `no' on Linux systems with kernel versions less than 2.6.
-#erl_xcomp_linux_clock_gettime_correction=
-
-# * `erl_xcomp_linux_nptl' - `yes|no'. Defaults to `yes' on Linux; otherwise,
-# `no'. If `yes', the target system must have NPTL (Native POSIX Thread
-# Library). Older Linux systems have LinuxThreads instead of NPTL (Linux
-# kernel versions typically less than 2.6).
-#erl_xcomp_linux_nptl=
-
-# * `erl_xcomp_linux_usable_sigaltstack' - `yes|no'. Defaults to `yes' on Linux;
-# otherwise, `no'. If `yes', `sigaltstack()' must be usable on the target
-# system. `sigaltstack()' on Linux kernel versions less than 2.4 are
-# broken.
-#erl_xcomp_linux_usable_sigaltstack=
-
-# * `erl_xcomp_linux_usable_sigusrx' - `yes|no'. Defaults to `yes'. If `yes',
-# the `SIGUSR1' and `SIGUSR2' signals must be usable by the ERTS. Old
-# LinuxThreads thread libraries (Linux kernel versions typically less than
-# 2.2) used these signals and made them unusable by the ERTS.
-#erl_xcomp_linux_usable_sigusrx=
-
-# * `erl_xcomp_poll' - `yes|no'. Defaults to `no' on Darwin/MacOSX; otherwise,
-# `yes'. If `yes', the target system must have a working `poll()'
-# implementation that also can handle devices. If `no', `select()' will be
-# used instead of `poll()'.
-erl_xcomp_poll=no
-
-# * `erl_xcomp_putenv_copy' - `yes|no'. Defaults to `no'. If `yes', the target
-# system must have a `putenv()' implementation that stores a copy of the
-# key/value pair.
-#erl_xcomp_putenv_copy=
-
-# * `erl_xcomp_reliable_fpe' - `yes|no'. Defaults to `no'. If `yes', the target
-# system must have reliable floating point exceptions.
-#erl_xcomp_reliable_fpe=
-# * `erl_xcomp_ose_ldflags_pass1` - Linker flags for the OSE module (pass 1)
-erl_xcomp_ose_ldflags_pass1="-r --no-omagic"
-
-# * `erl_xcomp_ose_ldflags_pass2` - Linker flags for the OSE module (pass 2)
-erl_xcomp_ose_ldflags_pass2="-n --emit-relocs -ecrt0_lm --no-omagic"
-
-# * `erl_xcomp_ose_OSEROOT` - OSE installation root directory
-erl_xcomp_ose_OSEROOT="${OSEROOT}"
-
-# * `erl_xcomp_ose_STRIP` - Strip utility shipped with the OSE distribution
-erl_xcomp_ose_STRIP="${GCCROOT}/bin/${GCCTARGET}-strip"
-
-# * `erl_xcomp_ose_LM_POST_LINK` - OSE postlink tool
-erl_xcomp_ose_LM_POST_LINK="${OSEROOT}/bin/${HOST}/lm_post_link"
-
-# * `erl_xcomp_ose_LM_SET_CONF` - Sets the configuration for an OSE load module
-erl_xcomp_ose_LM_SET_CONF="${OSEROOT}/bin/${HOST}/lm_set_conf"
-
-# * `erl_xcomp_ose_LM_ELF_SIZE` - OSE load module elf size tool
-erl_xcomp_ose_LM_ELF_SIZE="${OSEROOT}/bin/${HOST}/lm_elf_size"
-
-# * `erl_xcomp_ose_LM_LCF` - OSE load module linker configuration file
-erl_xcomp_ose_LM_LCF="${ERL_TOP}/erts/emulator/sys/ose/gcc_${GCCVERSION}_lm_ppc.lcf"
-
-# * `erl_xcomp_ose_BEAM_LM_CONF` - beam OSE load module configuration file
-erl_xcomp_ose_BEAM_LM_CONF="${ERL_TOP}/erts/emulator/sys/ose/beam.lmconf"
-
-# * `erl_xcomp_ose_RUN_ERL_LM_CONF` - run_erl_lm OSE load module configuration file
-erl_xcomp_ose_RUN_ERL_LM_CONF="${ERL_TOP}/erts/etc/ose/etc.lmconf"
-
-# * `erl_xcomp_ose_EPMD_LM_CONF` - epmd OSE load module configuration file
-erl_xcomp_ose_EPMD_LM_CONF="${ERL_TOP}/erts/etc/ose/etc.lmconf"
-
-# * `erl_xcomp_ose_CONFD` - OSE confd source file
-erl_xcomp_ose_CONFD="${OSEROOT}/src/ose_confd.c"
-
-# * `erl_xcomp_ose_CRT0_LM` - OSE crt0 lm source file
-erl_xcomp_ose_CRT0_LM="${OSEROOT}/src/crt0_lm.c"
-
-
-## -----------------------------------------------------------------------------
diff --git a/xcomp/erl-xcomp-sfk-linux-ose5.conf b/xcomp/erl-xcomp-sfk-linux-ose5.conf
deleted file mode 100644
index a4d64e5636..0000000000
--- a/xcomp/erl-xcomp-sfk-linux-ose5.conf
+++ /dev/null
@@ -1,305 +0,0 @@
-## -*-shell-script-*-
-##
-## %CopyrightBegin%
-##
-## Copyright Ericsson AB 2009-2012. All Rights Reserved.
-##
-## Licensed under the Apache License, Version 2.0 (the "License");
-## you may not use this file except in compliance with the License.
-## You may obtain a copy of the License at
-##
-## http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS,
-## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-## See the License for the specific language governing permissions and
-## limitations under the License.
-##
-## %CopyrightEnd%
-##
-## File: erl-xcomp-sfk-linux-ose5.conf
-## Author: Petre Pircalabu
-##
-## -----------------------------------------------------------------------------
-## When cross compiling Erlang/OTP using `otp_build', copy this file and set
-## the variables needed below. Then pass the path to the copy of this file as
-## an argument to `otp_build' in the configure stage:
-## `otp_build configure --xcomp-conf=<FILE>'
-## -----------------------------------------------------------------------------
-
-## Note that you cannot define arbitrary variables in a cross compilation
-## configuration file. Only the ones listed below will be guaranteed to be
-## visible throughout the whole execution of all `configure' scripts. Other
-## variables needs to be defined as arguments to `configure' or exported in
-## the environment.
-
-## -- Variables needed for an OSE5 build ---------------------------------------
-OSEROOT="/vobs/ose5/system"
-HOST="linux"
-GCCVERSION="4.6.3"
-GCCROOT="${OSEROOT}/gcc_linux_x86_${GCCVERSION}"
-GCCTARGET="i386-elf"
-
-## -- Variables for `otp_build' Only -------------------------------------------
-
-## Variables in this section are only used, when configuring Erlang/OTP for
-## cross compilation using `$ERL_TOP/otp_build configure'.
-
-## *NOTE*! These variables currently have *no* effect if you configure using
-## the `configure' script directly.
-
-# * `erl_xcomp_build' - The build system used. This value will be passed as
-# `--build=$erl_xcomp_build' argument to the `configure' script. It does
-# not have to be a full `CPU-VENDOR-OS' triplet, but can be. The full
-# `CPU-VENDOR-OS' triplet will be created by
-# `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_build'. If set to `guess',
-# the build system will be guessed using
-# `$ERL_TOP/erts/autoconf/config.guess'.
-erl_xcomp_build=guess
-
-# * `erl_xcomp_host' - Cross host/target system to build for. This value will
-# be passed as `--host=$erl_xcomp_host' argument to the `configure' script.
-# It does not have to be a full `CPU-VENDOR-OS' triplet, but can be. The
-# full `CPU-VENDOR-OS' triplet will be created by
-# `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_host'.
-erl_xcomp_host="$GCCTARGET-ose"
-
-# * `erl_xcomp_configure_flags' - Extra configure flags to pass to the
-# `configure' script.
-erl_xcomp_configure_flags="--disable-threads --disable-smp-support --disable-kernel-poll --disable-hipe --without-termcap --without-javac --disable-dynamic-ssl-lib --disable-shared-zlib --without-ssl --enable-static-nifs --enable-static-nifs=$ERL_TOP/lib/asn1/priv/lib/powerpc-unknown-ose/asn1rt_nif.a"
-
-## -- Cross Compiler and Other Tools -------------------------------------------
-
-## If the cross compilation tools are prefixed by `<HOST>-' you probably do
-## not need to set these variables (where `<HOST>' is what has been passed as
-## `--host=<HOST>' argument to `configure').
-
-## All variables in this section can also be used when native compiling.
-
-# * `CC' - C compiler.
-CC="$GCCROOT/bin/$GCCTARGET-gcc"
-
-# * `CFLAGS' - C compiler flags.
-CFLAGS="-g -fno-strict-aliasing -fno-builtin -fshort-wchar -Wall -Wno-unknown-pragmas -I$GCCROOT/include/c++/$GCCVERSION -I$OSEROOT/include -I$OSEROOT/include/ose_spi -I$OSEROOT/include/gcc -MD -MP -D__OSE__ -DLITTLE_ENDIAN -DCF_CONF_SIZE=0x800"
-
-# * `STATIC_CFLAGS' - Static C compiler flags.
-#STATIC_CFLAGS=
-
-# * `CFLAG_RUNTIME_LIBRARY_PATH' - This flag should set runtime library
-# search path for the shared libraries. Note that this actually is a
-# linker flag, but it needs to be passed via the compiler.
-#CFLAG_RUNTIME_LIBRARY_PATH=
-
-# * `CPP' - C pre-processor.
-#CPP=
-
-# * `CPPFLAGS' - C pre-processor flags.
-CPPFLAGS="-g -fno-strict-aliasing -fno-builtin -fshort-wchar -Wall -Wno-unknown-pragmas -I$GCCROOT/include/c++/$GCCVERSION -I$OSEROOT/include -I$OSEROOT/include/ose_spi -I$OSEROOT/include/gcc -MD -MP -D__OSE__ -DLITTLE_ENDIAN -DCF_CONF_SIZE=0x800"
-
-# * `CXX' - C++ compiler.
-#CXX=
-
-# * `CXXFLAGS' - C++ compiler flags.
-CXXFLAGS="-g -fno-strict-aliasing -ansi -I$GCCROOT/include/c++/$GCCVERSION -I$OSEROOT/include -I$OSEROOT/include/gcc "
-
-# * `LD' - Linker.
-LD="$GCCROOT/bin/$GCCTARGET-ld"
-
-# * `LDFLAGS' - Linker flags.
-LDFLAGS="-Wl,-ecrt0_lm -Wl,-T,$ERL_TOP/erts/emulator/sys/ose/gcc_lm_x86_$GCCVERSION.lcf"
-
-# * `LIBS' - Libraries.
-LIBS="$OSEROOT/lib/x86/libcrt.a $OSEROOT/lib/x86/libm.a $GCCROOT/lib/gcc/$GCCTARGET/$GCCVERSION/libgcc.a"
-
-## -- *D*ynamic *E*rlang *D*river Linking --
-
-## *NOTE*! Either set all or none of the `DED_LD*' variables.
-
-# * `DED_LD' - Linker for Dynamically loaded Erlang Drivers.
-#DED_LD=
-
-# * `DED_LDFLAGS' - Linker flags to use with `DED_LD'.
-#DED_LDFLAGS=
-
-# * `DED_LD_FLAG_RUNTIME_LIBRARY_PATH' - This flag should set runtime library
-# search path for shared libraries when linking with `DED_LD'.
-#DED_LD_FLAG_RUNTIME_LIBRARY_PATH=
-
-## -- Large File Support --
-
-## *NOTE*! Either set all or none of the `LFS_*' variables.
-
-# * `LFS_CFLAGS' - Large file support C compiler flags.
-#LFS_CFLAGS=
-
-# * `LFS_LDFLAGS' - Large file support linker flags.
-#LFS_LDFLAGS=
-
-# * `LFS_LIBS' - Large file support libraries.
-#LFS_LIBS=
-
-## -- Other Tools --
-
-# * `RANLIB' - `ranlib' archive index tool.
-RANLIB="$GCCROOT/bin/$GCCTARGET-ranlib"
-
-# * `AR' - `ar' archiving tool.
-AR="$GCCROOT/bin/$GCCTARGET-ar"
-
-# * `STRIP' - `strip
-STRIP="$GCCROOT/bin/$GCCTARGET-strip"
-
-# * `GETCONF' - `getconf' system configuration inspection tool. `getconf' is
-# currently used for finding out large file support flags to use, and
-# on Linux systems for finding out if we have an NPTL thread library or
-# not.
-#GETCONF=
-
-## -- Cross System Root Locations ----------------------------------------------
-
-# * `erl_xcomp_sysroot' - The absolute path to the system root of the cross
-# compilation environment. Currently, the `crypto', `odbc', `ssh' and
-# `ssl' applications need the system root. These applications will be
-# skipped if the system root has not been set. The system root might be
-# needed for other things too. If this is the case and the system root
-# has not been set, `configure' will fail and request you to set it.
-erl_xcomp_sysroot="$OSEROOT"
-
-# * `erl_xcomp_isysroot' - The absolute path to the system root for includes
-# of the cross compilation environment. If not set, this value defaults
-# to `$erl_xcomp_sysroot', i.e., only set this value if the include system
-# root path is not the same as the system root path.
-erl_xcomp_isysroot="$OSEROOT/include"
-
-## -- Optional Feature, and Bug Tests ------------------------------------------
-
-## These tests cannot (always) be done automatically when cross compiling. You
-## usually do not need to set these variables. Only set these if you really
-## know what you are doing.
-
-## Note that some of these values will override results of tests performed
-## by `configure', and some will not be used until `configure' is sure that
-## it cannot figure the result out.
-
-## The `configure' script will issue a warning when a default value is used.
-## When a variable has been set, no warning will be issued.
-
-# * `erl_xcomp_after_morecore_hook' - `yes|no'. Defaults to `no'. If `yes',
-# the target system must have a working `__after_morecore_hook' that can be
-# used for tracking used `malloc()' implementations core memory usage.
-# This is currently only used by unsupported features.
-#erl_xcomp_after_morecore_hook=
-
-# * `erl_xcomp_bigendian' - `yes|no'. No default. If `yes', the target system
-# must be big endian. If `no', little endian. This can often be
-# automatically detected, but not always. If not automatically detected,
-# `configure' will fail unless this variable is set. Since no default
-# value is used, `configure' will try to figure this out automatically.
-#erl_xcomp_bigendian=
-
-# * `erl_xcomp_double_middle` - `yes|no`. No default. If `yes`, the
-# target system must have doubles in "middle-endian" format. If
-# `no`, it has "regular" endianness. This can often be automatically
-# detected, but not always. If not automatically detected,
-# `configure` will fail unless this variable is set. Since no
-# default value is used, `configure` will try to figure this out
-# automatically.
-#erl_xcomp_double_middle_endian
-
-# * `erl_xcomp_clock_gettime_cpu_time' - `yes|no'. Defaults to `no'. If `yes',
-# the target system must have a working `clock_gettime()' implementation
-# that can be used for retrieving process CPU time.
-#erl_xcomp_clock_gettime_cpu_time=
-
-# * `erl_xcomp_getaddrinfo' - `yes|no'. Defaults to `no'. If `yes', the target
-# system must have a working `getaddrinfo()' implementation that can
-# handle both IPv4 and IPv6.
-#erl_xcomp_getaddrinfo=
-
-# * `erl_xcomp_gethrvtime_procfs_ioctl' - `yes|no'. Defaults to `no'. If `yes',
-# the target system must have a working `gethrvtime()' implementation and
-# is used with procfs `ioctl()'.
-#erl_xcomp_gethrvtime_procfs_ioctl=
-
-# * `erl_xcomp_dlsym_brk_wrappers' - `yes|no'. Defaults to `no'. If `yes', the
-# target system must have a working `dlsym(RTLD_NEXT, <S>)' implementation
-# that can be used on `brk' and `sbrk' symbols used by the `malloc()'
-# implementation in use, and by this track the `malloc()' implementations
-# core memory usage. This is currently only used by unsupported features.
-#erl_xcomp_dlsym_brk_wrappers=
-
-# * `erl_xcomp_kqueue' - `yes|no'. Defaults to `no'. If `yes', the target
-# system must have a working `kqueue()' implementation that returns a file
-# descriptor which can be used by `poll()' and/or `select()'. If `no' and
-# the target system has not got `epoll()' or `/dev/poll', the kernel-poll
-# feature will be disabled.
-#erl_xcomp_kqueue=
-
-# * `erl_xcomp_linux_clock_gettime_correction' - `yes|no'. Defaults to `yes' on
-# Linux; otherwise, `no'. If `yes', `clock_gettime(CLOCK_MONOTONIC, _)' on
-# the target system must work. This variable is recommended to be set to
-# `no' on Linux systems with kernel versions less than 2.6.
-#erl_xcomp_linux_clock_gettime_correction=
-
-# * `erl_xcomp_linux_nptl' - `yes|no'. Defaults to `yes' on Linux; otherwise,
-# `no'. If `yes', the target system must have NPTL (Native POSIX Thread
-# Library). Older Linux systems have LinuxThreads instead of NPTL (Linux
-# kernel versions typically less than 2.6).
-#erl_xcomp_linux_nptl=
-
-# * `erl_xcomp_linux_usable_sigaltstack' - `yes|no'. Defaults to `yes' on Linux;
-# otherwise, `no'. If `yes', `sigaltstack()' must be usable on the target
-# system. `sigaltstack()' on Linux kernel versions less than 2.4 are
-# broken.
-#erl_xcomp_linux_usable_sigaltstack=
-
-# * `erl_xcomp_linux_usable_sigusrx' - `yes|no'. Defaults to `yes'. If `yes',
-# the `SIGUSR1' and `SIGUSR2' signals must be usable by the ERTS. Old
-# LinuxThreads thread libraries (Linux kernel versions typically less than
-# 2.2) used these signals and made them unusable by the ERTS.
-#erl_xcomp_linux_usable_sigusrx=
-
-# * `erl_xcomp_poll' - `yes|no'. Defaults to `no' on Darwin/MacOSX; otherwise,
-# `yes'. If `yes', the target system must have a working `poll()'
-# implementation that also can handle devices. If `no', `select()' will be
-# used instead of `poll()'.
-erl_xcomp_poll=no
-
-# * `erl_xcomp_putenv_copy' - `yes|no'. Defaults to `no'. If `yes', the target
-# system must have a `putenv()' implementation that stores a copy of the
-# key/value pair.
-#erl_xcomp_putenv_copy=
-
-# * `erl_xcomp_reliable_fpe' - `yes|no'. Defaults to `no'. If `yes', the target
-# system must have reliable floating point exceptions.
-#erl_xcomp_reliable_fpe=
-
-# * `erl_xcomp_ose_ldflags_pass1` - Linker flags for the OSE module (pass 1)
-erl_xcomp_ose_ldflags_pass1="-r --no-omagic"
-
-# * `erl_xcomp_ose_ldflags_pass2` - Linker flags for the OSE module (pass 2)
-erl_xcomp_ose_ldflags_pass2="-n --emit-relocs -ecrt0_lm --no-omagic"
-
-# * `erl_xcomp_ose_OSEROOT` - OSE installation root directory
-erl_xcomp_ose_OSEROOT="$OSEROOT"
-
-# * `erl_xcomp_ose_STRIP` - Strip utility shipped with the OSE distribution
-erl_xcomp_ose_STRIP="$GCCROOT/bin/$GCCTARGET-strip"
-
-# * `erl_xcomp_ose_LM_POST_LINK` - OSE postlink tool
-erl_xcomp_ose_LM_POST_LINK="$OSEROOT/bin/$HOST/lm_post_link"
-
-# * `erl_xcomp_ose_LM_SET_CONF` - OSE load module configuration tool
-erl_xcomp_ose_LM_SET_CONF="$OSEROOT/bin/$HOST/lm_set_conf"
-
-# * `erl_xcomp_ose_LM_GET_CONF` - OSE load module elf size tool
-erl_xcomp_ose_LM_ELF_SIZE="$OSEROOT/bin/$HOST/lm_elf_size"
-
-# * `erl_xcomp_ose_LM_LCF` - OSE load module linker configuration file
-erl_xcomp_ose_LM_LCF="${ERL_TOP}/erts/emulator/sys/ose/gcc_lm_x86_$GCCVERSION.lcf"
-
-# * `erl_xcomp_ose_LM_CONF` - OSE load module default configuration file
-erl_xcomp_ose_LM_CONF="${ERL_TOP}/erts/emulator/sys/ose/default.lmconf"
-
-## -----------------------------------------------------------------------------
diff --git a/xcomp/erl-xcomp-vars.sh b/xcomp/erl-xcomp-vars.sh
index 0443867341..e864f7b96b 100644
--- a/xcomp/erl-xcomp-vars.sh
+++ b/xcomp/erl-xcomp-vars.sh
@@ -27,4 +27,4 @@
# and precious variables in $ERL_TOP/erts/aclocal.m4.
#
-erl_xcomp_vars="erl_xcomp_sysroot erl_xcomp_isysroot erl_xcomp_bigendian erl_xcomp_double_middle_endian erl_xcomp_linux_clock_gettime_correction erl_xcomp_linux_nptl erl_xcomp_linux_usable_sigusrx erl_xcomp_linux_usable_sigaltstack erl_xcomp_poll erl_xcomp_kqueue erl_xcomp_putenv_copy erl_xcomp_reliable_fpe erl_xcomp_getaddrinfo erl_xcomp_gethrvtime_procfs_ioctl erl_xcomp_clock_gettime_cpu_time erl_xcomp_after_morecore_hook erl_xcomp_dlsym_brk_wrappers erl_xcomp_posix_memalign erl_xcomp_ose_ldflags_pass1 erl_xcomp_ose_ldflags_pass2 erl_xcomp_ose_OSEROOT erl_xcomp_ose_STRIP erl_xcomp_ose_LM_POST_LINK erl_xcomp_ose_LM_SET_CONF erl_xcomp_ose_LM_GET_CONF erl_xcomp_ose_LM_ELF_SIZE erl_xcomp_ose_LM_LCF erl_xcomp_ose_BEAM_LM_CONF erl_xcomp_ose_EPMD_LM_CONF erl_xcomp_ose_RUN_ERL_LM_CONF erl_xcomp_ose_CONFD erl_xcomp_ose_CRT0_LM"
+erl_xcomp_vars="erl_xcomp_sysroot erl_xcomp_isysroot erl_xcomp_bigendian erl_xcomp_double_middle_endian erl_xcomp_linux_clock_gettime_correction erl_xcomp_linux_nptl erl_xcomp_linux_usable_sigusrx erl_xcomp_linux_usable_sigaltstack erl_xcomp_poll erl_xcomp_kqueue erl_xcomp_putenv_copy erl_xcomp_reliable_fpe erl_xcomp_getaddrinfo erl_xcomp_gethrvtime_procfs_ioctl erl_xcomp_clock_gettime_cpu_time erl_xcomp_after_morecore_hook erl_xcomp_dlsym_brk_wrappers erl_xcomp_posix_memalign"