summaryrefslogtreecommitdiff
path: root/erts/emulator/beam/erl_unicode.c
Commit message (Collapse)AuthorAgeFilesLines
* erts: Statically allocate trap export entries againJohn Högberg2020-11-131-10/+10
| | | | | Now that we no longer execute code inside them, they no longer need to be allocated at runtime.
* erts: Refactor bif exports to be allocated at start-timeLukas Larsson2020-09-211-10/+10
| | | | | | | | This is needed as BeamAsm needs the export entries to be executable, which means that we need to allocate them. Co-authored-by: John Högberg <john@erlang.org> Co-authored-by: Dan Gudmundsson <dgud@erlang.org>
* Update copyright yearRickard Green2020-03-131-1/+1
|
* Fix error report for large integers in unicode:characters_to_*()Rickard Green2019-10-161-0/+11
|
* Merge branch 'rickard/unicode-bin/OTP-16002' into maintRickard Green2019-09-021-6/+28
|\ | | | | | | | | | | * rickard/unicode-bin/OTP-16002: Update runtime dependency to erts Return heap binary from unicode:characters_to_binary() when result is small
| * Return heap binary from unicode:characters_to_binary() when result is smallRickard Green2019-08-231-6/+28
| |
* | erts: Beautify away #ifdef DEBUGSverker Eriksson2018-09-071-3/+1
|/ | | | | "(void)result" will silence warning about unused variable and compiler will optimize away such unused variables.
* erts: Refactor usage of am_atom_put to ERTS_MAKE_AMSverker Eriksson2018-06-041-5/+5
| | | | | | | | | | and let compiler determine string lengths. These were actually wrong in erl_db.c: count_trap\0 replace_tra select_tra
* Always use sys_memcpy/cmp/etc instead of plain memcpy/cmp/etcJohn Högberg2018-03-091-6/+6
|
* Merge branch 'maint'Rickard Green2018-01-111-35/+117
|\ | | | | | | | | * maint: Fix encoding of filenames in stacktraces
| * Fix encoding of filenames in stacktracesRickard Green2018-01-111-35/+117
| |
| * Revert "Merge branch 'rickard/null-char-filenames/ERL-370/OTP-14543' into maint"Rickard Green2017-10-121-53/+5
| | | | | | | | | | This reverts commit 0717a2194e863f3a78595184ccc5637697f03353, reversing changes made to 71a40658a0cef8b3e25df3a8e48a72d0563a89bf.
| * Don't allow null in filenamesRickard Green2017-09-271-5/+53
| |
* | Disallow NULs in filename-encoded stringsJohn Högberg2018-01-031-12/+2
| | | | | | | | | | | | | | | | Previously we accepted trailing NULs, which was backwards compatible as such usage never resulted in misbehavior in the first place. The downside is that it prevented erts_native_filename_need from returning an accurate number of *actual characters*, needlessly complicating encoding-agnostic code like erts_osenv.
* | Replace the libc environment with a thread-safe emulationJohn Högberg2018-01-031-14/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | putenv(3) and friends aren't thread-safe regardless of how you slice it; a global lock around all environment operations (like before) keeps things safe as far as our own operations go, but we have absolutely no control over what libc or a library dragged in by a driver/NIF does -- they're free to call getenv(3) or putenv(3) without honoring our lock. This commit solves this by setting up an "emulated" environment which can't be touched without going through our interfaces. Third-party libraries can still shoot themselves in the foot but benign uses of os:putenv/2 will no longer risk crashing the emulator.
* | Don't allow null chars in various stringsRickard Green2017-10-111-5/+92
|/ | | | | | | | | | | | | | | | Various places that now reject null chars inside strings - Primitive file operations reject it in filenames. - Primitive environment variable operations reject it in names and values. - os:cmd() reject it in its input. Also '=' characters are rejected by primitive environment variable operations in environment variable names. Documentation has been updated to document null characters in these types of data as invalid. Currently these operations accept null chars at the end of strings, but that will change in the future.
* Update copyright yearRaimo Niskanen2017-05-041-1/+1
|
* erts: Add deallocation veto for magic destructorsSverker Eriksson2017-02-141-1/+2
| | | | | A magic destructor can return 0 and thereby take control and prolong the lifetime of a magic binary.
* Use magic refs for unicode static NIFs trapsRickard Green2017-02-061-8/+4
|
* Add new AtU8 beam chunkJosé Valim2017-01-301-50/+33
| | | | | | | | | | | | | | | The new chunk stores atoms encoded in UTF-8. beam_lib has also been modified to handle the new 'utf8_atoms' attribute while the 'atoms' attribute may be a missing chunk from now on. The binary_to_atom/2 BIF can now encode any utf8 binary with up to 255 characters. The list_to_atom/1 BIF can now accept codepoints higher than 255 with up to 255 characters (thanks to Björn Gustavsson).
* erl_unicode.c: fix integer truncation problemsMikael Pettersson2016-05-051-28/+30
| | | | | | | | | - use Sint for 'left' and Uint for 'pos' - cost_to_proc(): adjust types, remove unused return value - copy_utf8_bin(): return Uint - characters_to_utf8_trap(): remove harmful cast - unicode_characters_to_binary_2(): correct types in debug code - erts_convert_filename_to_encoding(): remove useless cast
* update copyright-yearHenrik Nord2016-03-151-1/+1
|
* erts: Change erl_exit into erts_exitSverker Eriksson2016-02-241-1/+1
| | | | | | | | | | | | | | | | | This is mostly a pure refactoring. Except for the buggy cases when calling erlang:halt() with a positive integer in the range -(INT_MIN+2) to -INT_MIN that got confused with ERTS_ABORT_EXIT, ERTS_DUMP_EXIT and ERTS_INTR_EXIT. Outcome OLD erl_exit(n, ) NEW erts_exit(n, ) ------- ------------------- ------------------------------------------- exit(Status) n = -Status <= 0 n = Status >= 0 crashdump+abort n > 0, ignore n n = ERTS_ERROR_EXIT < 0 The outcome of the old ERTS_ABORT_EXIT, ERTS_INTR_EXIT and ERTS_DUMP_EXIT are the same as before (even though their values have changed).
* Change license text to APLv2Bruce Yinhe2015-06-181-9/+10
|
* Fix conversion of empty string in erts_convert_native_to_filename()Rickard Green2014-05-221-0/+2
|
* erts: Add 'extra' argument to erts_convert_filename_to_encodingSverker Eriksson2013-12-161-7/+10
|
* Merge branch 'sverk/load-nif-unicode'Sverker Eriksson2013-10-161-49/+93
|\ | | | | | | | | | | | | | | | | | | | | | | | | OTP-11408 * sverk/load-nif-unicode: erts: Fix bug in atom to filename conversions Fix open_ddll for win erts, crypto: Support NIF library with unicode filename on windows erts: Factor out erts_convert_filename_to_wchar() erts: Fix compiler warning erts: Fix loading of NIF library with unicode in path erts: Remove unused constant DRIVER_TAB_SIZE
| * erts: Fix bug in atom to filename conversionsSverker Eriksson2013-09-241-17/+42
| | | | | | | | Buggy old code assumed latin1 atoms.
| * erts: Factor out erts_convert_filename_to_wchar()Sverker Eriksson2013-09-191-32/+51
| | | | | | | | from erts_convert_filename_to_encoding()
* | Merge branch 'maint'Sverker Eriksson2013-10-151-0/+3
|\ \ | |/ |/| | | | | Conflicts: erts/preloaded/ebin/erlang.beam
| * erts: erts_mmap supercarrier management and erts_mseg usageRickard Green2013-09-301-0/+3
| | | | | | | | | | | | | | | | * Coalescing and trimming of free segments in supercarrier * Management of super aligned and super unaligned areas in supercarrier * Management of reservation of physical memory * erts_mseg usage of erts_mmap
* | Merge branch 'maint'Patrik Nyblom2013-06-051-2/+2
|\ \ | |/
| * Fix faulty rest on error in unicode:characters_to_listPatrik Nyblom2013-05-021-2/+2
| |
* | erts: Change erlang:open_port spawn to handle unicodeDan Gudmundsson2013-06-031-1/+11
|/ | | | | | Previously only 'spawn_executable' handled unicode input. Also change 'cd' option to always handle unicode. Update open_port documentation and tests
* erts: Use block comments - ansi styleBjörn-Egil Dahlberg2013-03-041-1/+1
|
* Add +pc {latin1|unicode} switch and io:printable_range/0Patrik Nyblom2013-02-181-0/+8
| | | | | | | | | This is the base for implementing configurable ~tp printouts, so that the user can define which characters to view as actually printable in the shell and by io_lib:format. The functionality is neither documented nor used in this commit
* Teach prim_file:set_cwd() to avoid entering non-translatable directoriesBjörn Gustavsson2013-02-111-0/+46
| | | | | | | | | | | | | | | | | We have decided that we don't want to deal with the compilations of prim_file:get_cwd() returning a binary when the current directory name cannot be translated losslessly to a list (i.e. when the run-time system was started with +fnu and the current directory name contains bytes that are not part of a valid UTF-8 sequence). Therefore, if prim_file:set_cwd() is given a binary as the pathname, we will need to check the binary to make sure it can be translated to a list. We will introduce a new BIF, called prim_file:is_translatable/1, which will check both filename encoding mode, and if it is one of Unicode modes, the binary as well. We don't need to do anything special if prim_file:set_cwd() is passed a list.
* Make prim_file skip invalid filenames in unicode modePatrik Nyblom2013-02-111-3/+14
| | | | | | | | | | | | | | | The fix affects list_dir and read_link. Raw filenames are now never produced, just consumed even if +fnu or +fna is used on Linux etc. This also adds the options to get error return or error handler warning messages with +fn{u|a}{i|w|e} as an option to erl. This is still not documented and there needs to be other versions of read_dir and read_link to facilitate reading of all types of filenames and links. A check that we will not change to an invalid directory is also needed.
* Merge branch 'sverk/enc_atom-opt'Sverker Eriksson2013-01-281-2/+2
|\ | | | | | | | | | | * sverk/enc_atom-opt: erts: Optimize atom encoding to use memcpy for pure ascii erts: Refactor erts_atom_get to use ErtsAtomEncoding
| * erts: Refactor erts_atom_get to use ErtsAtomEncodingSverker Eriksson2013-01-251-2/+2
| | | | | | | | instead of 'is_latin1' boolean argument.
* | Update copyright yearsBjörn-Egil Dahlberg2013-01-251-1/+1
|/
* erts: Fix bug in analyze_utf8 causing faulty latin1 detectionSverker Eriksson2013-01-221-2/+2
|
* atom fixes for NIFs and atom_to_binarySverker Eriksson2013-01-161-60/+7
|
* UTF-8 support for distributionRickard Green2013-01-161-24/+115
|
* erts: Change internal representation of atoms to utf8Sverker Eriksson2013-01-081-96/+78
|
* Merge branch 'maint'Björn-Egil Dahlberg2012-08-311-1/+1
|\ | | | | | | | | | | Conflicts: lib/diameter/autoconf/vxworks/sed.general xcomp/README.md
| * Update copyright yearsBjörn-Egil Dahlberg2012-08-311-1/+1
| |
* | Merge branch 'maint'Patrik Nyblom2012-08-201-6/+98
|\ \ | |/ | | | | | | | | | | | | Conflicts: erts/doc/src/erlang.xml erts/preloaded/ebin/init.beam lib/kernel/doc/src/os.xml lib/stdlib/test/filename_SUITE.erl
| * Make get/putenv and erlexec understand UnicodePatrik Nyblom2012-08-141-6/+98
| | | | | | | | | | | | | | | | | | | | Putenv and getenv needs to convert to the proper environment strings in Unicode depending on platform and user settings for filename encoding. Also erlexec needs to pass environment strings in an appropriate way for kernel to pick up. All environment strings on the command line, as well as home directory, is now passed in UTF8 on windows and in whatever encoding you have on Unix, kernel tries to convert all parameters and environments from UTF8 before making strings.
* | erts: Refactor new helper function erts_init_trap_exportSverker Eriksson2012-02-211-60/+19
|/