pcsc-lite 2.3.0
pcscdaemon.c File Reference

This is the main pcscd daemon. More...

#include "config.h"
#include <time.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <getopt.h>
#include "misc.h"
#include "pcsclite.h"
#include "pcscd.h"
#include "debuglog.h"
#include "winscard_msg.h"
#include "winscard_svc.h"
#include "sys_generic.h"
#include "hotplug.h"
#include "readerfactory.h"
#include "configfile.h"
#include "utils.h"
#include "eventhandler.h"

Go to the source code of this file.

Macros

#define OPT_STRING   "c:fTdhvaieCHt:r:s:xSI"
 

Functions

static void at_exit (void)
 
static void clean_temp_files (void)
 
static void signal_trap (int)
 
static void print_version (void)
 
static void print_usage (char const *const)
 
static void SVCServiceRunLoop (void)
 The Server's Message Queue Listener function.
 
static void * signal_thread (void *arg)
 thread dedicated to handle signals
 
int main (int argc, char **argv)
 

Variables

_Atomic bool AraKiri = false
 
static bool Init = true
 
bool AutoExit = false
 Represents an Application Context on the Server side.
 
bool SocketActivated = false
 
static int ExitValue = EXIT_FAILURE
 
int HPForceReaderPolling = 0
 
bool disable_polkit = false
 
static int pipefd [] = {-1, -1}
 
static int signal_handler_fd [] = {-1, -1}
 
bool Add_Serial_In_Name = true
 
bool Add_Interface_In_Name = true
 

Detailed Description

This is the main pcscd daemon.

The function main() starts up the communication environment.
Then an endless loop is called to look for Client connections. For each Client connection a call to CreateContextThread() is done.

Definition in file pcscdaemon.c.

Function Documentation

◆ at_exit()

static void at_exit ( void )
static

Definition at line 805 of file pcscdaemon.c.

◆ clean_temp_files()

static void clean_temp_files ( void )
static

Definition at line 829 of file pcscdaemon.c.

◆ main()

int main ( int argc,
char ** argv )

Definition at line 255 of file pcscdaemon.c.

◆ print_usage()

static void print_usage ( char const * const progname)
static

Definition at line 869 of file pcscdaemon.c.

◆ print_version()

static void print_version ( void )
static

Definition at line 856 of file pcscdaemon.c.

◆ signal_thread()

static void * signal_thread ( void * arg)
static

thread dedicated to handle signals

a signal handler can not call any function. See signal(7) for a list of function that are safe to call from a signal handler. The functions syslog(), gettimeofday() and remove() are NOT safe.

Definition at line 174 of file pcscdaemon.c.

◆ signal_trap()

static void signal_trap ( int sig)
static

Definition at line 847 of file pcscdaemon.c.

◆ SVCServiceRunLoop()

static void SVCServiceRunLoop ( void )
static

The Server's Message Queue Listener function.

An endless loop calls the function ProcessEventsServer() to check for messages sent by clients. If the message is valid, CreateContextThread() is called to serve this request.

Definition at line 101 of file pcscdaemon.c.

Variable Documentation

◆ Add_Interface_In_Name

bool Add_Interface_In_Name = true

Definition at line 82 of file pcscdaemon.c.

◆ Add_Serial_In_Name

bool Add_Serial_In_Name = true

Definition at line 81 of file pcscdaemon.c.

◆ AraKiri

_Atomic bool AraKiri = false

Definition at line 72 of file pcscdaemon.c.

◆ AutoExit

bool AutoExit = false

Represents an Application Context on the Server side.

An Application Context contains Channels (hCard).

Definition at line 74 of file pcscdaemon.c.

◆ disable_polkit

bool disable_polkit = false

Definition at line 78 of file pcscdaemon.c.

◆ ExitValue

int ExitValue = EXIT_FAILURE
static

Definition at line 76 of file pcscdaemon.c.

◆ HPForceReaderPolling

int HPForceReaderPolling = 0

Definition at line 77 of file pcscdaemon.c.

◆ Init

bool Init = true
static

Definition at line 73 of file pcscdaemon.c.

◆ pipefd

int pipefd[] = {-1, -1}
static

Definition at line 79 of file pcscdaemon.c.

◆ signal_handler_fd

int signal_handler_fd[] = {-1, -1}
static

Definition at line 80 of file pcscdaemon.c.

◆ SocketActivated

bool SocketActivated = false

Definition at line 75 of file pcscdaemon.c.