[complement-svn] SF.net SVN: complement: [1398] trunk/complement/explore/inquiry/shades
Status: Pre-Alpha
Brought to you by:
complement
From: <com...@us...> - 2006-11-13 18:25:35
|
Revision: 1398 http://svn.sourceforge.net/complement/?rev=1398&view=rev Author: complement Date: 2006-11-13 10:25:20 -0800 (Mon, 13 Nov 2006) Log Message: ----------- msg investigations Added Paths: ----------- trunk/complement/explore/inquiry/shades/msgq/ trunk/complement/explore/inquiry/shades/msgq/Makefile trunk/complement/explore/inquiry/shades/msgq/Makefile.inc trunk/complement/explore/inquiry/shades/msgq/test.cc Property changes on: trunk/complement/explore/inquiry/shades/msgq ___________________________________________________________________ Name: svn:ignore + obj Added: trunk/complement/explore/inquiry/shades/msgq/Makefile =================================================================== --- trunk/complement/explore/inquiry/shades/msgq/Makefile (rev 0) +++ trunk/complement/explore/inquiry/shades/msgq/Makefile 2006-11-13 18:25:20 UTC (rev 1398) @@ -0,0 +1,6 @@ +# -*- Makefile -*- Time-stamp: <04/01/09 16:53:50 ptr> + +SRCROOT := ../../.. + +include Makefile.inc +include ${SRCROOT}/Makefiles/top.mak Added: trunk/complement/explore/inquiry/shades/msgq/Makefile.inc =================================================================== --- trunk/complement/explore/inquiry/shades/msgq/Makefile.inc (rev 0) +++ trunk/complement/explore/inquiry/shades/msgq/Makefile.inc 2006-11-13 18:25:20 UTC (rev 1398) @@ -0,0 +1,5 @@ +# -*- makefile -*- Time-stamp: <04/01/12 15:37:40 ptr> + +PRGNAME = test +#SRC_C = test.c +SRC_CC = test.cc Added: trunk/complement/explore/inquiry/shades/msgq/test.cc =================================================================== --- trunk/complement/explore/inquiry/shades/msgq/test.cc (rev 0) +++ trunk/complement/explore/inquiry/shades/msgq/test.cc 2006-11-13 18:25:20 UTC (rev 1398) @@ -0,0 +1,53 @@ +#include <sys/ipc.h> +#include <sys/msg.h> + +#include <iostream> +#include <iomanip> + +using namespace std; + +int main( int argc, char **argv ) +{ + // key_t key = 12345; + key_t key = ftok( "/tmp/msg.queue", 276 ); + + int msqid = msgget( key /* IPC_PRIVATE */, 0666 | IPC_CREAT ); + + if ( msqid < 0 ) { + cerr << "Can't create message queue" << endl; + return 1; + } + + + struct msqid_ds buf; + if ( msgctl( msqid, IPC_STAT, &buf ) < 0 ) { + cerr << "Can't stat message queue" << endl; + return 2; + } + + cout << buf.msg_perm.uid << "\n" << buf.msg_perm.gid << "\n" + << oct << buf.msg_perm.mode << dec << "\n" + << buf.msg_qbytes << endl; + + // if ( msgctl( msqid, IPC_RMID, &buf ) ) { + // cerr << "Can't remove message queue" << endl; + // return 4; + // } + + return 0; + + + buf.msg_qbytes = /* 16384; */ 256 * 1024 * 1024; + + if ( msgctl( msqid, IPC_SET, &buf ) < 0 ) { + cerr << "Can't set message queue params" << endl; + return 3; + } + + if ( msgctl( msqid, IPC_STAT, &buf ) < 0 ) { + cerr << "Can't stat message queue" << endl; + return 2; + } + + return 0; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |