syslog-ng source
console.c File Reference
#include "console.h"
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <syslog.h>
#include <errno.h>
Include dependency graph for console.c:

Functions

GString * _get_fn_names (gint fns)
 
void console_printf (const gchar *fmt,...)
 
gboolean console_acquire_from_fds (gint fds[3], gint fds_to_steal)
 
void console_release (void)
 
void console_destroy (void)
 
void console_global_init (const gchar *console_prefix_)
 
void console_global_deinit (void)
 

Variables

GMutex console_lock
 
gboolean using_initial_console = TRUE
 
gboolean console_destroyed = FALSE
 
const gchar * console_prefix
 
gint initial_console_fds [3]
 
gint stolen_fds
 

Function Documentation

◆ _get_fn_names()

GString* _get_fn_names ( gint  fns)

◆ console_acquire_from_fds()

gboolean console_acquire_from_fds ( gint  fds[3],
gint  fds_to_steal 
)

◆ console_destroy()

void console_destroy ( void  )

◆ console_global_deinit()

void console_global_deinit ( void  )

◆ console_global_init()

void console_global_init ( const gchar *  console_prefix_)

◆ console_printf()

void console_printf ( const gchar *  fmt,
  ... 
)

This function sends a message to the client preferring to use the stderr channel as long as it is available and switching to using syslog() if it isn't. Generally the stderr channell will be available in the startup process and in the beginning of the first startup in the supervisor/daemon processes. Later on the stderr fd will be closed and we have to fall back to using the system log.

◆ console_release()

void console_release ( void  )

Restore input/output/error. This function is idempotent, can be called any number of times without harm.

Variable Documentation

◆ console_destroyed

gboolean console_destroyed = FALSE

◆ console_lock

GMutex console_lock

◆ console_prefix

const gchar* console_prefix

◆ initial_console_fds

gint initial_console_fds[3]

◆ stolen_fds

gint stolen_fds

◆ using_initial_console

gboolean using_initial_console = TRUE