libfiu (internal) 0.90
Defines | Functions | Variables
fiu-rc.c File Reference
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <limits.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <pthread.h>
#include <errno.h>
#include "fiu-control.h"
#include "internal.h"
Include dependency graph for fiu-rc.c:

Go to the source code of this file.

Defines

#define FIU_ENABLE   1
#define MAX_LINE   512

Functions

static int read_line (int fd, char *buf)
int fiu_rc_string (const char *cmd, char **const error)
 Applies a remote control command given via a string.
static int rc_do_command (int fdr, int fdw)
static void * rc_fifo_thread (void *unused)
static void fifo_atexit (void)
static int _fiu_rc_fifo (const char *basename)
static void fifo_atfork_child (void)
int fiu_rc_fifo (const char *basename)
 Enables remote control over a named pipe.

Variables

static char npipe_basename [PATH_MAX]
static char npipe_path_in [PATH_MAX]
static char npipe_path_out [PATH_MAX]

Define Documentation

#define FIU_ENABLE   1

Definition at line 18 of file fiu-rc.c.

#define MAX_LINE   512

Definition at line 25 of file fiu-rc.c.

Referenced by fiu_rc_string(), rc_do_command(), and read_line().


Function Documentation

static int read_line ( int  fd,
char *  buf 
) [static]

Definition at line 35 of file fiu-rc.c.

Referenced by rc_do_command().

Here is the caller graph for this function:

int fiu_rc_string ( const char *  cmd,
char **const  error 
)

Applies a remote control command given via a string.

The format of the string is not stable and is still subject to change. At the moment, this function is exported for consumption by the libfiu utilities.

Parameters:
cmd,:A zero-terminated string with the command to apply.
error,:In case of an error, it will point to a human-readable error message.
Returns:
0 if success, < 0 otherwise.

Definition at line 82 of file fiu-rc.c.

Referenced by rc_do_command().

Here is the call graph for this function:

Here is the caller graph for this function:

static int rc_do_command ( int  fdr,
int  fdw 
) [static]

Definition at line 196 of file fiu-rc.c.

Referenced by rc_fifo_thread().

Here is the call graph for this function:

Here is the caller graph for this function:

static void* rc_fifo_thread ( void *  unused) [static]

Definition at line 231 of file fiu-rc.c.

Referenced by _fiu_rc_fifo().

Here is the call graph for this function:

Here is the caller graph for this function:

static void fifo_atexit ( void  ) [static]

Definition at line 278 of file fiu-rc.c.

Referenced by _fiu_rc_fifo().

Here is the caller graph for this function:

static int _fiu_rc_fifo ( const char *  basename) [static]

Definition at line 284 of file fiu-rc.c.

Referenced by fifo_atfork_child(), and fiu_rc_fifo().

Here is the call graph for this function:

Here is the caller graph for this function:

static void fifo_atfork_child ( void  ) [static]

Definition at line 318 of file fiu-rc.c.

Referenced by fiu_rc_fifo().

Here is the call graph for this function:

Here is the caller graph for this function:

int fiu_rc_fifo ( const char *  basename)

Enables remote control over a named pipe.

The name pipe path will begin with the given basename. "-$PID" will be appended to it to form the final path. After the process dies, the pipe will be removed. If the process forks, a new pipe will be created.

Once this function has been called, the fiu-ctrl utility can be used to control the points of failure externally.

Parameters:
basenameBase path to use in the creation of the named pipes.
Returns:
0 on success, -1 on errors.

Definition at line 323 of file fiu-rc.c.

Here is the call graph for this function:


Variable Documentation

char npipe_basename[PATH_MAX] [static]

Definition at line 227 of file fiu-rc.c.

Referenced by fifo_atfork_child(), and fiu_rc_fifo().

char npipe_path_in[PATH_MAX] [static]

Definition at line 228 of file fiu-rc.c.

Referenced by _fiu_rc_fifo(), fifo_atexit(), and rc_fifo_thread().

char npipe_path_out[PATH_MAX] [static]

Definition at line 229 of file fiu-rc.c.

Referenced by _fiu_rc_fifo(), fifo_atexit(), and rc_fifo_thread().