libipc now uses 64-bit float (double) timers.
parent
290a693572
commit
062c36a2f3
24
Makefile
24
Makefile
|
@ -1,5 +1,5 @@
|
|||
PACKAGE = 'libipc'
|
||||
VERSION = '0.5.1'
|
||||
VERSION = '0.6.0'
|
||||
|
||||
PREFIX := /usr/local
|
||||
BINDIR := $(PREFIX)/bin
|
||||
|
@ -50,25 +50,25 @@ libipc.so: src/communication.o src/error.o src/fs.o src/message.o src/network.o
|
|||
$(Q)$(CC) -o libipc.so -shared $(LDFLAGS) src/communication.o src/error.o src/fs.o src/message.o src/network.o src/print.o src/usocket.o src/utils.o
|
||||
|
||||
libipc.so.install: libipc.so
|
||||
@echo '[01;31m IN > [01;37m$(LIBDIR)/libipc.so.0.5.1[00m'
|
||||
@echo '[01;31m IN > [01;37m$(LIBDIR)/libipc.so.0.6.0[00m'
|
||||
$(Q)mkdir -p '$(DESTDIR)$(LIBDIR)'
|
||||
$(Q)install -m0755 libipc.so $(DESTDIR)$(LIBDIR)/libipc.so.0.5.1
|
||||
@echo '[01;35m LN > [01;37m$(LIBDIR)/libipc.so.0.5[00m'
|
||||
$(Q)ln -sf '$(LIBDIR)/libipc.so.0.5.1' '$(DESTDIR)/$(LIBDIR)/libipc.so.0.5'
|
||||
$(Q)install -m0755 libipc.so $(DESTDIR)$(LIBDIR)/libipc.so.0.6.0
|
||||
@echo '[01;35m LN > [01;37m$(LIBDIR)/libipc.so.0.6[00m'
|
||||
$(Q)ln -sf '$(LIBDIR)/libipc.so.0.6.0' '$(DESTDIR)/$(LIBDIR)/libipc.so.0.6'
|
||||
@echo '[01;35m LN > [01;37m$(LIBDIR)/libipc.so.0[00m'
|
||||
$(Q)ln -sf '$(LIBDIR)/libipc.so.0.5.1' '$(DESTDIR)/$(LIBDIR)/libipc.so.0'
|
||||
$(Q)ln -sf '$(LIBDIR)/libipc.so.0.6.0' '$(DESTDIR)/$(LIBDIR)/libipc.so.0'
|
||||
@echo '[01;35m LN > [01;37m$(LIBDIR)/libipc.so[00m'
|
||||
$(Q)ln -sf '$(LIBDIR)/libipc.so.0.5.1' '$(DESTDIR)/$(LIBDIR)/libipc.so'
|
||||
$(Q)ln -sf '$(LIBDIR)/libipc.so.0.6.0' '$(DESTDIR)/$(LIBDIR)/libipc.so'
|
||||
|
||||
libipc.so.clean:
|
||||
@echo '[01;37m RM > [01;37mlibipc.so[00m'
|
||||
$(Q)rm -f libipc.so
|
||||
|
||||
libipc.so.uninstall:
|
||||
@echo '[01;37m RM > [01;37m$(LIBDIR)/libipc.so.0.5.1[00m'
|
||||
$(Q)rm -f '$(DESTDIR)$(LIBDIR)/libipc.so.0.5.1'
|
||||
@echo '[01;37m RM > [01;37m$(LIBDIR)/libipc.so.0.5[00m'
|
||||
$(Q)rm -f '$(DESTDIR)$(LIBDIR)/libipc.so.0.5'
|
||||
@echo '[01;37m RM > [01;37m$(LIBDIR)/libipc.so.0.6.0[00m'
|
||||
$(Q)rm -f '$(DESTDIR)$(LIBDIR)/libipc.so.0.6.0'
|
||||
@echo '[01;37m RM > [01;37m$(LIBDIR)/libipc.so.0.6[00m'
|
||||
$(Q)rm -f '$(DESTDIR)$(LIBDIR)/libipc.so.0.6'
|
||||
@echo '[01;37m RM > [01;37m$(LIBDIR)/libipc.so.0[00m'
|
||||
$(Q)rm -f '$(DESTDIR)$(LIBDIR)/libipc.so.0'
|
||||
@echo '[01;37m RM > [01;37m$(LIBDIR)/libipc.so[00m'
|
||||
|
@ -297,7 +297,7 @@ $(PACKAGE)-$(VERSION).tar.bz2: distdir
|
|||
$(PACKAGE)-$(VERSION)/src/utils.h
|
||||
|
||||
help:
|
||||
@echo '[01;37m :: libipc-0.5.1[00m'
|
||||
@echo '[01;37m :: libipc-0.6.0[00m'
|
||||
@echo ''
|
||||
@echo '[01;37mGeneric targets:[00m'
|
||||
@echo '[00m - [01;32mhelp [37m Prints this help message.[00m'
|
||||
|
|
|
@ -21,8 +21,8 @@ struct ipc_connection_infos *clients = NULL;
|
|||
|
||||
void main_loop ()
|
||||
{
|
||||
long base_timer = 0;
|
||||
long timer = base_timer;
|
||||
double base_timer = 0;
|
||||
double timer = base_timer;
|
||||
SECURE_DECLARATION (struct ipc_error, ret);
|
||||
|
||||
clients = malloc (sizeof (struct ipc_connection_infos));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
package=libipc # Package name.
|
||||
version=0.5.1 # Package version.
|
||||
version=0.6.0 # Package version.
|
||||
|
||||
# Our targets are the library and its documentation.
|
||||
targets=(libipc man/libipc.7)
|
||||
|
|
|
@ -368,7 +368,7 @@ struct ipc_error handle_message (struct ipc_event *event, struct ipc_connection_
|
|||
struct ipc_error ipc_wait_event_networkd (struct ipc_connection_infos *cinfos
|
||||
, struct ipc_connection_info *cinfo // NULL for clients
|
||||
, struct ipc_event *event, struct ipc_switchings *switchdb
|
||||
, long *timer)
|
||||
, double *timer)
|
||||
{
|
||||
T_R ((cinfos == NULL), IPC_ERROR_WAIT_EVENT__NO_CLIENTS_PARAM);
|
||||
T_R ((event == NULL), IPC_ERROR_WAIT_EVENT__NO_EVENT_PARAM);
|
||||
|
@ -410,15 +410,16 @@ struct ipc_error ipc_wait_event_networkd (struct ipc_connection_infos *cinfos
|
|||
struct timeval *ptimeout = NULL;
|
||||
SECURE_DECLARATION (struct timeval, timeout);
|
||||
|
||||
if (timer != NULL && *timer > 0) {
|
||||
timeout.tv_sec = *timer;
|
||||
if (timer != NULL && *timer > 0.0) {
|
||||
timeout.tv_sec = (long) *timer;
|
||||
timeout.tv_usec = (long) ((long)((*timer) * 1000000) % 1000000);
|
||||
ptimeout = &timeout;
|
||||
}
|
||||
|
||||
T_PERROR_RIPC ((select (fdmax + 1, &readf, NULL, NULL, ptimeout) == -1), "select", IPC_ERROR_WAIT_EVENT__SELECT);
|
||||
|
||||
if (ptimeout != NULL) {
|
||||
*timer = timeout.tv_sec;
|
||||
*timer = (double) timeout.tv_sec + (timeout.tv_usec / 1000000.0);
|
||||
if (*timer == 0) {
|
||||
IPC_EVENT_SET (event, IPC_EVENT_TYPE_TIMER, NULL, NULL);
|
||||
IPC_RETURN_NO_ERROR;
|
||||
|
@ -444,7 +445,7 @@ struct ipc_error ipc_wait_event_networkd (struct ipc_connection_infos *cinfos
|
|||
|
||||
struct ipc_error ipc_wait_event (struct ipc_connection_infos *cinfos
|
||||
, struct ipc_connection_info *cinfo // NULL for clients
|
||||
, struct ipc_event *event, long *timer)
|
||||
, struct ipc_event *event, double *timer)
|
||||
{
|
||||
return ipc_wait_event_networkd (cinfos, cinfo, event, NULL, timer);
|
||||
}
|
||||
|
|
|
@ -251,7 +251,7 @@ struct ipc_error ipc_write (const struct ipc_connection_info *, const struct ipc
|
|||
|
||||
struct ipc_error ipc_wait_event (struct ipc_connection_infos *clients
|
||||
, struct ipc_connection_info *srv
|
||||
, struct ipc_event *event, long *timer);
|
||||
, struct ipc_event *event, double *timer);
|
||||
|
||||
// store and remove only pointers on allocated structures
|
||||
struct ipc_error ipc_add (struct ipc_connection_infos *, struct ipc_connection_info *);
|
||||
|
@ -324,7 +324,7 @@ struct networkd {
|
|||
|
||||
struct ipc_error ipc_wait_event_networkd (struct ipc_connection_infos *cinfos
|
||||
, struct ipc_connection_info *cinfo // cinfo is NULL for clients
|
||||
, struct ipc_event *event, struct ipc_switchings *switchdb, long *timer);
|
||||
, struct ipc_event *event, struct ipc_switchings *switchdb, double *timer);
|
||||
|
||||
void ipc_switching_add (struct ipc_switchings *is, int orig, int dest);
|
||||
int ipc_switching_del (struct ipc_switchings *is, int fd);
|
||||
|
|
Reference in New Issue