|
From: <mla...@us...> - 2006-11-13 02:03:06
|
Revision: 129
http://svn.sourceforge.net/g15daemon/?rev=129&view=rev
Author: mlampard
Date: 2006-11-12 18:02:49 -0800 (Sun, 12 Nov 2006)
Log Message:
-----------
remove dependancy on libdaemon
Modified Paths:
--------------
trunk/g15daemon-wip/ChangeLog
trunk/g15daemon-wip/INSTALL
trunk/g15daemon-wip/README
trunk/g15daemon-wip/configure.in
trunk/g15daemon-wip/g15daemon/g15_plugins.c
trunk/g15daemon-wip/g15daemon/g15daemon.h
trunk/g15daemon-wip/g15daemon/linked_lists.c
trunk/g15daemon-wip/g15daemon/main.c
trunk/g15daemon-wip/g15daemon/utility_funcs.c
trunk/g15daemon-wip/plugins/g15_plugin_clock.c
trunk/g15daemon-wip/plugins/g15_plugin_net.c
trunk/g15daemon-wip/plugins/g15_plugin_template.c
trunk/g15daemon-wip/plugins/g15_plugin_uinput.c
Modified: trunk/g15daemon-wip/ChangeLog
===================================================================
--- trunk/g15daemon-wip/ChangeLog 2006-11-12 11:31:28 UTC (rev 128)
+++ trunk/g15daemon-wip/ChangeLog 2006-11-13 02:02:49 UTC (rev 129)
@@ -91,6 +91,8 @@
xmms devel and glib devel packages will need to be installed prior to attempting ./configure --enable-xmmsplugin
Plugin is not compiled by default.
- Clock is now a plugin
+- dependency on libdaemon is now removed
+
Modified: trunk/g15daemon-wip/INSTALL
===================================================================
--- trunk/g15daemon-wip/INSTALL 2006-11-12 11:31:28 UTC (rev 128)
+++ trunk/g15daemon-wip/INSTALL 2006-11-13 02:02:49 UTC (rev 129)
@@ -42,10 +42,7 @@
A few things we need to check before installing the g15daemon.
For compiling you need:
-libdaemon development package. (libdaemon-dev)
-You can install the libdaemon from your distribution
-repositories or from the libdaemon homepage .
-(http://0pointer.de/lennart/projects/libdaemon/ last time I checked...)
+libg15, libg15render, and libusb development packages.
For running the daemon you need:
linux kernel uniput module
Modified: trunk/g15daemon-wip/README
===================================================================
--- trunk/g15daemon-wip/README 2006-11-12 11:31:28 UTC (rev 128)
+++ trunk/g15daemon-wip/README 2006-11-13 02:02:49 UTC (rev 129)
@@ -18,14 +18,8 @@
xmms spectrum analyser plugin, based on the finespectrum plugin,
is also available in the package.
-G15daemon depends on libg15 from G15tools, and the libdaemon de-
-velopment packages
- from your distrobution, or from the libdaemon homepage.
+G15daemon depends on libg15 from G15tools.
-Whilst G15daemon is developed on and for linux, chances are that
-it will compile and run on any OS that supports pthreads, libusb,
-and libdaemon.
-
[INSTALLING]
To install, enter the directory you've extracted the archive in-
Modified: trunk/g15daemon-wip/configure.in
===================================================================
--- trunk/g15daemon-wip/configure.in 2006-11-12 11:31:28 UTC (rev 128)
+++ trunk/g15daemon-wip/configure.in 2006-11-13 02:02:49 UTC (rev 129)
@@ -16,7 +16,6 @@
AC_PROG_RANLIB
# Checks for libraries.
-AC_CHECK_LIB([daemon], [daemon_log],,AC_MSG_ERROR(["libdaemon (or its devel package) not found. please install it"]))
AC_CHECK_LIB([g15], [initLibG15],,AC_MSG_ERROR(["libg15 (or its devel package) not found. please install it"]))
AC_CHECK_LIB([g15render], [g15r_initCanvas],,AC_MSG_ERROR(["libg15render (or its devel package) not found. please install it"]))
AC_CHECK_LIB([m], [sin])
Modified: trunk/g15daemon-wip/g15daemon/g15_plugins.c
===================================================================
--- trunk/g15daemon-wip/g15daemon/g15_plugins.c 2006-11-12 11:31:28 UTC (rev 128)
+++ trunk/g15daemon-wip/g15daemon/g15_plugins.c 2006-11-13 02:02:49 UTC (rev 129)
@@ -35,7 +35,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
-#include <libdaemon/daemon.h>
#include <config.h>
#include <fcntl.h>
#include <unistd.h>
@@ -59,7 +58,7 @@
handle = dlopen (name,RTLD_LAZY | mode);
if ((error = dlerror()) != NULL) {
- daemon_log (LOG_ERR, "%s\n", error);
+ g15daemon_log (LOG_ERR, "%s\n", error);
return(NULL);
}
@@ -144,7 +143,7 @@
void *handle = plugin_args->plugin_handle;
if(plugin_args->info->plugin_run!=NULL||plugin_args->info->event_handler!=NULL) {
- daemon_log(LOG_ERR,"registered plugin \"%s\"",info->name);
+ g15daemon_log(LOG_ERR,"registered plugin \"%s\"",info->name);
} else {
return NULL;
}
@@ -159,7 +158,7 @@
if(plugin_args)
free(plugin_args);
- daemon_log(LOG_INFO,"Removed plugin %s",info->name);
+ g15daemon_log(LOG_INFO,"Removed plugin %s",info->name);
g15_dlclose_plugin(handle);
}
@@ -180,7 +179,7 @@
dlerror();
if(!plugin_args->info) { /* if it doesnt have a valid struct, we should just load it as a library... but we dont at the moment FIXME */
- daemon_log(LOG_ERR,"%s is not a valid g15daemon plugin\n",name);
+ g15daemon_log(LOG_ERR,"%s is not a valid g15daemon plugin\n",name);
g15_dlclose_plugin(plugin_handle);
dlerror();
return;
@@ -217,7 +216,7 @@
pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_DETACHED);
pthread_attr_setstacksize(&attr,64*1024); /* set stack to 64k - dont need 8Mb */
if (pthread_create(&client_connection, &attr, (void*)plugin_thread, plugin_args) != 0) {
- daemon_log(LOG_WARNING,"Unable to create client thread.");
+ g15daemon_log(LOG_WARNING,"Unable to create client thread.");
} else {
pthread_detach(client_connection);
}
@@ -238,7 +237,7 @@
strcpy(pluginname, plugin_directory);
strncat(pluginname,"/",1);
strncat(pluginname,ep->d_name,200);
- daemon_log(LOG_INFO, "Loading plugin %s",pluginname);
+ g15daemon_log(LOG_INFO, "Loading plugin %s",pluginname);
g15_plugin_load (displaylist, pluginname);
pthread_msleep(20);
}
Modified: trunk/g15daemon-wip/g15daemon/g15daemon.h
===================================================================
--- trunk/g15daemon-wip/g15daemon/g15daemon.h 2006-11-12 11:31:28 UTC (rev 128)
+++ trunk/g15daemon-wip/g15daemon/g15daemon.h 2006-11-13 02:02:49 UTC (rev 129)
@@ -53,6 +53,7 @@
#endif
#include <pwd.h>
+#include <syslog.h>
#define CLIENT_CMD_GET_KEYSTATE 'k'
#define CLIENT_CMD_SWITCH_PRIORITIES 'p'
@@ -239,4 +240,6 @@
int send_event(void *caller, unsigned int event, unsigned long value);
/* return time in milliseconds */
unsigned int gettimerms();
+/* syslog wrapper */
+int g15daemon_log (int priority, const char *fmt, ...);
#endif
Modified: trunk/g15daemon-wip/g15daemon/linked_lists.c
===================================================================
--- trunk/g15daemon-wip/g15daemon/linked_lists.c 2006-11-12 11:31:28 UTC (rev 128)
+++ trunk/g15daemon-wip/g15daemon/linked_lists.c 2006-11-13 02:02:49 UTC (rev 129)
@@ -25,8 +25,7 @@
*/
#include <stdio.h>
#include <stdlib.h>
-#include <libdaemon/daemon.h>
-#include "g15daemon.h"
+#include <g15daemon.h>
#include <libg15.h>
extern lcd_t *keyhandler;
@@ -172,7 +171,7 @@
if(&oldnode->lcd == (void*)keyhandler) {
client_handles_keys = 0;
keyhandler = NULL;
- daemon_log(LOG_WARNING,"Client key handler quit, going back to defaults");
+ g15daemon_log(LOG_WARNING,"Client key handler quit, going back to defaults");
}
if((*display_list)->head!=oldnode){
Modified: trunk/g15daemon-wip/g15daemon/main.c
===================================================================
--- trunk/g15daemon-wip/g15daemon/main.c 2006-11-12 11:31:28 UTC (rev 128)
+++ trunk/g15daemon-wip/g15daemon/main.c 2006-11-13 02:02:49 UTC (rev 129)
@@ -35,7 +35,6 @@
#include <sys/time.h>
#include <fcntl.h>
#include <unistd.h>
-#include <libdaemon/daemon.h>
#include <pwd.h>
#include <config.h>
@@ -48,7 +47,7 @@
/* all threads will exit if leaving >0 */
int leaving = 0;
-
+unsigned int g15daemon_debug = 0;
unsigned int cycle_key;
unsigned int client_handles_keys = 0;
struct lcd_t *keyhandler = NULL;
@@ -203,43 +202,50 @@
return NULL;
}
+void g15daemon_sighandler(int sig) {
+ switch(sig){
+ case SIGINT:
+ case SIGQUIT:
+ leaving = 1;
+ break;
+ case SIGPIPE:
+ break;
+ }
+}
+
int main (int argc, char *argv[])
{
pid_t daemonpid;
int retval;
int i;
- int g15daemon_debug = 0;
+ struct sigaction new_action, old_action;
pthread_t keyboard_thread;
pthread_t lcd_thread;
- daemon_pid_file_ident =
- daemon_log_ident =
- daemon_ident_from_argv0(argv[0]);
for (i=0;i<argc;i++) {
char daemonargs[20];
memset(daemonargs,0,20);
strncpy(daemonargs,argv[i],19);
if (!strncmp(daemonargs, "-k",2) || !strncmp(daemonargs, "--kill",6)) {
-#ifdef DAEMON_PID_FILE_KILL_WAIT_AVAILABLE
- if ((retval = daemon_pid_file_kill_wait(SIGINT, 15)) != 0)
-#else
- if ((retval = daemon_pid_file_kill(SIGINT)) != 0)
-#endif
- daemon_log(LOG_WARNING, "Failed to kill daemon");
- return retval < 0 ? 1 : 0;
+ daemonpid = g15daemon_return_running();
+ if(daemonpid>0) {
+ kill(daemonpid,SIGINT);
+ } else
+ printf("G15Daemon not running\n");
+ exit(0);
}
if (!strncmp(daemonargs, "-v",2) || !strncmp(daemonargs, "--version",9)) {
float lg15ver = LIBG15_VERSION;
- printf("G15Daemon version %s - %s\n",VERSION,daemon_pid_file_is_running() >= 0 ?"Loaded & Running":"Not Running");
+ printf("G15Daemon version %s - %s\n",VERSION,g15daemon_return_running() >= 0 ?"Loaded & Running":"Not Running");
printf("compiled with libg15 version %.3f\n\n",lg15ver/1000);
exit(0);
}
if (!strncmp(daemonargs, "-h",2) || !strncmp(daemonargs, "--help",6)) {
- printf("G15Daemon version %s - %s\n",VERSION,daemon_pid_file_is_running() >= 0 ?"Loaded & Running":"Not Running");
+ printf("G15Daemon version %s - %s\n",VERSION,g15daemon_return_running() >= 0 ?"Loaded & Running":"Not Running");
printf("%s -h (--help) or -k (--kill) or -s (--switch) or -d (--debug) or -v (--version)\n\n -k will kill a previous incarnation,\n -h shows this help\n -s changes the screen-switch key from MR to L1\n -d debug mode - stay in foreground and output all debug messages to STDERR\n -v show version\n",argv[0]);
exit(0);
}
@@ -254,55 +260,24 @@
g15daemon_debug = 1;
}
}
-
- if ((daemonpid = daemon_pid_file_is_running()) >= 0) {
- printf("%s is already running. Use \'%s -k\' to kill the daemon before running again.\nExiting now\n",argv[0],argv[0]);
- return 1;
+ if(g15daemon_return_running()>=0) {
+ g15daemon_log(LOG_ERR,"G15Daemon already running.. Exiting");
+ exit(0);
}
+ if(!g15daemon_debug)
+ daemon(0,0);
- daemon_retval_init();
-
- if(!g15daemon_debug) {
- if((daemonpid = daemon_fork()) < 0){
- daemon_retval_done();
- return 1;
- }
- }
-
- if (daemonpid && !g15daemon_debug){
- retval=0;
- char * g15_errors[] = { "No Error",
- "Unable to write to PID file",
- "Unable to initialise keyboard",
- "Unable to configure the linux kernel UINPUT driver",
- "Unable to register signal handler",
- "Unable to create new thread", NULL };
- if((retval = daemon_retval_wait(20)) !=0) {
- if(retval)
- daemon_log(LOG_ERR,"An Error Occurred - %i : ( %s ) received",retval, g15_errors[retval]);
- else
- daemon_log(LOG_ERR,"A library error occurred. Please file a bug report stating the g15daemon version, your kernel version, libdaemon version and your distribution name.");
- return 255;
- }
-
- return retval;
-
- }else{ /* daemonised now */
-
+ if(g15daemon_create_pidfile() == 0) {
+
int fd;
fd_set fds;
lcdlist_t *lcdlist;
pthread_attr_t attr;
struct passwd *nobody;
unsigned char location[1024];
-
+
+ openlog("g15daemon", LOG_PID, LOG_DAEMON);
nobody = getpwnam("nobody");
-
- if(daemon_pid_file_create() !=0){
- daemon_log(LOG_ERR,"Unable to create PID File! Exiting");
- daemon_retval_send(1);
- goto exitnow;
- }
/* init stuff here.. */
retval = initLibG15();
@@ -310,17 +285,10 @@
setLEDs(0);
if(retval != G15_NO_ERROR){
- daemon_log(LOG_ERR,"Unable to find G15 keyboard or the keyboard is already handled. Exiting");
- daemon_retval_send(2);
+ g15daemon_log(LOG_ERR,"Unable to find G15 keyboard or the keyboard is already handled. Exiting");
goto exitnow;
}
-
- if(daemon_signal_init(SIGINT,SIGQUIT,SIGHUP,SIGPIPE,0) <0){
- daemon_log(LOG_ERR,"Unable to register signal handler. Exiting");
- daemon_retval_send(4);
- goto exitnow;
- }
-
+
/* all other processes/threads should be seteuid nobody */
if(nobody!=NULL) {
seteuid(nobody->pw_uid);
@@ -338,8 +306,7 @@
pthread_attr_setschedpolicy(&attr,thread_policy);
if (pthread_create(&keyboard_thread, &attr, keyboard_watch_thread, lcdlist) != 0) {
- daemon_log(LOG_ERR,"Unable to create keyboard listener thread. Exiting");
- daemon_retval_send(5);
+ g15daemon_log(LOG_ERR,"Unable to create keyboard listener thread. Exiting");
goto exitnow;
}
pthread_attr_setstacksize(&attr,128*1024);
@@ -349,47 +316,31 @@
pthread_attr_setschedpolicy(&attr,thread_policy);
if (pthread_create(&lcd_thread, &attr, lcd_draw_thread, lcdlist) != 0) {
- daemon_log(LOG_ERR,"Unable to create display thread. Exiting");
- daemon_retval_send(5);
+ g15daemon_log(LOG_ERR,"Unable to create display thread. Exiting");
goto exitnow;
}
- daemon_retval_send(0);
- daemon_log(LOG_INFO,"%s loaded\n",PACKAGE_STRING);
+ g15daemon_log(LOG_INFO,"%s loaded\n",PACKAGE_STRING);
- snprintf(location,1024,"%s/%s\0",DATADIR,"g15daemon/splash/g15logo2.wbmp");
+ snprintf(location,1024,"%s/%s\0",DATADIR,"g15daemon/splash/g15logo2.wbmp");
load_wbmp(lcdlist->tail->lcd,location);
- write_buf_to_g15(lcdlist->tail->lcd);
+ write_buf_to_g15(lcdlist->tail->lcd);
snprintf(location,1024,"%s/%s\0",DATADIR,"g15daemon/plugins");
g15_open_all_plugins(lcdlist,location);
+
+ new_action.sa_handler = g15daemon_sighandler;
+ new_action.sa_flags = 0;
+ sigaction(SIGINT, &new_action, NULL);
+ sigaction(SIGQUIT, &new_action, NULL);
- FD_ZERO(&fds);
- FD_SET(fd=daemon_signal_fd(),&fds);
-
do {
- fd_set myfds = fds;
- if(select(FD_SETSIZE,&myfds,0,0,0) <0){
- if(errno == EINTR) continue;
- break;
- }
-
- if(FD_ISSET(fd,&fds)){
- int sig;
- sig = daemon_signal_next();
- switch(sig){
- case SIGINT:
- case SIGQUIT:
- leaving = 1;
- daemon_log(LOG_INFO,"Leaving by request");
- break;
- case SIGPIPE:
- break;
- }
- }
- } while ( leaving == 0 );
-
- daemon_signal_done();
+ sleep(1);
+
+ } while( leaving == 0);
+
+ g15daemon_log(LOG_INFO,"Leaving by request");
+
pthread_join(lcd_thread,NULL);
pthread_join(keyboard_thread,NULL);
@@ -399,14 +350,13 @@
#endif
#endif
lcdlist_destroy(&lcdlist);
- }
exitnow:
- /* return to root privilages for the final countdown */
- seteuid(0);
+ /* return to root privilages for the final countdown */
+ seteuid(0);
setegid(0);
-
- daemon_retval_done();
- daemon_pid_file_remove();
+ closelog();
+ unlink("/var/run/g15daemon.pid");
+ }
return 0;
}
Modified: trunk/g15daemon-wip/g15daemon/utility_funcs.c
===================================================================
--- trunk/g15daemon-wip/g15daemon/utility_funcs.c 2006-11-12 11:31:28 UTC (rev 128)
+++ trunk/g15daemon-wip/g15daemon/utility_funcs.c 2006-11-13 02:02:49 UTC (rev 129)
@@ -39,10 +39,14 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#include <libdaemon/daemon.h>
#include "g15daemon.h"
#include <libg15.h>
+#include <stdarg.h>
+extern unsigned int g15daemon_debug;
+#define G15DAEMON_PIDFILE "/var/run/g15daemon.pid"
+
+
/* if no exitfunc or eventhandler, member should be NULL */
const plugin_info_t generic_info[] = {
/* TYPE, name, initfunc, updatefreq, exitfunc, eventhandler */
@@ -59,12 +63,89 @@
size++;
if((ptr = calloc(1, size)) == NULL) {
- daemon_log(LOG_WARNING, "g15_xmalloc() failed: %s.\n", strerror(errno));
+ g15daemon_log(LOG_WARNING, "g15_xmalloc() failed: %s.\n", strerror(errno));
return NULL;
}
return ptr;
}
+int g15daemon_return_running(){
+ int fd;
+ char pidtxt[128];
+ int pid;
+ int l;
+
+ if ((fd = open(G15DAEMON_PIDFILE, O_RDWR, 0644)) < 0) {
+ return -1;
+ }
+ if((l = read(fd,pidtxt,sizeof(pidtxt)-1)) < 0) {
+ unlink (G15DAEMON_PIDFILE);
+ close(fd);
+ return -1;
+ }
+ if((pid = atoi(pidtxt)) <= 0) {
+ g15daemon_log(LOG_ERR,"pidfile corrupt");
+ unlink(G15DAEMON_PIDFILE);
+ close(fd);
+ return -1;
+ }
+ if((kill(pid,0) != 0) && errno != EPERM ) {
+ g15daemon_log(LOG_ERR,"Process died - removing pidfile");
+ unlink(G15DAEMON_PIDFILE);
+ close(fd);
+ return -1;
+ }
+
+ return pid;
+
+}
+
+
+int g15daemon_create_pidfile() {
+
+ char pidtxt[128];
+ size_t l;
+ int fd;
+
+ if(!g15daemon_return_running() && (fd = open(G15DAEMON_PIDFILE, O_CREAT|O_RDWR|O_EXCL, 0644)) < 0) {
+ g15daemon_log(LOG_ERR,"previous G15Daemon process died. removing pidfile");
+ unlink(G15DAEMON_PIDFILE);
+ }
+ if ((fd = open(G15DAEMON_PIDFILE, O_CREAT|O_RDWR|O_EXCL, 0644)) < 0) {
+ return 1;
+ }
+
+ snprintf(pidtxt, sizeof(pidtxt), "%lu\n", (unsigned long) getpid());
+
+ if (write(fd, pidtxt, l = strlen(pidtxt)) != l) {
+ g15daemon_log(LOG_WARNING, "write(): %s", strerror(errno));
+ unlink(G15DAEMON_PIDFILE);
+ }
+
+ if(fd>0) {
+ close(fd);
+ return 0;
+ }
+ return 1;
+}
+
+/* syslog wrapper */
+int g15daemon_log (int priority, const char *fmt, ...) {
+
+ unsigned char buf[1024];
+ va_list argp;
+ va_start (argp, fmt);
+ if(g15daemon_debug == 0)
+ vsyslog(priority, fmt, argp);
+ else {
+ vfprintf(stderr,fmt,argp);
+ fprintf(stderr,"\n");
+ }
+ va_end (argp);
+
+ return 0;
+}
+
void convert_buf(lcd_t *lcd, unsigned char * orig_buf)
{
unsigned int x,y;
Modified: trunk/g15daemon-wip/plugins/g15_plugin_clock.c
===================================================================
--- trunk/g15daemon-wip/plugins/g15_plugin_clock.c 2006-11-12 11:31:28 UTC (rev 128)
+++ trunk/g15daemon-wip/plugins/g15_plugin_clock.c 2006-11-13 02:02:49 UTC (rev 129)
@@ -33,7 +33,6 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
-#include <libdaemon/daemon.h>
#include <config.h>
#include <g15daemon.h>
Modified: trunk/g15daemon-wip/plugins/g15_plugin_net.c
===================================================================
--- trunk/g15daemon-wip/plugins/g15_plugin_net.c 2006-11-12 11:31:28 UTC (rev 128)
+++ trunk/g15daemon-wip/plugins/g15_plugin_net.c 2006-11-13 02:02:49 UTC (rev 129)
@@ -37,8 +37,8 @@
#include <errno.h>
#include <libg15.h>
-#include "g15daemon.h"
-#include <libdaemon/daemon.h>
+#include <g15daemon.h>
+
static int leaving;
int server_events(plugin_event_t *myevent);
@@ -57,7 +57,7 @@
if(lcdnode->list->current == lcdnode){
// send the keystate inband back to the client
if((msgret = send(sock,(void *)¤t_key_state,sizeof(current_key_state),0))<0)
- daemon_log(LOG_WARNING,"Error in send: %s\n",strerror(errno));
+ g15daemon_log(LOG_WARNING,"Error in send: %s\n",strerror(errno));
current_key_state = 0;
}
else{
@@ -105,13 +105,13 @@
lcdnode->lcd->state_changed = 1;
} /*else if (msgbuf[0] & CLIENT_CMD_KEY_HANDLER)
{
- daemon_log(LOG_WARNING, "Client is taking over keystate");
+ g15daemon_log(LOG_WARNING, "Client is taking over keystate");
client_handles_keys=1;
keyhandler = &lcdnode->lcd;
keyhandler->connection = sock;
- daemon_log(LOG_WARNING, "Client has taken over keystate");
+ g15daemon_log(LOG_WARNING, "Client has taken over keystate");
}*/
}
@@ -125,7 +125,7 @@
struct sockaddr_in servaddr;
if ((listening_socket = socket(AF_INET, SOCK_STREAM, 0)) < 0 ) {
- daemon_log(LOG_WARNING, "Unable to create socket.\n");
+ g15daemon_log(LOG_WARNING, "Unable to create socket.\n");
return -1;
}
@@ -138,12 +138,12 @@
servaddr.sin_port = htons(LISTEN_PORT);
if (bind(listening_socket, (struct sockaddr *) &servaddr, sizeof(servaddr)) < 0 ) {
- daemon_log(LOG_WARNING, "error calling bind()\n");
+ g15daemon_log(LOG_WARNING, "error calling bind()\n");
return -1;
}
if (listen(listening_socket, MAX_CLIENTS) < 0 ) {
- daemon_log(LOG_WARNING, "error calling listen()\n");
+ g15daemon_log(LOG_WARNING, "error calling listen()\n");
return -1;
}
@@ -327,7 +327,7 @@
if ( (conn_s = accept(listening_socket, NULL, NULL) ) < 0 ) {
if(errno==EWOULDBLOCK || errno==EAGAIN){
}else{
- daemon_log(LOG_WARNING, "error calling accept()\n");
+ g15daemon_log(LOG_WARNING, "error calling accept()\n");
return -1;
}
}
@@ -342,9 +342,9 @@
pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_DETACHED);
pthread_attr_setstacksize(&attr,256*1024); /* set stack to 768k - dont need 8Mb - this is probably rather excessive also */
if (pthread_create(&client_connection, &attr, lcd_client_thread, clientnode) != 0) {
- daemon_log(LOG_WARNING,"Unable to create client thread.");
+ g15daemon_log(LOG_WARNING,"Unable to create client thread.");
if (close(conn_s) < 0 ) {
- daemon_log(LOG_WARNING, "error calling close()\n");
+ g15daemon_log(LOG_WARNING, "error calling close()\n");
return -1;
}
@@ -363,12 +363,12 @@
int g15_socket=-1;
if((g15_socket = init_sockserver())<0){
- daemon_log(LOG_ERR,"Unable to initialise the server at port %i",LISTEN_PORT);
+ g15daemon_log(LOG_ERR,"Unable to initialise the server at port %i",LISTEN_PORT);
return NULL;
}
if (fcntl(g15_socket, F_SETFL, O_NONBLOCK) <0 ) {
- daemon_log(LOG_ERR,"Unable to set socket to nonblocking");
+ g15daemon_log(LOG_ERR,"Unable to set socket to nonblocking");
}
while ( !leaving ) {
@@ -388,7 +388,7 @@
case G15_EVENT_KEYPRESS:{
if(lcd->connection) { /* server client */
if((send(lcd->connection,(void *)&event->value,sizeof(event->value),0))<0)
- daemon_log(LOG_WARNING,"Error in send: %s\n",strerror(errno));
+ g15daemon_log(LOG_WARNING,"Error in send: %s\n",strerror(errno));
}
break;
}
Modified: trunk/g15daemon-wip/plugins/g15_plugin_template.c
===================================================================
--- trunk/g15daemon-wip/plugins/g15_plugin_template.c 2006-11-12 11:31:28 UTC (rev 128)
+++ trunk/g15daemon-wip/plugins/g15_plugin_template.c 2006-11-13 02:02:49 UTC (rev 129)
@@ -33,7 +33,6 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
-#include <libdaemon/daemon.h>
#include <config.h>
#include <g15daemon.h>
Modified: trunk/g15daemon-wip/plugins/g15_plugin_uinput.c
===================================================================
--- trunk/g15daemon-wip/plugins/g15_plugin_uinput.c 2006-11-12 11:31:28 UTC (rev 128)
+++ trunk/g15daemon-wip/plugins/g15_plugin_uinput.c 2006-11-13 02:02:49 UTC (rev 129)
@@ -31,7 +31,6 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
-#include <libdaemon/daemon.h>
#include <config.h>
#include <g15daemon.h>
@@ -59,7 +58,7 @@
++i;
}
if(uinp_fd<0){
- daemon_log(LOG_ERR,"Unable to open UINPUT device. Please ensure the uinput driver is loaded into the kernel and that you have permission to open the device.");
+ g15daemon_log(LOG_ERR,"Unable to open UINPUT device. Please ensure the uinput driver is loaded into the kernel and that you have permission to open the device.");
return -1;
}
/* all other processes/threads should be seteuid nobody */
@@ -88,7 +87,7 @@
if (ioctl(uinp_fd, UI_DEV_CREATE))
{
- daemon_log(LOG_ERR,"Unable to create UINPUT device.");
+ g15daemon_log(LOG_ERR,"Unable to create UINPUT device.");
return -1;
}
return 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|