Last active
December 15, 2015 18:39
-
-
Save shuangjj/5305049 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Networking on Android Emulator | |
http://developer.android.com/tools/devices/emulator.html#emulatornetworking | |
2. socket from bask | |
http://hacktux.com/bash/socket | |
3. common errors | |
no router - server ip is wrong | |
connection refused - disable firewall, check port number | |
4. IP address on Android devices | |
adb shell netcfg | |
adb shell ifconfig | |
5. kill a process binding at certain port | |
sudo netstat -ap | grep :<port_number> | |
http://superuser.com/questions/127863/manually-closing-a-port-from-commandline | |
6. config printk buffer size | |
http://elinux.org/Debugging_by_printing#Internals_.2F_Changing_the_size_of_the_printk_buffer | |
7. Enable timing information to printk | |
http://elinux.org/Kernel_Debugging_Tips | |
CONFIG_PRINTK_TIMES | This option is found on the "Kernel Hacking" menu when configuring the kernel | |
8. Log level | |
The loglevel | |
The kernel routine printk() will only print a message on the console, | |
if it has a loglevel less than the value of the variable con‐ | |
sole_loglevel. This variable initially has the value DEFAULT_CON‐ | |
SOLE_LOGLEVEL (7), but is set to 10 if the kernel command line contains | |
the word "debug", and to 15 in case of a kernel fault (the 10 and 15 | |
are just silly, and equivalent to 8). This variable is set (to a value | |
in the range 1-8) by the call syslog(8,dummy,value). The calls sys‐ | |
log(type,dummy,dummy) with type equal to 6 or 7, set it to 1 (kernel | |
panics only) or 7 (all except debugging messages), respectively. | |
Every text line in a message has its own loglevel. This level is | |
DEFAULT_MESSAGE_LOGLEVEL - 1 (6) unless the line starts with <d> where | |
d is a digit in the range 1-7, in which case the level is d. The con‐ | |
ventional meaning of the loglevel is defined in <linux/kernel.h> as | |
follows: | |
#define KERN_EMERG "<0>" /* system is unusable */ | |
#define KERN_ALERT "<1>" /* action must be taken immediately */ | |
#define KERN_CRIT "<2>" /* critical conditions */ | |
#define KERN_ERR "<3>" /* error conditions */ | |
#define KERN_WARNING "<4>" /* warning conditions */ | |
#define KERN_NOTICE "<5>" /* normal but significant condition */ | |
#define KERN_INFO "<6>" /* informational */ | |
#define KERN_DEBUG "<7>" /* debug-level messages */ | |
The call syslog(2,buf,len) waits until this kernel log buffer is | |
nonempty, and then reads at most len bytes into the buffer buf. It | |
returns the number of bytes read. Bytes read from the log disappear | |
from the log buffer: the information can only be read once. This is | |
the function executed by the kernel when a user program reads | |
/proc/kmsg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment