Remove native win32 support. We have no report that LCDproc can be natively
compiled and used with recent Windows systems (Windows Vista/7). Except for serial drivers (and those using USB->serial adapters) drivers are not expected to work with those systems.
This commit is contained in:
+2
-32
@@ -14,12 +14,8 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#ifndef WIN32
|
||||
# include <errno.h>
|
||||
# include <dlfcn.h>
|
||||
#else
|
||||
# include <windows.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#include <dlfcn.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -219,20 +215,10 @@ driver_bind_module(Driver *driver)
|
||||
debug(RPT_DEBUG, "%s(driver=[%.40s])", __FUNCTION__, driver->name);
|
||||
|
||||
/* Load the module */
|
||||
#ifndef WIN32
|
||||
driver->module_handle = dlopen(driver->filename, RTLD_NOW);
|
||||
#else
|
||||
driver->module_handle = LoadLibraryEx((driver->filename), NULL, 0);
|
||||
#endif
|
||||
if (driver->module_handle == NULL) {
|
||||
#ifndef WIN32
|
||||
report(RPT_ERR, "Could not open driver module %.40s: %s",
|
||||
driver->filename, dlerror());
|
||||
#else
|
||||
/* REVISIT: replace dlerror() */
|
||||
report(RPT_ERR, "Could not open driver module %.40s.",
|
||||
driver->filename);
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -249,21 +235,13 @@ driver_bind_module(Driver *driver)
|
||||
strcpy(s, *(driver->symbol_prefix));
|
||||
strcat(s, driver_symbols[i].name);
|
||||
debug(RPT_DEBUG, "%s: finding symbol: %s", __FUNCTION__, s);
|
||||
#ifndef WIN32
|
||||
*p = dlsym(driver->module_handle, s);
|
||||
#else
|
||||
*p = (void(*)()) (GetProcAddress(driver->module_handle, s));
|
||||
#endif
|
||||
free(s);
|
||||
}
|
||||
/* 2) try to retrieve the symbol without the symbol prefix */
|
||||
if (*p == NULL) {
|
||||
debug(RPT_DEBUG, "%s: finding symbol: %s", __FUNCTION__, driver_symbols[i].name);
|
||||
#ifndef WIN32
|
||||
*p = dlsym(driver->module_handle, driver_symbols[i].name);
|
||||
#else
|
||||
*p = (void(*)()) (GetProcAddress(driver->module_handle, driver_symbols[i].name));
|
||||
#endif
|
||||
}
|
||||
|
||||
if (*p != NULL) {
|
||||
@@ -283,11 +261,7 @@ driver_bind_module(Driver *driver)
|
||||
if (missing_symbols > 0) {
|
||||
report(RPT_ERR, "Driver [%.40s] misses %d required symbols",
|
||||
driver->name, missing_symbols);
|
||||
#ifndef WIN32
|
||||
dlclose(driver->module_handle);
|
||||
#else
|
||||
FreeLibrary(driver->module_handle);
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -325,11 +299,7 @@ driver_unbind_module(Driver *driver)
|
||||
{
|
||||
debug(RPT_DEBUG, "%s(driver=[%.40s])", __FUNCTION__, driver->name);
|
||||
|
||||
#ifndef WIN32
|
||||
dlclose(driver->module_handle);
|
||||
#else
|
||||
FreeLibrary(driver->module_handle);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
#define COMMAND_LRNLONG 12
|
||||
#define COMMAND_LRNRAWRPT 13
|
||||
#define COMMAND_RELOAD 14
|
||||
#define COMMAND_LCD 15
|
||||
#define COMMAND_LCD 15
|
||||
#define COMMAND_LEARNSTAT 16
|
||||
#define COMMAND_TEMP 17
|
||||
#define COMMAND_GETREMOTES 18
|
||||
@@ -306,18 +306,9 @@ typedef struct {
|
||||
}
|
||||
NETWORKCLIENT;
|
||||
|
||||
#define TCP_PORT 21000
|
||||
#define LIRC_PORT 8765
|
||||
#define UDP_PORT 6510
|
||||
#define WEB_PORT 80
|
||||
#define TCP_PORT 21000
|
||||
#define LIRC_PORT 8765
|
||||
#define UDP_PORT 6510
|
||||
#define WEB_PORT 80
|
||||
#define ALTERNATE_WEB 8080
|
||||
|
||||
#ifdef WIN32
|
||||
#define CLIENT_COUNT MAXIMUM_WAIT_OBJECTS - 3
|
||||
#endif /*
|
||||
*/
|
||||
|
||||
#ifdef LINUX
|
||||
#define CLIENT_COUNT 64
|
||||
#endif /*
|
||||
*/
|
||||
|
||||
+2
-58
@@ -20,7 +20,6 @@
|
||||
* 2001, Rene Wagner
|
||||
* 2002, Mike Patnode
|
||||
* 2002, Guillaume Filion
|
||||
* 2003, Benjamin Tse (Win32 support)
|
||||
* 2005-2006, Peter Marschall (cleanup)
|
||||
*/
|
||||
|
||||
@@ -34,10 +33,8 @@
|
||||
#include <strings.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#ifndef WIN32
|
||||
# include <pwd.h>
|
||||
# include <sys/wait.h>
|
||||
#endif
|
||||
#include <pwd.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
@@ -542,7 +539,6 @@ set_default_settings(void)
|
||||
static void
|
||||
install_signal_handlers(int allow_reload)
|
||||
{
|
||||
#ifndef WIN32
|
||||
/* Installs signal handlers so that the program does clean exit and
|
||||
* can also receive a reload signal.
|
||||
* sigaction() is favoured over signal() */
|
||||
@@ -574,15 +570,6 @@ install_signal_handlers(int allow_reload)
|
||||
/* Treat this signal just like INT and TERM */
|
||||
}
|
||||
sigaction(SIGHUP, &sa, NULL);
|
||||
#else
|
||||
/* Win32 does not support POSIX signals i.e. sigaction(). However, it does
|
||||
* support ANSI signals in mingw. */
|
||||
signal(SIGINT, exit_program); /* Ctrl-C will cause a clean exit...*/
|
||||
signal(SIGTERM, exit_program); /* and "kill"...*/
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
|
||||
/* REVISIT: implement SIGHUP on windows */
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -601,13 +588,6 @@ child_ok_func(int signal)
|
||||
static pid_t
|
||||
daemonize(void)
|
||||
{
|
||||
#ifdef WIN32
|
||||
/* WIN32 does not support fork() - CreateProcess() does not even have
|
||||
* similar functionality. Instead don't daemonize on WIN32.
|
||||
*/
|
||||
pid_t parent;
|
||||
parent = getpid();
|
||||
#else
|
||||
pid_t child;
|
||||
pid_t parent;
|
||||
int child_status;
|
||||
@@ -659,7 +639,6 @@ daemonize(void)
|
||||
|
||||
setsid(); /* Create a new session because otherwise we'll
|
||||
* catch a SIGHUP when the shell is closed. */
|
||||
#endif
|
||||
|
||||
return parent;
|
||||
}
|
||||
@@ -668,11 +647,9 @@ daemonize(void)
|
||||
static int
|
||||
wave_to_parent(pid_t parent_pid)
|
||||
{
|
||||
#ifndef WIN32
|
||||
debug(RPT_DEBUG, "%s(parent_pid=%d)", __FUNCTION__, parent_pid);
|
||||
|
||||
kill(parent_pid, SIGUSR1);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -722,7 +699,6 @@ init_drivers(void)
|
||||
static int
|
||||
drop_privs(char *user)
|
||||
{
|
||||
#ifndef WIN32
|
||||
struct passwd *pwent;
|
||||
|
||||
debug(RPT_DEBUG, "%s(user=\"%.40s\")", __FUNCTION__, user);
|
||||
@@ -738,9 +714,6 @@ drop_privs(char *user)
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
/* Don't alter privileges in WIN32 */
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -782,14 +755,8 @@ static void
|
||||
do_mainloop(void)
|
||||
{
|
||||
Screen *s;
|
||||
#ifndef WIN32
|
||||
struct timeval t;
|
||||
struct timeval last_t;
|
||||
#else
|
||||
LARGE_INTEGER t;
|
||||
LARGE_INTEGER last_t;
|
||||
LARGE_INTEGER perf_freq; /* frequency of high perf counter (cycles per usec) */
|
||||
#endif
|
||||
int sleeptime;
|
||||
long int process_lag = 0;
|
||||
long int render_lag = 0;
|
||||
@@ -797,20 +764,11 @@ do_mainloop(void)
|
||||
|
||||
debug(RPT_DEBUG, "%s()", __FUNCTION__);
|
||||
|
||||
#ifndef WIN32
|
||||
gettimeofday(&t, NULL); /* Get initial time */
|
||||
#else
|
||||
QueryPerformanceFrequency(&perf_freq);
|
||||
/* scale perf_freq to number of cycles per micro-sec */
|
||||
/* REVISIT: this causes rounding errors below but is more efficient */
|
||||
perf_freq.QuadPart /= 1e6;
|
||||
QueryPerformanceCounter(&t);
|
||||
#endif
|
||||
|
||||
while (1) {
|
||||
/* Get current time */
|
||||
last_t = t;
|
||||
#ifndef WIN32
|
||||
gettimeofday(&t, NULL);
|
||||
t_diff = t.tv_sec - last_t.tv_sec;
|
||||
if ( ((t_diff + 1) > (LONG_MAX / 1e6)) || (t_diff < 0) ) {
|
||||
@@ -822,15 +780,6 @@ do_mainloop(void)
|
||||
t_diff *= 1e6;
|
||||
t_diff += t.tv_usec - last_t.tv_usec;
|
||||
}
|
||||
#else
|
||||
QueryPerformanceCounter(&t);
|
||||
/*t_diff.HighPart = t.HighPart - last_t.HighPart;
|
||||
t_diff.LowPart = t.LowPart - last_t.LowPart;
|
||||
*/
|
||||
t_diff = t.QuadPart - last_t.QuadPart;
|
||||
t_diff /= perf_freq.QuadPart; /* scale to microseconds */
|
||||
/* REVISIT: assumes fits into long */
|
||||
#endif
|
||||
process_lag += t_diff;
|
||||
if (process_lag > 0) {
|
||||
/* Time for a processing stroke */
|
||||
@@ -870,12 +819,7 @@ do_mainloop(void)
|
||||
/* Sleep just as long as needed */
|
||||
sleeptime = min(0-process_lag, 0-render_lag);
|
||||
if (sleeptime > 0) {
|
||||
#ifndef WIN32
|
||||
usleep(sleeptime);
|
||||
#else
|
||||
/* Sleep in Windows takes milliseconds argument */
|
||||
Sleep(sleeptime / 1000);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Check if a SIGHUP has been caught */
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
* Refer to the COPYING file distributed with this package.
|
||||
*
|
||||
* Copyright (c) 1999, William Ferrell, Scott Scriven
|
||||
* 2003, Benjamin Tse (blt@ieee.org) - Winsock port
|
||||
* 2004, F5 Networks, Inc. - IP-address input
|
||||
* 2005, Peter Marschall - error checks, ...
|
||||
* 2009, Markus Dolze - input ring buffer
|
||||
@@ -24,15 +23,11 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef WINSOCK2
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <arpa/inet.h>
|
||||
#endif /* WINSOCK */
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
@@ -95,17 +90,6 @@ sock_init(char* bind_addr, int bind_port)
|
||||
{
|
||||
int i;
|
||||
|
||||
#ifdef WINSOCK2
|
||||
/* Initialize the Winsock dll */
|
||||
WSADATA wsaData;
|
||||
int startup = WSAStartup(MAKEWORD(2, 2), &wsaData);
|
||||
if (startup != 0) {
|
||||
report(RPT_ERR, "%s: Could not start Winsock library - %s",
|
||||
__FUNCTION__, sock_geterror());
|
||||
}
|
||||
/* REVISIT: call WSACleanup(); */
|
||||
#endif
|
||||
|
||||
debug(RPT_DEBUG, "%s(bind_addr=\"%s\", port=%d)", __FUNCTION__, bind_addr, bind_port);
|
||||
|
||||
/* Create the socket and set it up to accept connections. */
|
||||
@@ -198,14 +182,6 @@ sock_shutdown(void)
|
||||
free(freeClientSocketPool);
|
||||
sring_destroy(messageRing);
|
||||
|
||||
#ifdef WINSOCK2
|
||||
if (WSACleanup() != 0) {
|
||||
report(RPT_ERR, "%s: Error closing Winsock library - %s",
|
||||
__FUNCTION__, sock_geterror());
|
||||
retVal = -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@@ -227,11 +203,7 @@ sock_create_inet_socket(char *addr, unsigned int port)
|
||||
|
||||
/* Create the socket. */
|
||||
sock = socket(PF_INET, SOCK_STREAM, 0);
|
||||
#ifdef WINSOCK2
|
||||
if (sock == INVALID_SOCKET)
|
||||
#else
|
||||
if (sock < 0)
|
||||
#endif
|
||||
{
|
||||
report(RPT_ERR, "%s: cannot create socket - %s",
|
||||
__FUNCTION__, sock_geterror());
|
||||
@@ -248,12 +220,7 @@ sock_create_inet_socket(char *addr, unsigned int port)
|
||||
memset(&name, 0, sizeof(name));
|
||||
name.sin_family = AF_INET;
|
||||
name.sin_port = htons(port);
|
||||
#ifndef WINSOCK2
|
||||
/* REVISIT: can probably use the same code as under winsock */
|
||||
inet_aton(addr, &name.sin_addr);
|
||||
#else
|
||||
name.sin_addr.S_un.S_addr = inet_addr(addr);
|
||||
#endif
|
||||
|
||||
if (bind(sock, (struct sockaddr *) &name, sizeof(name)) < 0) {
|
||||
report(RPT_ERR, "%s: cannot bind to port %d at address %s - %s",
|
||||
@@ -317,11 +284,7 @@ sock_poll_clients(void)
|
||||
socklen_t size = sizeof(clientname);
|
||||
|
||||
new_sock = accept(listening_fd, (struct sockaddr *) &clientname, &size);
|
||||
#ifdef WINSOCK2
|
||||
if (new_sock == INVALID_SOCKET) {
|
||||
#else
|
||||
if (new_sock < 0) {
|
||||
#endif
|
||||
report(RPT_ERR, "%s: Accept error - %s",
|
||||
__FUNCTION__, sock_geterror());
|
||||
return -1;
|
||||
@@ -330,14 +293,7 @@ sock_poll_clients(void)
|
||||
inet_ntoa(clientname.sin_addr), ntohs(clientname.sin_port), new_sock);
|
||||
FD_SET(new_sock, &active_fd_set);
|
||||
|
||||
#ifdef WINSOCK2
|
||||
{
|
||||
unsigned long tmp;
|
||||
ioctlsocket(new_sock, FIONBIO, &tmp);
|
||||
}
|
||||
#else
|
||||
fcntl(new_sock, F_SETFL, O_NONBLOCK);
|
||||
#endif
|
||||
|
||||
/* Create new client */
|
||||
if ((c = client_create(new_sock)) == NULL) {
|
||||
|
||||
Reference in New Issue
Block a user