-// Citadel "system dependent" stuff.
-//
-// Here's where we (hopefully) have most parts of the Citadel server that
-// might need tweaking when run on different operating system variants.
+// This started as a portability layer, but then everything got more standard.
+// Most of it handles network communication.
//
// Copyright (c) 1987-2023 by the citadel.org team
//
-// This program is open source software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License, version 3.
+// This program is open source software. Use, duplication, or disclosure
+// is subject to the terms of the GNU General Public License, version 3.
#include "sysdep.h"
#include <stdlib.h>
if ( (ip_addr == NULL) // any IPv6
|| (IsEmptyStr(ip_addr))
|| (!strcmp(ip_addr, "*"))
+ || (!strcmp(ip_addr, "::"))
) {
ip_version = 6;
sin6.sin6_addr = in6addr_any;
}
-// The system-dependent part of master_cleanup() - close the master socket.
-void sysdep_master_cleanup(void) {
- context_cleanup();
-}
-
-
-
pid_t current_child;
void supervisor_process_shutdown(int signum) {
kill(current_child, signum);
begin_critical_section(S_SESSION_TABLE);
for (ptr = ContextList; ptr != NULL; ptr = ptr->next) {
int checkfd = ptr->client_socket;
- if ((checkfd != -1) && (ptr->state == CON_IDLE) ){
+ if ((checkfd != -1) && (ptr->state == CON_IDLE)){
if (FD_ISSET(checkfd, &readfds)) {
ptr->input_waiting = 1;
if (!bind_me) {
else {
ptr->state = CON_READY;
}
- } else if ((ptr->is_async) && (ptr->async_waiting) && (ptr->h_async_function)) {
+ }
+ else if ((ptr->is_async) && (ptr->async_waiting) && (ptr->h_async_function)) {
if (!bind_me) {
bind_me = ptr; // I choose you!
bind_me->state = CON_EXECUTING;
pthread_mutex_lock(&ThreadCountMutex);
--active_workers;
- if ((active_workers + CtdlGetConfigInt("c_min_workers") < num_workers) &&
- (num_workers > CtdlGetConfigInt("c_min_workers")))
- {
+ if ( (active_workers + CtdlGetConfigInt("c_min_workers") < num_workers)
+ && (num_workers > CtdlGetConfigInt("c_min_workers"))
+ ) {
num_workers--;
pthread_mutex_unlock(&ThreadCountMutex);
return (NULL);
// SyslogFacility()
// Translate text facility name to syslog.h defined value.
-int SyslogFacility(char *name)
-{
+int SyslogFacility(char *name) {
int i;
- struct
- {
+ struct {
int facility;
char *name;
} facTbl[] =