www: $(gen_html) $(gruta_html) $(web_pics) $(web_misc) $(shots) tags doxygen
client_objs = client.cmdline.o client.o net.o string.o crypt.o
-gui_objs = gui.cmdline.o gui.o gui_common.o exec.o close_on_fork.o signal.o \
- string.o gui_theme.o stat.o ringbuffer.o fd.o
sdl_gui_objs = sdl_gui.cmdline.o SFont.o sdl_gui.o gui_common.o exec.o \
close_on_fork.o string.o stat.o fd.o
dbadm_objs = dbadm.o exec.o close_on_fork.o string.o
para_client: $(client_objs)
$(CC) -o $@ $(client_objs) $(SSL_LDFLAGS) -lreadline -lncurses $(SSL_LIBS)
-para_gui: $(gui_objs)
- $(CC) -o $@ $(gui_objs) -lncurses
+para_gui: @gui_objs@
+ $(CC) -o $@ @gui_objs@ -lncurses
para_audiod: @audiod_objs@
$(CC) -o $@ @audiod_objs@ @audiod_ldflags@
s->write_fd = fds[0];
add_close_on_fork_list(s->write_fd);
/* we write to this fd in do_select, so we need non-blocking */
- fcntl(s->write_fd, F_SETFL, O_NONBLOCK);
+ mark_fd_nonblock(s->write_fd);
gettimeofday(&s->wstime, NULL);
current_decoder = slot_num;
activate_inactive_grab_clients(slot_num, s->format, &s->fci->filters);
AC_SUBST(server_ldflags, $server_ldflags)
AC_DEFINE_UNQUOTED(INIT_SERVER_ERRLISTS,
objlist_to_errlist($server_errlist_objs), errors used by para_server)
+
+gui_cmdline_objs="gui.cmdline"
+gui_errlist_objs="exec close_on_fork signal string stat ringbuffer fd"
+gui_other_objs="gui gui_common gui_theme"
+gui_objs="$gui_cmdline_objs $gui_errlist_objs $gui_other_objs"
+AC_DEFINE_UNQUOTED(INIT_GUI_ERRLISTS,
+ objlist_to_errlist($gui_errlist_objs), errors used by para_gui)
+AC_SUBST(gui_objs, add_dot_o($gui_objs))
+
AC_OUTPUT
AC_MSG_NOTICE([creating Makefile.deps])
gcc -MM -MG *.c > Makefile.deps
SS_DCCP_RECV,
SS_DCCP_SEND,
SS_FD,
+ SS_GUI,
SS_RINGBUFFER};
#define NUM_SS (SS_RINGBUFFER + 1)
PARA_ERROR(SIGNAL_SIG_ERR, "signal() retured SIG_ERR"), \
PARA_ERROR(SIGNAL_READ, "read error from signal pipe"), \
PARA_ERROR(WAITPID, "waitpid error"), \
+ PARA_ERROR(SIGNAL_PIPE, "failed to setup signal pipe"), \
#define STRING_ERRORS \
PARA_ERROR(DCCP_LISTEN, "dccp listen error"), \
PARA_ERROR(DCCP_WRITE, "dccp write error"), \
+#define FD_ERRORS \
+ PARA_ERROR(F_GETFL, "failed to get fd flags"), \
+ PARA_ERROR(F_SETFL, "failed to set fd flags")
/* these do not need error handling (yet) */
#define SERVER_ERRORS
#define CLOSE_ON_FORK_ERRORS
#define DAEMON_ERRORS
#define ORTP_SEND_ERRORS
+#define GUI_ERRORS
#define RINGBUFFER_ERRORS
-#define FD_ERRORS
/**
SS_ENUM(DCCP_RECV);
SS_ENUM(DCCP_SEND);
SS_ENUM(FD);
+SS_ENUM(GUI);
SS_ENUM(RINGBUFFER);
/** \endcond */
#undef PARA_ERROR
#include "para.h"
+#include "error.h"
/**
* check whether a file exists
*
PARA_CRIT_LOG("select error (%s)\n", strerror(err));
return ret;
}
+
+int mark_fd_nonblock(int fd)
+{
+ int flags = fcntl(fd, F_GETFL);
+ if (flags < 0)
+ return -E_F_GETFL;
+ if (fcntl(fd, F_SETFL, ((long)flags) | O_NONBLOCK) < 0)
+ return -E_F_SETFL;
+ return 1;
+}
+
/** \file fd.h file handling functions */
int file_exists(const char *);
-
int para_select(int n, fd_set *readfds, fd_set *writefds,
struct timeval *timeout);
+int mark_fd_nonblock(int fd);
#include "ringbuffer.h"
#include "string.h"
#include "fd.h"
+#include "error.h"
+/** define the array of error lists needed by para_gui */
+INIT_GUI_ERRLISTS;
extern const char *status_item_list[NUM_STAT_ITEMS];
static char *stat_content[NUM_STAT_ITEMS];
int ret = 0;
signal_pipe = para_signal_init();
-// fcntl(signal_pipe, F_SETFL, O_NONBLOCK);
PARA_NOTICE_LOG("%s", "setting up signal handlers\n");
ret += para_install_sighandler(SIGINT);
ret += para_install_sighandler(SIGTERM);
/** \file signal.c signal handling functions */
#include "para.h"
+#include "fd.h"
#include "error.h"
static int signal_pipe[2];
*/
int para_signal_init(void)
{
- int i;
+ int ret = -E_SIGNAL_PIPE;
if (pipe(signal_pipe))
goto err_out;
- for (i = 0; i < 2; i++) {
- int fd = signal_pipe[i], flags = fcntl(fd, F_GETFL);
- if (flags < 0)
- goto err_out;
- if (fcntl(fd, F_SETFL, ((long)flags) | O_NONBLOCK) < 0)
- goto err_out;
- }
+ ret = mark_fd_nonblock(signal_pipe[0]);
+ if (ret < 0)
+ goto err_out;
+ ret = mark_fd_nonblock(signal_pipe[1]);
+ if (ret < 0)
+ goto err_out;
return signal_pipe[0];
err_out:
- PARA_EMERG_LOG("%s", "pipe error: Can not setup signal pipe");
+ PARA_EMERG_LOG("%s\n", PARA_STRERROR(-ret));
exit(EXIT_FAILURE);
}