| 21 |
#include "log.h" |
#include "log.h" |
| 22 |
#include "io.h" |
#include "io.h" |
| 23 |
#include "menu.h" |
#include "menu.h" |
| 24 |
|
#include "file_loader.h" |
| 25 |
#include <stdlib.h> |
#include <stdlib.h> |
| 26 |
#include <signal.h> |
#include <signal.h> |
| 27 |
#include <string.h> |
#include <string.h> |
| 160 |
} |
} |
| 161 |
unload_menu_shm(p_bbs_menu); |
unload_menu_shm(p_bbs_menu); |
| 162 |
|
|
| 163 |
|
// Load data files |
| 164 |
|
if (file_loader_init(FILE_MMAP_COUNT_LIMIT) < 0) |
| 165 |
|
{ |
| 166 |
|
log_error("file_loader_init() error\n"); |
| 167 |
|
return -4; |
| 168 |
|
} |
| 169 |
|
for (int i = 0; i < data_files_load_startup_count; i++) |
| 170 |
|
{ |
| 171 |
|
if (load_file_mmap(data_files_load_startup[i]) < 0) |
| 172 |
|
{ |
| 173 |
|
log_error("load_file_mmap(%s) error\n", data_files_load_startup[i]); |
| 174 |
|
} |
| 175 |
|
} |
| 176 |
|
|
| 177 |
// Set signal handler |
// Set signal handler |
| 178 |
signal(SIGHUP, sig_hup_handler); |
signal(SIGHUP, sig_hup_handler); |
| 179 |
signal(SIGCHLD, sig_chld_handler); |
signal(SIGCHLD, sig_chld_handler); |
| 182 |
// Initialize socket server |
// Initialize socket server |
| 183 |
net_server(BBS_address, BBS_port); |
net_server(BBS_address, BBS_port); |
| 184 |
|
|
| 185 |
|
// Cleanup loaded data files |
| 186 |
|
file_loader_cleanup(); |
| 187 |
|
|
| 188 |
// Cleanup menu |
// Cleanup menu |
| 189 |
unload_menu(p_bbs_menu); |
unload_menu(p_bbs_menu); |
| 190 |
free(p_bbs_menu); |
free(p_bbs_menu); |