diff --git a/src/Makefile.am b/src/Makefile.am index eecb8860..4d042ff2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -26,7 +26,7 @@ wavstreamer_SOURCES = wavstreamer.c mt_daapd_CPPFLAGS = @AVAHI_CFLAGS@ @SQLITE3_CFLAGS@ @ID3TAG_CFLAGS@ @OGGVORBIS_CFLAGS@ @TAGLIB_CFLAGS@ mt_daapd_LDADD = @AVAHI_LIBS@ @SQLITE3_LIBS@ @ID3TAG_LIBS@ @OGGVORBIS_LIBS@ @FLAC_LIBS@ @TAGLIB_LIBS@ mt_daapd_SOURCES = main.c daapd.h rend.h webserver.c \ - webserver.h configfile.c configfile.h err.c err.h restart.c restart.h \ + webserver.h configfile.c configfile.h err.c err.h \ mp3-scanner.h mp3-scanner.c \ db-generic.c db-generic.h ff-plugins.c ff-plugins.h \ rxml.c rxml.h redblack.c redblack.h scan-mp3.c scan-aif.c \ diff --git a/src/configfile.c b/src/configfile.c index 38751c73..1de9eac0 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -55,7 +55,6 @@ #include "db-generic.h" #include "err.h" #include "os.h" -#include "restart.h" #include "xml-rpc.h" #include "upnp.h" #include "rend.h" diff --git a/src/daapd.h b/src/daapd.h index 91f102df..02d0e273 100644 --- a/src/daapd.h +++ b/src/daapd.h @@ -57,7 +57,6 @@ #include "webserver.h" /** Simple struct for holding stat info. - * \todo wire up the tag_stats#bytes_served stuff into r_write() in restart.c */ typedef struct tag_stats { time_t start_time; /**< When the server was started */ diff --git a/src/db-sql.c b/src/db-sql.c index efa196b2..f1af55fa 100644 --- a/src/db-sql.c +++ b/src/db-sql.c @@ -42,7 +42,6 @@ #include "mp3-scanner.h" #include "db-generic.h" #include "db-sql.h" -#include "restart.h" #include "smart-parser.h" #include "plugin.h" #include "conf.h" /* FIXME */ diff --git a/src/main.c b/src/main.c index 070a09a0..5e2b7a83 100644 --- a/src/main.c +++ b/src/main.c @@ -82,7 +82,6 @@ #include "err.h" #include "mp3-scanner.h" #include "webserver.h" -#include "restart.h" #include "db-generic.h" #include "os.h" #include "plugin.h" diff --git a/src/mp3-scanner.c b/src/mp3-scanner.c index 2621fe01..e49b787e 100644 --- a/src/mp3-scanner.c +++ b/src/mp3-scanner.c @@ -52,7 +52,6 @@ #include "io.h" #include "mp3-scanner.h" #include "os.h" -#include "restart.h" #include "util.h" /* diff --git a/src/plugin.c b/src/plugin.c index 6f72957b..09f65482 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -58,7 +58,6 @@ #include "os.h" #include "plugin.h" #include "rend.h" -#include "restart.h" #include "smart-parser.h" #include "xml-rpc.h" #include "webserver.h" diff --git a/src/restart.c b/src/restart.c deleted file mode 100644 index 2a285359..00000000 --- a/src/restart.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Restart Library - * - * ** NOTICE ** - * - * This code is written by (and is therefore copyright) Dr Kay Robbins - * (krobbins@cs.utsa.edu) and Dr. Steve Robbins (srobbins@cs.utsa.edu), - * and was released with unspecified licensing as part of their book - * _UNIX_Systems_Programming_ (Prentice Hall, ISBN: 0130424110). - * - * Dr. Steve Robbins was kind enough to allow me to re-license this - * software as GPL. I would request that any bugs or problems with - * this code be brought to my attention (ron@pedde.com), and I will - * submit appropriate patches upstream, should the problem be with - * the original code. - * - * ** NOTICE ** - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include -#include -#include -#include -#ifdef HAVE_SYS_SELECT_H -# include -#endif -#ifdef HAVE_SYS_TIME_H -# include -#endif -#ifdef HAVE_SYS_WAIT_H -# include -#endif - -#include "daapd.h" -#include "err.h" -#include "restart.h" - -#define BLKSIZE PIPE_BUF - -/* Private functions */ - -int r_fdprintf(int fd, char *fmt, ...) { - char buffer[1024]; - va_list ap; - - va_start(ap, fmt); - vsnprintf(buffer, 1024, fmt, ap); - va_end(ap); - - return r_write(fd,buffer,strlen(buffer)); -} - -/* Restart versions of traditional functions */ - -int r_close(int fildes) { - int retval; - while (retval = close(fildes), retval == -1 && errno == EINTR) ; - return retval; -} - -int r_dup2(int fildes, int fildes2) { - int retval; - while (retval = dup2(fildes, fildes2), retval == -1 && errno == EINTR) ; - return retval; -} - - -int r_open2(const char *path, int oflag) { - int retval; - while (retval = open(path, oflag), retval == -1 && errno == EINTR) ; - return retval; -} - -ssize_t r_read(int fd, void *buf, size_t size) { - ssize_t retval; - while (((retval = read(fd, buf, (int)size)) == -1) && (errno==EINTR)) {}; - return retval; -} - -ssize_t r_write(int fd, void *buf, size_t size) { - char *bufp; - size_t bytestowrite; - ssize_t byteswritten; - size_t totalbytes; - - for (bufp = buf, bytestowrite = size, totalbytes = 0; - bytestowrite > 0; - bufp += byteswritten, bytestowrite -= byteswritten) { - byteswritten = write(fd, bufp, bytestowrite); - if ((byteswritten) == -1 && (errno != EINTR)) - return -1; - if (byteswritten == -1) - byteswritten = 0; - totalbytes += byteswritten; - } - return (ssize_t) totalbytes; -} - -/* Utility functions */ - -ssize_t readblock(int fd, void *buf, size_t size) { - char *bufp; - ssize_t bytesread; - size_t bytestoread; - size_t totalbytes; - - for (bufp = buf, bytestoread = size, totalbytes = 0; - bytestoread > 0; - bufp += bytesread, bytestoread -= bytesread) { - bytesread = read(fd, bufp, bytestoread); - if ((bytesread == 0) && (totalbytes == 0)) - return 0; - if (bytesread == 0) { - errno = EINVAL; - return -1; - } - if ((bytesread) == -1 && (errno != EINTR)) - return -1; - if (bytesread == -1) - bytesread = 0; - totalbytes += bytesread; - } - return (ssize_t) totalbytes; -} - -int readline(int fd, char *buf, int nbytes) { - int numread = 0; - int returnval; - - while (numread < nbytes - 1) { - returnval = read(fd, buf + numread, 1); - if ((returnval == -1) && (errno == EINTR)) - continue; - if ((returnval == 0) && (numread == 0)) - return 0; - if (returnval == 0) - break; - if (returnval == -1) - return -1; - numread++; - if (buf[numread-1] == '\n') { - buf[numread] = '\0'; - return numread; - } - } - errno = EINVAL; - return -1; -} - - - diff --git a/src/restart.h b/src/restart.h deleted file mode 100644 index 19729f01..00000000 --- a/src/restart.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Restart Library - * - * ** NOTICE ** - * - * This code is written by (and is therefore copyright) Dr Kay Robbins - * (krobbins@cs.utsa.edu) and Dr. Steve Robbins (srobbins@cs.utsa.edu), - * and was released with unspecified licensing as part of their book - * _UNIX_Systems_Programming_ (Prentice Hall, ISBN: 0130424110). - * - * Dr. Steve Robbins was kind enough to allow me to re-license this - * software as GPL. I would request that any bugs or problems with - * this code be brought to my attention (ron@pedde.com), and I will - * submit appropriate patches upstream, should the problem be with - * the original code. - * - * ** NOTICE ** - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include - -#ifdef HAVE_UNISTD_H -# include -#endif - -#ifdef HAVE_SYS_TIME_H -# include -#endif - -#include - -#ifndef ETIME -#define ETIME ETIMEDOUT -#endif - -struct timeval add2currenttime(double seconds); -int copyfile(int fromfd, int tofd); -int r_fdprintf(int fd, char *fmt, ...); -int r_close(int fildes); -int r_dup2(int fildes, int fildes2); -int r_open2(const char *path, int oflag); -ssize_t r_read(int fd, void *buf, size_t size); -ssize_t r_write(int fd, void *buf, size_t size); -ssize_t readblock(int fd, void *buf, size_t size); -int readline(int fd, char *buf, int nbytes); -int readlinetimed(int fd, char *buf, int nbytes, double seconds); -ssize_t readtimed(int fd, void *buf, size_t nbyte, double seconds); -int readwrite(int fromfd, int tofd); -int readwriteblock(int fromfd, int tofd, char *buf, int size); -int waitfdtimed(int fd, struct timeval end); diff --git a/src/scan-flac.c b/src/scan-flac.c index a728392a..06b9d224 100644 --- a/src/scan-flac.c +++ b/src/scan-flac.c @@ -43,7 +43,6 @@ #include #include "daapd.h" -#include "restart.h" #include "err.h" #include "mp3-scanner.h" diff --git a/src/scan-wma.c b/src/scan-wma.c index 3b826e4b..520b1b27 100644 --- a/src/scan-wma.c +++ b/src/scan-wma.c @@ -34,7 +34,6 @@ #include "daapd.h" #include "io.h" #include "mp3-scanner.h" -#include "restart.h" #include "err.h" typedef struct tag_wma_guidlist {