add emitter affinity

Addresses the bulk of https://github.com/facebook/libphenom/issues/21
I'm punting on mutiplexing scheduler threads on emitters for now,
simply because the current epoll() syscall implementation is a
limiting factor.

This commit does a couple of things:

* Factors the various system dependent emitter code out into files
  of their own
* Factors the emitters so that we can set up multiple emitters
* Create one emitter per scheduler thread
* Increases the size of the emitter event buffer; previously, we
  would collect only a single event at a time in order to be fairer
  to the rest of the scheduler threads.  Since jobs are now affine,
  we no longer have this concern.  (This comes at the cost of a slow
  job delaying all the other jobs with the same affinity)
* Adds `emitter_affinity` to the job struct; this can be used to
  set the affinity of the job (surprise!)
* Set emitter_affinity in iopipes.c
* Fixup the Illumos build

The affinity change gives us almost linear scaling of the dispatch
rate in iopipes.t as we raise the number of scheduler threads;
previously, we'd see a drop-off as we passed HT and socket boundaries
due to cache coherency traffic overheads.
Add OpenSSL support to ph_sock_t

Addresses https://github.com/facebook/libphenom/issues/20

Since SSL carries around a lot of state, we chose to implement the
bulk of the logic in ph_sock_t.

This commit adds some connectors for BIO->ph_stream_t and so on;
these exist to facilitate the ph_sock_t implementation and have
some limitations (such as missing read primitives) in some cases.

We choose to provide just enough infrastructure for you to build
your protocol on top of ph_sock_t.  In particular, you need to provide
the SSL context and object management.

We may evolve this over time to add more convenience functions.

This commits augments the echo example to demonstrate how to enable
SSL for a listener, and adds a very simple sclient example that shows
how to build an SSL client.

Also: fixup an issue with bufq's where gc can leave them completely
empty of spare buffers.
add ph_string_append_str
ensure that inttypes.h exports PRIxXX
Fixup build on kssl enabled platforms
some gccs barf on pragma diagnostic push

So let's just be explicit about what we want to happen
affinity: make listener round-robin the accepted sock
Consolidate counter and thread TLS data, revise init

Tackle a couple of things:

* Both threads and counters had their own copies of code to manage
  allocations and TLS data; consolidate it into one
* Resolve some initialization issues
* Addresses https://github.com/facebook/libphenom/issues/11 by
  removing the dependency on ph_mem_alloc for ph_thread_t data

This gives us better defined initialization semantics both within
the library and for the client applications that consume it.

It also reduces some boilerplate with pthread_once and the (albeit
very very small) overhead that introduced into the various call sites.

The new initialization approach uses the `constructor` attribute of
gcc to cause a shim function to run prior to `main`.  This shim function
registers the true constructor/destructor functions and arranges for
them to run at `ph_library_init` time.

Using the linker to manage construction means that we'll only pull
in the pieces that are used in the application.

gcc supports specifying priorities for constructors but this isn't
available to all systems (notably Solaris).
'Slot' should be put before the compare expression to guarantee thread safe.
It's not thread safe.

Use concurrency kit cas to make thread safe.
Fix thread-unsafe bug.
fix line wrapping & use ck_pr_faa_8
add null ptr check in ph_string_equal_cstr

See https://github.com/facebook/libphenom/issues/29 for context
fix potential use-after-free with ares

Noticed this while digging into
https://github.com/facebook/libphenom/issues/29:

```
==26939== Invalid write of size 8
==26939==    at 0x10000AFD8: ph_job_set_nbio (in ./tests/dns.t)
==26939==    by 0x10000388B: sock_state_cb (in ./tests/dns.t)
==26939==    by 0xCD79: ares__close_sockets (in /usr/local/Cellar/c-ares/1.10.0/lib/libcares.2.dylib)
==26939==    by 0xD976: ares__destroy_servers_state (in /usr/local/Cellar/c-ares/1.10.0/lib/libcares.2.dylib)
==26939==    by 0xD871: ares_destroy (in /usr/local/Cellar/c-ares/1.10.0/lib/libcares.2.dylib)
==26939==    by 0x100003AC7: do_ares_fini (in ./tests/dns.t)
==26939==    by 0x100001C0F: ph_library_teardown (in ./tests/dns.t)
==26939==    by 0x2FC524: __cxa_finalize (in /usr/lib/system/libsystem_c.dylib)
==26939==    by 0x2FE68A: exit (in /usr/lib/system/libsystem_c.dylib)
==26939==    by 0x2667E7: start (in /usr/lib/system/libdyld.dylib)
==26939==  Address 0x100105950 is 16 bytes inside a block of size 120 free'd
/*
==26939==    at 0x75B8: free (in /usr/local/Cellar/valgrind/HEAD/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==26939==    by 0x100009DB7: ph_mem_free (in ./tests/dns.t)
==26939==    by 0x1000038A6: sock_state_cb (in ./tests/dns.t)
==26939==    by 0xCD79: ares__close_sockets (in /usr/local/Cellar/c-ares/1.10.0/lib/libcares.2.dylib)
==26939==    by 0xD976: ares__destroy_servers_state (in /usr/local/Cellar/c-ares/1.10.0/lib/libcares.2.dylib)
/*
==26939==    by 0xD871: ares_destroy (in /usr/local/Cellar/c-ares/1.10.0/lib/libcares.2.dylib)
==26939==    by 0x100003AC7: do_ares_fini (in ./tests/dns.t)
==26939==    by 0x100001C0F: ph_library_teardown (in ./tests/dns.t)
==26939==    by 0x2FC524: __cxa_finalize (in /usr/lib/system/libsystem_c.dylib)
==26939==    by 0x2FE68A: exit (in /usr/lib/system/libsystem_c.dylib)
==26939==    by 0x2667E7: start (in /usr/lib/system/libdyld.dylib)
```

I only saw it once, so seems hard to trigger, but nonetheless:
Switch to using a job template and SMR to address this.
fixup doc entry name matching

Adding `PH_` for macros meant that struct ph_job was being mislabeled
as a PH_STAILQ_ENTRY.  Make the title check prefer `struct`s that start
the line.  This duplicates a later rule that matches `struct` anywhere
in the line because it is late and I'm too lazy to check to see what
might be affected if I remove the latter.
pretty print json for the docs

Not sure if this was breaking gh-pages or if something else broke it
around the same time... but having put this code together, might
as well check it in now.
improve cross-links in the variant docs
more crosslinks for variant docs
add helper for getting at a c-string rendition of a ph_string_t

Docs explain it; we prefer to copy (or not copy if possible) to the
stack over using the heap.  The rationale is that most of the strings
we'll pass to c-string APIs will be small enough that stack will be
appropriate; my immediate use case is passing strings to posix APIs
for use as filenames.
auto generation of proper tags

For context, see:

https://github.com/facebook/libphenom/pull/28
https://github.com/facebook/libphenom/pull/30