libexplain  1.4.D001
Data Structures | Typedefs | Functions
libexplain/buffer/path_to_pid.c File Reference
#include <libexplain/ac/dirent.h>
#include <libexplain/ac/limits.h>
#include <libexplain/ac/stdio.h>
#include <libexplain/ac/stdlib.h>
#include <libexplain/ac/sys/param.h>
#include <libexplain/ac/sys/stat.h>
#include <libexplain/ac/unistd.h>
#include <libexplain/buffer/path_to_pid.h>
#include <libexplain/is_same_inode.h>
#include <libexplain/lsof.h>
#include <libexplain/string_buffer.h>

Go to the source code of this file.

Data Structures

struct  adapter

Typedefs

typedef struct adapter adapter

Functions

static void n_callback (explain_lsof_t *context, const char *name)
static int stat_to_pid (explain_string_buffer_t *sb, const struct stat *st)
int explain_buffer_path_to_pid (explain_string_buffer_t *sb, const char *path)
int explain_buffer_fildes_to_pid (explain_string_buffer_t *sb, int fildes)
int explain_buffer_path_users (explain_string_buffer_t *sb, const char *path, const char *caption)

Typedef Documentation

typedef struct adapter adapter

Definition at line 143 of file path_to_pid.c.


Function Documentation

int explain_buffer_fildes_to_pid ( struct explain_string_buffer_t sb,
int  fildes 
)

The explain_buffer_fildes_to_pid function may be used to inject the PIDs of processes that have the given file open.

Parameters:
sbThe string buffer to write the PIDs into
fildesopen file descrptor of file of interest
Returns:
number of uses

Definition at line 249 of file path_to_pid.c.

int explain_buffer_path_to_pid ( struct explain_string_buffer_t sb,
const char *  path 
)

The explain_buffer_path_to_pid function may be used to inject the PIDs of processes that have the given file open.

Parameters:
sbThe string buffer to write the PIDs into
pathThe path of the file of interest
Returns:
number of uses

Definition at line 238 of file path_to_pid.c.

int explain_buffer_path_users ( struct explain_string_buffer_t sb,
const char *  path,
const char *  caption 
)

The explain_buffer_path_users function may be used to inject the PIDs of processes that have the given file open. The caption is inserted, too.

Parameters:
sbThe string buffer to write the PIDs into
pathThe path of the file of interest
captionThe name of the argument being checked, "oldpath", "newpath", "pathname" or similar.
Returns:
number of uses

Definition at line 260 of file path_to_pid.c.

static void n_callback ( explain_lsof_t context,
const char *  name 
) [static]

Definition at line 155 of file path_to_pid.c.

static int stat_to_pid ( explain_string_buffer_t sb,
const struct stat *  st 
) [static]

Definition at line 184 of file path_to_pid.c.