[complement-svn] SF.net SVN: complement: [1353] trunk/explore/perf/stem
Status: Pre-Alpha
Brought to you by:
complement
From: <com...@us...> - 2006-11-01 12:40:04
|
Revision: 1353 http://svn.sourceforge.net/complement/?rev=1353&view=rev Author: complement Date: 2006-11-01 04:39:44 -0800 (Wed, 01 Nov 2006) Log Message: ----------- shades rlimit Added Paths: ----------- trunk/explore/perf/stem/rlimit/ trunk/explore/perf/stem/rlimit/Makefile trunk/explore/perf/stem/rlimit/Makefile.inc trunk/explore/perf/stem/rlimit/fdlimit.c Property changes on: trunk/explore/perf/stem/rlimit ___________________________________________________________________ Name: svn:ignore + obj Added: trunk/explore/perf/stem/rlimit/Makefile =================================================================== --- trunk/explore/perf/stem/rlimit/Makefile (rev 0) +++ trunk/explore/perf/stem/rlimit/Makefile 2006-11-01 12:39:44 UTC (rev 1353) @@ -0,0 +1,14 @@ +# -*- Makefile -*- Time-stamp: <04/01/09 16:53:50 ptr> + +SRCROOT := ../../.. +COMPILER_NAME := gcc + +include Makefile.inc +include ${SRCROOT}/Makefiles/top.mak + +INCLUDES += -I${CoMT_INCLUDE_DIR} +LDSEARCH += -L${CoMT_LIB_DIR} + +release-shared : LDFLAGS += -Wl,-rpath=${STLPORT_LIB_DIR}:${PWD}/${CoMT_LIB_DIR} -lxmt -lsockios -lstem +dbg-shared : LDFLAGS += -Wl,-rpath=${STLPORT_LIB_DIR}:${PWD}/${CoMT_LIB_DIR} -lxmtg -lsockiosg -lstemg +stldbg-shared : LDFLAGS += -Wl,-rpath=${STLPORT_LIB_DIR}:${PWD}/${CoMT_LIB_DIR} -lxmtstlg -lsockiosstlg -lstemstlg Added: trunk/explore/perf/stem/rlimit/Makefile.inc =================================================================== --- trunk/explore/perf/stem/rlimit/Makefile.inc (rev 0) +++ trunk/explore/perf/stem/rlimit/Makefile.inc 2006-11-01 12:39:44 UTC (rev 1353) @@ -0,0 +1,4 @@ +# -*- makefile -*- Time-stamp: <04/01/12 15:37:40 ptr> + +PRGNAME = fdlimit +SRC_C = fdlimit.c Added: trunk/explore/perf/stem/rlimit/fdlimit.c =================================================================== --- trunk/explore/perf/stem/rlimit/fdlimit.c (rev 0) +++ trunk/explore/perf/stem/rlimit/fdlimit.c 2006-11-01 12:39:44 UTC (rev 1353) @@ -0,0 +1,44 @@ +#include "stdio.h" +#include "stdlib.h" +#include "string.h" +#include "errno.h" +#include "sys/resource.h" + +int main (int argc, char *argv[]) +{ + if (argc != 2) + { + printf ("usage: fdlimit new-limit\n" + "$ ./fdlimit 100\n"); + exit (1); + } + struct rlimit rlp; + int result = getrlimit (RLIMIT_NOFILE, &rlp); + if (result != 0) + { + printf ("error %d: %s\n", errno, strerror (errno)); + exit (1); + } + printf ("current fd limit is %d\n", rlp.rlim_cur); + printf ("max fd limit is %d\n", rlp.rlim_max); + + /* change the current limit */ + rlp.rlim_cur = atoi (argv[1]); + + result = setrlimit (RLIMIT_NOFILE, &rlp); + if (result != 0) + { + printf ("error %d: %s\n", errno, strerror (errno)); + /* don't exit. see that the limit is unchanged */ + } + + result = getrlimit (RLIMIT_NOFILE, &rlp); + if (result != 0) + { + printf ("error %d: %s\n", errno, strerror (errno)); + exit (1); + } + printf ("current fd limit is %d\n", rlp.rlim_cur); + printf ("max fd limit is %d\n", rlp.rlim_max); + return 0; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |