[Glibc-bsd-commits] r4729 - in trunk/freebsd-libs/debian: . patches

Robert Millan rmh at alioth.debian.org
Thu Jul 11 10:55:27 UTC 2013


Author: rmh
Date: 2013-07-11 10:55:27 +0000 (Thu, 11 Jul 2013)
New Revision: 4729

Added:
   trunk/freebsd-libs/debian/patches/no_kvm_uread_in_freebsd10.diff
   trunk/freebsd-libs/debian/patches/preserve_libkvm_abi.diff
Modified:
   trunk/freebsd-libs/debian/changelog
   trunk/freebsd-libs/debian/patches/series
Log:
preserve_libkvm_abi.diff (and no_kvm_uread_in_freebsd10.diff): Backport fix from upstream to preserve 9.0 ABI in libkvm.

Modified: trunk/freebsd-libs/debian/changelog
===================================================================
--- trunk/freebsd-libs/debian/changelog	2013-07-11 10:54:18 UTC (rev 4728)
+++ trunk/freebsd-libs/debian/changelog	2013-07-11 10:55:27 UTC (rev 4729)
@@ -3,6 +3,8 @@
   * New upstream release.
     - Sync all patches.
   * Enable __FreeBSD_version when building freebsd-libs sources.
+  * preserve_libkvm_abi.diff (and no_kvm_uread_in_freebsd10.diff):
+    Backport fix from upstream to preserve 9.0 ABI in libkvm.
 
  -- Robert Millan <rmh at debian.org>  Tue, 09 Jul 2013 22:49:44 +0200
 

Added: trunk/freebsd-libs/debian/patches/no_kvm_uread_in_freebsd10.diff
===================================================================
--- trunk/freebsd-libs/debian/patches/no_kvm_uread_in_freebsd10.diff	                        (rev 0)
+++ trunk/freebsd-libs/debian/patches/no_kvm_uread_in_freebsd10.diff	2013-07-11 10:55:27 UTC (rev 4729)
@@ -0,0 +1,16 @@
+
+See the comments in preserve_libkvm_abi.diff for an explanation
+
+--- a/lib/libkvm/kvm_proc.c
++++ b/lib/libkvm/kvm_proc.c
+@@ -717,6 +717,10 @@
+ 	ssize_t amount;
+ 	int fd;
+ 
++#if __FreeBSD_version >= 1000000
++#error "kvm_uread is not present in FreeBSD 10 ABI. Please remove preserve_libkvm_abi.diff"
++#endif
++
+ 	if (!ISALIVE(kd)) {
+ 		_kvm_err(kd, kd->program,
+ 		    "cannot read user space from dead kernel");

Added: trunk/freebsd-libs/debian/patches/preserve_libkvm_abi.diff
===================================================================
--- trunk/freebsd-libs/debian/patches/preserve_libkvm_abi.diff	                        (rev 0)
+++ trunk/freebsd-libs/debian/patches/preserve_libkvm_abi.diff	2013-07-11 10:55:27 UTC (rev 4729)
@@ -0,0 +1,68 @@
+
+rev 253166 from stable/9
+
+kvm_uread was accidentally removed in 9.1. Upstream decided to add it
+back in stable/9 to preserve 9.0 ABI, while bumping soname in HEAD at
+the same time.
+
+This patch (along with no_kvm_uread_in_freebsd10.diff) needs to be
+removed when we upgrade to 10.0 or 9.2, whichever comes first.
+
+--- a/lib/libkvm/kvm_proc.c
++++ b/lib/libkvm/kvm_proc.c
+@@ -704,3 +704,55 @@
+ {
+ 	return (kvm_argv(kd, kp, 1, nchr));
+ }
++
++/*
++ * Read from user space.  The user context is given by p.
++ */
++ssize_t
++kvm_uread(kvm_t *kd, const struct kinfo_proc *kp, u_long uva, char *buf,
++	size_t len)
++{
++	char *cp;
++	char procfile[MAXPATHLEN];
++	ssize_t amount;
++	int fd;
++
++	if (!ISALIVE(kd)) {
++		_kvm_err(kd, kd->program,
++		    "cannot read user space from dead kernel");
++		return (0);
++	}
++
++	sprintf(procfile, "/proc/%d/mem", kp->ki_pid);
++	fd = open(procfile, O_RDONLY, 0);
++	if (fd < 0) {
++		_kvm_err(kd, kd->program, "cannot open %s", procfile);
++		return (0);
++	}
++
++	cp = buf;
++	while (len > 0) {
++		errno = 0;
++		if (lseek(fd, (off_t)uva, 0) == -1 && errno != 0) {
++			_kvm_err(kd, kd->program, "invalid address (%lx) in %s",
++			    uva, procfile);
++			break;
++		}
++		amount = read(fd, cp, len);
++		if (amount < 0) {
++			_kvm_syserr(kd, kd->program, "error reading %s",
++			    procfile);
++			break;
++		}
++		if (amount == 0) {
++			_kvm_err(kd, kd->program, "EOF reading %s", procfile);
++			break;
++		}
++		cp += amount;
++		uva += amount;
++		len -= amount;
++	}
++
++	close(fd);
++	return ((ssize_t)(cp - buf));
++}

Modified: trunk/freebsd-libs/debian/patches/series
===================================================================
--- trunk/freebsd-libs/debian/patches/series	2013-07-11 10:54:18 UTC (rev 4728)
+++ trunk/freebsd-libs/debian/patches/series	2013-07-11 10:55:27 UTC (rev 4729)
@@ -1,3 +1,9 @@
+# Patches from (or merged in) upstream
+preserve_libkvm_abi.diff
+
+# Patches that are in good shape for merging upstream
+
+# Other patches that might or might not be mergeable
 cdefs_macros.diff
 02_libcam.diff
 03_libsbuf.diff
@@ -19,5 +25,7 @@
 kvm_size_t_kludge.diff
 dwarf.diff
 elf.diff
-pthread_condattr_setclock.diff
+
+# Patches that are likely to be Debian-specific
+no_kvm_uread_in_freebsd10.diff
 libusb_pthread_condattr_setclock.diff




More information about the Glibc-bsd-commits mailing list