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
相关文档:
以root 身份登陆Linux 服务器,编辑/etc 目录下的共享目录配置文件exports,指定共享目录及权限等。
执行如下命令编辑文件/etc/exports:
# vi /etc/exports
在该文件里添加如下
内容:
/home/work 192.168.0.*(rw,sync,no_root_squash)
然
后保存退出。
添加的内容表示:允许 ......
转贴:
现在用linux的朋友越来越多了,前几天就有两个朋友问我linux下怎么配置java环境,我想还有很多朋友想了解学习这方面的东西,就写一个完全一点的linux java环境配置吧,希望对大家有帮助。
一. 下载jdk5.0 for linux
到sun的主页 http://java.sun.com/j2se/1.5.0/download.jsp 下载jdk安装文件jdk-1_5_0_05-li ......
# 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 ......
#include <stdio.h>
#include <string.h>
int
main(void)
{
char str[] =
"3BVPSq4xF.K?=u#,"
"G'K<MrDnRr7gH%#,"
"XKf<f%G`w^=?C<#,"
"HgU_AnNR?*PDQU#,"
......