Changes in / [5e713f6:9a1555d]
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
bitlbee.c
r5e713f6 r9a1555d 118 118 if( global.conf->runmode == RUNMODE_FORKDAEMON ) 119 119 ipc_master_load_state(); 120 121 if( global.conf->runmode == RUNMODE_DAEMON || 122 global.conf->runmode == RUNMODE_FORKDAEMON ) 123 ipc_master_listen_socket(); 120 124 121 125 if( ( fp = fopen( global.conf->pidfile, "w" ) ) ) -
configure
r5e713f6 r9a1555d 15 15 config='/var/lib/bitlbee/' 16 16 pidfile='/var/run/bitlbee.pid' 17 ipcsocket='/var/run/bitlbee' 17 18 plugindir='$prefix/lib/bitlbee' 18 19 … … 49 50 --pidfile=... $pidfile 50 51 --config=... $config 52 --ipcsocket=... $ipcsocket 51 53 52 54 --msn=0/1 Disable/enable MSN part $msn … … 76 78 config=`eval echo "$config/" | sed 's/\/\{1,\}/\//g'` 77 79 plugindir=`eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g'` 78 pidfile=`eval echo "$pidfile/" | sed 's/\/\{1,\}/\//g'` 80 pidfile=`eval echo "$pidfile" | sed 's/\/\{1,\}/\//g'` 81 ipcsocket=`eval echo "$ipcsocket" | sed 's/\/\{1,\}/\//g'` 79 82 80 83 cat<<EOF>Makefile.settings … … 86 89 DATADIR=$datadir 87 90 PLUGINDIR=$plugindir 88 PIDFILE=$pidfile89 91 CONFIG=$config 92 IPCSOCKET=$ipcsocket 90 93 91 94 ARCH=$arch … … 109 112 #define PLUGINDIR "$plugindir" 110 113 #define PIDFILE "$pidfile" 114 #define IPCSOCKET "$ipcsocket" 111 115 #define ARCH "$arch" 112 116 #define CPU "$cpu" -
ipc.c
r5e713f6 r9a1555d 28 28 #include "ipc.h" 29 29 #include "commands.h" 30 #ifndef _WIN32 31 #include <sys/un.h> 32 #endif 30 33 31 34 GSList *child_list = NULL; … … 461 464 } 462 465 466 467 static gboolean new_ipc_client (GIOChannel *gio, GIOCondition cond, gpointer data) 468 { 469 struct bitlbee_child *child = g_new0( struct bitlbee_child, 1 ); 470 int serversock; 471 472 serversock = g_io_channel_unix_get_fd(gio); 473 474 child->ipc_fd = accept(serversock, NULL, 0); 475 476 if (child->ipc_fd == -1) { 477 log_message( LOGLVL_WARNING, "Unable to accept connection on UNIX domain socket: %s", strerror(errno) ); 478 return TRUE; 479 } 480 481 child->ipc_inpa = gaim_input_add( child->ipc_fd, GAIM_INPUT_READ, ipc_master_read, child ); 482 483 child_list = g_slist_append( child_list, child ); 484 485 return TRUE; 486 } 487 488 #ifndef _WIN32 489 int ipc_master_listen_socket() 490 { 491 struct sockaddr_un un_addr; 492 int serversock; 493 GIOChannel *gio; 494 495 /* Clean up old socket files that were hanging around.. */ 496 if (unlink(IPCSOCKET) == -1 && errno != ENOENT) { 497 log_message( LOGLVL_ERROR, "Could not remove old IPC socket at %s: %s", IPCSOCKET, strerror(errno) ); 498 return 0; 499 } 500 501 un_addr.sun_family = AF_UNIX; 502 strcpy(un_addr.sun_path, IPCSOCKET); 503 504 serversock = socket(AF_UNIX, SOCK_STREAM, PF_UNIX); 505 506 if (serversock == -1) { 507 log_message( LOGLVL_WARNING, "Unable to create UNIX socket: %s", strerror(errno) ); 508 return 0; 509 } 510 511 if (bind(serversock, &un_addr, sizeof(un_addr)) == -1) { 512 log_message( LOGLVL_WARNING, "Unable to bind UNIX socket to %s: %s", IPCSOCKET, strerror(errno) ); 513 return 0; 514 } 515 516 if (listen(serversock, 5) == -1) { 517 log_message( LOGLVL_WARNING, "Unable to listen on UNIX socket: %s", strerror(errno) ); 518 return 0; 519 } 520 521 gio = g_io_channel_unix_new(serversock); 522 523 if (gio == NULL) { 524 log_message( LOGLVL_WARNING, "Unable to create IO channel for unix socket" ); 525 return 0; 526 } 527 528 g_io_add_watch(gio, G_IO_IN, new_ipc_client, NULL); 529 return 1; 530 } 531 #else 532 /* FIXME: Open named pipe \\.\BITLBEE */ 533 #endif 534 463 535 int ipc_master_load_state() 464 536 { -
ipc.h
r5e713f6 r9a1555d 57 57 void ipc_master_set_statefile( char *fn ); 58 58 int ipc_master_load_state(); 59 59 int ipc_master_listen_socket(); 60 60 61 61 extern GSList *child_list;
Note: See TracChangeset
for help on using the changeset viewer.