[haiku-commits] r36090 - in haiku/trunk/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces: mmap munmap

  • From: ingo_weinhold@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 8 Apr 2010 19:32:09 +0200 (CEST)

Author: bonefish
Date: 2010-04-08 19:32:09 +0200 (Thu, 08 Apr 2010)
New Revision: 36090
Changeset: http://dev.haiku-os.org/changeset/36090/haiku

Modified:
   
haiku/trunk/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/24-2.c
   
haiku/trunk/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/6-1.c
   
haiku/trunk/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/6-2.c
   
haiku/trunk/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/6-3.c
   
haiku/trunk/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/1-1.c
   
haiku/trunk/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/1-2.c
   
haiku/trunk/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/3-1.c
   
haiku/trunk/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/4-1.c
   
haiku/trunk/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/9-1.c
Log:
* Fixed more incorrect occurrences of the pid_t == int assumption.
* Automatic whitespace cleanup.


Modified: 
haiku/trunk/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/24-2.c
===================================================================
--- 
haiku/trunk/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/24-2.c
        2010-04-08 17:15:49 UTC (rev 36089)
+++ 
haiku/trunk/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/24-2.c
        2010-04-08 17:32:09 UTC (rev 36090)
@@ -1,19 +1,19 @@
-/*   
+/*
  * Copyright (c) 2002, Intel Corporation. All rights reserved.
  * This file is licensed under the GPL license.  For the full content
- * of this license, see the COPYING file at the top level of this 
+ * of this license, see the COPYING file at the top level of this
  * source tree.
 
  * The mmap( ) function shall fail if:
- * [ENOMEM] MAP_FIXED was specified, 
+ * [ENOMEM] MAP_FIXED was specified,
  * and the range [addr,addr+len) exceeds that allowed
  * for the address space of a process; or, if MAP_FIXED was not specified and
  * there is insufficient room in the address space to effect the mapping.
- * 
+ *
  * Test Step:
  * 1. Map a shared memory object, with size exceeding the value get from
  *    rlim_cur of resource RLIMIT_AS, setting MAP_FIXED;
- * 3. Should get ENOMEM. 
+ * 3. Should get ENOMEM.
  */
 
 #define _XOPEN_SOURCE 600
@@ -29,7 +29,7 @@
 #include <string.h>
 #include <errno.h>
 #include "posixtest.h"
- 
+
 #define TNAME "mmap/24-2.c"
 
 int main()
@@ -37,23 +37,23 @@
   char tmpfname[256];
   int shm_fd;
 
-  void *pa = NULL; 
+  void *pa = NULL;
   void *addr = NULL;
   size_t len;
   int prot = PROT_READ | PROT_WRITE;
   int flag = MAP_SHARED;
   int fd;
   off_t off = 0;
-  
+
   /* Size of the shared memory object */
   size_t shm_size;
   struct rlimit rlim;
   unsigned long page_size = sysconf(_SC_PAGE_SIZE);
 
   shm_size = 2 * page_size;
-  snprintf(tmpfname, sizeof(tmpfname), "pts_mmap_24_2_%d",
-           getpid());
-       
+  snprintf(tmpfname, sizeof(tmpfname), "pts_mmap_24_2_%ld",
+           (long)getpid());
+
   /* Create shared object */
   shm_unlink(tmpfname);
   shm_fd = shm_open(tmpfname, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR);
@@ -62,7 +62,7 @@
     printf(TNAME " Error at shm_open(): %s\n", strerror(errno));
     return PTS_UNRESOLVED;
   }
-  shm_unlink(tmpfname);   
+  shm_unlink(tmpfname);
   if(ftruncate(shm_fd, shm_size) == -1) {
     printf(TNAME " Error at ftruncate(): %s\n", strerror(errno));
     return PTS_UNRESOLVED;
@@ -74,25 +74,25 @@
                printf(TNAME " Error at getrlimit(): %s\n", strerror(errno));
                return PTS_UNRESOLVED;
   }
-  printf("available memory: %lu\n", rlim.rlim_cur); 
- 
-  /* First mmap, just to get a legal addr for second mmap */ 
-  fd = shm_fd; 
-  len = shm_size; 
+  printf("available memory: %lu\n", rlim.rlim_cur);
+
+  /* First mmap, just to get a legal addr for second mmap */
+  fd = shm_fd;
+  len = shm_size;
   pa = mmap (addr, len, prot, flag, fd, off);
   if (pa == MAP_FAILED)
   {
-    printf ("Test Fail: " TNAME " Error at first mmap(): %s\n", 
-            strerror(errno));    
+    printf ("Test Fail: " TNAME " Error at first mmap(): %s\n",
+            strerror(errno));
     exit(PTS_FAIL);
   }
-  
-  fd = shm_fd; 
+
+  fd = shm_fd;
   len = rlim.rlim_cur;
   flag = MAP_FIXED | MAP_SHARED;
   addr = pa;
-  printf("addr: %lx, len: %lx\n", (unsigned long)addr, 
-               (unsigned long)len); 
+  printf("addr: %lx, len: %lx\n", (unsigned long)addr,
+               (unsigned long)len);
   /* Make sure addr and len is aligned to page size */
   if ((unsigned long)addr % page_size)
   {
@@ -104,17 +104,17 @@
   {
     /* Lower boundary */
     len &= ~(page_size - 1);
-  }    
-  printf("addr: %lx, len: %lx\n", (unsigned long)addr, 
-               (unsigned long)len); 
+  }
+  printf("addr: %lx, len: %lx\n", (unsigned long)addr,
+               (unsigned long)len);
   pa = mmap (addr, len, prot, flag, fd, off);
   if (pa == MAP_FAILED && errno == ENOMEM)
   {
-    printf ("Test Pass: " TNAME " Get ENOMEM: %s\n", 
-            strerror(errno));    
+    printf ("Test Pass: " TNAME " Get ENOMEM: %s\n",
+            strerror(errno));
     exit(PTS_PASS);
   }
-  
+
   if (pa == MAP_FAILED)
     perror("Error at mmap()");
   else

Modified: 
haiku/trunk/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/6-1.c
===================================================================
--- 
haiku/trunk/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/6-1.c
 2010-04-08 17:15:49 UTC (rev 36089)
+++ 
haiku/trunk/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/6-1.c
 2010-04-08 17:32:09 UTC (rev 36090)
@@ -1,24 +1,24 @@
-/*   
+/*
  * Copyright (c) 2002, Intel Corporation. All rights reserved.
  * This file is licensed under the GPL license.  For the full content
- * of this license, see the COPYING file at the top level of this 
+ * of this license, see the COPYING file at the top level of this
  * source tree.
  *
- * MPR An implementation may permit accesses other than those specified by 
prot; 
- * however, if the Memory Protection option is supported, the implementation 
- * shall not permit a write to succeed where PROT_WRITE has not been set or 
- * shall not permit any access where PROT_NONE alone has been set. 
+ * MPR An implementation may permit accesses other than those specified by 
prot;
+ * however, if the Memory Protection option is supported, the implementation
+ * shall not permit a write to succeed where PROT_WRITE has not been set or
+ * shall not permit any access where PROT_NONE alone has been set.
  * The implementation shall support at least the following values of prot:
  * PROT_NONE, PROT_READ, PROT_WRITE, and the bitwise-inclusive OR of PROT_READ 
and
- * PROT_WRITE. 
+ * PROT_WRITE.
  *
  * Test Step:
  *
  * If Memory Protection option is supported:
  * 1. Spawn a child process.
  * 2. The child process mmap a memory region setting prot as PROT_READ.
- * 3. Try to write the mapped memory. 
- * 4. If the writing triger SIGSEGV, the PASS. 
+ * 3. Try to write the mapped memory.
+ * 4. If the writing triger SIGSEGV, the PASS.
  *
  * Please refer to IEEE_1003.1-2001. 2.8.3.3 Memory Protection.
  */
@@ -35,16 +35,16 @@
 #include <string.h>
 #include <errno.h>
 #include "posixtest.h"
- 
+
 #define TNAME "mmap/6-1.c"
 
 int main()
 {
 #ifdef _POSIX_MEMORY_PROTECTION
   char tmpfname[256];
-  int total_size = 1024; 
+  int total_size = 1024;
 
-  void *pa = NULL; 
+  void *pa = NULL;
   void *addr = NULL;
   size_t size = total_size;
   int flag = MAP_SHARED;
@@ -58,39 +58,39 @@
   int status;
   int sig_num;
 
-  snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_6_1_%d",
-           getpid());
+  snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_6_1_%ld",
+           (long)getpid());
   unlink(tmpfname);
   fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL,
             S_IRUSR | S_IWUSR);
   if (fd == -1)
-  {  
-    printf(TNAME " Error at open(): %s\n", 
-           strerror(errno));    
+  {
+    printf(TNAME " Error at open(): %s\n",
+           strerror(errno));
     exit(PTS_UNRESOLVED);
   }
   unlink(tmpfname);
-  
+
   child = fork();
 
   if (child == 0)
   {
     if(ftruncate(fd, total_size) == -1)
     {
-      printf(TNAME "Error at ftruncate(): %s\n", 
-              strerror(errno));    
+      printf(TNAME "Error at ftruncate(): %s\n",
+              strerror(errno));
       exit(PTS_UNRESOLVED);
     }
-  
+
     prot = PROT_READ;
     pa = mmap(addr, size, prot, flag, fd, off);
     if (pa == MAP_FAILED)
     {
-      printf("Test Fail: " TNAME " Error at mmap: %s\n", 
-            strerror(errno));    
+      printf("Test Fail: " TNAME " Error at mmap: %s\n",
+            strerror(errno));
       exit(PTS_FAIL);
     }
-  
+
     ch = pa;
 
     *ch = 'b';
@@ -103,10 +103,10 @@
     if (WIFSTOPPED(status))
     {
       sig_num = WSTOPSIG(status);
-      printf("Child process stopped by signal %d\n", sig_num); 
+      printf("Child process stopped by signal %d\n", sig_num);
       if (sig_num == SIGSEGV)
       {
-        printf("Test Pass: " TNAME 
+        printf("Test Pass: " TNAME
                 " Got SIGSEGV when writing to the mapped memory, "
                 "without setting PROT_WRITE\n");
         return PTS_PASS;
@@ -115,10 +115,10 @@
     if (WIFSIGNALED(status))
     {
       sig_num = WTERMSIG(status);
-      printf("Child process terminated by signal %d\n", sig_num); 
+      printf("Child process terminated by signal %d\n", sig_num);
       if (sig_num == SIGSEGV)
       {
-        printf ("Test Pass: " TNAME 
+        printf ("Test Pass: " TNAME
                 " Got SIGSEGV when writing to the mapped memory, "
                 "without setting PROT_WRITE\n");
         return PTS_PASS;
@@ -128,7 +128,7 @@
     {
       if (WEXITSTATUS(status) == 0)
       {
-        printf ("Test FAIL: " TNAME 
+        printf ("Test FAIL: " TNAME
                 " Did not got SIGSEGV when writing to the mapped memory,"
                 " without setting PROT_WRITE\n");
         return PTS_FAIL;
@@ -139,9 +139,9 @@
   }
 
 #else
-  printf ("Test Unresolved: " TNAME 
-          " _POSIX_MEMORY_PROTECTION not defined\n");    
+  printf ("Test Unresolved: " TNAME
+          " _POSIX_MEMORY_PROTECTION not defined\n");
   return PTS_UNRESOLVED;
 #endif
-  
+
 }

Modified: 
haiku/trunk/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/6-2.c
===================================================================
--- 
haiku/trunk/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/6-2.c
 2010-04-08 17:15:49 UTC (rev 36089)
+++ 
haiku/trunk/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/6-2.c
 2010-04-08 17:32:09 UTC (rev 36090)
@@ -1,25 +1,25 @@
-/*   
+/*
  * Copyright (c) 2002, Intel Corporation. All rights reserved.
  * This file is licensed under the GPL license.  For the full content
- * of this license, see the COPYING file at the top level of this 
+ * of this license, see the COPYING file at the top level of this
  * source tree.
  *
- * MPR An implementation may permit accesses other than those specified by 
prot; 
- * however, if the Memory Protection option is supported, the implementation 
- * shall not permit a write to succeed where PROT_WRITE has not been set or 
- * shall not permit any access where PROT_NONE alone has been set. 
+ * MPR An implementation may permit accesses other than those specified by 
prot;
+ * however, if the Memory Protection option is supported, the implementation
+ * shall not permit a write to succeed where PROT_WRITE has not been set or
+ * shall not permit any access where PROT_NONE alone has been set.
  * The implementation shall support at least the following values of prot:
  * PROT_NONE, PROT_READ, PROT_WRITE, and the bitwise-inclusive OR of PROT_READ 
and
- * PROT_WRITE. 
- * 
+ * PROT_WRITE.
+ *
  * Test Step:
  *
  * If the Memory Protection option is supported:
  *
  * 1. Spawn a child process.
  * 2. The child process mmap a memory region setting prot as PROT_NONE.
- * 3. Try to read the mapped memory. 
- * 4. If the read will triger SIGSEGV, the PASS. 
+ * 3. Try to read the mapped memory.
+ * 4. If the read will triger SIGSEGV, the PASS.
  *
  * Please refer to IEEE_1003.1-2001. 2.8.3.3 Memory Protection.
  */
@@ -38,7 +38,7 @@
 #include <string.h>
 #include <errno.h>
 #include "posixtest.h"
- 
+
 #define TNAME "mmap/6-2.c"
 
 int main()
@@ -47,9 +47,9 @@
 #ifdef _POSIX_MEMORY_PROTECTION
   char tmpfname[256];
   char* data;
-  int total_size = 1024; 
-  
-  void *pa = NULL; 
+  int total_size = 1024;
+
+  void *pa = NULL;
   void *addr = NULL;
   size_t size = total_size;
   int flag = MAP_SHARED;
@@ -63,49 +63,49 @@
   int status;
   int sig_num;
 
-  snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_6_2_%d",
-           getpid());
+  snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_6_2_%ld",
+           (long)getpid());
   unlink(tmpfname);
   fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL,
             S_IRUSR | S_IWUSR);
   if (fd == -1)
-  {  
-    printf(TNAME " Error at open(): %s\n", 
-           strerror(errno));    
+  {
+    printf(TNAME " Error at open(): %s\n",
+           strerror(errno));
     exit(PTS_UNRESOLVED);
   }
   unlink(tmpfname);
-  
+
   child = fork();
 
   if (child == 0)
   {
-    fflush (NULL); 
-    data = (char *) malloc(total_size); 
+    fflush (NULL);
+    data = (char *) malloc(total_size);
     memset(data, 'a', total_size);
     if (write(fd, data, total_size) != total_size)
     {
-      printf(TNAME "Error at write(): %s\n", 
-              strerror(errno));    
+      printf(TNAME "Error at write(): %s\n",
+              strerror(errno));
       exit(PTS_UNRESOLVED);
     }
     free(data);
-  
+
     prot = PROT_NONE;
     pa = mmap(addr, size, prot, flag, fd, off);
     if (pa == MAP_FAILED)
     {
-      printf("Test Fail: " TNAME " Error at mmap: %s\n", 
-            strerror(errno));    
+      printf("Test Fail: " TNAME " Error at mmap: %s\n",
+            strerror(errno));
       exit(PTS_FAIL);
     }
-    
+
     ch = pa;
     /* Read acess */
     if(*ch != 'a')
     {
-      printf ("Test Fail: " TNAME 
-              " The file did not mapped to memory\n");    
+      printf ("Test Fail: " TNAME
+              " The file did not mapped to memory\n");
       exit(PTS_FAIL);
     }
     exit(0);
@@ -119,44 +119,44 @@
       sig_num = WSTOPSIG(status);
       if (sig_num == SIGSEGV)
       {
-        printf("Test Pass: " TNAME 
+        printf("Test Pass: " TNAME
                 " Got SIGSEGV when reading the mapped memory, "
                 "setting PROT_NONE\n");
         return PTS_PASS;
       }
-      printf("Child process stopped by signal %d\n", sig_num); 
+      printf("Child process stopped by signal %d\n", sig_num);
     }
     if (WIFSIGNALED(status))
     {
       sig_num = WTERMSIG(status);
       if (sig_num == SIGSEGV)
       {
-        printf ("Test Pass: " TNAME 
+        printf ("Test Pass: " TNAME
                 " Got SIGSEGV when reading the mapped memory, "
                 " setting PROT_NOTE\n");
         return PTS_PASS;
       }
-      printf("Child process terminated by signal %d\n", sig_num); 
+      printf("Child process terminated by signal %d\n", sig_num);
     }
     if (WIFEXITED(status))
     {
       if (WEXITSTATUS(status) == 0)
       {
-        printf ("Test FAIL: " TNAME 
+        printf ("Test FAIL: " TNAME
                 " Did not got SIGSEGV when reading the mapped memory,"
                 " setting PROT_NOTE\n");
         return PTS_FAIL;
       }
-    
+
     }
     printf ("Test Unresolved\n");
     return PTS_UNRESOLVED;
   }
 
 #else
-  printf ("Test Unresolved: " TNAME 
-          " _POSIX_MEMORY_PROTECTION not defined\n");    
+  printf ("Test Unresolved: " TNAME
+          " _POSIX_MEMORY_PROTECTION not defined\n");
   return PTS_UNRESOLVED;
 #endif
-  
+
 }

Modified: 
haiku/trunk/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/6-3.c
===================================================================
--- 
haiku/trunk/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/6-3.c
 2010-04-08 17:15:49 UTC (rev 36089)
+++ 
haiku/trunk/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/mmap/6-3.c
 2010-04-08 17:32:09 UTC (rev 36090)
@@ -1,23 +1,23 @@
-/*   
+/*
  * Copyright (c) 2002, Intel Corporation. All rights reserved.
  * This file is licensed under the GPL license.  For the full content
- * of this license, see the COPYING file at the top level of this 
+ * of this license, see the COPYING file at the top level of this
  * source tree.
  *
- * MPR An implementation may permit accesses other than those specified by 
prot; 
- * however, if the Memory Protection option is supported, the implementation 
- * shall not permit a write to succeed where PROT_WRITE has not been set or 
- * shall not permit any access where PROT_NONE alone has been set. 
+ * MPR An implementation may permit accesses other than those specified by 
prot;
+ * however, if the Memory Protection option is supported, the implementation
+ * shall not permit a write to succeed where PROT_WRITE has not been set or
+ * shall not permit any access where PROT_NONE alone has been set.
  * The implementation shall support at least the following values of prot:
  * PROT_NONE, PROT_READ, PROT_WRITE, and the bitwise-inclusive OR of PROT_READ 
and
- * PROT_WRITE. 
- * 
+ * PROT_WRITE.
+ *
  * Test Step:
  * If Memory Protection option is suppored:
  * 1. Spawn a child process.
  * 2. The child process mmap a memory region setting prot as PROT_NONE.
- * 3. Try to write the mapped memory. 
- * 4. If the write will triger SIGSEGV, the PASS. 
+ * 3. Try to write the mapped memory.
+ * 4. If the write will triger SIGSEGV, the PASS.
  *
  * Please refer to IEEE_1003.1-2001. 2.8.3.3 Memory Protection.
  */
@@ -36,7 +36,7 @@
 #include <string.h>
 #include <errno.h>
 #include "posixtest.h"
- 
+
 #define TNAME "mmap/6-3.c"
 
 int main()
@@ -44,9 +44,9 @@
 
 #ifdef _POSIX_MEMORY_PROTECTION
   char tmpfname[256];
-  int total_size = 1024; 
-  
-  void *pa = NULL; 
+  int total_size = 1024;
+
+  void *pa = NULL;
   void *addr = NULL;
   size_t size = total_size;
   int flag = MAP_SHARED;
@@ -60,40 +60,40 @@
   int status;
   int sig_num;
 
-  snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_6_3_%d",
-           getpid());
+  snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_mmap_6_3_%ld",
+           (long)getpid());
   unlink(tmpfname);
   fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL,
             S_IRUSR | S_IWUSR);
   if (fd == -1)
-  {  
-    printf(TNAME " Error at open(): %s\n", 
-           strerror(errno));    
+  {
+    printf(TNAME " Error at open(): %s\n",
+           strerror(errno));
     exit(PTS_UNRESOLVED);
   }
   unlink(tmpfname);
-  
+
   child = fork();
 
   if (child == 0)
   {
-    fflush (NULL); 
+    fflush (NULL);
     if (ftruncate(fd, total_size) == -1)
     {
-      printf(TNAME "Error at ftruncate(): %s\n", 
-              strerror(errno));    
+      printf(TNAME "Error at ftruncate(): %s\n",
+              strerror(errno));
       exit(PTS_UNRESOLVED);
     }
-  
+
     prot = PROT_NONE;
     pa = mmap(addr, size, prot, flag, fd, off);
     if (pa == MAP_FAILED)
     {
-      printf("Test Fail: " TNAME " Error at mmap: %s\n", 
-            strerror(errno));    
+      printf("Test Fail: " TNAME " Error at mmap: %s\n",
+            strerror(errno));
       exit(PTS_FAIL);
     }
-    
+
     ch = pa;
 
     /* Write acess */
@@ -109,43 +109,43 @@
       sig_num = WSTOPSIG(status);
       if (sig_num == SIGSEGV)
       {
-        printf("Test Pass: " TNAME 
+        printf("Test Pass: " TNAME
                 " Got SIGSEGV when writing the mapped memory, "
                 "setting PROT_NONE\n");
         return PTS_PASS;
       }
-      printf("Child process stopped by signal %d\n", sig_num); 
+      printf("Child process stopped by signal %d\n", sig_num);
     }
     if (WIFSIGNALED(status))
     {
       sig_num = WTERMSIG(status);
       if (sig_num == SIGSEGV)
       {
-        printf ("Test Pass: " TNAME 
+        printf ("Test Pass: " TNAME
                 " Got SIGSEGV when writing the mapped memory, "
                 " setting PROT_NOTE\n");
         return PTS_PASS;
       }
-      printf("Child process terminated by signal %d\n", sig_num); 
+      printf("Child process terminated by signal %d\n", sig_num);
     }
     if (WIFEXITED(status))
     {
       if (WEXITSTATUS(status) == 0)
       {
-        printf ("Test FAIL: " TNAME 
+        printf ("Test FAIL: " TNAME
                 " Did not got SIGSEGV when writing the mapped memory,"
                 " setting PROT_NOTE\n");
         return PTS_FAIL;
       }
-    
+
     }
     printf ("Test Unresolved\n");
     return PTS_UNRESOLVED;
   }
 
 #else
-    printf ("Test Unresolved: " TNAME 
-            " _POSIX_MEMORY_PROTECTION not defined\n");    
+    printf ("Test Unresolved: " TNAME
+            " _POSIX_MEMORY_PROTECTION not defined\n");
     return PTS_UNRESOLVED;
 #endif
 }

Modified: 
haiku/trunk/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/1-1.c
===================================================================
--- 
haiku/trunk/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/1-1.c
       2010-04-08 17:15:49 UTC (rev 36089)
+++ 
haiku/trunk/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/1-1.c
       2010-04-08 17:32:09 UTC (rev 36090)
@@ -1,14 +1,14 @@
-/*   
+/*
  * Copyright (c) 2002, Intel Corporation. All rights reserved.
  * This file is licensed under the GPL license.  For the full content
- * of this license, see the COPYING file at the top level of this 
+ * of this license, see the COPYING file at the top level of this
  * source tree.
  *
- * The munmap( ) function shall remove any mappings for those 
- * entire pages containing any part of the address space of 
- * the process starting at addr and continuing for len bytes. 
- * Further references to these pages shall result in the 
- * generation of a SIGSEGV signal to the process. 
+ * The munmap( ) function shall remove any mappings for those
+ * entire pages containing any part of the address space of
+ * the process starting at addr and continuing for len bytes.
+ * Further references to these pages shall result in the
+ * generation of a SIGSEGV signal to the process.
  *
  * Test Step:
  * 1. map a file into memory;
@@ -31,7 +31,7 @@
 #include <string.h>
 #include <errno.h>
 #include "posixtest.h"
- 
+
 #define TNAME "munmap/1-1.c"
 
 void sigsegv_handler(int signum)
@@ -44,9 +44,9 @@
 int main()
 {
   char tmpfname[256];
-  long file_size; 
+  long file_size;
 
-  void *pa = NULL; 
+  void *pa = NULL;
   void *addr = NULL;
   size_t len;
   int flag;
@@ -55,66 +55,66 @@
   int prot;
 
   int page_size;
-  
+
   char *ch1;
- 
+
   struct sigaction sa;
 
   sigfillset(&sa.sa_mask);
   sa.sa_handler = sigsegv_handler;
-  sigaction(SIGSEGV, &sa, NULL);  
- 
+  sigaction(SIGSEGV, &sa, NULL);
+
   page_size = sysconf(_SC_PAGE_SIZE);
   file_size = 2 * page_size;
-  
+
   /* We hope to map 2 pages */
   len = page_size + 1;
-  
+
   /* Create tmp file */
-  snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_munmap_1_1_%d",
-           getpid());
+  snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_munmap_1_1_%ld",
+           (long)getpid());
   unlink(tmpfname);
   fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL,
             S_IRUSR | S_IWUSR);
   if (fd == -1)
-  {  
-    printf(TNAME " Error at open(): %s\n", 
-           strerror(errno));    
+  {
+    printf(TNAME " Error at open(): %s\n",
+           strerror(errno));
     exit(PTS_UNRESOLVED);
   }
   unlink(tmpfname);
- 
+
   if (ftruncate (fd, file_size) == -1)
   {
     printf("Error at ftruncate: %s\n", strerror(errno));
     exit(PTS_UNRESOLVED);
-  } 
-  
+  }
+
   flag = MAP_SHARED;
   prot = PROT_READ | PROT_WRITE;
   pa = mmap(addr, len, prot, flag, fd, off);
   if (pa == MAP_FAILED)
   {
-       printf ("Test UNRESOLVED: " TNAME " Error at mmap: %s\n", 
-            strerror(errno));    
+       printf ("Test UNRESOLVED: " TNAME " Error at mmap: %s\n",
+            strerror(errno));
     exit(PTS_UNRESOLVED);
   }
 
   /* ch1 is outside the mapped object, but in the mapped file */
   ch1 = pa + len + 1;
   *ch1 = 'b';
-  
+
   close (fd);
   if (munmap (pa, len) == -1)
   {
-       printf ("Test FAILED: " TNAME " Error at munmap: %s\n", 
-            strerror(errno));    
+       printf ("Test FAILED: " TNAME " Error at munmap: %s\n",
+            strerror(errno));
     exit(PTS_FAIL);
   }
- 
-  /* Try to reference the unmapped area, should trigger SIGSEGV */ 
+
+  /* Try to reference the unmapped area, should trigger SIGSEGV */
   *ch1 = 'a';
-  
+
   /* If reach this point, test fail */
   printf ("Test FAILED: Did not trigger SIGSEGV\n");
   return PTS_FAIL;

Modified: 
haiku/trunk/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/1-2.c
===================================================================
--- 
haiku/trunk/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/1-2.c
       2010-04-08 17:15:49 UTC (rev 36089)
+++ 
haiku/trunk/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/1-2.c
       2010-04-08 17:32:09 UTC (rev 36090)
@@ -1,19 +1,19 @@
-/*   
+/*
  * Copyright (c) 2002, Intel Corporation. All rights reserved.
  * This file is licensed under the GPL license.  For the full content
- * of this license, see the COPYING file at the top level of this 
+ * of this license, see the COPYING file at the top level of this
  * source tree.
  *
- * The munmap( ) function shall remove any mappings for those 
- * entire pages containing any part of the address space of 
- * the process starting at addr and continuing for len bytes. 
- * Further references to these pages shall result in the 
- * generation of a SIGSEGV signal to the process. 
+ * The munmap( ) function shall remove any mappings for those
+ * entire pages containing any part of the address space of
+ * the process starting at addr and continuing for len bytes.
+ * Further references to these pages shall result in the
+ * generation of a SIGSEGV signal to the process.
  *
  * Test Step:
  * 1. map a file into memory;
  * 2. unmap;
- * 3. Try to reference the unmapped memory, test whether SIGSEGV 
+ * 3. Try to reference the unmapped memory, test whether SIGSEGV
  *    is triggered.
  */
 
@@ -31,7 +31,7 @@
 #include <string.h>
 #include <errno.h>
 #include "posixtest.h"
- 
+
 #define TNAME "munmap/1-2.c"
 
 void sigsegv_handler(int signum)
@@ -44,9 +44,9 @@
 int main()
 {
   char tmpfname[256];
-  long file_size; 
+  long file_size;
 
-  void *pa = NULL; 
+  void *pa = NULL;
   void *addr = NULL;
   size_t len;
   int flag;
@@ -55,60 +55,60 @@
   int prot;
 
   int page_size;
-  
+
   char *ch;
- 
+
   struct sigaction sa;
 
   sigfillset(&sa.sa_mask);
   sa.sa_handler = sigsegv_handler;
-  sigaction(SIGSEGV, &sa, NULL);  
- 
+  sigaction(SIGSEGV, &sa, NULL);
+
   page_size = sysconf(_SC_PAGE_SIZE);
   file_size = 2 * page_size;
-  
+
   /* We hope to map 2 pages */
   len = page_size + 1;
-  
+
   /* Create tmp file */
-  snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_munmap_1_1_%d",
-           getpid());
+  snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_munmap_1_1_%ld",
+           (long)getpid());
   unlink(tmpfname);
   fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL,
             S_IRUSR | S_IWUSR);
   if (fd == -1)
-  {  
-    printf(TNAME " Error at open(): %s\n", 
-           strerror(errno));    
+  {
+    printf(TNAME " Error at open(): %s\n",
+           strerror(errno));
     exit(PTS_UNRESOLVED);
   }
   unlink(tmpfname);
- 
+
   if (ftruncate (fd, file_size) == -1)
   {
     printf("Error at ftruncate: %s\n", strerror(errno));
     exit(PTS_UNRESOLVED);
-  } 
-  
+  }
+
   flag = MAP_SHARED;
   prot = PROT_READ | PROT_WRITE;
   pa = mmap(addr, len, prot, flag, fd, off);
   if (pa == MAP_FAILED)
   {
-       printf ("Test UNRESOLVED: " TNAME " Error at mmap: %s\n", 
-            strerror(errno));    
+       printf ("Test UNRESOLVED: " TNAME " Error at mmap: %s\n",
+            strerror(errno));
     exit(PTS_UNRESOLVED);
   }
-  
+
   ch = pa;
   *ch = 'b';
-  
+
   close (fd);
   munmap (pa, len);
 
-  /* Should trigger SIGSEGV here */ 
+  /* Should trigger SIGSEGV here */
   *ch = 'a';
-    
+
   printf ("Test FAILED: Did not trigger SIGSEGV\n");
   return PTS_FAIL;
 }

Modified: 
haiku/trunk/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/3-1.c
===================================================================
--- 
haiku/trunk/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/3-1.c
       2010-04-08 17:15:49 UTC (rev 36089)
+++ 
haiku/trunk/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/munmap/3-1.c
       2010-04-08 17:32:09 UTC (rev 36090)
@@ -1,12 +1,12 @@
-/*   
+/*
  * Copyright (c) 2002, Intel Corporation. All rights reserved.
  * This file is licensed under the GPL license.  For the full content
- * of this license, see the COPYING file at the top level of this 
+ * of this license, see the COPYING file at the top level of this
  * source tree.
  *
- * The implementation shall require that addr be a multiple 
+ * The implementation shall require that addr be a multiple
  * of the page size {PAGESIZE}.
- * 
+ *
  * Test step:
  * Try to call unmap, with addr NOT a multiple of page size.
  * Should get EINVAL.
@@ -26,15 +26,15 @@
 #include <string.h>
 #include <errno.h>
 #include "posixtest.h"
- 
+
 #define TNAME "munmap/3-1.c"
 
 int main()
 {
   char tmpfname[256];
-  long file_size; 
+  long file_size;
 
-  void *pa = NULL; 
+  void *pa = NULL;
   void *addr = NULL;
   size_t len;
   int flag;
@@ -43,43 +43,43 @@
   int prot;
 
   int page_size;
-  
+
   char *pa2;
- 
- 
+
+
   page_size = sysconf(_SC_PAGE_SIZE);
   file_size = 2 * page_size;
-  
+
   /* We hope to map 2 pages */
   len = page_size + 1;
-  
+
   /* Create tmp file */
-  snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_munmap_1_1_%d",
-           getpid());
+  snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_munmap_1_1_%ld",
+           (long)getpid());
   unlink(tmpfname);
   fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL,
             S_IRUSR | S_IWUSR);
   if (fd == -1)
-  {  
-    printf(TNAME " Error at open(): %s\n", 
-           strerror(errno));    
+  {
+    printf(TNAME " Error at open(): %s\n",
+           strerror(errno));
     exit(PTS_UNRESOLVED);
   }
   unlink(tmpfname);
- 
+
   if (ftruncate (fd, file_size) == -1)
   {

[... truncated: 282 lines follow ...]

Other related posts:

  • » [haiku-commits] r36090 - in haiku/trunk/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces: mmap munmap - ingo_weinhold