You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Alex Williams a060b95bef
Fix typo
2 months ago
.github/workflows Add code, tests, CI, and build files 4 months ago
docs Remove offensive word from documentation 2 months ago
test Get rid of '(pmq-timedsend)' and '(pmq-timedreceive)' because redundant code 4 months ago
.gitignore First commit 4 months ago
LICENSE First commit 4 months ago
Makefile Replace sysdefs with (sysdefs) from pil21 4 months ago
README.md Fix typo 2 months ago
module.l Simplify handling of certain (native) calls 4 months ago
mqueue.l Ensure the memory buffer is filled with zeros 4 months ago
sysdefs.freebsd Add code, tests, CI, and build files 4 months ago
sysdefs.linux Add code, tests, CI, and build files 4 months ago
test.l Add code, tests, CI, and build files 4 months ago

README.md

POSIX Message Queues library for PicoLisp (64-bit only)

POSIX Message Queues provide a dependency-free mechanism for processes to exchange data in the form of messages.

This library makes it simple to embed support for POSIX Message Queues in PicoLisp applications running on Linux.

  1. Requirements
  2. Getting Started
  3. Quick Start
  4. Documentation
  5. Testing
  6. Contributing
  7. Changelog
  8. License

Requirements

  • PicoLisp 64-bit v17.12 to v20.7.16, or pil21
  • Linux with kernel v3.5+
  • Kernel POSIX Message Queues support
  • POSIX Realtime Extensions library (librt.so)

Getting Started

The first step is to run the unit tests: make check

If those fail, jump to the TUTORIALS section to perform the initial setup and system check.

If all works well, then your system is ready to use this library.

Quick Start

The code below illustrates how to use the queue for sending and receiving a message.

Example Code

(load "mqueue.l")                               # load the library
(let Fd (pmq-open "/myQ" (list O_RDWR O_CREAT)) # create a read/write queue named "/myQ"
  (pmq-send Fd "Hello World")                   # send the message "Hello World"
  (pmq-receive Fd)                              # receive the message
  (pmq-close Fd)                                # close the queue
  (pmq-unlink "/myQ") )                         # remove the queue

Example Output

Note: Verbose output is enabled by default and can be disabled with (off *PMQ_verbose).

[2020-09-17T03:37:15] Opened queue: Name='/myqueue', FD=3
[2020-09-17T03:37:15] Send: String='Hello World', Priority=0, FD=3
[2020-09-17T03:37:15] Get attributes: Flags=0, Maxmsg=10, Msgsize=8192, Curmsgs=1, FD=3
[2020-09-17T03:37:15] Receive: String='Hello World' (12 Bytes), FD=3
[2020-09-17T03:37:15] Closed queue: FD=3
[2020-09-17T03:37:15] Unlinked queue: Name='/myqueue'
-> 0

Documentation

Additional usage and reference documentation can be found in docs/

  • TUTORIALS: some guides to get started using this library
  • HOWTO: a set of recipes for performing more advanced tasks with this library
  • EXPLAIN: an explanation of some key concepts, including how this library works
  • REFERENCE: technical information on the internals of this library

Testing

This library comes with a large suite of unit and integration tests. To run the tests, type:

make check

Contributing

Changelog

Changelog

License

MIT License

Copyright (c) 2020 Alexander Williams, On-Prem license@on-premises.com