About: Citadel is an advanced messaging and collaboration system for groupware and BBS applications (preferred OS: Linux).
  Fossies Dox: citadel.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

No Matches
sysdep.c File Reference
#include "sysdep.h"
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <syslog.h>
#include <sys/syslog.h>
#include <execinfo.h>
#include <netdb.h>
#include <sys/un.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netinet/tcp.h>
#include <libcitadel.h>
#include "citserver.h"
#include "config.h"
#include "ctdl_module.h"
#include "sysdep_decls.h"
#include "modules/crypto/serv_crypto.h"
#include "housekeeping.h"
#include "context.h"
Include dependency graph for sysdep.c:

Go to the source code of this file.




static void signal_cleanup (int signum)
void init_sysdep (void)
int ctdl_tcp_server (char *ip_addr, int port_number, int queue_len)
int ctdl_uds_server (char *sockpath, int queue_len)
void buffer_output (void)
void unbuffer_output (void)
void flush_output (void)
void client_close (void)
int client_write (const char *buf, int nbytes)
void cputbuf (const StrBuf *Buf)
void cprintf (const char *format,...)
int client_read_blob (StrBuf *Target, int bytes, int timeout)
void client_set_inbound_buf (long N)
int client_read_random_blob (StrBuf *Target, int timeout)
int client_read_to (char *buf, int bytes, int timeout)
int HaveMoreLinesWaiting (CitContext *ctx)
int client_read (char *buf, int bytes)
int CtdlClientGetLine (StrBuf *Target)
int client_getln (char *buf, int bufsize)
void sysdep_master_cleanup (void)
void graceful_shutdown (int signum)
void start_daemon (int unused)
void checkcrash (void)
int convert_login (char NameToConvert[])
void HuntBadSession (void)
void * worker_thread (void *blah)
int SyslogFacility (char *name)


volatile int exit_signal = 0
volatile int shutdown_and_halt = 0
volatile int restart_server = 0
volatile int running_as_daemon = 0
static unsigned on = 1
static unsigned off = 0
pid_t current_child
int nFireUps = 0
int nFireUpsNonRestart = 0
pid_t ForkedPid = 1

Macro Definition Documentation



Definition at line 29 of file sysdep.c.

Function Documentation

◆ buffer_output()

void buffer_output ( void  )

Definition at line 259 of file sysdep.c.

References CC, and on.

Referenced by cmd_msgs(), do_command_loop(), imap_do_fetch_msg(), and imap_do_search().

◆ checkcrash()

void checkcrash ( void  )

Definition at line 649 of file sysdep.c.

References ctdl_run_dir, CtdlAideMessage, ForkedPid, nFireUps, and nFireUpsNonRestart.

Referenced by main().

◆ client_close()

void client_close ( void  )

Definition at line 286 of file sysdep.c.

References CC.

Referenced by client_read_blob(), client_write(), and RemoveContext().

◆ client_getln()

int client_getln ( char *  buf,
int  bufsize 

◆ client_read()

int client_read ( char *  buf,
int  bytes 

Definition at line 494 of file sysdep.c.

References client_read_to(), and CtdlGetConfigInt().

Referenced by cmd_conf(), cmd_ulri(), cmd_ului(), and cmd_writ().

◆ client_read_blob()

int client_read_blob ( StrBuf *  Target,
int  bytes,
int  timeout 

Definition at line 392 of file sysdep.c.

References CC, client_close(), and timeout().

Referenced by client_read_random_blob(), client_read_to(), and imap_append().

◆ client_read_random_blob()

int client_read_random_blob ( StrBuf *  Target,
int  timeout 

Definition at line 433 of file sysdep.c.

References CC, client_read_blob(), and timeout().

Referenced by xmpp_command_loop().

◆ client_read_to()

int client_read_to ( char *  buf,
int  bytes,
int  timeout 

Definition at line 461 of file sysdep.c.

References CC, client_read_blob(), and timeout().

Referenced by client_read().

◆ client_set_inbound_buf()

void client_set_inbound_buf ( long  N)

Definition at line 427 of file sysdep.c.

References CC, and SIZ.

Referenced by migr_do_import(), and xmpp_greeting().

◆ client_write()

◆ convert_login()

int convert_login ( char  NameToConvert[])

Definition at line 676 of file sysdep.c.

◆ cprintf()

void cprintf ( const char *  format,

Definition at line 369 of file sysdep.c.

References client_write().

Referenced by check_get(), citproto_begin_admin_session(), citproto_begin_session(), cmd_agea(), cmd_agup(), cmd_asea(), cmd_asup(), cmd_asyn(), cmd_auto(), cmd_cflr(), cmd_chek(), cmd_clos(), cmd_conf(), cmd_cre8(), cmd_creu(), cmd_dele(), cmd_delf(), cmd_dexp(), cmd_dlri(), cmd_dlui(), cmd_down(), cmd_dvca(), cmd_ebio(), cmd_echo(), cmd_eflr(), cmd_einf(), cmd_emsg(), cmd_ent0(), cmd_euid(), cmd_forg(), cmd_geta(), cmd_getr(), cmd_getu(), cmd_gexp(), cmd_gexp_async(), cmd_gibr(), cmd_gnet(), cmd_gnur(), cmd_goto(), cmd_gpex(), cmd_greg(), cmd_gtsn(), cmd_gvdn(), cmd_gvea(), cmd_gvsn(), cmd_halt(), cmd_ical(), cmd_iden(), cmd_info(), cmd_invt_kick(), cmd_isme(), cmd_kflr(), cmd_kill(), cmd_lflr(), cmd_list(), cmd_lkra(), cmd_lkrn(), cmd_lkro(), cmd_lout(), cmd_lprm(), cmd_lrms(), cmd_lsub(), cmd_lzrm(), cmd_mesg(), cmd_migr(), cmd_more(), cmd_move(), cmd_movf(), cmd_msgp(), cmd_msgs(), cmd_newu(), cmd_noop(), cmd_oida(), cmd_oidc(), cmd_oidd(), cmd_oidf(), cmd_oidl(), cmd_oids(), cmd_oimg(), cmd_open(), cmd_pass(), cmd_pibr(), cmd_qdir(), cmd_quit(), cmd_qusr(), cmd_rbio(), cmd_rcht(), cmd_rdir(), cmd_read(), cmd_regi(), cmd_renu(), cmd_reqt(), cmd_rinf(), cmd_rwho(), cmd_scdn(), cmd_seen(), cmd_seta(), cmd_setp(), cmd_setr(), cmd_setu(), cmd_sexp(), cmd_slrp(), cmd_snet(), cmd_spex(), cmd_srch(), cmd_stat(), cmd_stel(), cmd_tdap(), cmd_term(), cmd_time(), cmd_ucls(), cmd_uimg(), cmd_ulri(), cmd_ului(), cmd_uopn(), cmd_user(), cmd_vali(), cmd_view(), cmd_whok(), cmd_wiki(), cmd_writ(), CtdlAccessCheck(), CtdlOutputMsg(), CtdlOutputPreLoadedMsg(), CtdlSaveThisMessage(), CtdlUserGoto(), do_command_loop(), do_confirm(), DumpFormatFixed(), dvca_mime_callback(), fixed_output(), headers_euid(), headers_listing(), hunt_for_autocomplete(), ical_conflicts(), ical_conflicts_phase6(), ical_fixed_output_backend(), ical_freebusy(), ical_getics(), ical_handle_rsvp(), ical_hunt_for_conflicts(), ical_putics(), ical_respond(), imap_load_part(), list_roomname(), list_this_part(), list_this_pref(), list_this_suff(), ListThisUser(), logged_in_response(), migr_do_export(), migr_do_import(), migr_do_listdirs(), migr_do_restore_meta(), migr_export_floors(), migr_export_message(), migr_export_messages(), migr_export_openids(), migr_export_room_msg(), migr_export_rooms_backend(), migr_export_users_backend(), migr_export_visits(), mime_download(), mime_spew_section(), nntp_authinfo(), nntp_authinfo_pass(), nntp_authinfo_user(), nntp_capabilities(), nntp_command_loop(), nntp_date(), nntp_greeting(), nntp_group(), nntp_help(), nntp_list(), nntp_listgroup_backend(), nntp_mode(), nntp_newgroups(), nntp_quit(), nntp_xover(), nntp_xover_backend(), OpenCmdResult(), output_preferred(), output_roomname_in_list_format(), OutputCtdlMsgHeaders(), OutputRFC822MsgHeaders(), pop3_capa(), pop3_command_loop(), pop3_dele(), pop3_greeting(), pop3_last(), pop3_list(), pop3_login(), pop3_pass(), pop3_retr(), pop3_rset(), pop3_stat(), pop3_top(), pop3_uidl(), pop3_user(), roomchat_poll(), roomchat_rwho(), roomchat_send(), send_subscribe_confirmation_email(), send_unsubscribe_confirmation_email(), simple_listing(), smtp_attempt_delivery(), smtp_auth(), smtp_auth_greeting(), smtp_command_loop(), smtp_data(), smtp_get_pass(), smtp_get_user(), smtp_greeting(), smtp_hello(), smtp_help(), smtp_mail(), smtp_noop(), smtp_quit(), smtp_rcpt(), smtp_rset(), smtp_try_plain(), vcard_fixed_output(), wiki_history(), wiki_history_callback(), wiki_rev(), xmpp_destroy_buddy(), xmpp_indicate_presence(), xmpp_iq_roster_query(), xmpp_non_sasl_authenticate(), xmpp_output_auth_mechs(), xmpp_output_incoming_messages(), xmpp_presence_notify(), xmpp_query_namespace(), xmpp_roster_item(), xmpp_sasl_auth(), xmpp_stream_start(), and xmpp_xml_end().

◆ cputbuf()

void cputbuf ( const StrBuf *  Buf)

Definition at line 362 of file sysdep.c.

References client_write().

Referenced by cmd_gvdn(), headers_brief_filter(), IUnbuffer(), and smtp_data().

◆ ctdl_tcp_server()

int ctdl_tcp_server ( char *  ip_addr,
int  port_number,
int  queue_len 

Definition at line 107 of file sysdep.c.

Referenced by CtdlRegisterServiceHook().

◆ ctdl_uds_server()

int ctdl_uds_server ( char *  sockpath,
int  queue_len 

Definition at line 190 of file sysdep.c.

Referenced by CtdlRegisterServiceHook().

◆ CtdlClientGetLine()

int CtdlClientGetLine ( StrBuf *  Target)

◆ flush_output()

void flush_output ( void  )

Definition at line 277 of file sysdep.c.

References CC, off, and on.

Referenced by imap_append(), and imap_command_loop().

◆ graceful_shutdown()

void graceful_shutdown ( int  signum)

Definition at line 566 of file sysdep.c.

References current_child, and file_pid_file.

Referenced by start_daemon().

◆ HaveMoreLinesWaiting()

int HaveMoreLinesWaiting ( CitContext ctx)

Definition at line 479 of file sysdep.c.

References CitContext::client_socket, CitContext::kill_me, and CitContext::RecvBuf.

Referenced by worker_thread().

◆ HuntBadSession()

◆ init_sysdep()

void init_sysdep ( void  )

Definition at line 54 of file sysdep.c.

References MyConKey, signal_cleanup(), and ThreadKey.

Referenced by main().

◆ signal_cleanup()

static void signal_cleanup ( int  signum)

Definition at line 46 of file sysdep.c.

References exit_signal, and server_shutting_down.

Referenced by init_sysdep().

◆ start_daemon()

void start_daemon ( int  unused)

◆ sysdep_master_cleanup()

void sysdep_master_cleanup ( void  )

Definition at line 559 of file sysdep.c.

References context_cleanup().

Referenced by master_cleanup().

◆ SyslogFacility()

int SyslogFacility ( char *  name)

Definition at line 1011 of file sysdep.c.

Referenced by main().

◆ unbuffer_output()

◆ worker_thread()

Variable Documentation

◆ current_child

pid_t current_child

Definition at line 565 of file sysdep.c.

Referenced by graceful_shutdown(), and start_daemon().

◆ exit_signal

volatile int exit_signal = 0

Definition at line 40 of file sysdep.c.

Referenced by main(), and signal_cleanup().

◆ ForkedPid

pid_t ForkedPid = 1

Definition at line 574 of file sysdep.c.

Referenced by checkcrash(), and start_daemon().

◆ nFireUps

int nFireUps = 0

Definition at line 572 of file sysdep.c.

Referenced by checkcrash(), and start_daemon().

◆ nFireUpsNonRestart

int nFireUpsNonRestart = 0

Definition at line 573 of file sysdep.c.

Referenced by checkcrash(), and start_daemon().

◆ off

unsigned off = 0

Definition at line 257 of file sysdep.c.

Referenced by flush_output(), and unbuffer_output().

◆ on

unsigned on = 1

Definition at line 257 of file sysdep.c.

Referenced by buffer_output(), and flush_output().

◆ restart_server

volatile int restart_server = 0

Definition at line 42 of file sysdep.c.

Referenced by cmd_down(), cmd_scdn(), main(), and master_cleanup().

◆ running_as_daemon

volatile int running_as_daemon = 0

Definition at line 43 of file sysdep.c.

Referenced by main(), and master_cleanup().

◆ shutdown_and_halt

volatile int shutdown_and_halt = 0

Definition at line 41 of file sysdep.c.

Referenced by cmd_halt(), and master_cleanup().