The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Macros | Enumerations | Functions | Variables
radlock.c File Reference

Utility to examine semaphores used to provide exclusive running rights for a process. More...

#include <freeradius-devel/autoconf.h>
#include <freeradius-devel/util/perm.h>
#include <freeradius-devel/util/sem.h>
#include <freeradius-devel/util/value.h>
#include <freeradius-devel/util/syserror.h>
#include <freeradius-devel/util/strerror.h>
#include <ctype.h>
#include <stdarg.h>
#include <stdbool.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <assert.h>
+ Include dependency graph for radlock.c:

Go to the source code of this file.

Macros

#define EXIT_WITH_FAILURE   exit(EXIT_FAILURE)
 
#define EXIT_WITH_SUCCESS   exit(EXIT_SUCCESS)
 
#define INFO(fmt, ...)   fprintf(stdout, fmt "\n", ## __VA_ARGS__)
 

Enumerations

enum  fr_radlock_action_t {
  RADLOCK_INVALID = 0 ,
  RADLOCK_LOCK ,
  RADLOCK_TRYLOCK ,
  RADLOCK_UNLOCK ,
  RADLOCK_REMOVE ,
  RADLOCK_INFO ,
  RADLOCK_PERM
}
 

Functions

int main (int argc, char *argv[])
 
static NEVER_RETURNS void usage (int ret)
 

Variables

static fr_table_num_sorted_t const radlock_action_table []
 
static size_t radlock_action_table_len = NUM_ELEMENTS(radlock_action_table)
 

Detailed Description

Utility to examine semaphores used to provide exclusive running rights for a process.

Id
a34f01ab7d1045baa8c09d7e8d9fb2809ecd1e5b

Definition in file radlock.c.

Macro Definition Documentation

◆ EXIT_WITH_FAILURE

#define EXIT_WITH_FAILURE   exit(EXIT_FAILURE)

Definition at line 81 of file radlock.c.

◆ EXIT_WITH_SUCCESS

#define EXIT_WITH_SUCCESS   exit(EXIT_SUCCESS)

Definition at line 82 of file radlock.c.

◆ INFO

#define INFO (   fmt,
  ... 
)    fprintf(stdout, fmt "\n", ## __VA_ARGS__)

Definition at line 46 of file radlock.c.

Enumeration Type Documentation

◆ fr_radlock_action_t

Enumerator
RADLOCK_INVALID 
RADLOCK_LOCK 

Acquire the semaphore if it's at 0.

RADLOCK_TRYLOCK 

Try and lock the semaphore and return if we can't.

RADLOCK_UNLOCK 

Unlock the semaphore.

RADLOCK_REMOVE 

Remove the semaphore.

RADLOCK_INFO 

Information about the semaphore.

RADLOCK_PERM 

Modify permissions for a given semaphore.

Definition at line 49 of file radlock.c.

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 88 of file radlock.c.

◆ usage()

static NEVER_RETURNS void usage ( int  ret)
static

Definition at line 69 of file radlock.c.

+ Here is the caller graph for this function:

Variable Documentation

◆ radlock_action_table

fr_table_num_sorted_t const radlock_action_table[]
static
Initial value:
= {
{ L("info"), RADLOCK_INFO },
{ L("lock"), RADLOCK_LOCK },
{ L("perm"), RADLOCK_PERM },
{ L("remove"), RADLOCK_REMOVE },
{ L("trylock"), RADLOCK_TRYLOCK },
{ L("unlock"), RADLOCK_UNLOCK }
}
#define L(_str)
Helper for initialising arrays of string literals.
Definition: build.h:207
@ RADLOCK_TRYLOCK
Try and lock the semaphore and return if we can't.
Definition: radlock.c:52
@ RADLOCK_UNLOCK
Unlock the semaphore.
Definition: radlock.c:53
@ RADLOCK_PERM
Modify permissions for a given semaphore.
Definition: radlock.c:56
@ RADLOCK_LOCK
Acquire the semaphore if it's at 0.
Definition: radlock.c:51
@ RADLOCK_REMOVE
Remove the semaphore.
Definition: radlock.c:54
@ RADLOCK_INFO
Information about the semaphore.
Definition: radlock.c:55

Definition at line 59 of file radlock.c.

◆ radlock_action_table_len

size_t radlock_action_table_len = NUM_ELEMENTS(radlock_action_table)
static

Definition at line 67 of file radlock.c.