Time of Update: 2018-12-04
Linux核心中,關於虛存管理的最基本的嵌入式管理單元應該是struct vm_area_struct了,它描述的是一段連續的、具有相同訪問屬性的虛存空間,該虛存空間的大小為實體記憶體頁面的整數倍。 下面是struct vm_area_struct結構體的定義: QUOTE: /** This struct defines a memory VMM memory area. There is color: black; background-color:
Time of Update: 2018-12-04
#define switch_to(prev,next,last) do{ asm volatile {"pushl %%esi/n/t" "pushl %%edi/n/t" "movl %%esp,%0/n/t" "movl %3,%%esp/n/t" "movl $1f,%1/n/t"
Time of Update: 2018-12-04
現在就從linux kernel的原始碼的角度來分析該。二:fork()與execve()中stderr,stdio.stdout的繼承關係 其實用繼承這個詞好像不太準確,要準確一點,可能複製更適合. 首先有二點: 1:父進程fork出子進程後,是共用所有檔案描述符的(實際上也包括socket) 2:進程在execve後,除了用O_CLOEXEC標誌開啟的檔案外,其它的檔案描述符都是會複製到下個執行序列(注意這裡不會產生一個新進程,只是將舊的進程替換了)
Time of Update: 2018-12-04
安裝好linux後,這幾天只要有時間就繼續學習linux。剛開始不知道如何下手,正好手邊有mini2440的開發板,按照開發板的操作手冊,一步一步的執行,都沒有問題,但是開發板上的說明畢竟有限,而且很多是他們已經做好的。按照它這個流程走一遍,能大概有個瞭解。接下來就買了本鳥哥的linux 私房菜來看,看到第四章了,還沒到linux,只是在開始linux前的一些建議以及一些基本的知識。繼續吧。。。。我會在這裡記錄我學習linux的一點一滴。。。。。
Time of Update: 2018-12-04
Linux中time命令,我們經常用來計算某個程式的運行耗時(real),使用者態cpu耗時(user),系統態cpu耗時(sys)time命令最常用的使用方式就是在其後面直接跟上命令和參數:time <command> [<arguments...>]舉個栗子1:bixiaopeng@bixiaopengtekiMacBook-Pro ~$ time sleep 2real 0m2.005suser 0m0.001ssys
Time of Update: 2018-12-04
diff是用來比較兩個文字檔的差異的工具,它有三種格式,下面用執行個體介紹一下:準備三個測試檔案1.txt 2.txt 3.txtbixiaopeng@bixiaopengtekiMacBook-Pro ~$ cat 1.txt姓名:畢小朋年齡:保密性別:公的部落格:blog.csdn.net/wirelessqa微博:www.weibo.com/wirelessqa郵箱:wirelessqa.me@gmail.combixiaopeng@bixiaopengtekiMacBook-Pro ~$
Time of Update: 2018-12-04
chown可以改變某個檔案的所有者或所屬組,檔案是以空格分開的 要改變許可權的檔案清單,支援萬用字元。系統管理員經常使用chown命令,在將檔案拷貝到另一個使用者的名錄下之後,讓使用者擁有使用該檔案的許可權。 命令格式:chown [ -f ] [ -h ] [ -R ] Owner [ :Group ] { File ... | Directory ... }chown -R [ -f ] [ -H | -L | -P ] Owner [ :Group ]
Time of Update: 2018-12-04
1. 修改/etc/profile檔案特點:所有使用者的shell都有權使用你配置好的環境變數說明:如果你的電腦僅用作開發,建議使用此配置,因為所有使用者的shell都有權使用你配置好的環境變數,所以有可能會給系統帶來安全性問題。#1:編輯/etc/profilebixiaopeng@bixiaopengtekiMacBook-Pro ~$ vim /etc/profile
Time of Update: 2018-12-04
常用Linux標頭檔 /* linux/drivers/sys-print.c * Author: Woodpecker <Pecker.Hu@gmail.com> * * use sysfs to implement a Dynamic printk. * * This file is subject to the terms and conditions of the GNU General Public * License. See the file COPYING in
Time of Update: 2018-12-04
一. Linux 動態庫選擇順序指:1. 編譯器時用到動態庫,該從那些地方尋找,按照怎麼樣的順序尋找?2. 運行程式時需要動態庫,該從那些地方尋找,按照怎麼樣的順序尋找?二. gcc 編譯器時尋找SO順序如下:1. gcc 編譯時間參數-L指定的路徑2. 環境變數 LIBRARY_PATH3. 系統預設庫位置 /lib /usr/lib二. Linux 程式運行時尋找SO順序如下:1. gcc 編譯時間指定的執行階段程式庫路徑 -Wl,-rpath2. 環境變數
Time of Update: 2018-12-04
一個Linux pthread 小例子:#include <unistd.h>#include <stdio.h>#include <stdlib.h>#include <pthread.h>#include <fcntl.h>#include <string.h>int count = 0;void* pthread_fun(void* ptr){ count++; sleep(1);
Time of Update: 2018-12-04
一. 安裝工具 automake, autoconf, 編寫來源程式:mycc.c#include <stdio.h>#include "config.h"int main(int argc, char** argv){ if(argv == 1) { printf("version: %s\n", PACKAGE_STRING); } else { printf("name : %s\n", PACKAGE);
Time of Update: 2018-12-04
一. 情景模式1. 擷取檔案的絕對路徑,這裡指由fd擷取2. 擷取進程的絕對路徑二. linux kernel 和路徑有關的2個資料結構:1. struct dentry 檔案名稱儲存在這個結構體結構體原型:struct dentry {int d_mounted;struct inode *d_inode;/* Where the name belongs to - NULL is negative */struct hlist_node d_hash;/* lookup hash
Time of Update: 2018-12-04
ARM Linux許可權記憶體控制的實現early_trap_init->modify_domain(DOMAIN_USER, DOMAIN_CLIENT);設定USER MODE的domain許可權為client(01)根據建立的page maps表設定0xc0000000開始的地址SVC模式讀寫,USR模式不能讀寫gdb dump memory的命令如下:(struct thread_info *)0xc033a000 = (struct task_struct
Time of Update: 2018-12-04
This document shows how to compile linux tools such as SDL(simple DirectMedia Layer),Zlib,etc. #Writed by pecker.hu@gmail.com#Date:2010/11/02
Time of Update: 2018-12-04
陳工程師一直做Linux的嵌入式開發,作為在開發一線的工程師,他對很多問題的看法可能更切合實際需求,於是,通過郵件,就嵌入式開發方面的問題,請他談了一下自己的看法: 問:關於嵌入式開發,我們準備給同學們講解一些入門知識,從你一線開發經驗來說,給我們一些建議: 陳工回答:
Time of Update: 2018-12-04
linux 堆棧expand_stack__bprm_mm_init@@@@@@@@0xbe86f000 - 0xbe871000: address 0xbe84f000int expand_downwards(struct vm_area_struct *vma, unsigned long address){int error;if(strncmp(current->comm, "hello", 5) == 0)printk("@@@@@@@@0x%08lx - 0x%08lx:
Time of Update: 2018-12-04
轉自http://jimmy-lee.blog.hexun.com/6075934_d.html和http://blog.chinaunix.net/u3/97568/showart_1978276.html兩位的部落格。謝兩位分享。在Linux源碼中的fs部分,經常會碰到這樣的函數(位於kernel/include/linux/fs.h):/* * Kernel pointers have redundant information, so we can use a * scheme
Time of Update: 2018-12-04
在setup_arch()中: 1. parse_cmdline(): 根據uboot傳遞的mem資訊,調用early_mem()通過arm_add_memory()把實體記憶體資訊添加到meminfo結構體中。 2. paging_init():
Time of Update: 2018-12-04
一. 管道命令管道命令操作符是:”|”,它只能處理經由前面一個指令傳出的正確輸出資訊,對錯誤資訊資訊沒有直接處理能力。然後,傳遞給下一個命令,作為標準的輸入.管理命令的輸出說明:【指令1】正確輸出,作為【指令2】的輸入 然後【指令2】的輸出作為【指令3】的輸入 ,【指令3】輸出就會直接顯示在螢幕上面了。通過管道之後【指令1】和【指令2】的正確輸出不顯示在螢幕上面【提醒注意】:1. 管道命令只處理前一個命令正確輸出,不處理錯誤輸出;2. 管道命令右邊命令,必須能夠接收標準輸入資料流命令才行;二.