| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
long is only 32-bits on x64 Win32, but time_t is 64-bits. This was warning:
POSIX.xs(1777) : warning C4244: 'initializing' : conversion from 'time_t' to 'const long', possible loss of data
The check against (time_t)-1 is the approved check from ANSI C 89 and
99.
|
|
|
|
|
| |
this is mostly for the benefit of the PAUSE indexer, as described
in the code comment
|
|
|
|
|
|
|
|
|
|
| |
Microsoft, in their wisdom, chose to ignore the POSIX spec when implementing
their dup2(), and have theirs return 0 on success, instead of the file
descriptor. It seems that no other vendor is this, um, "special", so code
the exception directly, as we don't run Configure on Win32, so there's little
point probing for this.
This resolves RT #98912.
|
|
|
|
|
|
|
|
| |
Previously it was a Perl wrapper for CORE::sleep, converting CORE::sleep's
return value of elapsed time slept into the POSIX return value of seconds
remaining. However, that approach could sometimes return a negative result
if CORE::sleep had slept for more than a second longer than the requested
time.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
The whole point of sigsuspend and pause is to wait until a signal has
arrived, and then return *after* it has been triggered. Currently
delayed/"safe" signals prevent that from happening, which might cause
race conditions.
This patch prevents that (as far as possible) by running the signal
handlers ASAP.
|
|
|
|
|
|
|
|
|
| |
On Win32 which has no native TCSANOW definition this would produce:
Constant subroutine TCSANOW redefined at ../lib/POSIX.pm line -1.
because the macro wasn't defined when building the unknown symbols
table but was defined when building the defined symbols table.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
while compiling perl 5.14.2 on GNU/Hurd, I ran into what it seems a
undefined POSIX behaviour in ext/POSIX/t/sysconf.t.
my $fd = POSIX::open($fifo, O_RDWR)
or skip("could not open $fifo ($!)", 3 * @path_consts_fifo);
according to the POSIX open()[1] about O_RDWR,
The result is undefined if this flag is applied to a FIFO.
.... which is actually our case.
Apparently Linux and *FreeBSD (and maybe also OSes) accept this
behaviour, but on GNU/Hurd this causes the open() call to block
undefinitely. Given there's nothing done with the FIFO if not querying
{,f}pathconf() values, the proposed solution I attached is to change
the opening mode to "O_RDONLY | O_NONBLOCK".
[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html
|
|
|
|
|
|
|
|
|
|
|
| |
Commit fa22ee54 changed some of the POSIX error messages to be more
consistent, but in doing so made many of them grammatically incorrect.
It is almost always incorrect in English to join two independent
clauses with a comma.
I don’t think it’s particularly important that error messages be gram-
matical; I just don’t want them getting worse over time. Hence, I
have not touched those that were already ungrammatical.
|
|
|
|
| |
Even though the underlying error is RMS$_DNF. Go figure.
|
|
|
|
|
|
|
|
| |
0 isn't valid on all operating systems. TCASNOW has the value 0 on most
operating systems, but on Solaris (at least) TCASNOW, TCSADRAIN and
TCSAFLUSH have the same values as the equivalent ioctls, TCSETS, TCSETSW and
TCSETSF. Solaris faults 0, setting errno to EINVAL. This isn't useful as a
default behaviour.
|
|
|
|
|
|
| |
As POSIX.xs is not dual life, we can always rely on these macros being
defined for us in perl.h. (And these days, dual life XS code should let
Devel::PPPort take care of this sort of thing.)
|
|
|
|
|
|
| |
This shares identical code marshaling 6 to 9 input arguments into a
struct tm. However, as the return types differ we have to explicitly code
pushing the return value onto perl's stack.
|
| |
|
|
|
|
| |
On this platform, this reduces the shared object size by about .5K.
|
| |
|
|
|
|
|
|
| |
$! should always be 0 after each call, so test this whether the result is
defined or undefined. Match a defined result against a regex to ensure that
it is an integer, and give better diagnostics if it is not.
|
|
|
|
| |
The new API removes a lot of code repetition in the callers.
|
|
|
|
|
| |
Avoid using ok() when alternatives are available, as ok() can't give useful
diagnostics on failure.
|
|
|
|
|
|
|
| |
is{alnum,alpha,cntrl,digit,graph,lower,print,punct,space,upper,xdigit}
have identical structures, so replace them with one body to marshal
arguments between Perl and C, calling the C library is*() function via
a function pointer stored in the CV's XSANY.
|
|
|
|
|
|
| |
10 functions take a single NV argument and return an NV result. Merging them
reduces the shared object size by over 2K on this platform. (Argument
marshalling code in XS is not free.)
|
| |
|
|
|
|
|
|
| |
This removes a lot of copy-paste code.
[with a tweak by Ilmari that removed residual duplication]
|
| |
|
|
|
|
|
|
| |
Using ALIAS to merge POSIX::sig{pending,suspend} and
POSIX::tc{flow,flush,sendbreak} reduces the size of POSIX.so by about 2K
on this platform.
|
|
|
|
|
|
| |
Using ALIAS to merge cfget[io]speed(), get[cloi]flag(), cfset[io]speed()
and set[cloi]flag() reduces the size of POSIX.so by almost 2K on this
platform.
|
|
|
|
|
|
| |
Using ALIAS to merge addset() with delset() and emptyset() with fillset()
reduces the shared object size, by removing duplicate marshaling code for
arguments and return values. On this platform the saving is over .5K
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously POSIX::SigSet was using the PTROBJ typemap to store a pointer to
a dynamically-allocated sigset_t as an IV (blessed into the class)
This requires an explicit DESTROY to free the dynamic allocation, but fails
badly if any POSIX::SigSet objects exist at ithread clone time, as the
dynamic allocation is not duplicated in the new thread. (DESTROY is called
in both threads, free-from-wrong pool or other jollity occurs.)
Removing dynamic allocation removes the need for a DESTROY method.
This change is analogous to the previous change in POSIX::Termios, and is
made for the same reason.
|
|
|
|
|
| |
The same code will be needed for POSIX::SigSet::new(), so share it as a small
static function.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously POSIX::Termios was using the PTROBJ typemap to store a pointer to
a dynamically-allocated struct termios as an IV (blessed into the class).
This requires an explicit DESTROY to free the dynamic allocation, but fails
badly if any POSIX::Termios objects exist at ithread clone time, as the
dynamic allocation is not duplicated in the new thread. (DESTROY is called
in both threads, free-from-wrong pool or other jollity occurs.)
Removing dynamic allocation removes the need for a DESTROY method.
This introduces a new OPAQUEPTROBJ typemap, but currently doesn't use the
OUTPUT section, as that copies an existing structure, whereas
POSIX::Termios->new() only needs to zero-allocate the right space. Assuming
that this typemap should be of general applicability, it should be moved to
the main typemap file.
|
|
|
|
|
|
| |
We don't want to mess with the user's terminal (as we might mess it up), so
attempt to call each function on a disk file, and verify that it fails with
ENOTTY.
|
|
|
|
|
|
| |
We don't want to mess with the user's terminal (as we might mess it up), so
attempt to call tcsetattr() on a disk file, and verify that it fails with
ENOTTY.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
If no terminal devices are found, or getattr() fails on all of them, then
the struct termios wrapped by the POSIX:Termios object will consist of
initialised memory. In this case, it's not possible to use getcc() or the
other get*() methods on it.
Try harder to find a terminal device - as well as STDIN, STDOUT and STDERR
also try to open the controlling terminal directly.
|
|
|
|
|
|
|
|
|
|
| |
* Only import termios.h functions and constants from POSIX
* Loop over STDIN, STDOUT, STDERR instead of duplicating code.
* Avoid a needless defined? test, as isa_ok() handles undef.
* Switch to done_testing(), which also allows @getters to be inlined and
eliminated.
* The various get*() methods return integer values, so check this.
* Enable warnings.
|
|
|
|
|
| |
Remove support for the Borland C++ compiler on Win32, as agreed here:
http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2011-09/msg00034.html
|
|
|
|
|
|
| |
Explicitly warn that the default of importing everything means that
use POSIX; has to import 553 symbols. Hence it's probably better to use
an explicit import list, or import nothing.
|
|
|
|
|
|
|
| |
This is considerably terser than listing all the entries for @EXPORT_OK
longhand. With this change we can no longer delete from %replacement in
AUTOLOAD(), as import() and load_imports() may be called after AUTOLOAD()
has already been run.
|
| |
|
|
|
|
|
|
| |
This effectively reverts commit d925a710473da185, which added it and
reformatted the source code. isatty was in (the generated) @EXPORT
at that time, hence there was never a need to add it.
|
| |
|
|
|
|
|
|
|
|
|
| |
In the error message, name the POSIX function that was called, as well as
the suggested replacement method. This rephrasing was in the patch
supplied by Aristotle Pagaltzis, but I have retained the existing POSIX
use of :: when describing the method, because given two less than great
choices, I'm inclined to favour retaining the status quo and one change
over two changes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Replace all the subroutines that croak() with a data structure and 8 lines in
POSIX::AUTOLOAD().
[By Aristotle Pagaltzis, with some editing by the committer, and most of his
message changes applied as a previous commit to split apart improvements from
pure refactoring]
This commit eliminates the helper functions POSIX::refef() and
POSIX::unimpl(), which were not part of the documented API, not exported,
and not used in any code outside the core (that is visible to Google
codesearch).
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Suggested by Aristotle Pagaltzis as part of a larger refactoring.
This regularises the text, changing '--use' and ': use' to ', use' to be
consistent, provides a message for POSIX::srand(), and adds ' is' to the
message for POSIX::bsearch().
Most of the diagnostics have been unchanged since perl 5.000. For some,
IO::Handle replaced FileHandle in perl5.003_20 (28757baaaeaa3801).
div and ldiv's messages were improved to also mention % in 2003 by commit
7a6ca5fd18d88091.
|