[complement-svn] SF.net SVN: complement: [1440] trunk/complement/explore/inquiry/shades/msgq
Status: Pre-Alpha
Brought to you by:
complement
From: <com...@us...> - 2006-12-12 08:20:22
|
Revision: 1440 http://svn.sourceforge.net/complement/?rev=1440&view=rev Author: complement Date: 2006-12-12 00:20:21 -0800 (Tue, 12 Dec 2006) Log Message: ----------- play with two programs from same catalog Modified Paths: -------------- trunk/complement/explore/inquiry/shades/msgq/Makefile trunk/complement/explore/inquiry/shades/msgq/Makefile.inc trunk/complement/explore/inquiry/shades/msgq/test.cc Added Paths: ----------- trunk/complement/explore/inquiry/shades/msgq/test2.cc Modified: trunk/complement/explore/inquiry/shades/msgq/Makefile =================================================================== --- trunk/complement/explore/inquiry/shades/msgq/Makefile 2006-12-12 08:19:17 UTC (rev 1439) +++ trunk/complement/explore/inquiry/shades/msgq/Makefile 2006-12-12 08:20:21 UTC (rev 1440) @@ -1,6 +1,10 @@ -# -*- Makefile -*- Time-stamp: <04/01/09 16:53:50 ptr> +# -*- Makefile -*- Time-stamp: <06/11/13 23:03:45 ptr> SRCROOT := ../../.. include Makefile.inc include ${SRCROOT}/Makefiles/top.mak + +ifndef WITHOUT_STLPORT +LDFLAGS += -Wl,-rpath=${STLPORT_LIB_DIR} +endif Modified: trunk/complement/explore/inquiry/shades/msgq/Makefile.inc =================================================================== --- trunk/complement/explore/inquiry/shades/msgq/Makefile.inc 2006-12-12 08:19:17 UTC (rev 1439) +++ trunk/complement/explore/inquiry/shades/msgq/Makefile.inc 2006-12-12 08:20:21 UTC (rev 1440) @@ -1,5 +1,7 @@ # -*- makefile -*- Time-stamp: <04/01/12 15:37:40 ptr> PRGNAME = test +PRGNAMES = test2 #SRC_C = test.c SRC_CC = test.cc +test2_SRC_CC = test2.cc Modified: trunk/complement/explore/inquiry/shades/msgq/test.cc =================================================================== --- trunk/complement/explore/inquiry/shades/msgq/test.cc 2006-12-12 08:19:17 UTC (rev 1439) +++ trunk/complement/explore/inquiry/shades/msgq/test.cc 2006-12-12 08:20:21 UTC (rev 1440) @@ -8,9 +8,11 @@ int main( int argc, char **argv ) { - // key_t key = 12345; - key_t key = ftok( "/tmp/msg.queue", 276 ); + key_t key = 12345; + // key_t key = ftok( "/tmp/msg.queue", 276 ); + cerr << key << endl; + int msqid = msgget( key /* IPC_PRIVATE */, 0666 | IPC_CREAT ); if ( msqid < 0 ) { @@ -29,14 +31,8 @@ << 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; - - +#if 0 buf.msg_qbytes = /* 16384; */ 256 * 1024 * 1024; if ( msgctl( msqid, IPC_SET, &buf ) < 0 ) { @@ -48,6 +44,16 @@ cerr << "Can't stat message queue" << endl; return 2; } +#endif return 0; + +#if 0 + if ( msgctl( msqid, IPC_RMID, &buf ) ) { + cerr << "Can't remove message queue" << endl; + return 4; + } + + return 0; +#endif } Added: trunk/complement/explore/inquiry/shades/msgq/test2.cc =================================================================== --- trunk/complement/explore/inquiry/shades/msgq/test2.cc (rev 0) +++ trunk/complement/explore/inquiry/shades/msgq/test2.cc 2006-12-12 08:20:21 UTC (rev 1440) @@ -0,0 +1,59 @@ +#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 ); + + cerr << key << endl; + + 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 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; + } +#endif + + return 0; + +#if 0 + if ( msgctl( msqid, IPC_RMID, &buf ) ) { + cerr << "Can't remove message queue" << endl; + return 4; + } + + return 0; +#endif +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |