示例#1
0
文件: proc.c 项目: jananive/gencore
/* Counts the number of threads in the process */
int get_thread_count(int pid)
{
	struct pid_stat p;
	int ret;

	ret = get_pid_stat(pid, &p);
	if (ret)
		return -1;

	return p.__ps_thread_count;
}
示例#2
0
gint get_tpgid(pid_t pid)
{
#ifdef FULL
	g_debug("! Launch get_tpgid() for pid %d", pid);
#endif
	if (pid<1) return 0;

	pid_t tmp_tpgid = 0;
	pid_t current_tpgid = pid;

	while (tmp_tpgid != current_tpgid)
	{
		tmp_tpgid = current_tpgid;
		gchar **stats = get_pid_stat(tmp_tpgid, 11);
		if (stats) current_tpgid = atoi(stats[9]);
		g_strfreev(stats);
	}
	// g_debug("The pid =%d, tpgid=%d", pid, current_tpgid);
	return current_tpgid;
}