Applied cleanup patch from Saji Kumar <saji.kumar@wipro.com>.
I removed additional warnings created when -Wall option used.
I also fixed Makefiles to correctly locate the libraries and header files necessary for compilation.
diff --git a/testcases/kernel/syscalls/ipc/lib/Makefile b/testcases/kernel/syscalls/ipc/lib/Makefile
index b27d2e9..4fda42b 100644
--- a/testcases/kernel/syscalls/ipc/lib/Makefile
+++ b/testcases/kernel/syscalls/ipc/lib/Makefile
@@ -24,7 +24,7 @@
 SRCS=libipc.c
 OBJS=$(SRCS:.c=.o)
 MAINS=../libipc.a
-LTP_CFLAGS=-I../../../../../include -g
+LTP_CFLAGS=-I../../../../../include -g -Wall
 
 all: ../libipc.a
 
diff --git a/testcases/kernel/syscalls/ipc/lib/ipcmsg.h b/testcases/kernel/syscalls/ipc/lib/ipcmsg.h
index ad1fc1d..bb928db 100644
--- a/testcases/kernel/syscalls/ipc/lib/ipcmsg.h
+++ b/testcases/kernel/syscalls/ipc/lib/ipcmsg.h
@@ -48,4 +48,11 @@
 
 key_t msgkey;                   /* the ftok() generated message key */
 
+void check_root();
+void init_buf(MSGBUF *, int, int);
+void rm_queue(int);
+
+int getipckey();
+int getuserid(char *);
+
 #endif /* ipcmsg.h */
diff --git a/testcases/kernel/syscalls/ipc/lib/ipcsem.h b/testcases/kernel/syscalls/ipc/lib/ipcsem.h
index 3087bb0..63baf5f 100644
--- a/testcases/kernel/syscalls/ipc/lib/ipcsem.h
+++ b/testcases/kernel/syscalls/ipc/lib/ipcsem.h
@@ -28,6 +28,7 @@
 #include <sys/ipc.h>
 #include <sys/sem.h>
 
+
 #include "test.h"
 #include "usctest.h"
 
@@ -50,4 +51,10 @@
 	struct seminfo *ipc_buf;	/* buffer for IPC_INFO */
 };
 
+void rm_sema(int sem_id);
+void check_root();
+
+int getipckey();
+int getuserid(char *);
+
 #endif /* ipcsem.h */
diff --git a/testcases/kernel/syscalls/ipc/lib/ipcshm.h b/testcases/kernel/syscalls/ipc/lib/ipcshm.h
index 892b761..36ba876 100644
--- a/testcases/kernel/syscalls/ipc/lib/ipcshm.h
+++ b/testcases/kernel/syscalls/ipc/lib/ipcshm.h
@@ -46,5 +46,10 @@
 
 key_t shmkey;			/* an IPC key generated by ftok() */
 
+void rm_shm(int shm_id);
+void check_root();
+
+int getipckey();
+int getuserid(char*);
 
 #endif /* ipcshm.h */
diff --git a/testcases/kernel/syscalls/ipc/lib/libipc.c b/testcases/kernel/syscalls/ipc/lib/libipc.c
index 5664a73..2a462a4 100644
--- a/testcases/kernel/syscalls/ipc/lib/libipc.c
+++ b/testcases/kernel/syscalls/ipc/lib/libipc.c
@@ -40,6 +40,9 @@
 
 #include <pwd.h>
 #include <sys/timeb.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+
 
 /*
  * getipckey() - generates and returns a message key used by the "get"
@@ -191,7 +194,7 @@
 	 * check for # of attaches ? 
 	 */
 
-	if (shmctl(shm_id, 0, IPC_RMID, NULL) == -1) {
+	if (shmctl(shm_id, IPC_RMID, NULL) == -1) {
 		tst_resm(TINFO, "WARNING: shared memory deletion failed.");
 		tst_resm(TINFO, "This could lead to IPC resource problems.");
 		tst_resm(TINFO, "id = %d\n", shm_id);
diff --git a/testcases/kernel/syscalls/ipc/msgctl/Makefile b/testcases/kernel/syscalls/ipc/msgctl/Makefile
index 651c291..32e7cac 100644
--- a/testcases/kernel/syscalls/ipc/msgctl/Makefile
+++ b/testcases/kernel/syscalls/ipc/msgctl/Makefile
@@ -24,7 +24,8 @@
 SRCS=$(MAINS:=.c)
 OBJS=$(MAINS:=.o)
 IPC_LDFLAGS=-L.. -lipc
-LTP_CFLAGS=-I../../../../../include -g
+LTP_LDFLAGS=-L../../../../../lib -lltp
+LTP_CFLAGS=-I../lib -I../../../../../include -g -Wall
 
 all: $& $(MAINS)
 
diff --git a/testcases/kernel/syscalls/ipc/msgctl/msgctl01.c b/testcases/kernel/syscalls/ipc/msgctl/msgctl01.c
index acdd172..eb1c302 100644
--- a/testcases/kernel/syscalls/ipc/msgctl/msgctl01.c
+++ b/testcases/kernel/syscalls/ipc/msgctl/msgctl01.c
@@ -59,7 +59,7 @@
 #include "test.h"
 #include "usctest.h"
 
-#include "../lib/ipcmsg.h"
+#include "ipcmsg.h"
 
 char *TCID = "msgctl01";
 int TST_TOTAL = 1;
@@ -69,7 +69,7 @@
 
 struct msqid_ds qs_buf;
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
@@ -120,6 +120,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/msgctl/msgctl02.c b/testcases/kernel/syscalls/ipc/msgctl/msgctl02.c
index cc62465..32e03f8 100644
--- a/testcases/kernel/syscalls/ipc/msgctl/msgctl02.c
+++ b/testcases/kernel/syscalls/ipc/msgctl/msgctl02.c
@@ -59,7 +59,7 @@
 #include "test.h"
 #include "usctest.h"
 
-#include "../lib/ipcmsg.h"
+#include "ipcmsg.h"
 
 char *TCID = "msgctl02";
 int TST_TOTAL = 1;
@@ -71,7 +71,7 @@
 
 unsigned short new_bytes;
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
@@ -134,6 +134,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/msgctl/msgctl03.c b/testcases/kernel/syscalls/ipc/msgctl/msgctl03.c
index 8146184..3027b9c 100644
--- a/testcases/kernel/syscalls/ipc/msgctl/msgctl03.c
+++ b/testcases/kernel/syscalls/ipc/msgctl/msgctl03.c
@@ -58,7 +58,7 @@
 #include "test.h"
 #include "usctest.h"
 
-#include "../lib/ipcmsg.h"
+#include "ipcmsg.h"
 
 char *TCID = "msgctl03";
 int TST_TOTAL = 1;
@@ -68,7 +68,7 @@
 
 struct msqid_ds qs_buf;
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	char *msg;			/* message returned from parse_opts */
 
@@ -113,6 +113,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/msgctl/msgctl04.c b/testcases/kernel/syscalls/ipc/msgctl/msgctl04.c
index 8c9397b..e44a9e1 100644
--- a/testcases/kernel/syscalls/ipc/msgctl/msgctl04.c
+++ b/testcases/kernel/syscalls/ipc/msgctl/msgctl04.c
@@ -56,7 +56,7 @@
 #include "test.h"
 #include "usctest.h"
 
-#include "../lib/ipcmsg.h"
+#include "ipcmsg.h"
 
 char *TCID = "msgctl04";
 int TST_TOTAL = 6;
@@ -98,11 +98,11 @@
         {&bad_q, IPC_SET, &q_buf, EINVAL}
 };
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
-	int i, rval;
+	int i;
 
 	/* parse standard options */
 	if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
@@ -148,6 +148,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/msgctl/msgctl05.c b/testcases/kernel/syscalls/ipc/msgctl/msgctl05.c
index ba280a7..8e5d6ed 100644
--- a/testcases/kernel/syscalls/ipc/msgctl/msgctl05.c
+++ b/testcases/kernel/syscalls/ipc/msgctl/msgctl05.c
@@ -53,13 +53,15 @@
  *	There must be a nobody ID installed on the system.
  */
 
+#include <string.h>
+#include <pwd.h>
+#include <sys/wait.h>
+
 #include "test.h"
 #include "usctest.h"
 
-#include <string.h>
-#include <pwd.h>
 
-#include "../lib/ipcmsg.h"
+#include "ipcmsg.h"
 
 char *TCID = "msgctl05";
 int TST_TOTAL = 1;
@@ -73,7 +75,7 @@
 
 struct msqid_ds q_buf;
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	char *msg;			/* message returned from parse_opts */
 	pid_t pid;
@@ -113,7 +115,8 @@
 	}
 
 	cleanup ();
-
+        /**NOT REACHED**/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/msgget/Makefile b/testcases/kernel/syscalls/ipc/msgget/Makefile
index 5a3f551..5598b69 100644
--- a/testcases/kernel/syscalls/ipc/msgget/Makefile
+++ b/testcases/kernel/syscalls/ipc/msgget/Makefile
@@ -24,7 +24,8 @@
 SRCS=$(MAINS:=.c)
 OBJS=$(MAINS:=.o)
 IPC_LDFLAGS=-L.. -lipc
-LTP_CFLAGS=-I../../../../../include -g
+LTP_LDFLAGS=-L../../../../../lib -lltp
+LTP_CFLAGS=-I../lib -I../../../../../include -g -Wall
 
 all: $& $(MAINS)
 
diff --git a/testcases/kernel/syscalls/ipc/msgget/msgget01.c b/testcases/kernel/syscalls/ipc/msgget/msgget01.c
index 3ad9476..e8ca995 100644
--- a/testcases/kernel/syscalls/ipc/msgget/msgget01.c
+++ b/testcases/kernel/syscalls/ipc/msgget/msgget01.c
@@ -55,7 +55,7 @@
  *	none
  */
 
-#include "../lib/ipcmsg.h"
+#include "ipcmsg.h"
 
 #include <string.h>
 
@@ -65,7 +65,7 @@
 
 int msg_q_1 = -1;		/* to hold the message queue ID */
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
@@ -120,6 +120,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/msgget/msgget02.c b/testcases/kernel/syscalls/ipc/msgget/msgget02.c
index 7468c11..a7040f6 100644
--- a/testcases/kernel/syscalls/ipc/msgget/msgget02.c
+++ b/testcases/kernel/syscalls/ipc/msgget/msgget02.c
@@ -55,7 +55,7 @@
 #include "test.h"
 #include "usctest.h"
 
-#include "../lib/ipcmsg.h"
+#include "ipcmsg.h"
 
 char *TCID = "msgget02";
 int TST_TOTAL = 3;
@@ -75,11 +75,11 @@
 
 int msg_q_1 = -1;		/* The message queue id created in setup */
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
-	int i, rval;
+	int i;
 
 	/* parse standard options */
 	if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
@@ -131,6 +131,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/msgget/msgget03.c b/testcases/kernel/syscalls/ipc/msgget/msgget03.c
index c11a28a..eea514d 100644
--- a/testcases/kernel/syscalls/ipc/msgget/msgget03.c
+++ b/testcases/kernel/syscalls/ipc/msgget/msgget03.c
@@ -55,7 +55,7 @@
 #include "test.h"
 #include "usctest.h"
 
-#include "../lib/ipcmsg.h"
+#include "ipcmsg.h"
 
 char *TCID = "msgget03";
 int TST_TOTAL = 1;
@@ -75,7 +75,7 @@
 int msg_q_arr[MAXMSGS];		/* hold the id's that we create */
 int num_queue = 0;		/* count the queues created */
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
@@ -123,6 +123,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/msgget/msgget04.c b/testcases/kernel/syscalls/ipc/msgget/msgget04.c
index 81fede6..b3d6b4a 100644
--- a/testcases/kernel/syscalls/ipc/msgget/msgget04.c
+++ b/testcases/kernel/syscalls/ipc/msgget/msgget04.c
@@ -56,7 +56,7 @@
 #include "test.h"
 #include "usctest.h"
 
-#include "../lib/ipcmsg.h"
+#include "ipcmsg.h"
 
 char *TCID = "msgget04";
 int TST_TOTAL = 3;
@@ -72,7 +72,7 @@
 
 int test_flags[] = {MSG_RD, MSG_WR, MSG_RD | MSG_WR};
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;			/* loop counter */
 	char *msg;		/* message returned from parse_opts */
@@ -127,6 +127,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/msgrcv/Makefile b/testcases/kernel/syscalls/ipc/msgrcv/Makefile
index 1000a27..75e99b1 100644
--- a/testcases/kernel/syscalls/ipc/msgrcv/Makefile
+++ b/testcases/kernel/syscalls/ipc/msgrcv/Makefile
@@ -24,7 +24,8 @@
 SRCS=$(MAINS:=.c)
 OBJS=$(MAINS:=.o)
 IPC_LDFLAGS=-L.. -lipc
-LTP_CFLAGS=-I../../../../../include -g
+LTP_LDFLAGS=-L../../../../../lib -lltp
+LTP_CFLAGS=-I../lib -I../../../../../include -g -Wall
 
 all: $& $(MAINS)
 
diff --git a/testcases/kernel/syscalls/ipc/msgrcv/msgrcv01.c b/testcases/kernel/syscalls/ipc/msgrcv/msgrcv01.c
index 2443e1a..1dfaaed 100644
--- a/testcases/kernel/syscalls/ipc/msgrcv/msgrcv01.c
+++ b/testcases/kernel/syscalls/ipc/msgrcv/msgrcv01.c
@@ -58,11 +58,12 @@
  */
 
 #include <string.h>
+#include <sys/wait.h>
 
 #include "test.h"
 #include "usctest.h"
 
-#include "../lib/ipcmsg.h"
+#include "ipcmsg.h"
 
 void cleanup(void);
 void setup(void);
@@ -76,7 +77,7 @@
 
 pid_t c_pid;
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
     int lc;			/* loop counter */
     char *msg;			/* message returned from parse_opts */
@@ -151,6 +152,9 @@
 
     cleanup();
 
+    /** NOT REACHED **/
+    return(0);
+
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/msgrcv/msgrcv02.c b/testcases/kernel/syscalls/ipc/msgrcv/msgrcv02.c
index 5bffc98..c5cbdc3 100644
--- a/testcases/kernel/syscalls/ipc/msgrcv/msgrcv02.c
+++ b/testcases/kernel/syscalls/ipc/msgrcv/msgrcv02.c
@@ -58,7 +58,7 @@
 #include "test.h"
 #include "usctest.h"
 
-#include "../lib/ipcmsg.h"
+#include "ipcmsg.h"
 
 void cleanup(void);
 void setup(void);
@@ -88,7 +88,7 @@
 	{&msg_q_1, (MSGBUF *)-1, EFAULT}
 };
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
@@ -138,6 +138,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/msgrcv/msgrcv03.c b/testcases/kernel/syscalls/ipc/msgrcv/msgrcv03.c
index e519f1e..b069b27 100644
--- a/testcases/kernel/syscalls/ipc/msgrcv/msgrcv03.c
+++ b/testcases/kernel/syscalls/ipc/msgrcv/msgrcv03.c
@@ -53,7 +53,7 @@
 #include "test.h"
 #include "usctest.h"
 
-#include "../lib/ipcmsg.h"
+#include "ipcmsg.h"
 
 void cleanup(void);
 void setup(void);
@@ -80,7 +80,7 @@
 	{&msg_q_1, -1, EINVAL}
 };
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
@@ -130,6 +130,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/msgrcv/msgrcv04.c b/testcases/kernel/syscalls/ipc/msgrcv/msgrcv04.c
index 68feb4d..ce71e5f 100644
--- a/testcases/kernel/syscalls/ipc/msgrcv/msgrcv04.c
+++ b/testcases/kernel/syscalls/ipc/msgrcv/msgrcv04.c
@@ -55,7 +55,7 @@
 #include "test.h"
 #include "usctest.h"
 
-#include "../lib/ipcmsg.h"
+#include "ipcmsg.h"
 
 void cleanup(void);
 void setup(void);
@@ -91,7 +91,7 @@
 	{MSGSIZE, 2, IPC_NOWAIT, ENOMSG}
 };
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
@@ -141,6 +141,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/msgrcv/msgrcv05.c b/testcases/kernel/syscalls/ipc/msgrcv/msgrcv05.c
index 5a87483..4d7fb56 100644
--- a/testcases/kernel/syscalls/ipc/msgrcv/msgrcv05.c
+++ b/testcases/kernel/syscalls/ipc/msgrcv/msgrcv05.c
@@ -54,7 +54,7 @@
 #include "test.h"
 #include "usctest.h"
 
-#include "../lib/ipcmsg.h"
+#include "ipcmsg.h"
 
 void cleanup(void);
 void setup(void);
@@ -71,11 +71,10 @@
 MSGBUF rcv_buf;
 pid_t c_pid;
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
-	int i;
 
 	/* parse standard options */
 	if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
@@ -141,6 +140,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/msgrcv/msgrcv06.c b/testcases/kernel/syscalls/ipc/msgrcv/msgrcv06.c
index e2a97b2..5f34c0e 100644
--- a/testcases/kernel/syscalls/ipc/msgrcv/msgrcv06.c
+++ b/testcases/kernel/syscalls/ipc/msgrcv/msgrcv06.c
@@ -54,7 +54,7 @@
 #include "test.h"
 #include "usctest.h"
 
-#include "../lib/ipcmsg.h"
+#include "ipcmsg.h"
 
 void cleanup(void);
 void setup(void);
@@ -71,11 +71,10 @@
 MSGBUF rcv_buf;
 pid_t c_pid;
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
-	int i;
 
 	/* parse standard options */
 	if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
@@ -154,6 +153,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/msgsnd/Makefile b/testcases/kernel/syscalls/ipc/msgsnd/Makefile
index 06d977e..1a3138b 100644
--- a/testcases/kernel/syscalls/ipc/msgsnd/Makefile
+++ b/testcases/kernel/syscalls/ipc/msgsnd/Makefile
@@ -24,7 +24,8 @@
 SRCS=$(MAINS:=.c)
 OBJS=$(MAINS:=.o)
 IPC_LDFLAGS=-L.. -lipc
-LTP_CFLAGS=-I../../../../../include -g
+LTP_CFLAGS=-I../lib -I../../../../../include -g -Wall
+LTP_LDFLAGS=-L../../../../../lib -lltp
 
 all: $& $(MAINS)
 
diff --git a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd01.c b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd01.c
index 0725aaf..368ea37 100644
--- a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd01.c
+++ b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd01.c
@@ -60,7 +60,7 @@
 #include "test.h"
 #include "usctest.h"
 
-#include "../lib/ipcmsg.h"
+#include "ipcmsg.h"
 
 void cleanup(void);
 void setup(void);
@@ -74,7 +74,7 @@
 
 struct msqid_ds qs_buf;
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
@@ -137,6 +137,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd02.c b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd02.c
index 3878942..24af375 100644
--- a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd02.c
+++ b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd02.c
@@ -54,7 +54,7 @@
 #include "test.h"
 #include "usctest.h"
 
-#include "../lib/ipcmsg.h"
+#include "ipcmsg.h"
 
 void cleanup(void);
 void setup(void);
@@ -84,7 +84,7 @@
 	{&msg_q_1, NULL, EFAULT},
 };
 	
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
@@ -131,6 +131,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd03.c b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd03.c
index a456597..821492c 100644
--- a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd03.c
+++ b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd03.c
@@ -54,7 +54,7 @@
 #include "test.h"
 #include "usctest.h"
 
-#include "../lib/ipcmsg.h"
+#include "ipcmsg.h"
 
 void cleanup(void);
 void setup(void);
@@ -90,7 +90,7 @@
 	{&msg_q_1, &msg_buf, 1, -1, EINVAL}
 };
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
@@ -143,6 +143,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd04.c b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd04.c
index b842e6b..5c2d3b9 100644
--- a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd04.c
+++ b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd04.c
@@ -55,7 +55,7 @@
 #include "test.h"
 #include "usctest.h"
 
-#include "../lib/ipcmsg.h"
+#include "ipcmsg.h"
 
 void cleanup(void);
 void setup(void);
@@ -69,7 +69,7 @@
 int msg_q_1 = -1;		/* The message queue id created in setup */
 MSGBUF msg_buf;
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
@@ -116,6 +116,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd05.c b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd05.c
index c64f086..c1bb7ea 100644
--- a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd05.c
+++ b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd05.c
@@ -58,7 +58,7 @@
 #include "test.h"
 #include "usctest.h"
 
-#include "../lib/ipcmsg.h"
+#include "ipcmsg.h"
 
 void cleanup(void);
 void setup(void);
@@ -73,11 +73,11 @@
 int msg_q_1 = -1;		/* The message queue id created in setup */
 MSGBUF msg_buf;
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
-	pid_t c_pid, p_pid;
+	pid_t c_pid;
 
 	/* parse standard options */
 	if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
@@ -142,6 +142,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd06.c b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd06.c
index 0e7ff0b..a9bd144 100644
--- a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd06.c
+++ b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd06.c
@@ -55,10 +55,11 @@
  *	none
  */
 
+#include <sys/wait.h> 
 #include "test.h"
 #include "usctest.h"
 
-#include "../lib/ipcmsg.h"
+#include "ipcmsg.h"
 
 void cleanup(void);
 void setup(void);
@@ -72,11 +73,11 @@
 int msg_q_1 = -1;		/* The message queue id created in setup */
 MSGBUF msg_buf;
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
     int lc;			/* loop counter */
     char *msg;			/* message returned from parse_opts */
-    pid_t c_pid, p_pid;
+    pid_t c_pid;
     int retval = 0, status, e_code;
 
     /* parse standard options */
@@ -165,7 +166,9 @@
 
     cleanup();
 
- /*NOTREACHED*/}
+ /*NOTREACHED*/
+ return(0);
+}
 
 /*
  * setup() - performs all the ONE TIME setup for this test.
diff --git a/testcases/kernel/syscalls/ipc/semctl/Makefile b/testcases/kernel/syscalls/ipc/semctl/Makefile
index 933cca0..2ed39d4 100644
--- a/testcases/kernel/syscalls/ipc/semctl/Makefile
+++ b/testcases/kernel/syscalls/ipc/semctl/Makefile
@@ -24,6 +24,8 @@
 SRCS=$(MAINS:=.c)
 OBJS=$(MAINS:=.o)
 IPC_LDFLAGS=-L.. -lipc
+LTP_CFLAGS=-I../lib -I../../../../../include -Wall -g
+LTP_LDFLAGS=-L../../../../../lib -lltp
 
 all: $& $(MAINS)
 
diff --git a/testcases/kernel/syscalls/ipc/semctl/semctl01.c b/testcases/kernel/syscalls/ipc/semctl/semctl01.c
index cf056d3..724956e 100644
--- a/testcases/kernel/syscalls/ipc/semctl/semctl01.c
+++ b/testcases/kernel/syscalls/ipc/semctl/semctl01.c
@@ -57,7 +57,7 @@
  *	none
  */
 
-#include "../lib/ipcsem.h"
+#include "ipcsem.h"
 
 char *TCID = "semctl01";
 int TST_TOTAL = 10;
@@ -120,7 +120,7 @@
 	{0, IPC_RMID, func_rmid, (union semun)&buf, NULL}
 };
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
@@ -229,6 +229,8 @@
 	cleanup();
 
 	/*NOTREACHED*/
+        return(0);
+
 }
 
 /*
@@ -238,7 +240,7 @@
 func_stat()
 {
 	/* check the number of semaphores and the ipc_perm.mode value */
-	if (buf.sem_nsems == PSEMS && buf.sem_perm.mode == SEM_RA) {
+	if (buf.sem_nsems == PSEMS && buf.sem_perm.mode == (SEM_RA)) {
 		tst_resm(TPASS, "buf.sem_nsems and buf.sem_perm.mode"
 				" are correct");
 	} else {
@@ -269,7 +271,7 @@
 	}
 
 	/* check that the new mode is what we set */
-	if (buf.sem_perm.mode == SEM_RA | NEWMODE) {
+	if (buf.sem_perm.mode == (SEM_RA | NEWMODE)) {
 		tst_resm(TPASS, "buf.sem_perm.mode is correct");
 	} else {
 		tst_resm(TFAIL, "semaphore mode info is incorrect");
@@ -353,7 +355,6 @@
 void
 func_cnt(int rval)
 {
-	int i;
 
 	if (rval == NCHILD) {
 		tst_resm(TPASS, "number of sleeping processes is correct");
diff --git a/testcases/kernel/syscalls/ipc/semctl/semctl02.c b/testcases/kernel/syscalls/ipc/semctl/semctl02.c
index e165aa3..39baf26 100644
--- a/testcases/kernel/syscalls/ipc/semctl/semctl02.c
+++ b/testcases/kernel/syscalls/ipc/semctl/semctl02.c
@@ -50,7 +50,7 @@
  *	none
  */
 
-#include "../lib/ipcsem.h"
+#include "ipcsem.h"
 #include <pwd.h>
 
 char *TCID = "semctl02";
@@ -64,13 +64,12 @@
 
 int sem_id_1 = -1;
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
 
 	struct semid_ds sem_ds;
-	struct ipc_perm *ipcp = &sem_ds.sem_perm;
 	union semun un_arg;
 
 	/* parse standard options */
@@ -116,6 +115,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+        return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/semctl/semctl03.c b/testcases/kernel/syscalls/ipc/semctl/semctl03.c
index d399fe8..a6107fe 100644
--- a/testcases/kernel/syscalls/ipc/semctl/semctl03.c
+++ b/testcases/kernel/syscalls/ipc/semctl/semctl03.c
@@ -50,7 +50,7 @@
  *	none
  */
 
-#include "../lib/ipcsem.h"
+#include "ipcsem.h"
 
 char *TCID = "semctl03";
 int TST_TOTAL = 4;
@@ -83,7 +83,7 @@
 	{&sem_id_1, IPC_SET, (union semun)-1, EFAULT}
 };
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
@@ -128,6 +128,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/semctl/semctl04.c b/testcases/kernel/syscalls/ipc/semctl/semctl04.c
index 43bed03..149502e 100644
--- a/testcases/kernel/syscalls/ipc/semctl/semctl04.c
+++ b/testcases/kernel/syscalls/ipc/semctl/semctl04.c
@@ -57,9 +57,10 @@
  *	test must be run as root
  */
 
-#include "../lib/ipcsem.h"
+#include "ipcsem.h"
 
 #include <pwd.h>
+#include <sys/wait.h>
 
 char *TCID = "semctl04";
 int TST_TOTAL = 2;
@@ -74,7 +75,7 @@
 
 int TC[] = {IPC_SET, IPC_RMID};
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	char *msg;			/* message returned from parse_opts */
 	pid_t pid;
@@ -115,6 +116,7 @@
 	}
 	cleanup();
 
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/semctl/semctl05.c b/testcases/kernel/syscalls/ipc/semctl/semctl05.c
index 8344e69..e416596 100644
--- a/testcases/kernel/syscalls/ipc/semctl/semctl05.c
+++ b/testcases/kernel/syscalls/ipc/semctl/semctl05.c
@@ -50,7 +50,7 @@
  *	none
  */
 
-#include "../lib/ipcsem.h"
+#include "ipcsem.h"
 
 char *TCID = "semctl05";
 int TST_TOTAL = 3;
@@ -81,7 +81,7 @@
 	{5, SETVAL, (union semun)BIGV}
 };
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
@@ -130,6 +130,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/semop/Makefile b/testcases/kernel/syscalls/ipc/semop/Makefile
index d2b7bfe..c17cabd 100644
--- a/testcases/kernel/syscalls/ipc/semop/Makefile
+++ b/testcases/kernel/syscalls/ipc/semop/Makefile
@@ -24,7 +24,7 @@
 SRCS=$(MAINS:=.c)
 OBJS=$(MAINS:=.o)
 IPC_LDFLAGS=-L.. -lipc
-LTP_CFLAGS=-I../../../../../include -g
+LTP_CFLAGS=-I../lib -I../../../../../include -g -Wall
 LTP_LDFLAGS=-L../../../../../lib -lltp
 
 all: $& $(MAINS)
diff --git a/testcases/kernel/syscalls/ipc/semop/semop01.c b/testcases/kernel/syscalls/ipc/semop/semop01.c
index eb8f4fd..1574e14 100644
--- a/testcases/kernel/syscalls/ipc/semop/semop01.c
+++ b/testcases/kernel/syscalls/ipc/semop/semop01.c
@@ -61,7 +61,7 @@
  *	none
  */
 
-#include "../lib/ipcsem.h"
+#include "ipcsem.h"
 
 #define NSEMS	4	/* the number of primitive semaphores to test */
 
@@ -75,7 +75,7 @@
 struct sembuf sops[PSEMS];	/* an array of sembuf structures */
 
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
         union semun get_arr;
 	int lc;				/* loop counter */
@@ -151,6 +151,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/semop/semop02.c b/testcases/kernel/syscalls/ipc/semop/semop02.c
index ecb885e..9bf84fd 100644
--- a/testcases/kernel/syscalls/ipc/semop/semop02.c
+++ b/testcases/kernel/syscalls/ipc/semop/semop02.c
@@ -52,7 +52,7 @@
  */
 #include <pwd.h>
 
-#include "../lib/ipcsem.h"
+#include "ipcsem.h"
 
 char *TCID = "semop02";
 int TST_TOTAL = 5;
@@ -67,6 +67,7 @@
 struct passwd *ltpuser;
 
 struct sembuf s_buf[PSEMS];
+
 int badbuf = -1;
 
 #define NSOPS	5		/* a resonable number of operations */
@@ -80,22 +81,22 @@
 	int error;		/* the expected error number */
 } TC[] = {
 	/* E2BIG - the number of operations is too big */
-	{&sem_id_1, &s_buf, BIGOPS, E2BIG},
+	{&sem_id_1, (struct sembuf *)&s_buf, BIGOPS, E2BIG},
 
 	/* EACCES - the semaphore set has no access permission */
-	{&sem_id_2, &s_buf, NSOPS, EACCES},
+	{&sem_id_2, (struct sembuf *)&s_buf, NSOPS, EACCES},
 
 	/* EFAULT - the address for the s_buf value is not accessible */
 	{&sem_id_1, (struct sembuf *)-1, NSOPS, EFAULT},
 
 	/* EINVAL - the number of elments (t_ops) is 0 */
-	{&sem_id_1, &s_buf, 0, EINVAL},
+	{&sem_id_1, (struct sembuf *)&s_buf, 0, EINVAL},
 
 	/* EINVAL - the semaphore set doesn't exist */
-	{&bad_id, &s_buf, NSOPS, EINVAL}
+	{&bad_id, (struct sembuf *)&s_buf, NSOPS, EINVAL}
 };
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
@@ -143,6 +144,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/semop/semop03.c b/testcases/kernel/syscalls/ipc/semop/semop03.c
index cb206c7..47a9845 100644
--- a/testcases/kernel/syscalls/ipc/semop/semop03.c
+++ b/testcases/kernel/syscalls/ipc/semop/semop03.c
@@ -50,7 +50,7 @@
  *	none
  */
 
-#include "../lib/ipcsem.h"
+#include "ipcsem.h"
 
 char *TCID = "semop03";
 int TST_TOTAL = 2;
@@ -64,7 +64,7 @@
 
 int TC[] = {-1, PSEMS + 1};	/* negative and too many "primitive" semas */
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
@@ -124,6 +124,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/semop/semop04.c b/testcases/kernel/syscalls/ipc/semop/semop04.c
index 34d0efd..8a5f3c3 100644
--- a/testcases/kernel/syscalls/ipc/semop/semop04.c
+++ b/testcases/kernel/syscalls/ipc/semop/semop04.c
@@ -50,7 +50,7 @@
  *	none
  */
 
-#include "../lib/ipcsem.h"
+#include "ipcsem.h"
 
 char *TCID = "semop04";
 int TST_TOTAL = 2;
@@ -70,13 +70,13 @@
 	int error;
 } TC[] = {
 	/* EAGAIN sem_op = 0 */
-	{1, 0, IPC_NOWAIT, 2, EAGAIN},
+	{{1}, 0, IPC_NOWAIT, 2, EAGAIN},
 
 	/* EAGAIN sem_op = -1 */
-	{0, -1, IPC_NOWAIT, 2, EAGAIN}
+	{{0}, -1, IPC_NOWAIT, 2, EAGAIN}
 };
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
@@ -138,6 +138,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/semop/semop05.c b/testcases/kernel/syscalls/ipc/semop/semop05.c
index 035d084..aea3951 100644
--- a/testcases/kernel/syscalls/ipc/semop/semop05.c
+++ b/testcases/kernel/syscalls/ipc/semop/semop05.c
@@ -56,7 +56,9 @@
  *	none
  */
 
-#include "../lib/ipcsem.h"
+#include "ipcsem.h"
+#include <sys/types.h>
+#include <sys/wait.h>
 
 void sighandler(int);
 
@@ -78,19 +80,19 @@
 	int error;
 } TC[] = {
 	/* EIRDM sem_op = 0 */
-	{1, 0, 0, 2, EIDRM},
+	{{1}, 0, 0, 2, EIDRM},
 
 	/* EIRDM sem_op = -1 */
-	{0, -1, 0, 3, EIDRM},
+	{{0}, -1, 0, 3, EIDRM},
 
 	/* EINTR sem_op = 0 */
-	{1, 0, 0, 4, EINTR},
+	{{1}, 0, 0, 4, EINTR},
 
 	/* EINTR sem_op = -1 */
-	{0, -1, 0, 5, EINTR}
+	{{0}, -1, 0, 5, EINTR}
 };
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
@@ -172,6 +174,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/shmat/Makefile b/testcases/kernel/syscalls/ipc/shmat/Makefile
index 56befb9..41a13b5 100644
--- a/testcases/kernel/syscalls/ipc/shmat/Makefile
+++ b/testcases/kernel/syscalls/ipc/shmat/Makefile
@@ -23,8 +23,8 @@
 MAINS=shmat01 shmat02 shmat03
 SRCS=$(MAINS:=.c)
 OBJS=$(MAINS:=.o)
-IPC_LDFLAGS=-L.. -lipc
-LTP_CFLAGS=-I../../../../../include -g
+IPC_LDFLAGS=-L.. -lipc  -L../../../../../lib -lltp
+LTP_CFLAGS=-I../lib -I../../../../../include -g
 
 all: $& $(MAINS)
 
diff --git a/testcases/kernel/syscalls/ipc/shmat/shmat01.c b/testcases/kernel/syscalls/ipc/shmat/shmat01.c
index a409981..6106cc0 100644
--- a/testcases/kernel/syscalls/ipc/shmat/shmat01.c
+++ b/testcases/kernel/syscalls/ipc/shmat/shmat01.c
@@ -55,7 +55,7 @@
  *	none
  */
 
-#include "../lib/ipcshm.h"
+#include "ipcshm.h"
 
 char *TCID = "shmat01";
 int TST_TOTAL = 3;
@@ -80,13 +80,13 @@
 	{&shm_id_1, 0, 0},
 
 	/* an attach using non alligned memory */
-	{&shm_id_1, UNALIGNED, SHM_RND},
+	{&shm_id_1, (void *)UNALIGNED, SHM_RND},
 
 	/* a read only attach */
 	{&shm_id_1, 0, SHM_RDONLY}
 };
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
@@ -143,6 +143,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/shmat/shmat02.c b/testcases/kernel/syscalls/ipc/shmat/shmat02.c
index 886de8a..84e47cb 100644
--- a/testcases/kernel/syscalls/ipc/shmat/shmat02.c
+++ b/testcases/kernel/syscalls/ipc/shmat/shmat02.c
@@ -49,7 +49,7 @@
  *	Must be ran as non-root
  */
 
-#include "../lib/ipcshm.h"
+#include "ipcshm.h"
 #include <pwd.h>
 
 char *TCID = "shmat02";
@@ -78,13 +78,13 @@
 	{&shm_id_1, 0, EINVAL},
 
 	/* EINVAL - the address is not page aligned and SHM_RND is not given */
-	{&shm_id_2, NADDR, EINVAL},
+	{&shm_id_2, (void *)NADDR, EINVAL},
 
 	/* EACCES - the shared memory resource has no read/write permission */
 	{&shm_id_3, 0, EACCES}
 };
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
@@ -136,6 +136,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/shmat/shmat03.c b/testcases/kernel/syscalls/ipc/shmat/shmat03.c
index 811783a..034ffda 100644
--- a/testcases/kernel/syscalls/ipc/shmat/shmat03.c
+++ b/testcases/kernel/syscalls/ipc/shmat/shmat03.c
@@ -56,7 +56,7 @@
  *	test must be run at root
  */
 
-#include "../lib/ipcshm.h"
+#include "ipcshm.h"
 
 char *TCID = "shmat03";
 int TST_TOTAL = 1;
@@ -71,7 +71,7 @@
 uid_t ltp_uid;
 char *ltp_user = "nobody";
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	char *msg;			/* message returned from parse_opts */
 	int pid;
@@ -111,6 +111,7 @@
 	}
 
 	cleanup();
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/shmctl/Makefile b/testcases/kernel/syscalls/ipc/shmctl/Makefile
index b6541e5..fd4b19a 100644
--- a/testcases/kernel/syscalls/ipc/shmctl/Makefile
+++ b/testcases/kernel/syscalls/ipc/shmctl/Makefile
@@ -23,8 +23,8 @@
 MAINS=shmctl01 shmctl02 shmctl03 shmctl04
 SRCS=$(MAINS:=.c)
 OBJS=$(MAINS:=.o)
-IPC_LDFLAGS=-L.. -lipc
-LTP_CFLAGS=-I../../../../../include -g
+IPC_LDFLAGS=-L.. -lipc  -L../../../../../lib -lltp
+LTP_CFLAGS=-I ../lib -I../../../../../include -g -Wall
 
 all: $& $(MAINS)
 
diff --git a/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c b/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
index d106cb7..aec814b 100644
--- a/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
+++ b/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
@@ -59,7 +59,7 @@
  *	none
  */
 
-#include "../lib/ipcshm.h"
+#include "ipcshm.h"
 
 char *TCID = "shmctl01";
 int TST_TOTAL = 4;
@@ -113,7 +113,7 @@
 
 #define NEWMODE	0066
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
@@ -191,6 +191,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
@@ -316,7 +317,7 @@
 	}
 
 	/* use MODE_MASK to make sure we are comparing the last 9 bits */
-	if (!fail && (buf.shm_perm.mode & MODE_MASK) != (SHM_RW & MODE_MASK)) {
+	if (!fail && (buf.shm_perm.mode & MODE_MASK) != ((SHM_RW) & MODE_MASK)) {
 		tst_resm(TFAIL, "segment mode is incorrect");
 		fail = 1;
 	}
diff --git a/testcases/kernel/syscalls/ipc/shmctl/shmctl02.c b/testcases/kernel/syscalls/ipc/shmctl/shmctl02.c
index 60d15ca..490e202 100644
--- a/testcases/kernel/syscalls/ipc/shmctl/shmctl02.c
+++ b/testcases/kernel/syscalls/ipc/shmctl/shmctl02.c
@@ -51,7 +51,7 @@
  *	none
  */
 
-#include "../lib/ipcshm.h"
+#include "ipcshm.h"
 #include <pwd.h>
 
 char *TCID = "shmctl02";
@@ -96,7 +96,7 @@
 	{&shm_id_2, SHM_UNLOCK, &buf, EPERM}
 };
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
@@ -145,6 +145,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/shmctl/shmctl03.c b/testcases/kernel/syscalls/ipc/shmctl/shmctl03.c
index bd19a53..f5f7ed9 100644
--- a/testcases/kernel/syscalls/ipc/shmctl/shmctl03.c
+++ b/testcases/kernel/syscalls/ipc/shmctl/shmctl03.c
@@ -57,7 +57,9 @@
  *	test must be run as root
  */
 
-#include "../lib/ipcshm.h"
+#include "ipcshm.h"
+#include <sys/types.h>
+#include <sys/wait.h>
 
 char *TCID = "shmctl03";
 int TST_TOTAL = 3;
@@ -88,7 +90,7 @@
 	{&shm_id_1, IPC_RMID, &buf, EPERM},
 };
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	char *msg;			/* message returned from parse_opts */
 	int pid;
@@ -127,6 +129,7 @@
 	}
 	
 	cleanup ();
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/shmctl/shmctl04.c b/testcases/kernel/syscalls/ipc/shmctl/shmctl04.c
index 6ed2d5e..efeaf6f 100644
--- a/testcases/kernel/syscalls/ipc/shmctl/shmctl04.c
+++ b/testcases/kernel/syscalls/ipc/shmctl/shmctl04.c
@@ -41,7 +41,7 @@
  *	none
  */
 
-#include "../lib/ipcshm.h"
+#include "ipcshm.h"
 
 char *TCID = "shmctl04";
 int TST_TOTAL = 1;
@@ -55,7 +55,7 @@
  * that we are checking.
  */
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
@@ -89,6 +89,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/shmdt/Makefile b/testcases/kernel/syscalls/ipc/shmdt/Makefile
index fba00ce..6575270 100644
--- a/testcases/kernel/syscalls/ipc/shmdt/Makefile
+++ b/testcases/kernel/syscalls/ipc/shmdt/Makefile
@@ -23,8 +23,8 @@
 MAINS=shmdt01 shmdt02
 SRCS=$(MAINS:=.c)
 OBJS=$(MAINS:=.o)
-IPC_LDFLAGS+=-L.. -lipc
-LTP_CFLAGS+=-I../../../../../include -g
+IPC_LDFLAGS+=-L.. -lipc -L../../../../../lib -lltp
+LTP_CFLAGS+=-I../lib -I../../../../../include -g -Wall
 
 all: $& $(MAINS)
 
diff --git a/testcases/kernel/syscalls/ipc/shmdt/shmdt01.c b/testcases/kernel/syscalls/ipc/shmdt/shmdt01.c
index 033a686..3ea8823 100644
--- a/testcases/kernel/syscalls/ipc/shmdt/shmdt01.c
+++ b/testcases/kernel/syscalls/ipc/shmdt/shmdt01.c
@@ -57,7 +57,7 @@
  */
 
 #include <setjmp.h>
-#include "../lib/ipcshm.h"
+#include "ipcshm.h"
 
 char *TCID = "shmdt01";
 int TST_TOTAL = 1;
@@ -72,7 +72,7 @@
 int pass = 0;
 sigjmp_buf env;
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
@@ -122,6 +122,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/shmdt/shmdt02.c b/testcases/kernel/syscalls/ipc/shmdt/shmdt02.c
index cc1f64f..5741d5f 100644
--- a/testcases/kernel/syscalls/ipc/shmdt/shmdt02.c
+++ b/testcases/kernel/syscalls/ipc/shmdt/shmdt02.c
@@ -49,7 +49,7 @@
  *	none
  */
 
-#include "../lib/ipcshm.h"
+#include "ipcshm.h"
 
 char *TCID = "shmdt02";
 int TST_TOTAL = 1;
@@ -57,7 +57,7 @@
 
 int exp_enos[] = {EINVAL, 0};	/* 0 terminated list of expected errnos */
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
@@ -104,6 +104,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/shmget/Makefile b/testcases/kernel/syscalls/ipc/shmget/Makefile
index c5f479d..a2ea3e9 100644
--- a/testcases/kernel/syscalls/ipc/shmget/Makefile
+++ b/testcases/kernel/syscalls/ipc/shmget/Makefile
@@ -23,13 +23,15 @@
 MAINS=shmget01 shmget02 shmget03 shmget04 shmget05
 SRCS=$(MAINS:=.c)
 OBJS=$(MAINS:=.o)
+IPC_CFLAGS=-I ../lib
 IPC_LDFLAGS=-L.. -lipc
-LTP_CFLAGS=-I../../../../../include -g
+LTP_CFLAGS=-I../../../../../include -g -Wall
+LTP_LDFLAGS=-L../../../../../lib -lltp
 
 all: $& $(MAINS)
 
 $(MAINS): $(SRCS)
-	$(CC) -o $@ $@.c $(LTP_CFLAGS) $(LTP_LDFLAGS) $(IPC_LDFLAGS) $(LOADLIBES)
+	$(CC) -o $@ $@.c $(LTP_CFLAGS) $(LTP_LDFLAGS) $(IPC_CFLAGS) $(IPC_LDFLAGS) $(LOADLIBES)
 
 clean:
 	/bin/rm -rf $(OBJS) $(MAINS)
diff --git a/testcases/kernel/syscalls/ipc/shmget/shmget01.c b/testcases/kernel/syscalls/ipc/shmget/shmget01.c
index 221f32c..93fefd3 100644
--- a/testcases/kernel/syscalls/ipc/shmget/shmget01.c
+++ b/testcases/kernel/syscalls/ipc/shmget/shmget01.c
@@ -56,7 +56,7 @@
  *	none
  */
 
-#include "../lib/ipcshm.h"
+#include "ipcshm.h"
 
 char *TCID = "shmget01";
 int TST_TOTAL = 1;
@@ -64,7 +64,7 @@
 
 int shm_id_1 = -1;
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
@@ -87,7 +87,7 @@
 		 * Use TEST macro to make the call
 		 */
 	
-		TEST(shmget(shmkey, SHM_SIZE, IPC_CREAT | IPC_EXCL | SHM_RW));
+		TEST(shmget(shmkey, SHM_SIZE, (IPC_CREAT | IPC_EXCL | SHM_RW)));
 	
 		if (TEST_RETURN == -1) {
 			tst_resm(TFAIL, "%s call failed - errno = %d : %s",
@@ -118,7 +118,7 @@
 				 * mask out all but the lower 9 bits
 				 */
 				if ((buf.shm_perm.mode & MODE_MASK) !=
-				    (SHM_RW & MODE_MASK)) {
+				    ((SHM_RW) & MODE_MASK)) {
 					tst_resm(TFAIL, "segment mode is not "
 						 "correct");
 					continue;
@@ -143,6 +143,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+        return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/shmget/shmget02.c b/testcases/kernel/syscalls/ipc/shmget/shmget02.c
index de43b05..07edf77 100644
--- a/testcases/kernel/syscalls/ipc/shmget/shmget02.c
+++ b/testcases/kernel/syscalls/ipc/shmget/shmget02.c
@@ -50,7 +50,7 @@
  *	none
  */
 
-#include "../lib/ipcshm.h"
+#include "ipcshm.h"
 
 char *TCID = "shmget02";
 int TST_TOTAL = 5;
@@ -86,7 +86,7 @@
 	{&shm_id_2, SHM_SIZE, SHM_RW, ENOENT}
 };
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
@@ -135,6 +135,8 @@
 	cleanup();
 
 	/*NOTREACHED*/
+
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/shmget/shmget03.c b/testcases/kernel/syscalls/ipc/shmget/shmget03.c
index 69e880f..93ccbb1 100644
--- a/testcases/kernel/syscalls/ipc/shmget/shmget03.c
+++ b/testcases/kernel/syscalls/ipc/shmget/shmget03.c
@@ -50,7 +50,7 @@
  *	none
  */
 
-#include "../lib/ipcshm.h"
+#include "ipcshm.h"
 
 char *TCID = "shmget03";
 int TST_TOTAL = 1;
@@ -70,7 +70,7 @@
 int shm_id_arr[MAXIDS];
 
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
@@ -118,6 +118,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/shmget/shmget04.c b/testcases/kernel/syscalls/ipc/shmget/shmget04.c
index 4bdf2d4..2750b68 100644
--- a/testcases/kernel/syscalls/ipc/shmget/shmget04.c
+++ b/testcases/kernel/syscalls/ipc/shmget/shmget04.c
@@ -50,7 +50,7 @@
  *	none
  */
 #include <pwd.h>
-#include "../lib/ipcshm.h"
+#include "ipcshm.h"
 
 char *TCID = "shmget04";
 int TST_TOTAL = 1;
@@ -63,11 +63,10 @@
 
 int shm_id_1 = -1;
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
-	int i;
 
 	/* parse standard options */
 	if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
@@ -111,6 +110,7 @@
 	cleanup();
 
 	/*NOTREACHED*/
+	return(0);
 }
 
 /*
diff --git a/testcases/kernel/syscalls/ipc/shmget/shmget05.c b/testcases/kernel/syscalls/ipc/shmget/shmget05.c
index 3ff8e9d..0f3d5fb 100644
--- a/testcases/kernel/syscalls/ipc/shmget/shmget05.c
+++ b/testcases/kernel/syscalls/ipc/shmget/shmget05.c
@@ -56,7 +56,9 @@
  *	test must be run at root
  */
 
-#include "../lib/ipcshm.h"
+#include "ipcshm.h"
+#include <sys/types.h>
+#include <sys/wait.h>
 
 char *TCID = "shmget05";
 int TST_TOTAL = 1;
@@ -69,7 +71,7 @@
 uid_t ltp_uid;
 char *ltp_user = "nobody";
 
-main(int ac, char **av)
+int main(int ac, char **av)
 {
 	char *msg;			/* message returned from parse_opts */
 	int pid;
@@ -110,6 +112,7 @@
 		/* Remove the temporary directory */
 		tst_rmdir();
 	}
+	return(0);
 }
 
 /*