Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I want to send a signal to a process group, but up-front I'd like to know if it has a chance of succeeding.

Background: perl abstracts the system call killpg() and warps it into kill() with negative signal numbers. So, if you call kill(-15, $pid), perl translates it to killpg(15, $pid) on systems that support killpg().

Problem is that in order to run killpg(0, $pid), I'd have to call kill(-0, $pid) which is the same as kill(0, $pid) and won't trigger the special killpg(0, $pid) behavior.

So, there's no way to check if a process is up but hasn't called POSIX::setsid() or POSIX::setpgid() yet, causing kill(15, $pid) to succeed but kill(-15, $pid) to fail.

Any way around that? I could roll my own killpg() XS module, but I'd rather have it portable across Unix flavors and, ideally, use something that already comes with perl.


In reply to Perl's kill(): How to check if process group exists? by saintmike

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-04-20 00:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found