threadinfo.c File Reference

Getting thread information - Linux version. More...

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <linux/types.h>
#include <linux/dirent.h>
#include <linux/unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <l4/log/l4log.h>
#include "threadinfo.h"
#include "service.h"
#include "debug.h"

Defines

#define _GNU_SOURCE   1
#define __KERNEL__
#define DIRENT_BUF_SIZE   4096

Functions

int getdents (unsigned int fd, struct dirent *dirp, unsigned int count)
int getdents (uint fd, struct dirent *dirp, uint count)
static int getnum (const char *buf)
 return the number given in buf or -1 if something else
int get_thread_info (thread_t pid, thread_info_t *thread, thread_t *next_pid)
 Return prio and time of a given pid.
int get_thread_name (thread_info_t *thread)
 Return name of a thread, no-op in Linux.
int get_thread_values (load_display_t *disp)
 Read thread-values into load-display struct.


Detailed Description

Getting thread information - Linux version.

Date:
01/19/2004
Author:
Jork Loeser <jork.loeser@inf.tu-dresden.de>

Function Documentation

int get_thread_info ( thread_t  pid,
thread_info_t *  thread,
thread_t *  next_pid 
)

Return prio and time of a given pid.

The Linux version also returns the name of the thread. Therefore, get_thread_name() is a no-op.

This function fills: tid, prio, name, abstime

Parameters:
next_pid ignored
Returns:
-1 on error, 0 else

Referenced by get_thread_values(), and scope_update().

int get_thread_name ( thread_info_t *  thread  ) 

Return name of a thread, no-op in Linux.

Return name of a thread.

Referenced by get_thread_values().

int get_thread_values ( load_display_t *  disp  ) 

Read thread-values into load-display struct.

This function reads the current thread information into the given struct. The entries are read from the /proc filesystem. This functions only modifies the following arguments:

disp->list list of thread-infos, unsorted

Return values:
disp->list_size number of valid elements in list
disp->array array of thread-infos, tid-sorted
disp->array_size number of allocated array-elements
list and array are allocated as needed, reusing previously allocated fields.

Precondition:
Not reentrant, Must not be called in parallel.

References check_list(), get_thread_info(), and getnum().

Referenced by update_values().


Generated on Wed Apr 11 06:39:34 2012 for JTop - Top for DROPS by  doxygen 1.5.6