[SCM] BOINC packaging branch, master, updated. debian/7.1.10+dfsg-1-8-g800603c

Gianfranco Costamagna costamagnagianfranco at yahoo.it
Wed Jun 19 17:12:03 UTC 2013


The following commit has been merged in the master branch:
commit 8096238423756af561d3f4f7b2e7a56fe5c4738c
Author: Steffen Moeller <steffen_moeller at gmx.de>
Date:   Wed Jun 19 17:59:42 2013 +0200

    patch refresh, added idea for memory-only shared mem
    
    Not applied in debian/patches/series.

diff --git a/debian/changelog b/debian/changelog
index 54a750e..e16338d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+boinc (7.1.10+dfsg-2) UNRELEASED; urgency=low
+
+  * Experimenting with memory-only shared-memory
+    This is highly incompatible with regular clients.
+    It is expected to work only with Debian's clients after a rebuild.
+
+ -- Steffen Moeller <moeller at debian.org>  Wed, 19 Jun 2013 17:50:55 +0200
+
 boinc (7.1.10+dfsg-1) unstable; urgency=low
 
   * New upstream release.
diff --git a/debian/patches/mmap_mem_only.patch b/debian/patches/mmap_mem_only.patch
new file mode 100644
index 0000000..dc56a7f
--- /dev/null
+++ b/debian/patches/mmap_mem_only.patch
@@ -0,0 +1,119 @@
+Index: boinc_debian/lib/shmem.cpp
+===================================================================
+--- boinc_debian.orig/lib/shmem.cpp
++++ boinc_debian/lib/shmem.cpp
+@@ -308,9 +308,8 @@
+ 
+ // V6 mmap() shared memory for Unix/Linux/Mac
+ //
+-int create_shmem_mmap(const char *path, size_t size, void** pp) {
++int create_shmem_mmap(const char *const path, size_t size, void** pp) {
+     int fd, retval;
+-    struct stat sbuf;
+     
+     // Return NULL pointer if create_shmem fails
+     *pp = 0;
+@@ -324,26 +323,12 @@
+     // it's a big headache for anyone it affects,
+     // and it's not a significant security issue.
+     //
+-    fd = open(path, O_RDWR | O_CREAT, 0666);
++    fd = shm_open(path, O_TRUNC | O_RDWR | O_CREAT, 0666);
+     if (fd < 0) return ERR_SHMGET;
+ 
+-    retval = fstat(fd, &sbuf);
+-    if (retval) {
+-        close(fd);
+-        return ERR_SHMGET;
+-    }
+-    if (sbuf.st_size < (long)size) {
+-        // The following 2 lines extend the file and clear its new 
+-        // area to all zeros because they write beyond the old EOF. 
+-        // See the lseek man page for details.
+-        lseek(fd, size-1, SEEK_SET);
+-        if (! write(fd, "\0", 1)) {
+-	    close(fd);
+-	    return ERR_SHMGET;
+-	}
+-    }
++    if (0>ftruncate(fd,size)) return ERR_SHMGET;
+ 
+-    *pp = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_FILE | MAP_SHARED, fd, 0);
++    *pp = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+     
+     close(fd);
+ 
+@@ -360,13 +345,13 @@
+ }
+ 
+ 
+-int attach_shmem_mmap(const char *path, void** pp) {
++int attach_shmem_mmap(const char *const path, void** pp) {
+     int fd, retval;
+     struct stat sbuf;
+     
+     // Return NULL pointer if attach_shmem fails
+     *pp = 0;
+-    fd = open(path, O_RDWR);
++    fd = shm_open(path, O_RDWR, 0666);
+     if (fd < 0) return ERR_SHMGET;
+ 
+     retval = fstat(fd, &sbuf);
+@@ -392,8 +377,10 @@
+ }
+ 
+ 
+-int detach_shmem_mmap(void* p, size_t size) {
+-    return munmap((char *)p, size);
++int detach_shmem_mmap(const char* const memname, void* p, size_t size) {
++    int i=munmap((char *)p, size);
++    if (0==i) shm_unlink(memname);
++    return i;
+ }
+ 
+ #if HAVE_SYS_SHM_H
+Index: boinc_debian/lib/shmem.h
+===================================================================
+--- boinc_debian.orig/lib/shmem.h
++++ boinc_debian/lib/shmem.h
+@@ -42,9 +42,9 @@
+ #else
+ #ifndef __EMX__
+ #define MMAPPED_FILE_NAME    "boinc_mmap_file"
+-extern int create_shmem_mmap(const char *path, size_t size, void** pp);
+-extern int attach_shmem_mmap(const char *path, void** pp);
+-extern int detach_shmem_mmap(void* p, size_t size);
++extern int create_shmem_mmap(const char *const path, size_t size, void** pp);
++extern int attach_shmem_mmap(const char *const path, void** pp);
++extern int detach_shmem_mmap(const char* const path, void* p, size_t size);
+ #endif
+ extern int create_shmem(key_t, int size, gid_t gid, void**);
+ extern int attach_shmem(key_t, void**);
+Index: boinc_debian/client/app.cpp
+===================================================================
+--- boinc_debian.orig/client/app.cpp
++++ boinc_debian/client/app.cpp
+@@ -211,7 +211,9 @@
+     if (app_client_shm.shm) {
+ #ifndef __EMX__
+         if (app_version->api_major_version() >= 6) {
+-            retval = detach_shmem_mmap(app_client_shm.shm, sizeof(SHARED_MEM));
++	    char buf[MAXPATHLEN];
++	    sprintf(buf, "%s/%s", slot_dir, MMAPPED_FILE_NAME);
++            retval = detach_shmem_mmap(buf, app_client_shm.shm, sizeof(SHARED_MEM));
+         } else
+ #endif
+         {
+Index: boinc_debian/Makefile.incl
+===================================================================
+--- boinc_debian.orig/Makefile.incl
++++ boinc_debian/Makefile.incl
+@@ -44,7 +44,7 @@
+ LIBSCHED_FCGI = -lsched_fcgi
+ $(LIBSCHED_FCGI):
+ 	cd $(top_builddir)/sched; ${MAKE} libsched_fcgi.la
+-LIBBOINC = -lboinc
++LIBBOINC = -lboinc -lrt
+ $(LIBBOINC):
+ 	cd $(top_builddir)/lib; ${MAKE} libboinc.la
+ LIBBOINC_CRYPT = -lboinc_crypt
diff --git a/debian/patches/more_clang_warnings.patch b/debian/patches/more_clang_warnings.patch
index e6603cf..737b392 100644
--- a/debian/patches/more_clang_warnings.patch
+++ b/debian/patches/more_clang_warnings.patch
@@ -1,6 +1,8 @@
---- a/client/app_control.cpp
-+++ b/client/app_control.cpp
-@@ -590,8 +590,8 @@
+Index: boinc_debian/client/app_control.cpp
+===================================================================
+--- boinc_debian.orig/client/app_control.cpp
++++ boinc_debian/client/app_control.cpp
+@@ -589,8 +589,8 @@
      } else {
          x = y;
      }
@@ -11,7 +13,7 @@
      strip_whitespace(buf);
      fclose(f);
      return true;
-@@ -1422,13 +1422,13 @@
+@@ -1421,13 +1421,13 @@
      FILE* f = fopen(path, "r");
      if (!f) return;
      buf[0] = 0;
@@ -27,8 +29,10 @@
          msg_printf(wup->project, MSG_INTERNAL_ERROR,
              "no project URL in task state file"
          );
---- a/client/cs_platforms.cpp
-+++ b/client/cs_platforms.cpp
+Index: boinc_debian/client/cs_platforms.cpp
+===================================================================
+--- boinc_debian.orig/client/cs_platforms.cpp
++++ boinc_debian/client/cs_platforms.cpp
 @@ -143,7 +143,7 @@
          strlcat(cmdline," -m",256);
          if ((f=popen(cmdline,"r"))) {
@@ -47,8 +51,10 @@
                                  // If the library is 32-bit ELF, then we're
                                  // golden.
                                  if (strstr(cmdline, "ELF") && strstr(cmdline, "32-bit")) support32=1;
---- a/lib/crypt.cpp
-+++ b/lib/crypt.cpp
+Index: boinc_debian/lib/crypt.cpp
+===================================================================
+--- boinc_debian.orig/lib/crypt.cpp
++++ boinc_debian/lib/crypt.cpp
 @@ -208,14 +208,17 @@
      }
      if (j != len) return ERR_NULL;
@@ -70,9 +76,11 @@
  #endif
      return 0;
  }
---- a/lib/diagnostics.cpp
-+++ b/lib/diagnostics.cpp
-@@ -608,7 +608,7 @@
+Index: boinc_debian/lib/diagnostics.cpp
+===================================================================
+--- boinc_debian.orig/lib/diagnostics.cpp
++++ boinc_debian/lib/diagnostics.cpp
+@@ -607,7 +607,7 @@
      size = backtrace (array, 64);
  //  Anything that calls malloc here (i.e *printf()) will probably fail
  //  so we'll do it the hard way.
@@ -81,7 +89,7 @@
      char mbuf[10];
      char *p=mbuf+9;
      int i=size;
-@@ -617,10 +617,10 @@
+@@ -616,10 +616,10 @@
        *(p--)=i%10+'0';
        i/=10;
      }
@@ -95,8 +103,10 @@
      backtrace_symbols_fd(array, size, fileno(stderr));
  #endif
  
---- a/client/hostinfo_unix.cpp
-+++ b/client/hostinfo_unix.cpp
+Index: boinc_debian/client/hostinfo_unix.cpp
+===================================================================
+--- boinc_debian.orig/client/hostinfo_unix.cpp
++++ boinc_debian/client/hostinfo_unix.cpp
 @@ -1236,11 +1236,12 @@
  #endif
          fd = popen(cmd, "r");
@@ -115,8 +125,10 @@
              pclose(fd);
          }
      }
---- a/client/app_start.cpp
-+++ b/client/app_start.cpp
+Index: boinc_debian/client/app_start.cpp
+===================================================================
+--- boinc_debian.orig/client/app_start.cpp
++++ boinc_debian/client/app_start.cpp
 @@ -850,7 +850,10 @@
      char* argv[100];
      char current_dir[1024];
@@ -142,8 +154,10 @@
  
          if (!config.no_priority_change) {
  #if HAVE_SETPRIORITY
---- a/api/graphics2_unix.cpp
-+++ b/api/graphics2_unix.cpp
+Index: boinc_debian/api/graphics2_unix.cpp
+===================================================================
+--- boinc_debian.orig/api/graphics2_unix.cpp
++++ boinc_debian/api/graphics2_unix.cpp
 @@ -191,7 +191,9 @@
      FILE *f = boinc_fopen("gfx_info", "r");
      if (f) {
@@ -155,8 +169,10 @@
          fclose(f);
      }
  
---- a/lib/procinfo_unix.cpp
-+++ b/lib/procinfo_unix.cpp
+Index: boinc_debian/lib/procinfo_unix.cpp
+===================================================================
+--- boinc_debian.orig/lib/procinfo_unix.cpp
++++ boinc_debian/lib/procinfo_unix.cpp
 @@ -219,9 +219,11 @@
          sprintf(pidpath, "/proc/%s/stat", piddir->d_name);
          fd = fopen(pidpath, "r");
@@ -171,9 +187,11 @@
  
              if (retval) {
                  final_retval = retval;
---- a/client/log_flags.cpp
-+++ b/client/log_flags.cpp
-@@ -510,7 +510,10 @@
+Index: boinc_debian/client/log_flags.cpp
+===================================================================
+--- boinc_debian.orig/client/log_flags.cpp
++++ boinc_debian/client/log_flags.cpp
+@@ -509,7 +509,10 @@
  #ifdef _WIN32
              _chdir(config.data_dir);
  #else
@@ -185,9 +203,11 @@
  #endif
          }
      } else {
---- a/client/switcher.cpp
-+++ b/client/switcher.cpp
-@@ -47,6 +47,8 @@
+Index: boinc_debian/client/switcher.cpp
+===================================================================
+--- boinc_debian.orig/client/switcher.cpp
++++ boinc_debian/client/switcher.cpp
+@@ -46,6 +46,8 @@
      char            newlibs[256];
      char            *projectDirName;
  
@@ -196,7 +216,7 @@
      strcpy(user_name, "boinc_project");
      strcpy(group_name, "boinc_project");
  
-@@ -74,12 +76,16 @@
+@@ -73,12 +75,16 @@
      // We are running setuid root, so setgid() sets real group ID,
      // effective group ID and saved set_group-ID for this process
      grp = getgrnam(group_name);
@@ -215,7 +235,7 @@
  
      // For unknown reasons, the LD_LIBRARY_PATH and DYLD_LIBRARY_PATH
      // environment variables are not passed in to switcher, though all
-@@ -126,7 +132,8 @@
+@@ -125,7 +131,8 @@
  
      execv(argv[1], argv+2);
  
@@ -226,8 +246,10 @@
 +    if (errno) fprintf(stderr, "Process creation (%s) failed: errno=%d\n", argv[1], errno);
 +    return(errno);
  }
---- a/lib/shmem.cpp
-+++ b/lib/shmem.cpp
+Index: boinc_debian/lib/shmem.cpp
+===================================================================
+--- boinc_debian.orig/lib/shmem.cpp
++++ boinc_debian/lib/shmem.cpp
 @@ -337,7 +337,10 @@
          // area to all zeros because they write beyond the old EOF. 
          // See the lseek man page for details.
diff --git a/debian/patches/series b/debian/patches/series
index 6a50620..5c2be49 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -61,3 +61,4 @@ rrsim_iterator_cppcheck.patch
 filesys_error_message.patch
 de.po.patch
 more_clang_warnings.patch
+#mmap_mem_only.patch

-- 
BOINC packaging



More information about the pkg-boinc-commits mailing list