DCMD_PROC_THREADCTL

Perform a ThreadCtl() on another process/thread.

#include <sys/procfs.h>

#define DCMD_PROC_THREADCTL   __DIOTF(_DCMD_PROC, __PROC_SUBCMD_PROCFS + 27, procfs_threadctl)

The arguments to devctl() are:

Argument Value
filedes A file descriptor for the process.
dcmd DCMD_PROC_THREADCTL
dev_data_ptr A pointer to a procfs_threadctl structure
n_bytes sizeof(procfs_threadctl)
dev_info_ptr NULL

The argument is a pointer to a procfs_threadctl structure. For example:

procfs_threadctl    tctl;

tctl.tid = tid;
tctl.cmd = _NTO_TCTL_NAME;

tn = (struct _thread_name *)(&tctl.data);
tn->name_buf_len = sizeof(tctl.data) - sizeof(*tn);

//We can only communicate a maximum buffer size via devctl
if( newname_len > tn->name_buf_len || prevname_len >
    tn->name_buf_len) {
    return E2BIG;
}

tn->new_name_len = newname_len;
if(newname_len > 0) {
    memcpy(tn->name_buf, newname, newname_len);
}

devctl(fd, DCMD_PROC_THREADCTL, &tctl, sizeof(tctl), NULL);