All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH][openfile] file descriptors not cleaned up
@ 2009-09-30  2:06 Henry Yei
  2009-10-04 22:18 ` Jiri Palecek
  0 siblings, 1 reply; 12+ messages in thread
From: Henry Yei @ 2009-09-30  2:06 UTC (permalink / raw)
  To: LTP Mailing List

[-- Attachment #1: Type: text/plain, Size: 486 bytes --]

Hello,

This patch for openfile contains the following changes:
- test output to use tst_resm functions
- sets ups and cleans up tmp dir properly
- closes all opened file descriptors before thread exit(fixes nfs issues on removing tmp dir)

Signed-off-by: Henry Yei <hyei@mvista.com>


This test opens multiple file descriptors to the same file. Perhaps the author meant to open file handles for separate files?



Henry Yei
MontaVista Software, Inc.
hyei@mvista.com


[-- Attachment #2: openfile.patch --]
[-- Type: application/octet-stream, Size: 9821 bytes --]

diff -Nurp -x CVS ltp-20090531/testcases/kernel/fs/openfile/Makefile ltp-wdir/testcases/kernel/fs/openfile/Makefile
--- ltp-20090531/testcases/kernel/fs/openfile/Makefile	2003-03-04 08:13:52.000000000 -0800
+++ ltp-wdir/testcases/kernel/fs/openfile/Makefile	2009-09-29 18:37:25.704096806 -0700
@@ -1,5 +1,5 @@
-CFLAGS += -Wall
-LOADLIBES += -lpthread
+CFLAGS+= -I../../../../include -Wall
+LDLIBS+= -L../../../../lib -lltp -lpthread
 
 SRCS=$(wildcard *.c)
 TARGETS=$(patsubst %.c,%,$(SRCS))
diff -Nurp -x CVS ltp-20090531/testcases/kernel/fs/openfile/openfile.c ltp-wdir/testcases/kernel/fs/openfile/openfile.c
--- ltp-20090531/testcases/kernel/fs/openfile/openfile.c	2009-02-26 04:14:52.000000000 -0800
+++ ltp-wdir/testcases/kernel/fs/openfile/openfile.c	2009-09-29 18:53:04.900096315 -0700
@@ -29,94 +29,107 @@
  *
  */
 
-
 #include <pthread.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
 #include <unistd.h>
 
+#include "test.h"
+#include "usctest.h"
+
+char *TCID = "openfile01";	/* Test program identifier.    */
+int TST_TOTAL = 1;
 
 #define MAXFILES        32768
 #define MAXTHREADS      10
 
-
 /* Control Structure */
 struct cb {
 	pthread_mutex_t m;
-	pthread_cond_t  init_cv;
-	pthread_cond_t  thr_cv;
-	int		thr_sleeping;
+	pthread_cond_t init_cv;
+	pthread_cond_t thr_cv;
+	int thr_sleeping;
 } c;
 
-
 /* Global Variables */
-int     numthreads=10, numfiles=10;
-int     debug=0;
-char *  filename="FILETOOPEN";
+int numthreads = 10, numfiles = 10;
+int debug = 0;
+char * filename = "FILETOOPEN";
 
+void setup(void)
+{
+	tst_tmpdir();
+}
 
-/* Procedures */
-void *threads(void* thread_id);
+void cleanup(void)
+{
+	tst_rmdir();
+	tst_exit();
+}
 
 
+/* Procedures */
+void *threads(void* thread_id);
 
 /* **************************************************************************
-   *                              MAIN PROCEDURE                            *
-   ************************************************************************** */
+ *                              MAIN PROCEDURE                            *
+ ************************************************************************** */
 
 int main(int argc, char *argv[])
 {
-	int 	   i,opt,badopts=0;
-        FILE 	   *fd;
-	pthread_t  th_id;
-	char       msg[80]="";
-        extern char *optarg;
-
-        while((opt=getopt(argc, argv, "df:t:h")) != EOF) {
-          switch((char) opt) {
-            case 'd':
-              debug=1;
-              break;
-            case 'f':
-              numfiles=atoi(optarg);
-              if(numfiles <= 0)
-                badopts=1;
-              break;
-            case 't':
-              numthreads=atoi(optarg);
-              if(numthreads <= 0)
-                badopts=1;
-              break;
-            case 'h':
-            default:
-              printf("Usage: openfile [-d] -f FILES -t THREADS\n");
-       	      _exit(1);
-          }
-        }
-        if(badopts) {
-          printf("Usage: openfile [-d] -f FILES -t THREADS\n");
-       	  _exit(1);
-        }
-
-    	/* Check if numthreads is less than MAXFILES */
-    	if ( numfiles > MAXFILES ){
-          	sprintf(msg,"%s\nCannot use %d files", msg, numfiles);
-          	sprintf(msg,"%s, used %d files instead\n", msg, MAXFILES);
-          	numfiles = MAXFILES;
-    	}
-
-    	/* Check if numthreads is less than MAXTHREADS */
-    	if ( numthreads > MAXTHREADS ){
-          	sprintf(msg,"%s\nCannot use %d threads", msg, numthreads);
-          	sprintf(msg,"%s, used %d threads instead\n", msg, MAXTHREADS);
-          	numthreads = MAXTHREADS;
+	int i, opt, badopts = 0;
+	FILE *fd;
+	pthread_t th_id;
+	char msg[80] = "";
+	extern char *optarg;
+
+	while ((opt = getopt(argc, argv, "df:t:h")) != EOF) {
+		switch ((char) opt) {
+		case 'd':
+			debug = 1;
+			break;
+		case 'f':
+			numfiles = atoi(optarg);
+			if (numfiles <= 0)
+				badopts = 1;
+			break;
+		case 't':
+			numthreads = atoi(optarg);
+			if (numthreads <= 0)
+				badopts = 1;
+			break;
+		case 'h':
+		default:
+			printf("Usage: openfile [-d] -f FILES -t THREADS\n");
+			_exit(1);
+		}
+	}
+	if (badopts) {
+		printf("Usage: openfile [-d] -f FILES -t THREADS\n");
+		_exit(1);
+	}
+
+	setup();
+
+	/* Check if numthreads is less than MAXFILES */
+	if (numfiles > MAXFILES) {
+		sprintf(msg, "%s\nCannot use %d files", msg, numfiles);
+		sprintf(msg, "%s, used %d files instead\n", msg, MAXFILES);
+		numfiles = MAXFILES;
+	}
+
+	/* Check if numthreads is less than MAXTHREADS */
+	if (numthreads > MAXTHREADS) {
+		sprintf(msg, "%s\nCannot use %d threads", msg, numthreads);
+		sprintf(msg, "%s, used %d threads instead\n", msg, MAXTHREADS);
+		numthreads = MAXTHREADS;
 	}
 
 	/* Create files */
-	if ((fd=fopen(filename,"w")) == NULL){
-		perror ("FAIL - Could not create file");
-		_exit(1);
+	if ((fd = fopen(filename, "w")) == NULL) {
+		tst_resm(TFAIL, "Could not create file");
+		cleanup();
 	}
 
 	/* Initialize thread control variables, lock & condition */
@@ -126,120 +139,122 @@ int main(int argc, char *argv[])
 	c.thr_sleeping = 0;
 
 	/* Grab mutex lock */
-	if (pthread_mutex_lock(&c.m)){
-		perror("FAIL - failed to grab mutex lock");
+	if (pthread_mutex_lock(&c.m)) {
+		tst_resm(TFAIL, "failed to grab mutex lock");
 		fclose(fd);
 		unlink(filename);
-		_exit(1);
+		cleanup();
 	}
 
 	printf("Creating Reading Threads\n");
 
 	/* Create threads */
-	for (i=0; i<numthreads; i++)
-		if (pthread_create(&th_id, (pthread_attr_t *)NULL, threads,
-				(void *)(uintptr_t)i)) {
-			perror("FAIL - failed creating a pthread; increase limits");
+	for (i = 0; i < numthreads; i++)
+		if (pthread_create(&th_id, (pthread_attr_t *) NULL, threads,
+				(void *) (uintptr_t) i)) {
+			tst_resm(TFAIL, "failed creating a pthread; increase limits");
 			fclose(fd);
 			unlink(filename);
-			_exit(1);
+			cleanup();
 		}
 
 	/* Sleep until all threads are created */
 	while (c.thr_sleeping != numthreads)
-		if (pthread_cond_wait(&c.init_cv, &c.m)){
-			perror("FAIL - error while waiting for reading threads");
+		if (pthread_cond_wait(&c.init_cv, &c.m)) {
+			tst_resm(TFAIL, "error while waiting for reading threads");
 			fclose(fd);
 			unlink(filename);
-			_exit(1);
+			cleanup();
 		}
 
 	/* Wake up all threads */
-	if (pthread_cond_broadcast(&c.thr_cv)){
-		perror("FAIL - failed trying to wake up reading threads");
+	if (pthread_cond_broadcast(&c.thr_cv)) {
+		tst_resm(TFAIL, "failed trying to wake up reading threads");
 		fclose(fd);
 		unlink(filename);
-		_exit(1);
+		cleanup();
 	}
 	/* Release mutex lock */
 	if (pthread_mutex_unlock(&c.m)) {
-		perror("FAIL - failed to release mutex lock");
+		tst_resm(TFAIL, "failed to release mutex lock");
 		fclose(fd);
 		unlink(filename);
-		_exit(1);
+		cleanup();
 	}
 
-        printf("PASS - Threads are done reading\n");
+	tst_resm(TPASS, "Threads are done reading");
 
-    	printf("%s", msg);
 	fclose(fd);
 	unlink(filename);
-	_exit(0);
+	cleanup();
 }
 
-
-
 /* **************************************************************************
-   *				OTHER PROCEDURES			    *
-   ************************************************************************** */
+ *				OTHER PROCEDURES			    *
+ ************************************************************************** */
+
+void close_files(FILE *fd_list[]) {
+	int i;
+	for (i = 0; i < numfiles; i++) {
+		fclose(fd_list[i]);
+	}
+}
 
 /* threads: Each thread opens the files specified */
-void * threads(void* thread_id_)
-{
-  int thread_id=(uintptr_t)thread_id_;
-    	char  errmsg[80];
-        FILE  *fd;
-	int   i;
-
-    	/* Open files */
-    	for (i=0; i<numfiles; i++) {
-                if(debug)
-       		  printf("Thread  %d : Opening file number %d \n", thread_id, i);
-       		if ((fd = fopen(filename,"rw")) == NULL) {
-          		sprintf(errmsg,"FAIL - Couldn't open file #%d",i);
-          		perror(errmsg);
+void * threads(void* thread_id_) {
+	int thread_id = (uintptr_t) thread_id_;
+	char errmsg[80];
+	FILE *fd_list[MAXFILES];
+	int i;
+
+	/* Open files */
+	for (i = 0; i < numfiles; i++) {
+		if (debug)
+			printf("Thread  %d : Opening file number %d \n", thread_id, i);
+		if ((fd_list[i] = fopen(filename, "rw")) == NULL) {
+			sprintf(errmsg, "FAIL - Couldn't open file #%d", i);
+			perror(errmsg);
 			unlink(filename);
-			pthread_exit((void*)1);
-       		}
-    	}
+			pthread_exit((void*) 1);
+		}
+	}
 
 	/* Grab mutex lock */
 	if (pthread_mutex_lock(&c.m)) {
 		perror("FAIL - failed to grab mutex lock");
-       		fclose(fd);
+		close_files(fd_list);
 		unlink(filename);
-		pthread_exit((void*)1);
+		pthread_exit((void*) 1);
 	}
 
 	/* Check if you should wake up main thread */
-        if (++c.thr_sleeping == numthreads)
-                if (pthread_cond_signal(&c.init_cv)){
+	if (++c.thr_sleeping == numthreads)
+		if (pthread_cond_signal(&c.init_cv)) {
 			perror("FAIL - failed to signal main thread");
-       			fclose(fd);
+			close_files(fd_list);
 			unlink(filename);
-			pthread_exit((void*)1);
+			pthread_exit((void*) 1);
 		}
 
 	/* Sleep until woken up */
-        if (pthread_cond_wait(&c.thr_cv, &c.m)){
+	if (pthread_cond_wait(&c.thr_cv, &c.m)) {
 		perror("FAIL - failed to wake up correctly");
-       		fclose(fd);
+		close_files(fd_list);
 		unlink(filename);
-		pthread_exit((void*)1);
+		pthread_exit((void*) 1);
 	}
 
 	/* Release mutex lock */
-        if (pthread_mutex_unlock(&c.m)){
+	if (pthread_mutex_unlock(&c.m)) {
 		perror("FAIL - failed to release mutex lock");
-       		fclose(fd);
+		close_files(fd_list);
 		unlink(filename);
-		pthread_exit((void*)1);
+		pthread_exit((void*) 1);
 	}
 
-	/* Close file and exit */
-       	fclose(fd);
+	/* Close file handles and exit */
+	close_files(fd_list);
 	unlink(filename);
-        pthread_exit((void*)0);
+	pthread_exit((void*) 0);
 }
 
-

[-- Attachment #3: Type: text/plain, Size: 401 bytes --]

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [LTP] [PATCH][openfile] file descriptors not cleaned up
  2009-09-30  2:06 [LTP] [PATCH][openfile] file descriptors not cleaned up Henry Yei
@ 2009-10-04 22:18 ` Jiri Palecek
  2009-10-05  2:51   ` [LTP] GPL License in CrackerJack hisashi.hashimoto.wh
  2009-10-05 21:33   ` [LTP] [PATCH][openfile] file descriptors not cleaned up Henry Yei
  0 siblings, 2 replies; 12+ messages in thread
From: Jiri Palecek @ 2009-10-04 22:18 UTC (permalink / raw)
  To: Henry Yei; +Cc: LTP Mailing List

Hello,

On Wednesday 30 September 2009 04:06:46 Henry Yei wrote:
> This patch for openfile contains the following changes:
> - test output to use tst_resm functions
> - sets ups and cleans up tmp dir properly
> - closes all opened file descriptors before thread exit(fixes nfs issues on removing tmp dir)
> 
> Signed-off-by: Henry Yei <hyei@mvista.com>
> 
> 
> This test opens multiple file descriptors to the same file. Perhaps the author meant to open file handles for separate files?

This is suspicious, for me too. But maybe there is some logic behind opening the same file many times.

I just have a small remark about your patch: Shouldn't you call close_files() here, too? (With a partially full fd_list array handled, of course)

+void * threads(void* thread_id_) {
+	int thread_id = (uintptr_t) thread_id_;
+	char errmsg[80];
+	FILE *fd_list[MAXFILES];
+	int i;
+
+	/* Open files */
+	for (i = 0; i < numfiles; i++) {
+		if (debug)
+			printf("Thread  %d : Opening file number %d \n", thread_id, i);
+		if ((fd_list[i] = fopen(filename, "rw")) == NULL) {
+			sprintf(errmsg, "FAIL - Couldn't open file #%d", i);
+			perror(errmsg);

Regards
    Jiri Palecek

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [LTP] GPL License in CrackerJack
  2009-10-04 22:18 ` Jiri Palecek
@ 2009-10-05  2:51   ` hisashi.hashimoto.wh
  2009-10-13 14:43     ` Subrata Modak
  2009-10-05 21:33   ` [LTP] [PATCH][openfile] file descriptors not cleaned up Henry Yei
  1 sibling, 1 reply; 12+ messages in thread
From: hisashi.hashimoto.wh @ 2009-10-05  2:51 UTC (permalink / raw)
  Cc: LTP Mailing List

Suburata-san,
Yamato-san,

   This is Hashimoto of CrackerJack.

I inserted License Description into all source code of our project.
(GPL V2)
   If you need our latest source code,
please do one of followings.

SVN
svn co https://crackerjack.svn.sourceforge.net/svnroot/crackerjack crackerjack 

Download tar ball.
crackerjack-3.0.tgz at http://sourceforge.net/projects/crackerjack/files/

Thanks,

Hisashi Hashimoto

Board of Director, the Linux Foundation,

Senior Engineer

Open Source Software Promotion Center
Enterprise Business Planning
Hitachi, Ltd., Software Division
Tel : +81-45-862-8470, Fax : +81-45-862-8471
hisashi.hashimoto.wh@hitachi.com

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [LTP] [PATCH][openfile] file descriptors not cleaned up
  2009-10-04 22:18 ` Jiri Palecek
  2009-10-05  2:51   ` [LTP] GPL License in CrackerJack hisashi.hashimoto.wh
@ 2009-10-05 21:33   ` Henry Yei
  2009-10-13 14:43     ` Subrata Modak
  1 sibling, 1 reply; 12+ messages in thread
From: Henry Yei @ 2009-10-05 21:33 UTC (permalink / raw)
  To: jpalecek; +Cc: LTP Mailing List

[-- Attachment #1: Type: text/plain, Size: 1422 bytes --]

On Wednesday 04, October 2009 04:06:46 Jiri Palecek wrote:

Hello,

On Wednesday 30 September 2009 04:06:46 Henry Yei wrote:
> This patch for openfile contains the following changes:
> - test output to use tst_resm functions
> - sets ups and cleans up tmp dir properly
> - closes all opened file descriptors before thread exit(fixes nfs issues on removing tmp dir)
> 
> Signed-off-by: Henry Yei <hyei@mvista.com>
> 
> 
> This test opens multiple file descriptors to the same file. Perhaps the author meant to open file handles for separate files?

This is suspicious, for me too. But maybe there is some logic behind opening the same file many times.

I just have a small remark about your patch: Shouldn't you call close_files() here, too? (With a partially full fd_list array handled, of course)

+void * threads(void* thread_id_) {
+	int thread_id = (uintptr_t) thread_id_;
+	char errmsg[80];
+	FILE *fd_list[MAXFILES];
+	int i;
+
+	/* Open files */
+	for (i = 0; i < numfiles; i++) {
+		if (debug)
+			printf("Thread  %d : Opening file number %d \n", thread_id, i);
+		if ((fd_list[i] = fopen(filename, "rw")) == NULL) {
+			sprintf(errmsg, "FAIL - Couldn't open file #%d", i);
+			perror(errmsg);



Jiri, 

Thanks for reviewing the patch. Yes, that was an omission on my part. I have attached an updated patch. Let me know if there are any more comments.



Henry Yei




[-- Attachment #2: openfile.patch --]
[-- Type: application/octet-stream, Size: 9930 bytes --]

diff -Nurp -x CVS ltp-20090531/testcases/kernel/fs/openfile/Makefile ltp-wdir/testcases/kernel/fs/openfile/Makefile
--- ltp-20090531/testcases/kernel/fs/openfile/Makefile	2003-03-04 08:13:52.000000000 -0800
+++ ltp-wdir/testcases/kernel/fs/openfile/Makefile	2009-09-29 18:37:25.704096806 -0700
@@ -1,5 +1,5 @@
-CFLAGS += -Wall
-LOADLIBES += -lpthread
+CFLAGS+= -I../../../../include -Wall
+LDLIBS+= -L../../../../lib -lltp -lpthread
 
 SRCS=$(wildcard *.c)
 TARGETS=$(patsubst %.c,%,$(SRCS))
diff -Nurp -x CVS ltp-20090531/testcases/kernel/fs/openfile/openfile.c ltp-wdir/testcases/kernel/fs/openfile/openfile.c
--- ltp-20090531/testcases/kernel/fs/openfile/openfile.c	2009-02-26 04:14:52.000000000 -0800
+++ ltp-wdir/testcases/kernel/fs/openfile/openfile.c	2009-10-05 14:28:23.584097826 -0700
@@ -29,94 +29,107 @@
  *
  */
 
-
 #include <pthread.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
 #include <unistd.h>
 
+#include "test.h"
+#include "usctest.h"
+
+char *TCID = "openfile01";	/* Test program identifier.    */
+int TST_TOTAL = 1;
 
 #define MAXFILES        32768
 #define MAXTHREADS      10
 
-
 /* Control Structure */
 struct cb {
 	pthread_mutex_t m;
-	pthread_cond_t  init_cv;
-	pthread_cond_t  thr_cv;
-	int		thr_sleeping;
+	pthread_cond_t init_cv;
+	pthread_cond_t thr_cv;
+	int thr_sleeping;
 } c;
 
-
 /* Global Variables */
-int     numthreads=10, numfiles=10;
-int     debug=0;
-char *  filename="FILETOOPEN";
+int numthreads = 10, numfiles = 10;
+int debug = 0;
+char * filename = "FILETOOPEN";
 
+void setup(void)
+{
+	tst_tmpdir();
+}
 
-/* Procedures */
-void *threads(void* thread_id);
+void cleanup(void)
+{
+	tst_rmdir();
+	tst_exit();
+}
 
 
+/* Procedures */
+void *threads(void* thread_id);
 
 /* **************************************************************************
-   *                              MAIN PROCEDURE                            *
-   ************************************************************************** */
+ *                              MAIN PROCEDURE                            *
+ ************************************************************************** */
 
 int main(int argc, char *argv[])
 {
-	int 	   i,opt,badopts=0;
-        FILE 	   *fd;
-	pthread_t  th_id;
-	char       msg[80]="";
-        extern char *optarg;
-
-        while((opt=getopt(argc, argv, "df:t:h")) != EOF) {
-          switch((char) opt) {
-            case 'd':
-              debug=1;
-              break;
-            case 'f':
-              numfiles=atoi(optarg);
-              if(numfiles <= 0)
-                badopts=1;
-              break;
-            case 't':
-              numthreads=atoi(optarg);
-              if(numthreads <= 0)
-                badopts=1;
-              break;
-            case 'h':
-            default:
-              printf("Usage: openfile [-d] -f FILES -t THREADS\n");
-       	      _exit(1);
-          }
-        }
-        if(badopts) {
-          printf("Usage: openfile [-d] -f FILES -t THREADS\n");
-       	  _exit(1);
-        }
-
-    	/* Check if numthreads is less than MAXFILES */
-    	if ( numfiles > MAXFILES ){
-          	sprintf(msg,"%s\nCannot use %d files", msg, numfiles);
-          	sprintf(msg,"%s, used %d files instead\n", msg, MAXFILES);
-          	numfiles = MAXFILES;
-    	}
-
-    	/* Check if numthreads is less than MAXTHREADS */
-    	if ( numthreads > MAXTHREADS ){
-          	sprintf(msg,"%s\nCannot use %d threads", msg, numthreads);
-          	sprintf(msg,"%s, used %d threads instead\n", msg, MAXTHREADS);
-          	numthreads = MAXTHREADS;
+	int i, opt, badopts = 0;
+	FILE *fd;
+	pthread_t th_id;
+	char msg[80] = "";
+	extern char *optarg;
+
+	while ((opt = getopt(argc, argv, "df:t:h")) != EOF) {
+		switch ((char) opt) {
+		case 'd':
+			debug = 1;
+			break;
+		case 'f':
+			numfiles = atoi(optarg);
+			if (numfiles <= 0)
+				badopts = 1;
+			break;
+		case 't':
+			numthreads = atoi(optarg);
+			if (numthreads <= 0)
+				badopts = 1;
+			break;
+		case 'h':
+		default:
+			printf("Usage: openfile [-d] -f FILES -t THREADS\n");
+			_exit(1);
+		}
+	}
+	if (badopts) {
+		printf("Usage: openfile [-d] -f FILES -t THREADS\n");
+		_exit(1);
+	}
+
+	setup();
+
+	/* Check if numthreads is less than MAXFILES */
+	if (numfiles > MAXFILES) {
+		sprintf(msg, "%s\nCannot use %d files", msg, numfiles);
+		sprintf(msg, "%s, used %d files instead\n", msg, MAXFILES);
+		numfiles = MAXFILES;
+	}
+
+	/* Check if numthreads is less than MAXTHREADS */
+	if (numthreads > MAXTHREADS) {
+		sprintf(msg, "%s\nCannot use %d threads", msg, numthreads);
+		sprintf(msg, "%s, used %d threads instead\n", msg, MAXTHREADS);
+		numthreads = MAXTHREADS;
 	}
 
 	/* Create files */
-	if ((fd=fopen(filename,"w")) == NULL){
-		perror ("FAIL - Could not create file");
-		_exit(1);
+	if ((fd = fopen(filename, "w")) == NULL) {
+		tst_resm(TFAIL, "Could not create file");
+		cleanup();
 	}
 
 	/* Initialize thread control variables, lock & condition */
@@ -126,120 +139,126 @@ int main(int argc, char *argv[])
 	c.thr_sleeping = 0;
 
 	/* Grab mutex lock */
-	if (pthread_mutex_lock(&c.m)){
-		perror("FAIL - failed to grab mutex lock");
+	if (pthread_mutex_lock(&c.m)) {
+		tst_resm(TFAIL, "failed to grab mutex lock");
 		fclose(fd);
 		unlink(filename);
-		_exit(1);
+		cleanup();
 	}
 
 	printf("Creating Reading Threads\n");
 
 	/* Create threads */
-	for (i=0; i<numthreads; i++)
-		if (pthread_create(&th_id, (pthread_attr_t *)NULL, threads,
-				(void *)(uintptr_t)i)) {
-			perror("FAIL - failed creating a pthread; increase limits");
+	for (i = 0; i < numthreads; i++)
+		if (pthread_create(&th_id, (pthread_attr_t *) NULL, threads,
+				(void *) (uintptr_t) i)) {
+			tst_resm(TFAIL, "failed creating a pthread; increase limits");
 			fclose(fd);
 			unlink(filename);
-			_exit(1);
+			cleanup();
 		}
 
 	/* Sleep until all threads are created */
 	while (c.thr_sleeping != numthreads)
-		if (pthread_cond_wait(&c.init_cv, &c.m)){
-			perror("FAIL - error while waiting for reading threads");
+		if (pthread_cond_wait(&c.init_cv, &c.m)) {
+			tst_resm(TFAIL, "error while waiting for reading threads");
 			fclose(fd);
 			unlink(filename);
-			_exit(1);
+			cleanup();
 		}
 
 	/* Wake up all threads */
-	if (pthread_cond_broadcast(&c.thr_cv)){
-		perror("FAIL - failed trying to wake up reading threads");
+	if (pthread_cond_broadcast(&c.thr_cv)) {
+		tst_resm(TFAIL, "failed trying to wake up reading threads");
 		fclose(fd);
 		unlink(filename);
-		_exit(1);
+		cleanup();
 	}
 	/* Release mutex lock */
 	if (pthread_mutex_unlock(&c.m)) {
-		perror("FAIL - failed to release mutex lock");
+		tst_resm(TFAIL, "failed to release mutex lock");
 		fclose(fd);
 		unlink(filename);
-		_exit(1);
+		cleanup();
 	}
 
-        printf("PASS - Threads are done reading\n");
+	tst_resm(TPASS, "Threads are done reading");
 
-    	printf("%s", msg);
 	fclose(fd);
 	unlink(filename);
+	cleanup();
 	_exit(0);
 }
 
-
-
 /* **************************************************************************
-   *				OTHER PROCEDURES			    *
-   ************************************************************************** */
+ *				OTHER PROCEDURES			    *
+ ************************************************************************** */
+
+void close_files(FILE *fd_list[], int len) {
+	int i;
+	for (i = 0; i < len; i++) {
+		fclose(fd_list[i]);
+	}
+}
 
 /* threads: Each thread opens the files specified */
-void * threads(void* thread_id_)
-{
-  int thread_id=(uintptr_t)thread_id_;
-    	char  errmsg[80];
-        FILE  *fd;
-	int   i;
-
-    	/* Open files */
-    	for (i=0; i<numfiles; i++) {
-                if(debug)
-       		  printf("Thread  %d : Opening file number %d \n", thread_id, i);
-       		if ((fd = fopen(filename,"rw")) == NULL) {
-          		sprintf(errmsg,"FAIL - Couldn't open file #%d",i);
-          		perror(errmsg);
+void * threads(void* thread_id_) {
+	int thread_id = (uintptr_t) thread_id_;
+	char errmsg[80];
+	FILE *fd_list[MAXFILES];
+	int i;
+
+	/* Open files */
+	for (i = 0; i < numfiles; i++) {
+		if (debug)
+			printf("Thread  %d : Opening file number %d \n", thread_id, i);
+		if ((fd_list[i] = fopen(filename, "rw")) == NULL) {
+			sprintf(errmsg, "FAIL - Couldn't open file #%d", i);
+			perror(errmsg);
+			if (i > 0) {
+				close_files(fd_list, i-1);
+			}
 			unlink(filename);
-			pthread_exit((void*)1);
-       		}
-    	}
+			pthread_exit((void*) 1);
+		}
+	}
 
 	/* Grab mutex lock */
 	if (pthread_mutex_lock(&c.m)) {
 		perror("FAIL - failed to grab mutex lock");
-       		fclose(fd);
+		close_files(fd_list, numfiles);
 		unlink(filename);
-		pthread_exit((void*)1);
+		pthread_exit((void*) 1);
 	}
 
 	/* Check if you should wake up main thread */
-        if (++c.thr_sleeping == numthreads)
-                if (pthread_cond_signal(&c.init_cv)){
+	if (++c.thr_sleeping == numthreads)
+		if (pthread_cond_signal(&c.init_cv)) {
 			perror("FAIL - failed to signal main thread");
-       			fclose(fd);
+			close_files(fd_list, numfiles);
 			unlink(filename);
-			pthread_exit((void*)1);
+			pthread_exit((void*) 1);
 		}
 
 	/* Sleep until woken up */
-        if (pthread_cond_wait(&c.thr_cv, &c.m)){
+	if (pthread_cond_wait(&c.thr_cv, &c.m)) {
 		perror("FAIL - failed to wake up correctly");
-       		fclose(fd);
+		close_files(fd_list, numfiles);
 		unlink(filename);
-		pthread_exit((void*)1);
+		pthread_exit((void*) 1);
 	}
 
 	/* Release mutex lock */
-        if (pthread_mutex_unlock(&c.m)){
+	if (pthread_mutex_unlock(&c.m)) {
 		perror("FAIL - failed to release mutex lock");
-       		fclose(fd);
+		close_files(fd_list, numfiles);
 		unlink(filename);
-		pthread_exit((void*)1);
+		pthread_exit((void*) 1);
 	}
 
-	/* Close file and exit */
-       	fclose(fd);
+	/* Close file handles and exit */
+	close_files(fd_list, numfiles);
 	unlink(filename);
-        pthread_exit((void*)0);
+	pthread_exit((void*) 0);
 }
 
-

[-- Attachment #3: Type: text/plain, Size: 401 bytes --]

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [LTP] [PATCH][openfile] file descriptors not cleaned up
  2009-10-05 21:33   ` [LTP] [PATCH][openfile] file descriptors not cleaned up Henry Yei
@ 2009-10-13 14:43     ` Subrata Modak
  2009-10-13 19:20       ` Garrett Cooper
  0 siblings, 1 reply; 12+ messages in thread
From: Subrata Modak @ 2009-10-13 14:43 UTC (permalink / raw)
  To: Henry Yei; +Cc: jpalecek, LTP Mailing List

On Mon, 2009-10-05 at 14:33 -0700, Henry Yei wrote: 
> On Wednesday 04, October 2009 04:06:46 Jiri Palecek wrote:
> 
> Hello,
> 
> On Wednesday 30 September 2009 04:06:46 Henry Yei wrote:
> > This patch for openfile contains the following changes:
> > - test output to use tst_resm functions
> > - sets ups and cleans up tmp dir properly
> > - closes all opened file descriptors before thread exit(fixes nfs issues on removing tmp dir)
> > 
> > Signed-off-by: Henry Yei <hyei@mvista.com>
> > 
> > 
> > This test opens multiple file descriptors to the same file. Perhaps the author meant to open file handles for separate files?
> 
> This is suspicious, for me too. But maybe there is some logic behind opening the same file many times.
> 
> I just have a small remark about your patch: Shouldn't you call close_files() here, too? (With a partially full fd_list array handled, of course)
> 
> +void * threads(void* thread_id_) {
> +	int thread_id = (uintptr_t) thread_id_;
> +	char errmsg[80];
> +	FILE *fd_list[MAXFILES];
> +	int i;
> +
> +	/* Open files */
> +	for (i = 0; i < numfiles; i++) {
> +		if (debug)
> +			printf("Thread  %d : Opening file number %d \n", thread_id, i);
> +		if ((fd_list[i] = fopen(filename, "rw")) == NULL) {
> +			sprintf(errmsg, "FAIL - Couldn't open file #%d", i);
> +			perror(errmsg);
> 
> 
> 
> Jiri, 
> 
> Thanks for reviewing the patch. Yes, that was an omission on my part. I have attached an updated patch. Let me know if there are any more comments.
> 

Henry,

This patch is ineffective on the present Makefile(s). Please rebase them
over latest CVS and resend:

patching file testcases/kernel/fs/openfile/Makefile
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- saving rejects to file
testcases/kernel/fs/openfile/Makefile.rej
patching file testcases/kernel/fs/openfile/openfile.c

Regards--
Subrata

> 
> 
> Henry Yei
> 
> 
> 
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay 
> ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
> http://p.sf.net/sfu/devconf
> _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [LTP] GPL License in CrackerJack
  2009-10-05  2:51   ` [LTP] GPL License in CrackerJack hisashi.hashimoto.wh
@ 2009-10-13 14:43     ` Subrata Modak
  0 siblings, 0 replies; 12+ messages in thread
From: Subrata Modak @ 2009-10-13 14:43 UTC (permalink / raw)
  To: hisashi.hashimoto.wh; +Cc: LTP Mailing List

On Mon, 2009-10-05 at 11:51 +0900, hisashi.hashimoto.wh@hitachi.com
wrote: 
> Suburata-san,
> Yamato-san,
> 
>    This is Hashimoto of CrackerJack.
> 
> I inserted License Description into all source code of our project.
> (GPL V2)
>    If you need our latest source code,
> please do one of followings.

Thank you Hashimoto-san. We will refer to your code whenever needed.

Regards--
Subrata

> 
> SVN
> svn co https://crackerjack.svn.sourceforge.net/svnroot/crackerjack crackerjack 
> 
> Download tar ball.
> crackerjack-3.0.tgz at http://sourceforge.net/projects/crackerjack/files/
> 
> Thanks,
> 
> Hisashi Hashimoto
> 
> Board of Director, the Linux Foundation,
> 
> Senior Engineer
> 
> Open Source Software Promotion Center
> Enterprise Business Planning
> Hitachi, Ltd., Software Division
> Tel : +81-45-862-8470, Fax : +81-45-862-8471
> hisashi.hashimoto.wh@hitachi.com
> 
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay 
> ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
> http://p.sf.net/sfu/devconf
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [LTP] [PATCH][openfile] file descriptors not cleaned up
  2009-10-13 14:43     ` Subrata Modak
@ 2009-10-13 19:20       ` Garrett Cooper
  2009-10-13 19:21         ` Garrett Cooper
  0 siblings, 1 reply; 12+ messages in thread
From: Garrett Cooper @ 2009-10-13 19:20 UTC (permalink / raw)
  To: subrata; +Cc: jpalecek, LTP Mailing List

On Tue, Oct 13, 2009 at 7:43 AM, Subrata Modak
<subrata@linux.vnet.ibm.com> wrote:
> On Mon, 2009-10-05 at 14:33 -0700, Henry Yei wrote:
>> On Wednesday 04, October 2009 04:06:46 Jiri Palecek wrote:
>>
>> Hello,
>>
>> On Wednesday 30 September 2009 04:06:46 Henry Yei wrote:
>> > This patch for openfile contains the following changes:
>> > - test output to use tst_resm functions
>> > - sets ups and cleans up tmp dir properly
>> > - closes all opened file descriptors before thread exit(fixes nfs issues on removing tmp dir)
>> >
>> > Signed-off-by: Henry Yei <hyei@mvista.com>
>> >
>> >
>> > This test opens multiple file descriptors to the same file. Perhaps the author meant to open file handles for separate files?
>>
>> This is suspicious, for me too. But maybe there is some logic behind opening the same file many times.
>>
>> I just have a small remark about your patch: Shouldn't you call close_files() here, too? (With a partially full fd_list array handled, of course)
>>
>> +void * threads(void* thread_id_) {
>> +     int thread_id = (uintptr_t) thread_id_;
>> +     char errmsg[80];
>> +     FILE *fd_list[MAXFILES];
>> +     int i;
>> +
>> +     /* Open files */
>> +     for (i = 0; i < numfiles; i++) {
>> +             if (debug)
>> +                     printf("Thread  %d : Opening file number %d \n", thread_id, i);
>> +             if ((fd_list[i] = fopen(filename, "rw")) == NULL) {
>> +                     sprintf(errmsg, "FAIL - Couldn't open file #%d", i);
>> +                     perror(errmsg);
>>
>>
>>
>> Jiri,
>>
>> Thanks for reviewing the patch. Yes, that was an omission on my part. I have attached an updated patch. Let me know if there are any more comments.
>>
>
> Henry,
>
> This patch is ineffective on the present Makefile(s). Please rebase them
> over latest CVS and resend:
>
> patching file testcases/kernel/fs/openfile/Makefile
> Hunk #1 FAILED at 1.
> 1 out of 1 hunk FAILED -- saving rejects to file
> testcases/kernel/fs/openfile/Makefile.rej
> patching file testcases/kernel/fs/openfile/openfile.c

    I'll gladly help if help is needed. Feel free to ping me and we
can setup a rendezvous on IRC or something.
Thanks!
-Garrett

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [LTP] [PATCH][openfile] file descriptors not cleaned up
  2009-10-13 19:20       ` Garrett Cooper
@ 2009-10-13 19:21         ` Garrett Cooper
  2009-10-14  2:25           ` Henry Yei
  0 siblings, 1 reply; 12+ messages in thread
From: Garrett Cooper @ 2009-10-13 19:21 UTC (permalink / raw)
  To: subrata; +Cc: jpalecek, LTP Mailing List

On Tue, Oct 13, 2009 at 12:20 PM, Garrett Cooper <yanegomi@gmail.com> wrote:
> On Tue, Oct 13, 2009 at 7:43 AM, Subrata Modak
> <subrata@linux.vnet.ibm.com> wrote:
>> On Mon, 2009-10-05 at 14:33 -0700, Henry Yei wrote:
>>> On Wednesday 04, October 2009 04:06:46 Jiri Palecek wrote:
>>>
>>> Hello,
>>>
>>> On Wednesday 30 September 2009 04:06:46 Henry Yei wrote:
>>> > This patch for openfile contains the following changes:
>>> > - test output to use tst_resm functions
>>> > - sets ups and cleans up tmp dir properly
>>> > - closes all opened file descriptors before thread exit(fixes nfs issues on removing tmp dir)
>>> >
>>> > Signed-off-by: Henry Yei <hyei@mvista.com>
>>> >
>>> >
>>> > This test opens multiple file descriptors to the same file. Perhaps the author meant to open file handles for separate files?
>>>
>>> This is suspicious, for me too. But maybe there is some logic behind opening the same file many times.
>>>
>>> I just have a small remark about your patch: Shouldn't you call close_files() here, too? (With a partially full fd_list array handled, of course)
>>>
>>> +void * threads(void* thread_id_) {
>>> +     int thread_id = (uintptr_t) thread_id_;
>>> +     char errmsg[80];
>>> +     FILE *fd_list[MAXFILES];
>>> +     int i;
>>> +
>>> +     /* Open files */
>>> +     for (i = 0; i < numfiles; i++) {
>>> +             if (debug)
>>> +                     printf("Thread  %d : Opening file number %d \n", thread_id, i);
>>> +             if ((fd_list[i] = fopen(filename, "rw")) == NULL) {
>>> +                     sprintf(errmsg, "FAIL - Couldn't open file #%d", i);
>>> +                     perror(errmsg);
>>>
>>>
>>>
>>> Jiri,
>>>
>>> Thanks for reviewing the patch. Yes, that was an omission on my part. I have attached an updated patch. Let me know if there are any more comments.
>>>
>>
>> Henry,
>>
>> This patch is ineffective on the present Makefile(s). Please rebase them
>> over latest CVS and resend:
>>
>> patching file testcases/kernel/fs/openfile/Makefile
>> Hunk #1 FAILED at 1.
>> 1 out of 1 hunk FAILED -- saving rejects to file
>> testcases/kernel/fs/openfile/Makefile.rej
>> patching file testcases/kernel/fs/openfile/openfile.c
>
>    I'll gladly help if help is needed. Feel free to ping me and we
> can setup a rendezvous on IRC or something.

    I looked at the diff again and if you just omit the Makefile
change then the rest should go through.
HTH,
-Garrett

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [LTP] [PATCH][openfile] file descriptors not cleaned up
  2009-10-13 19:21         ` Garrett Cooper
@ 2009-10-14  2:25           ` Henry Yei
  2009-10-14  2:30             ` Garrett Cooper
  2009-10-14 20:28             ` [LTP] [PATCH][openfile] file descriptors not cleaned up Subrata Modak
  0 siblings, 2 replies; 12+ messages in thread
From: Henry Yei @ 2009-10-14  2:25 UTC (permalink / raw)
  To: Garrett Cooper, subrata; +Cc: jpalecek, LTP Mailing List

[-- Attachment #1: Type: text/plain, Size: 3200 bytes --]

All,

Here is the openfile patch without the Makefile changes as they are not needed with the new Makefile changes.
I regenerated and tested the patch with the latest version of the ltp from CVS.

I had trouble compiling LTP without autoconf 2.61 even after following instructions from the README.mk-users file to try to build without autoconf. Most of our test hosts are running autoconf 2.59. Does anyone have updated instructions?


-----Original Message-----
From: Garrett Cooper [mailto:yanegomi@gmail.com] 
Sent: Tuesday, October 13, 2009 12:22 PM
To: subrata@linux.vnet.ibm.com
Cc: Henry Yei; jpalecek@web.de; LTP Mailing List
Subject: Re: [LTP] [PATCH][openfile] file descriptors not cleaned up

On Tue, Oct 13, 2009 at 12:20 PM, Garrett Cooper <yanegomi@gmail.com> wrote:
> On Tue, Oct 13, 2009 at 7:43 AM, Subrata Modak
> <subrata@linux.vnet.ibm.com> wrote:
>> On Mon, 2009-10-05 at 14:33 -0700, Henry Yei wrote:
>>> On Wednesday 04, October 2009 04:06:46 Jiri Palecek wrote:
>>>
>>> Hello,
>>>
>>> On Wednesday 30 September 2009 04:06:46 Henry Yei wrote:
>>> > This patch for openfile contains the following changes:
>>> > - test output to use tst_resm functions
>>> > - sets ups and cleans up tmp dir properly
>>> > - closes all opened file descriptors before thread exit(fixes nfs issues on removing tmp dir)
>>> >
>>> > Signed-off-by: Henry Yei <hyei@mvista.com>
>>> >
>>> >
>>> > This test opens multiple file descriptors to the same file. Perhaps the author meant to open file handles for separate files?
>>>
>>> This is suspicious, for me too. But maybe there is some logic behind opening the same file many times.
>>>
>>> I just have a small remark about your patch: Shouldn't you call close_files() here, too? (With a partially full fd_list array handled, of course)
>>>
>>> +void * threads(void* thread_id_) {
>>> +     int thread_id = (uintptr_t) thread_id_;
>>> +     char errmsg[80];
>>> +     FILE *fd_list[MAXFILES];
>>> +     int i;
>>> +
>>> +     /* Open files */
>>> +     for (i = 0; i < numfiles; i++) {
>>> +             if (debug)
>>> +                     printf("Thread  %d : Opening file number %d \n", thread_id, i);
>>> +             if ((fd_list[i] = fopen(filename, "rw")) == NULL) {
>>> +                     sprintf(errmsg, "FAIL - Couldn't open file #%d", i);
>>> +                     perror(errmsg);
>>>
>>>
>>>
>>> Jiri,
>>>
>>> Thanks for reviewing the patch. Yes, that was an omission on my part. I have attached an updated patch. Let me know if there are any more comments.
>>>
>>
>> Henry,
>>
>> This patch is ineffective on the present Makefile(s). Please rebase them
>> over latest CVS and resend:
>>
>> patching file testcases/kernel/fs/openfile/Makefile
>> Hunk #1 FAILED at 1.
>> 1 out of 1 hunk FAILED -- saving rejects to file
>> testcases/kernel/fs/openfile/Makefile.rej
>> patching file testcases/kernel/fs/openfile/openfile.c
>
>    I'll gladly help if help is needed. Feel free to ping me and we
> can setup a rendezvous on IRC or something.

    I looked at the diff again and if you just omit the Makefile
change then the rest should go through.
HTH,
-Garrett

[-- Attachment #2: openfile.patch --]
[-- Type: application/octet-stream, Size: 9309 bytes --]

--- ltp/testcases/kernel/fs/openfile/openfile.c	2009-02-26 04:14:52.000000000 -0800
+++ ltp-wdir/testcases/kernel/fs/openfile/openfile.c	2009-10-05 14:28:23.584097826 -0700
@@ -29,94 +29,107 @@
  *
  */
 
-
 #include <pthread.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
 #include <unistd.h>
 
+#include "test.h"
+#include "usctest.h"
+
+char *TCID = "openfile01";	/* Test program identifier.    */
+int TST_TOTAL = 1;
 
 #define MAXFILES        32768
 #define MAXTHREADS      10
 
-
 /* Control Structure */
 struct cb {
 	pthread_mutex_t m;
-	pthread_cond_t  init_cv;
-	pthread_cond_t  thr_cv;
-	int		thr_sleeping;
+	pthread_cond_t init_cv;
+	pthread_cond_t thr_cv;
+	int thr_sleeping;
 } c;
 
-
 /* Global Variables */
-int     numthreads=10, numfiles=10;
-int     debug=0;
-char *  filename="FILETOOPEN";
+int numthreads = 10, numfiles = 10;
+int debug = 0;
+char * filename = "FILETOOPEN";
 
+void setup(void)
+{
+	tst_tmpdir();
+}
 
-/* Procedures */
-void *threads(void* thread_id);
+void cleanup(void)
+{
+	tst_rmdir();
+	tst_exit();
+}
 
 
+/* Procedures */
+void *threads(void* thread_id);
 
 /* **************************************************************************
-   *                              MAIN PROCEDURE                            *
-   ************************************************************************** */
+ *                              MAIN PROCEDURE                            *
+ ************************************************************************** */
 
 int main(int argc, char *argv[])
 {
-	int 	   i,opt,badopts=0;
-        FILE 	   *fd;
-	pthread_t  th_id;
-	char       msg[80]="";
-        extern char *optarg;
-
-        while((opt=getopt(argc, argv, "df:t:h")) != EOF) {
-          switch((char) opt) {
-            case 'd':
-              debug=1;
-              break;
-            case 'f':
-              numfiles=atoi(optarg);
-              if(numfiles <= 0)
-                badopts=1;
-              break;
-            case 't':
-              numthreads=atoi(optarg);
-              if(numthreads <= 0)
-                badopts=1;
-              break;
-            case 'h':
-            default:
-              printf("Usage: openfile [-d] -f FILES -t THREADS\n");
-       	      _exit(1);
-          }
-        }
-        if(badopts) {
-          printf("Usage: openfile [-d] -f FILES -t THREADS\n");
-       	  _exit(1);
-        }
-
-    	/* Check if numthreads is less than MAXFILES */
-    	if ( numfiles > MAXFILES ){
-          	sprintf(msg,"%s\nCannot use %d files", msg, numfiles);
-          	sprintf(msg,"%s, used %d files instead\n", msg, MAXFILES);
-          	numfiles = MAXFILES;
-    	}
-
-    	/* Check if numthreads is less than MAXTHREADS */
-    	if ( numthreads > MAXTHREADS ){
-          	sprintf(msg,"%s\nCannot use %d threads", msg, numthreads);
-          	sprintf(msg,"%s, used %d threads instead\n", msg, MAXTHREADS);
-          	numthreads = MAXTHREADS;
+	int i, opt, badopts = 0;
+	FILE *fd;
+	pthread_t th_id;
+	char msg[80] = "";
+	extern char *optarg;
+
+	while ((opt = getopt(argc, argv, "df:t:h")) != EOF) {
+		switch ((char) opt) {
+		case 'd':
+			debug = 1;
+			break;
+		case 'f':
+			numfiles = atoi(optarg);
+			if (numfiles <= 0)
+				badopts = 1;
+			break;
+		case 't':
+			numthreads = atoi(optarg);
+			if (numthreads <= 0)
+				badopts = 1;
+			break;
+		case 'h':
+		default:
+			printf("Usage: openfile [-d] -f FILES -t THREADS\n");
+			_exit(1);
+		}
+	}
+	if (badopts) {
+		printf("Usage: openfile [-d] -f FILES -t THREADS\n");
+		_exit(1);
+	}
+
+	setup();
+
+	/* Check if numthreads is less than MAXFILES */
+	if (numfiles > MAXFILES) {
+		sprintf(msg, "%s\nCannot use %d files", msg, numfiles);
+		sprintf(msg, "%s, used %d files instead\n", msg, MAXFILES);
+		numfiles = MAXFILES;
+	}
+
+	/* Check if numthreads is less than MAXTHREADS */
+	if (numthreads > MAXTHREADS) {
+		sprintf(msg, "%s\nCannot use %d threads", msg, numthreads);
+		sprintf(msg, "%s, used %d threads instead\n", msg, MAXTHREADS);
+		numthreads = MAXTHREADS;
 	}
 
 	/* Create files */
-	if ((fd=fopen(filename,"w")) == NULL){
-		perror ("FAIL - Could not create file");
-		_exit(1);
+	if ((fd = fopen(filename, "w")) == NULL) {
+		tst_resm(TFAIL, "Could not create file");
+		cleanup();
 	}
 
 	/* Initialize thread control variables, lock & condition */
@@ -126,120 +139,126 @@ int main(int argc, char *argv[])
 	c.thr_sleeping = 0;
 
 	/* Grab mutex lock */
-	if (pthread_mutex_lock(&c.m)){
-		perror("FAIL - failed to grab mutex lock");
+	if (pthread_mutex_lock(&c.m)) {
+		tst_resm(TFAIL, "failed to grab mutex lock");
 		fclose(fd);
 		unlink(filename);
-		_exit(1);
+		cleanup();
 	}
 
 	printf("Creating Reading Threads\n");
 
 	/* Create threads */
-	for (i=0; i<numthreads; i++)
-		if (pthread_create(&th_id, (pthread_attr_t *)NULL, threads,
-				(void *)(uintptr_t)i)) {
-			perror("FAIL - failed creating a pthread; increase limits");
+	for (i = 0; i < numthreads; i++)
+		if (pthread_create(&th_id, (pthread_attr_t *) NULL, threads,
+				(void *) (uintptr_t) i)) {
+			tst_resm(TFAIL, "failed creating a pthread; increase limits");
 			fclose(fd);
 			unlink(filename);
-			_exit(1);
+			cleanup();
 		}
 
 	/* Sleep until all threads are created */
 	while (c.thr_sleeping != numthreads)
-		if (pthread_cond_wait(&c.init_cv, &c.m)){
-			perror("FAIL - error while waiting for reading threads");
+		if (pthread_cond_wait(&c.init_cv, &c.m)) {
+			tst_resm(TFAIL, "error while waiting for reading threads");
 			fclose(fd);
 			unlink(filename);
-			_exit(1);
+			cleanup();
 		}
 
 	/* Wake up all threads */
-	if (pthread_cond_broadcast(&c.thr_cv)){
-		perror("FAIL - failed trying to wake up reading threads");
+	if (pthread_cond_broadcast(&c.thr_cv)) {
+		tst_resm(TFAIL, "failed trying to wake up reading threads");
 		fclose(fd);
 		unlink(filename);
-		_exit(1);
+		cleanup();
 	}
 	/* Release mutex lock */
 	if (pthread_mutex_unlock(&c.m)) {
-		perror("FAIL - failed to release mutex lock");
+		tst_resm(TFAIL, "failed to release mutex lock");
 		fclose(fd);
 		unlink(filename);
-		_exit(1);
+		cleanup();
 	}
 
-        printf("PASS - Threads are done reading\n");
+	tst_resm(TPASS, "Threads are done reading");
 
-    	printf("%s", msg);
 	fclose(fd);
 	unlink(filename);
+	cleanup();
 	_exit(0);
 }
 
-
-
 /* **************************************************************************
-   *				OTHER PROCEDURES			    *
-   ************************************************************************** */
+ *				OTHER PROCEDURES			    *
+ ************************************************************************** */
+
+void close_files(FILE *fd_list[], int len) {
+	int i;
+	for (i = 0; i < len; i++) {
+		fclose(fd_list[i]);
+	}
+}
 
 /* threads: Each thread opens the files specified */
-void * threads(void* thread_id_)
-{
-  int thread_id=(uintptr_t)thread_id_;
-    	char  errmsg[80];
-        FILE  *fd;
-	int   i;
-
-    	/* Open files */
-    	for (i=0; i<numfiles; i++) {
-                if(debug)
-       		  printf("Thread  %d : Opening file number %d \n", thread_id, i);
-       		if ((fd = fopen(filename,"rw")) == NULL) {
-          		sprintf(errmsg,"FAIL - Couldn't open file #%d",i);
-          		perror(errmsg);
+void * threads(void* thread_id_) {
+	int thread_id = (uintptr_t) thread_id_;
+	char errmsg[80];
+	FILE *fd_list[MAXFILES];
+	int i;
+
+	/* Open files */
+	for (i = 0; i < numfiles; i++) {
+		if (debug)
+			printf("Thread  %d : Opening file number %d \n", thread_id, i);
+		if ((fd_list[i] = fopen(filename, "rw")) == NULL) {
+			sprintf(errmsg, "FAIL - Couldn't open file #%d", i);
+			perror(errmsg);
+			if (i > 0) {
+				close_files(fd_list, i-1);
+			}
 			unlink(filename);
-			pthread_exit((void*)1);
-       		}
-    	}
+			pthread_exit((void*) 1);
+		}
+	}
 
 	/* Grab mutex lock */
 	if (pthread_mutex_lock(&c.m)) {
 		perror("FAIL - failed to grab mutex lock");
-       		fclose(fd);
+		close_files(fd_list, numfiles);
 		unlink(filename);
-		pthread_exit((void*)1);
+		pthread_exit((void*) 1);
 	}
 
 	/* Check if you should wake up main thread */
-        if (++c.thr_sleeping == numthreads)
-                if (pthread_cond_signal(&c.init_cv)){
+	if (++c.thr_sleeping == numthreads)
+		if (pthread_cond_signal(&c.init_cv)) {
 			perror("FAIL - failed to signal main thread");
-       			fclose(fd);
+			close_files(fd_list, numfiles);
 			unlink(filename);
-			pthread_exit((void*)1);
+			pthread_exit((void*) 1);
 		}
 
 	/* Sleep until woken up */
-        if (pthread_cond_wait(&c.thr_cv, &c.m)){
+	if (pthread_cond_wait(&c.thr_cv, &c.m)) {
 		perror("FAIL - failed to wake up correctly");
-       		fclose(fd);
+		close_files(fd_list, numfiles);
 		unlink(filename);
-		pthread_exit((void*)1);
+		pthread_exit((void*) 1);
 	}
 
 	/* Release mutex lock */
-        if (pthread_mutex_unlock(&c.m)){
+	if (pthread_mutex_unlock(&c.m)) {
 		perror("FAIL - failed to release mutex lock");
-       		fclose(fd);
+		close_files(fd_list, numfiles);
 		unlink(filename);
-		pthread_exit((void*)1);
+		pthread_exit((void*) 1);
 	}
 
-	/* Close file and exit */
-       	fclose(fd);
+	/* Close file handles and exit */
+	close_files(fd_list, numfiles);
 	unlink(filename);
-        pthread_exit((void*)0);
+	pthread_exit((void*) 0);
 }
 
-

[-- Attachment #3: Type: text/plain, Size: 399 bytes --]

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [LTP] [PATCH][openfile] file descriptors not cleaned up
  2009-10-14  2:25           ` Henry Yei
@ 2009-10-14  2:30             ` Garrett Cooper
       [not found]               ` <8368651DACC1964480F951191B94A0780153D6A2@svexch01.mvista.com>
  2009-10-14 20:28             ` [LTP] [PATCH][openfile] file descriptors not cleaned up Subrata Modak
  1 sibling, 1 reply; 12+ messages in thread
From: Garrett Cooper @ 2009-10-14  2:30 UTC (permalink / raw)
  To: Henry Yei; +Cc: jpalecek, LTP Mailing List

On Tue, Oct 13, 2009 at 7:25 PM, Henry Yei <hyei@mvista.com> wrote:
> All,
>
> Here is the openfile patch without the Makefile changes as they are not needed with the new Makefile changes.
> I regenerated and tested the patch with the latest version of the ltp from CVS.
>
> I had trouble compiling LTP without autoconf 2.61 even after following instructions from the README.mk-users file to try to build without autoconf. Most of our test hosts are running autoconf 2.59. Does anyone have updated instructions?
>
>
> -----Original Message-----
> From: Garrett Cooper [mailto:yanegomi@gmail.com]
> Sent: Tuesday, October 13, 2009 12:22 PM
> To: subrata@linux.vnet.ibm.com
> Cc: Henry Yei; jpalecek@web.de; LTP Mailing List
> Subject: Re: [LTP] [PATCH][openfile] file descriptors not cleaned up
>
> On Tue, Oct 13, 2009 at 12:20 PM, Garrett Cooper <yanegomi@gmail.com> wrote:
>> On Tue, Oct 13, 2009 at 7:43 AM, Subrata Modak
>> <subrata@linux.vnet.ibm.com> wrote:
>>> On Mon, 2009-10-05 at 14:33 -0700, Henry Yei wrote:
>>>> On Wednesday 04, October 2009 04:06:46 Jiri Palecek wrote:
>>>>
>>>> Hello,
>>>>
>>>> On Wednesday 30 September 2009 04:06:46 Henry Yei wrote:
>>>> > This patch for openfile contains the following changes:
>>>> > - test output to use tst_resm functions
>>>> > - sets ups and cleans up tmp dir properly
>>>> > - closes all opened file descriptors before thread exit(fixes nfs issues on removing tmp dir)
>>>> >
>>>> > Signed-off-by: Henry Yei <hyei@mvista.com>
>>>> >
>>>> >
>>>> > This test opens multiple file descriptors to the same file. Perhaps the author meant to open file handles for separate files?
>>>>
>>>> This is suspicious, for me too. But maybe there is some logic behind opening the same file many times.
>>>>
>>>> I just have a small remark about your patch: Shouldn't you call close_files() here, too? (With a partially full fd_list array handled, of course)
>>>>
>>>> +void * threads(void* thread_id_) {
>>>> +     int thread_id = (uintptr_t) thread_id_;
>>>> +     char errmsg[80];
>>>> +     FILE *fd_list[MAXFILES];
>>>> +     int i;
>>>> +
>>>> +     /* Open files */
>>>> +     for (i = 0; i < numfiles; i++) {
>>>> +             if (debug)
>>>> +                     printf("Thread  %d : Opening file number %d \n", thread_id, i);
>>>> +             if ((fd_list[i] = fopen(filename, "rw")) == NULL) {
>>>> +                     sprintf(errmsg, "FAIL - Couldn't open file #%d", i);
>>>> +                     perror(errmsg);
>>>>
>>>>
>>>>
>>>> Jiri,
>>>>
>>>> Thanks for reviewing the patch. Yes, that was an omission on my part. I have attached an updated patch. Let me know if there are any more comments.

Hi Henry,
    You're suffering from an issue that I wanted to solve... I think
that we should be checking in autoconf'ed files (not _pre-configure'd_
files), but others object with my point of view.
    You can do it without autoconf, but the problem is that you'll
have to do a lot of hand-editing to make things work properly. Do you
want me to send you the autoconf'ed files?
HTH,
-Garrett

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [LTP] [PATCH][openfile] file descriptors not cleaned up
  2009-10-14  2:25           ` Henry Yei
  2009-10-14  2:30             ` Garrett Cooper
@ 2009-10-14 20:28             ` Subrata Modak
  1 sibling, 0 replies; 12+ messages in thread
From: Subrata Modak @ 2009-10-14 20:28 UTC (permalink / raw)
  To: Henry Yei; +Cc: jpalecek, LTP Mailing List

Thanks Henry.

Regards--
Subrata

On Tue, 2009-10-13 at 19:25 -0700, Henry Yei wrote: 
> All,
> 
> Here is the openfile patch without the Makefile changes as they are not needed with the new Makefile changes.
> I regenerated and tested the patch with the latest version of the ltp from CVS.
> 
> I had trouble compiling LTP without autoconf 2.61 even after following instructions from the README.mk-users file to try to build without autoconf. Most of our test hosts are running autoconf 2.59. Does anyone have updated instructions?
> 
> 
> -----Original Message-----
> From: Garrett Cooper [mailto:yanegomi@gmail.com] 
> Sent: Tuesday, October 13, 2009 12:22 PM
> To: subrata@linux.vnet.ibm.com
> Cc: Henry Yei; jpalecek@web.de; LTP Mailing List
> Subject: Re: [LTP] [PATCH][openfile] file descriptors not cleaned up
> 
> On Tue, Oct 13, 2009 at 12:20 PM, Garrett Cooper <yanegomi@gmail.com> wrote:
> > On Tue, Oct 13, 2009 at 7:43 AM, Subrata Modak
> > <subrata@linux.vnet.ibm.com> wrote:
> >> On Mon, 2009-10-05 at 14:33 -0700, Henry Yei wrote:
> >>> On Wednesday 04, October 2009 04:06:46 Jiri Palecek wrote:
> >>>
> >>> Hello,
> >>>
> >>> On Wednesday 30 September 2009 04:06:46 Henry Yei wrote:
> >>> > This patch for openfile contains the following changes:
> >>> > - test output to use tst_resm functions
> >>> > - sets ups and cleans up tmp dir properly
> >>> > - closes all opened file descriptors before thread exit(fixes nfs issues on removing tmp dir)
> >>> >
> >>> > Signed-off-by: Henry Yei <hyei@mvista.com>
> >>> >
> >>> >
> >>> > This test opens multiple file descriptors to the same file. Perhaps the author meant to open file handles for separate files?
> >>>
> >>> This is suspicious, for me too. But maybe there is some logic behind opening the same file many times.
> >>>
> >>> I just have a small remark about your patch: Shouldn't you call close_files() here, too? (With a partially full fd_list array handled, of course)
> >>>
> >>> +void * threads(void* thread_id_) {
> >>> +     int thread_id = (uintptr_t) thread_id_;
> >>> +     char errmsg[80];
> >>> +     FILE *fd_list[MAXFILES];
> >>> +     int i;
> >>> +
> >>> +     /* Open files */
> >>> +     for (i = 0; i < numfiles; i++) {
> >>> +             if (debug)
> >>> +                     printf("Thread  %d : Opening file number %d \n", thread_id, i);
> >>> +             if ((fd_list[i] = fopen(filename, "rw")) == NULL) {
> >>> +                     sprintf(errmsg, "FAIL - Couldn't open file #%d", i);
> >>> +                     perror(errmsg);
> >>>
> >>>
> >>>
> >>> Jiri,
> >>>
> >>> Thanks for reviewing the patch. Yes, that was an omission on my part. I have attached an updated patch. Let me know if there are any more comments.
> >>>
> >>
> >> Henry,
> >>
> >> This patch is ineffective on the present Makefile(s). Please rebase them
> >> over latest CVS and resend:
> >>
> >> patching file testcases/kernel/fs/openfile/Makefile
> >> Hunk #1 FAILED at 1.
> >> 1 out of 1 hunk FAILED -- saving rejects to file
> >> testcases/kernel/fs/openfile/Makefile.rej
> >> patching file testcases/kernel/fs/openfile/openfile.c
> >
> >    I'll gladly help if help is needed. Feel free to ping me and we
> > can setup a rendezvous on IRC or something.
> 
>     I looked at the diff again and if you just omit the Makefile
> change then the rest should go through.
> HTH,
> -Garrett


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [LTP] autoconf files
       [not found]               ` <8368651DACC1964480F951191B94A0780153D6A2@svexch01.mvista.com>
@ 2009-10-15 22:03                 ` Garrett Cooper
  0 siblings, 0 replies; 12+ messages in thread
From: Garrett Cooper @ 2009-10-15 22:03 UTC (permalink / raw)
  To: Henry Yei; +Cc: LTP list

[-- Attachment #1: Type: text/plain, Size: 4223 bytes --]

On Thu, Oct 15, 2009 at 2:23 PM, Henry Yei <hyei@mvista.com> wrote:
>> -----Original Message-----
>> From: Garrett Cooper [mailto:yanegomi@gmail.com]
>> Sent: Tuesday, October 13, 2009 7:31 PM
>> To: Henry Yei
>> Cc: subrata@linux.vnet.ibm.com; jpalecek@web.de; LTP Mailing List
>> Subject: Re: [LTP] [PATCH][openfile] file descriptors not cleaned up
>>
>> On Tue, Oct 13, 2009 at 7:25 PM, Henry Yei <hyei@mvista.com> wrote:
>> > All,
>> >
>> > Here is the openfile patch without the Makefile changes as they are
>> not needed with the new Makefile changes.
>> > I regenerated and tested the patch with the latest version of the ltp
>> from CVS.
>> >
>> > I had trouble compiling LTP without autoconf 2.61 even after
>> following instructions from the README.mk-users file to try to build
>> without autoconf. Most of our test hosts are running autoconf 2.59.
>> Does anyone have updated instructions?
>> >
>> >
>> > -----Original Message-----
>> > From: Garrett Cooper [mailto:yanegomi@gmail.com]
>> > Sent: Tuesday, October 13, 2009 12:22 PM
>> > To: subrata@linux.vnet.ibm.com
>> > Cc: Henry Yei; jpalecek@web.de; LTP Mailing List
>> > Subject: Re: [LTP] [PATCH][openfile] file descriptors not cleaned up
>> >
>> > On Tue, Oct 13, 2009 at 12:20 PM, Garrett Cooper <yanegomi@gmail.com>
>> wrote:
>> >> On Tue, Oct 13, 2009 at 7:43 AM, Subrata Modak
>> >> <subrata@linux.vnet.ibm.com> wrote:
>> >>> On Mon, 2009-10-05 at 14:33 -0700, Henry Yei wrote:
>> >>>> On Wednesday 04, October 2009 04:06:46 Jiri Palecek wrote:
>> >>>>
>> >>>> Hello,
>> >>>>
>> >>>> On Wednesday 30 September 2009 04:06:46 Henry Yei wrote:
>> >>>> > This patch for openfile contains the following changes:
>> >>>> > - test output to use tst_resm functions
>> >>>> > - sets ups and cleans up tmp dir properly
>> >>>> > - closes all opened file descriptors before thread exit(fixes
>> nfs issues on removing tmp dir)
>> >>>> >
>> >>>> > Signed-off-by: Henry Yei <hyei@mvista.com>
>> >>>> >
>> >>>> >
>> >>>> > This test opens multiple file descriptors to the same file.
>> Perhaps the author meant to open file handles for separate files?
>> >>>>
>> >>>> This is suspicious, for me too. But maybe there is some logic
>> behind opening the same file many times.
>> >>>>
>> >>>> I just have a small remark about your patch: Shouldn't you call
>> close_files() here, too? (With a partially full fd_list array handled,
>> of course)
>> >>>>
>> >>>> +void * threads(void* thread_id_) {
>> >>>> +     int thread_id = (uintptr_t) thread_id_;
>> >>>> +     char errmsg[80];
>> >>>> +     FILE *fd_list[MAXFILES];
>> >>>> +     int i;
>> >>>> +
>> >>>> +     /* Open files */
>> >>>> +     for (i = 0; i < numfiles; i++) {
>> >>>> +             if (debug)
>> >>>> +                     printf("Thread  %d : Opening file number %d
>> \n", thread_id, i);
>> >>>> +             if ((fd_list[i] = fopen(filename, "rw")) == NULL) {
>> >>>> +                     sprintf(errmsg, "FAIL - Couldn't open file
>> #%d", i);
>> >>>> +                     perror(errmsg);
>> >>>>
>> >>>>
>> >>>>
>> >>>> Jiri,
>> >>>>
>> >>>> Thanks for reviewing the patch. Yes, that was an omission on my
>> part. I have attached an updated patch. Let me know if there are any
>> more comments.
>>
>> Hi Henry,
>>     You're suffering from an issue that I wanted to solve... I think
>> that we should be checking in autoconf'ed files (not _pre-configure'd_
>> files), but others object with my point of view.
>>     You can do it without autoconf, but the problem is that you'll
>> have to do a lot of hand-editing to make things work properly. Do you
>> want me to send you the autoconf'ed files?
>> HTH,
>> -Garrett
>
> Garrett,
>
> I'd like to take you up on the offer for those autoconf files. I usually work off a released tarball from LTP and update the test from CVS as needed, but with these Makefile changes, working off all the latest code will be easier.

Henry,
    Here's the tarball for this month's version. The only thing that
will change between releases (unless an m4 file is added, removed or
changed, or configure.ac changes) is m4/ltp-version.m4.
Cheers!
-Garrett

[-- Attachment #2: autotools-files.tbz2 --]
[-- Type: application/octet-stream, Size: 69961 bytes --]

[-- Attachment #3: Type: text/plain, Size: 399 bytes --]

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2009-10-15 22:04 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-30  2:06 [LTP] [PATCH][openfile] file descriptors not cleaned up Henry Yei
2009-10-04 22:18 ` Jiri Palecek
2009-10-05  2:51   ` [LTP] GPL License in CrackerJack hisashi.hashimoto.wh
2009-10-13 14:43     ` Subrata Modak
2009-10-05 21:33   ` [LTP] [PATCH][openfile] file descriptors not cleaned up Henry Yei
2009-10-13 14:43     ` Subrata Modak
2009-10-13 19:20       ` Garrett Cooper
2009-10-13 19:21         ` Garrett Cooper
2009-10-14  2:25           ` Henry Yei
2009-10-14  2:30             ` Garrett Cooper
     [not found]               ` <8368651DACC1964480F951191B94A0780153D6A2@svexch01.mvista.com>
2009-10-15 22:03                 ` [LTP] autoconf files Garrett Cooper
2009-10-14 20:28             ` [LTP] [PATCH][openfile] file descriptors not cleaned up Subrata Modak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.