/go-sysv

A Golang wrapper for System V IPC

Primary LanguageGoBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

System V Wrapper

Overview

A limited wrapper around System V inter-process communication facilities. This package does not aim to expose the full System V feature set but rather expose a limited set of features in idiomatic and safe Go.

Implemented facilities:

  • Message queues
    • Create queue
    • Delete queue
    • Send
    • Receive
    • Manage existing queue
  • Semaphore sets
  • Shared memory segments

Example

The example files can be run using the following commands:

go run example/sender/main.go    # Create queue and send message
go run example/receiver/main.go  # Receive one message
go run example/cleanup/main.go   # Delete queue from system

Send and receive can be run in any order, though note the receiver will block until a message arrives.

If you experience trouble on your system and need to delete queues without using this package, use ipcs and ipcrm.

# Show all system v resources
ipcs -oa
# Delete queue by id
ipcrm -q $QUEUE_ID

Installation

Install this package using go get:

go get github.com/sgilson/go-sysv