Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

signal flags not restored #6882

Open
p5pRT opened this issue Oct 30, 2003 · 3 comments
Open

signal flags not restored #6882

p5pRT opened this issue Oct 30, 2003 · 3 comments

Comments

@p5pRT
Copy link

p5pRT commented Oct 30, 2003

Migrated from rt.perl.org#24366 (status was 'open')

Searchable as RT24366$

@p5pRT
Copy link
Author

p5pRT commented Oct 30, 2003

From powerman@sky.net.ua

Created by powerman@sky.net.ua

1. Use POSIX's sigaction() to modify signal flags.
2. Temporary change signal handler using local().
3. After local() signal restored with unmodified flags. :(

use POSIX;
$SIG{NUM50} = sub {};
my $act = bless({}, "POSIX​::SigAction");
sigaction(50, undef, $act);
$act->{FLAGS} |= &POSIX​::SA_RESTART;
sigaction(50, $act);
sigaction(50, undef, $act);
print "SA_RESTART​: ", $act->{FLAGS} & &POSIX​::SA_RESTART ? "yes" : "no", "\n";
{ local $SIG{NUM50}="IGNORE" }
sigaction(50, undef, $act);
print "SA_RESTART​: ", $act->{FLAGS} & &POSIX​::SA_RESTART ? "yes" : "no", "\n";

Probably perl must use sigaction() call to save old handler with flags?

Perl Info

Flags:
    category=core
    severity=high

Site configuration information for perl v5.8.0:

Configured by root at Tue Feb 11 17:22:15 EET 2003.

Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.4.19, archname=i686-linux-thread-multi
    uname='linux home.power 2.4.19 #1 ×ÓË Á×Ç 18 00:22:21 eest 2002 i686 unknown '
    config_args='-Dprefix=/usr -Doptimize= -O3 -march=athlon -mcpu=athlon  -d -e -s -Dinstallprefix=/usr -Dusethreads'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize=' -O3 -march=athlon -mcpu=athlon ',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing'
    ccversion='', gccversion='3.0', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lndbm -ldbm -ldb -ldl -lm -lpthread -lc -lcrypt -lutil
    perllibs=-lnsl -ldl -lm -lpthread -lc -lcrypt -lutil
    libc=/lib/libc-2.2.5.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.2.5'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    


@INC for perl v5.8.0:
    /usr/lib/perl5/5.8.0/i686-linux-thread-multi
    /usr/lib/perl5/5.8.0
    /usr/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi
    /usr/lib/perl5/site_perl/5.8.0
    /usr/lib/perl5/site_perl
    .


Environment for perl v5.8.0:
    HOME=/home/powerman
    LANG=ru_RU.koi8r
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/powerman/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin
    PERL_BADLANG (unset)
    SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Dec 12, 2011

From @Leont

On Thu Oct 30 08​:34​:26 2003, powerman@​sky.net.ua wrote​:

[Please enter your report here]

1. Use POSIX's sigaction() to modify signal flags.
2. Temporary change signal handler using local().
3. After local() signal restored with unmodified flags. :(

use POSIX;
$SIG{NUM50} = sub {};
my $act = bless({}, "POSIX​::SigAction");
sigaction(50, undef, $act);
$act->{FLAGS} |= &POSIX​::SA_RESTART;
sigaction(50, $act);
sigaction(50, undef, $act);
print "SA_RESTART​: ", $act->{FLAGS} & &POSIX​::SA_RESTART ? "yes" :
"no", "\n";
{ local $SIG{NUM50}="IGNORE" }
sigaction(50, undef, $act);
print "SA_RESTART​: ", $act->{FLAGS} & &POSIX​::SA_RESTART ? "yes" :
"no", "\n";

Probably perl must use sigaction() call to save old handler with
flags?

This is asking a lot of special casing. I suspect it's possible to do
this (by using localization magic on the %SIG entries), but I'm not sure
it's really worth it.

Leon

@p5pRT
Copy link
Author

p5pRT commented Dec 12, 2011

The RT System itself - Status changed from 'new' to 'open'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants