Branch: Tag:

2017-09-12

2017-09-12 09:56:13 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.File: Don't preallocate huge read buffers.

It is common for code to attempt to read huge (typically on
the order of 2GB) amounts of data from sources which are
expected to be much smaller. Don't fail the read() due to
there being no memory for the huge buffer.

Fixes multiple build failures.

2017-09-10

2017-09-10 21:03:22 by Arne Goedeke <el@laramies.com>

Stdio.File(): allow reading more than 2GB at once

* use size_t instead of int for the number of bytes to read
* use flags to control the read behavior
* in blocking mode the interpreter lock is only released and re-aquired
once per call

These changes apply both to read(2) and recvmsg(2).

2017-09-01

2017-09-01 12:10:56 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.File(): close() fixes.

Unify low level calls close_fd() and close_fd_quietly() to reduce
code duplication.

Fix error handling in close_fd() and do_close_fd(). POSIX says that
fds are closed on all errors except EINTR, where it is unspecified.
Don't complain about close(2) failing with EBADF if it previously
failed with EINTR.

Ignore close(2) failing with ECONNRESET. This happens on eg FreeBSD
when there is still data pending to be sent and the peer has already
closed the connection.

Fix documentation for the return value of close().

Potential fix for testsuite failures on FreeBSD.

2017-08-08

2017-08-08 22:13:04 by Martin Nilsson <nilsson@fastmail.com>

Remove AIX 3.2 workarounds.

2017-08-06

2017-08-06 13:04:20 by Arne Goedeke <el@laramies.com>

Stdio.File(): allow reading more than 2GB at once

* use size_t instead of int for the number of bytes to read
* use flags to control the read behavior
* in blocking mode the interpreter lock is only released and re-aquired
once per call

These changes apply both to read(2) and recvmsg(2).

2017-07-11

2017-07-11 17:42:09 by Martin Nilsson <nilsson@fastmail.com>

Removed redundant exit code.

2017-06-17

2017-06-17 21:03:24 by Martin Nilsson <nilsson@fastmail.com>

Use fast_clone_object instead of low_clone+call_c_initializers

2017-04-24

2017-04-24 09:57:21 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio: Fixed error handling in do_read() some more.

Read data should not be thrown away due to a later error...

Potential fix for Process.popen() returning zero in some circumstances.

2017-04-23

2017-04-23 08:02:57 by Arne Goedeke <el@laramies.com>

file_read: fixed signal handling

Release interpreter lock later and require it earlier to make sure that
signals are handled correctly.

2017-02-26

2017-02-26 10:45:38 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio: Avoid using readdir_r(3C).

readdir_r() has been marked as deprecated in current glibc, and
is redundant in all modern libc's, where readdir(3C) is thread
safe as long as the same DIR/dirfd is not used in several threads.

2017-01-25

2017-01-25 15:22:32 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Break out sprintf-related stuff from stralloc.h to sprintf.h.

Minor header file cleanup.

2017-01-21

2017-01-21 22:27:53 by Arne Goedeke <el@laramies.com>

byte_buffer: added flags to control growth

The way the buffer growth (exponential or not) can now be controlled by
setting flags. Additionally there is a flag to toggle between standard
realloc and mexec_realloc. This will be used to allocate space for
generating machine code.

2017-01-01

2017-01-01 17:51:41 by Arne Goedeke <el@laramies.com>

Stdio.File(): simplify do_recvmsg

do_recvmsg() had two code paths, one for big reads using dynamic buffer,
one for small reads which used a new string directly. Since we split
string headers and data, this split is not needed anymore. We create
pike strings from buffers directly without reallocation.

2017-01-01 17:51:41 by Arne Goedeke <el@laramies.com>

Stdio.File()->read: optimize buffer size

This change makes sure that the read buffer size will always exactly be
as big as the data we want to read. This usually saves one realloc().

2016-12-31

2016-12-31 17:12:23 by Arne Goedeke <el@laramies.com>

Replace dynamic_buffer API everywhere

This change should be purely cosmetic. It replaces the old
dynamic_buffer API by the corresponding byte_buffer API everywhere.
The wrapper definitions in dynamic_buffer.h will remain for now.

2016-12-31 17:12:22 by Arne Goedeke <el@laramies.com>

dynamic_buffer: use new buffer internally

The API of dynamic_buffer is now a slim swapper around the new buffer
API. This changes many places where the dynamic_buffer internals were
directly used.

2016-12-31 17:12:22 by Arne Goedeke <el@laramies.com>

Stdio.File: simplified read()

2016-12-30

2016-12-30 09:29:45 by Arne Goedeke <el@laramies.com>

Replace dynamic_buffer API everywhere

This change should be purely cosmetic. It replaces the old
dynamic_buffer API by the corresponding byte_buffer API everywhere.
The wrapper definitions in dynamic_buffer.h will remain for now.

2016-12-29

2016-12-29 15:02:35 by Arne Goedeke <el@laramies.com>

Stdio.File: simplified read()

2016-12-29 15:02:35 by Arne Goedeke <el@laramies.com>

dynamic_buffer: use new buffer internally

The API of dynamic_buffer is now a slim swapper around the new buffer
API. This changes many places where the dynamic_buffer internals were
directly used.

2016-12-05

2016-12-05 12:49:06 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio: Survive setsockopt(SO_REUSEPORT) failing with EINVAL.

The Linux emulation layer in MS Windows 10 behaves this way.

Fixes [LysLysKOM 21915643].

2016-12-04

2016-12-04 13:48:20 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio: Survive setsockopt(SO_REUSEPORT) failing with EINVAL.

The Linux emulation layer in MS Windows 10 behaves this way.

Fixes [LysLysKOM 21915643].

2016-11-10

2016-11-10 16:38:44 by Arne Goedeke <el@laramies.com>

Stdio.File: simplified read()

2016-11-08

2016-11-08 12:46:01 by Arne Goedeke <el@laramies.com>

dynamic_buffer: use new buffer internally

The API of dynamic_buffer is now a slim swapper around the new buffer
API. This changes many places where the dynamic_buffer internals were
directly used.

2016-09-15

2016-09-15 14:51:21 by Chris Angelico <rosuav@gmail.com>

Add a 'level' parameter to setsockopt(), and add more constants

2016-09-15 14:51:12 by Chris Angelico <rosuav@gmail.com>

Add set_nodelay() function to Stdio.File objects to control Nagling

2016-09-15 14:51:03 by Chris Angelico <rosuav@gmail.com>

Document the link between set_keepalive and setsockopt

2016-09-15 14:45:40 by Chris Angelico <rosuav@gmail.com>

Implement Stdio.File()->setsockopt()

2016-09-15 14:41:52 by Arne Goedeke <el@laramies.com>

Stdio: added getprotobyname()

2016-08-05

2016-08-05 09:03:56 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio: Added enums File{Mode,Property}Flags.

Also adds corresponding documentation.

Fixes some broken documentation references.

2016-04-08

2016-04-08 19:48:49 by Martin Nilsson <nilsson@fastmail.com>

Removed PTRDIFF_T_TO_LONG

2016-02-24

2016-02-24 15:08:57 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio: Fixed support for second argument to set_buffer().

Fixes [CID 1353480].

2016-02-24 11:47:28 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio: Fixed support for second argument to set_buffer().

Fixes [CID 1353480].

2016-02-12

2016-02-12 13:50:54 by Martin Nilsson <nilsson@fastmail.com>

Removed PTRDIFF_T_TO_LONG

2016-02-11

2016-02-11 20:04:06 by Martin Nilsson <nilsson@fastmail.com>

Everyone have INT64 in C99-land.

2016-01-30

2016-01-30 22:03:07 by Martin Nilsson <nilsson@fastmail.com>

Rewrite MAP_VARIABLE to PIKE_MAP_VARIABLE.

2016-01-29

2016-01-29 23:41:58 by Martin Nilsson <nilsson@fastmail.com>

Since NO_PIKE_SHORTHAND doesn't do much anymore, it isn't needed anywhere.

2016-01-26

2016-01-26 23:56:01 by Martin Nilsson <nilsson@fastmail.com>

Removed << on file object. Has been deprecated a while and not properly working always.

2016-01-26 21:08:15 by Martin Nilsson <nilsson@fastmail.com>

SIMPLE_TOO_FEW_ARGS_ERROR should be SIMPLE_WRONG_NUM_ARGS_ERROR since long ago. Replaced them and tighten up argument control in places.

2016-01-26 19:38:42 by Martin Nilsson <nilsson@fastmail.com>

SIMPLE_BAD_ARG_ERROR is only kept for compatibility, but we still had 500+ uses of it.

2015-11-25

2015-11-25 13:43:21 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Build: Fixed quite a few warnings about unused arguments.

2015-11-16

2015-11-16 00:44:43 by Martin Nilsson <nilsson@fastmail.com>

Don't clean up the stack in void functions.

2015-10-18

2015-10-18 01:39:52 by Martin Nilsson <nilsson@fastmail.com>

dmalloc.h is included from global.h

2015-10-18 01:08:46 by Martin Nilsson <nilsson@fastmail.com>

sys/types.h is included from global.h

2015-10-14

2015-10-14 21:25:02 by Martin Nilsson <nilsson@fastmail.com>

Use the existing PTRDIFF_T_TO_LONG

2015-10-14 19:41:28 by Martin Nilsson <nilsson@fastmail.com>

Removed Intel IA64 compiler specific DO_NOT_WARN.

2015-09-27

2015-09-27 04:26:33 by Martin Nilsson <nilsson@fastmail.com>

Start using __builtin_unreachable

2015-08-22

2015-08-22 18:35:10 by Per Hedbor <ph@opera.com>

Static:ified a lot of strings.

This is more or less all instances of push_text(static data here).

Left to do: make_shared_X_string(static data here). :)

2015-08-18

2015-08-18 18:07:49 by Per Hedbor <ph@opera.com>

Static:ified a lot of strings.

This is more or less all instances of push_text(static data here).

Left to do: make_shared_X_string(static data here). :)

2015-05-25

2015-05-25 15:33:02 by Martin Nilsson <nilsson@opera.com>

Removed trailing spaces.

2015-05-04

2015-05-04 04:39:06 by Chris Angelico <rosuav@gmail.com>

Add constants for IP Type Of Service settings

2015-05-04 04:29:07 by Chris Angelico <rosuav@gmail.com>

Add a 'level' parameter to setsockopt(), and add more constants

2015-05-04 03:53:03 by Chris Angelico <rosuav@gmail.com>

Document the link between set_keepalive and setsockopt

2015-05-04 03:53:03 by Chris Angelico <rosuav@gmail.com>

Implement Stdio.File()->setsockopt()

2015-05-04 03:53:03 by Chris Angelico <rosuav@gmail.com>

Add set_nodelay() function to Stdio.File objects to control Nagling

2015-03-16

2015-03-16 17:27:53 by Martin Nilsson <nilsson@opera.com>

Remove deprecated security system.

2014-11-15

2014-11-15 13:42:52 by Stephen R. van den Berg <srb@cuci.nl>

Remove superfluous legacy compat support prior to 7.8.

2014-11-03

2014-11-03 10:12:25 by Martin Nilsson <nilsson@opera.com>

malloc -> calloc

2014-10-28

2014-10-28 16:51:21 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio: Fix compilation issues on OSes without dirfd(3C).

Some operating systems (like eg Solaris 10) do not have dirfd(3C).
Fallback to indexing the DIR with dd_fd or d_fd to get the fd.

2014-10-28 16:48:27 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio: Fix compilation issues on OSes without dirfd(3C).

Some operating systems (like eg Solaris 10) do not have dirfd(3C).
Fallback to indexing the DIR with dd_fd or d_fd to get the fd.

2014-10-19

2014-10-19 12:24:43 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Fd: Fixed minor race in write().

There were some (uncommon) cases where the backend poll flags
weren't reset after a successful write.

2014-10-19 12:20:57 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Fd: Fixed minor race in write().

There were some (uncommon) cases where the backend poll flags
weren't reset after a successful write.

2014-10-05

2014-10-05 11:59:41 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: output_to() et al now support functions.

This reduces the need for proxy objects in higher level code
using Stdio.Buffer internally.

Also adds support for subtyped objects and multiple inheritance
of Stdio.Fd et al.

2014-10-05 11:24:16 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Buffer: output_to() et al now support functions.

This reduces the need for proxy objects in higher level code
using Stdio.Buffer internally.

Also adds support for subtyped objects and multiple inheritance
of Stdio.Fd et al.

2014-10-03

2014-10-03 16:16:13 by Per Hedbor <ph@opera.com>

Removed security system (on this branch)

2014-10-02

2014-10-02 16:36:41 by Per Hedbor <ph@opera.com>

Removed MAX_FD configure test

It only returns the current max anyway, which is usually
smaller than the max if you are running as root, and can
also be changed at any time at runtime.

Instead, use sysconf(_SC_OPEN_MAX) when available if needed, and as a
last resort a hardcoded value (on Windows), but as a secondary change
all uses except two was removed:

o Stdio.get_all_active_fd - On systems without /dev/fd and
/proc/self/fd.

o On NT, the size of FD_SET is now set to a hardcoded value (64k).

The rewrite of get_all_active_fd also speeds it up a lot. Not that it
is a frequently used function.

2014-10-02 13:24:01 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.File: More race fixes in connect() [bug 7293].

It seems the backend on Linux sometimes may trigger before the connect(2)
is done with POLLIN and a state where read(2) fails with ENOTCONN.

Reduce the race condition by inhibiting backend callbacks on the
fd during connect(2).

2014-10-01

2014-10-01 16:29:23 by Martin Nilsson <nilsson@opera.com>

Fix warnings

2014-10-01 14:38:48 by Martin Nilsson <nilsson@opera.com>

Stdio.IOBuffer -> Stdio.Buffer (part 2)

2014-10-01 13:51:56 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.File: Fixed race condition in nonblocking connect().

Potential fix for [bug 7293].

2014-09-28

2014-09-28 19:11:31 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.Fd: Map _errno.

Make it possible to set the errno for a Stdio.File from Pike code.

Also added some minimal documentation for the other mapped fields
in Stdio.Fd, as well as moving the documentation for the low-level
functions from Stdio.File to Stdio.Fd.

2014-09-27

2014-09-27 13:03:47 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.File: Support UNDEFINED as the first argument to read().

2014-09-23

2014-09-23 16:04:59 by Arne Goedeke <el@laramies.com>

Stdio.File: removed notify()

This API has never been completed and does not work as advertised.
Also, dnotify has has been superseded by inotify in 2005 which is
supported as System.Inotify.

2014-09-23 10:54:37 by Per Hedbor <ph@opera.com>

Added more direct mapping to seek.

Also added SEEK_DATA and SEEK_HOLE support if they are supported by
the OS (solaris, freebsd, linux).

In order to keep compatibility the SEEK_<whatever> constants are
actually strings.

Deprecated the old seek( offset, multiplier, adder ) version of seek
(which was, according to the documentation, obsolete before year
2000).

2014-09-19

2014-09-19 17:18:23 by Martin Nilsson <nilsson@opera.com>

&x[0] -> x

2014-09-04

2014-09-04 15:57:43 by Arne Goedeke <el@laramies.com>

Merge remote-tracking branch 'origin/8.0' into string_alloc

Conflicts:
src/stralloc.c

2014-09-04 14:31:05 by Martin Nilsson <nilsson@opera.com>

perror test is not used.

2014-09-03

2014-09-03 18:14:04 by Martin Nilsson <nilsson@opera.com>

memcpy is C89 and 4.3BSD

2014-09-03 17:53:37 by Martin Nilsson <nilsson@opera.com>

memset is C89 and 4.3BSD

2014-08-28

2014-08-28 16:52:34 by Chris Angelico <rosuav@gmail.com>

Add set_nodelay() function to Stdio.File objects to control Nagling

2014-08-28 16:46:46 by Chris Angelico <rosuav@gmail.com>

Document the link between set_keepalive and setsockopt

2014-08-28 16:44:12 by Chris Angelico <rosuav@gmail.com>

Implement Stdio.File()->setsockopt()

2014-08-28 13:03:26 by Chris Angelico <rosuav@gmail.com>

Add nodelay() function to Stdio.File objects to control Nagling

2014-08-28 12:03:12 by Per Hedbor <ph@opera.com>

Moved __builtin.IOBuffer to Stdio.IOBuffer (for now)

2014-08-26

2014-08-26 10:24:50 by Per Hedbor <ph@opera.com>

Fixed an issue with the connect argument parsing

2014-08-26 09:37:07 by Per Hedbor <ph@opera.com>

Added support for TCP_FASTOPEN (server and client)

The server support is always enabled if possible, on the client side
it is enabled if you pass an additional argument to connect (see the documentation).

2014-08-25

2014-08-25 18:29:35 by Martin Nilsson <nilsson@opera.com>

More consistent use of error macros.

2014-08-25 16:31:51 by Martin Nilsson <nilsson@opera.com>

Consistent formatting of function name parameter to get_all_args

2014-07-12

2014-07-12 09:11:55 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.File: Improved documentation of write().

Restructured and more details about behaviour in nonblocking mode.

2014-05-26

2014-05-26 16:37:00 by Martin Nilsson <nilsson@opera.com>

Fixed some misfirings from Pers script.

2014-05-26 15:31:21 by Per Hedbor <ph@opera.com>

Removed a few casts

2014-05-23

2014-05-23 19:48:31 by Arne Goedeke <el@laramies.com>

Stdio: use -Os for file.c with gcc

gcc -O3 generates extremely bloated code for functions in file.c, even
though it makes no sense to unroll the loop around open(2).

2014-05-22

2014-05-22 16:49:17 by Per Hedbor <ph@opera.com>

Binary size: push_constant_text -> push_text when not time-critical.

Especially in error handling, and code that does a lot of other string
operations anyway the speed gain is not wort the 100+ bytes code size
of each instance of push_constant_text

This saves about 20K of code size (main pike binary), while not really
changing the speed much.

push_constant_text that seemed to be in at least pseudo-time-critical
code was kept as they were.

On a related note, push_constant_text(":") four times in a row creates
four different string variables, for obvious reasons.

Some of the remaining push_constant_text really should have a
module/file local string variable, even though that is more bothersome
to create.

It might be nice to have this in .cmod files automatically.

2014-05-12

2014-05-12 21:08:22 by Arne Goedeke <el@laramies.com>

Stdio: use -Os for file.c with gcc

gcc -O3 generates extremely bloated code for functions in file.c, even
though it makes no sense to unroll the loop around open(2).

2014-04-27

2014-04-27 21:18:05 by Martin Nilsson <nilsson@opera.com>

memset takes void* as first argument, no casting needed.

2014-04-27 20:37:42 by Martin Nilsson <nilsson@opera.com>

mallocs nowdays return void*, so no need to case.

2014-04-27 18:31:29 by Martin Nilsson <nilsson@opera.com>

Free takes void* and doesn't need any cast anymore.

2014-03-03

2014-03-03 19:47:52 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio: Added File()->get_dir().

Added function for getting the directory contents relative to an open
file.

2014-02-26

2014-02-26 12:41:33 by Per Hedbor <ph@opera.com>

Merge branch '8.0' into per/rdrnd

2014-02-26 10:47:23 by Arne Goedeke <el@laramies.com>

undefined variable in debug mode

2014-02-25

2014-02-25 14:31:54 by Per Hedbor <ph@opera.com>

The query_X_callback functions are never added as functions in the low level file

2014-01-12

2014-01-12 02:07:06 by Arne Goedeke <el@laramies.com>

Stdio.File: signed integers don't overflow in C

checking for signed overflow using (r<<1) < r does not work. the purpose
of these checks is a mystery to me, though.

2014-01-05

2014-01-05 15:14:13 by Marcus Comstedt <marcus@mc.pp.se>

Merge branch '8.0' into gobject-introspection

2013-11-13

2013-11-13 16:59:56 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Stdio.File: Fix grantpt() on Solaris (and others?)

grantpt(3C) on Solaris is implemented as fork + exec of
"/usr/lib/pt_chmod". Unfortunately the libc function doesn't bother
clearing the FD_CLOEXEC flag before the exec, so the fd never got
to the helper binary, which caused grantpt(3C) to fail with EPERM.

2013-08-14

2013-08-14 09:24:50 by Marcus Comstedt <marcus@mc.pp.se>

_Stdio: Don't use PIPE_CAPABILITIES if non-existing

2013-06-21

2013-06-21 09:18:55 by Arne Goedeke <el@laramies.com>

Merge remote-tracking branch 'origin/7.9' into pdf

2013-06-17

2013-06-17 21:40:00 by Martin Nilsson <nilsson@opera.com>

Removed auto bignum checks.

2013-06-17 17:14:35 by Martin Nilsson <nilsson@opera.com>

Some tweaks that removes both _Stdio and files from the documentation.

2013-06-17 14:15:28 by Martin Nilsson <nilsson@opera.com>

Rewrite Locale.Charset to Charset

2013-06-14

2013-06-14 15:32:54 by Henrik Grubbström (Grubba) <grubba@grubba.org>

_Stdio: Fixed documentation to be more correct.

2013-06-14 09:40:17 by Martin Nilsson <nilsson@opera.com>

Doc fixes.

2013-06-14 09:10:38 by Martin Nilsson <nilsson@opera.com>

Move documentation to _Stdio.

2013-06-11

2013-06-11 23:50:34 by Arne Goedeke <el@laramies.com>

Merge remote-tracking branch 'origin/7.9' into ba

2013-06-11 10:52:09 by Martin Nilsson <nilsson@opera.com>

Changed some identifiers from files to stdio.

2013-06-11 09:36:48 by Martin Nilsson <nilsson@opera.com>

files -> _Stdio with minimal changes.