Linux c 数据类型
当Linux内核在体系结构差异较大的平台之间移植时,会产生与数据类型相关的问题。
.在编译内核时使用 -Wall -W strict-prototypes 选项, 可以避免很多错误的发生
.内核使用的基本数据类型主要有:
int 标准C语言整数类型
u32 32位整数类型
pid_t 特定内核对象pid的类型
.在不同的CPU体系结构上,C语言的数据类型所占空间不一样。
arch
char
short
int
long
ptr
long-long
u8
u16
u32
u64
i686
1
2
4
4
4
8
1
2
4
8
i386
1
2
4
4
4
8
1
2
4
8
alpha
1
2
4
8
8
8
1
2
4
8
armv41
1
2
4
4
4
8
1
2
4
8
ia64
1
2
4
8
8
8
1
2
4
8
m68k
1
2
4
4
4
8
1
2
4
8
mips
1
2
4
4
4
8
1
2
4
8
ppc
1
2
4
4
4
8
1
2
4
8
sparc
1
2
4
4
4
8
1
2
4
8
sparc64
1
2
4
4
4
8
1
2
4
8
.内核中的地址是unsigned long类型, 指针大小和long类型相同
.内核提供下列数据类型, 所有类型在头文件<asm/types.h>中声明, 这个文件又被头文件<Linux/types.h>所包含, 下面是 include/asm/typs.h文件
[File] /usr/src/kernels/2.6.9-22.EL-i686/include/asm-i386/types.h
#ifndef _I386_TYPES_H
#define _I386_TYPES_H
#ifndef __ASSEMBLY__
typedef unsigned short umode_t;
/*
* __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
* header files exported to user space
*/
typedef __signed__ char __s8;
typedef unsigned char __u8;
typedef __signed__ short __s16;
typedef unsigned short __u16;
typedef __signed__ int __s32;
typedef unsigned int __u32;
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
typedef __sig
相关文档:
总览
用iptables -ADC 来指定链的规
则
,-A添加 -D删除 -C 修改
iptables - [RI] chain rule num rule-specification[option]
用iptables - RI 通过规则的顺序指定
iptables -D chain rule num[option]
删除指定规则
iptables -[LFZ] [chain][option]
用iptables -LFZ 链名 [选项]
iptables -[NX] chain
用 -NX ......
步骤:
一。熟悉在普通电脑上用
GDB调试的基本方式。参见:
http://www.ibm.com/developerworks/linux/library/l-gdb/
二。下载《
gdb
quick reference》,
2张纸,打印出来放在手边备用。
三。让嵌入式系统支持
gdbserver.
(在
openwrt上,即在
make
menuconfig时选择编译
gdbserver)
四。进行调试
&nbs ......
最近在调试linux小系统,想让小系统支持中文,经过几天的调试,这个问题终于得以解决,下面总结一下遇到的问题和解决办法。
在console下面支持中文我选择的是采用外挂式平台的办法,并不真正汉化内核,因为担心汉化内核会有较大的风险,所以选用外挂的方式。采用外挂的方式必须得准 ......
# redhat-config-network
/* 使用ifconfig命令配置并查看网络接口情况 */
//配置eth0的IP,同时激活设备
# ifconfig eth0 192.168.168.119 netmask 255.255.255.0 up
//配置eth0别名设备 eth0:1 的IP,并添加路由
# ifconfig eth0:1 192.168.168.110
# route add –host 192.168.168.110 dev eth0:1
//激活(禁 ......
# cd /home/tmp (进入压缩包所在目录)
# groupadd mysql (建立mysql组)
# useradd -g mysql mysql (在mysql组中建立mysql用户)
# tar -zxvf mysql-5.0.37.tar.gz (解压mysql源码,bz2压缩包请用“tar -jvxf 文件名”指令)
# cd mysql-5.0.37 (进入解压目录)
# ./configure --prefix=/usr/local/mysql (p ......