mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	retrieve current path on macOS
This commit is contained in:
		
							parent
							
								
									1408f15921
								
							
						
					
					
						commit
						e6b72e8cae
					
				
				
				Notes:
				
					git
				
				2019-08-31 04:40:14 +09:00 
				
			
			
			
		
		
					 1 changed files with 13 additions and 0 deletions
				
			
		
							
								
								
									
										13
									
								
								addr2line.c
									
										
									
									
									
								
							
							
						
						
									
										13
									
								
								addr2line.c
									
										
									
									
									
								
							|  | @ -21,6 +21,10 @@ | |||
| #include <stdio.h> | ||||
| #include <errno.h> | ||||
| 
 | ||||
| #ifdef HAVE_LIBPROC_H | ||||
| #include <libproc.h> | ||||
| #endif | ||||
| 
 | ||||
| #ifdef HAVE_STDBOOL_H | ||||
| #include <stdbool.h> | ||||
| #else | ||||
|  | @ -2068,6 +2072,15 @@ main_exe_path(void) | |||
|     len--; /* sysctl sets strlen+1 */ | ||||
|     return len; | ||||
| } | ||||
| #elif defined(HAVE_LIBPROC_H) | ||||
| static ssize_t | ||||
| main_exe_path(void) | ||||
| { | ||||
|     int len = proc_pidpath(getpid(), binary_filename, PATH_MAX); | ||||
|     if (len == 0) return 0; | ||||
|     binary_filename[len] = 0; | ||||
|     return len; | ||||
| } | ||||
| #else | ||||
| #undef HAVE_MAIN_EXE_PATH | ||||
| #endif | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 David Carlier
						David Carlier