pidentd  3.0.19
About: implementation of the RFC1413 identification server (more or less complete rewrite compared to version 2)
  Fossies Dox: pidentd-3.0.19.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

safeio.c File Reference
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <math.h>
#include <errno.h>
#include <fcntl.h>
#include <syslog.h>
#include "pidentd.h"
Include dependency graph for safeio.c:

Go to the source code of this file.

Functions

void s_abort (void)
 
int s_open (const char *path, int oflag,...)
 
ssize_t s_write (int fd, const char *buf, size_t len)
 
ssize_t s_read (int fd, char *buf, size_t len)
 
int s_close (int fd)
 
void * s_malloc (size_t size)
 
void s_free (void *p)
 
char * s_strdup (const char *s)
 
int s_accept (int fd, struct sockaddr *sin, socklen_t *len)
 
int s_getsockname (int fd, struct sockaddr *sin, socklen_t *len)
 
int s_getpeername (int fd, struct sockaddr *sin, socklen_t *len)
 
static void random_lock_init (void)
 
long s_random (void)
 
int s_snprintf (char *buf, size_t bufsize, const char *format,...)
 

Variables

static int random_lock
 
static int random_once = 0
 

Function Documentation

◆ random_lock_init()

static void random_lock_init ( void  )
static

Definition at line 233 of file safeio.c.

References pthread_mutex_init(), and random_lock.

Referenced by s_random().

◆ s_abort()

void s_abort ( void  )

Definition at line 33 of file safeio.c.

Referenced by s_malloc(), s_snprintf(), and s_strdup().

◆ s_accept()

int s_accept ( int  fd,
struct sockaddr *  sin,
socklen_t *  len 
)

Definition at line 184 of file safeio.c.

References errno.

Referenced by server_run().

◆ s_close()

int s_close ( int  fd)

Definition at line 113 of file safeio.c.

References errno.

Referenced by pidfile_create(), and request_thread().

◆ s_free()

void s_free ( void *  p)

◆ s_getpeername()

int s_getpeername ( int  fd,
struct sockaddr *  sin,
socklen_t *  len 
)

Definition at line 214 of file safeio.c.

References errno.

Referenced by request_run().

◆ s_getsockname()

int s_getsockname ( int  fd,
struct sockaddr *  sin,
socklen_t *  len 
)

Definition at line 199 of file safeio.c.

References errno.

Referenced by handle_request().

◆ s_malloc()

void* s_malloc ( size_t  size)

Definition at line 132 of file safeio.c.

References debug, and s_abort().

Referenced by buffer_init(), ka_lookup(), ka_open(), kernel_init(), request_run(), and stval().

◆ s_open()

int s_open ( const char *  path,
int  oflag,
  ... 
)

Definition at line 44 of file safeio.c.

References errno.

Referenced by become_daemon(), pidfile_create(), and stval().

◆ s_random()

long s_random ( void  )

◆ s_read()

ssize_t s_read ( int  fd,
char *  buf,
size_t  len 
)

Definition at line 98 of file safeio.c.

References errno.

Referenced by request_thread().

◆ s_snprintf()

int s_snprintf ( char *  buf,
size_t  bufsize,
const char *  format,
  ... 
)

Definition at line 269 of file safeio.c.

References debug, and s_abort().

Referenced by pidfile_create(), s_inet_ntox(), send_error(), send_result(), send_version(), and stval().

◆ s_strdup()

char* s_strdup ( const char *  s)

Definition at line 161 of file safeio.c.

References s_abort().

Referenced by ka_lookup(), main(), and str2str().

◆ s_write()

ssize_t s_write ( int  fd,
const char *  buf,
size_t  len 
)

Definition at line 83 of file safeio.c.

References errno.

Referenced by pidfile_create(), send_error(), send_result(), and send_version().

Variable Documentation

◆ random_lock

int random_lock
static

Definition at line 229 of file safeio.c.

Referenced by random_lock_init(), and s_random().

◆ random_once

int random_once = 0
static

Definition at line 230 of file safeio.c.

Referenced by s_random().