From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4205 invoked by alias); 13 Feb 2008 00:16:21 -0000 Received: (qmail 4175 invoked by uid 367); 13 Feb 2008 00:16:21 -0000 Date: Wed, 13 Feb 2008 00:16:00 -0000 Message-ID: <20080213001621.4158.qmail@sourceware.org> From: cagney@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: frysk.sys.Tid returns a ProcessIdentifier. X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: f0e1d0ce0f3e015de79f183f90533865aad6fc7c X-Git-Newrev: dc39ca4ad561e54129250ab87bf412f8aaf2c802 Mailing-List: contact frysk-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-cvs-owner@sourceware.org Reply-To: frysk@sourceware.org X-SW-Source: 2008-q1/txt/msg00205.txt.bz2 The branch, master has been updated via dc39ca4ad561e54129250ab87bf412f8aaf2c802 (commit) from f0e1d0ce0f3e015de79f183f90533865aad6fc7c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit dc39ca4ad561e54129250ab87bf412f8aaf2c802 Author: Andrew Cagney Date: Tue Feb 12 19:09:57 2008 -0500 frysk.sys.Tid returns a ProcessIdentifier. frysk-core/frysk/event/ChangeLog 2008-02-12 Andrew Cagney * EventLoop.java: Update to match frysk.sys.Tid. * EventLoopTestBed.java: Ditto. frysk-sys/frysk/sys/ChangeLog 2008-02-12 Andrew Cagney * Tid.java: Return a ProcessIdentifier. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/event/ChangeLog | 5 +++++ frysk-core/frysk/event/EventLoop.java | 22 ++++++++++------------ frysk-core/frysk/event/EventLoopTestBed.java | 8 ++++---- frysk-core/frysk/proc/live/LinuxPtraceHost.java | 2 +- frysk-sys/frysk/sys/ChangeLog | 2 ++ frysk-sys/frysk/sys/Tid.java | 11 +++++++---- frysk-sys/frysk/sys/cni/Poll.cxx | 5 +++-- frysk-sys/frysk/sys/cni/Tid.cxx | 5 ++--- 8 files changed, 34 insertions(+), 26 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/event/ChangeLog b/frysk-core/frysk/event/ChangeLog index b1870c2..1c234d1 100644 --- a/frysk-core/frysk/event/ChangeLog +++ b/frysk-core/frysk/event/ChangeLog @@ -1,3 +1,8 @@ +2008-02-12 Andrew Cagney + + * EventLoop.java: Update to match frysk.sys.Tid. + * EventLoopTestBed.java: Ditto. + 2008-02-06 Teresa Thomas * ProcEvent.java: New. diff --git a/frysk-core/frysk/event/EventLoop.java b/frysk-core/frysk/event/EventLoop.java index e44212e..22630c0 100644 --- a/frysk-core/frysk/event/EventLoop.java +++ b/frysk-core/frysk/event/EventLoop.java @@ -1,6 +1,6 @@ // This file is part of the program FRYSK. // -// Copyright 2005, 2006, 2007, Red Hat Inc. +// Copyright 2005, 2006, 2007, 2008, Red Hat Inc. // // FRYSK is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by @@ -39,6 +39,7 @@ package frysk.event; +import frysk.sys.ProcessIdentifier; import frysk.sys.Signal; import frysk.sys.Tid; import frysk.sys.WaitBuilder; @@ -100,29 +101,26 @@ public abstract class EventLoop * EventLoop thread modifies any of the event queues, the event * thread will need to be woken up using a Signal.IO. */ - private int tid = -1; // can change once - final boolean isCurrentThread() - { - if (tid == -1) { + private ProcessIdentifier tid = null; // can change once + final boolean isCurrentThread() { + if (tid == null) { updateTid(); return true; } return tid == Tid.get(); } - private void wakeupBlockedEventLoop() - { + private void wakeupBlockedEventLoop() { // Some how got into a state where both the event-loop is // running (isGoingToBlock) and the event-loop thread-id // wasn't set. - if (tid <= 0) + if (tid == null) throw new RuntimeException ("EventLoop.tid botch"); Signal.IO.tkill(tid); } private Exception firstSet; - private void updateTid() - { - int newTid = Tid.get(); - if (tid <= 0) { + private void updateTid() { + ProcessIdentifier newTid = Tid.get(); + if (tid == null) { firstSet = new Exception(); tid = newTid; return; diff --git a/frysk-core/frysk/event/EventLoopTestBed.java b/frysk-core/frysk/event/EventLoopTestBed.java index 7183c89..a745e38 100644 --- a/frysk-core/frysk/event/EventLoopTestBed.java +++ b/frysk-core/frysk/event/EventLoopTestBed.java @@ -1,6 +1,6 @@ // This file is part of the program FRYSK. // -// Copyright 2005, 2007, Red Hat Inc. +// Copyright 2005, 2007, 2008, Red Hat Inc. // // FRYSK is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by @@ -41,6 +41,7 @@ package frysk.event; import frysk.sys.Signal; import frysk.sys.Tid; +import frysk.sys.ProcessIdentifier; import frysk.junit.TestCase; /** @@ -51,7 +52,7 @@ abstract class EventLoopTestBed extends TestCase { private EventLoop eventLoop; - private int eventTid; + private ProcessIdentifier eventTid; /** * Return the event loop to be tested. @@ -62,8 +63,7 @@ abstract class EventLoopTestBed * Re-create the event loop ready for the next test. Always * include a CNTRL-C handler so that the tests can be aborted. */ - public void setUp () - { + public void setUp() { eventLoop = newEventLoop (); eventLoop.add(new SignalEvent(Signal.INT) { public void execute () { diff --git a/frysk-core/frysk/proc/live/LinuxPtraceHost.java b/frysk-core/frysk/proc/live/LinuxPtraceHost.java index 2c35ee8..bd83b53 100644 --- a/frysk-core/frysk/proc/live/LinuxPtraceHost.java +++ b/frysk-core/frysk/proc/live/LinuxPtraceHost.java @@ -257,7 +257,7 @@ public class LinuxPtraceHost extends LiveHost { ProcessIdentifier pid = Fork.ptrace(stdin, stdout, stderr, args); // See if the Host knows about this task. - TaskId myTaskId = new TaskId(Tid.get()); + TaskId myTaskId = new TaskId(Tid.get().intValue()); Task myTask = get(myTaskId); if (myTask == null) { // If not, find this process and add this task to it. diff --git a/frysk-sys/frysk/sys/ChangeLog b/frysk-sys/frysk/sys/ChangeLog index 1083782..fbec901 100644 --- a/frysk-sys/frysk/sys/ChangeLog +++ b/frysk-sys/frysk/sys/ChangeLog @@ -1,5 +1,7 @@ 2008-02-12 Andrew Cagney + * Tid.java: Return a ProcessIdentifier. + * Pid.java: Return a ProcessIdentifier. * cni/Ptrace.cxx: Delete. diff --git a/frysk-sys/frysk/sys/Tid.java b/frysk-sys/frysk/sys/Tid.java index 746676a..c8a9bce 100644 --- a/frysk-sys/frysk/sys/Tid.java +++ b/frysk-sys/frysk/sys/Tid.java @@ -1,6 +1,6 @@ // This file is part of the program FRYSK. // -// Copyright 2005, Red Hat Inc. +// Copyright 2005, 2008, Red Hat Inc. // // FRYSK is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by @@ -43,10 +43,13 @@ package frysk.sys; * Get task (thread) information. */ -public final class Tid -{ +public final class Tid { /** * Returns the thread ID of this thread/task. */ - public static native int get (); + public static ProcessIdentifier get() { + return ProcessIdentifierFactory.create(tid()); + } + // XXX: Used by poll. + static native int tid(); } diff --git a/frysk-sys/frysk/sys/cni/Poll.cxx b/frysk-sys/frysk/sys/cni/Poll.cxx index 4af2357..b5c7735 100644 --- a/frysk-sys/frysk/sys/cni/Poll.cxx +++ b/frysk-sys/frysk/sys/cni/Poll.cxx @@ -55,6 +55,7 @@ _syscall2(int, tkill, pid_t, tid, int, sig); #include #include "frysk/sys/cni/Errno.hxx" +#include "frysk/sys/ProcessIdentifier.h" #include "frysk/sys/Tid.h" #include "frysk/sys/Poll.h" #include "frysk/sys/Signal.h" @@ -79,7 +80,7 @@ handler (int signum, siginfo_t *siginfo, void *context) // For what ever reason, the signal can come in on the wrong thread. // When that occures, re-direct it (explicitly) to the thread that // can handle the signal. - pid_t me = frysk::sys::Tid::get (); + pid_t me = frysk::sys::Tid::tid(); if (poll_jmpbuf.tid == me) { #if 0 fprintf (stderr, "pid %d got signal %d (%s) from %d\n", @@ -190,7 +191,7 @@ frysk::sys::Poll::poll (frysk::sys::PollBuilder* pollObserver, // setjmp, re-starting this code, forcing the poll (even if it // wasn't reached) to be canceled. - poll_jmpbuf.tid = frysk::sys::Tid::get (); + poll_jmpbuf.tid = frysk::sys::Tid::tid(); errno = ::pthread_sigmask (SIG_UNBLOCK, &mask, 0); if (errno != 0) throwErrno (errno, "pthread_sigmask.UNBLOCK"); diff --git a/frysk-sys/frysk/sys/cni/Tid.cxx b/frysk-sys/frysk/sys/cni/Tid.cxx index 660edd6..dd2b337 100644 --- a/frysk-sys/frysk/sys/cni/Tid.cxx +++ b/frysk-sys/frysk/sys/cni/Tid.cxx @@ -1,6 +1,6 @@ // This file is part of the program FRYSK. // -// Copyright 2005, Red Hat Inc. +// Copyright 2005, 2008, Red Hat Inc. // // FRYSK is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by @@ -49,7 +49,6 @@ _syscall0(pid_t,gettid) #include "frysk/sys/Tid.h" jint -frysk::sys::Tid::get () -{ +frysk::sys::Tid::tid() { return ::gettid (); } hooks/post-receive -- frysk system monitor/debugger