FAQ
Reviewers: rsc, rminnich, npe1,

Message:
Hello rsc@golang.org, rminnich@gmail.com, npe@plan9.bell-labs.com (cc:
golang-dev@googlegroups.com),

I'd like you to review this change to
https://go.googlecode.com/hg/


Description:
src/pkg: Fix PID comparison during runtime exit sequence for Plan 9.

The m->procid is a uint64. If this comparison fails (viz., returns true
when really the two ought to be the same), then the process will try
to write an interrupt note to itself, possibly not killing others in its
thread group.

Please review this at http://codereview.appspot.com/6543049/

Affected files:
M src/pkg/runtime/thread_plan9.c


Index: src/pkg/runtime/thread_plan9.c
===================================================================
--- a/src/pkg/runtime/thread_plan9.c
+++ b/src/pkg/runtime/thread_plan9.c
@@ -173,7 +173,7 @@

pid = getpid();
for(m=runtime·atomicloadp(&runtime·allm); m; m=m->alllink)
- if(m->procid != pid)
+ if((int32)m->procid != pid)
runtime·postnote(m->procid, "gointr");
}

Search Discussions

  • Russ Cox at Sep 21, 2012 at 2:32 pm
    This only matters for pids above 2147483647, right? Did you actually
    run into this? I'd rather make getpid return a uint64 and define pid
    as uint64 than need to introduce casts in every comparison. That is,
    the cast is a symptom that something else wasn't declared correctly.

    Russ
  • Seed at Sep 22, 2012 at 10:04 pm
    PTAL.
    On 2012/09/21 14:32:51, rsc wrote:
    This only matters for pids above 2147483647, right? Did you actually
    run into this? I'd rather make getpid return a uint64 and define pid
    as uint64 than need to introduce casts in every comparison. That is,
    the cast is a symptom that something else wasn't declared correctly.
    Russ
    We ran into this because of a difference of opinion about the
    size of `long' between UNIX and Plan 9, while cross-compiling.
    I apologize for the dirty hack. I've updated this to a more
    appropriate solution.

    I agree about getpid; I'll update it in another CL.


    Thanks,
    Akshat



    http://codereview.appspot.com/6543049/
  • Ron minnich at Sep 23, 2012 at 12:03 am
    I like this one much better.

    LGTM.

    ron

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedSep 21, '12 at 1:57p
activeSep 23, '12 at 12:03a
posts4
users3
websitegolang.org

3 users in discussion

Seed: 2 posts Russ Cox: 1 post Ron minnich: 1 post

People

Translate

site design / logo © 2022 Grokbase