ruby_posix_mq.git
6 years agoRuby posix_mq 2.4.1masterv2.4.1
Eric Wong [Tue, 30 Jan 2018 23:59:56 +0000 (30 23:59 +0000)]
Ruby posix_mq 2.4.1

This release fixes a problem affecting users of newer clang (5.x+)
and Ruby 2.5.0:  https://bugs.ruby-lang.org/issues/14425
There is no need to upgrade if using gcc or Ruby <= 2.4.

* drop extra args to rb_funcall

6 years agodrop extra args to rb_funcall
Eric Wong [Tue, 30 Jan 2018 23:56:12 +0000 (30 23:56 +0000)]
drop extra args to rb_funcall

Having extra args was harmless in Ruby 2.4, but Ruby 2.5 with
newer versions of clang are not happy about it.  Eventually this
may be fixed in Ruby 2.5.1: https://bugs.ruby-lang.org/issues/14425

7 years agoRuby posix_mq 2.4.0v2.4.0
Eric Wong [Mon, 20 Mar 2017 19:41:50 +0000 (20 19:41 +0000)]
Ruby posix_mq 2.4.0

Most notably there are some FreeBSD fixes.  There are also
some minor internal cleanups and doc updates.

7 changes since 2.3.0 (2016-02-02):

      doc: remove private email address
      doc: update bogomips.org URLs to HTTPS
      set correct condition for setting id_autoclose
      test_posix_mq: get tests passing under FreeBSD 10.3
      TypedData C-API conversion
      freeze internal objects
      build: remove build-time olddoc dependency

7 years agobuild: remove build-time olddoc dependency
Eric Wong [Mon, 20 Mar 2017 19:35:01 +0000 (20 19:35 +0000)]
build: remove build-time olddoc dependency

This should make it easier for distros to pick this
up without picking up olddoc, too.

We will still use olddoc for generating the website since it
reduces bandwidth costs, and for generating NEWS for our own
builds.

7 years agofreeze internal objects
Eric Wong [Mon, 20 Mar 2017 18:47:26 +0000 (20 18:47 +0000)]
freeze internal objects

We do not want ObjectSpace walkers to be able to mess with
our internals.

7 years agoTypedData C-API conversionpu
Eric Wong [Sat, 18 Mar 2017 08:16:31 +0000 (18 08:16 +0000)]
TypedData C-API conversion

This provides some extra type safety if combined with other
C extensions, as well as allowing us to account for memory usage of
the HTTP parser in ObjectSpace.

This requires Ruby 1.9.3+ and has remained a stable API since
then.  This will become officially supported when Ruby 2.3.0 is
released later this month.

This API has only been documented in doc/extension.rdoc (formerly
README.EXT) in the Ruby source tree since April 2015, r50318

7 years agotest_posix_mq: get tests passing under FreeBSD 10.3
Eric Wong [Sat, 18 Mar 2017 08:07:26 +0000 (18 08:07 +0000)]
test_posix_mq: get tests passing under FreeBSD 10.3

Apparently POSIX message queues adopted close-on-fork behavior
in FreeBSD at some point.  Oh well, somebody else who is more
interested in FreeBSD than can look into fixing it on their end.

Improve exception reporting a bit while we're at it.

7 years agoset correct condition for setting id_autoclose
Eric Wong [Sat, 18 Mar 2017 07:48:49 +0000 (18 07:48 +0000)]
set correct condition for setting id_autoclose

This bug was noticed under FreeBSD :x

7 years agodoc: update bogomips.org URLs to HTTPS
Eric Wong [Sat, 18 Mar 2017 07:50:17 +0000 (18 07:50 +0000)]
doc: update bogomips.org URLs to HTTPS

It looks like HTTPS support provided by the Let's Encrypt
project is still going strong, and maybe we can rely on it.

7 years agodoc: remove private email address
Eric Wong [Sat, 18 Mar 2017 07:46:12 +0000 (18 07:46 +0000)]
doc: remove private email address

Email is not private, and we won't be able to protect your
privacy.  Anonymity (when desired) should be the sender's
responsibility, not the recipients'.

8 years agoRuby posix_mq 2.3.0 - updates for Ruby 2.3+v2.3.0
Eric Wong [Tue, 2 Feb 2016 23:25:17 +0000 (2 23:25 +0000)]
Ruby posix_mq 2.3.0 - updates for Ruby 2.3+

This release updates our POSIX_MQ#close to match the idempotent
IO#close behavior under Ruby 2.3 and later.  Previous Ruby versions
continue to be supported, but POSIX_MQ#close remains non-idempotent
when built against old Ruby versions.

4 changes since v2.2.0:

      enable frozen_string_literal for Ruby 2.3+
      support idempotent POSIX_MQ#close
      README: remove cgit and ssoma references
      build: use '--local' domain for dev gem install

8 years agobuild: use '--local' domain for dev gem install
Eric Wong [Tue, 2 Feb 2016 23:01:49 +0000 (2 23:01 +0000)]
build: use '--local' domain for dev gem install

This avoids unnecessary network requests for disconnected
systems.

8 years agoREADME: remove cgit and ssoma references
Eric Wong [Tue, 2 Feb 2016 22:17:22 +0000 (2 22:17 +0000)]
README: remove cgit and ssoma references

We may not always be cgit, and encouraging tarball snapshot
downloads is a waste of resources

Release tarballs are not, as users aren't expected to know to
do "git clone"; but developers are.

This is also not an appropriate place for advertising ssoma.

8 years agosupport idempotent POSIX_MQ#close
Eric Wong [Tue, 2 Feb 2016 22:14:16 +0000 (2 22:14 +0000)]
support idempotent POSIX_MQ#close

IO#close under Ruby 2.3 is idempotent, we shall follow suit
with POSIX_MQ#close

8 years agoenable frozen_string_literal for Ruby 2.3+
Eric Wong [Tue, 2 Feb 2016 20:11:22 +0000 (2 20:11 +0000)]
enable frozen_string_literal for Ruby 2.3+

No changes for older Rubies, but this reduces garbage under 2.3

9 years agoRuby posix_mq 2.2.0 - support FD adoptionv2.2.0
Eric Wong [Fri, 16 Jan 2015 20:13:45 +0000 (16 20:13 +0000)]
Ruby posix_mq 2.2.0 - support FD adoption

The major feature of this release is the POSIX_MQ.for_fd class
method thanks to Christopher Lord.  The addition of the
POSIX_MQ#autoclose? and POSIX_MQ#autoclose= round out the new
feature set.  All of the new methods are analogous to their
counterparts in the core IO class.

The mailing list is also moved to ruby-posix-mq@bogomips.org
and no longer requires subscription.  Existing librelist
subscribers will need to resubscribe manually (as I have no
way of doing so automatically):

ruby-posix-mq+subscribe@bogomips.org

HTTP archives and instructions for extracting the mail archives
via git are available at:

http://bogomips.org/ruby-posix-mq/

Christopher Lord (1):
      Ability to adopt file descriptors

Eric Wong (16):
      for_fd: delay assigning to mq->des until after mq_getattr
      test_posix_mq: rewrite test to not depend on DL or alarm
      support autoclose= and autoclose?
      pack rw_args struct
      change mailing list to ruby-posix-mq@bogomips.org
      doc: remove --sanitize-html option for pandoc
      switch documentation to olddoc
      LICENSE: allow all future versions of LGPLv3+
      favor comparisons against zero instead of -1
      pkg.mk: misc tweaks and updates
      gemspec: remove rdoc_options setting
      .gitignore: add placeholder
      gemspec: use SPDX license abbreviation
      misc doc updates
      POSIX_MQ#autoclose= propagates to IO
      GNUmakefile: ordering fix for building gem

9 years agoGNUmakefile: ordering fix for building gem
Eric Wong [Fri, 16 Jan 2015 20:12:31 +0000 (16 20:12 +0000)]
GNUmakefile: ordering fix for building gem

9 years agoPOSIX_MQ#autoclose= propagates to IO
Eric Wong [Mon, 12 Jan 2015 08:27:41 +0000 (12 08:27 +0000)]
POSIX_MQ#autoclose= propagates to IO

If a corresponding IO object exists or is created later, propagate
autoclose to the corresponding IO object to avoid simplify autoclose
handling for the user.  This hopefully avoids nasty surprises in case
users disable autoclose but want to keep the IO object around.

9 years agomisc doc updates
Eric Wong [Mon, 12 Jan 2015 07:57:32 +0000 (12 07:57 +0000)]
misc doc updates

* Include the email addresses for olddoc
* README: update support status of Rubies
* label link to mailing list archives

9 years agogemspec: use SPDX license abbreviation
Eric Wong [Mon, 12 Jan 2015 07:52:53 +0000 (12 07:52 +0000)]
gemspec: use SPDX license abbreviation

9 years ago.gitignore: add placeholder
Eric Wong [Mon, 12 Jan 2015 07:47:39 +0000 (12 07:47 +0000)]
.gitignore: add placeholder

9 years agogemspec: remove rdoc_options setting
Eric Wong [Mon, 12 Jan 2015 07:46:44 +0000 (12 07:46 +0000)]
gemspec: remove rdoc_options setting

We no longer need it for olddoc

9 years agopkg.mk: misc tweaks and updates
Eric Wong [Mon, 12 Jan 2015 07:44:22 +0000 (12 07:44 +0000)]
pkg.mk: misc tweaks and updates

* We're not using isolate anymore
* support EXTCONF_ARGS env for building
* add "make check" as an alias for "make test"
  (muscle memory for GNU-autotools projects)

9 years agofavor comparisons against zero instead of -1
Eric Wong [Sun, 11 Jan 2015 03:19:33 +0000 (11 03:19 +0000)]
favor comparisons against zero instead of -1

This should allow faster instructions to be used in some cases.
Technically this may be less pedantically correct, but there is
enough existing code out there which does the same thing to
discourage kernel/libc developers from overloading negative
return values.

...And glibc even favors comparison against zero, too.

9 years agoLICENSE: allow all future versions of LGPLv3+
Eric Wong [Sat, 10 Jan 2015 00:14:21 +0000 (10 00:14 +0000)]
LICENSE: allow all future versions of LGPLv3+

In case I'm hit by a bus and FSF comes out with an LGPLv4,
the project will still be able to move forward.

While we're at it, update the gemspec, too.

9 years agoswitch documentation to olddoc
Eric Wong [Fri, 9 Jan 2015 03:53:45 +0000 (9 03:53 +0000)]
switch documentation to olddoc

wrongdoc was difficult to maintain because of the tidy-ffi
dependency and the HTML5 changes in Darkfish could not be
handled well by Tidy.

olddoc is superior as it generates leaner HTML which loads faster,
requires less scrolling and less processing power to render.
Aesthetic comparisons are subjective of course but completely
unimportant compared to speed and accessibility.

9 years agodoc: remove --sanitize-html option for pandoc
Eric Wong [Fri, 9 Jan 2015 23:10:14 +0000 (9 23:10 +0000)]
doc: remove --sanitize-html option for pandoc

Newer versions of pandoc removed this option

9 years agochange mailing list to ruby-posix-mq@bogomips.org
Eric Wong [Fri, 9 Jan 2015 23:02:55 +0000 (9 23:02 +0000)]
change mailing list to ruby-posix-mq@bogomips.org

The public-inbox + mlmmj setup on bogomips.org allows posting
without subscription and offers downloadable archives via git.
The lack of rsyncable archives on librelist nowadays and
subscription-required nature of librelist are points against it.

Repliers are now encouraged to Cc: all recipients (using the
reply-all function of their mail client) since many readers are
not subscribed.

This project has never accepted or encouraged HTML email, but
librelist accepted it.  The bogomips.org mail server is
configured to treat HTML mail as spam, so do not send HTML mail
if you expect a response.

Users who wish to subscribe may send a message to:

ruby-posix-mq+subscribe@bogomips.org

Similarly, they may unsubscribe via:

ruby-posix-mq+unsubscribe@bogomips.org

HTTP archives are available via:

http://bogomips.org/ruby-posix-mq/

ssoma users may also use: git://bogomips.org/ruby-posix-mq
(see README change)

Old messages to the librelist addresses will continue to
get routed to the new mailing list.

ref: http://public-inbox.org/

9 years agopack rw_args struct
Eric Wong [Fri, 9 Jan 2015 22:10:24 +0000 (9 22:10 +0000)]
pack rw_args struct

This saves one word of stack space, potentially improving
performance a miniscule amount.

9 years agosupport autoclose= and autoclose?
Eric Wong [Fri, 9 Jan 2015 04:18:22 +0000 (9 04:18 +0000)]
support autoclose= and autoclose?

These are analogous to the identically-named IO methods and useful
when we're inheriting descriptors (or writing tests for inheriting
descriptors).

9 years agotest_posix_mq: rewrite test to not depend on DL or alarm
Eric Wong [Fri, 9 Jan 2015 07:28:21 +0000 (9 07:28 +0000)]
test_posix_mq: rewrite test to not depend on DL or alarm

DL is removed and deprecated, and we don't actually need
it or alarm to test for EINTR-safety.

9 years agofor_fd: delay assigning to mq->des until after mq_getattr
Eric Wong [Fri, 9 Jan 2015 04:18:21 +0000 (9 04:18 +0000)]
for_fd: delay assigning to mq->des until after mq_getattr

We do not want to assign to mq->des before verifying we
have a valid message queue, otherwise the GC may misclose
an invalid MQ descriptor (which may be a valid FD).

9 years agoAbility to adopt file descriptors
Christopher Lord [Sat, 3 Jan 2015 17:15:58 +0000 (3 10:15 -0700)]
Ability to adopt file descriptors

This patch adds support for adopting an existing file descriptor, together
with testcases. The need for this comes up when we use systemd with the
ListenMessageQueue directive. For socket activation, systemd opens the POSIX
message queue and expects user code to begin using the file descriptor
without opening it in-process.

To support the systemd model in the `posix_mq` gem, this patch suggests
imitating the behavior on the Socket class, which uses `#for_fd` to create a
socket class from a descriptor.

One confounding factor exists. POSIX queues have a name but it is difficult
to get access to this name in a safe manner from the file descriptor. One
option would be to `readlink(2)` on `/proc/self/fd/N` to get the name[1], but
note that if the descriptor is unlinked we wouldn't get anything usable.
Rather than risk incorrect behavior and extra complexity, I've decided to
just raise an `ArgumentError` if `#name` is called on adopted descriptors.
Typically one wouldn't need the actual name in a systemd socket-activated
situation, anyway.

[1]: http://stackoverflow.com/questions/1188757/getting-filename-from-file-descriptor-in-c

[ew: simplified type checks to be consistent with IO.for_fd,
 fixed test case]

Signed-off-by: Eric Wong <normalperson@yhbt.net>
10 years agoposix_mq 2.1.0 - ensure compatibility with future Rubiesv2.1.0
Eric Wong [Sat, 15 Feb 2014 13:34:12 +0000 (15 13:34 +0000)]
posix_mq 2.1.0 - ensure compatibility with future Rubies

* avoid deprecated rb_thread_blocking_region in Ruby 2.0/2.1
* prepare for rb_thread_blocking_region removal

10 years agoavoid deprecated rb_thread_blocking_region in Ruby 2.0/2.1
Eric Wong [Sat, 15 Feb 2014 13:13:06 +0000 (15 13:13 +0000)]
avoid deprecated rb_thread_blocking_region in Ruby 2.0/2.1

This will be removed in Ruby 2.2, so avoid the deprecation warning.

10 years agoprepare for rb_thread_blocking_region removal
Eric Wong [Sun, 9 Feb 2014 00:40:11 +0000 (9 00:40 +0000)]
prepare for rb_thread_blocking_region removal

It'll be OK to use rb_thread_call_without_gvl when
rb_thread_blocking_region is not detectable at all.
We still use rb_thread_blocking_region for Ruby 2.0-2.1 because
rb_thread_call_without_gvl was detectable in 1.9.3, but not
usable as an internal symbol.

ref: https://bugs.ruby-lang.org/issues/9502

10 years agoRakefile: kill raa_update task
Eric Wong [Mon, 30 Sep 2013 18:24:33 +0000 (30 18:24 +0000)]
Rakefile: kill raa_update task

RAA is dead.

11 years agopkg.mk: update
Eric Wong [Mon, 6 Aug 2012 21:06:38 +0000 (6 21:06 +0000)]
pkg.mk: update

11 years agoposix_mq 2.0.0 - a minor API change + FreeBSD fixesv2.0.0
Eric Wong [Mon, 6 Aug 2012 20:58:04 +0000 (6 20:58 +0000)]
posix_mq 2.0.0 - a minor API change + FreeBSD fixes

Blocking methods no longer raise Errno::EINTR (to match
Ruby IO semantics, making code easier to work with).

There are also many FreeBSD-related fixes thanks to
Hleb Valoshka <375gnu@gmail.com> and small code cleanups.

11 years agotest: relax test timings for timed* tests
ew@fbsd90-32.(none) [Wed, 11 Jul 2012 02:54:33 +0000 (11 02:54 +0000)]
test: relax test timings for timed* tests

On my i386-freebsd9 VM, this takes just longer than the
maximum allowable time.

11 years agoextconf: fix __mq_oshandle() detection on FreeBSD
ew@fbsd90-32.(none) [Wed, 11 Jul 2012 02:25:44 +0000 (11 02:25 +0000)]
extconf: fix __mq_oshandle() detection on FreeBSD

We need to have -lrt in LDFLAGS before we can detect it.

11 years agotest: disable IO.select test if #to_io is missing
ew@fbsd90-32.(none) [Wed, 11 Jul 2012 02:02:43 +0000 (11 02:02 +0000)]
test: disable IO.select test if #to_io is missing

11 years agoext: fix type inconsistencies for int vs mqd_t retvals
ew@fbsd90-32.(none) [Wed, 11 Jul 2012 01:58:57 +0000 (11 01:58 +0000)]
ext: fix type inconsistencies for int vs mqd_t retvals

Somehow I mixed up return values for mq_* functions that
return "int".  This was noticed on FreeBSD where mqd_t
is NOT an integer.

11 years agonotify: set lower bound for notify stack size
Eric Wong [Thu, 12 Jul 2012 19:30:20 +0000 (12 12:30 -0700)]
notify: set lower bound for notify stack size

Some OSes have ridiculously low boundaries and we don't
want mysterious failures on them

11 years agoblocking functions do not raise Errno::EINTR
Eric Wong [Wed, 4 Jul 2012 00:57:44 +0000 (3 17:57 -0700)]
blocking functions do not raise Errno::EINTR

Blocking functions should not raise Errno::EINTR to match
existing semantics of Ruby IO methods (e.g. IO.select, IO#read,
IO#write).  This makes user code easier to read/write.

Like th Ruby methods we emulate, we only reacquire the GVL on
EINTR to fire signal handlers, but otherwise emulate SA_RESTART
semantics.

This is a backwards-incompatible API change (but unlikely
to break existing code).

11 years agoAdd libc names for Debian GNU/kFreeBSD and FreeBSD in tests.
Hleb Valoshka [Tue, 3 Jul 2012 20:13:49 +0000 (3 23:13 +0300)]
Add libc names for Debian GNU/kFreeBSD and FreeBSD in tests.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
11 years agoFix call to DL::Function.new in tests
Hleb Valoshka [Tue, 3 Jul 2012 20:13:48 +0000 (3 23:13 +0300)]
Fix call to DL::Function.new in tests

The 3rd argument of DL::Function.new is ABI type, not a return type.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
12 years agofix compiler warnings, oops
Eric Wong [Thu, 16 Jun 2011 07:41:48 +0000 (16 07:41 +0000)]
fix compiler warnings, oops

CFLAGS=-Wall somehow got disabled in my Ruby installation...

12 years agonum2timespec: remove needless double-assignment
Eric Wong [Tue, 14 Jun 2011 07:44:18 +0000 (14 07:44 +0000)]
num2timespec: remove needless double-assignment

Oops

12 years agono need to rb_intern("*")
Eric Wong [Tue, 14 Jun 2011 07:21:25 +0000 (14 07:21 +0000)]
no need to rb_intern("*")

'*' works just the same

13 years agoposix_mq 1.0.0 - kinder, gentler message queuesv1.0.0
Eric Wong [Tue, 1 Mar 2011 09:07:05 +0000 (1 09:07 +0000)]
posix_mq 1.0.0 - kinder, gentler message queues

There is one backwards-incompatible API change:

  POSIX_MQ#send returns +true+ on success instead of +nil+
  for consistency with POSIX_MQ#trysend.

This release adds the POSIX_MQ#trysend, POSIX_MQ#tryreceive and
POSIX_MQ#tryshift interfaces to avoid exceptions on common
EAGAIN errors for users of non-blocking queues.

Bugfixes: non-blocking behavior changes to a shared descriptor
in a different process are reflected immediately in the child
(this won't fix race conditions in your code, however).
Minor bugfixes for posix-mq-rb(1) and quieted warnings for
1.9.3dev.

13 years agomake methods that should be private, private
Eric Wong [Tue, 1 Mar 2011 08:57:16 +0000 (1 08:57 +0000)]
make methods that should be private, private

So private we won't mention them in the commit message!

13 years agoremove unused tryinit function
Eric Wong [Tue, 1 Mar 2011 08:52:34 +0000 (1 08:52 +0000)]
remove unused tryinit function

Something I considered but decided wasn't worth doing.

13 years agoPOSIX_MQ#send returns +true+ on success
Eric Wong [Tue, 1 Mar 2011 08:51:28 +0000 (1 08:51 +0000)]
POSIX_MQ#send returns +true+ on success

This is to be consistent with POSIX_MQ#trysend

13 years agofinalize try* interfaces
Eric Wong [Tue, 1 Mar 2011 08:40:44 +0000 (1 08:40 +0000)]
finalize try* interfaces

Consider them good enough for a 1.0.0 release

13 years agoposix-mq-rb: always prefer write-in-full behavior
Eric Wong [Sun, 27 Feb 2011 11:43:28 +0000 (27 11:43 +0000)]
posix-mq-rb: always prefer write-in-full behavior

In case somebody made the receiving pipe non-blocking,
we want the command-line tool to succeed.

13 years agofix warnings and enable them for tests
Eric Wong [Sun, 27 Feb 2011 11:40:40 +0000 (27 11:40 +0000)]
fix warnings and enable them for tests

Cleaner code anyways.

13 years agoposix-mq-rb: use IO#binmode to get binary IOs
Eric Wong [Sun, 27 Feb 2011 11:37:23 +0000 (27 11:37 +0000)]
posix-mq-rb: use IO#binmode to get binary IOs

Avoids warnings this way

13 years agodoc: note that the try* interfaces are not final
Eric Wong [Sun, 27 Feb 2011 11:27:51 +0000 (27 11:27 +0000)]
doc: note that the try* interfaces are not final

But they'll be pushed to the site for greater
visibility.

13 years agobump version to 0.8.0prev0.8.0pre
Eric Wong [Sun, 27 Feb 2011 11:11:19 +0000 (27 11:11 +0000)]
bump version to 0.8.0pre

Remove the VERSION constant, it's cruft.

13 years agodoc: fix doc generation for manpage
Eric Wong [Sun, 27 Feb 2011 10:59:09 +0000 (27 10:59 +0000)]
doc: fix doc generation for manpage

Oops

13 years agoadd trysend, tryreceive, and tryshift interfaces
Eric Wong [Sun, 27 Feb 2011 10:54:42 +0000 (27 10:54 +0000)]
add trysend, tryreceive, and tryshift interfaces

These are kinder and less exceptional than their
non-trying counterparts as generating exceptions
is expensive for common EAGAIN errors.

13 years agoeliminate needless global (cPOSIX_MQ)
Eric Wong [Sun, 27 Feb 2011 10:19:13 +0000 (27 10:19 +0000)]
eliminate needless global (cPOSIX_MQ)

It can be local variable

13 years agorun GC on ENOSPC when calling mq_open()
Eric Wong [Sun, 27 Feb 2011 10:11:34 +0000 (27 10:11 +0000)]
run GC on ENOSPC when calling mq_open()

It could work...

13 years agoSymbols are VALUEs, not IDs
Eric Wong [Sun, 27 Feb 2011 10:08:48 +0000 (27 10:08 +0000)]
Symbols are VALUEs, not IDs

Oops :x

13 years agotests: do not require Fiddle for Ruby 1.9
Eric Wong [Sun, 27 Feb 2011 09:59:11 +0000 (27 09:59 +0000)]
tests: do not require Fiddle for Ruby 1.9

It's only available when compiled with libffi.

13 years agoDo not trust locally cached mq_flags
Eric Wong [Sun, 27 Feb 2011 09:56:34 +0000 (27 09:56 +0000)]
Do not trust locally cached mq_flags

These flags can be changed in the parent or child
process, so we will always have to run mq_getattr()
to check it.  This removes the GVL-keeping non-blocking
optimizations but we'll gain some soon.

13 years agocleanup DL usage for alarm() test
Eric Wong [Thu, 24 Feb 2011 04:52:26 +0000 (23 20:52 -0800)]
cleanup DL usage for alarm() test

13 years agofix test alarm() case for Ruby 1.9
Eric Wong [Thu, 24 Feb 2011 04:43:09 +0000 (23 20:43 -0800)]
fix test alarm() case for Ruby 1.9

DL in Ruby 1.9 isn't the same

13 years agoposix_mq 0.7.0 - cleanups + portability fixesv0.7.0
Eric Wong [Thu, 24 Feb 2011 00:09:46 +0000 (23 16:09 -0800)]
posix_mq 0.7.0 - cleanups + portability fixes

This release now works for systems other than Linux and FreeBSD
that support POSIX message queues.  This is usable for systems
without mq_timedsend() or mq_timedreceive() but with the
non-timed variants (timeouts wont work).

Thanks to Tadeusz Bochan for testing.

Ruby posix_mq is now dual-licensed under the GPLv2 (as well as the
preferred LGPLv3) for compatibility with existing GPLv2-only code.

13 years agodoc: full rdoc coverage!
Eric Wong [Thu, 24 Feb 2011 00:31:16 +0000 (23 16:31 -0800)]
doc: full rdoc coverage!

13 years agodoc: add copy of GPLv2
Eric Wong [Thu, 24 Feb 2011 00:25:57 +0000 (23 16:25 -0800)]
doc: add copy of GPLv2

For completeness, the LGPLv3 remains the preferred license.

13 years agodoc: note that timeout is not always supported
Eric Wong [Thu, 24 Feb 2011 00:19:16 +0000 (23 16:19 -0800)]
doc: note that timeout is not always supported

Maybe people will just upgrade to newer systems eventually.

13 years agoREADME: update mailing list notes
Eric Wong [Thu, 24 Feb 2011 00:05:36 +0000 (23 16:05 -0800)]
README: update mailing list notes

If it's not clear, we hate HTML.

13 years agoadded a note about em-posixmq for EventMachine users
Eric Wong [Wed, 23 Feb 2011 23:30:02 +0000 (23 15:30 -0800)]
added a note about em-posixmq for EventMachine users

ref: http://mid.gmane.org/AANLkTimNcWKqNSbD5GL76Z9rS3Gfi3uGusPksD2Eo+=P@mail.gmail.com

13 years agodoc: discourage the use of notify
Eric Wong [Wed, 23 Feb 2011 23:26:40 +0000 (23 15:26 -0800)]
doc: discourage the use of notify

POSIX_MQ#notify(&block) mostly sucks.

13 years agounindent class methods
Eric Wong [Wed, 23 Feb 2011 23:21:55 +0000 (23 15:21 -0800)]
unindent class methods

No need to waste indentation and make eyes wander.

13 years agotest for alarm() working properly to interrupt
Eric Wong [Wed, 23 Feb 2011 20:11:18 +0000 (23 20:11 +0000)]
test for alarm() working properly to interrupt

Some systems without mq_timedsend/mq_timedreceive need to
use alarm() or similar (setitimer()) to interrupt timed-out
mq_send/mq_receive calls, so we need to handle EINTR properly.

13 years agoupdate URLs for git and cgit
Eric Wong [Wed, 23 Feb 2011 19:46:53 +0000 (23 19:46 +0000)]
update URLs for git and cgit

While the old URLs still work, bogomips.org went on a URL diet

13 years agofix MQ_IO_NIL_P and MQ_IO_CLOSE macros
Eric Wong [Wed, 23 Feb 2011 19:43:38 +0000 (23 19:43 +0000)]
fix MQ_IO_NIL_P and MQ_IO_CLOSE macros

These cannot be cast to void since its value is
meaningful.

13 years agotest: fix GC test for systems without POSIX_MQ#to_io
Eric Wong [Wed, 23 Feb 2011 19:42:58 +0000 (23 19:42 +0000)]
test: fix GC test for systems without POSIX_MQ#to_io

Not all systems can convert POSIX_MQ to IO objects.

13 years agoLICENSE: dual license, adding GPLv2
Eric Wong [Wed, 23 Feb 2011 01:42:02 +0000 (22 17:42 -0800)]
LICENSE: dual license, adding GPLv2

This makes us explicitly compatible with GPLv2-only programs.

13 years agoattempt to support systems w/o mq_timedsend/mq_timedreceive
Eric Wong [Wed, 23 Feb 2011 00:46:26 +0000 (22 16:46 -0800)]
attempt to support systems w/o mq_timedsend/mq_timedreceive

Some ancient systems don't support mq_timedsend and
mq_timedreceive but somehow manage to support other POSIX
mq_* functions.

13 years agoextconf: remove unnecessary dir_config statement
Eric Wong [Tue, 22 Feb 2011 23:41:22 +0000 (22 15:41 -0800)]
extconf: remove unnecessary dir_config statement

It's all standard C library stuff.

13 years agouse StringValueCStr for paths
Eric Wong [Tue, 22 Feb 2011 23:32:40 +0000 (22 15:32 -0800)]
use StringValueCStr for paths

RSTRING_PTR may contain '\0' bytes which makes it unsuitable
for mq_unlink() and mq_open()

13 years agofix broken rb_str_set_len() #define for Ruby 1.8.6
Eric Wong [Tue, 22 Feb 2011 23:02:31 +0000 (22 15:02 -0800)]
fix broken rb_str_set_len() #define for Ruby 1.8.6

This was too aggressively deleted during cleanups for Rubinius
support in commit 5339d9d693c794c0f20270d5726cb360e31dff30

Noticed-by: Tadeusz Bochan <tad.bochan@bnpparibas.com>
ref: 2a92695fc1958e0370782284c6196625@ruby-forum.com

13 years agofix for systems that can't convert mqd_t to FD
Eric Wong [Tue, 22 Feb 2011 22:50:59 +0000 (22 14:50 -0800)]
fix for systems that can't convert mqd_t to FD

Apparently there are OSes that don't have methods to convert
mqd_t to FD.

Noticed-by: Tadeusz Bochan <tad.bochan@bnpparibas.com>
ref: <2a92695fc1958e0370782284c6196625@ruby-forum.com>

13 years agoswitch to pkg.mk for packaging needs
Eric Wong [Tue, 22 Feb 2011 22:39:31 +0000 (22 14:39 -0800)]
switch to pkg.mk for packaging needs

I can't stand Rake :x

13 years agopublish_news target is less braindead
Eric Wong [Sun, 26 Dec 2010 01:25:27 +0000 (26 01:25 +0000)]
publish_news target is less braindead

Run it by default on releases.

13 years agoposix_mq 0.6.0 - Rubinius supportv0.6.0
Eric Wong [Sat, 25 Dec 2010 08:23:03 +0000 (25 00:23 -0800)]
posix_mq 0.6.0 - Rubinius support

Rubinius 1.2 as well as Ruby 1.9.  Ruby 1.8 works except it will
block the entire interpreter for blocking operations.  Spurious
errors during GC for POSIX_MQ#to_io users are now avoided.

13 years agoswitch to wrongdoc for documentation
Eric Wong [Sat, 25 Dec 2010 08:19:49 +0000 (25 00:19 -0800)]
switch to wrongdoc for documentation

No more JavaScript on our site!

13 years agoadd Rubinius support
Eric Wong [Sat, 25 Dec 2010 07:56:07 +0000 (24 23:56 -0800)]
add Rubinius support

Cleaner code, too, no more direct RSTRUCT usage.

13 years agorefactor type checks and remove unnecessary guards
Eric Wong [Sat, 25 Dec 2010 07:24:29 +0000 (24 23:24 -0800)]
refactor type checks and remove unnecessary guards

StringValuePtr should already be a sufficient guard.
There are more tests while we're at it, too, and we'll
now raise TypeError instead of ArgumentError when a
POSIX_MQ::Attr is not passed properly.

13 years agoremove rb_time_interval() and gettimeofday() dependency
Eric Wong [Sat, 25 Dec 2010 02:11:04 +0000 (24 18:11 -0800)]
remove rb_time_interval() and gettimeofday() dependency

This function isn't exported in the standard Ruby headers,
it returns an aggregate value and isn't available in Rubinius,
either, so nuke it.

While we're at it, use clock_gettime() instead of gettimeofday()
to avoid unnecessary timeval usage since mq_send/mq_receive
rely on higher-precision timespecs instead.

13 years agotests: use Class#method_defined?
Eric Wong [Fri, 20 Aug 2010 02:37:32 +0000 (19 19:37 -0700)]
tests: use Class#method_defined?

I did not know about this method back in the day...

13 years agotest: avoid leaving queues behind
Eric Wong [Fri, 20 Aug 2010 02:36:23 +0000 (19 19:36 -0700)]
test: avoid leaving queues behind

We shouldn't unnecessarily hog system resources.

13 years agoavoid double close() and EBADF
Eric Wong [Fri, 20 Aug 2010 02:25:58 +0000 (19 19:25 -0700)]
avoid double close() and EBADF

It can be dangerous to hit (and ignore) EBADF errors in
multi-threaded applications.  Users of POSIX_MQ#to_io have two
Ruby objects pointing to the same file descriptor, making
things tricky when it comes time to reap resources.

We'll always prefer to close the Ruby IO object if it exists
(because we have less control over its GC behavior) and
ignore the raw descriptor.

13 years agoopen/notify: invoke GC if needed
Eric Wong [Mon, 2 Aug 2010 08:28:15 +0000 (2 08:28 +0000)]
open/notify: invoke GC if needed

On ENOMEM, EMFILE, and ENFILE errors, it is customary to
invoke the Ruby GC and free up resources and retry the
system call.

13 years agoposix_mq 0.5.1v0.5.1
Eric Wong [Sun, 9 May 2010 08:05:56 +0000 (9 01:05 -0700)]
posix_mq 0.5.1

Fix POSIX_MQ#notify(&block) usage, this regression was
introduced in 0.4.0 and our tests for it were broken, as well.

13 years agofix POSIX_MQ#notify(&block) aka SIGEV_THREAD
Eric Wong [Sun, 9 May 2010 07:05:03 +0000 (9 00:05 -0700)]
fix POSIX_MQ#notify(&block) aka SIGEV_THREAD

tests for them were stupidly broken and never executed :x