[POWERPC] Fix spurious vectors on weird MPIC

The weird TSI 10x MPIC needs an EOI after getting a spurious vector.  This
patch uses the existing MPIC_SPV_EOI flag to fix this issue.

Signed-off-by: Josh Boyer <94755a79aca753e683bb6d0e796d473b797056eb@linux.vnet.ibm.com>
Signed-off-by: Paul Mackerras <19a0ba370c443ba08d20b5061586430ab449ee8c@samba.org>

--- arch/powerpc/sysdev/mpic.c
+++ arch/powerpc/sysdev/mpic.c
@@ -1333,8 +1333,11 @@
 #ifdef DEBUG_LOW
 	DBG("%s: get_one_irq(): %d\n", mpic->name, src);
 #endif
-	if (unlikely(src == mpic->spurious_vec))
+	if (unlikely(src == mpic->spurious_vec)) {
+		if (mpic->flags & MPIC_SPV_EOI)
+			mpic_eoi(mpic);
 		return NO_IRQ;
+	}
 	return irq_linear_revmap(mpic->irqhost, src);
 }


allow branch reversal to fail

allow branch reversal to fail

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@30943 91177308-0d34-0410-b5e6-96231b3b80d8

--- include/llvm/Target/TargetInstrInfo.h
+++ include/llvm/Target/TargetInstrInfo.h
@@ -308,10 +308,11 @@
     assert(0 && "Target didn't implement TargetInstrInfo::RemoveBranch!");
   }

-  /// Reverses the branch condition of the MachineInstr pointed by
-  /// MI. The instruction is replaced and the new MI is returned.
-  virtual void ReverseBranchCondition(std::vector<MachineOperand> &Cond) const {
-    assert(0 && "Target didn't implement ReverseBranchCondition!");
+  /// ReverseBranchCondition - Reverses the branch condition of the specified
+  /// condition list, returning false on success and true if it cannot be
+  /// reversed.
+  virtual bool ReverseBranchCondition(std::vector<MachineOperand> &Cond) const {
+    return true;
   }

   /// insertNoop - Insert a noop into the instruction stream at the specified


1. Change send_file() and get_file() to use the open_file_stream() routine to do most of the work. 2. Get rid of try_via_nfs() and try_via_afs(), as these are now handled by open_file_stream() in its dealings with the shadow. 3. Get rid of send_core() routine which was intended to efficiently transfer sun core files (which have holes) - this never worked correctly, and was never used.

--- src/condor_syscall_lib/xfer_file.c
+++ src/condor_syscall_lib/xfer_file.c
@@ -39,165 +39,127 @@
 double	get_time();
 extern int	Syscalls;

-#if defined(__STDC__)
-int try_via_afs( char *, int, int );
-#else
-int try_via_afs();
-#endif
+#define CHUNK_SIZE 4096

 /*
 ** Transfer a local file to a remote machine.
 */
-send_file( local, remote, perm )
-char	*local;
-char	*remote;
-int		perm;
-{
-
-	int		scm;
+int
+send_file( const char *local, const char *remote, int perm )
+{
+
 	int		remote_fd, local_fd;
-	int		answer;
-	char	buf[4096];
-	int		nbytes;
-	int		bytes_written;
-	int		count = 0;
+	char	buf[ CHUNK_SIZE ];
+	int		nbytes, bytes_to_go;
+	size_t	len;
 	double	start, finish;
-	int		mode = O_WRONLY | O_CREAT | O_TRUNC;

 	dprintf( D_ALWAYS, "Entering send_file( %s, %s, 0%o )\n",local,remote,perm);

-	if( (remote_fd = try_via_afs(remote,mode,perm)) >= 0 ) {
-		dprintf( D_ALWAYS, "Transferring file via AFS\n" );
-	} else if( (remote_fd = try_via_nfs(remote,mode,perm)) >= 0 ) {
-		dprintf( D_ALWAYS, "Transferring file via NFS\n" );
-	} else {
-		dprintf( D_ALWAYS, "Transferring file via CONDOR_send_file\n" );
-		answer =  REMOTE_syscall( CONDOR_send_file, local, remote, perm );
-		return answer;
-	}
-
+		/* Start timing the transfer */
 	start = get_time();

-
+		/* Open the local file */
 	if( (local_fd=open(local,O_RDONLY,0)) < 0 ) {
 		dprintf( D_FULLDEBUG, "Failed to open \"%s\" locally, errno = %d\n",
 														local, errno);
 		return -1;
 	}

-	/*
-	display_syscall_mode( __LINE__, __FILE__ );
-	dprintf( D_ALWAYS, "Local file \"%s\": fd = %d\n", local, local_fd );
-	dprintf( D_ALWAYS, "Remote file \"%s\": fd = %d\n", remote, remote_fd );
-	DumpOpenFds();
-	*/
-
-	for(;;) {
-
-		/* dprintf( D_ALWAYS, "Attempting to read from fd %d\n", local_fd ); */
-		nbytes = read( local_fd, buf, sizeof(buf) );
-		/* dprintf( D_ALWAYS, "nbytes = %d\n", nbytes ) */;
-
-		if( nbytes <= 0 ) {
-			break;
-		}
-		if( (bytes_written = write(remote_fd,buf,nbytes)) == nbytes ) {
-			count += nbytes;
-			/* dprintf( D_ALWAYS, "Wrote %d bytes to fd %d\n",
-													nbytes, remote_fd ); */
-		} else {
+		/* Find length of the file */
+	len = lseek( local_fd, 0, 2 );
+	lseek( local_fd, 0, 0 );
+
+		/* Open the remote file */
+	remote_fd = open_file_stream( remote, O_WRONLY | O_CREAT | O_TRUNC, &len );
+	if( remote_fd < 0 ) {
+		dprintf( D_ALWAYS, "Failed to open \"%s\" remotely, errno = %d\n",
+															remote, errno );
+	}
+
+		/* transfer the data */
+	dprintf( D_ALWAYS, "File length is %d\n", len );
+	for(bytes_to_go = len; bytes_to_go; bytes_to_go -= nbytes ) {
+		nbytes = MIN( CHUNK_SIZE, bytes_to_go );
+		nbytes = read( local_fd, buf, nbytes );
+		if( nbytes < 0 ) {
+			dprintf( D_ALWAYS, "Can't read fd %d, errno = %d\n",
+														local_fd, errno );
+		}
+		if( write(remote_fd,buf,nbytes) != nbytes ) {
 			dprintf( D_ALWAYS, "Can't write fd %d, errno = %d\n",
 														remote_fd, errno );
 			return -1;
 		}
 	}

+		/* Clean up */
 	(void)close( local_fd );
 	(void)close( remote_fd );
+
+		/* report */
 	finish = get_time();
-
-	if( nbytes < 0 ) {
-		dprintf( D_ALWAYS, "Can't read fd %d, errno = %d\n", local_fd, errno );
-	}
-	if( nbytes == 0 ) {
-		dprintf( D_ALWAYS,"Send_file() transferred %d bytes, %d bytes/second\n",
-										count, (int)(count/(finish-start)) );
-	}
-
-	return nbytes;
+	dprintf( D_ALWAYS,"Send_file() transferred %d bytes, %d bytes/second\n",
+										len, (int)(len/(finish-start)) );
+
+	return len;
 }

 /*
 ** Transfer a remote file to the local machine.
 */
-get_file( remote, local, mode )
-char	*remote;
-char	*local;
-int		mode;
-{
-	int		scm;
+int
+get_file( const char *remote, const char *local, int mode )
+{
 	int		remote_fd, local_fd;
-	int		answer;
-	char	buf[4096];
-	int		nbytes;
-	int		count = 0;
+	char	buf[ CHUNK_SIZE ];
+	int		nbytes, bytes_to_go;
+	size_t	len;
 	double	start, finish;
-	char	external[ MAXPATHLEN ];

 	dprintf( D_ALWAYS, "Entering get_file( %s, %s, 0%o )\n", remote,local,mode);

-	if( (remote_fd = try_via_afs(remote,O_RDONLY,0)) >= 0 ) {
-		dprintf( D_ALWAYS, "Transferring file via AFS\n" );
-	} else if( (remote_fd = try_via_nfs(remote,O_RDONLY,0)) >= 0 ) {
-		dprintf( D_ALWAYS, "Transferring file via NFS\n" );
-	} else {
-		dprintf( D_ALWAYS, "Transferring file via CONDOR_get_file\n" );
-		answer =  REMOTE_syscall( CONDOR_get_file, remote, local, mode );
-		return answer;
-	}
-
-
-		/* Use NFS or AFS to transfer the file */
 	start = get_time();

+		/* open the remote file */
+	remote_fd = open_file_stream( remote, O_RDONLY, &len );
+	if( remote_fd < 0 ) {
+		dprintf( D_ALWAYS, "open_file_stream(%s,O_RDONLY,0x%x) failed\n",
+														remote_fd, &len );
+	}
+
+		/* open the local file */
 	if( (local_fd=open(local,O_WRONLY|O_CREAT|O_TRUNC,mode)) < 0 ) {
 		dprintf( D_FULLDEBUG, "Failed to open \"%s\" locally, errno = %d\n",
 														local, errno);
 		return -1;
 	}

-	for(;;) {
-
-		/* dprintf( D_ALWAYS, "Attempting to read from fd %d\n", remote_fd ); */
-		nbytes = read( remote_fd, buf,sizeof(buf) );
-		/* dprintf( D_ALWAYS, "nbytes = %d\n", nbytes ); */
-
-		if( nbytes <= 0 ) {
-			break;
-		}
-		if( write(local_fd,buf,nbytes) == nbytes ) {
-			count += nbytes;
-		} else {
+		/* transfer the data */
+	for(bytes_to_go = len; bytes_to_go; bytes_to_go -= nbytes ) {
+		nbytes = MIN( CHUNK_SIZE, bytes_to_go );
+		nbytes = read( remote_fd, buf, nbytes );
+		if( nbytes < 0 ) {
+			dprintf( D_ALWAYS, "Can't read fd %d, errno = %d\n",
+														remote_fd, errno );
+		}
+		if( write(local_fd,buf,nbytes) != nbytes ) {
 			dprintf( D_ALWAYS, "Can't write fd %d, errno = %d\n",
 														local_fd, errno );
 			return -1;
 		}
 	}

+		/* clean up */
 	(void)close( local_fd );
 	(void)close( remote_fd );

 	finish = get_time();

-	if( nbytes < 0 ) {
-		dprintf( D_ALWAYS, "Can't read fd %d, errno = %d\n", remote_fd, errno );
-	}
-	if( nbytes == 0 ) {
-		dprintf( D_ALWAYS,"Get_file() transferred %d bytes, %d bytes/second\n",
-										count, (int)(count/(finish-start)) );
-	}
-
-	return nbytes;
+	dprintf( D_ALWAYS,"Get_file() transferred %d bytes, %d bytes/second\n",
+										len, (int)(len/(finish-start)) );
+
+	return len;
 }

 #include <sys/time.h>
@@ -215,82 +177,10 @@
 	return (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0;
 }

-/*
-** Here we try to open the file via NFS, but avoid an obvious cases where
-** NFS would be a loss.  If the file is physically located on the submitting
-** machine, block transferring the file via the shadow will be better than
-** NFS.  This will be even more true if we are writing the file.
-**
-** On the other hand, if the file is on the submitting machine, and we're
-** that machine, then what appears to be NFS access would really be local.
-** In that case we're better off than using the shadow, so do it locally,
-** which is still called "NFS".
-*/
-try_via_nfs( path, flags, mode )
-char	*path;
-int		flags;
-int		mode;
-{
-#if 1
-	return -1;
-#else
-	int		scm;
-	char	external[ MAXPATHLEN ];
-	static char	submitting_host[ MAXPATHLEN ];
-	static char	this_host[ MAXPATHLEN ];
-	int		submitting_host_len;
-	int		answer = 0;
-	char	*file_host, *find_physical_host();
-
-	dprintf( D_FULLDEBUG, "Entering try_via_nfs\n" );
-
-
-	if( submitting_host[0] == '\0' ) {
-
-		REMOTE_syscall( CONDOR_gethostname, submitting_host,
-													sizeof(submitting_host) );
-		dprintf( D_FULLDEBUG, "submitting_host = \"%s\"\n", submitting_host );
-
-		gethostname( this_host, sizeof(this_host) );
-		dprintf( D_FULLDEBUG, "this_host = \"%s\"\n", this_host );
-
-		submitting_host_len = strlen( submitting_host );
-	}
-
-	if( (file_host = find_physical_host(path,flags)) == NULL ) {
-		dprintf( D_ALWAYS, "Can't find physical location of file \"%s\"\n",
-																		path );
-		return -1;
-	}
-	dprintf( D_FULLDEBUG, "at point 2\n" );
-	dprintf( D_FULLDEBUG, "this_host = \"%s\"\n", this_host );
-	dprintf( D_FULLDEBUG, "submitting_host = \"%s\"\n", submitting_host );
-	dprintf( D_FULLDEBUG, "file_host = \"%s\"\n", file_host );
-
-	if( strcmp(submitting_host,file_host) == 0 ) {
-		dprintf(D_FULLDEBUG,"File is physically located on submitting host\n" );
-		if( strcmp(submitting_host,this_host) == 0 ) {
-			dprintf( D_FULLDEBUG, "But we are the submitting host\n" );
-			answer = unmapped_nfs_open( path, flags, mode );
-			dprintf( D_FULLDEBUG, "answer=%d\n", answer );
-		} else {
-			answer = -1;	/* Avoid NFS */
-		}
-	} else {
-		dprintf( D_FULLDEBUG,
-			 "File is NOT physically located on submitting host\n" );
-		answer = unmapped_nfs_open( path, flags, mode );
-		dprintf( D_FULLDEBUG, "answer=%d\n", answer );
-	}
-
-	return answer;
-#endif
-}
-
+
+#if 0
 char *
-find_physical_host( path, flags )
-char	*path;
-int		flags;
+find_physical_host( const char *path, int flags )
 {
 	static char answer[ MAXPATHLEN ];
 	char		dir[ MAXPATHLEN ];
@@ -331,171 +221,4 @@
 		return NULL;
 	}
 }
-
-#if 0	/* This never got working, but we should do it some day... */
-#if defined(SUNOS40) || defined(SUNOS41) || defined(CMOS)
-
-/*
-** Transfer a local core file to a remote machine.
-*/
-send_core( local, remote, mode )
-char	*local;
-char	*remote;
-int		mode;
-{
-	int		scm;
-	int		remote_fd, local_fd;
-	int		answer;
-	char	buf[4096];
-	int		nbytes;
-	int		count = 0;
-	double	start, finish;
-
-	struct core core;
-	struct stat status;
-	char	buf2[PAGSIZ];
-	int		realStackSize, stackOffset;
-	int		read_err = 0;		/* error found if any */
-	int		write_err = 0;		/* error found if any */
-	int		bytes_to_go;
-	int		len;
-	int		ck = 0;
-
-
-	dprintf( D_ALWAYS, "Entering send_core( %s, %s, 0%o )\n",local,remote,mode);
-
-	remote_fd = try_via_nfs( remote, O_WRONLY|O_CREAT|O_TRUNC, mode );
-	if( remote_fd < 0 ) {
-		dprintf( D_ALWAYS, "Transferring file via CONDOR_send_core\n" );
-		answer =  REMOTE_syscall( CONDOR_send_core, local, remote, mode );
-		return answer;
-	}
-
-
-	dprintf( D_ALWAYS, "Transferring file via NFS\n" );
-	scm = SetSyscalls( SYS_LOCAL | SYS_RECORDED );
-
-	start = get_time();
-
-
-	if( (local_fd=open(local,O_RDONLY,0)) < 0 ) {
-		dprintf( D_FULLDEBUG, "Failed to open \"%s\" locally, errno = %d\n",
-														local, errno);
-		(void)SetSyscalls( scm );
-		return -1;
-	}
-
-	ck = read(local_fd, (char *) &core, sizeof(core)) != sizeof(core);
-	ck = (write(remote_fd, (char *) &core, sizeof(core)) != sizeof(core)) || ck;
-	if (ck)
-		dprintf(D_ALWAYS, "Error copy core\n");
-	else
-		dprintf(D_ALWAYS, "Done copy core\n");
-
-	for (bytes_to_go = core.c_dsize; !read_err && !write_err && bytes_to_go;
-			bytes_to_go -= len) {
-		len = bytes_to_go < sizeof(buf) ? bytes_to_go : sizeof(buf);
-		if (read(local_fd, buf, len) != len) {
-			read_err = 1;
-			break;
-		}
-		if (write(remote_fd, buf, len) != len) {
-			write_err = 1;
-			break;
-		}
-	}
-	if (!read_err && !write_err)
-		dprintf(D_ALWAYS, "Done copy data area\n");
-	else
-		dprintf(D_ALWAYS, "Error copy data area\n");
-
-
-	/*
-	 *  Find the stackOffset and realStackSize
-	 */
-	lstat(local, &status);
-	realStackSize = status.st_blocks * DEV_BSIZE -
-			(status.st_size - core.c_ssize);
-
-	/* lseek to the estimate bottom of real stack area */
-	lseek(local_fd, -2 * PAGSIZ - realStackSize, L_XTND);
-
-	/* read upward and shrink the real stack size to get a closer value */
-	for ( ; realStackSize > 0; realStackSize -= PAGSIZ) {
-		if (read(local_fd, buf2, sizeof(buf2)) != sizeof(buf2) ) {
-			EXCEPT("read(local_fd %d, buf2 0x%x, %d)",
-					local_fd, buf2, sizeof(buf2));
-		}
-		if (!is_zero(buf2, sizeof(buf2)))
-			break;
-	}
-	stackOffset = core.c_ssize - realStackSize;
-
-	/* local_fd is already at the right place after above operation */
-    lseek(remote_fd, stackOffset, L_INCR);
-
-	/* now do the rest of the copying */
-	for (bytes_to_go = realStackSize; !read_err && !write_err && bytes_to_go;
-			bytes_to_go -= len) {
-		len = bytes_to_go < sizeof(buf) ? bytes_to_go : sizeof(buf);
-		if (read(local_fd, buf, len) != len) {
-			read_err = 1;
-			break;
-		}
-		if (write(remote_fd, buf, len) != len) {
-			write_err = 1;
-			break;
-		}
-	}
-	dprintf(D_ALWAYS, "-Done copy stack area\n");
-	dprintf(D_ALWAYS, "status.st_size = %d, lseek = %d\n", status.st_size,
-			lseek(local_fd, 0, L_XTND));
-	lseek(remote_fd, status.st_size, L_SET);
-
-
-	(void)close( local_fd );
-	(void)close( remote_fd );
-	finish = get_time();
-
-	if( read_err ) {
-		dprintf(D_ALWAYS, "Can't read fd %d, errno = %d\n", local_fd, errno );
-	}
-	if( write_err ) {
-		dprintf(D_ALWAYS, "Can't write fd %d, errno = %d\n", remote_fd, errno );
-	}
-	if( !read_err && !write_err ) {
-		dprintf(D_ALWAYS,"Send_file() transferred %d bytes, %f bytes/second\n",
-										count, count / (finish - start) );
-	}
-
-	(void)SetSyscalls( scm );
-	if (read_err || write_err)
-		return -1;
-	return 0;
-}
-#endif defined(SUNOS40) || defined(SUNOS41) || defined(CMOS)
 #endif
-
-
-#define MATCH	0 /* for strcmp */
-
-int
-try_via_afs( remote, mode, perm )
-char *remote;
-int mode;
-int perm;
-{
-	int		fd;
-
-	if( strncmp("/afs",remote,4) != MATCH ) {
-		return -1;
-	}
-
-	if( (fd = open(remote,mode,perm)) < 0 ) {
-		dprintf( D_ALWAYS, "\"%s\" is an AFS file, but open failed\n", remote );
-		return -1;
-	}
-
-	dprintf( D_ALWAYS, "Opened \"%s\" via AFS\n", remote );
-	return fd;
-}


Fix cosmetic bug in stale copy of msync_args.  'len' is size_t, not int.

--- sys/vm/vm_mmap.c
+++ sys/vm/vm_mmap.c
@@ -463,7 +463,7 @@
 #ifndef _SYS_SYSPROTO_H_
 struct msync_args {
 	void *addr;
-	int len;
+	size_t len;
 	int flags;
 };
 #endif


Fix objc import

Fix objc import

--- Nimble_Snapshots/Nimble_Snapshots.h
+++ Nimble_Snapshots/Nimble_Snapshots.h
@@ -8,4 +8,4 @@

 // In this header, you should import all the public headers of your framework using statements like #import <Nimble_Snapshots/PublicHeader.h>

-#import <Nimble_Snapshots/NBSMockedApplication.h>
+#import "NBSMockedApplication.h"


omxh264enc: Add support for setting profile/level via caps

--- omx/gstomxh264enc.c
+++ omx/gstomxh264enc.c
@@ -101,6 +101,107 @@
 gst_omx_h264_enc_set_format (GstOMXVideoEnc * enc, GstOMXPort * port,
     GstVideoState * state)
 {
+  GstOMXH264Enc *self = GST_OMX_H264_ENC (enc);
+  GstCaps *peercaps;
+  OMX_VIDEO_AVCPROFILETYPE profile = OMX_VIDEO_AVCProfileBaseline;
+  OMX_VIDEO_AVCLEVELTYPE level = OMX_VIDEO_AVCLevel11;
+
+  peercaps = gst_pad_peer_get_caps (GST_BASE_VIDEO_CODEC_SRC_PAD (enc));
+  if (peercaps) {
+    GstStructure *s;
+    GstCaps *intersection;
+    const gchar *profile_string, *level_string;
+    OMX_VIDEO_PARAM_PROFILELEVELTYPE param;
+    OMX_ERRORTYPE err;
+
+    intersection =
+        gst_caps_intersect (peercaps,
+        gst_pad_get_pad_template_caps (GST_BASE_VIDEO_CODEC_SRC_PAD (enc)));
+    gst_caps_unref (peercaps);
+    if (gst_caps_is_empty (intersection)) {
+      gst_caps_unref (intersection);
+      GST_ERROR_OBJECT (self, "Empty caps");
+      return FALSE;
+    }
+
+    s = gst_caps_get_structure (intersection, 0);
+    profile_string = gst_structure_get_string (s, "profile");
+    if (profile_string) {
+      if (g_str_equal (profile_string, "baseline")) {
+        profile = OMX_VIDEO_AVCProfileBaseline;
+      } else if (g_str_equal (profile_string, "main")) {
+        profile = OMX_VIDEO_AVCProfileMain;
+      } else if (g_str_equal (profile_string, "extended")) {
+        profile = OMX_VIDEO_AVCProfileExtended;
+      } else if (g_str_equal (profile_string, "high")) {
+        profile = OMX_VIDEO_AVCProfileHigh;
+      } else if (g_str_equal (profile_string, "high-10")) {
+        profile = OMX_VIDEO_AVCProfileHigh10;
+      } else if (g_str_equal (profile_string, "high-4:2:2")) {
+        profile = OMX_VIDEO_AVCProfileHigh422;
+      } else if (g_str_equal (profile_string, "high-4:4:4")) {
+        profile = OMX_VIDEO_AVCProfileHigh444;
+      } else {
+        GST_ERROR_OBJECT (self, "Unsupported profile %s", profile_string);
+        return FALSE;
+      }
+    }
+    level_string = gst_structure_get_string (s, "level");
+    if (level_string) {
+      if (g_str_equal (level_string, "1")) {
+        level = OMX_VIDEO_AVCLevel1;
+      } else if (g_str_equal (level_string, "1b")) {
+        level = OMX_VIDEO_AVCLevel1b;
+      } else if (g_str_equal (level_string, "1.1")) {
+        level = OMX_VIDEO_AVCLevel11;
+      } else if (g_str_equal (level_string, "1.2")) {
+        level = OMX_VIDEO_AVCLevel12;
+      } else if (g_str_equal (level_string, "1.3")) {
+        level = OMX_VIDEO_AVCLevel13;
+      } else if (g_str_equal (level_string, "2")) {
+        level = OMX_VIDEO_AVCLevel2;
+      } else if (g_str_equal (level_string, "2.1")) {
+        level = OMX_VIDEO_AVCLevel21;
+      } else if (g_str_equal (level_string, "2.2")) {
+        level = OMX_VIDEO_AVCLevel22;
+      } else if (g_str_equal (level_string, "3")) {
+        level = OMX_VIDEO_AVCLevel3;
+      } else if (g_str_equal (level_string, "3.1")) {
+        level = OMX_VIDEO_AVCLevel31;
+      } else if (g_str_equal (level_string, "3.2")) {
+        level = OMX_VIDEO_AVCLevel32;
+      } else if (g_str_equal (level_string, "4")) {
+        level = OMX_VIDEO_AVCLevel4;
+      } else if (g_str_equal (level_string, "4.1")) {
+        level = OMX_VIDEO_AVCLevel41;
+      } else if (g_str_equal (level_string, "4.2")) {
+        level = OMX_VIDEO_AVCLevel42;
+      } else if (g_str_equal (level_string, "5")) {
+        level = OMX_VIDEO_AVCLevel5;
+      } else if (g_str_equal (level_string, "5.1")) {
+        level = OMX_VIDEO_AVCLevel51;
+      } else {
+        GST_ERROR_OBJECT (self, "Unsupported level %s", level_string);
+        return FALSE;
+      }
+    }
+
+    GST_OMX_INIT_STRUCT (&param);
+    param.nPortIndex = GST_OMX_VIDEO_ENC (self)->out_port->index;
+    param.eProfile = profile;
+    param.eLevel = level;
+
+    err =
+        gst_omx_component_set_parameter (GST_OMX_VIDEO_ENC (self)->component,
+        OMX_IndexParamVideoProfileLevelCurrent, &param);
+    if (err != OMX_ErrorNone) {
+      GST_ERROR_OBJECT (self,
+          "Error setting profile %d and level %d: %s (0x%08x)", profile, level,
+          gst_omx_error_to_string (err), err);
+      return FALSE;
+    }
+  }
+
   return TRUE;
 }

@@ -108,11 +209,106 @@
 gst_omx_h264_enc_get_caps (GstOMXVideoEnc * enc, GstOMXPort * port,
     GstVideoState * state)
 {
+  GstOMXH264Enc *self = GST_OMX_H264_ENC (enc);
   GstCaps *caps;
+  OMX_ERRORTYPE err;
+  OMX_VIDEO_PARAM_PROFILELEVELTYPE param;
+  const gchar *profile, *level;
+
+  GST_OMX_INIT_STRUCT (&param);
+  param.nPortIndex = GST_OMX_VIDEO_ENC (self)->out_port->index;
+
+  err =
+      gst_omx_component_get_parameter (GST_OMX_VIDEO_ENC (self)->component,
+      OMX_IndexParamVideoProfileLevelCurrent, &param);
+  if (err != OMX_ErrorNone)
+    return NULL;
+
+  switch (param.eProfile) {
+    case OMX_VIDEO_AVCProfileBaseline:
+      profile = "baseline";
+      break;
+    case OMX_VIDEO_AVCProfileMain:
+      profile = "main";
+      break;
+    case OMX_VIDEO_AVCProfileExtended:
+      profile = "extended";
+      break;
+    case OMX_VIDEO_AVCProfileHigh:
+      profile = "high";
+      break;
+    case OMX_VIDEO_AVCProfileHigh10:
+      profile = "high-10";
+      break;
+    case OMX_VIDEO_AVCProfileHigh422:
+      profile = "high-4:2:2";
+      break;
+    case OMX_VIDEO_AVCProfileHigh444:
+      profile = "high-4:4:4";
+      break;
+    default:
+      g_assert_not_reached ();
+      break;
+  }
+
+  switch (param.eLevel) {
+    case OMX_VIDEO_AVCLevel1:
+      level = "1";
+      break;
+    case OMX_VIDEO_AVCLevel1b:
+      level = "1b";
+      break;
+    case OMX_VIDEO_AVCLevel11:
+      level = "1.1";
+      break;
+    case OMX_VIDEO_AVCLevel12:
+      level = "1.2";
+      break;
+    case OMX_VIDEO_AVCLevel13:
+      level = "1.3";
+      break;
+    case OMX_VIDEO_AVCLevel2:
+      level = "2";
+      break;
+    case OMX_VIDEO_AVCLevel21:
+      level = "2.1";
+      break;
+    case OMX_VIDEO_AVCLevel22:
+      level = "2.2";
+      break;
+    case OMX_VIDEO_AVCLevel3:
+      level = "3";
+      break;
+    case OMX_VIDEO_AVCLevel31:
+      level = "3.1";
+      break;
+    case OMX_VIDEO_AVCLevel32:
+      level = "3.2";
+      break;
+    case OMX_VIDEO_AVCLevel4:
+      level = "4";
+      break;
+    case OMX_VIDEO_AVCLevel41:
+      level = "4.1";
+      break;
+    case OMX_VIDEO_AVCLevel42:
+      level = "4.2";
+      break;
+    case OMX_VIDEO_AVCLevel5:
+      level = "5";
+      break;
+    case OMX_VIDEO_AVCLevel51:
+      level = "5.1";
+      break;
+    default:
+      g_assert_not_reached ();
+      break;
+  }

   caps =
       gst_caps_new_simple ("video/x-h264", "width", G_TYPE_INT, state->width,
-      "height", G_TYPE_INT, state->height, NULL);
+      "height", G_TYPE_INT, state->height,
+      "profile", G_TYPE_STRING, profile, "level", G_TYPE_STRING, level, NULL);

   if (state->fps_n != 0)
     gst_caps_set_simple (caps, "framerate", GST_TYPE_FRACTION, state->fps_n,


Cleaned up Integrators.h and added MIT license. Cleaned up GaussLegendre.h and added MIT license.

--- Quad1D/GaussLegendre.h
+++ Quad1D/GaussLegendre.h
@@ -1,4 +1,29 @@
 #pragma once
+/*////////////////////////////////////////////////////////////////////////////
+GaussLegendre.h
+
+Generates Gauss-Legendre quadratures.
+
+Copyright 2017 HJA Bird
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/////////////////////////////////////////////////////////////////////////////

 #include <cmath>
 #include <array>
@@ -9,7 +34,8 @@

 	// DECLARATIONS
 	template <typename Ty, typename TyStor>
-	constexpr void gauss_legendre(int n_points, TyStor & points, TyStor & weights);
+	constexpr void gauss_legendre(int n_points, TyStor & points,
+												TyStor & weights);

 	template <int n_points, typename Ty>
 	constexpr void gauss_legendre(std::array<Ty, n_points> & points,
@@ -19,8 +45,10 @@
 	// DEFINITIONS

 	/// \param n_points number of guass points desired
-	/// \param points an indexable container of Ty - Gauss points written here
-	/// \param weights an indexable container of Ty -  Weights of points written here
+	/// \param points an indexable container of Ty -
+	/// Gauss points written here
+	/// \param weights an indexable container of Ty -
+	/// Weights of points written here
 	///
 	/// \brief generate gauss legendre quadrature
 	///
@@ -31,10 +59,13 @@
 	/// weights.resize(3);
 	/// Quad1D::gauss_legendre<double>(3, points, weights);
 	/// \endcode
-	/// points and weights now contain the coordinates and weights of a GL quadrature.
-	/// Not it is the responsibiltiy of the user to ensure the containers are large enough.
+	/// points and weights now contain the coordinates and weights of a
+	/// GL quadrature.
+	/// Not it is the responsibiltiy of the user to ensure the containers
+	/// are large enough.
 	///
-	/// It may be that points and weights are different but can be cast to an appropriate type.
+	/// It may be that points and weights are different but can be cast
+	/// to an appropriate type.
 	/// \code
 	/// My_typeA points;
 	/// My_typeB weights;
@@ -43,7 +74,8 @@
 	/// Quad1D::gauss_legendre<double>(3, points, (My_typeB) weights);
 	/// \endcode
 	template <typename Ty, typename TyStor>
-	constexpr void gauss_legendre(int n_points, TyStor & points, TyStor & weights)
+	constexpr void gauss_legendre(int n_points, TyStor & points,
+												TyStor & weights)
 	{
 		Ty m;
 		Ty z, z1;
@@ -81,23 +113,29 @@
 	}

-	/// \param points std::array of Ty, length n_ponts - Gauss points written here
-	/// \param weights std::array of Ty, length n_ponts-  Weights of points written here
+	/// \param points std::array of Ty, length n_ponts -
+	/// Gauss points written here
+	/// \param weights std::array of Ty, length n_ponts-
+	/// Weights of points written here
 	///
-	/// \brief generate gauss legendre quadrature - likely to be evaluated at compile time.
+	/// \brief generate gauss legendre quadrature - likely to be evaluated
+	/// at compile time.
 	///
 	/// Generates points and weights for a gauss legendre quadrature.
 	/// \code
 	/// std::array<double, 100> p, w;
 	/// Quad1D::gauss_legendre<100, double>(p, w);
 	/// \endcode
-	/// p now contians quadrature points, and w weights. This code should be optimised away
-	/// such that the solution is precalcuated at compile time.
+	/// p now contians quadrature points, and w weights. This code
+	/// should be optimised away such that the solution is precalcuated
+	/// at compile time.
 	template <int n_points, typename Ty>
-	constexpr void gauss_legendre(std::array<Ty, n_points> & points, std::array<Ty, n_points> & weights)
+	constexpr void gauss_legendre(std::array<Ty, n_points> & points,
+								  std::array<Ty, n_points> & weights)
 	{
 		static_assert(n_points > 0);
-		gauss_legendre < Ty, std::array<Ty, n_points>>(n_points, points, weights);
+		gauss_legendre < Ty, std::array<Ty, n_points>>(n_points, points,
+																weights);
 	}


[#6763] Fix SPARC arithmetic error in ASR handling.

--- arch/sparc/cpu_registers.c
+++ arch/sparc/cpu_registers.c
@@ -29,7 +29,7 @@
         case R_0_32 ... R_7_32: /* R0-R7 aka Global0-7 */
             return &(cpu->gregs[reg]);
         case R_8_32 ... R_31_32: /* R8 to 31 : Out0-7, Local0-7, In0-7 */
-            return &(cpu->regwptr[reg-8]);
+            return &(cpu->regwptr[reg-R_8_32]);
         case PSR_32:
                 /* Compute PSR before exposing state.  */
                 if (cpu->cc_op != CC_OP_FLAGS) {
@@ -45,7 +45,7 @@
         case NPC_32:
             return &(cpu->npc);
         case ASR_16_32 ... ASR_31_32:
-            return &(cpu->asr[reg-527]);
+            return &(cpu->asr[reg-ASR_16_32]);
         case WIM_32:
             return &(cpu->wim);
         default:


fixed some warnings in IO

fixed some warnings in IO

--- include/readdy/io/bits/DataSet_bits.h
+++ include/readdy/io/bits/DataSet_bits.h
@@ -114,8 +114,16 @@
             H5Eprint (H5Eget_current_stack(), stderr);
         }
         memorySpace = -1;
-        H5Pclose(plist);
-        H5Pclose(fileSpace);
+        if(plist >= 0 && H5Pclose(plist) < 0) {
+            log::console()->error("Error on closing plist {}", plist);
+            H5Eprint (H5Eget_current_stack(), stderr);
+            throw std::runtime_error("Error on closing plist " + std::to_string(plist));
+        }
+        if(fileSpace >= 0 && H5Sclose(fileSpace) < 0) {
+            log::console()->error("Error on closing file space {}", fileSpace);
+            H5Eprint (H5Eget_current_stack(), stderr);
+            throw std::runtime_error("(constructor) Error on closing file space " + std::to_string(fileSpace));
+        }
     }
 }

@@ -154,7 +162,11 @@
         currentExtent.resize(dims.size());
         auto fileSpace = H5Dget_space(dataSetHandle);
         H5Sget_simple_extent_dims(fileSpace, currentExtent.data(), nullptr);
-        H5Dclose(fileSpace);
+        if(fileSpace >= 0 && H5Sclose(fileSpace) < 0) {
+            log::console()->error("error on closing file space! {}", fileSpace);
+            H5Eprint (H5Eget_current_stack(), stderr);
+            throw std::runtime_error("error on closing file space!");
+        }
     }
     std::vector<h5::dims_t> offset;
     {
@@ -230,7 +242,11 @@
         {
             auto fileSpace = H5Dget_space(dataSetHandle);
             H5Sget_simple_extent_dims(fileSpace, currentExtent.data(), nullptr);
-            H5Dclose(fileSpace);
+            if(fileSpace >= 0 && H5Sclose(fileSpace) < 0) {
+                log::console()->error("error on closing file space! {}", fileSpace);
+                H5Eprint (H5Eget_current_stack(), stderr);
+                throw std::runtime_error("error on closing file space!");
+            }
         }
     }
     offset[extensionDim] = currentExtent[extensionDim];


When vm_mmap() is used to map a vm object into a kernel vm_map, it
makes no sense to check the size of the kernel vm_map against the
user-level resource limits for the calling process.

Reviewed by:	kib

--- sys/vm/vm_mmap.c
+++ sys/vm/vm_mmap.c
@@ -1438,18 +1438,18 @@

 	size = round_page(size);

-	PROC_LOCK(td->td_proc);
-	if (td->td_proc->p_vmspace->vm_map.size + size >
-	    lim_cur(td->td_proc, RLIMIT_VMEM)) {
+	if (map == &td->td_proc->p_vmspace->vm_map) {
+		PROC_LOCK(td->td_proc);
+		if (map->size + size > lim_cur(td->td_proc, RLIMIT_VMEM)) {
+			PROC_UNLOCK(td->td_proc);
+			return (ENOMEM);
+		}
+		if (racct_set(td->td_proc, RACCT_VMEM, map->size + size)) {
+			PROC_UNLOCK(td->td_proc);
+			return (ENOMEM);
+		}
 		PROC_UNLOCK(td->td_proc);
-		return (ENOMEM);
-	}
-	if (racct_set(td->td_proc, RACCT_VMEM,
-	    td->td_proc->p_vmspace->vm_map.size + size)) {
-		PROC_UNLOCK(td->td_proc);
-		return (ENOMEM);
-	}
-	PROC_UNLOCK(td->td_proc);
+	}

 	/*
 	 * We currently can only deal with page aligned file offsets.


omxh264enc: fix typo in 'set_avc_intra_period'

https://bugzilla.gnome.org/show_bug.cgi?id=784379

--- omx/gstomxh264enc.c
+++ omx/gstomxh264enc.c
@@ -376,7 +376,7 @@
 }

 static gboolean
-set_avc_intra_perdiod (GstOMXH264Enc * self)
+set_avc_intra_period (GstOMXH264Enc * self)
 {
   OMX_VIDEO_CONFIG_AVCINTRAPERIOD config_avcintraperiod;
   OMX_ERRORTYPE err;
@@ -518,7 +518,7 @@
       GST_OMX_H264_VIDEO_ENC_PERIODICITY_OF_IDR_FRAMES_DEFAULT
       || self->interval_intraframes !=
       GST_OMX_H264_VIDEO_ENC_INTERVAL_OF_CODING_INTRA_FRAMES_DEFAULT) {
-    set_avc_intra_perdiod (self);
+    set_avc_intra_period (self);
   }
 #ifdef USE_OMX_TARGET_RPI
   /* The Pi uses a specific OMX setting to configure the intra period */


tile: fix some issues in hugepage support

First, in huge_pte_offset(), we were erroneously checking
pgd_present(), which is always true, rather than pud_present(),
which is the thing that tells us if there is a top-level (L0) PTE.
Fixing this means we properly look up huge page entries only when
the Present bit is actually set in the PTE.

Second, use the standard pte_alloc_map() instead of the hand-rolled
pte_alloc_hugetlb() routine that basically was written to avoid
worrying about CONFIG_HIGHPTE.  However, we no longer plan to support
HIGHPTE, so a separate routine was just unnecessary code duplication.

Signed-off-by: Chris Metcalf <074881f6f5da4d3b5278870ff234d1077ee622c0@tilera.com>

--- arch/tile/mm/hugetlbpage.c
+++ arch/tile/mm/hugetlbpage.c
@@ -49,38 +49,6 @@
 #endif
 };

-/*
- * This routine is a hybrid of pte_alloc_map() and pte_alloc_kernel().
- * It assumes that L2 PTEs are never in HIGHMEM (we don't support that).
- * It locks the user pagetable, and bumps up the mm->nr_ptes field,
- * but otherwise allocate the page table using the kernel versions.
- */
-static pte_t *pte_alloc_hugetlb(struct mm_struct *mm, pmd_t *pmd,
-				unsigned long address)
-{
-	pte_t *new;
-
-	if (pmd_none(*pmd)) {
-		new = pte_alloc_one_kernel(mm, address);
-		if (!new)
-			return NULL;
-
-		smp_wmb(); /* See comment in __pte_alloc */
-
-		spin_lock(&mm->page_table_lock);
-		if (likely(pmd_none(*pmd))) {  /* Has another populated it ? */
-			mm->nr_ptes++;
-			pmd_populate_kernel(mm, pmd, new);
-			new = NULL;
-		} else
-			VM_BUG_ON(pmd_trans_splitting(*pmd));
-		spin_unlock(&mm->page_table_lock);
-		if (new)
-			pte_free_kernel(mm, new);
-	}
-
-	return pte_offset_kernel(pmd, address);
-}
 #endif

 pte_t *huge_pte_alloc(struct mm_struct *mm,
@@ -109,7 +77,7 @@
 		else {
 			if (sz != PAGE_SIZE << huge_shift[HUGE_SHIFT_PAGE])
 				panic("Unexpected page size %#lx\n", sz);
-			return pte_alloc_hugetlb(mm, pmd, addr);
+			return pte_alloc_map(mm, NULL, pmd, addr);
 		}
 	}
 #else
@@ -144,14 +112,14 @@

 	/* Get the top-level page table entry. */
 	pgd = (pgd_t *)get_pte((pte_t *)mm->pgd, pgd_index(addr), 0);
-	if (!pgd_present(*pgd))
-		return NULL;

 	/* We don't have four levels. */
 	pud = pud_offset(pgd, addr);
 #ifndef __PAGETABLE_PUD_FOLDED
 # error support fourth page table level
 #endif
+	if (!pud_present(*pud))
+		return NULL;

 	/* Check for an L0 huge PTE, if we have three levels. */
 #ifndef __PAGETABLE_PMD_FOLDED


fix gcc error: can't convert optional to bool

--- include/sleepy_discord/json_wrapper.h
+++ include/sleepy_discord/json_wrapper.h
@@ -554,7 +554,7 @@
 				return TypeHelper<typename Optional::value_type>::fromType(*value, allocator);
 			}
 			static inline bool empty(const Optional& value) {
-				return bool{ value };
+				return value.has_value();
 			}
 			static inline bool isType(const Value& value) {
 				 return TypeHelper<typename Optional::value_type>::isType(value);
@@ -578,7 +578,7 @@
 				}
 			}
 			static inline bool empty(const Nullable& value) {
-				return bool{ value };
+				return value.has_value();
 			}
 			static inline bool isType(const Value& value) {
 				return value.IsNull() || TypeHelper<typename Nullable::value_type>::isType(value);


Assert that the containing object is locked in vm_page_io_start() and vm_page_io_finish().  The motivation being to transition synchronization of the vm_page's busy field from the global page queues lock to the per-object lock.

--- sys/vm/vm_page.c
+++ sys/vm/vm_page.c
@@ -335,6 +335,7 @@
 vm_page_io_start(vm_page_t m)
 {

+	VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
 	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
 	m->busy++;
 }
@@ -343,6 +344,7 @@
 vm_page_io_finish(vm_page_t m)
 {

+	VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
 	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
 	m->busy--;
 	if (m->busy == 0)


For more history, use git log -- dummyin6.c ../../../ccnd/lib/getaddrinfo/dummyin6.c

--- src/contrib/getaddrinfo/dummyin6.c
+++ src/contrib/getaddrinfo/dummyin6.c
@@ -61,3 +61,4 @@
 #ifndef IN6ADDR_LOOPBACK_DECLARED
 const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT;
 #endif
+


net: http: Fix HTTP_DATA_FINAL notification

HTTP_DATA_FINAL was incorrectly notified in case Content Length field
was present in the HTTP respone - in such case it was set for every
response fragment, not only the last one.

Fix this by relying on `message_complete` flag instead of
`http_should_keep_alive()` function to determine whether to notify
HTTP_DATA_FINAL or not. As the HTTP parser calls the
`on_message_complete()` callback in either case (response is chunked or
not), this seems to be a more reasonable apporach to determine whether
the fragment is final or not.

Additinally, instead of calling response callback for
`on_body`/`on_message_complete` separately, call it directly from
`http_wait_data()` function, after the parsing round. This fixes the
case when headers were not reported correctly when the provided buffer
was smaller than the total headers length, resulting in corrupted data
being reported to the user.

Signed-off-by: Robert Lubos <9d28997c6894a2d0321a7bb399169af7ce99b64e@nordicsemi.no>

--- subsys/net/lib/http/http_client.c
+++ subsys/net/lib/http/http_client.c
@@ -269,28 +269,6 @@
 		req->internal.response.body_start = (uint8_t *)at;
 	}

-	if (req->internal.response.cb) {
-		if (http_should_keep_alive(parser)) {
-			NET_DBG("Calling callback for partitioned %zd len data",
-				req->internal.response.data_len);
-
-			req->internal.response.cb(&req->internal.response,
-						  HTTP_DATA_MORE,
-						  req->internal.user_data);
-		} else {
-			NET_DBG("Calling callback for %zd len data",
-				req->internal.response.data_len);
-
-			req->internal.response.cb(&req->internal.response,
-						  HTTP_DATA_FINAL,
-						  req->internal.user_data);
-		}
-
-		/* Re-use the result buffer and start to fill it again */
-		req->internal.response.data_len = 0;
-		req->internal.response.body_start = NULL;
-	}
-
 	return 0;
 }

@@ -353,12 +331,6 @@
 		http_method_str(req->method));

 	req->internal.response.message_complete = 1;
-
-	if (req->internal.response.cb) {
-		req->internal.response.cb(&req->internal.response,
-					  HTTP_DATA_FINAL,
-					  req->internal.user_data);
-	}

 	return 0;
 }
@@ -416,12 +388,21 @@

 	do {
 		received = zsock_recv(sock, req->internal.response.recv_buf + offset,
-				req->internal.response.recv_buf_len - offset,
-				0);
+				      req->internal.response.recv_buf_len - offset,
+				      0);
 		if (received == 0) {
 			/* Connection closed */
 			LOG_DBG("Connection closed");
 			ret = total_received;
+
+			if (req->internal.response.cb) {
+				NET_DBG("Calling callback for closed connection");
+
+				req->internal.response.cb(&req->internal.response,
+							  HTTP_DATA_FINAL,
+							  req->internal.user_data);
+			}
+
 			break;
 		} else if (received < 0) {
 			/* Socket error */
@@ -445,6 +426,35 @@
 			offset = 0;
 		}

+		if (req->internal.response.cb) {
+			bool notify = false;
+			enum http_final_call event;
+
+			if (req->internal.response.message_complete) {
+				NET_DBG("Calling callback for %zd len data",
+					req->internal.response.data_len);
+
+				notify = true;
+				event = HTTP_DATA_FINAL;
+			} else if (offset == 0) {
+				NET_DBG("Calling callback for partitioned %zd len data",
+					req->internal.response.data_len);
+
+				notify = true;
+				event = HTTP_DATA_MORE;
+			}
+
+			if (notify) {
+				req->internal.response.cb(&req->internal.response,
+							  event,
+							  req->internal.user_data);
+
+				/* Re-use the result buffer and start to fill it again */
+				req->internal.response.data_len = 0;
+				req->internal.response.body_start = NULL;
+			}
+		}
+
 		if (req->internal.response.message_complete) {
 			ret = total_received;
 			break;


x86/fpu: Optimize fpu__activate_fpstate_read()

fpu__activate_fpstate_read() is used before FPU registers are
read from the fpstate by ptrace and core dumping.

It's not necessary to unlazy non-current child tasks in this case,
since the reading of registers is non-destructive.

Cc: Andy Lutomirski <2cc0d0d76de2e6f37b92deeb83c85cb306fc5dc1@amacapital.net>
Cc: Bobby Powers <ab5c1f9fe62b73e39ab6f9824010ebb63b35f2c7@gmail.com>
Cc: Borislav Petkov <0691a664b24b6f15b20cd5aee64b72271db08be1@alien8.de>
Cc: Dave Hansen <71bcd3d88361b22cd828f9a350d19d8775f56d4e@linux.intel.com>
Cc: Fenghua Yu <94fe9a7ec8ff966c1952fe98e39b5ae3a7477695@intel.com>
Cc: H. Peter Anvin <8a453bad9912ffe59bc0f0b8abe03df9be19379e@zytor.com>
Cc: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>
Cc: Oleg Nesterov <20b70f0af00562e63758b9ee42012ecc96c58590@redhat.com>
Cc: Thomas Gleixner <00e4cf8f46a57000a44449bf9dd8cbbcc209fd2a@linutronix.de>
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@kernel.org>

--- arch/x86/kernel/fpu/core.c
+++ arch/x86/kernel/fpu/core.c
@@ -312,10 +312,7 @@
 	if (fpu->fpregs_active) {
 		fpu__save(fpu);
 	} else {
-		if (fpu->fpstate_active) {
-			/* Invalidate any lazy state: */
-			fpu->last_cpu = -1;
-		} else {
+		if (!fpu->fpstate_active) {
 			fpstate_init(&fpu->state);

 			/* Safe to do for current and for stopped child tasks: */


try reading unhinted blocks from write_pool cache

git-svn-id: 4e7379b20b57f8e3dde5a0b7363f233184647162@1710 4e380d45-d1fd-0310-85a7-d18ec86df0ad

--- include/stxxl/bits/containers/queue.h
+++ include/stxxl/bits/containers/queue.h
@@ -214,7 +214,7 @@
             STXXL_VERBOSE1("queue::pop Case 5");

             assert(!bids.empty());
-            request_ptr req = p_pool->read(front_block, bids.front());
+            request_ptr req = p_pool->read(front_block, bids.front(), *w_pool);
             STXXL_VERBOSE_QUEUE("queue[" << this << "]: pop block  " << front_block << " @ " << FMT_BID(bids.front()));
             for (unsigned_type i = 0; i < blocks2prefetch && i < bids.size() - 1; ++i)
             {             // give prefetching hints


Correct a comment.

Correct a comment.

--- sys/vm/vm_page.c
+++ sys/vm/vm_page.c
@@ -258,7 +258,7 @@
 	    MTX_DEF);

 	/*
-	 * Initialize the queue headers for the free queue, the active queue
+	 * Initialize the queue headers for the hold queue, the active queue,
 	 * and the inactive queue.
 	 */
 	vm_pageq_init();


Sync with pool removeal from svn_client_auth_baton_t.

* client.c

(free_cl): Remove reference to pool in auth baton.
(cl_new): Ditto.

git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@840917 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/bindings/ruby/client.c
+++ subversion/bindings/ruby/client.c
@@ -63,7 +63,6 @@
 {
   svn_client_auth_baton_t *auth_baton = p;

-  apr_pool_destroy (auth_baton->pool);
   free (auth_baton);
 }

@@ -76,7 +75,6 @@
   rb_scan_args (argc, argv, "00&", &auth);
   obj = Data_Make_Struct (class, svn_client_auth_baton_t, 0, free_cl,
                           auth_baton);
-  auth_baton->pool = svn_pool_create (NULL);
   auth_baton->prompt_callback = cl_prompt;
   auth_baton->prompt_baton = (void *) auth;
   rb_iv_set (obj, "@auth", auth);


x86/fpu: Do system-wide setup from fpu__detect()

fpu__cpu_init() is called on every CPU, so it is the wrong place
to call fpu__init_system() from. Call it from fpu__detect():
this is early CPU init code, but we already have CPU features detected,
so we can call the system-wide FPU init code from here.

Reviewed-by: Borislav Petkov <0691a664b24b6f15b20cd5aee64b72271db08be1@alien8.de>
Cc: Andy Lutomirski <2cc0d0d76de2e6f37b92deeb83c85cb306fc5dc1@amacapital.net>
Cc: Dave Hansen <71bcd3d88361b22cd828f9a350d19d8775f56d4e@linux.intel.com>
Cc: Fenghua Yu <94fe9a7ec8ff966c1952fe98e39b5ae3a7477695@intel.com>
Cc: H. Peter Anvin <8a453bad9912ffe59bc0f0b8abe03df9be19379e@zytor.com>
Cc: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>
Cc: Oleg Nesterov <20b70f0af00562e63758b9ee42012ecc96c58590@redhat.com>
Cc: Peter Zijlstra <3fddac958924aef220f202ca567388ddab3f14a8@infradead.org>
Cc: Thomas Gleixner <00e4cf8f46a57000a44449bf9dd8cbbcc209fd2a@linutronix.de>
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@kernel.org>

--- arch/x86/kernel/fpu/init.c
+++ arch/x86/kernel/fpu/init.c
@@ -245,7 +245,6 @@
 void fpu__cpu_init(void)
 {
 	fpu__init_cpu();
-	fpu__init_system();
 }

 static int __init no_387(char *s)
@@ -279,5 +278,6 @@
 	else
 		clear_cpu_cap(c, X86_FEATURE_FPU);

+	fpu__init_system();
 	/* The final cr0 value is set later, in fpu_init() */
 }


Don't bail reading a metadata instance if swift_isaMask isn't available

This symbol is conditionally emitted based on whether there is an isa
mask for the platform. For 32-bit embedded platforms, this symbol
isn't present.

--- include/swift/Remote/MetadataReader.h
+++ include/swift/Remote/MetadataReader.h
@@ -692,9 +692,10 @@
   /// the isa mask.
   std::pair<bool, StoredPointer> readMetadataFromInstance(
       StoredPointer ObjectAddress) {
+    StoredPointer isaMaskValue = ~0;
     auto isaMask = readIsaMask();
-    if (!isaMask.first)
-      return {false, 0};
+    if (isaMask.first)
+      isaMaskValue = isaMask.second;

     StoredPointer MetadataAddress;
     if (!Reader->readBytes(RemoteAddress(ObjectAddress),
@@ -702,7 +703,7 @@
                            sizeof(StoredPointer)))
       return {false, 0};

-    return {true, MetadataAddress & isaMask.second};
+    return {true, MetadataAddress & isaMaskValue};
   }

   /// Given the address of a nominal type descriptor, attempt to resolve


Undo last commit - not a bug, just duplicate code.  PG_MAPPED and     PG_WRITEABLE are already cleared by vm_page_protect().

--- sys/vm/vm_page.c
+++ sys/vm/vm_page.c
@@ -34,7 +34,7 @@
  * SUCH DAMAGE.
  *
  *	from: @(#)vm_page.c	7.4 (Berkeley) 5/7/91
- *	$Id: vm_page.c,v 1.120 1999/01/24 02:29:26 dillon Exp $
+ *	$Id: vm_page.c,v 1.121 1999/01/24 06:00:31 dillon Exp $
  */

 /*
@@ -1555,7 +1555,6 @@
 	 */

 	vm_page_protect(m, VM_PROT_NONE);
-	vm_page_flag_clear(m, PG_WRITEABLE | PG_MAPPED);
 #if !defined(MAX_PERF)
 	if (m->dirty != 0) {
 		panic("vm_page_cache: caching a dirty page, pindex: %d", m->pindex);


Eliminate dead code path. Based on apr_file_write_full contract

  "if *bytes_written is less than nbytes, an error is _always_ returned"

* subversion/clients/cmdline/util.c
  (svn_cl__edit_externally): apr_err can't be zero when
   written != strlen(contents_native)

--- subversion/clients/cmdline/util.c
+++ subversion/clients/cmdline/util.c
@@ -171,11 +171,10 @@
     apr_err = apr_err2;

   /* Make sure the whole CONTENTS were written, else return an error. */
-  if (apr_err || (written != strlen (contents_native)))
-    {
-      err = svn_error_createf
-        (apr_err ? apr_err : SVN_ERR_INCOMPLETE_DATA, NULL,
-         "failed writing '%s'", tmpfile_name);
+  if (apr_err)
+    {
+      err = svn_error_createf (apr_err, NULL,
+                               "failed writing '%s'", tmpfile_name);
       goto cleanup;
     }


Remove unused `isTypeContext` from MetadataReader.h

--- include/swift/Remote/MetadataReader.h
+++ include/swift/Remote/MetadataReader.h
@@ -2220,25 +2220,21 @@
       return false;
     };

-    bool isTypeContext = false;
     switch (auto contextKind = descriptor->getKind()) {
     case ContextDescriptorKind::Class:
       if (!getContextName())
         return nullptr;
       nodeKind = Demangle::Node::Kind::Class;
-      isTypeContext = true;
       break;
     case ContextDescriptorKind::Struct:
       if (!getContextName())
         return nullptr;
       nodeKind = Demangle::Node::Kind::Structure;
-      isTypeContext = true;
       break;
     case ContextDescriptorKind::Enum:
       if (!getContextName())
         return nullptr;
       nodeKind = Demangle::Node::Kind::Enum;
-      isTypeContext = true;
       break;
     case ContextDescriptorKind::Protocol: {
       if (!getContextName())


Update some deprecated functions in libsvn_client/export.c

* subversion/libsvn_client/export.c
  (copy_one_versioned_file): Use a provided wc_ctx to call the new APIs.
  (svn_client_export4): Optionally create, and then use, a working copy
    context.

--- subversion/libsvn_client/export.c
+++ subversion/libsvn_client/export.c
@@ -96,6 +96,7 @@
 copy_one_versioned_file(const char *from,
                         const char *to,
                         svn_wc_adm_access_t *adm_access,
+                        svn_wc_context_t *wc_ctx,
                         const svn_opt_revision_t *revision,
                         const char *native_eol,
                         apr_pool_t *pool)
@@ -112,6 +113,9 @@
   svn_stream_t *dst_stream;
   const char *dst_tmp;
   svn_error_t *err;
+  const char *from_abspath;
+
+  SVN_ERR(svn_dirent_get_absolute(&from_abspath, from, pool));

   SVN_ERR(svn_wc_entry(&entry, from, adm_access, FALSE, pool));

@@ -131,7 +135,8 @@
   if (revision->kind != svn_opt_revision_working)
     {
       SVN_ERR(svn_wc_get_pristine_contents(&source, from, pool, pool));
-      SVN_ERR(svn_wc_get_prop_diffs(NULL, &props, from, adm_access, pool));
+      SVN_ERR(svn_wc_get_prop_diffs2(NULL, &props, wc_ctx, from_abspath,
+                                     pool, pool));
     }
   else
     {
@@ -141,7 +146,7 @@
          ### the file readonly if it is a regular file. */
       SVN_ERR(svn_subst_read_specialfile(&source, from, pool, pool));

-      SVN_ERR(svn_wc_prop_list(&props, from, adm_access, pool));
+      SVN_ERR(svn_wc_prop_list2(&props, wc_ctx, from_abspath, pool, pool));
       SVN_ERR(svn_wc_status2(&status, from, adm_access, pool));
       if (status->text_status != svn_wc_status_normal)
         local_mod = TRUE;
@@ -248,6 +253,7 @@
                      svn_depth_t depth,
                      const char *native_eol,
                      svn_client_ctx_t *ctx,
+                     svn_wc_context_t *wc_ctx,
                      apr_pool_t *pool)
 {
   svn_wc_adm_access_t *adm_access;
@@ -256,12 +262,6 @@
   apr_pool_t *iterpool;
   apr_hash_t *entries;
   apr_hash_index_t *hi;
-  svn_wc_context_t *wc_ctx;
-
-  if (!ctx->wc_ctx)
-    SVN_ERR(svn_wc_context_create(&wc_ctx, NULL /* config */, pool, pool));
-  else
-    wc_ctx = ctx->wc_ctx;

   SVN_ERR(svn_wc_adm_probe_open3(&adm_access, NULL, from, FALSE,
                                  0, ctx->cancel_func, ctx->cancel_baton,
@@ -350,7 +350,7 @@
                       SVN_ERR(copy_versioned_files(new_from, new_to,
                                                    revision, force,
                                                    ignore_externals, depth,
-                                                   native_eol, ctx,
+                                                   native_eol, ctx, wc_ctx,
                                                    iterpool));
                     }
                 }
@@ -361,7 +361,7 @@
               const char *new_to = svn_path_join(to, item, iterpool);

               SVN_ERR(copy_one_versioned_file(new_from, new_to, adm_access,
-                                              revision, native_eol,
+                                              wc_ctx, revision, native_eol,
                                               iterpool));
             }
         }
@@ -410,7 +410,7 @@
                   SVN_ERR(copy_versioned_files(new_from, new_to,
                                                revision, force, FALSE,
                                                svn_depth_infinity, native_eol,
-                                               ctx, iterpool));
+                                               ctx, wc_ctx, iterpool));
                 }
             }
         }
@@ -419,7 +419,7 @@
     }
   else if (entry->kind == svn_node_file)
     {
-      SVN_ERR(copy_one_versioned_file(from, to, adm_access, revision,
+      SVN_ERR(copy_one_versioned_file(from, to, adm_access, wc_ctx, revision,
                                       native_eol, pool));
     }

@@ -1011,11 +1011,20 @@
   else
     {
       /* This is a working copy export. */
+      svn_wc_context_t *wc_ctx;
+
+      if (!ctx->wc_ctx)
+        SVN_ERR(svn_wc_context_create(&wc_ctx, NULL /* config */, pool, pool));
+      else
+        wc_ctx = ctx->wc_ctx;

       /* just copy the contents of the working copy into the target path. */
       SVN_ERR(copy_versioned_files(from, to, revision, overwrite,
                                    ignore_externals, depth, native_eol,
-                                   ctx, pool));
+                                   ctx, wc_ctx, pool));
+
+      if (!ctx->wc_ctx)
+        SVN_ERR(svn_wc_context_destroy(wc_ctx));
     }


Add queue type and printer-uri to long "lpstat -e" output.

--- systemv/lpstat.c
+++ systemv/lpstat.c
@@ -255,7 +255,18 @@
                     fputs(dest->name, stdout);

                   if (long_status)
-                    printf(" %s\n", cupsGetOption("device-uri", dest->num_options, dest->options));
+                  {
+                    const char *printer_uri_supported = cupsGetOption("printer-uri-supported", dest->num_options, dest->options);
+                    const char *printer_is_temporary = cupsGetOption("printer-is-temporary", dest->num_options, dest->options);
+                    const char *type = "network";
+
+                    if (printer_is_temporary && !strcmp(printer_is_temporary, "true"))
+                      type = "temporary";
+                    else if (printer_uri_supported)
+                      type = "permanent";
+
+                    printf(" %s %s %s\n", type, printer_uri_supported ? printer_uri_supported : "none", cupsGetOption("device-uri", dest->num_options, dest->options));
+                  }
                   else
                     putchar('\n');
                 }


MFC:	geom_raid3.c	1.12

MFC:	geom_raid3.c	1.12

Don't forget to initialize 'id' field.

Approved by:	re (kensmith)

--- sbin/geom/class/raid3/geom_raid3.c
+++ sbin/geom/class/raid3/geom_raid3.c
@@ -173,6 +173,7 @@
 		return;
 	}
 	strlcpy(md.md_name, str, sizeof(md.md_name));
+	md.md_id = arc4random();
 	md.md_all = *nargs - 1;
 	md.md_mflags = 0;
 	md.md_dflags = 0;


[Sema] Provide copy constructor/assignment operator for TypeCheckRequest.

One of the member variant of the union has a non-trivial copy
constructor, therefore the copy cosntructor is implicitly deleted
(in C++11). Provide the constructor and the copy assignment operator
explictly in order to avoid build errors.

--- include/swift/Sema/TypeCheckRequest.h
+++ include/swift/Sema/TypeCheckRequest.h
@@ -114,7 +114,42 @@
   }

 #include "swift/Sema/TypeCheckRequestPayloads.def"
-
+
+  TypeCheckRequest(const TypeCheckRequest &T) { *this = T; }
+
+  TypeCheckRequest& operator=(const TypeCheckRequest &T) {
+    TheKind = T.getKind();
+    switch (getPayloadKind(TheKind)) {
+    case PayloadKind::Class:
+      Payload.Class = T.Payload.Class;
+      break;
+    case PayloadKind::Enum:
+      Payload.Enum = T.Payload.Enum;
+      break;
+    case PayloadKind::InheritedClauseEntry:
+      new (&Payload.InheritedClauseEntry)
+        std::pair<llvm::PointerUnion<TypeDecl *, ExtensionDecl *>, unsigned>();
+      Payload.InheritedClauseEntry = T.Payload.InheritedClauseEntry;
+      break;
+    case PayloadKind::Protocol:
+      Payload.Protocol = T.Payload.Protocol;
+      break;
+    case PayloadKind::DeclContextLookup:
+      new (&Payload.DeclContextLookup) DeclContextLookupInfo();
+      Payload.DeclContextLookup = T.Payload.DeclContextLookup;
+      break;
+    case PayloadKind::TypeResolution:
+      new (&Payload.InheritedClauseEntry)
+        std::tuple<TypeRepr *, DeclContext *, unsigned>();
+      Payload.TypeResolution = T.Payload.TypeResolution;
+      break;
+    case PayloadKind::TypeDeclResolution:
+      Payload.TypeDeclResolution = T.Payload.TypeDeclResolution;
+      break;
+    }
+    return *this;
+  }
+
   /// Determine the kind of type check request.
   Kind getKind() const { return TheKind; }


More work on issue #1004: Make the second half of exports cancellable.

* subversion/libsvn_client/export.c
  (remove_admin_dirs, copy_versioned_files): Take a ctx parameter, use
    it to invoke the cancellation function at appropriate points.  All
    callers changed.

git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@845413 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/libsvn_client/export.c
+++ subversion/libsvn_client/export.c
@@ -38,7 +38,9 @@
 /*** Code. ***/

 static svn_error_t *
-remove_admin_dirs (const char *dir, apr_pool_t *pool)
+remove_admin_dirs (const char *dir,
+                   svn_client_ctx_t *ctx,
+                   apr_pool_t *pool)
 {
   apr_pool_t *subpool = svn_pool_create (pool);
   apr_hash_t *dirents;
@@ -58,6 +60,12 @@
       item = key;
       type = val;

+      if (ctx->cancel_func)
+        SVN_ERR (ctx->cancel_func (ctx->cancel_baton));
+
+      /* ### We could also invoke ctx->notify_func somewhere in
+         ### here... Is it called for, though?  Not sure. */
+
       if (*type == svn_node_dir)
         {
           const char *dir_path = svn_path_join (dir, key, subpool);
@@ -68,7 +76,7 @@
             }
           else
             {
-              SVN_ERR (remove_admin_dirs (dir_path, subpool));
+              SVN_ERR (remove_admin_dirs (dir_path, ctx, subpool));
             }
         }

@@ -83,6 +91,7 @@
 static svn_error_t *
 copy_versioned_files (const char *from,
                       const char *to,
+                      svn_client_ctx_t *ctx,
                       apr_pool_t *pool)
 {
   apr_pool_t *subpool = svn_pool_create (pool);
@@ -122,6 +131,12 @@
           item = key;
           type = val;

+          if (ctx->cancel_func)
+            SVN_ERR (ctx->cancel_func (ctx->cancel_baton));
+
+          /* ### We could also invoke ctx->notify_func somewhere in
+             ### here... Is it called for, though?  Not sure. */
+
           if (*type == svn_node_dir)
             {
               if (strcmp (item, SVN_WC_ADM_DIR_NAME) == 0)
@@ -133,7 +148,8 @@
                   const char *new_from = svn_path_join (from, key, subpool);
                   const char *new_to = svn_path_join (to, key, subpool);

-                  SVN_ERR (copy_versioned_files (new_from, new_to, subpool));
+                  SVN_ERR (copy_versioned_files (new_from, new_to,
+                                                 ctx, subpool));
                 }
             }
           else if (*type == svn_node_file)
@@ -186,12 +202,12 @@
                                     pool));

       /* walk over the wc and remove the administrative directories. */
-      SVN_ERR (remove_admin_dirs (to, pool));
+      SVN_ERR (remove_admin_dirs (to, ctx, pool));
     }
   else
     {
       /* just copy the contents of the working copy into the target path. */
-      SVN_ERR (copy_versioned_files (from, to, pool));
+      SVN_ERR (copy_versioned_files (from, to, ctx, pool));
     }

   return SVN_NO_ERROR;


ALSA: compress: Cancel the optimization of compiler and fix the size of struct for all platform.

Cancel the optimization of compiler for struct snd_compr_avail
which size will be 0x1c in 32bit kernel while 0x20 in 64bit
kernel under the optimizer. That will make compaction between
32bit and 64bit. So add packed to fix the size of struct
snd_compr_avail to 0x1c for all platform.

Signed-off-by: Zhang Dongxing <8ab622f03a97543000309be6a5647ed65e99f511@intel.com>
Signed-off-by: xiaoming wang <432784a429e5c6bfee995afc7cd6d79e756339fb@intel.com>
Acked-by: Vinod Koul <5cf69c63beb17bf38d63aa0e923ee8256af0e205@intel.com>
Cc: <4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@vger.kernel.org>
Signed-off-by: Takashi Iwai <4596b3305151c7ee743192a95d394341e3d3b644@suse.de>

--- include/uapi/sound/compress_offload.h
+++ include/uapi/sound/compress_offload.h
@@ -80,7 +80,7 @@
 struct snd_compr_avail {
 	__u64 avail;
 	struct snd_compr_tstamp tstamp;
-};
+} __attribute__((packed));

 enum snd_compr_direction {
 	SND_COMPRESS_PLAYBACK = 0,


Fix slow "svn st" where the targets are files by not locking the whole anchor
tree.

* libsvn_client/status.c (svn_client_status): Don't lock the whole directory
  hierarchy if not necessary.

--- subversion/libsvn_client/status.c
+++ subversion/libsvn_client/status.c
@@ -91,7 +91,7 @@
                    svn_client_ctx_t *ctx,
                    apr_pool_t *pool)
 {
-  svn_wc_adm_access_t *adm_access;
+  svn_wc_adm_access_t *anchor_access, *target_access;
   svn_wc_traversal_info_t *traversal_info = svn_wc_init_traversal_info (pool);
   const char *anchor, *target;
   const svn_delta_editor_t *editor;
@@ -100,6 +100,7 @@
   const svn_wc_entry_t *entry;
   struct status_baton sb;
   svn_revnum_t edit_revision = SVN_INVALID_REVNUM;
+  svn_error_t *err;

   sb.real_status_func = status_func;
   sb.real_status_baton = status_baton;
@@ -107,13 +108,17 @@

   /* First checks do not require a lock on the working copy.  We will
      reopen the working copy with a lock later. */
-  SVN_ERR (svn_wc_adm_probe_open2 (&adm_access, NULL, path,
+  SVN_ERR (svn_wc_adm_probe_open2 (&target_access, NULL, path,
                                    FALSE, 0, pool));

   /* Get the entry for this path so we can determine our anchor and
      target.  If the path is unversioned, and the caller requested
      that we contact the repository, we error. */
-  SVN_ERR (svn_wc_entry (&entry, path, adm_access, FALSE, pool));
+  SVN_ERR (svn_wc_entry (&entry, path, target_access, FALSE, pool));
+
+  /* Close up our ADM area and reopen it with the depth we want. */
+  SVN_ERR (svn_wc_adm_close (target_access));
+
   if (entry)
     SVN_ERR (svn_wc_get_actual_target (path, &anchor, &target, pool));
   else if (! update)
@@ -122,27 +127,52 @@
     return svn_error_createf (SVN_ERR_UNVERSIONED_RESOURCE, NULL,
                               _("'%s' is not under version control"), path);

-  /* Close up our ADM area.  We'll be re-opening soon. */
-  SVN_ERR (svn_wc_adm_close (adm_access));
-
-  /* Need to lock the tree.  A recursive status requires us to lock the whole
-     tree.  A non-recursive status requires the target directory and immediate
-     subdirectories to be locked.  However, if the user does "svn status
-     --non-recursive dir1/dir2", then we start locking from dir1, so in order
-     to lock the children of dir2 we need a depth of 2.
-     ### FIXME: In the non-recursive case this always locks too much.  This
-     ###        is a performance bug.  (But this is better than locking too
-     ###        little, which would be a correctness bug).
-   */
-  SVN_ERR (svn_wc_adm_probe_open2 (&adm_access, NULL, anchor,
-                                   FALSE, (descend ? -1 : 2), pool));
+  /* Need to lock the tree.  We lock the anchor first, to not lock too much
+     if we have a target.  We need to lock the target and immediate children
+     if the status is non-recursive.  Else, we lock the whole hierarchy
+     under target.  If we are contacting the repository, we need a recursive
+     lock under anchor so that auth data can be stored. */
+
+  if (update)
+    {
+      SVN_ERR (svn_wc_adm_open2 (&anchor_access, NULL, anchor,
+                                 FALSE, -1, pool));
+      SVN_ERR (svn_wc_adm_probe_retrieve (&target_access, anchor_access,
+                                          path, pool));
+    }
+  else
+    {
+      SVN_ERR (svn_wc_adm_probe_open2 (&anchor_access, NULL, anchor,
+                                       FALSE,
+                                       *target ? 0 : (descend ? -1 : 1), pool));
+      if (*target)
+        {
+          /* Careful! svn_adm_probe_open2 may lock the parent in certain
+             situations, which results in an already locked error.  We use the
+             svn_wc_adm_open2 function instead, since we already have the
+             parent locked. */
+          err = svn_wc_adm_open2 (&target_access, anchor_access, path,
+                                  FALSE, (descend || update) ? -1 : 1, pool);
+          /* If target is not a versioned directory, then that's fine: we need
+             no locking. */
+          if (err && err->apr_err == SVN_ERR_WC_NOT_DIRECTORY)
+            {
+              svn_error_clear (err);
+              target_access = anchor_access;
+            }
+          else
+            SVN_ERR (err);
+        }
+      else
+        target_access = anchor_access;
+    }

   /* Get the status edit, and use our wrapping status function/baton
      as the callback pair. */
   SVN_ERR (svn_wc_get_status_editor (&editor, &edit_baton, &edit_revision,
-                                     adm_access, target, ctx->config, descend,
-                                     get_all, no_ignore, tweak_status, &sb,
-                                     ctx->cancel_func, ctx->cancel_baton,
+                                     anchor_access, target, ctx->config,
+                                     descend, get_all, no_ignore, tweak_status,
+                                     &sb, ctx->cancel_func, ctx->cancel_baton,
                                      traversal_info, pool));

   /* If we want to know about out-of-dateness, we crawl the working copy and
@@ -153,16 +183,7 @@
       void *ra_baton, *session, *report_baton;
       const svn_ra_reporter_t *reporter;
       const char *URL;
-      svn_wc_adm_access_t *anchor_access;
       svn_node_kind_t kind;
-
-      /* Using pool cleanup to close it. This needs to be recursive so that
-         auth data can be stored. */
-      if (strlen (anchor) != strlen (path))
-        SVN_ERR (svn_wc_adm_open2 (&anchor_access, NULL, anchor, FALSE,
-                                   -1, pool));
-      else
-        anchor_access = adm_access;

       /* Get full URL from the ANCHOR. */
       SVN_ERR (svn_wc_entry (&entry, anchor, anchor_access, FALSE, pool));
@@ -205,7 +226,6 @@
         }
       else
         {
-          svn_wc_adm_access_t *tgt_access;
           svn_revnum_t revnum;

           if (revision->kind == svn_opt_revision_head)
@@ -230,9 +250,7 @@
              within PATH.  When we call reporter->finish_report,
              EDITOR will be driven to describe differences between our
              working copy and HEAD. */
-          SVN_ERR (svn_wc_adm_probe_retrieve (&tgt_access, adm_access,
-                                              path, pool));
-          SVN_ERR (svn_wc_crawl_revisions (path, tgt_access, reporter,
+          SVN_ERR (svn_wc_crawl_revisions (path, target_access, reporter,
                                            report_baton, FALSE, descend,
                                            FALSE, NULL, NULL, NULL, pool));
         }
@@ -259,7 +277,7 @@
   /* Close the access baton here, as svn_client__do_external_status()
      calls back into this function and thus will be re-opening the
      working copy. */
-  SVN_ERR (svn_wc_adm_close (adm_access));
+  SVN_ERR (svn_wc_adm_close (anchor_access));

   /* If there are svn:externals set, we don't want those to show up as
      unversioned or unrecognized, so patch up the hash.  If caller wants


Update miscParams documentation for OS X and iOS. For bug 395

--- OgreMain/include/OgreRenderSystem.h
+++ OgreMain/include/OgreRenderSystem.h
@@ -342,7 +342,10 @@

 			externalWindowHandle
 			Win32: HWND as integer

-			    GLX: poslong:posint:poslong (display*:screen:windowHandle) or poslong:posint:poslong:poslong (display*:screen:windowHandle:XVisualInfo*)
+			    GLX: poslong:posint:poslong (display*:screen:windowHandle) or poslong:posint:poslong:poslong (display*:screen:windowHandle:XVisualInfo*)

+                OS X: WindowRef for Carbon or NSWindow for Cocoa address as an integer
+                iOS: UIWindow address as an integer
+
 			0 (none)
 			External window handle, for embedding the OGRE render in an existing window

@@ -379,6 +382,7 @@
 			String: "cocoa" or "carbon"
 			"carbon"
 			Specifies the type of rendering window on the Mac Platform.
+            Mac OS X Specific

@@ -393,6 +397,7 @@
 				In short, by setting this flag to "true" the Ogre::Root::createRenderWindow interprets the "externalWindowHandle" as a NSView*
 				instead of an OgreView*. See OgreOSXCocoaView.h/mm.

+            Mac OS X Specific

@@ -404,8 +409,25 @@
                  native resolution is 960 x 640.  Windows are always 320 x 480, if you would like to limit the display
                  to 720 x 480, specify 1.5 as the scaling factor.

+             iOS Specific

+

+             externalViewHandle
+             UIView pointer as an integer
+             0
+             External view handle, for rendering OGRE render in an existing view
+             iOS Specific
+
+

+

+             externalViewControllerHandle
+             UIViewController pointer as an integer
+             0
+             External view controller handle, for embedding OGRE in an existing view controller
+             iOS Specific
+
+

 			FSAA
 			Positive integer (usually 0, 2, 4, 8, 16)


* subversion/libsvn_client/update.c
  (svn_client__update_internal):
     Following up on r39823, remove an unneeded entry retrieval that
     was used to work around the crop issues fixed in r39822.

Found by: gstein

git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@879914 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/libsvn_client/update.c
+++ subversion/libsvn_client/update.c
@@ -179,13 +179,6 @@

   /* Get full URL from the ANCHOR. */

-  {
-    const svn_wc_entry_t *entry;
-
-  SVN_ERR(svn_wc__get_entry_versioned(&entry, ctx->wc_ctx, anchor_abspath,
-                                      svn_node_unknown, FALSE, FALSE,
-                                      pool, pool));
-}
   SVN_ERR(svn_wc__node_get_url(&anchor_url, ctx->wc_ctx, anchor_abspath,
                                pool, pool));
   if (! anchor_url)


Promoted _setRenderTarget from the OpenGL render system.

--- OgreMain/include/OgreRenderSystem.h
+++ OgreMain/include/OgreRenderSystem.h
@@ -1153,6 +1153,11 @@
 			mDerivedDepthBiasSlopeScale = slopeScale;
 		}

+		/**
+         * Set current render target to target, enabling its GL context if needed
+         */
+        virtual void _setRenderTarget(RenderTarget *target) = 0;
+
 		/** Defines a listener on the custom events that this render system
 		can raise.
 		@see RenderSystem::addListener


director: Make sure ring syncing doesn't get lost when directors get disconnected.

--- src/director/director-connection.c
+++ src/director/director-connection.c
@@ -675,40 +675,25 @@
 	return FALSE;
 }

-static bool director_connection_sync(struct director_connection *conn,
-				     const char *const *args, const char *line)
+static void
+director_connection_sync_host(struct director_connection *conn,
+			      struct director_host *host,
+			      uint32_t seq, const char *line)
 {
 	struct director *dir = conn->dir;
-	struct director_host *host;
-	struct ip_addr ip;
-	unsigned int port, seq;
-
-	if (str_array_length(args) != 3 ||
-	    !director_args_parse_ip_port(conn, args, &ip, &port) ||
-	    str_to_uint(args[2], &seq) < 0) {
-		i_error("director(%s): Invalid SYNC args", conn->name);
-		return FALSE;
-	}
-
-	/* find the originating director. if we don't see it, it was already
-	   removed and we can ignore this sync. */
-	host = director_host_lookup(dir, &ip, port);
-	if (host == NULL)
-		return TRUE;

 	if (host->self) {
 		if (dir->sync_seq != seq) {
 			/* stale SYNC event */
-			return TRUE;
+			return;
 		}

 		if (!dir->ring_handshaked) {
 			/* the ring is handshaked */
 			director_set_ring_handshaked(dir);
 		} else if (dir->ring_synced) {
-			i_error("Received SYNC from %s (seq=%u) "
-				"while already synced", conn->name, seq);
-			return TRUE;
+			/* duplicate SYNC (which was sent just in case the
+			   previous one got lost) */
 		} else {
 			if (dir->debug) {
 				i_debug("Ring is synced (%s sent seq=%u)",
@@ -716,13 +701,43 @@
 			}
 			director_set_ring_synced(dir);
 		}
-		return TRUE;
-	}
-
-	/* forward it to the connection on right */
-	if (dir->right != NULL) {
+	} else {
+		/* forward it to the connection on right */
+		if (dir->right != NULL) {
+			director_connection_send(dir->right,
+				t_strconcat(line, "\n", NULL));
+		}
+	}
+}
+
+static bool director_connection_sync(struct director_connection *conn,
+				     const char *const *args, const char *line)
+{
+	struct director *dir = conn->dir;
+	struct director_host *host;
+	struct ip_addr ip;
+	unsigned int port, seq;
+
+	if (str_array_length(args) != 3 ||
+	    !director_args_parse_ip_port(conn, args, &ip, &port) ||
+	    str_to_uint(args[2], &seq) < 0) {
+		i_error("director(%s): Invalid SYNC args", conn->name);
+		return FALSE;
+	}
+
+	/* find the originating director. if we don't see it, it was already
+	   removed and we can ignore this sync. */
+	host = director_host_lookup(dir, &ip, port);
+	if (host != NULL)
+		director_connection_sync_host(conn, host, seq, line);
+
+	if (!dir->ring_synced && dir->left != NULL && dir->right != NULL &&
+	    (host == NULL || !host->self)) {
+		/* send a new SYNC in case the previous one got dropped */
 		director_connection_send(dir->right,
-					 t_strconcat(line, "\n", NULL));
+			t_strdup_printf("SYNC\t%s\t%u\t%u\n",
+					net_ip2addr(&dir->self_ip),
+					dir->self_port, dir->sync_seq));
 	}
 	return TRUE;
 }


* subversion/libsvn_delta/svndiff.c
  (svn_txdelta_parse_svndiff): Avoid burning CPU cycles when all we would
    do with the processed windows is sending them to the bitbucket.

git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@1446194 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/libsvn_delta/svndiff.c
+++ subversion/libsvn_delta/svndiff.c
@@ -945,8 +945,17 @@
   db->header_bytes = 0;
   db->error_on_early_close = error_on_early_close;
   stream = svn_stream_create(db, pool);
-  svn_stream_set_write(stream, write_handler);
-  svn_stream_set_close(stream, close_handler);
+
+  if (handler != svn_delta_noop_window_handler)
+    {
+      svn_stream_set_write(stream, write_handler);
+      svn_stream_set_close(stream, close_handler);
+    }
+  else
+    {
+      /* And else we just ignore everything as efficiently as we can.
+         by not hooking the stream at all */
+    }
   return stream;
 }


director: Don't send expired user records to remote servers.

--- src/director/director-connection.c
+++ src/director/director-connection.c
@@ -731,6 +731,12 @@

 	o_stream_cork(conn->output);
 	while ((user = user_directory_iter_next(conn->user_iter)) != NULL) {
+		if (!user_directory_user_has_connections(conn->dir->users,
+							 user)) {
+			/* user is already expired */
+			continue;
+		}
+
 		T_BEGIN {
 			const char *line;


* subversion/libsvn_delta/svndiff.c   (decode_file_offset, decode_size): Remove an unnecessary assignment in     the case where the decoding is incomplete, and document that case.

--- subversion/libsvn_delta/svndiff.c
+++ subversion/libsvn_delta/svndiff.c
@@ -354,10 +354,13 @@
 };

-/* Decode an svndiff-encoded integer into VAL and return a pointer to
+/* Decode an svndiff-encoded integer into *VAL and return a pointer to
    the byte after the integer.  The bytes to be decoded live in the
-   range [P..END-1].  See the comment for encode_int earlier in this
-   file for more detail on the encoding format.  */
+   range [P..END-1].  If these bytes do not contain a whole encoded
+   integer, return NULL; in this case *VAL is undefined.
+
+   See the comment for encode_int() earlier in this file for more detail on
+   the encoding format.  */
 static const unsigned char *
 decode_file_offset(svn_filesize_t *val,
                    const unsigned char *p,
@@ -383,7 +386,6 @@
       }
     }

-  *val = temp;
   return NULL;
 }

@@ -411,7 +413,6 @@
       }
     }

-  *val = temp;
   return NULL;
 }


* libsvn_ra_dav/commit.c (simple_request): Use new svn_ra_dav__convert_error to get better error messages.

--- subversion/libsvn_ra_dav/commit.c
+++ subversion/libsvn_ra_dav/commit.c
@@ -169,12 +169,9 @@

   if (rv != NE_OK)
     {
-      /* ### need to be more sophisticated with reporting the failure */
-      return svn_error_createf(SVN_ERR_RA_REQUEST_FAILED, 0, NULL,
-                               ras->pool,
-                               "The server request failed (neon:%d http:%d) "
-                               "(%s %s)",
-                               rv, *code, method, url_str->data);
+      const char *msg = apr_pstrcat(ras->pool, method, " failed", NULL);
+
+      return svn_ra_dav__convert_error(ras->sess, msg, rv, ras->pool);
     }

   return NULL;


util_sysctl: added copyright tag

util_sysctl: added copyright tag

--- inc/util_sysctl.h
+++ inc/util_sysctl.h
@@ -1,8 +1,10 @@
 /**
- * @file   util_sysctl.h
- * @author Shane Barnes
- * @date   11 Mar 2016
- * @brief  System control utility interface.
+ * @file      util_sysctl.h
+ * @brief     System control utility interface.
+ * @author    Shane Barnes
+ * @date      11 Mar 2016
+ * @copyright Copyright 2016 Shane Barnes. All rights reserved.
+ *            This project is released under the MIT license.
  */

 #ifndef _UTIL_SYSCTL_H_


(main): watch out for (and skip) the srcdir argument which is passed during
  a standard "make check" execution.

git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@839426 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/tests/svn_tests_main.c
+++ subversion/tests/svn_tests_main.c
@@ -18,9 +18,11 @@
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
+
 #include <apr_pools.h>
 #include <apr_strings.h>
 #include <apr_general.h>
+#include <apr_lib.h>

 #include "svn_error.h"

@@ -91,6 +93,7 @@
   int i;
   int got_error = 0;
   apr_pool_t *pool;
+  int ran_a_test = 0;

   /* How many tests are there? */
   int array_size = get_array_size();
@@ -116,16 +119,27 @@
     {
       for (i = 1; i < argc; i++)
         {
-          test_num = atoi (argv[i]);
-          if (do_test_num (prog_name, test_num, pool))
-            got_error = 1;
+          if (apr_isdigit (argv[i][0]))
+            {
+              ran_a_test = 1;
+              test_num = atoi (argv[i]);
+              if (do_test_num (prog_name, test_num, pool))
+                got_error = 1;

-          /* Clear the per-function pool */
-          svn_pool_clear (pool);
+              /* Clear the per-function pool */
+              svn_pool_clear (pool);
+            }
+          else
+            {
+              /* (probably) a source directory pathname */
+              printf ("notice: ignoring argument %d\n", i);
+            }
         }
     }
-  else            /* just run all tests */
+
+  if (!ran_a_test)
     {
+      /* just run all tests */
       for (i = 1; i <= array_size; i++)
         {
           if (do_test_num (prog_name, i, pool))


Tidy up comments

Tidy up comments

--- include/any_ptr.h
+++ include/any_ptr.h
@@ -27,7 +27,7 @@

         std::any a1{ p };
         std::any_cast<Derived*>( a1 ); // cast succeeds
-        std::any_cast<Base*>( a1 ); // throws exceptions as there's no implicit up cast
+        std::any_cast<Base*>( a1 ); // cast fails as there's no implicit up cast

         xxx::any_ptr a2{ p };
         xxx::any_ptr_cast<Base*>( a1 ); // implicit up cast succeeds


Added new find replace image to bitmap header file.

--- include/bitmaps.h
+++ include/bitmaps.h
@@ -188,6 +188,7 @@
 EXTERN_BITMAP( file_footprint_xpm )
 EXTERN_BITMAP( fill_zone_xpm )
 EXTERN_BITMAP( find_xpm )
+EXTERN_BITMAP( find_replace_xpm )
 EXTERN_BITMAP( flag_xpm )
 EXTERN_BITMAP( fonts_xpm )
 EXTERN_BITMAP( footprint_text_xpm )


Fix wrong CHATCMD_FLAG_ARG_STATIC byteflag

--- include/console.h
+++ include/console.h
@@ -66,7 +66,7 @@
 	CHATCMD_FLAG_LOCAL_REMOTE = CHATCMD_FLAG_LOCAL | CHATCMD_FLAG_REMOTE,
 	CHATCMD_FLAG_ARG_NONE = 0x0010,
 	CHATCMD_FLAG_ARG_DYNAMIC = 0x0020,
-	CHATCMD_FLAG_ARG_STATIC = 0x0030,
+	CHATCMD_FLAG_ARG_STATIC = 0x0040,
 	CHATCMD_FLAG_ARG_DYNAMIC_STATIC = CHATCMD_FLAG_ARG_DYNAMIC | CHATCMD_FLAG_ARG_STATIC,
 	CHATCMD_FLAG_ARG_ALLMODES = CHATCMD_FLAG_ARG_DYNAMIC_STATIC | CHATCMD_FLAG_ARG_NONE,
 };


added a new crgunit constructor

added a new crgunit constructor

--- include/crgunit.h
+++ include/crgunit.h
@@ -33,6 +33,8 @@
     CrgUnit(vector <vec> positions, vector <vec> norms, vector <vec> planes,
             const unsigned int & id, CrgUnitType * type,
             const unsigned int & molId);
+    CrgUnit(const unsigned int & id, CrgUnitType * type,
+            const unsigned int & molId):_id(id), _type(type), _molid(molId){}
     CrgUnit(vec pos, vec plane1, vec norm1, CrgUnitType * type);

     /*CrgUnit(CrgUnit & acrg){


change defaults slightly

change defaults slightly

--- include/glbopts.h
+++ include/glbopts.h
@@ -28,8 +28,8 @@
 #define SCS_SOLVED_INACCURATE (2)

 /* DEFAULT SOLVER PARAMETERS AND SETTINGS --------------------------    */
-#define MAX_ITERS (5000)
-#define EPS (1E-5)
+#define MAX_ITERS (10000)
+#define EPS (1E-4)
 #define ALPHA (1.5)
 #define RHO_X (1E-3)
 #define SCALE (10.0)


Adjust documentation

Adjust documentation

--- include/megaapi.h
+++ include/megaapi.h
@@ -6729,9 +6729,8 @@
          * - MegaRequest::getFlag - Returns the first parameter
          * - MegaRequest::getNumber - Returns the second parameter
          *
-         * If there is no Internet connection available, in iOS, this method will retry for up to 5 seconds and
-         * may fail with the error code MegaError::API_EACCESS in onRequestFinish() if not possible to retrieve the
-         * DNS servers from the system.
+         * If not possible to retrieve the DNS servers from the system, in iOS, this request will fail with
+         * the error code MegaError::API_EACCESS in onRequestFinish().
          *
          * @param disconnect true if you want to disconnect already connected requests
          * It's not recommended to set this flag to true if you are not fully sure about what are you doing. If you


Another bug fix for TSF writer

Another bug fix for TSF writer

--- src/dwi/tractography/scalar_file.h
+++ src/dwi/tractography/scalar_file.h
@@ -218,10 +218,10 @@

             out.seekp (current_offset, out.beg);
             out.write (reinterpret_cast<char*> (&(buffer[0])), sizeof (value_type)*(buffer_size));
+            current_offset = int64_t (out.tellp()) - sizeof(value_type);
             verify_stream (out);
             update_counts (out);
             verify_stream (out);
-            current_offset = int64_t (out.tellp()) - sizeof(value_type);
             buffer_size = 0;
           }


newline warning

newline warning

--- include/openbox.h
+++ include/openbox.h
@@ -36,4 +36,5 @@

 }}

-#endif	/* OPENBOX_H */+#endif	/* OPENBOX_H */
+


forgot prototyle for __rpc_get_local_uid()

--- include/rpc/svc.h
+++ include/rpc/svc.h
@@ -410,6 +410,8 @@
  */
 int svc_dg_enablecache __P((SVCXPRT *, const u_int));

+int __rpc_get_local_uid(SVCXPRT *transp, uid_t *uid);
+
 __END_DECLS


implement simhash

implement simhash


properly define __packed when using it

properly define __packed when using it

we don't want to get a __packed symbol,
so we need to define __package attribute before using it for
"struct version_struct".

Signed-off-by: Vincent Palatin <70a9964ec8fd10b0b08fcc8623c2add25ddf99ac@chromium.org>

BRANCH=none
BUG=none
TEST="make buildall" and verify that we no longer have a __packed
symbol in any of the build/<board/ec.{RO|RW}.map.

Change-Id: I4c229660f9b751a9149c08261fe71154067e6e62
Reviewed-on: https://chromium-review.googlesource.com/189223
Reviewed-by: Randall Spangler <62698fdbb84d1779579ee80c3f39fac22017e5bc@chromium.org>
Commit-Queue: Vincent Palatin <70a9964ec8fd10b0b08fcc8623c2add25ddf99ac@chromium.org>
Tested-by: Vincent Palatin <70a9964ec8fd10b0b08fcc8623c2add25ddf99ac@chromium.org>

--- include/version.h
+++ include/version.h
@@ -7,6 +7,8 @@

 #ifndef __CROS_EC_VERSION_H
 #define __CROS_EC_VERSION_H
+
+#include "common.h"

 #define CROS_EC_VERSION_COOKIE1 0xce112233
 #define CROS_EC_VERSION_COOKIE2 0xce445566


Updated version

Updated version

--- include/version.h
+++ include/version.h
@@ -22,6 +22,6 @@
 #define _VERSION

 #define VERSION_MAJOR	2
-#define VERSION_MINOR	0
+#define VERSION_MINOR	2

 #endif


better

better

--- src/examples/querystring_example.c
+++ src/examples/querystring_example.c
@@ -54,6 +54,8 @@
   *ptr = NULL;                  /* reset when done */
   val = MHD_lookup_connection_value (connection, MHD_GET_ARGUMENT_KIND, "q");
   me = malloc (snprintf (NULL, 0, fmt, "q", val) + 1);
+  if (me == NULL)
+    return MHD_NO;
   sprintf (me, fmt, "q", val);
   response = MHD_create_response_from_data (strlen (me), me, MHD_YES, MHD_NO);
   ret = MHD_queue_response (connection, MHD_HTTP_OK, response);


Add select() & poll() based sleep for comparison purposes.

--- openpgm/pgm/timer.c
+++ openpgm/pgm/timer.c
@@ -20,6 +20,7 @@
  */

 #include <fcntl.h>
+#include <poll.h>
 #include <sched.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -75,6 +76,8 @@
 static void nano_sleep (gulong);
 static void rtc_sleep (gulong);
 static void tsc_sleep (gulong);
+static void select_sleep (gulong);
+static void poll_sleep (gulong);

 static void pgm_time_conv (pgm_time_t*, time_t*);
 static void pgm_time_conv_from_reset (pgm_time_t*, time_t*);
@@ -114,6 +117,8 @@
 	case 'N':	pgm_time_sleep = nano_sleep; break;
 	case 'R':	pgm_time_sleep = rtc_sleep; break;
 	case 'T':	pgm_time_sleep = tsc_sleep; break;
+	case 'S':	pgm_time_sleep = select_sleep; break;			/* mainly for testing glib loop */
+	case 'P':	pgm_time_sleep = poll_sleep; break;

 	default:
 	case 'M':
@@ -460,6 +465,24 @@
 	nanosleep (&ts, NULL);
 }

+static void
+select_sleep (gulong usec)
+{
+	struct timespec ts;
+	ts.tv_sec	= usec / 1000000UL;
+	ts.tv_nsec	= (usec % 1000000UL) * 1000;
+	pselect (0, NULL, NULL, NULL, &ts, NULL);
+}
+
+static void
+poll_sleep (gulong usec)
+{
+	struct timespec ts;
+	ts.tv_sec	= usec / 1000000UL;
+	ts.tv_nsec	= (usec % 1000000UL) * 1000;
+	ppoll (NULL, 0, &ts, NULL);
+}
+
 /* convert from pgm_time_t to time_t with pgm_time_t in microseconds since the epoch.
  */
 static void


gallium/util: Really allow aliasing of dst for u_box_union_*

Gallium nine relies on aliasing to work with this function.
Without this patch, dirty region tracking was incorrect, which
could lead to incorrect textures or vertex buffers.
Fixes several game bugs with nine.
Fixes https://github.com/iXit/Mesa-3D/issues/234

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>

Cc: "12.0" <59f39c0db42d4479a46b02d4d2bc11120e37bb44@lists.freedesktop.org>

--- src/gallium/auxiliary/util/u_box.h
+++ src/gallium/auxiliary/util/u_box.h
@@ -124,11 +124,15 @@
 u_box_union_2d(struct pipe_box *dst,
                const struct pipe_box *a, const struct pipe_box *b)
 {
-   dst->x = MIN2(a->x, b->x);
-   dst->y = MIN2(a->y, b->y);
-
-   dst->width = MAX2(a->x + a->width, b->x + b->width) - dst->x;
-   dst->height = MAX2(a->y + a->height, b->y + b->height) - dst->y;
+   int x, y;
+
+   x = MIN2(a->x, b->x);
+   y = MIN2(a->y, b->y);
+
+   dst->width = MAX2(a->x + a->width, b->x + b->width) - x;
+   dst->height = MAX2(a->y + a->height, b->y + b->height) - y;
+   dst->x = x;
+   dst->y = y;
 }

 /* Aliasing of @dst permitted. */
@@ -136,13 +140,18 @@
 u_box_union_3d(struct pipe_box *dst,
                const struct pipe_box *a, const struct pipe_box *b)
 {
-   dst->x = MIN2(a->x, b->x);
-   dst->y = MIN2(a->y, b->y);
-   dst->z = MIN2(a->z, b->z);
-
-   dst->width = MAX2(a->x + a->width, b->x + b->width) - dst->x;
-   dst->height = MAX2(a->y + a->height, b->y + b->height) - dst->y;
-   dst->depth = MAX2(a->z + a->depth, b->z + b->depth) - dst->z;
+   int x, y, z;
+
+   x = MIN2(a->x, b->x);
+   y = MIN2(a->y, b->y);
+   z = MIN2(a->z, b->z);
+
+   dst->width = MAX2(a->x + a->width, b->x + b->width) - x;
+   dst->height = MAX2(a->y + a->height, b->y + b->height) - y;
+   dst->depth = MAX2(a->z + a->depth, b->z + b->depth) - z;
+   dst->x = x;
+   dst->y = y;
+   dst->z = z;
 }

 static inline boolean


gallium: decrease the size of pipe_rasterizer_state - 36 -> 32 bytes

Reviewed-by: Nicolai Hähnle <0d0be6cf5ad662651be2dc5dfd44aa2b09d4c1cc@amd.com>
Reviewed-by: Brian Paul <3cb4e1df5ec4da2c7c4af7c52cec8cf340a55a10@vmware.com>

--- src/gallium/include/pipe/p_state.h
+++ src/gallium/include/pipe/p_state.h
@@ -158,7 +158,13 @@
    unsigned line_stipple_factor:8;  /**< [1..256] actually */
    unsigned line_stipple_pattern:16;

-   uint32_t sprite_coord_enable; /* referring to 32 TEXCOORD/GENERIC inputs */
+   /**
+    * Replace the given TEXCOORD inputs with point coordinates, max. 8 inputs.
+    * If TEXCOORD (including PCOORD) are unsupported, replace GENERIC inputs
+    * instead. Max. 9 inputs: 8x GENERIC to emulate TEXCOORD, and 1x GENERIC
+    * to emulate PCOORD.
+    */
+   uint16_t sprite_coord_enable; /* 0-7: TEXCOORD/GENERIC, 8: PCOORD */

    float line_width;
    float point_size;           /**< used when no per-vertex size */


GBA Video: Don't mask out high bits of BLDY (fixes #899)

--- src/gba/renderers/video-software.c
+++ src/gba/renderers/video-software.c
@@ -295,7 +295,6 @@
 		value &= 0x1F1F;
 		break;
 	case REG_BLDY:
-		value &= 0x1F;
 		if (value > 0x10) {
 			value = 0x10;
 		}


FIxed zeroing register for AVX2

FIxed zeroing register for AVX2

--- src/generator_matcopy_avx_avx512.c
+++ src/generator_matcopy_avx_avx512.c
@@ -194,7 +194,7 @@
     if (remaining && (l_kernel_config.instruction_set == LIBXSMM_X86_AVX || l_kernel_config.instruction_set == LIBXSMM_X86_AVX2)) {
       libxsmm_x86_instruction_vec_compute_reg( io_generated_code,
                                               l_kernel_config.instruction_set,
-                                              l_kernel_config.vxor_instruction,
+                                              LIBXSMM_X86_INSTR_XORPD,
                                               'x',
                                               0,
                                               0,


Return bool from compute_float_64

Return bool from compute_float_64

--- src/generic/stage2/numberparsing.h
+++ src/generic/stage2/numberparsing.h
@@ -24,7 +24,7 @@
 // set to false. This should work *most of the time* (like 99% of the time).
 // We assume that power is in the [FASTFLOAT_SMALLEST_POWER,
 // FASTFLOAT_LARGEST_POWER] interval: the caller is responsible for this check.
-simdjson_really_inline double compute_float_64(int64_t power, uint64_t i, bool negative, bool *success) {
+simdjson_really_inline bool compute_float_64(int64_t power, uint64_t i, bool negative, double &d) {
   // we start with a fast path
   // It was described in
   // Clinger WD. How to read floating point numbers accurately.
@@ -40,7 +40,7 @@
 #endif
     // convert the integer into a double. This is lossless since
     // 0 <= i <= 2^53 - 1.
-    double d = double(i);
+    d = double(i);
     //
     // The general idea is as follows.
     // If 0 <= s < 2^53 and if 10^0 <= p <= 10^22 then
@@ -59,8 +59,7 @@
     if (negative) {
       d = -d;
     }
-    *success = true;
-    return d;
+    return true;
   }
   // When 22 < power && power <  22 + 16, we could
   // hope for another, secondary fast path.  It wa
@@ -85,7 +84,8 @@
   // In the slow path, we need to adjust i so that it is > 1<<63 which is always
   // possible, except if i == 0, so we handle i == 0 separately.
   if(i == 0) {
-    return 0.0;
+    d = 0.0;
+    return true;
   }

   // We are going to need to do some 64-bit arithmetic to get a more precise product.
@@ -135,8 +135,7 @@
     // This does happen, e.g. with 7.3177701707893310e+15.
     if (((product_middle + 1 == 0) && ((product_high & 0x1FF) == 0x1FF) &&
          (product_low + i < product_low))) { // let us be prudent and bail out.
-      *success = false;
-      return 0;
+      return false;
     }
     upper = product_high;
     lower = product_middle;
@@ -157,25 +156,24 @@
   // floating-point values.
   if (simdjson_unlikely((lower == 0) && ((upper & 0x1FF) == 0) &&
                ((mantissa & 3) == 1))) {
-      // if mantissa & 1 == 1 we might need to round up.
-      //
-      // Scenarios:
-      // 1. We are not in the middle. Then we should round up.
-      //
-      // 2. We are right in the middle. Whether we round up depends
-      // on the last significant bit: if it is "one" then we round
-      // up (round to even) otherwise, we do not.
-      //
-      // So if the last significant bit is 1, we can safely round up.
-      // Hence we only need to bail out if (mantissa & 3) == 1.
-      // Otherwise we may need more accuracy or analysis to determine whether
-      // we are exactly between two floating-point numbers.
-      // It can be triggered with 1e23.
-      // Note: because the factor_mantissa and factor_mantissa_low are
-      // almost always rounded down (except for small positive powers),
-      // almost always should round up.
-      *success = false;
-      return 0;
+    // if mantissa & 1 == 1 we might need to round up.
+    //
+    // Scenarios:
+    // 1. We are not in the middle. Then we should round up.
+    //
+    // 2. We are right in the middle. Whether we round up depends
+    // on the last significant bit: if it is "one" then we round
+    // up (round to even) otherwise, we do not.
+    //
+    // So if the last significant bit is 1, we can safely round up.
+    // Hence we only need to bail out if (mantissa & 3) == 1.
+    // Otherwise we may need more accuracy or analysis to determine whether
+    // we are exactly between two floating-point numbers.
+    // It can be triggered with 1e23.
+    // Note: because the factor_mantissa and factor_mantissa_low are
+    // almost always rounded down (except for small positive powers),
+    // almost always should round up.
+    return false;
   }

   mantissa += mantissa & 1;
@@ -193,15 +191,12 @@
   uint64_t real_exponent = c.exp - lz;
   // we have to check that real_exponent is in range, otherwise we bail out
   if (simdjson_unlikely((real_exponent < 1) || (real_exponent > 2046))) {
-    *success = false;
-    return 0;
+    return false;
   }
   mantissa |= real_exponent << 52;
   mantissa |= (((uint64_t)negative) << 63);
-  double d;
   memcpy(&d, &mantissa, sizeof(d));
-  *success = true;
-  return d;
+  return true;
 }

 static bool parse_float_strtod(const uint8_t *ptr, double *outDouble) {
@@ -392,9 +387,8 @@
     writer.skip_double();
     return error;
   }
-  bool success = true;
-  double d = compute_float_64(exponent, i, negative, &success);
-  if (!success) {
+  double d;
+  if (!compute_float_64(exponent, i, negative, d)) {
     // we are almost never going to get here.
     if (!parse_float_strtod(src, &d)) { return INVALID_NUMBER(src); }
   }
@@ -713,12 +707,10 @@
   //
   // Assemble (or slow-parse) the float
   //
+  double d;
   if (simdjson_likely(!overflow)) {
-    bool success = true;
-    double d = compute_float_64(exponent, i, negative, &success);
-    if (success) { return d; }
-  }
-  double d;
+    if (compute_float_64(exponent, i, negative, d)) { return d; }
+  }
   if (!parse_float_strtod(src-negative, &d)) {
     return NUMBER_ERROR;
   }


max_component for x86 vector; fixes #3

max_component for x86 vector; fixes #3

--- src/geom/optimization/x86/vector.h
+++ src/geom/optimization/x86/vector.h
@@ -64,6 +64,18 @@
 				throw std::runtime_error("Bad index");
 			}

+			float
+			max_component3 ()
+			{
+				return std::max(x, std::max(y, z));
+			}
+
+			float
+			max_component4 ()
+			{
+				return std::max(x, std::max(y, std::max(z, w)));
+			}
+
 			inline void
 			dump (const char *name, unsigned int level = 0)
 			{


google: Replace tabs with spaces

google: Replace tabs with spaces

https://bugzilla.gnome.org/show_bug.cgi?id=728877

--- src/goabackend/goagoogleprovider.c
+++ src/goabackend/goagoogleprovider.c
@@ -142,8 +142,8 @@
          /* GMail IMAP and SMTP access */
          "https://mail.google.com/ "

-	 /* Google Cloud Print */
-	 "https://www.googleapis.com/auth/cloudprint "
+         /* Google Cloud Print */
+         "https://www.googleapis.com/auth/cloudprint "

          /* Google Talk */
          "https://www.googleapis.com/auth/googletalk";


kmsfilterelement: Add a leaky queue before video filters

This queue leaks buffer if they arrive later than 200 ms. In this
way, we avoid problems with video lag if the process is too heavy or
the machine is too load.

Change-Id: Iaf62f4ea79258e444f3eb61ce2a86802e292c90c

--- src/gst-plugins/kmsfilterelement.c
+++ src/gst-plugins/kmsfilterelement.c
@@ -25,6 +25,7 @@
 #include "kmsfiltertype.h"

 #define PLUGIN_NAME "filterelement"
+#define LEAKY_TIME 200000       /*200 ms */

 #define DEFAULT_FILTER_TYPE KMS_FILTER_TYPE_AUTODETECT

@@ -82,10 +83,29 @@

   self->priv->filter = filter;

-  gst_element_link (filter, agnosticbin);
-  gst_element_sync_state_with_parent (filter);
-
-  kms_element_connect_sink_target (KMS_ELEMENT (self), target, type);
+  if (type == KMS_ELEMENT_PAD_TYPE_VIDEO) {
+    GstElement *queue;
+    GstPad *pad;
+
+    queue = gst_element_factory_make ("queue", NULL);
+    pad = gst_element_get_static_pad (queue, "sink");
+
+    gst_bin_add (GST_BIN (self), queue);
+
+    g_object_set (queue, "max-size-time", LEAKY_TIME, "leaky",
+        2 /*downstream */ , NULL);
+
+    gst_element_link (queue, filter);
+    gst_element_link (filter, agnosticbin);
+    gst_element_sync_state_with_parent (filter);
+    gst_element_sync_state_with_parent (queue);
+    kms_element_connect_sink_target (KMS_ELEMENT (self), pad, type);
+    gst_object_unref (pad);
+  } else {
+    gst_element_link (filter, agnosticbin);
+    gst_element_sync_state_with_parent (filter);
+    kms_element_connect_sink_target (KMS_ELEMENT (self), target, type);
+  }
 }

 static void


more

more

bk: 530fa0c1eutq_B8K0fkIpGxj40_j_A

--- src/gui/tcltk/tcl/win/tclWinPort.h
+++ src/gui/tcltk/tcl/win/tclWinPort.h
@@ -544,6 +544,31 @@
 /* This type is not defined in the Windows headers */
 #define socklen_t       int

+#ifdef __MINGW32__
+static __inline char*
+gai_strerrorA(int ecode)
+{
+	static char message[1024+1];
+	DWORD dwFlags = FORMAT_MESSAGE_FROM_SYSTEM
+		      | FORMAT_MESSAGE_IGNORE_INSERTS
+		      | FORMAT_MESSAGE_MAX_WIDTH_MASK;
+	DWORD dwLanguageId = MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT);
+	FormatMessageA(dwFlags, NULL, ecode, dwLanguageId, (LPSTR)message, 1024, NULL);
+	return message;
+}
+
+static __inline WCHAR*
+gai_strerrorW(int ecode)
+{
+	static WCHAR message[1024+1];
+	DWORD dwFlags = FORMAT_MESSAGE_FROM_SYSTEM
+		      | FORMAT_MESSAGE_IGNORE_INSERTS
+		      | FORMAT_MESSAGE_MAX_WIDTH_MASK;
+	DWORD dwLanguageId = MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT);
+	FormatMessageW(dwFlags, NULL, ecode, dwLanguageId, (LPWSTR)message, 1024, NULL);
+	return message;
+}
+#endif

 /*
  * The following macros have trivial definitions, allowing generic code to