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);
 }
 
-
