#include "unw_nto_internal.h"
#include "os-qnx.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/procfs.h>
#include <sys/neutrino.h>
#include <unistd.h>
static void _cont_thread (int ctl_fd, pthread_t tid)
{
procfs_threadctl tctl =
{
.cmd = _NTO_TCTL_ONE_THREAD_CONT,
.tid = tid
};
memcpy (tctl.data, & (tid), sizeof (tid));
int ret = devctl (ctl_fd, DCMD_PROC_THREADCTL, &tctl, sizeof (tctl), NULL);
if (ret != EOK)
{
Debug (0, "error %d continuing thread %d: %s\n",
ret, tid, strerror (ret));
}
}
void unw_nto_destroy (void *arg)
{
unw_nto_internal_t *uni = (unw_nto_internal_t *)arg;
int ctl_fd = unw_nto_procfs_open_ctl (uni->pid);
if (ctl_fd < 0)
{
Debug (0, "error %d opening procfs ctl file for pid %d: %s\n",
errno, uni->pid, strerror (errno));
free (uni);
return;
}
_cont_thread (ctl_fd, uni->tid);
close (ctl_fd);
free (uni);
}