Age | Commit message (Collapse) | Author |
|
Per H @ Tail-f: The original code here had problems that possibly
only occur if you abuse it for non-INET sockets, but anyway:
a) If the getsockopt for SO_PRIORITY or IP_TOS failed, the actual
requested setsockopt was never even attempted.
b) If {get,set}sockopt for one of IP_TOS and SO_PRIORITY failed,
but ditto for the other worked and that was actually the requested
option, failure was still reported to erlang.
|
|
|
|
When setting file_info it will now correctly set access and
modified time. Previously these entities were swapped.
|
|
|
|
* pan/r14b01-file-driver-fix:
Correct usage of pointer-to-size in unix_efile
|
|
* pan/werl-scrollwheel/OTP-8985:
Teach win_con.c about scroll wheels
|
|
|
|
|
|
|
|
* pan/inet6_corrections/OTP-8969:
Stop using uncertain flags for getaddrinfo()
Teach inet_test_lib to understand enetunreach
Make windows inet_gethost work for ipv6
|
|
The AI_V4MAPPED flag is falling out of grace in modern
IPv6 stacks, for security reasons, e.g. FreeBSD do not
document it any longer. The AI_ADDRCONFIG flag have
got unclear semantics on the same OS.
|
|
|
|
Also close find-handles in altname and other minor corrections to patch
|
|
|
|
Also corrected compressed files on Windows
|
|
|
|
|
|
* jr/windows-file-append:
Fix appending to large files (>4GB) on Windows
OTP-8958
|
|
* bw/win32-file-linking:
Add Win32 support for hard and symbolic file system links
OTP-8955
|
|
* rickard/thr-spec-inet-buf/OTP-8916:
Remove tight restrictions on some options
Thread specific inet driver buffer stack
|
|
Remove tight restrictions on the high_watermark, low_watermark, and
buffer options.
|
|
The inet driver internal buffer stack implementation
has been rewritten in order to reduce lock contention.
|
|
|
|
|
|
|
|
This patch fixes building error of SCTP in FreeBSD 7.1 and later.
See
http://www.erlang.org/cgi-bin/ezmlm-cgi?2:mss:1257:200904:hppnfialjjdlgecdiehe
for the details.
R13A patch for solving a compilation error when building
erts/emulator/drivers/common/inet_drv.c
by Kenji Rikitake 12-APR-2009
Symptom solved by this patch:
When building R13A in FreeBSD 7.1-RELEASE,
the compiler flag
HAVE_STRUCT_SCTP_PADDRPARAMS_SPP_SACKDELAY
is NOT enabled.
Some code in
erts/emulator/drivers/common/inet_drv.c
incorrectly assumes
HAVE_STRUCT_SCTP_PADDRPARAMS_SPP_SACKDELAY
is always true when
HAVE_STRUCT_SCTP_PADDRPARAMS_SPP_FLAGS
is true in config.h.
This assumption causes a compilation error.
|
|
Hard linking requires XP or later and a NTFS formatted drive.
Symbolic linking requires Windows Vista, Windows Server 2008,
Windows 7 or later. Symbolic linking on earlier versions of
Windows will return {error, enotsup}. file:make_link/2,
file:make_sym_link/2 and file:read_link/1 are all implemented.
file:read_file_info/1 does NOT return the number of hard
links on the file as this results in performance problems
for read_file_info/1, however this can be enabled by uncommenting
a few lines of code.
The original path was submitted on 9/2/2009 by Alex Tearse-Doyle.
|
|
Append mode doesn't work for files larger that 4GB on Windows.
Caused by incorrect usage of SetFilePointer in win_efile.c.
Fix uses OVERLAPPED structure to specify write position (EOF).
http://msdn.microsoft.com/en-us/library/aa365747.aspx
Opening file in append mode was also considered, but rejected, because
it might cause backwards incompatibility by limiting applicable
operations on the descriptor.
SetFilePointerEx was not used because it would caused more system calls
than using OVERLAPPED structure.
|
|
When the HTTP packet mode has been enabled for a socket,
the ssl and gen_tcp modules have different error indications
when there is an error while parsing the HTTP header:
ssl:recv(SSLSocket, 0) -> {ok, {http_error, _Str}}
gen_tcp:recv(Socket, 0) -> {error, {http_error, _Str}}
We have decided to change gen_tcp:recv/2 to behave the same
way as ssl:recv/2. That means that there will be always be
an ok tuple if data could be succefully read from the socket,
and an error tuple if there was a read error at the socket level.
|
|
* ms/inet-bug-fixes:
inet: support retrieving MAC address on BSD
inet: fix getservbyname buffer overflow
inet: fix ifr_name buffer overflow
inet: null terminate ifr_name buffer
OTP-8816
|
|
On systems supporting getaddrinfo(), support looking up the MAC
address from inet:ifget/2. The results have the same quirks as with
Linux: if the MAC address is longer than 6 bytes (e.g., fw0 under
Mac OS X), the address is truncated; if the interface does not have
a MAC address (e.g., lo0), an address consisting of 0's is returned.
|
|
* rani/sctp-sndrcvinfo/OTP-8795:
Fix xfer_active close expection for Solaris behaviour
Keep default #sctp_sndrcvinfo{} fields on gen_sctp:send/4
Fill in sinfo_assoc_id in struct sctp_sndrcvinfo for getopt()
Conflicts:
lib/kernel/test/gen_sctp_SUITE.erl
|
|
The assoc_id field was uninitialized causing random answers.
|
|
inet:setopts(S, [{linger,{true,2}}]) returned {error,einval} for
SCTP sockets. The inet_drv had a bug when checking the option size.
|
|
The mem_drv driver was only useful when elib_malloc was
active.
|
|
A long time ago, the Erlang run-time system could be
build with pre-ANSI/ISO-C (K&R) C compilers, but that is
no longer possible. Remove the remaining uses of the
compatibility macros that made it possible that possible.
|
|
The byte holding the length of the interface name for the getservbyname/2
function is used in a signed context and can become negative, causing
the buffer to be overrun. Make the same change for getservbyport/2.
Test case:
inet:getservbyname(list_to_atom(lists:flatten(lists:duplicate(128, "x"))), tcp).
|
|
The byte holding the length of the interface name for the ifget/2
functions is used in a signed context and can become negative,
causing the ifreq.ifr_name buffer to be overrun.
Test case:
inet:ifget(lists:duplicate(128, "x"), [addr]).
|
|
The buffer holding the interface name should be null terminated.
See man 7 socket on Linux or the definition of IFNAMSIZ in net/if.h
on FreeBSD:
Length of interface external name, including terminating '\0'.
|
|
Debug and patch by Per Hedeland for R13B04 on erlang-patches:
Connected UDP (and handling of any other errors in UDP recv())
is broken in passive mode for all SCTP-enabled builds.
|
|
Add an option that atomically tests for the existence of a file and
creates it if the file does not exist, by passing the O_EXCL flag
to open() on Unix and CREATE_NEW flag on Windows. Support for O_EXCL
varies across platforms and filesystems.
{ok, Fd} = file:open("/tmp/foo", [write,exclusive]),
{error, eexist} = file:open("/tmp/foo", [write,exclusive]).
|
|
See dwShareMode on
http://msdn.microsoft.com/en-us/library/aa363858(VS.85).aspx
|
|
Remove redundant "!defined(__WIN32__)". It is used inside
the #else branch of a "#ifdef __WIN32__", so it serves no
useful purpose except to fool unsuspecting readers.
|
|
On some combinations of Montavista Linux running on Cavium Octeon
chips, some socket-related system calls erroneously return negative
numbers other than -1 to indicate errors, but inet_drv.c specifically
compares against -1 to test for errors. The result is that beam dumps
core due to the code treating these negative numbers as success
indicators, as counts/offsets of bytes written, etc. thereby
corrupting its own internal data structures.
To fix this, introduce a portability macro to test the result of
socket system calls. The test remains unchanged on Windows but for
other platforms the macro considers all return values that are less
than zero to be errors.
Though POSIX specifies that errors from these system calls are
indicated by a return value of -1, treating all negative return values
as errors is also safe, as described in detail below. In networking
programming, treating all negative return values from system calls as
errors is very common practice -- see the examples in W. Richard
Stevens's popular and highly lauded network programming books, for
example.
For system calls that return 0 to indicate success, treating all
negative numbers as errors is safe because only 0 is specified to
indicate success. These include:
getsockname
getpeername
getsockopt
gethostname
bind
listen
connect
close
shutdown
Likewise, for system calls that return non-negative numbers to
indicate success, treating all negative numbers as errors is also
safe. These functions typically return signed integers of type
ssize_t, and they treat any parameters of type size_t that cannot fit
within the ssize_t return value, such as numbers of bytes to read or
write, as errors (specifically EINVAL). For example, in the "ERRORS"
section of the man page for writev from several varieties of Linux, it
states that EINVAL is returned when the total length of the I/O is
more than can be expressed by the ssize_t return value.
These calls include:
recv
recvfrom
recvmsg
writev
send
sendto
sendmsg
Finaly, the socket() system call is also similar to these in that it
returns a signed type (int) with all non-negative return values
indicating success, so treating all negative return values as errors
is safe.
|
|
* fm/file-operations:
Update preloaded modules
Add file:advise/4 - a wrapper to the POSIX syscall posix_fadvise
Add file:datasync/1 for syncing file contents only
sys.h: Correct the get_int64() macro
OTP-8637 fm/file-operations
The functions file:advise/4 and file:datasync/1 have been added. (Thanks to
Filipe David Manana.)
|
|
Useful for informing the Operating System about the access pattern
for a file's data, so that it can adapt the caching strategy to
maximize disk IO performance.
|
|
file:datasync/1 invokes the POSIX system call "int fdatasync(int fd)".
This system call is similar to "fsync" but, unlike fsync, it does not
update the metadata associated with the file (like the access time for
example). It's used by many DBMSs (MySQL and SQLite of example) to
increase disk IO performance, as it avoids disk seeks and disk write
operations compared to fsync.
More details on it at:
http://linux.die.net/man/2/fdatasync
An example, from the MySQL source:
http://bazaar.launchpad.net/~mysql/mysql-server/mysql-5.1-telco-6.1/annotate/head%3A/mysys/my_sync.c#L61
This new function just calls fsync on systems not implementing fdatasync.
|
|
|
|
* bg/remove-stray-ose-support:
configure: Remove stray OSE/Delta support
Makefiles: Remove stray OSE/Delta support
kernel tests: Remove stray OSE/Delta support
system tests: Remove stray OSE/Delta support
erl_interface tests: Remove stray OSE/Delta support
epmd: Remove stray OSE/Delta support
epmd: #ifdef out start_epmd() for other platforms than VxWorks
emulator tests: Remove stray OSE/Delta support
emulator: Remove stray OSE/Delta support
emulator: Eliminate #ifdef for sys_tty_reset()
test_server: Remove stray support for OSE/Delta
OTP-8585 bg/remove-stray-ose-support
|
|
|