diff options
| author | 2021-02-01 14:46:34 -0500 | |
|---|---|---|
| committer | 2021-02-01 14:46:34 -0500 | |
| commit | 5a922fa1607be4b15afe18f592c86b175d8b834a (patch) | |
| tree | 40965df157bd15ea2f468e8372510728c837f1a6 /src/libopm | |
| parent | 6a0204e95aa5358ef2bf7714559ccd366dba4617 (diff) | |
New upstream version 1.1.10.upstream/1.1.10upstream
Diffstat (limited to 'src/libopm')
| -rw-r--r-- | src/libopm/src/Makefile.am | 28 | ||||
| -rw-r--r-- | src/libopm/src/Makefile.in | 36 | ||||
| -rw-r--r-- | src/libopm/src/libopm.c | 5 | ||||
| -rw-r--r-- | src/libopm/src/list.c | 2 | ||||
| -rw-r--r-- | src/libopm/src/list.h | 2 | ||||
| -rw-r--r-- | src/libopm/src/memory.c | 2 | ||||
| -rw-r--r-- | src/libopm/src/memory.h | 2 | ||||
| -rw-r--r-- | src/libopm/src/opm_gettime.c | 40 | ||||
| -rw-r--r-- | src/libopm/src/opm_gettime.h | 27 |
9 files changed, 110 insertions, 34 deletions
diff --git a/src/libopm/src/Makefile.am b/src/libopm/src/Makefile.am index 7726c07..b0c9504 100644 --- a/src/libopm/src/Makefile.am +++ b/src/libopm/src/Makefile.am @@ -1,18 +1,20 @@ noinst_LTLIBRARIES = libopm.la -libopm_la_SOURCES = config.c \ - config.h \ - libopm.c \ - libopm.h \ - list.c \ - list.h \ - memory.c \ - memory.h \ - opm_common.h \ - opm_error.h \ - opm.h \ - opm_types.h \ - proxy.c \ +libopm_la_SOURCES = config.c \ + config.h \ + libopm.c \ + libopm.h \ + list.c \ + list.h \ + memory.c \ + memory.h \ + opm_common.h \ + opm_error.h \ + opm.h \ + opm_gettime.c \ + opm_gettime.h \ + opm_types.h \ + proxy.c \ proxy.h libopm_la_LIBADD = @LTLIBOBJS@ diff --git a/src/libopm/src/Makefile.in b/src/libopm/src/Makefile.in index 99bd4d1..4153926 100644 --- a/src/libopm/src/Makefile.in +++ b/src/libopm/src/Makefile.in @@ -112,7 +112,8 @@ CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libopm_la_DEPENDENCIES = @LTLIBOBJS@ -am_libopm_la_OBJECTS = config.lo libopm.lo list.lo memory.lo proxy.lo +am_libopm_la_OBJECTS = config.lo libopm.lo list.lo memory.lo \ + opm_gettime.lo proxy.lo libopm_la_OBJECTS = $(am_libopm_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -135,7 +136,7 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/config.Plo ./$(DEPDIR)/libopm.Plo \ ./$(DEPDIR)/list.Plo ./$(DEPDIR)/memory.Plo \ - ./$(DEPDIR)/proxy.Plo + ./$(DEPDIR)/opm_gettime.Plo ./$(DEPDIR)/proxy.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -307,19 +308,21 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libopm.la -libopm_la_SOURCES = config.c \ - config.h \ - libopm.c \ - libopm.h \ - list.c \ - list.h \ - memory.c \ - memory.h \ - opm_common.h \ - opm_error.h \ - opm.h \ - opm_types.h \ - proxy.c \ +libopm_la_SOURCES = config.c \ + config.h \ + libopm.c \ + libopm.h \ + list.c \ + list.h \ + memory.c \ + memory.h \ + opm_common.h \ + opm_error.h \ + opm.h \ + opm_gettime.c \ + opm_gettime.h \ + opm_types.h \ + proxy.c \ proxy.h libopm_la_LIBADD = @LTLIBOBJS@ @@ -381,6 +384,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libopm.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memory.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opm_gettime.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proxy.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @@ -545,6 +549,7 @@ distclean: distclean-am -rm -f ./$(DEPDIR)/libopm.Plo -rm -f ./$(DEPDIR)/list.Plo -rm -f ./$(DEPDIR)/memory.Plo + -rm -f ./$(DEPDIR)/opm_gettime.Plo -rm -f ./$(DEPDIR)/proxy.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ @@ -595,6 +600,7 @@ maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/libopm.Plo -rm -f ./$(DEPDIR)/list.Plo -rm -f ./$(DEPDIR)/memory.Plo + -rm -f ./$(DEPDIR)/opm_gettime.Plo -rm -f ./$(DEPDIR)/proxy.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic diff --git a/src/libopm/src/libopm.c b/src/libopm/src/libopm.c index d6118ff..430a29d 100644 --- a/src/libopm/src/libopm.c +++ b/src/libopm/src/libopm.c @@ -44,6 +44,7 @@ #include "opm_error.h" #include "opm_types.h" #include "opm_common.h" +#include "opm_gettime.h" #include "list.h" #include "proxy.h" @@ -826,7 +827,7 @@ libopm_check_closed(OPM_T *scanner) if (LIST_SIZE(&scanner->scans) == 0) return; - time(&present); + present = opm_gettime(); timeout = *(int *)libopm_config(scanner->config, OPM_CONFIG_TIMEOUT); LIST_FOREACH_SAFE(node1, next1, scanner->scans.head) @@ -964,7 +965,7 @@ libopm_do_connect(OPM_T * scanner, OPM_SCAN_T *scan, OPM_CONNECTION_T *conn) #endif conn->state = OPM_STATE_ESTABLISHED; - time(&conn->creation); /* Stamp creation time, for timeout */ + conn->creation = opm_gettime(); /* Stamp creation time, for timeout */ } /* check_poll diff --git a/src/libopm/src/list.c b/src/libopm/src/list.c index eb237bc..aea809f 100644 --- a/src/libopm/src/list.c +++ b/src/libopm/src/list.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2002-2003 Erik Fears - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * 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 diff --git a/src/libopm/src/list.h b/src/libopm/src/list.h index 20dbef2..ebd0cef 100644 --- a/src/libopm/src/list.h +++ b/src/libopm/src/list.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2002-2003 Erik Fears - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * 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 diff --git a/src/libopm/src/memory.c b/src/libopm/src/memory.c index abde66b..d2c8c3a 100644 --- a/src/libopm/src/memory.c +++ b/src/libopm/src/memory.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2002 Erik Fears - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * 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 diff --git a/src/libopm/src/memory.h b/src/libopm/src/memory.h index 268be66..f841fe0 100644 --- a/src/libopm/src/memory.h +++ b/src/libopm/src/memory.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2002 Erik Fears - * Copyright (c) 2014-2020 ircd-hybrid development team + * Copyright (c) 2014-2021 ircd-hybrid development team * * 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 diff --git a/src/libopm/src/opm_gettime.c b/src/libopm/src/opm_gettime.c new file mode 100644 index 0000000..e2107b3 --- /dev/null +++ b/src/libopm/src/opm_gettime.c @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2014-2021 ircd-hybrid development team + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + */ + +#include <stdlib.h> + +#include "opm_gettime.h" + +time_t +opm_gettime(void) +{ + struct timespec ts; + +#ifdef CLOCK_MONOTONIC_RAW + if (clock_gettime(CLOCK_MONOTONIC_RAW, &ts) == 0) +#elif CLOCK_MONOTONIC + if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) +#else + if (clock_gettime(CLOCK_REALTIME, &ts) == 0) +#endif + return ts.tv_sec; + + exit(EXIT_FAILURE); + return -1; +} diff --git a/src/libopm/src/opm_gettime.h b/src/libopm/src/opm_gettime.h new file mode 100644 index 0000000..cba52fb --- /dev/null +++ b/src/libopm/src/opm_gettime.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2014-2021 ircd-hybrid development team + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + */ + +#ifndef OPM_GETTIME_H +#define OPM_GETTIME_H + +#include <time.h> + +extern time_t opm_gettime(void); +#endif + |
