GDB (xrefs)
Classes | Macros | Typedefs | Functions | Variables
linux-osdata.c File Reference
#include "common-defs.h"
#include "linux-osdata.h"
#include <sys/types.h>
#include <sys/sysinfo.h>
#include <ctype.h>
#include <utmp.h>
#include <time.h>
#include <unistd.h>
#include <pwd.h>
#include <grp.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "xml-utils.h"
#include "buffer.h"
#include <dirent.h>
#include <sys/stat.h>
#include "filestuff.h"

Go to the source code of this file.

Classes

union  socket_addr
 
struct  osdata_type
 

Macros

#define NAMELEN(dirent)   strlen ((dirent)->d_name)
 
#define MAX_PID_T_STRLEN   (sizeof ("-9223372036854775808") - 1)
 

Typedefs

typedef long long PID_T
 
typedef long long TIME_T
 

Functions

int linux_common_core_of_thread (ptid_t ptid)
 
static void command_from_pid (char *command, int maxlen, PID_T pid)
 
static char * commandline_from_pid (PID_T pid)
 
static void user_from_uid (char *user, int maxlen, uid_t uid)
 
static int get_process_owner (uid_t *owner, PID_T pid)
 
static int get_cores_used_by_process (PID_T pid, int *cores, const int num_cores)
 
static LONGEST linux_xfer_osdata_processes (gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
 
static int compare_processes (const void *process1, const void *process2)
 
static LONGEST linux_xfer_osdata_processgroups (gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
 
static LONGEST linux_xfer_osdata_threads (gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
 
static LONGEST linux_xfer_osdata_cpus (gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
 
static LONGEST linux_xfer_osdata_fds (gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
 
static const char * format_socket_state (unsigned char state)
 
static void print_sockets (unsigned short family, int tcp, struct buffer *buffer)
 
static LONGEST linux_xfer_osdata_isockets (gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
 
static void time_from_time_t (char *time, int maxlen, TIME_T seconds)
 
static void group_from_gid (char *group, int maxlen, gid_t gid)
 
static LONGEST linux_xfer_osdata_shm (gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
 
static LONGEST linux_xfer_osdata_sem (gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
 
static LONGEST linux_xfer_osdata_msg (gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
 
static LONGEST linux_xfer_osdata_modules (gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
 
LONGEST linux_common_xfer_osdata (const char *annex, gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
 

Variables

struct osdata_type osdata_table []
 

Macro Definition Documentation

#define MAX_PID_T_STRLEN   (sizeof ("-9223372036854775808") - 1)
#define NAMELEN (   dirent)    strlen ((dirent)->d_name)

Typedef Documentation

typedef long long PID_T

Definition at line 47 of file linux-osdata.c.

typedef long long TIME_T

Definition at line 52 of file linux-osdata.c.

Function Documentation

static void command_from_pid ( char *  command,
int  maxlen,
PID_T  pid 
)
static
static char* commandline_from_pid ( PID_T  pid)
static
static int compare_processes ( const void *  process1,
const void *  process2 
)
static

Definition at line 408 of file linux-osdata.c.

Referenced by linux_xfer_osdata_processgroups().

static const char* format_socket_state ( unsigned char  state)
static

Definition at line 881 of file linux-osdata.c.

Referenced by print_sockets().

static int get_cores_used_by_process ( PID_T  pid,
int cores,
const int  num_cores 
)
static
static int get_process_owner ( uid_t *  owner,
PID_T  pid 
)
static

Definition at line 233 of file linux-osdata.c.

References MAX_PID_T_STRLEN.

Referenced by linux_xfer_osdata_processes().

static void group_from_gid ( char *  group,
int  maxlen,
gid_t  gid 
)
static
int linux_common_core_of_thread ( ptid_t  ptid)
LONGEST linux_common_xfer_osdata ( const char *  annex,
gdb_byte readbuf,
ULONGEST  offset,
ULONGEST  len 
)
static LONGEST linux_xfer_osdata_cpus ( gdb_byte readbuf,
ULONGEST  offset,
ULONGEST  len 
)
static
static LONGEST linux_xfer_osdata_fds ( gdb_byte readbuf,
ULONGEST  offset,
ULONGEST  len 
)
static
static LONGEST linux_xfer_osdata_isockets ( gdb_byte readbuf,
ULONGEST  offset,
ULONGEST  len 
)
static
static LONGEST linux_xfer_osdata_modules ( gdb_byte readbuf,
ULONGEST  offset,
ULONGEST  len 
)
static
static LONGEST linux_xfer_osdata_msg ( gdb_byte readbuf,
ULONGEST  offset,
ULONGEST  len 
)
static
static LONGEST linux_xfer_osdata_processes ( gdb_byte readbuf,
ULONGEST  offset,
ULONGEST  len 
)
static
static LONGEST linux_xfer_osdata_processgroups ( gdb_byte readbuf,
ULONGEST  offset,
ULONGEST  len 
)
static
static LONGEST linux_xfer_osdata_sem ( gdb_byte readbuf,
ULONGEST  offset,
ULONGEST  len 
)
static
static LONGEST linux_xfer_osdata_shm ( gdb_byte readbuf,
ULONGEST  offset,
ULONGEST  len 
)
static
static LONGEST linux_xfer_osdata_threads ( gdb_byte readbuf,
ULONGEST  offset,
ULONGEST  len 
)
static
static void print_sockets ( unsigned short  family,
int  tcp,
struct buffer buffer 
)
static
static void time_from_time_t ( char *  time,
int  maxlen,
TIME_T  seconds 
)
static
static void user_from_uid ( char *  user,
int  maxlen,
uid_t  uid 
)
static

Variable Documentation

struct osdata_type osdata_table[]
Initial value:
= {
{ "cpus", "CPUs", "Listing of all cpus/cores on the system",
{ "files", "File descriptors", "Listing of all file descriptors",
{ "modules", "Kernel modules", "Listing of all loaded kernel modules",
{ "msg", "Message queues", "Listing of all message queues",
{ "processes", "Processes", "Listing of all processes",
{ "procgroups", "Process groups", "Listing of all process groups",
{ "semaphores", "Semaphores", "Listing of all semaphores",
{ "shm", "Shared-memory regions", "Listing of all shared-memory regions",
{ "sockets", "Sockets", "Listing of all internet-domain sockets",
{ "threads", "Threads", "Listing of all threads",
{ NULL, NULL, NULL }
}
static LONGEST linux_xfer_osdata_modules(gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
static LONGEST linux_xfer_osdata_isockets(gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
static LONGEST linux_xfer_osdata_shm(gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
static LONGEST linux_xfer_osdata_fds(gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
Definition: linux-osdata.c:767
static LONGEST linux_xfer_osdata_cpus(gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
Definition: linux-osdata.c:668
static LONGEST linux_xfer_osdata_msg(gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
static LONGEST linux_xfer_osdata_processgroups(gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
Definition: linux-osdata.c:439
static LONGEST linux_xfer_osdata_processes(gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
Definition: linux-osdata.c:291
static LONGEST linux_xfer_osdata_threads(gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
Definition: linux-osdata.c:555
static LONGEST linux_xfer_osdata_sem(gdb_byte *readbuf, ULONGEST offset, ULONGEST len)

Referenced by linux_common_xfer_osdata().