Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
|
|
|
|
* rickard-sverker/supercarrier/OTP-11149: (29 commits)
erts: Add test case for erts_mmap
erts: Add mutex to init_atoms in erts_mmap.c
erts: Fix lock violation for init_atoms in erl_mmap.c
erts: Fix misc minor bugs in supercarrier initialization
erts: Add erts_mmap stats
erts: Add erts_bld_tupleX macros
erts: Rename erts_bld_atom_uint_2tup_list to *_uword_*
erts: Fix bug in lookup_free_seg
erts: Fix race bug in erts_munmap
erts: Add HARD_DBG_MSEG
erts: Refactor rbt_insert in erl_mmap
erts: erts_mmap improved free seg desc management
erts: Add documentation for +MMsc* system flags
erts: Allow page aligned erts_munmap()
erts: Sort tree in super aligned sizes (SA_SZ_ADDR_ORDER)
erts: Fix ASSERT bug and void* arithmetics
erts: Add mmap argument to erts_debug:get_internal_state
erts: Improve erts_mmap out of free descriptor management
erts: Cleanup erl_mmap
erts: Add __func__ to ERTS_ASSERT macro
...
|
|
Introduce unconditional ERTS_ASSERT
and use that for both ASSERT and ASSERT_EXPR.
|
|
files as delimiters.
While working on a tool that processes Erlang code and testing it against this repo,
I found out about those little sneaky 0xff. I thought it may be of help to other
people build such tools to remove non-conforming-to-standard characters.
|
|
* raimo/fix-signedness-flaws-in-efile_drv:
Fix EV_* macros and functions signedness flaws
|
|
* raimo/linux-network-namespace-sockopt/OTP-11157:
Document socket option 'netns'
Rudimentary test
Make netns option value a string
Implement netns for SCTP + bugfixes
Implement netns option for TCP and UDP
Implement emulator netns support for TCP and UDP
|
|
|
|
The actual port id is used to create a key from the
pointer value which is the ErlDrvPort. To do this
a new driver api function driver_async_port_key is
added and the driver API minor version is updated.
The documentation is updated and the faulty description of
how to spread ports over async threads is updated to
use the new API.
Testcase also added.
|
|
|
|
|
|
|
|
This is needed as some gcc versions seems to optimize this undefined
behaviour in a way which breaks this code.
|
|
|
|
|
|
|
|
Bug introduced in a73414d2e8ad03538 and never released.
|
|
* nox/fix-wcwidth/OTP-11106:
Properly guard WIDE_TAG use with HAVE_WCWIDTH in ttsl_drv
|
|
* rickard/inet_opts/OTP-11075:
Make high_msgq_watermark and low_msgq_watermark generic inet options
Conflicts:
erts/preloaded/ebin/prim_inet.beam
|
|
|
|
* nox/wide-chars/OTP-11088:
Support wide characters in the shell through wcwidth()
Fix bogus DEBUGLOG() incantations in ttsl_drv
|
|
|
|
There is one remaining bug where ttsl_drv's state ends up inconsistent
with the terminal own state; when a wide character is entered on the
last column of the terminal.
Reported-by: Loïc Hoguin
|
|
|
|
|
|
Running some valgrind memory checking showed the error below:
==18040== Thread 6:
==18040== Source and destination overlap in memcpy(0xf3f3f04, 0xf3f3f08, 52)
==18040== at 0x4C2CFA0: memcpy@@GLIBC_2.14 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18040== by 0x5CF527: del_chars (ttsl_drv.c:845)
==18040== by 0x5CED5E: ttysl_from_erlang (ttsl_drv.c:658)
==18040== by 0x4982E3: erts_write_to_port (io.c:1235)
==18040== by 0x49A2BD: erts_port_command (io.c:2223)
==18040== by 0x48C054: do_send (bif.c:1962)
==18040== by 0x48CB6E: erl_send (bif.c:2162)
==18040== by 0x566599: process_main (beam_emu.c:1665)
==18040== by 0x4B1A95: sched_thread_func (erl_process.c:4834)
==18040== by 0x6075E2: thr_wrapper (ethread.c:106)
==18040== by 0x5560E99: start_thread (pthread_create.c:308)
This occurred on Linux using R15B01 while the shell was emitting a prompt,
but the same problem is still present in R16B.
Change the memcpy on line 845 of ttsl_drv.c to memmove as valgrind
suggests. After the change, verify with valgrind that the error no longer
occurs.
|
|
* lukas/erts/efile_delayed_write_fix/OTP-10984:
Do driver_deq in worker threads instead of async_ready
|
|
Doing it in async_ready was needed before the pdl was introduced, but
now with the pdl the deq no longer needs the port lock to protect it.
This was not an issue when async_ready was called in the worker thread,
but now (R15B) that it is signalled back to the scheduler, some very nasty
race conditions could occur when using driver_timer and async jobs.
|
|
|
|
|
|
|
|
* egil/win-efile-bugfix/OTP-10890:
erts: Use correct type for ReadFile bytes read
|
|
|
|
Using a 64bit type for bytes read will not always clear the higher bits.
|
|
* sverk/tcp-exit_on_close-false:
inet_drv: Fix condition to reject INET_REQ_IGNOREFD for UDP and SCTP
A stab at fixing bug with {exit_on_close,false} not working
|
|
|
|
Seems to happen with async threads and when user closes
the file explicitly before the port is closed.
|
|
|
|
when invalid packets are received.
|
|
* pan/fix-compiler-warnings-clang-and-new-gcc:
Fix compiler warnings from GCC 4.7.1 on ARCH Linux
Fix clang compiler warnings on FreeBSD in erts
|
|
|
|
The following are deliberately left, as I have only a list of compiler
warnings and no system to test on:
hipe/hipe_x86_signal.c:264:5: warning: no previous prototype for function '_sigaction' [-Wmissing-prototypes]
int __SIGACTION(int signum, const struct sigaction *act, struct sigaction *oldact)
^
hipe/hipe_x86_signal.c:222:21: note: expanded from macro '__SIGACTION'
^
1 warning generated.
sys/unix/sys_float.c:835:16: warning: declaration of 'struct exception' will not be visible outside of this function [-Wvisibility]
matherr(struct exception *exc)
^
sys/unix/sys_float.c:835:1: warning: no previous prototype for function 'matherr' [-Wmissing-prototypes]
matherr(struct exception *exc)
^
2 warnings generated.
drivers/unix/unix_efile.c:1504:11: warning: implicit declaration of function 'sendfile' [-Wimplicit-function-declaration]
retval = sendfile(in_fd, out_fd, *offset, SENDFILE_CHUNK_SIZE,
^
1 warning generated.
|
|
Also, on 64 bit architectures, use 64 bit int's for the
counters and be specific about the counter variables sizes
utilizing datatypes from sys.h.
|
|
|
|
* pan/R16/redhat_workaround:
Clean up and make the fix work on windows.
Add workaround for CentOS/RedHat writev bug to inet_drv
OTP-10747
|
|
|
|
Some file operations provided by the Erlang file module
didn't open the target file with all the file share flags.
This made some concurrent file operations against the
same file fail on Windows, while on other platforms such
as GNU/Linux or Mac OS X they succeed. The operations will
fail only if they're performed concurrently by different
threads (async IO threads or scheduler threads).
For example, one Erlang process does a file:delete/1 call
while another Erlang process is doing a filelib:file_size/1
call. This made the former process get an eacces error from
the file:delete/1 call. On GNU/Linux or Mac OS X the call would
succeed. Another example is if one Erlang process attempts to
open a file for reading while another one is in the middle of
a file:read_file_info/1 call (after it opened the file and
before it closed the file).
It's easy to verify that if a file is not open with all the
share flags, it's impossible for other threads (even if they
belong to the same OS process) to open the file while the
file is not closed by the first thread.
The following test program shows this:
#include <windows.h>
#include <iostream>
// Must be an existing file
//#define SHARE_FLAGS (FILE_SHARE_READ)
static DWORD WINAPI MyThreadFunction(LPVOID lpParam);
static char *lastError();
int main(int argc, char *argv[])
{
DWORD threadId;
HANDLE threadHandle, hFile;
hFile = CreateFile(FILENAME, GENERIC_READ, SHARE_FLAGS, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE) {
std::cerr << "File open error from main: " <<
lastError() << std::endl;
return 1;
}
std::cout << "Main thread opened file successfully" << std::endl;
threadHandle = CreateThread(NULL, 0, MyThreadFunction, NULL, 0, &threadId);
if (threadHandle == INVALID_HANDLE_VALUE) {
std::cerr << "Thread create error from main: " <<
lastError() << std::endl;
return 1;
}
WaitForSingleObject(threadHandle, INFINITE);
CloseHandle(threadHandle);
CloseHandle(hFile);
return 0;
}
static DWORD WINAPI MyThreadFunction( LPVOID lpParam )
{
HANDLE hFile;
hFile = CreateFile(FILENAME, GENERIC_READ, SHARE_FLAGS, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE) {
std::cerr << "File open error from second thread: " <<
lastError() << std::endl;
return 1;
}
std::cout << "Second thread opened file successfully" << std::endl;
CloseHandle(hFile);
return 0;
}
static char *lastError()
{
static char *buf = NULL;
DWORD dw = GetLastError();
if (buf != NULL) {
LocalFree((LPTSTR) &buf);
}
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, dw, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &buf, 0, NULL);
return buf;
}
Rnning this program with SHARE_FLAGS set to 0 (as efile_fileinfo()
does for e.g.), shows that the second thread is unable to open the
file:
C:\cygwin\home\fdmanana\tmp>touch foo.bar
C:\cygwin\home\fdmanana\tmp>threads_fopen_test.exe
Main thread opened file successfully
File open error from second thread: The process cannot access the
file because it is being used by another process.
Changing the program's SHARE_FLAGS to FILE_SHARE_READ, shows that
both threads are able to open the file:
C:\cygwin\home\fdmanana\tmp>touch foo.bar
C:\cygwin\home\fdmanana\tmp>threads_test.exe
Main thread opened file successfully
Second thread opened file successfully
Same logic applies to opening files for writing or deleting and
renaming files while they're open by some other thread that didn't
specify the flags FILE_SHARE_WRITE and FILE_SHARE_DELETE.
|