mirror of
				https://github.com/meizu-m86/kexec-tools-arm64
				synced 2025-11-04 13:56:01 +08:00 
			
		
		
		
	vmcore-dmesg: Collect full dmesg regardless of logged_chars
logged_chars would be set to 0 by `dmesg -c`, but full dmesg is useful for debugging. So instead of using logged_chars directly, we calculate it by ourselves. Now logged_chars is set to the minimum of log_end and log_buf_len, as the same logic as crash utility is using. Signed-off-by: Dangyi Liu <dliu@redhat.com> Cc: Dave Young <dyoung@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
This commit is contained in:
		@@ -540,6 +540,12 @@ static void dump_dmesg_legacy(int fd)
 | 
				
			|||||||
		exit(53);
 | 
							exit(53);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/*
 | 
				
			||||||
 | 
						 * To collect full dmesg including the part before `dmesg -c` is useful
 | 
				
			||||||
 | 
						 * for later debugging. Use same logic as what crash utility is using.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						logged_chars = log_end < log_buf_len ? log_end : log_buf_len;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	write_to_stdout(buf + (log_buf_len -  logged_chars), logged_chars);
 | 
						write_to_stdout(buf + (log_buf_len -  logged_chars), logged_chars);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user