"ifconfig [dev_name] up"

int interface_up(char * interface_name)
{
    int s;
    if((s = socket(PF_INET,SOCK_STREAM,0)) < 0)

phchiu 發表在 痞客邦 留言(0) 人氣()

o_path.gif

The Internet Protocol (IP) is the heart of the Linux messaging system. While Linux (more or less) strictly adheres to the layering concept - and it is possible to use a different protocol (like ATM) - IP is almost always the nexus through which packets flow. The IP implementation of the network layer performs routing and forwarding as well as encapsulating data. See Figure 2.1 for a simplified diagram of how network packets move through the Linux kernel.

Figure 2.1: Abstraction of the Linux message traffic path.

When an application generates traffic, it sends packets through sockets to a transport layer (TCP or UDP) and then on to the network layer (IP). In the IP layer, the kernel looks up the route to the host in either the routing cache or its Forwarding Information Base (FIB). If the packet is for another computer, the kernel addresses it and then sends it to a link layer output interface (typically an Ethernet device) which ultimately sends the packet out over the physical medium.

When a packet arrives over the medium, the input interface receives it and checks to see if the packet is indeed for the host computer. If so, it sends the packet up to the IP layer, which looks up the route to the packet's destination. If the packet has to be forwarded to another computer, the IP layer sends it back down to an output interface. If the packet is for an application, it sends it up through the transport layer and sockets for the application to read when it is ready.

Along the way, each socket and protocol performs various checks and formatting functions, detailed in later chapters. The entire process is implemented with references and jump tables that isolate each protocol, most of which are set up during initialization when the computer boots. See Chapter 3 for details of the initialization process.

phchiu 發表在 痞客邦 留言(0) 人氣()

Sited from Vbird
----------------------------------------------------
awk 則比較傾向於一行當中分成數個『欄位』來處理
awk '條件類型1{動作1} 條件類型2{動作2} ...' filename
awk 後面接兩個單引號並加上大括號 {} 來設定想要對資料進行的處理動作。 awk 可以處理後續接的檔案,也可以讀取來自前個指令的 standard output 。 但如前面說的, 

phchiu 發表在 痞客邦 留言(1) 人氣()

Static link:

Compiler時,

library加入程式碼

優:快

劣:佔空間

phchiu 發表在 痞客邦 留言(0) 人氣()

[轉貼]用GCC自製Library

引用: PTT看板: LinuxDev (作者: cole945)

----------------------------------------------------------------------

Library可分成三種,staticshareddynamically loaded

phchiu 發表在 痞客邦 留言(0) 人氣()

  • Dec 01 Thu 2011 22:23
  • MTK

MediaTek真的頗累  

或者說裡面的人還滿厲害的

也可以說我太弱了orz

希望可以趕快進入狀況

這樣下去  三年後我會變強的

phchiu 發表在 痞客邦 留言(0) 人氣()

What is callback?

簡單的說,如果你使用了某個function,那麼你就是『call』了一個function。
如果系統或是函式是要求你給一個function pointer,
這個function pointer指到一個實際的函式(多半這個函式是你自己寫的)。
然後它會在適當的時間呼叫此function,則此function就是所謂的 callback function。

phchiu 發表在 痞客邦 留言(0) 人氣()

Support blocking Send/Recv

作法:

socket 動態建立,傳送一次就必須建立server and client

Performance test:

ping-pong between x86<->PPE (10000次 4byte)  約12秒

phchiu 發表在 痞客邦 留言(0) 人氣()

Native C applications for Android

The Android Java SDK is nice and all, but what if you want to run
some C service or code? Well, it turns out that this isn't exactly
difficult. You can compile an application using a standard Linux
cross-compiler, install it and run your programs from the shell.

phchiu 發表在 痞客邦 留言(0) 人氣()

Compile Android kernel from the source

I confirmed the following procedure only on my linux host (FC8). Sorry for Windows and Mac users.
1. Get toolchains from CodeSourcery (Choose ARM GNU/Linux and IA32 GNU/Linux).
2. Get kernl source code from here.
3. Deploy toolcains and kernel source and enter in the kernel source tree.

phchiu 發表在 痞客邦 留言(0) 人氣()

Three Cs model指的是我們可以將所有cache miss歸類成三大類:

1. Compulsory misses

2. Capacity misses

3. Conflict misses

  • Compulsory misses:也稱為cold start misses,第一次存取未曾在cache內的block而發生的cache miss。

phchiu 發表在 痞客邦 留言(0) 人氣()

message.gif

IPC:Message Queues:<sys/msg.h>

Two (or more) processes can exchange information via access to a common system message queue.

Before a process can send or receive a message, the queue must be

phchiu 發表在 痞客邦 留言(0) 人氣()

1 2
Blog Stats
⚠️

成人內容提醒

本部落格內容僅限年滿十八歲者瀏覽。
若您未滿十八歲,請立即離開。

已滿十八歲者,亦請勿將內容提供給未成年人士。