This series has two purposes:
* Add a basic thread support library to the tree.
* Get rid of all calls to C library functions that POSIX describes
as inherently unsafe in a multithreaded program, and then add a
make-time check that flags an error if any calls get reintroduced.
Ben Pfaff (11):
ovs-thread: New module, initially just with pthreads wrapper
functions.
ovs-thread: Add per-thread data support.
ovs-atomic: New library for atomic operations.
ovs-thread: Add support for convenient once-only initializers.
ovs-thread: Add support for various thread-related assertions.
New function ovs_strerror() as a thread-safe replacement for
strerror().
Replace all uses of strerror() by ovs_strerror(), for thread safety.
random: Make thread-safe.
Use random_*() instead of rand(), for thread safety.
sparse: Remove prototypes for thread-unsafe functions from headers.
Makefile: Blacklist functions that threaded programs cannot use
safely.
Makefile.am | 26 ++-
build-aux/thread-safety-blacklist | 90 +++++++++
configure.ac | 8 +-
include/sparse/automake.mk | 1 +
include/sparse/math.h | 5 +-
include/sparse/netinet/in.h | 3 +-
include/sparse/pthread.h | 61 ++++++
lib/automake.mk | 9 +
lib/command-line.c | 4 +-
lib/compiler.h | 36 ++++-
lib/daemon.c | 43 ++---
lib/dpif-linux.c | 9 +-
lib/dpif-netdev.c | 4 +-
lib/dpif.c | 23 ++-
lib/entropy.c | 4 +-
lib/fatal-signal.c | 6 +-
lib/json.c | 5 +-
lib/jsonrpc.c | 7 +-
lib/learning-switch.c | 6 +-
lib/lockfile.c | 11 +-
lib/netdev-bsd.c | 32 ++--
lib/netdev-dummy.c | 5 +-
lib/netdev-linux.c | 63 ++++---
lib/netdev.c | 10 +-
lib/netlink-notifier.c | 7 +-
lib/netlink-socket.c | 26 ++--
lib/ofp-errors.c | 10 +-
lib/ofp-version-opt.c | 3 +
lib/ovs-atomic-c11.h | 62 ++++++
lib/ovs-atomic-gcc4+.c | 68 +++++++
lib/ovs-atomic-gcc4+.h | 267 ++++++++++++++++++++++++++
lib/ovs-atomic-gcc4.7+.h | 141 ++++++++++++++
lib/ovs-atomic-pthreads.c | 61 ++++++
lib/ovs-atomic-pthreads.h | 157 ++++++++++++++++
lib/ovs-atomic.h | 250 +++++++++++++++++++++++++
lib/ovs-thread.c | 194 +++++++++++++++++++
lib/ovs-thread.h | 370 +++++++++++++++++++++++++++++++++++++
lib/poll-loop.c | 4 +-
lib/process.c | 10 +-
lib/random.c | 26 ++-
lib/rconn.c | 8 +-
lib/reconnect.c | 6 +-
lib/rtbsd.c | 8 +-
lib/sflow_agent.c | 3 +-
lib/signals.c | 4 +-
lib/socket-util.c | 40 ++--
lib/stream-fd.c | 4 +-
lib/stream-ssl.c | 19 +-
lib/stream-tcp.c | 4 +-
lib/stream-unix.c | 7 +-
lib/timeval.c | 8 +-
lib/unixctl.c | 2 +-
lib/util.c | 57 +++++--
lib/util.h | 3 +-
lib/vconn-stream.c | 6 +-
lib/vconn.c | 2 +-
lib/vlandev.c | 6 +-
lib/vlog.c | 4 +-
lib/worker.c | 8 +-
m4/openvswitch.m4 | 42 ++++-
ofproto/collectors.c | 6 +-
ofproto/connmgr.c | 6 +-
ofproto/in-band.c | 12 +-
ofproto/ofproto-dpif-sflow.c | 2 +-
ofproto/ofproto-dpif.c | 14 +-
ofproto/ofproto.c | 24 ++--
ovsdb/jsonrpc-server.c | 6 +-
ovsdb/ovsdb-server.c | 7 +-
tests/automake.mk | 5 +
tests/library.at | 4 +
tests/test-atomic.c | 94 ++++++++++
tests/test-classifier.c | 25 ++--
tests/test-hindex.c | 3 +-
tests/test-hmap.c | 5 +-
tests/test-netflow.c | 2 +-
tests/test-sflow.c | 2 +-
tests/test-util.c | 4 +-
tests/test-vconn.c | 12 +-
utilities/ovs-controller.c | 2 +-
utilities/ovs-dpctl.c | 8 +-
utilities/ovs-ofctl.c | 10 +-
vswitchd/bridge.c | 18 +-
vswitchd/ovs-vswitchd.c | 4 +-
vswitchd/system-stats.c | 20 ++-
vswitchd/xenserver.c | 4 +-
85 files changed, 2335 insertions(+), 332 deletions(-)
create mode 100644 build-aux/thread-safety-blacklist
create mode 100644 include/sparse/pthread.h
create mode 100644 lib/ovs-atomic-c11.h
create mode 100644 lib/ovs-atomic-gcc4+.c
create mode 100644 lib/ovs-atomic-gcc4+.h
create mode 100644 lib/ovs-atomic-gcc4.7+.h
create mode 100644 lib/ovs-atomic-pthreads.c
create mode 100644 lib/ovs-atomic-pthreads.h
create mode 100644 lib/ovs-atomic.h
create mode 100644 lib/ovs-thread.c
create mode 100644 lib/ovs-thread.h
create mode 100644 tests/test-atomic.c
--
1.7.2.5
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev