diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2016-02-17 21:04:18 -0500 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2016-02-19 21:06:09 -0500 |
commit | 38e3b244f46695a70f41e8f8af02147747dff6bf (patch) | |
tree | 954dd32259c94848599881d267c1682744f85d3f /cpan/IPC-SysV | |
parent | 0172e63ff9dbdedac30a79ff56b7e0299d8d8b71 (diff) | |
download | perl-38e3b244f46695a70f41e8f8af02147747dff6bf.tar.gz |
Upgrade to IPC-SysV 2.05.
Diffstat (limited to 'cpan/IPC-SysV')
-rw-r--r-- | cpan/IPC-SysV/SysV.xs | 12 | ||||
-rw-r--r-- | cpan/IPC-SysV/lib/IPC/Msg.pm | 6 | ||||
-rw-r--r-- | cpan/IPC-SysV/lib/IPC/Semaphore.pm | 10 | ||||
-rw-r--r-- | cpan/IPC-SysV/lib/IPC/SharedMem.pm | 6 | ||||
-rw-r--r-- | cpan/IPC-SysV/lib/IPC/SysV.pm | 10 | ||||
-rw-r--r-- | cpan/IPC-SysV/t/ipcsysv.t | 4 |
6 files changed, 28 insertions, 20 deletions
diff --git a/cpan/IPC-SysV/SysV.xs b/cpan/IPC-SysV/SysV.xs index c7db50a392..121a1643b4 100644 --- a/cpan/IPC-SysV/SysV.xs +++ b/cpan/IPC-SysV/SysV.xs @@ -392,10 +392,14 @@ shmat(id, addr, flag) int flag CODE: #ifdef HAS_SHM - void *caddr = SvOK(addr) ? sv2addr(addr) : NULL; - void *shm = (void *) shmat(id, caddr, flag); - ST(0) = shm == (void *) -1 ? &PL_sv_undef - : sv_2mortal(newSVpvn((char *) &shm, sizeof(void *))); + if (id >= 0) { + void *caddr = SvOK(addr) ? sv2addr(addr) : NULL; + void *shm = (void *) shmat(id, caddr, flag); + ST(0) = shm == (void *) -1 ? &PL_sv_undef + : sv_2mortal(newSVpvn((char *) &shm, sizeof(void *))); + } else { + ST(0) = &PL_sv_undef; + } XSRETURN(1); #else Perl_die(aTHX_ PL_no_func, "shmat"); return; diff --git a/cpan/IPC-SysV/lib/IPC/Msg.pm b/cpan/IPC-SysV/lib/IPC/Msg.pm index f4cf099b1f..c2539a4f1e 100644 --- a/cpan/IPC-SysV/lib/IPC/Msg.pm +++ b/cpan/IPC-SysV/lib/IPC/Msg.pm @@ -15,7 +15,7 @@ use strict; use vars qw($VERSION); use Carp; -$VERSION = '2.04'; +$VERSION = '2.05'; # Figure out if we have support for native sized types my $N = do { my $foo = eval { pack "L!", 0 }; $@ ? '' : '!' }; @@ -169,7 +169,7 @@ Returns the system message queue identifier. =item rcv ( BUF, LEN [, TYPE [, FLAGS ]] ) Read a message from the queue. Returns the type of the message read. -See L<msgrcv>. The BUF becomes tainted. +See L<msgrcv(2)>. The BUF becomes tainted. =item remove @@ -193,7 +193,7 @@ or a list of I<name>-I<value> pairs. =item snd ( TYPE, MSG [, FLAGS ] ) Place a message on the queue with the data from C<MSG> and with type C<TYPE>. -See L<msgsnd>. +See L<msgsnd(2)>. =item stat diff --git a/cpan/IPC-SysV/lib/IPC/Semaphore.pm b/cpan/IPC-SysV/lib/IPC/Semaphore.pm index 3bcbfe78ea..7ff6fbca56 100644 --- a/cpan/IPC-SysV/lib/IPC/Semaphore.pm +++ b/cpan/IPC-SysV/lib/IPC/Semaphore.pm @@ -16,7 +16,7 @@ use strict; use vars qw($VERSION); use Carp; -$VERSION = '2.04'; +$VERSION = '2.05'; # Figure out if we have support for native sized types my $N = do { my $foo = eval { pack "L!", 0 }; $@ ? '' : '!' }; @@ -56,7 +56,9 @@ sub id { sub remove { my $self = shift; - (semctl($$self,0,IPC_RMID,0), undef $$self)[0]; + my $result = semctl($$self,0,IPC_RMID,0); + undef $$self; + $result; } sub getncnt { @@ -240,7 +242,7 @@ Returns the system identifier for the semaphore set. C<OPLIST> is a list of operations to pass to C<semop>. C<OPLIST> is a concatenation of smaller lists, each which has three values. The first is the semaphore number, the second is the operation and the last -is a flags value. See L<semop> for more details. For example +is a flags value. See L<semop(2)> for more details. For example $sem->op( 0, -1, IPC_NOWAIT, @@ -293,7 +295,7 @@ of these fields see your system documentation. =head1 SEE ALSO -L<IPC::SysV>, L<Class::Struct>, L<semget>, L<semctl>, L<semop> +L<IPC::SysV>, L<Class::Struct>, L<semget(2)>, L<semctl(2)>, L<semop(2)> =head1 AUTHORS diff --git a/cpan/IPC-SysV/lib/IPC/SharedMem.pm b/cpan/IPC-SysV/lib/IPC/SharedMem.pm index 84f718b8a0..eadb3fc5f9 100644 --- a/cpan/IPC-SysV/lib/IPC/SharedMem.pm +++ b/cpan/IPC-SysV/lib/IPC/SharedMem.pm @@ -15,7 +15,7 @@ use strict; use vars qw($VERSION); use Carp; -$VERSION = '2.04'; +$VERSION = '2.05'; # Figure out if we have support for native sized types my $N = do { my $foo = eval { pack "L!", 0 }; $@ ? '' : '!' }; @@ -235,12 +235,12 @@ of these fields see you system documentation. Permanently attach to the shared memory segment. When a C<IPC::SharedMem> object is attached, it will use L<memread> and L<memwrite> instead of L<shmread> and L<shmwrite> for accessing the shared memory segment. -Returns true if successful, or false on error. See L<shmat>. +Returns true if successful, or false on error. See L<shmat(2)>. =item detach Detach from the shared memory segment that previously has been attached -to. Returns true if successful, or false on error. See L<shmdt>. +to. Returns true if successful, or false on error. See L<shmdt(2)>. =item addr diff --git a/cpan/IPC-SysV/lib/IPC/SysV.pm b/cpan/IPC-SysV/lib/IPC/SysV.pm index 418996550c..883c755f46 100644 --- a/cpan/IPC-SysV/lib/IPC/SysV.pm +++ b/cpan/IPC-SysV/lib/IPC/SysV.pm @@ -18,7 +18,7 @@ use Config; require Exporter; @ISA = qw(Exporter); -$VERSION = '2.04'; +$VERSION = '2.05'; # To support new constants, just add them to @EXPORT_OK # and the C/XS code will be generated automagically. @@ -129,7 +129,7 @@ but your system might have more. =item ftok( PATH, ID ) Return a key based on PATH and ID, which can be used as a key for -C<msgget>, C<semget> and C<shmget>. See L<ftok>. +C<msgget>, C<semget> and C<shmget>. See L<ftok(3)>. If ID is omitted, it defaults to C<1>. If a single character is given for ID, the numeric value of that character is used. @@ -137,14 +137,14 @@ given for ID, the numeric value of that character is used. =item shmat( ID, ADDR, FLAG ) Attach the shared memory segment identified by ID to the address -space of the calling process. See L<shmat>. +space of the calling process. See L<shmat(2)>. ADDR should be C<undef> unless you really know what you're doing. =item shmdt( ADDR ) Detach the shared memory segment located at the address specified -by ADDR from the address space of the calling process. See L<shmdt>. +by ADDR from the address space of the calling process. See L<shmdt(2)>. =item memread( ADDR, VAR, POS, SIZE ) @@ -163,7 +163,7 @@ successful, or false if there is an error. =head1 SEE ALSO -L<IPC::Msg>, L<IPC::Semaphore>, L<IPC::SharedMem>, L<ftok>, L<shmat>, L<shmdt> +L<IPC::Msg>, L<IPC::Semaphore>, L<IPC::SharedMem>, L<ftok(3)>, L<shmat(2)>, L<shmdt(2)> =head1 AUTHORS diff --git a/cpan/IPC-SysV/t/ipcsysv.t b/cpan/IPC-SysV/t/ipcsysv.t index 710555e780..c7a92ed903 100644 --- a/cpan/IPC-SysV/t/ipcsysv.t +++ b/cpan/IPC-SysV/t/ipcsysv.t @@ -24,7 +24,7 @@ elsif ($Config{'d_msg'} ne 'define') { plan(skip_all => '$Config{d_msg} undefined'); } -plan(tests => 38); +plan(tests => 39); # These constants are common to all tests. # Later the sem* tests will import more for themselves. @@ -298,6 +298,8 @@ SKIP: { is(unpack("N", unpack("P4", $addr)), 0xbadc0de5, 'read modified shm by addr'); + is(shmat(-1, undef, 0), undef, 'shmat illegal id fails'); + ok(defined shmdt($addr), 'shmdt'); } |