The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Typedefs | Functions
exfile.h File Reference

API for managing concurrent file access. More...

#include <freeradius-devel/server/request.h>
+ Include dependency graph for exfile.h:

Go to the source code of this file.

Typedefs

typedef struct exfile_s exfile_t
 

Functions

int exfile_close (exfile_t *lf, CC_RELEASE_HANDLE("exfile_fd") int fd)
 
void exfile_enable_triggers (exfile_t *ef, CONF_SECTION *cs, char const *trigger_prefix, fr_pair_list_t *trigger_args)
 Enable triggers for an exfiles handle. More...
 
exfile_texfile_init (TALLOC_CTX *ctx, uint32_t entries, fr_time_delta_t idle, bool locking)
 Initialize a way for multiple threads to log to one or more files. More...
 
int exfile_open (exfile_t *lf, char const *filename, mode_t permissions, off_t *offset)
 Open a new log file, or maybe an existing one. More...
 

Detailed Description

API for managing concurrent file access.

Id
1fe9b15623b3a66ac71fd6a70c66337a4ee1b2de

Definition in file exfile.h.

Typedef Documentation

◆ exfile_t

typedef struct exfile_s exfile_t

Definition at line 1 of file exfile.h.

Function Documentation

◆ exfile_close()

int exfile_close ( exfile_t lf,
CC_RELEASE_HANDLE("exfile_fd") int  fd 
)

◆ exfile_enable_triggers()

void exfile_enable_triggers ( exfile_t ef,
CONF_SECTION conf,
char const *  trigger_prefix,
fr_pair_list_t trigger_args 
)

Enable triggers for an exfiles handle.

Parameters
[in]efto enable triggers for.
[in]confsection to search for triggers in.
[in]trigger_prefixprefix to prepend to all trigger names. Usually a path to the module's trigger configuration .e.g.
modules.<name>.file 
<trigger name> 
is appended to form the complete path.
[in]trigger_argsto make available in any triggers executed by the exfile api. Exfile-File is automatically added to this list.

Definition at line 195 of file exfile.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exfile_init()

exfile_t* exfile_init ( TALLOC_CTX *  ctx,
uint32_t  max_entries,
fr_time_delta_t  max_idle,
bool  locking 
)

Initialize a way for multiple threads to log to one or more files.

Parameters
ctxThe talloc context
max_entriesMax file descriptors to cache, and manage locks for.
max_idleMaximum time a file descriptor can be idle before it's closed.
lockingwhether or not to lock the files.
Returns
  • new context.
  • NULL on error.

Definition at line 147 of file exfile.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exfile_open()

int exfile_open ( exfile_t ef,
char const *  filename,
mode_t  permissions,
off_t offset 
)

Open a new log file, or maybe an existing one.

When multithreaded, the FD is locked via a mutex. This way we're sure that no other thread is writing to the file.

Parameters
efThe logfile context returned from exfile_init().
filenamethe file to open.
permissionsto use.
offsetOptional pointer to store offset in when seeking the end of file.
Returns
  • FD used to write to the file.
  • -1 on failure.

Definition at line 505 of file exfile.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function: