Commit bb10f2b4 authored by Aurelio Colosimo's avatar Aurelio Colosimo Committed by Alessandro Rubini

Make time-unix usable by a different time- too

In order to time-unix functions to be used externally, these three changes
are here made:
* created time-unix/unix-time.h
* removed static attribute from functions in time-unix
* added a proper include path to CFLAGS
Signed-off-by: Aurelio Colosimo's avatarAurelio Colosimo <aurelio@aureliocolosimo.it>
parent b5b630fc
...@@ -24,6 +24,7 @@ include time-$(TIME)/Makefile ...@@ -24,6 +24,7 @@ include time-$(TIME)/Makefile
# Unix time operations are always included as a fallback # Unix time operations are always included as a fallback
include time-unix/Makefile include time-unix/Makefile
CFLAGS += -Itime-unix
$(LIBARCH): $(OBJ-libarch) $(LIBARCH): $(OBJ-libarch)
$(AR) r $@ $^ $(AR) r $@ $^
......
...@@ -24,6 +24,7 @@ include time-$(TIME)/Makefile ...@@ -24,6 +24,7 @@ include time-$(TIME)/Makefile
# Unix time operations are always included as a fallback # Unix time operations are always included as a fallback
include time-unix/Makefile include time-unix/Makefile
CFLAGS += -Itime-unix
# mini-rpc directory contains minipc library # mini-rpc directory contains minipc library
MINIPC_DIR := $A/mini-rpc MINIPC_DIR := $A/mini-rpc
......
...@@ -90,7 +90,7 @@ static int unix_recv_msg(struct pp_instance *ppi, int fd, void *pkt, int len, ...@@ -90,7 +90,7 @@ static int unix_recv_msg(struct pp_instance *ppi, int fd, void *pkt, int len,
} }
/* Receive and send is *not* so trivial */ /* Receive and send is *not* so trivial */
static int unix_net_recv(struct pp_instance *ppi, void *pkt, int len, int unix_net_recv(struct pp_instance *ppi, void *pkt, int len,
TimeInternal *t) TimeInternal *t)
{ {
struct pp_channel *ch1, *ch2; struct pp_channel *ch1, *ch2;
...@@ -121,7 +121,7 @@ static int unix_net_recv(struct pp_instance *ppi, void *pkt, int len, ...@@ -121,7 +121,7 @@ static int unix_net_recv(struct pp_instance *ppi, void *pkt, int len,
return ret; return ret;
} }
static int unix_net_send(struct pp_instance *ppi, void *pkt, int len, int unix_net_send(struct pp_instance *ppi, void *pkt, int len,
TimeInternal *t, int chtype, int use_pdelay_addr) TimeInternal *t, int chtype, int use_pdelay_addr)
{ {
struct sockaddr_in addr; struct sockaddr_in addr;
...@@ -324,7 +324,7 @@ err_out: ...@@ -324,7 +324,7 @@ err_out:
return -1; return -1;
} }
static int unix_net_exit(struct pp_instance *ppi); int unix_net_exit(struct pp_instance *ppi);
/* /*
* Inits all the network stuff * Inits all the network stuff
...@@ -360,7 +360,7 @@ int unix_net_init(struct pp_instance *ppi) ...@@ -360,7 +360,7 @@ int unix_net_init(struct pp_instance *ppi)
/* /*
* Shutdown all the network stuff * Shutdown all the network stuff
*/ */
static int unix_net_exit(struct pp_instance *ppi) int unix_net_exit(struct pp_instance *ppi)
{ {
struct ip_mreq imr; struct ip_mreq imr;
int fd; int fd;
......
...@@ -16,7 +16,7 @@ static void clock_fatal_error(char *context) ...@@ -16,7 +16,7 @@ static void clock_fatal_error(char *context)
exit(1); exit(1);
} }
static int unix_time_get(struct pp_instance *ppi, TimeInternal *t) int unix_time_get(struct pp_instance *ppi, TimeInternal *t)
{ {
struct timespec tp; struct timespec tp;
if (clock_gettime(CLOCK_REALTIME, &tp) < 0) if (clock_gettime(CLOCK_REALTIME, &tp) < 0)
...@@ -79,7 +79,7 @@ int unix_time_adjust_freq(struct pp_instance *ppi, long freq_ppm) ...@@ -79,7 +79,7 @@ int unix_time_adjust_freq(struct pp_instance *ppi, long freq_ppm)
return unix_time_adjust(ppi, 0, freq_ppm); return unix_time_adjust(ppi, 0, freq_ppm);
} }
static unsigned long unix_calc_timeout(struct pp_instance *ppi, int millisec) unsigned long unix_calc_timeout(struct pp_instance *ppi, int millisec)
{ {
struct timespec now; struct timespec now;
uint64_t now_ms; uint64_t now_ms;
......
/*
* Aurelio Colosimo for CERN, 2013 -- public domain
*/
/* Defined in unix-socket.c */
int unix_net_init(struct pp_instance *ppi);
int unix_net_exit(struct pp_instance *ppi);
int unix_net_recv(struct pp_instance *ppi, void *pkt, int len,
TimeInternal *t);
int unix_net_send(struct pp_instance *ppi, void *pkt, int len,
TimeInternal *t, int chtype, int use_pdelay_addr);
/* Defined in unix-time.c */
int unix_time_get(struct pp_instance *ppi, TimeInternal *t);
int32_t unix_time_set(struct pp_instance *ppi, TimeInternal *t);
int unix_time_adjust(struct pp_instance *ppi, long offset_ns,
long freq_ppm);
int unix_time_adjust_offset(struct pp_instance *ppi, long offset_ns);
int unix_time_adjust_freq(struct pp_instance *ppi, long freq_ppm);
unsigned long unix_calc_timeout(struct pp_instance *ppi,
int millisec);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment