public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH v2 1/2] pipeio: convert strerror(errno) to TERRNO
@ 2011-12-15  9:35 Jan Stancek
  0 siblings, 0 replies; only message in thread
From: Jan Stancek @ 2011-12-15  9:35 UTC (permalink / raw)
  To: ltp-list

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


Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
  testcases/kernel/ipc/pipeio/pipeio.c |   32 
++++++++++++++++----------------
  1 files changed, 16 insertions(+), 16 deletions(-)



[-- Attachment #2: 0001-pipeio-convert-strerror-errno-to-TERRNO.patch --]
[-- Type: text/x-patch, Size: 4749 bytes --]

diff --git a/testcases/kernel/ipc/pipeio/pipeio.c b/testcases/kernel/ipc/pipeio/pipeio.c
index 1c28c9b..22ab3a7 100644
--- a/testcases/kernel/ipc/pipeio/pipeio.c
+++ b/testcases/kernel/ipc/pipeio/pipeio.c
@@ -433,7 +433,7 @@ char *av[];
 
 	if ((writebuf = (char *) malloc(size)) == NULL ||
 	    (readbuf = (char *) malloc(size)) == NULL) {
-		tst_resm (TFAIL, "malloc() failed: %s", strerror(errno));
+		tst_resm (TFAIL|TERRNO, "malloc() failed");
   		SAFE_FREE(writebuf);
 		SAFE_FREE(readbuf);
 		exit(1);
@@ -444,15 +444,15 @@ char *av[];
 	writebuf[size-1] = 'A';	/* to detect partial read/write problem */
 
 	if ((sem_id = semget(IPC_PRIVATE, 1, IPC_CREAT|S_IRWXU)) == -1) {
-		tst_brkm(TBROK, NULL, "Couldn't allocate semaphore: %s", strerror(errno));
+		tst_brkm(TBROK|TERRNO, NULL, "Couldn't allocate semaphore");
 	}
 
 	if (semctl(sem_id, 0, SETVAL, u) == -1)
-		tst_brkm(TBROK, NULL, "Couldn't initialize semaphore value: %s", strerror(errno));
+		tst_brkm(TBROK|TERRNO, NULL, "Couldn't initialize semaphore value");
 
 	if (background) {
 	    if ((n=fork()) == -1) {
-		tst_resm (TFAIL, "fork() failed: %s", strerror(errno));
+		tst_resm (TFAIL|TERRNO, "fork() failed");
 		exit(1);
 	    }
 	    else if (n != 0) /* parent */
@@ -461,7 +461,7 @@ char *av[];
 
 	if (unpipe) {
 		if (pipe(fds) == -1) {
-			tst_resm (TFAIL, "pipe() failed to create un-named pipe: %s", strerror(errno));
+			tst_resm (TFAIL|TERRNO, "pipe() failed to create un-named pipe");
 			exit(1);
 		}
 		read_fd = fds[0];
@@ -470,14 +470,14 @@ char *av[];
 		blk_type = UNNAMED_IO;
 	} else {
 		if (strlen(dir) && chdir(dir) == -1) {
-			tst_resm (TFAIL, "chdir(%s) failed: %s", dir, strerror(errno));
+			tst_resm (TFAIL|TERRNO, "chdir(%s) failed", dir);
 			exit(1);
 		}
 
 		if (stat(pname, &stbuf) == -1) {
 
 		    if (mkfifo(pname,0777) == -1) {
-			tst_resm (TFAIL, "mkfifo(%s,0777) failed: %s", pname, strerror(errno));
+			tst_resm (TFAIL|TERRNO, "mkfifo(%s,0777) failed", pname);
 			exit(1);
 		    }
 		}
@@ -510,7 +510,7 @@ printf("num_wrters = %d\n", num_wrters);
 
 	for (i=num_wrters; i > 0; --i) {
 		if ((c=fork()) < 0) {
-			tst_resm (TFAIL, "fork() failed: %s", strerror(errno));
+			tst_resm (TFAIL|TERRNO, "fork() failed");
 			exit(1);
 		}
 		if (c == 0) break;	/* stop child from forking */
@@ -521,11 +521,11 @@ printf("child after fork pid = %d\n", getpid());
 #endif
 		if (! unpipe) {
 			if ((write_fd = open(pname,O_WRONLY)) == -1) {
-				tst_resm (TFAIL, "child pipe open(%s, %#o) failed: %s", pname, O_WRONLY|ndelay, strerror(errno));
+				tst_resm (TFAIL|TERRNO, "child pipe open(%s, %#o) failed", pname, O_WRONLY|ndelay);
 				exit(1);
 			}
 			if (ndelay && fcntl(write_fd, F_SETFL, O_NONBLOCK) == -1) {
-				tst_brkm(TBROK, NULL, "Failed setting the pipe to nonblocking mode: %s", strerror(errno));
+				tst_brkm(TBROK|TERRNO, NULL, "Failed setting the pipe to nonblocking mode");
 			}
 		}
 		else {
@@ -539,7 +539,7 @@ printf("child after fork pid = %d\n", getpid());
 		};
 
 		if (semop(sem_id, &sem_op, 1) == -1)
-			tst_brkm(TBROK, NULL, "Couldn't raise the semaphore: %s", strerror(errno));
+			tst_brkm(TBROK|TERRNO, NULL, "Couldn't raise the semaphore");
 
 		pid_word = (int *)&writebuf[0];
 		count_word = (int *)&writebuf[NBPW];
@@ -567,7 +567,7 @@ printf("child after fork pid = %d\n", getpid());
 			 * If lio_write_buffer returns a negative number,
 			 * the return will be -errno.
 			 */
-													tst_resm (TFAIL, "pass %d: lio_write_buffer(%s) failed; it returned %d: %s", j, cp, nb, strerror(-nb));
+				tst_resm (TFAIL, "pass %d: lio_write_buffer(%s) failed; it returned %d: %s", j, cp, nb, strerror(-nb));
 				exit(1);
 			}
 			else if (nb != size) {
@@ -591,11 +591,11 @@ printf("child after fork pid = %d\n", getpid());
 
 		if (! unpipe) {
 			if ((read_fd = open(pname,O_RDONLY)) == -1) {
-				tst_resm (TFAIL, "parent pipe open(%s, %#o) failed: %s", pname, O_RDONLY, strerror(errno));
+				tst_resm (TFAIL|TERRNO, "parent pipe open(%s, %#o) failed", pname, O_RDONLY);
 				exit(1);
 			}
 			if (ndelay && fcntl(read_fd, F_SETFL, O_NONBLOCK) == -1) {
-				tst_brkm(TBROK, NULL, "Failed setting the pipe to nonblocking mode: %s", strerror(errno));
+				tst_brkm(TBROK|TERRNO, NULL, "Failed setting the pipe to nonblocking mode");
 			}
 		}
 		else {
@@ -612,7 +612,7 @@ printf("child after fork pid = %d\n", getpid());
 			if (errno == EINTR) {
 				continue;
 			}
-			tst_brkm(TBROK, NULL, "Couldn't wait on semaphore: %s", strerror(errno));
+			tst_brkm(TBROK|TERRNO, NULL, "Couldn't wait on semaphore");
 		}
 
 		for (i=num_wrters*num_writes; i > 0 || loop; --i) {
@@ -884,4 +884,4 @@ sig_handler(int sig)
     fflush(stdout);
     exit(3);
 
-}
\ No newline at end of file
+}


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

------------------------------------------------------------------------------
10 Tips for Better Server Consolidation
Server virtualization is being driven by many needs.  
But none more important than the need to reduce IT complexity 
while improving strategic productivity.  Learn More! 
http://www.accelacomm.com/jaw/sdnl/114/51507609/

[-- 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 related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-12-15  9:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-15  9:35 [LTP] [PATCH v2 1/2] pipeio: convert strerror(errno) to TERRNO Jan Stancek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox