diff options
| author | Po-Chuan Hsieh <sunpoet@FreeBSD.org> | 2026-04-18 21:18:13 +0000 |
|---|---|---|
| committer | Po-Chuan Hsieh <sunpoet@FreeBSD.org> | 2026-04-18 21:18:13 +0000 |
| commit | 7f4a795432528d90d517c3fe47d39e9a7be56b63 (patch) | |
| tree | 00c6b0550f83b5af4e18d7b7ff9bbd1734a9853a | |
| parent | e64e24418d086b6851f905ef661774bac0d710e2 (diff) | |
devel/p5-Atomic-Pipe: Add p5-Atomic-Pipe 0.023
Normally if you write to a pipe from multiple processes/threads, the messages
will come mixed together unpredictably. Some messages may be interrupted by
parts of messages from other writers. This module takes advantage of some POSIX
specifications to allow multiple writers to send arbitrary data down a pipe in
atomic chunks to avoid the issue.
NOTE: This only works for POSIX compliant pipes on POSIX compliant systems. Also
some features may not be available on older systems, or some platforms.
Under the hood this module will split your message into small sections of
slightly smaller than the PIPE_BUF limit. Each message will be sent as 1 atomic
chunk with a 4 byte prefix indicating what process id it came from, what thread
id it came from, a chunk ID (in descending order, so if there are 3 chunks the
first will have id 2, the second 1, and the final chunk is always 0 allowing a
flush as it knows it is done) and then 1 byte with the length of the data
section to follow.
On the receiving end this module will read chunks and re-assemble them based on
the header data. So the reader will always get complete messages. Note that
message order is not guarenteed when messages are sent from multiple processes
or threads. Though all messages from any given thread/process should be in
order.
| -rw-r--r-- | devel/Makefile | 1 | ||||
| -rw-r--r-- | devel/p5-Atomic-Pipe/Makefile | 21 | ||||
| -rw-r--r-- | devel/p5-Atomic-Pipe/distinfo | 3 | ||||
| -rw-r--r-- | devel/p5-Atomic-Pipe/pkg-descr | 22 | ||||
| -rw-r--r-- | devel/p5-Atomic-Pipe/pkg-plist | 2 |
5 files changed, 49 insertions, 0 deletions
diff --git a/devel/Makefile b/devel/Makefile index 28d8be0b3225..95b6a0b86f96 100644 --- a/devel/Makefile +++ b/devel/Makefile @@ -1970,6 +1970,7 @@ SUBDIR += p5-Async-Interrupt SUBDIR += p5-Async-MergePoint SUBDIR += p5-AtExit + SUBDIR += p5-Atomic-Pipe SUBDIR += p5-Attribute-Handlers SUBDIR += p5-Attribute-Handlers-Prospective SUBDIR += p5-Attribute-Persistent diff --git a/devel/p5-Atomic-Pipe/Makefile b/devel/p5-Atomic-Pipe/Makefile new file mode 100644 index 000000000000..2e40dcc3af97 --- /dev/null +++ b/devel/p5-Atomic-Pipe/Makefile @@ -0,0 +1,21 @@ +PORTNAME= Atomic-Pipe +PORTVERSION= 0.023 +CATEGORIES= devel perl5 +MASTER_SITES= CPAN +MASTER_SITE_SUBDIR= CPAN:EXODIST +PKGNAMEPREFIX= p5- + +MAINTAINER= sunpoet@FreeBSD.org +COMMENT= Send atomic messages from multiple writers across a POSIX pipe +WWW= https://metacpan.org/dist/Atomic-Pipe + +LICENSE= ART10 GPLv1+ +LICENSE_COMB= dual +LICENSE_FILE_GPLv1+ = ${WRKSRC}/LICENSE + +USES= perl5 +USE_PERL5= configure + +NO_ARCH= yes + +.include <bsd.port.mk> diff --git a/devel/p5-Atomic-Pipe/distinfo b/devel/p5-Atomic-Pipe/distinfo new file mode 100644 index 000000000000..fb11b026bc5c --- /dev/null +++ b/devel/p5-Atomic-Pipe/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1775587090 +SHA256 (Atomic-Pipe-0.023.tar.gz) = ca72bccf0ace8032a58b17e58a416d4293f1c3442d5b5a0d893b27b491a8a688 +SIZE (Atomic-Pipe-0.023.tar.gz) = 37349 diff --git a/devel/p5-Atomic-Pipe/pkg-descr b/devel/p5-Atomic-Pipe/pkg-descr new file mode 100644 index 000000000000..e708bca4b46f --- /dev/null +++ b/devel/p5-Atomic-Pipe/pkg-descr @@ -0,0 +1,22 @@ +Normally if you write to a pipe from multiple processes/threads, the messages +will come mixed together unpredictably. Some messages may be interrupted by +parts of messages from other writers. This module takes advantage of some POSIX +specifications to allow multiple writers to send arbitrary data down a pipe in +atomic chunks to avoid the issue. + +NOTE: This only works for POSIX compliant pipes on POSIX compliant systems. Also +some features may not be available on older systems, or some platforms. + +Under the hood this module will split your message into small sections of +slightly smaller than the PIPE_BUF limit. Each message will be sent as 1 atomic +chunk with a 4 byte prefix indicating what process id it came from, what thread +id it came from, a chunk ID (in descending order, so if there are 3 chunks the +first will have id 2, the second 1, and the final chunk is always 0 allowing a +flush as it knows it is done) and then 1 byte with the length of the data +section to follow. + +On the receiving end this module will read chunks and re-assemble them based on +the header data. So the reader will always get complete messages. Note that +message order is not guarenteed when messages are sent from multiple processes +or threads. Though all messages from any given thread/process should be in +order. diff --git a/devel/p5-Atomic-Pipe/pkg-plist b/devel/p5-Atomic-Pipe/pkg-plist new file mode 100644 index 000000000000..89a8376d3346 --- /dev/null +++ b/devel/p5-Atomic-Pipe/pkg-plist @@ -0,0 +1,2 @@ +%%SITE_PERL%%/Atomic/Pipe.pm +%%PERL5_MAN3%%/Atomic::Pipe.3.gz |
