본문 바로가기

name

[JAVA] Reflection 을 이용한 변수명 출력하기 - 예제코드 예를 들면 public class Car { private String model; public String owner; public static final int FOO = 123; public static final int BAR = 456; 이런식으로 숫자값에 대한 정의만 난무한 class 가 있고, 이에 대해서 변수명을 출력할 일이 있다면 (주로 디버깅) 일일이 switch 문이나 if else 를 만드는 일은 곤욕스러운 일이다. 자바에서는아래와 같이 getDeclaredFields 함수를 이용해서 동적으로 123 의 값을 가지고 "FOO" 를 출력하는 일이 가능하다. onLine compile test : https://www.compilejava.net///********************.. 더보기
find PID as process name and send signal using shell script #!/system/bin/shecho "sigquit.system_server.sh: start" > /dev/kmsgecho "sigquit.system_server.sh: start"sleep 10.0str=""echo "sigquit.system_server.sh: delay finish" > /dev/kmsgecho "sigquit.system_server.sh: delay finish"while [ "$str" = "" ]; do str=`ps | grep system_server` sleep 0.1donepid=${str:10:4}echo "sigquit.system_server.sh: kill -3 ${pid}" > /dev/kmsgecho "sigquit.system_server.sh: k.. 더보기
get pid by process name - example source code (예제 코드) 원문 : https://phoxis.org/2013/09/13/find-process-ids-of-a-running-process-by-name/ 이름으로 pid 를 찾아내는 예제 #include #include #include #include #include #include /* checks if the string is purely an integer * we can do it with `strtol' also */int check_if_number (char *str){ int i; for (i=0; str[i] != '\0'; i++) { if (!isdigit (str[i])) { return 0; } } return 1;} #define MAX_BUF 1024#define PID_LIST_BL.. 더보기
Android init.rc 분석 기본 문법http://www.dreamy.pe.kr/zbxe/CodeClip/164851 설명http://egloos.zum.com/shadowxx/v/10770478http://blog.naver.com/PostView.nhn?blogId=multiedit&logNo=40147752143 예제http://forum.falinux.com/zbxe/index.php?mid=android&sort_index=readed_count&order_type=asc&document_srl=781528 class name 을 등록하고 아래와 같이 class 를 start stop 시킬 수 있다.즉, class_start 를 호출하면 해당 class name 을 등록한 모든 service 들이 시작된다.. 더보기
android 에서 eMMC 의 hw 이름 출력하는 방법 (nexus5) cat /sys/class/block/mmcblk0/device/name 더보기
현재 프로세스의 이름 출력, print current process name linux platform side 에서 현재 프로세스 이름을 출력하는 방법 입니다. extern char *__progname;char* get_process_name(){return __progname;} 더보기
kernel 동작을 trigger 시킨 process name과 pid 얻기 system call 이나 sysfs 등을 통해서 kernel 을 동작시킨 process 주체의 name 과 pid 를 kernel 단에서 얻을 수 있습니다. process 명칭 문자열 : current->comm pid : task_pid_nr(current) 더보기