Closed Bug 348399 Opened 19 years ago Closed 19 years ago

There is no way to get a PRProcess* from an existing PID

Categories

(NSPR :: NSPR, enhancement)

4.6.2
enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: julien.pierre, Unassigned)

Details

Attachments

(1 file)

NSPR offers some useful portable functions for process manipulation, such as PR_WaitProcess and PR_KillProcess . These functions require a PRProcess* . This is a platform-specific, opaque structure. The only way to currently obtain one of those structures is to create the process from PR_CreateProcess, that is, from the parent process that created the child. In some cases, process manipulation is needed from another process than the immediate parent. I'm proposing a new function : PRProcess* PR_GetProcessFromPID(PRUint64 pid); I believe PRUint64 should be large enough to handle the size of a PID on all our currently supported platforms.
Blocks: 331413
Assignee: wtchang → julien.pierre.bugs
I took a quick stab at fixing this on Solaris. I was able to make PR_KillProcess work on non-child processes, but I can't get PR_WaitProcess to work because the waitpid system call it relies on only operates on child processes.
Attached patch Work in progressSplinter Review
This is a patch that attempts to implement the RFE for Unix pthread platforms, including a test program. Unfortunately, it fails because there is no way to wait for uan unrelated process.
Assignee: julien.pierre.bugs → nobody
No longer blocks: 331413
Marked the bug WONTFIX. It's not easy to design a cross-platform process management API for two reasons. 1. On Unix the SIGCHLD signal is only sent to the parent process, and only the parent process can call one of the wait* functions to reap the terminated child process. 2. It's inappropriate for NSPR (a library) to own the SIGCHILD signal handler, which is process-wide. This is why I stopped further development of the PRProcess API in NSPR. NSPR-based applications may write platform specific code to create and manage processes.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → WONTFIX
Target Milestone: --- → 4.7
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: