Coder Social home page Coder Social logo

ipc's Introduction

System V message queue IPC functions

Wrapper functions for System V Message Queue IPC.

GoDoc Build Status

Example

package main

import (
	"log"
	"syscall"

	"github.com/siadat/ipc"
)

func main() {
	key, err := ipc.Ftok("/dev/null", 42)
	if err != nil {
		panic(err)
	}

	qid, err := ipc.Msgget(key, ipc.IPC_CREAT|ipc.IPC_EXCL|0600)
	if err == syscall.EEXIST {
		log.Fatalf("queue(key=0x%x) exists", key)
	}
	if err != nil {
		log.Fatal(err)
	}

	msg := &ipc.Msgbuf{Mtype: 12, Mtext: []byte("message")}
	err = ipc.Msgsnd(qid, msg, 0)
	if err != nil {
		log.Fatal(err)
	}
}

ipc's People

Contributors

jservan avatar kristocc avatar monktastic avatar peano88 avatar siadat avatar weirdbob avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ipc's Issues

regarding key and qid

is key or message queue id (qid) <== this going to be different if i ran the program for a long time (e.g. forever)
coz i would like to init once instead of going to get the msqid all the time.

will it change during the runtime of the program? otherwise i just init as a variable and use everywhere for the duration of the daemon program

	key, err := ipc.Ftok(ftokpath, ftokid)
	if err != nil {
		log.Fatal(err)
	}

	var qid uint

	switch os.Args[1] {
	case "s", "r":
		qid, err = ipc.Msgget(key, ipc.IPC_CREAT|perm)

license?

Looks like a nice project! Can you please consider adding a license file using either MIT or Apache?

migrate to pure go

Hi
we are using ipc message queues widely in our c projects, I want to add new app written in go
is it possible to migrate project to pure go and don't use cgo?
we want to use it on aix(7.2) and we didn't manage to setup cgo(it's not possible to connect it to internet, but dependencies need internet connection)

thanks

Lost bytes when running on ARM7

Hello,
I try to use your lib on a raspberry pi (raspbian based ), I've just used your Msgrcv test as example, it works well on a x86 computer, but on an ARM7 Everytime I lost the 4th first bytes.

Generate key 705037316
Create ipc queue id 0
Message [24 45 68 0 251 33 9 64] send to ipc id 0
Message [24 45 68 0 0 0 0 0] receive to ipc id 0
2019/11/28 16:50:34 Input = [24 45 68 0 0 0 0 0], want [24 45 68 0 251 33 9 64]

It's probably an issue with cgo but to you have an idea for fixing that ?

Thank you

ipc.Msgctl can not use

I want to get stat, but no any function can use.

this code can't return any data.

ipc.Msgctl(qid, ipc.IPC_STAT)

Version

Hi,

could you please consider tagging/creating a release for this project (whatever the number)? It's stable enough for us to use in production and it would be easier in our go.mod to reference a version instead of a commit.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.