筆記!
檔案內容為:
ISP.txt的檔案內容為 abcde_fgh,希望能在Makefile的shell當中,使用awk指令取出fgh的部份,放到Makefile的ISP_ABBR的變數當中。
解法如下:
$(eval ISP_ABBR := $(shell echo $(shell grep $(ISP) ISP.txt | awk -F '_' '{print $$2}'))) \
筆記!
檔案內容為:
ISP.txt的檔案內容為 abcde_fgh,希望能在Makefile的shell當中,使用awk指令取出fgh的部份,放到Makefile的ISP_ABBR的變數當中。
解法如下:
$(eval ISP_ABBR := $(shell echo $(shell grep $(ISP) ISP.txt | awk -F '_' '{print $$2}'))) \
這篇文章受密碼保護,請輸入密碼後查看內容。
#include <stdio.h>
int main() {
char line[64]={0};
sprintf(line, "this is Line %d",__LINE__ );
write(STDOUT_FILENO,line,sizeof(line));
原本得到的IP位址為16進制的 0a01a8c0 (192.168.1.10)
struct in_addr ip_addr;
char ipaddr_str[20]={0};
/*buf = 1 eth0 0a01a8c0 */
sscanf(buf, "%d %s %08x %s", &tf.hash, tf.dev, &tf.ipaddr, tf.macaddr);
Linux Kernel 取得網路介面卡資訊:
筆記一下建立/proc的方式:
#include <linux/proc_fs.h>
struct proc_dir_entry *p;
int write_tf_monitor(struct file *file, const char *buffer, int length, void *data)
{

先前已在embedded system中porting過dmalloc,這次在ubuntu PC上也試著使用看看。
首先至 http://packages.ubuntu.com/zh-tw/source/raring/dmalloc 下載 dmalloc_5.5.2.orig.tar.gz
接著下 tar -zxvf dmalloc_5.5.2.orig.tar.gz 將之解壓縮。
開始安裝:
1、執行 ./configure 產生Makefile及其相依性檔案
這篇文章受密碼保護,請輸入密碼後查看內容。