mirror of
				https://github.com/strongswan/strongswan.git
				synced 2025-11-04 00:00:51 -05:00 
			
		
		
		
	leak detective binds execution to a signle core, avoids corruption on SMP machines
This commit is contained in:
		
							parent
							
								
									f2bd424c89
								
							
						
					
					
						commit
						7a485e90bd
					
				@ -15,6 +15,8 @@
 | 
				
			|||||||
 * $Id$
 | 
					 * $Id$
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 | 
					#define _GNU_SOURCE
 | 
				
			||||||
 | 
					#include <sched.h>
 | 
				
			||||||
#include <stddef.h>
 | 
					#include <stddef.h>
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
@ -473,6 +475,16 @@ leak_detective_t *leak_detective_create()
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
	if (getenv("LEAK_DETECTIVE_DISABLE") == NULL)
 | 
						if (getenv("LEAK_DETECTIVE_DISABLE") == NULL)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 | 
							cpu_set_t mask;
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							CPU_ZERO(&mask);
 | 
				
			||||||
 | 
							CPU_SET(0, &mask);
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							if (sched_setaffinity(0, sizeof(cpu_set_t), &mask) != 0)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								fprintf(stderr, "setting CPU affinity failed: %m");
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
		lib->leak_detective = TRUE;
 | 
							lib->leak_detective = TRUE;
 | 
				
			||||||
		install_hooks();
 | 
							install_hooks();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user