mirror of
https://github.com/Perl/perl5.git
synced 2026-01-26 08:38:23 +00:00
amigaos4: better kill() implementation
(the underlying UNIX emulation has changed)
This commit is contained in:
parent
1cd70adfb6
commit
ef2467ad52
@ -181,6 +181,8 @@ This will build the default setup that installs under SDK:local/newlib/lib/
|
||||
=item Add flock() emulation using IDOS->LockRecord thanks to Tony Cook
|
||||
for the suggestion.
|
||||
|
||||
=item Fix issue where kill was using the wrong kind of process ID
|
||||
|
||||
=back
|
||||
|
||||
=item B<27th November 2013>
|
||||
|
||||
@ -89,6 +89,7 @@ struct thread_info
|
||||
int ti_children;
|
||||
pthread_t ti_parent;
|
||||
struct MsgPort *ti_port;
|
||||
struct Process *ti_Process;
|
||||
};
|
||||
|
||||
static struct thread_info pseudo_children[MAX_THREADS];
|
||||
@ -154,6 +155,31 @@ struct child_arg
|
||||
PerlInterpreter *ca_interp;
|
||||
};
|
||||
|
||||
#undef kill
|
||||
|
||||
/* FIXME: Is here's a chance, albeit it small of a clash between our pseudo pid */
|
||||
/* derived from the pthread API and the dos.library pid that newlib kill uses? */
|
||||
/* clib2 used the Process address so there was no issue */
|
||||
|
||||
int amigaos_kill(Pid_t pid, int signal)
|
||||
{
|
||||
int i;
|
||||
Pid_t realpid = pid; // Perhaps we have a real pid from else where?
|
||||
/* Look for our DOS pid */
|
||||
IExec->ObtainSemaphore(&fork_array_sema);
|
||||
for (i = 0; i < MAX_THREADS; i++)
|
||||
{
|
||||
if (pseudo_children[i].ti_pid == pid)
|
||||
{
|
||||
realpid = (Pid_t)IDOS->GetPID(pseudo_children[i].ti_Process,GPID_PROCESS);
|
||||
break;
|
||||
}
|
||||
}
|
||||
IExec->ReleaseSemaphore(&fork_array_sema);
|
||||
/* Allow the C library to work out which signals are realy valid */
|
||||
return kill(realpid,signal);
|
||||
}
|
||||
|
||||
static THREAD_RET_TYPE amigaos4_start_child(void *arg)
|
||||
{
|
||||
|
||||
@ -183,6 +209,7 @@ static THREAD_RET_TYPE amigaos4_start_child(void *arg)
|
||||
nextchild = getnextchild();
|
||||
|
||||
pseudo_children[nextchild].ti_pid = pseudo_id;
|
||||
pseudo_children[nextchild].ti_Process = (struct Process *)IExec->FindTask(NULL);
|
||||
pseudo_children[nextchild].ti_parent =
|
||||
((struct child_arg *)arg)->ca_parent;
|
||||
pseudo_children[nextchild].ti_port =
|
||||
|
||||
@ -41,9 +41,14 @@ char *mystrdup(const char *s);
|
||||
char *convert_path_u2a(const char *filename);
|
||||
char *convert_path_a2u(const char *filename);
|
||||
|
||||
/* signal.h */
|
||||
/* Need Pid_t define to make amigaos.c compile without including config.h */
|
||||
#ifndef Pid_t
|
||||
#define Pid_t pid_t
|
||||
#endif
|
||||
|
||||
// #define SIGQUIT SIGABRT
|
||||
int amigaos_kill(Pid_t pid, int signal);
|
||||
|
||||
#define kill(a,b) amigaos_kill((a),(b))
|
||||
|
||||
void ___makeenviron() __attribute__((constructor));
|
||||
void ___freeenviron() __attribute__((destructor));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user