summaryrefslogtreecommitdiffstats
path: root/lib/qtime.c
Commit message (Collapse)AuthorAgeFilesLines
* Work in progress -- pthread handling and debug improvementsChris Hall2012-05-281-4/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Logging: * added "debug bgp io" -- to log all BGP Engine I/O, with the option to log input or output only. This is similar to "debug bgp update", but that affects the Routing Engine, while this affects the BGP Engine. * reviewed and updated "debug bgp fsm". The fsm logging now covers all aspects of the fsm, which is all in the BGP Engine. Any nominally fsm logging in the Routing Engine is now "event" logging. Added collision resolution to fsm logging. Dovetailed fsm and keepalive logging. * removed logging of route advertisment timer and withdraw events. pthread and nexus handling: * qpt_thread object created to encapsulate a pthread, with means to keep track of existing pthreads and their cpu usage. This is now used instead of the list of qpnexus for the watch-dog. * added explicit qpt_finish() and call from qexit(). Collects up and destroys all qpt_thread -- including any "detached" qpt_thread. * changed qpt_thread_signal() to qpt_thread_raise() Now takes qpt_thread object (not pthread_t) and also is now agnostic about qpthreads_enabled. Work in progress -- pthread handling and debug improvements Logging: * added "debug bgp io" -- to log all BGP Engine I/O, with the option to log input or output only. This is similar to "debug bgp update", but that affects the Routing Engine, while this affects the BGP Engine. * reviewed and updated "debug bgp fsm". The fsm logging now covers all aspects of the fsm, which is all in the BGP Engine. Any nominally fsm logging in the Routing Engine is now "event" logging. Added collision resolution to fsm logging. Dovetailed fsm and keepalive logging. * removed logging of route advertisment timer and withdraw events. pthread and nexus handling: * qpt_thread object created to encapsulate a pthread, with means to keep track of existing pthreads and their cpu usage. This is now used instead of the list of qpnexus for the watch-dog. * added explicit qpt_finish() and call from qexit(). Collects up and destroys all qpt_thread -- including any "detached" qpt_thread. * changed qpt_thread_signal() to qpt_thread_raise() Now takes qpt_thread object (not pthread_t) and also is now agnostic about qpthreads_enabled. * tidied up pthread attribute and status handling, to cope with a wider variety of pthread implementations, and to lay ground- work for more pthreads and more subtle scheduling. Logging at pthread start up provides more information about what the local implementation supports. Flags up some issues with FreeBSD -- in particular broken pthread CPU clock :-( * changed handling of "thread specific" variables, so that is now also qpthreads_enabled agnostic. * added tests in configure.ac to identify when: pthread_attr_getstack() pthread_attr_setstack() pthread_attr_get_np() pthread_getattr_np() are available. (For FreeBSD, at least, also need to know whether to include <pthread_np.h>.) Others: * added "NO_RETURN" macro for __attribute__((noreturn)) or local equivalent. * added qfb_nam_t -- a shorter general purpose fixed length sting object.
* Improve error handling in lib/qpthreads and lib/qtimeChris Hall2012-04-191-0/+32
| | | | | | | | | | | | | | | | | | | | Error handling now: * gives name of mutex when fails. * if clock_gettime() fails, this is fatal for CLOCK_REALTIME and CLOCK_MONOTONIC (as before) but not for any other clock (new behaviour). * log errors (and other anomalies) in pthread_getcpuclockid(), but do not abort. Remove a couple of warnings about variable "format" values for printf-like functions. Fix bug in new vtysh/extract.pl -- change mechanics of extracting CMD_INSTALL_TABLE entries, so that deals better with #if etc between entries.
* Merge branch 'master' of /git/quagga.euro-ix into pipeworkex16pChris Hall2011-03-291-6/+27
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | This ensures that the two branches are consistent after the merging of the old-Quagga 0.99.18 changes. Release: 0.99.18ex16p. Eliminated some whitespace differences ! Collected RESTRICTED_NODE show_bgp_ipv6_safi_route_cmd and show_bgp_ipv6_safi_prefix_cmd, and one HAVE_IPV6 skip. Also releasing filename in closezlog(). Removed strlen() from lib/qfstring.c for async-signal-safe purposes.
| * Bring "ex" version up to date with 0.99.18ex14Chris Hall2011-03-291-0/+11
| | | | | | | | | | | | | | | | Release: 0.99.18ex14 Also fixes issue with unknown attributes -- does not release them prematurely. Contains the "bgpd: New show commands for improved view and address family support", which is post 0.99.18. (But not RFC 5082 GTSM.)
* | Bring "ex" version up to date with 0.99.18ex15pChris Hall2011-03-291-44/+60
| | | | | | | | | | | | | | | | | | Release: 0.99.18ex15p -- Pipework Branch Also fixes issue with unknown attributes -- does not release them prematurely. Contains the "bgpd: New show commands for improved view and address family support", which is post 0.99.18. (But not RFC 5082 GTSM.)
* | Upgrade of "pipework" -- including piping to/from shell commandsex11pChris Hall2011-03-211-0/+85
| | | | | | | | | | | | Version 0.99.15ex11p A major overhaul.
* | Second tranche of updates for pipework branch.Chris Hall2011-02-131-0/+48
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | modified: bgpd/bgp_connection.c modified: bgpd/bgp_debug.c modified: bgpd/bgp_engine.h modified: bgpd/bgp_main.c modified: bgpd/bgp_packet.c modified: bgpd/bgp_peer.c modified: bgpd/bgp_route.c modified: bgpd/bgp_routemap.c modified: bgpd/bgp_session.c modified: bgpd/bgp_vty.c modified: bgpd/bgpd.c modified: bgpd/bgpd.h modified: configure.ac modified: isisd/dict.h modified: isisd/isis_misc.c modified: isisd/isis_routemap.c modified: isisd/isis_spf.c modified: lib/Makefile.am modified: lib/command.c modified: lib/command.h modified: lib/command_execute.h modified: lib/command_parse.c modified: lib/command_parse.h modified: lib/command_queue.c modified: lib/command_queue.h modified: lib/elstring.h modified: lib/heap.c modified: lib/if.c modified: lib/if.h modified: lib/keychain.c modified: lib/keystroke.c modified: lib/keystroke.h modified: lib/list_util.c modified: lib/list_util.h modified: lib/log.c modified: lib/log.h modified: lib/memory.c modified: lib/memory.h modified: lib/memtypes.c modified: lib/misc.h modified: lib/mqueue.c modified: lib/mqueue.h deleted: lib/node_type.h modified: lib/pthread_safe.c modified: lib/qfstring.c modified: lib/qiovec.c modified: lib/qiovec.h modified: lib/qpath.c modified: lib/qpnexus.c modified: lib/qpnexus.h modified: lib/qpselect.c modified: lib/qpthreads.h modified: lib/qstring.c modified: lib/qstring.h modified: lib/qtime.c modified: lib/qtime.h modified: lib/qtimers.c modified: lib/qtimers.h modified: lib/routemap.c modified: lib/symtab.h modified: lib/thread.h deleted: lib/uty.h modified: lib/vector.c modified: lib/vector.h modified: lib/version.h.in modified: lib/vio_fifo.c modified: lib/vio_fifo.h modified: lib/vio_lines.c modified: lib/vio_lines.h modified: lib/vty.c modified: lib/vty.h modified: lib/vty_cli.c modified: lib/vty_cli.h modified: lib/vty_io.c modified: lib/vty_io.h modified: lib/vty_io_basic.c modified: lib/vty_io_basic.h modified: lib/vty_io_file.c modified: lib/vty_io_file.h modified: lib/vty_io_shell.c modified: lib/vty_io_term.c modified: lib/vty_io_term.h modified: lib/vty_local.h modified: lib/vty_pipe.c modified: lib/workqueue.h modified: lib/zebra.h modified: ospf6d/ospf6_lsa.c modified: ripngd/ripngd.c modified: tests/test-list_util.c modified: tests/test-vector.c modified: vtysh/vtysh.c modified: vtysh/vtysh_config.c
* Ensure all timeouts are timeout times in qtime_mono_t.Chris Hall (GMCH)2009-12-091-1/+1
| | | | | | | | | | | | | | | | | | Introduced separate types for qtime_mono_t and qtime_real_t, to distinguish the time base of a given value. Revised all users of timeouts so that they are all expressed as qtime_mono_t values, so are all Quagga monotonic time based. Revised qpt_cond_timedwait() so that all condition variables use the same timebase (CLOCK_MONOTONIC if available, by default). Now all timeout times are qtime_mono_t, and are converted to whatever the condition variable is set to, if necessary. Added explicit timeout to mqueue. Fixed qps_pselect() to zeroise result vectors if no fds are reported pending -- seems the O/S does not do this.
* Fixes to lib/qtime.c and lib/qtimers.hChris Hall (GMCH)2009-12-081-3/+3
| | | | Needs to use lldiv in qtime.c on 32bit machine.
* Improved lib/qt_craft_monotonic() handling of overflow.Chris Hall (GMCH)2009-12-081-29/+93
| | | | | | | Improved the arithmetic and changed code to deal with wrap around only if clock_t is 32-bits (and not to compile if it is less !). Updated documentation.
* Updates to lib/qtime.c & .hChris Hall (GMCH)2009-12-061-6/+8
| | | | | | | Added conversion routines for CLOCK_REALTIME/timeofday to/from monotonic clock -- so can set timers to actual time, if required. Added confirms and tidied up documentation.
* Pthreads infrastructure -- initial commitChris Hall (GMCH)2009-12-021-0/+128
New files: lib/qpthreads.c & .h Encapsulates the Pthreads facilities to be used in Quagga. Implicitly documents the sub-set of Pthreads being used. Provides error checking for a number of functions which may return errors, but are not generally expected to and for whom an error is treated as fatal. Could be modified to "null out" the use of Pthreads. New files: lib/qtime.c & .h Defines a 64-bit integer time value which is a lot easier to handle than the usual timespec and timeval structures. (C99 requires a 64-bit integer.) Provides front ends for gettimeofday() & clock_gettime() which return 64-bit time value. Also conversions to and from timespec and timeval. Provides a monotonic clock for when CLOCK_MONOTONIC is not available. (This is based on code from Joakim Tjernlund.) New files: lib/heap.c & .h Implements a heap data structure closely allied to the vector. This will be used for timer handling. Modified: lib/memtypes.c New memory types for qpthreads structures and for the heap. Modified: lib/zassert.h Added explicit "passert" == assert which is not subject to NDEBUG. Added explicit "nassert" == assert which is subject to NDEBUG. Added zabort, zabort_errno and zabbort_err for when something has gone fatally wrong. (Require changes to lib/log.c which are TBD.)