summaryrefslogtreecommitdiff
path: root/ext/POSIX
Commit message (Collapse)AuthorAgeFilesLines
* avoid truncating time values when long is smaller than time_tTony Cook2012-01-181-2/+2
| | | | | | | | | 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.
* include a package POSIX::SigSetRicardo Signes2011-12-301-0/+8
| | | | | this is mostly for the benefit of the PAUSE indexer, as described in the code comment
* Provide the correct POSIX return value for POSIX::dup2() on Win32.Nicholas Clark2011-12-302-3/+11
| | | | | | | | | | 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.
* Convert POSIX::sleep to an XS wrapper for PerlProc_sleep().Nicholas Clark2011-12-302-2/+9
| | | | | | | | 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.
* Increase $POSIX::VERSION to 1.28Father Chrysostomos2011-12-291-1/+1
|
* Signal handlers must run before sigsuspend returnsLeon Timmermans2011-12-291-0/+4
| | | | | | | | | | 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.
* avoid double defining the POSIX::TCSANOW constant subTony Cook2011-11-282-3/+7
| | | | | | | | | 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.
* Fix hang in ext/POSIX/t/sysconf.t on GNU/HurdPino Toscano2011-11-041-1/+1
| | | | | | | | | | | | | | | | | | | 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
* Correct punctuation in some POSIX error messagesFather Chrysostomos2011-09-172-39/+39
| | | | | | | | | | | 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.
* POSIX::access() doesn't do ENOTDIR on VMS.Craig A. Berry2011-09-171-1/+1
| | | | Even though the underlying error is RMS$_DNF. Go figure.
* Change POSIX::Termios::setattr() to default to TCASNOW, not 0.Nicholas Clark2011-09-131-1/+8
| | | | | | | | 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.
* Remove unneeded fallback definitions of dNOOP, dVAR etc from POSIX.xsNicholas Clark2011-09-131-20/+0
| | | | | | 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.)
* Merge the implementations of POSIX::{asctime,mktime} using ALIAS.Nicholas Clark2011-09-131-34/+18
| | | | | | 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.
* Merge the implementations of POSIX::{access,mkfifo} using ALIAS.Nicholas Clark2011-09-131-7/+8
|
* Merge the implementations of POSIX::{close,dup,tcdrain} using ALIAS.Nicholas Clark2011-09-131-8/+8
| | | | On this platform, this reduces the shared object size by about .5K.
* Add tests for POSIX::{access,close,dup,dup2}.Nicholas Clark2011-09-131-2/+51
|
* In ext/POSIX/t/sysconf.t, make the tests more strict.Nicholas Clark2011-09-131-8/+5
| | | | | | $! 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.
* In ext/POSIX/t/sysconf.t, refactor the API of _check_and_report().Nicholas Clark2011-09-131-24/+18
| | | | The new API removes a lot of code repetition in the callers.
* In various POSIX tests, make better use of Test::More.Nicholas Clark2011-09-133-35/+38
| | | | | Avoid using ok() when alternatives are available, as ok() can't give useful diagnostics on failure.
* Merge the implementations of 11 is*() functions in POSIX using XSANY.Nicholas Clark2011-09-131-154/+74
| | | | | | | 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.
* Merge the implementations of 10 maths functions in POSIX using ALIAS.Nicholas Clark2011-09-131-36/+44
| | | | | | 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.)
* Further tests for POSIX trigonometric and hyperbolic functions.Nicholas Clark2011-09-131-1/+31
|
* Change POSIX::localeconv() to a table-driven implementation.Nicholas Clark2011-09-131-63/+58
| | | | | | This removes a lot of copy-paste code. [with a tweak by Ilmari that removed residual duplication]
* Add tests for POSIX::localeconv().Nicholas Clark2011-09-131-3/+31
|
* Merge the implementations of 2 sets of POSIX functions.Nicholas Clark2011-09-131-15/+14
| | | | | | 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.
* Merge the implementations of 4 sets of POSIX::Termios methods.Nicholas Clark2011-09-131-87/+53
| | | | | | 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.
* Merge the implementations of 2 pairs of POSIX::SigSet methods.Nicholas Clark2011-09-131-11/+14
| | | | | | 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
* Store sigset_t used by POSIX::SigSet directly in the object SV.Nicholas Clark2011-09-132-23/+16
| | | | | | | | | | | | | | 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.
* In POSIX.xs, extract allocate_struct() from POSIX::Termios::new().Nicholas Clark2011-09-131-7/+13
| | | | | The same code will be needed for POSIX::SigSet::new(), so share it as a small static function.
* Add tests for POSIX::SigSet.Nicholas Clark2011-09-131-0/+96
|
* Store struct termios used by POSIX::Termios directly in the object SV.Nicholas Clark2011-09-132-16/+28
| | | | | | | | | | | | | | | | | 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.
* Add tests for POSIX::tc{drain,flow,flush,sendbreak}()Nicholas Clark2011-09-131-0/+18
| | | | | | 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.
* Add tests for POSIX::Termios->setattr().Nicholas Clark2011-09-131-0/+12
| | | | | | 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.
* Add tests for POSIX::Termios->setcc().Nicholas Clark2011-09-131-0/+21
|
* Add tests for POSIX::Termios->get[iocf]flags().Nicholas Clark2011-09-131-0/+33
|
* Add tests for POSIX::Termios->get[io]speed().Nicholas Clark2011-09-131-0/+25
|
* Add tests for passing POSIX::Termios->getcc() out of range subscripts.Nicholas Clark2011-09-131-0/+5
|
* In termios.t, avoid reading uninitialised memory in the tests.Nicholas Clark2011-09-131-22/+39
| | | | | | | | | | 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.
* Refactor ext/POSIX/t/termios.tNicholas Clark2011-09-131-43/+25
| | | | | | | | | | * 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.
* The Borland Chainsaw MassacreSteve Hay2011-09-102-4/+1
| | | | | 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
* Change the synopsis in POSIX.pod to stress use POSIX ();Nicholas Clark2011-09-011-2/+4
| | | | | | 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.
* Generate @POSIX::EXPORT_OK from %reimpl, %replacement and an exception list.Nicholas Clark2011-09-011-59/+5
| | | | | | | 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.
* Test that @POSIX::EXPORT and @POSIX::EXPORT_OK are not inadvertently changed.Nicholas Clark2011-09-011-0/+116
|
* Remove isatty from @POSIX::EXPORT_OK, as it's already in @EXPORT.Nicholas Clark2011-09-011-1/+0
| | | | | | 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.
* Replace use of AutoLoader in POSIX with a custom compilation deferral scheme.Aristotle Pagaltzis2011-09-011-379/+98
|
* In POSIX, improve the diagnostic for the "use $method" instead.Nicholas Clark2011-09-012-2/+3
| | | | | | | | | 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.
* In POSIX, drastically simplify the wrappers for "unimplemented" functions.Aristotle Pagaltzis2011-09-012-341/+105
| | | | | | | | | | | | | | 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).
* In POSIX.pm, modernise package variable style.Aristotle Pagaltzis2011-09-011-9/+8
|
* The more regular POSIX "unimplemented" diagnostics simplify the tests.Nicholas Clark2011-09-011-60/+60
|
* Improvements to the diagnostics for "unimplemented" POSIX functions.Nicholas Clark2011-09-012-44/+44
| | | | | | | | | | | | 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.