自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(41)
  • 资源 (7)
  • 收藏
  • 关注

原创 fedora10教育网能用的更新源

本人苦心收集,转载请注明来源,http://blog.csdn.net/guozan523注:我也是从互联网上找的,所以真正的创造者不是我,感谢网上的各种大牛。 每个单独的段落都是一个源 [Fedora-bupt]name=Fedora $releasever - $basearchbaseurl=ftp://ftp.bupt.edu.cn/pub/mirror/fed

2009-06-27 18:39:00 1424

原创 搬家了

http://www.zendo.name欢迎访问

2012-03-19 23:22:25 419 1

原创 变革

我仿佛看到了一个变革的年代,就在最近

2012-02-20 11:06:07 668

原创 Solaris 11 安装图形界面

安装没有GUI的solaris 11,后来又需要GUI,手动安装过去的方法:pkg install slim_install现在的方法(优先尝试):pkg install solaris-desktop然后开启服务svcadm enable gdm如果还不行,查阅 /var/log/xorg.0.log

2011-10-25 11:16:50 9601 1

原创 Linux内核container_of宏

container_of宏是Linux内核中经常出现的一个东西,原型定义在linux/include/linux/kernel.h中#define container_of(ptr, type, member) ({ / const typeof( ((type *)0)->member ) *__mptr = (ptr); / (type *)( (char *)__mptr - offsetof(type,member) );})ptr指向type(目前发现都是struct 类型)中的一个元素m

2011-02-12 21:09:00 947

原创 dd to backup mbr, you should care not to rewrite the Partion table

<br />Sorry for writen in English, my Chinese input method is down<br />usually we use dd to backup MBR, but few people knows that you may destroy your Partion table if not used correctly. So I'd write this to notify you.<br /><br />MBR Total size<br />446

2011-01-23 14:03:00 652

原创 linux内核模块编译,最简单的hello world

驱动源代码可用,只是MODULE_LICENCE行老报错,加上#也不行,就注释掉了//hello world driver for linux 2.6#include #include #include //MODULE_LICENCE("GPL");static int __init hello_init(void){ printk(KERN_ALERT "Hello, world! from kernel space..../n"); return 0;}

2011-01-22 21:21:00 1401 1

原创 struct 中部分变量赋值

<br />C 语言中对struct中部分变量命名,见到变量名中带 . 不要惊讶——C变量名是不允许有 . 的<br /> <br /> <br /> <br /> #include <stdio.h>int main(int argc, char *argv[]){ struct s { int a; int b; int c; }; struct s test = { .b =

2011-01-15 19:16:00 1728

转载 chrome更新源

<br />i686平台:<br /><br /><br />[google]<br /><br />name=Google - i386<br /><br />baseurl=http://dl.google.com/linux/rpm/stable/i386<br /><br />enabled=1<br /><br />gpgcheck=1<br /><br />gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub<br /><br

2011-01-01 15:48:00 1470

原创 小激动,代码恁帅了——最长公共子序列

<br />/*commom subsequenceuse an array of two rows******************just like thiseach time in turn, because the length of a[i][j] is only defined by a[i-1][j-1]or a[i][j-1] a[i-1][j], so we only need two rowsm[i] == n[j] -> a[i][j] = a[i-1

2010-11-26 22:44:00 540

原创 指向函数的指针,重温大一的C知识

<br /><br />//今天看了个tftp的源码,为下面的typedef纠结,还好经过一段时间研究,终于看懂了。下面是学到的东西<br /> <br />//首先说明(* CMDFUNC)(char [][256],int pcount)是void,可猜测CMDFUNC是什么,下面会有揭晓<br />typedef void (* CMDFUNC)(char [][256],int pcount);<br /> <br />//定义CMDNUM类型<br />typedef struct _cmdnum

2010-11-16 22:57:00 725

原创 只有曾失去的才知道珍惜

<br />只有曾失去的才知道珍惜<br />我爱着你,也熟知你的缺点<br />总以为野草更绿<br />无知的萌动,我抛弃了你<br />只有失去后才知道还爱着你<br />见到你,莫名的激动<br />故意的远离,只是更痛苦的思念<br />直到见到你和别人在一起<br />心如刀割<br />垂头站在风中,如此的失落<br />半年的滴答,一颗心的躁动<br />今天终于平静下来<br />我知道我爱的是你<br />虽然试图远离,可这不是万有引力

2010-11-12 20:38:00 969

原创 三日实验遇到问题简记

<br /><br />内核编译<br />使用2.6.34.4编译不行<br />最终使用和系统安装上的2.6.33.3,可行<br />但是不能安装nvidia显卡驱动,最好使用nouveau开源驱动<br />出现一次无法启动后,将/etc/X11/xorg.conf删除掉即可<br />编译时须将文件系统支持尽量的编译进去,防止以后无法识别一些文件系统<br />  <br />  时间测量<br />测试设备初始化时间<br />do_gettimeofday 读取的时间tv_usec总是0<br

2010-08-21 11:51:00 726

原创 grep –v usr result.txt

<br />/* Filename: go.c Author: guozan @SCS-BUPT Mail: [email protected] Date: 2010/5/7 Desciptions: program to complete grep –v usr < /etc/passwd | wc –l > result.txt More:*/#include <unistd.h>#in

2010-08-05 20:29:00 1167

原创 ls v0.2

/* Filename: list.c Author: guozan @SCS-BUPT Mail: [email protected] Date: 2010/4/6 Desciptions: a program similar with linuxs ls, with -a : list all, include ones with . infront

2010-04-07 09:37:00 1428

原创 ls的C语言实现

/* Name: list.c Author: guozan _SCS_BUPT Mail: [email protected] Date: 2010/4/6 实验目的:练习vi,使用UNIX的系统调用和库函数,体会UNIX文件通配符的处理方式以及命令对选项的处理方式。 编程实现程序list.c,列表普通磁盘文件(不考虑目录和设备

2010-04-06 23:30:00 6671

原创 路由器自动拨号上网试出来的

中间的具体破解步骤可参考前面的博客-中兴****路由器破解 由于Linux下连接无线然后拨号的问题一直解决不了,最终采取了让猫自动拨号的方法。结果是遇到了悲剧,学习了网上的方法,可惜没有学完就出山,在断网状态下去琢磨怎么把网给连上,试了n个vpi/vci终于找到了对的成功后发现:亳州的vpi/vci是0/35,现在在网上查的好像不是这个,不过还是相信实践的结果。电信的客服小姐也没听说过

2010-01-31 21:52:00 1536

转载 Windows PowerShell

 熟习Win7的过程中发现里面添加了powershell,确实比cmd好用多了,也算是windows的一个进步吧,想想mac那么帅的电脑里还佩戴有超强的shell,windows做的实在是不怎么好,现在知道改进了,不过和linux的shell差距还是很大,毕竟受众不同,估计主要也是为server开发的。Windows PowerShell 的新增功能更新时间: 2009年1月

2010-01-28 13:55:00 1989

转载 加快FireFox的启动速度与浏览速度.Speeding up Firefox

转自:http://hi.baidu.com/jackiye/blog/item/dc6c78033e3236723812bba6.html/cmtid/ee0c79363f81373a0b55a92f 加快FireFox的启动速度与浏览速度.Speeding up Firefox(以下为Windows为例 Linux可以参照)1. 主页设定:about:blank2.

2010-01-17 00:05:00 721

原创 第一次汇编大作业-学生信息统计,包括排序

插入排序,只对哈希表中的序号进行排序,学生信息直接按顺序存入内存,输出排序结果时,按哈希表中的序号进行输出    ;begin: 2009年 12月 01日 星期二 13:10:06 CST;end:2009年 12月 03日 星期四 22:34:37 CST;author: guozan-scst-bupt;description:students score

2009-12-10 17:22:00 1865

原创 selective repeat

和网络层/物理层的接口是由库函数提供,所以只是把数据链路层对包的处理贴上 /* file: datalink.c *//* use: complete protocol 6, the selective repeat *//* date: 2009 11 22 11:55:21 CST *

2009-12-02 19:45:00 2927 1

原创 玩了一天的系统,庆祝下

 从早上起来就开始装系统刚开始有个宏大的目标,要从最底层开始搭建起来图形界面看来是成功了,呵呵搭建了一个xfce桌面配pcman+metaciy/engliment的平台,不过用着太不爽了,又重装了fedora11从硬盘安装,一次一次的玩,还挺有意思的大概重装了5次左右吧,记不清了现在用的是从文本界面搭建起来的,gnome+nautilus+metacity的,呃,也就

2009-11-19 22:43:00 671

原创 vim boxes

 最近发现vim boxes很好用,就把其中的图片给整出来了 BOX c /*************/ /* */ /* */ /*************/END c# =================================================================

2009-11-02 13:27:00 728

转载 海明码(Hamming Code )编码

海明码(Hamming Code )编码的关键是使用多余的奇偶校验位来识别一位错误。码字(Code Word) 按如下方法构建:1、把所有2的幂次方的数据位标记为奇偶校验位(编号为1, 2, 4, 8, 16, 32, 64等的位置)2、其他数据位用于待编码数据. (编号为3, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17等的位置)3、每个奇偶校

2009-10-26 19:41:00 9372 1

原创 lex

代码:main.c instructions.c error_report.c analyze.cinstructions.h error_report.h analyze.hmain.c#include #include #include #include "analyze.h"#include "instructions.h"int main(int

2009-10-20 12:57:00 584

原创 memory control block system

 昨晚上想了2点多,想一个人,连名字都不知道连续几个晚上想着失眠了结果早上起来脑子里突然闪过一句话memory control block system或者是memory block control system都说日有所思,夜有所想怎么想着就冒出这么句话来啊啊啊啊啊

2009-10-10 11:42:00 741

原创 安装飞信

源码安装make的时候出现这个问题/usr/bin/ld: cannot find -lssl可是明明已经安装了libssl啊$ locate libssl/lib/libssl.so.0.9.8g/lib/libssl.so.7/lib/libssl3.so/lib/libssl3.so.1d 看看makefile里怎么写的,第19行LIBS  

2009-10-07 21:54:00 854 2

原创 安装broadcom无线网卡驱动又一个问题

前面的一篇日志里记载了成功安装无线网卡驱动的方法 然而重装系统,然后升级了内核之后再装的时候就出问题了 先是dmesg显示, lack license ,taint kernel,大概就是这个意思,是说驱动缺少了认证,估计是gpl的问题,broadcom下的驱动没有认证,导致了无线网卡驱动不能加载 修理方法,现在是不提示license有问题了,改天去试一下能不能上无线网

2009-10-07 21:48:00 845

原创 fedora locale修改

刚开始是遇到中文在console下的乱码问题,用网上的方法开始解决,修改了/etc/sysconfig/i18n,结果是挂载了ntfs之后,在X下里面的中文文件名是乱码于是把i18n改了回来,但是此时的locale却定格为gb18030,怎么改都改不过来新建了一个~/.i18n定义语言为zh_CN.UTF-8此时能够解决,但是却导致console下的locale变成了中文尝试更改i

2009-09-14 07:29:00 2476

转载 umask的第一位

suid 和 sgid    当您最初登录时,将启动一个新的 shell 进程。您已经知道,但是您可能还不知道这个新的 shell进程(通常是 bash)使用您的用户标识运行。照这样,bash 程序可以访问所有属于您的文件和目录。事实上,作为用户,我们完全依靠其它程序来代表我们执行操作。因为您启动的程序继承了您的用户标识,因此它们不能访问任何不允许您访问的文件系统对象。    例如,一般用户不能直

2009-09-04 09:52:00 1627

转载 微软全部产品整理

这些年一直用微软的工具吃饭(吃软饭),忽然想整理一下,花了两天的业余时间。这才发现有太多的产品我都没有用过,甚至没有听说过。你知道微软有全国广播电台吗? 因此,不是IT业的人也看一下,因为微软的产品涉及软件及互联网的各个领域,生活的各个领域。微软是一头大象,我们只能像盲人一样摸到他的一部分,即使像我这种吃软饭几年的人。转自:http://hi.baidu.com/zhuxp/blog/item

2009-08-22 23:10:00 1291

原创 中兴ZXV10 H608B具体开启路由方法

没试过,因为发现猫装上后就是这个设置,就没有去改­。除了基本模式里有点不同­具体打开路由方法:­网络->宽带设置­1、连接名称是个下拉菜单,里面有很多选项,把这些选项全部删除(之后你就断线了)。然后就剩一个“新建wan连接”­2、绑定选项不选­3、模式选路由­4、路由模式选pppoe­5、业务模式选Internet­6、vpi和vci值一定要正确,否则无法上

2009-08-04 10:56:00 11860

转载 安装Broadcom 43xx 无线网卡驱动

无线终于连上了,试过了,能用fedora10。 很多本本都配备了 broadcom 的无线网卡,有些Linux发行版默认是无法驱动的,我用的是Broadcom 4312的驱动,在安装fedora code 6 时代无法默认驱动起来,所以就使用 ndiswrapper 驱动windows下的bcm4312的驱动,一用就是两年多。但是使用ndiswrapper驱动有一个缺点:无法支持M

2009-08-04 10:56:00 8834

原创 使用gethostbyname获取主机的各种信息

从书上抄的 #include #include #include #include #include #include int main(int argc, char **argv){    char *host = NULL, **names = NULL, **addrs = NULL;    struct hostent *hostinfo =

2009-06-30 23:55:00 595

原创 linux终端显示汉字问题

在网上搜了很多方法,有个方法安装zhcon,可是发现自己的机子上早就装上了原来方法说的是针对终端,而不是虚拟终端,这点要注意在X 窗口下的叫虚拟终端

2009-06-26 22:26:00 1172 1

转载 linux下挂载光驱、软驱、U盘

转自:http://hi.baidu.com/pengzhijun/blog/item/d9977722823ee2a44623e893.html mount   -t   iso9660   /dev/cdrom   /mnt/cdrom       挂光驱   mount   -t   vfat   /dev/fd0   /mnt/floppy           挂软驱   

2009-06-18 18:15:00 720

原创 把rabin miller搞定了,睡觉了,哈哈

//使用整型的数组,模拟的二进制的大整数int RabinMiller(const BigInt mayPrim){ BigInt bigNum1;  BigInt mayPrimSub1; BigInt result;  BigInt base, tempBase;  int i = 0, j =0, length =0; SetZero(base); SetZero(bigNum1);

2009-05-15 01:50:00 703 1

原创 丢了

大二下学期,一直想要学习和获得更多,最后却发现一切都丢了。自己还不是超人

2009-05-10 21:10:00 440

转载 算法学习资料统计

转自:http://wtommy.ycool.com/post.2334736.html 1.     Knuth的巨作 计算机算法科学的Bible2. 传说中的宝典3. Knuth对于计算机数学的经典理解4. 计算机研究生必修的专业课程5. 计算几何6. 经典离散数学教材7. 相当经典的数据结构和算法入门教材8.  刘汝佳的杰作,引导着信息学竞赛的发展9. 传说中的黑书,不

2009-05-03 23:04:00 539

原创 Electrical Outlets 利用树的性质解题

  题目在下面:先推导树的一个性质一棵树的叶子节点数目 + 中间节点数目 = 分支数目  + 1;每个分支必定指向一个节点,不管是叶子还是中间的节点;即除根节点之外,每个节点都有一个分支指向它,可得上述公式。 http://acm.pku.edu.cn/JudgeOnline/problem?id=2636DescriptionRoy has just move

2009-05-01 23:06:00 462

GNU Make 使用手册(中译版)

GNU Make 使用手册(中译版) 对make使用的详细介绍

2009-12-21

grub2基础手册,入门

最新采用的grub2,基础入门手册,还成。。。。。。

2009-12-21

vim中文手册7.2

vim中文手册7.2 .。。。。。。。。。。。。。。。。

2009-12-21

Linux programming 3rd.pdf

Chapter 1: Getting Started 1 An Introduction to UNIX, Linux, and GNU 1 What Is UNIX? 1 A Brief History of UNIX 2 UNIX Philosophy 2 What Is Linux? 3 The GNU Project and the Free Software Foundation 3 Linux Distributions 4 Programming Linux 5 Linux Programs 5 The C Compiler 6 Try It Out—Our First Linux C Program 7 Development System Roadmap 8 Applications 8 Header Files 8 Library Files 9 Static Libraries 10 Try It Out—Static Libraries 10 Shared Libraries 12 Getting Help 13 Try It Out—Manual Pages and info 14 Summary 15 Chapter 2: Shell Programming 17 Why Program with a Shell? 18 A Bit of Philosophy 18 What Is a Shell? 19 Pipes and Redirection 21 Redirecting Output 21 Redirecting Input 22 Pipes 23 Contents The Shell as a Programming Language 23 Interactive Programs 23 Creating a Script 25 Making a Script Executable 26 Shell Syntax 27 Variables 28 Quoting 28 Try It Out—Variables 29 Environment Variables 29 Parameter Variables 30 Try It Out—Parameter and Environment Variables 31 Conditions 32 The test, or [, Command 32 Control Structures 35 if 35 Try It Out—Using the if Command 35 elif 36 Try It Out—Doing Further Checks with an elif 36 A Problem with Variables 36 for 37 Try It Out—for Loop with Fixed Strings 38 Try It Out—for Loop with Wildcard Expansion 38 while 39 Try It Out—Here We Go Again, Again 40 until 41 case 41 Try It Out—Case I: User Input 42 Try It Out—Case II: Putting Patterns Together 42 Try It Out—Case IIl: Executing Multiple Statements 43 Lists 44 Try It Out—AND Lists 45 Try It Out—OR Lists 46 Statement Blocks 47 Functions 47 Try It Out—A Simple Function 47 Try It Out—Returning a Value 49 Commands 50 break 50 The : Command 51 viii Contents continue 51 The . Command 52 Try It Out—The Dot Command 53 echo 53 eval 54 exec 54 exit n 55 export 55 Try It Out—Exporting Variables 56 expr 56 printf 57 return 58 set 58 59 shift trap 60 Try It Out—Trapping Signals 60 unset 62 Two More Useful Commands and Regular Expressions 62 Try It Out—find with Tests 64 Try It Out—Basic grep Usage 66 Try It Out—Regular Expressions 68 Command Execution 69 Arithmetic Expansion 70 Parameter Expansion 70 Try It Out—Parameter Processing 72 Here Documents 73 Try It Out—Using Here Documents 73 Try It Out—Another Use for a Here Document 74 Debugging Scripts 75 Going Graphical—The Dialog Utility 76 Try It Out—Using the dialog Utility 78 Try It Out 79 Putting It All Together 80 Requirements 81 Design 81 Try It Out—A CD Application 83 Notes on the Application 90 Summary 90 ix Contents Chapter 3: Working with Files 91 Linux File Structure 92 Directories 92 Files and Devices 93 /dev/console 93 /dev/tty 93 /dev/null 94 System Calls and Device Drivers 94 Library Functions 95 Low-Level File Access 96 write 96 read 97 open 98 Initial Permissions 100 umask 100 close 101 ioctl 102 Try It Out—A File Copy Program 102 Other System Calls for Managing Files 104 lseek 104 fstat, stat, and lstat 104 dup and dup2 106 The Standard I/O Library 107 fopen 108 fread 108 fwrite 109 fclose 109 fflush 109 fseek 110 fgetc, getc, and getchar 110 fputc, putc, and putchar 110 fgets and gets 111 Formatted Input and Output 111 printf, fprintf, and sprintf 112 scanf, fscanf, and sscanf 114 Other Stream Functions 116 Try It Out—Another File Copy Program 116 Stream Errors 117 Streams and File Descriptors 118 File and Directory Maintenance 118 chmod 118 chown 119 x Contents unlink, link, and symlink 119 mkdir and rmdir 119 chdir and getcwd 120 Scanning Directories 120 opendir 121 readdir 121 telldir 122 seekdir 122 closedir 122 Try It Out—A Directory-Scanning Program 122 Errors 125 strerror 125 perror 126 The /proc File System 126 Advanced Topics: fcntl and mmap 130 fcntl 130 mmap 131 Try It Out—Using mmap 132 Summary 134 Chapter 4: The Linux Environment 135 Program Arguments 135 Try It Out—Program Arguments 137 getopt 138 Try It Out—getopt 139 getopt_long 140 Environment Variables 142 Try It Out—getenv and putenv 143 Use of Environment Variables 144 The environ Variable 145 Try It Out—environ 145 Time and Date 146 Try It Out—time 146 Try It Out—gmtime 148 Try It Out—ctime 150 Try It Out—strftime and strptime 152 Temporary Files 153 Try It Out—tmpnam and tmpfile 154 User Information 155 Try It Out—User Information 156 Host Information 158 Try It Out—Host Information 159 xi Contents Logging 160 Try It Out—syslog 162 Try It Out—logmask 163 Resources and Limits 164 Try It Out—Resource Limits 167 Summary 169 Chapter 5: Terminals 171 Reading from and Writing to the Terminal 171 Try It Out—Menu Routines in C 172 Canonical versus Non-Canonical Modes 173 Handling Redirected Output 174 Try It Out—Checking for Output Redirection 175 Talking to the Terminal 176 Try It Out—Using /dev/tty 176 The Terminal Driver and the General Terminal Interface 178 Overview 178 Hardware Model 179 The termios Structure 180 Input Modes 181 Output Modes 182 Control Modes 183 Local Modes 183 Special Control Characters 184 Characters 185 The TIME and MIN Values 185 Accessing Terminal Modes from the Shell 186 Setting Terminal Modes from the Command Prompt 187 Terminal Speed 187 Additional Functions 188 Try It Out—A Password Program with termios 189 Try It Out—Reading Each Character 190 Terminal Output 191 Terminal Type 191 Identify Your Terminal Type 192 Using terminfo Capabilities 195 Try It Out—Total Terminal Control 198 Detecting Keystrokes 200 Try It Out—Your Very Own kbhit 200 Virtual Consoles 202 Pseudo Terminals 204 Summary 204 xii Contents Chapter 6: Managing Text-Based Screens with curses 205 Compiling with curses 206 Concepts 207 Try It Out—A Simple curses Program 208 Initialization and Termination 210 Output to the Screen 210 Reading from the Screen 211 Clearing the Screen 211 Moving the Cursor 212 Character Attributes 212 Try It Out—Moving, Inserting, and Attributes 212 The Keyboard 214 Keyboard Modes 215 Keyboard Input 215 Try It Out—Keyboard Modes and Input 216 Windows 217 The WINDOW Structure 217 Generalized Functions 218 Moving and Updating a Window 218 Try It Out—Multiple Windows 219 Optimizing Screen Refreshes 222 Subwindows 223 Try It Out—Subwindows 223 The Keypad 225 Try It Out—Using the Keypad 226 Color 227 Try It Out—-Colors 229 Redefining Colors 230 Pads 230 Try It Out—Using a Pad 231 The CD Collection Application 233 Try It Out—A New CD Collection Application 233 Try It Out—Looking at main 235 Try It Out—The Menu 236 Try It Out—Database File Manipulation 238 Try It Out—Querying the CD Database 243 Summary 247 Chapter 7: Data Management 249 Managing Memory 249 Simple Memory Allocation 250 Try It Out—Simple Memory Allocation 250 xiii Contents Allocating Lots of Memory 251 Try It Out—Asking for All Physical Memory 251 Try It Out—Available Memory 252 Abusing Memory 254 Try It Out—Abuse Your Memory 254 The Null Pointer 255 Try It Out—Accessing a Null Pointer 255 Freeing Memory 256 Try It Out—Freeing Memory 257 Other Memory Allocation Functions 257 File Locking 258 Creating Lock Files 258 Try It Out—Creating a Lock File 259 Try It Out—Cooperative Lock Files 260 Locking Regions 262 The F_GETLK Command 263 The F_SETLK Command 264 The F_SETLKW Command 264 Use of read and write with Locking 264 Try It Out—Locking a File with fcntl 265 Try It Out—Testing Locks on a File 267 Competing Locks 270 Try It Out—Competing Locks 270 Other Lock Commands 273 Deadlocks 273 Databases 274 The dbm Database 274 Introduction to dbm 274 Getting dbm 275 Troubleshooting and Reinstalling dbm 275 The dbm Routines 276 dbm Access Functions 277 dbm_open 277 dbm_store 277 dbm_fetch 277 dbm_close 278 Try It Out—A Simple dbm Database 278 Additional dbm Functions 280 dbm_delete 281 dbm_error 281 xiv Contents dbm_clearerr 281 dbm_firstkey and dbm_nextkey 281 Try It Out—Retrieving and Deleting 281 The CD Application 282 Updating the Design 283 The CD Database Application Using dbm 283 Try It Out—cd_data.h 284 Try It Out—app_ui.c 285 Try It Out—cd_access.c 295 Summary 302 Chapter 8: MySQL 303 Installation 304 Precompiled Packages 304 Post-Install Configuration 306 Post-Installation Troubleshooting 310 MySQL Administration 310 Commands 310 myisamchk 311 mysql 311 mysqladmin 312 mysqlbug 313 mysqlimport 314 mysqlshow 314 Creating Users and Giving Them Permissions 314 grant 314 revoke 316 Passwords 316 Creating a Database 317 Data Types 318 Boolean 318 Character 318 Number 318 Temporal 319 Creating a Table 319 Graphical Tools 322 Accessing MySQL Data from C 325 Connection Routines 326 Error Handling 330 xv Contents Executing SQL Statements 331 SQL Statements That Return No Data 331 Discovering What You Inserted 334 Try It Out 334 Try It Out 335 Statements That Return Data 336 Processing Returned Data 340 Miscellaneous Functions 346 The CD Database Application 347 Creating the Tables 348 Adding Some Data 350 Try It Out 352 Accessing the Application Data from C 353 Interface Definition 353 Test Application Interface 354 Implementing the Interface 355 Summary 363 Chapter 9: Development Tools 365 Problems of Multiple Source Files 365 The make Command and Makefiles 366 The Syntax of Makefiles 366 Options and Parameters to make 367 Dependencies 367 Rules 368 Try It Out—A Simple Makefile 368 Comments in a Makefile 370 Macros in a Makefile 370 Try It Out—A Makefile with Macros 370 Multiple Targets 372 Try It Out—Multiple Targets 372 Built-in Rules 374 Suffix and Pattern Rules 375 Managing Libraries with make 376 Try It Out—Managing a Library 376 Advanced Topic: Makefiles and Subdirectories 378 GNU make and gcc 378 Try It Out—gcc -MM 379 Source Code Control 379 RCS 380 The rcs Command 380 The ci Command 381 xvi Contents The co Command 381 The rlog Command 382 The rcsdiff Command 383 Identifying Revisions 383 Try It Out—GNU make with RCS 385 The ident Command 385 Try It Out—ident 385 SCCS 386 Comparing RCS and SCCS 386 CVS 386 Using CVS Locally 387 Accessing CVS over a Network 390 gCVS 390 BitKeeper 391 Writing a Manual Page 391 Distributing Software 395 The patch Program 395 Other Distribution Utilities 397 RPM Packages 399 Working with RPM Package Files 400 Installing RPM Packages 400 Building RPM Packages 401 Gathering the Software 401 Creating an RPM Spec File 403 Building an RPM Package with rpmbuild 407 Other Package Formats 410 Development Environments 410 xwpe 410 C-Forge 411 KDevelop 412 Other Environments 414 Summary 415 Chapter 10: Debugging 417 Types of Errors 417 General Debugging Techniques 418 A Program with Bugs 418 Code Inspection 421 Instrumentation 422 Try It Out—Debug Information 423 Debugging without Recompiling 424 Controlled Execution 424 xvii Contents Debugging with gdb 425 Starting gdb 425 Running a Program 426 Stack Trace 427 Examining Variables 427 Listing the Program 428 Setting Breakpoints 429 Patching with the Debugger 432 Learning More about gdb 433 More Debugging Tools 434 Lint: Removing the Fluff from Your Programs 434 Function Call Tools 436 ctags 436 cxref 436 cflow 437 Execution Profiling with prof/gprof 438 Assertions 439 Try It Out—assert 439 Memory Debugging 440 ElectricFence 441 Try It Out—ElectricFence 441 valgrind 442 Try It Out—valgrind 442 Summary 444 Chapter 11: Processes and Signals 445 What Is a Process? 445 Process Structure 446 The Process Table 447 Viewing Processes 447 System Processes 449 Process Scheduling 450 Starting New Processes 451 Try It Out—system 452 Replacing a Process Image 453 Try It Out—execlp 454 Duplicating a Process Image 455 Try It Out—fork 457 Waiting for a Process 458 Try It Out—wait 458 Zombie Processes 460 Try It Out—Zombies 460 xviii Contents Input and Output Redirection 462 Try It Out—Redirection 462 Threads 463 Signals 463 Try It Out—Signal Handling 465 Sending Signals 467 Try It Out—An Alarm Clock 468 A Robust Signals Interface 470 Try It Out—sigaction 470 Signal Sets 471 sigaction Flags 473 Common Signal Reference 474 Summary 476 Chapter 12: POSIX Threads 477 What Is a Thread? 477 Advantages and Drawbacks of Threads 478 A First Threads Program 479 Try It Out—A Simple Threaded Program 481 Simultaneous Execution 483 Try It Out—Simultaneous Execution of Two Threads 483 Synchronization 485 Synchronization with Semaphores 485 Try It Out—A Thread Semaphore 486 Synchronization with Mutexes 490 Try It Out—A Thread Mutex 490 Thread Attributes 494 Try It Out—Setting the Detached State Attribute 495 Thread Attributes—Scheduling 497 Try It Out—Scheduling 497 Canceling a Thread 498 Try It Out—Canceling a Thread 499 Threads in Abundance 501 Try It Out—Many Threads 501 Summary 504 Chapter 13: Inter-Process Communication: Pipes 505 What Is a Pipe? 505 Process Pipes 506 popen 506 pclose 507 Try It Out—Reading Output from an External Program 507 xix Contents Sending Output to popen 508 Try It Out—Sending Output to an External Program 508 Passing More Data 509 Try It Out—Reading Larger Amounts of Data from a Pipe 509 How popen Is Implemented 510 Try It Out—popen Starts a Shell 510 The Pipe Call 511 Try It Out—The pipe Function 512 Try It Out—Pipes across a fork 513 Parent and Child Processes 514 Try It Out—Pipes and exec 515 Reading Closed Pipes 516 Pipes Used as Standard Input and Output 517 File Descriptor Manipulation by close and dup 517 Try It Out—Pipes and dup 518 Named Pipes: FIFOs 520 Try It Out—Creating a Named Pipe 521 Accessing a FIFO 522 Try It Out—Accessing a FIFO File 522 Opening a FIFO with open 523 Try It Out—Opening FIFO Files 524 O_RDONLY and O_WRONLY with No O_NONBLOCK 525 O_RDONLY with O_NONBLOCK and O_WRONLY 526 Reading and Writing FIFOs 526 Try It Out—Inter-Process Communication with FIFOs 527 Advanced Topic: Client/Server Using FIFOs 529 Try It Out—An Example Client/Server Application 530 The CD Database Application 533 Aims 534 Implementation 534 Try It Out—The Header File, cliserv.h 536 Client Interface Functions 538 Try It Out—The Client’s Interpreter 538 Searching the Database 542 Try It Out—Searching 543 The Server Interface 544 Try It Out—server.c 544 The Pipe 548 Try It Out—Pipes Implementation Header 549 Server-Side Functions 549 Try It Out—Server Functions 549 Try It Out—Plumbing the Pipes 551 xx Contents Client-Side Functions 552 Try It Out—Client Functions 552 Try It Out—Getting Server Results 553 Application Summary 554 Summary 555 Chapter 14: Semaphores, Shared Memory, and Message Queues 557 Semaphores 557 Semaphore Definition 558 A Theoretical Example 559 Linux Semaphore Facilities 560 semget 561 semop 561 semctl 562 Using Semaphores 563 Try It Out—Semaphores 563 Shared Memory 566 shmget 568 shmat 568 shmdt 569 shmctl 569 Try It Out—Shared Memory 570 Message Queues 573 msgget 574 msgsnd 574 msgrcv 575 msgctl 576 Try It Out—Message Queues 576 The CD Database Application 579 Try It Out—Revising the Server Functions 580 Try It Out—Revising the Client Functions 581 IPC Status Commands 583 Semaphores 583 Shared Memory 584 Message Queues 584 Summary 585 Chapter 15: Sockets 587 What Is a Socket? 588 Socket Connections 588 Try It Out—A Simple Local Client 588 Try It Out—A Simple Local Server 590 xxi Contents Socket Attributes 592 Socket Domains 592 Socket Types 593 Socket Protocols 594 Creating a Socket 594 Socket Addresses 595 Naming a Socket 596 Creating a Socket Queue 596 Accepting Connections 597 Requesting Connections 597 Closing a Socket 598 Socket Communications 598 Try It Out—Network Client 599 Try It Out—Network Server 600 Host and Network Byte Ordering 601 Network Information 602 Try It Out—Network Information 604 Try It Out—Connecting to a Standard Service 606 The Internet Daemon (inetd) 608 Socket Options 609 Multiple Clients 610 Try It Out—A Server for Multiple Clients 610 select 613 Try It Out—select 614 Multiple Clients 616 Try It Out—An Improved Multiple Client/Server 616 Datagrams 619 Summary 622 Chapter 16: Programming GNOME Using GTK+ 623 Introducing X 623 X Server 624 X Client 624 X Protocol 624 Xlib 624 Toolkits 625 Window Managers 625 Other Ways to GUI—Platform-Independent Windowing APIs 625 Introducing GTK+ 626 GLib Type System 626 GTK+ Object System 627 xxii Contents Introducing GNOME 628 Installing the GNOME/GTK+ Development Libraries 629 Try it Out—A Plain GtkWindow 631 Events, Signals, and Callbacks 632 Try It Out—A Callback Function 633 Packing Box Widgets 635 Try It Out—Widget Container Layout 636 GTK+ Widgets 638 GtkWindow 638 GtkEntry 639 Try It Out—Username and Password Entry 640 GtkSpinButton 643 Try It Out—GtkSpinButton 644 GtkButton 644 GtkToggleButton 645 GtkCheckButton 645 GtkRadioButton 645 Try It Out—GtkCheckButton, GtkToggleButton, and GtkRadioButton 646 GtkTreeView 648 Try It Out—GtkTreeView 650 GNOME Widgets 652 Try It Out—A GNOME Window 653 GNOME Menus 653 Try It Out—GNOME Menus 655 Try It Out—Menus with GNOME Macros 657 Dialogs 658 GtkDialog 658 Modal Dialog Box 660 Nonmodal Dialogs 661 GtkMessageDialog 662 CD Database Application 663 Try It Out—cdapp_gnome.h 664 Try It Out—interface.c 665 Try It Out—callbacks.c 669 Try It Out—main.c 673 Summary 675 Chapter 17: Programming KDE Using Qt 677 Introducing KDE and Qt 677 Installing Qt 678 Try It Out—QMainWindow 680 xxiii Contents Signals and Slots 681 Try It Out—Signals and Slots 683 Try It Out—Using QBoxLayout Classes 686 Qt Widgets 688 QLineEdit 688 Try It Out—QLineEdit 689 Qt Buttons 691 QButton—The Button Base Class 691 QPushButton 692 QCheckBox 692 QRadioButton 693 Try It Out—QButtons 694 QComboBox 695 Try It Out—QComboBox 697 QListView 699 Try It Out—QListView 700 Dialogs 701 QDialog 702 Modal Dialogs 702 Nonmodal Dialogs 703 Semimodal Dialog 703 QMessageBox 704 QInputDialog 705 Using qmake to Simplify Writing Makefiles 707 Menus and Toolbars 708 Try It Out—A KDE Application with Menus and Toolbars 709 CD Database Application Using KDE/Qt 711 Try It Out—MainWindow 712 Try It Out—AddCdDialog 715 Try It Out—LogonDialog 717 Try It Out—main.cpp 719 Summary 720 Chapter 18: Device Drivers 721 Writing Device Drivers 721 Devices 722 Device Classes 723 User and Kernel Space 724 What Goes Where? 725 Building Modules 725 Data Types 727 Try It Out—A Kernel Module 727 xxiv Contents Character Devices 729 File Operations 730 A Sample Driver: schar 732 The MSG Macro 733 Registering the Device 734 Module Usage Count 735 Open and Release 735 Reading the Device 736 The current Task 737 Wait Queues 738 Writing to the Device 739 Nonblocking Reads 740 Seeking 741 ioctl 741 Checking User Rights 744 poll 744 Try It Out—Reading and Writing to schar 745 Try It Out—ioctl 746 Module Parameters 747 Try It Out—modinfo 747 proc File System Interface 748 How schar Behaves 750 Time and Jiffies 750 Small Delays 752 Timers 752 Try It Out—The Timer Implementation in schar 754 Giving Up the Processor 755 Task Queues 756 The Predefined Task Queues 756 Memory Management 758 Virtual Memory Areas 759 Address Space 759 Types of Memory Locations 760 Getting Memory in Device Drivers 761 kmalloc 762 vmalloc 762 Transferring Data between User and Kernel Space 763 Moving More Data 764 Simple Memory Mapping 765 I/O Memory 766 Assignment of Devices in Iomap 768 I/O Memory mmap 768 Try It Out—The Iomap Module 769 xxv Contents I/O Ports 771 Interrupt Handling 772 Allocating an Interrupt 773 Getting an Appropriate IRQ 774 The IRQ Handler 775 Bottom Halves 776 Re-entrancy 777 Disabling Single Interrupts 778 Atomicity 779 Protecting Critical Sections 780 Basic Spin Locks 780 Reader and Writer Locks 780 Automated Locking 781 Block Devices 781 radimo—A Simple RAM Disk Module 782 Size Issues 783 Registering a Block Device 784 Media Change 785 ioctl for Block Devices 785 The request Function 786 The Buffer Cache 788 Try It Out—radimo 789 Going Further 790 Debugging 790 Oops Tracing 790 Debugging Modules 792 The Magic Key 793 Kernel Debugger—kdb 793 Remote Debugging 794 General Notes on Debugging 794 Portability 795 Data Types 795 Endianess 795 Alignment 796 Anatomy of the Kernel Source 796 Summary 797 Chapter 19: Standards for Linux 799 The C Programming Language 800 A Brief History Lesson 800 The GNU Compiler Collection 801 xxvi Contents gcc Options 801 Compiler Options for Standards Tracking 802 Define Options for Standard Tracking 802 Compiler Options for Warnings 802 Interfaces and the LSB 803 LSB Standard Libraries 804 A Brief History Lesson 804 Using the LSB Standard for Libraries 805 LSB Users and Groups 805 LSB System Initialization 805 The Filesystem Hierarchy Standard 807 /bin 808 /boot 808 /dev 808 /etc 809 /home 809 /lib 809 /mnt 809 /opt 809 /root 809 /sbin 809 /tmp 809 /usr 810 /var 810 Further Reading about Standards 810 Summary 810 Index 811

2009-10-06

GentooLinux

gentoolinux安装入门介绍,pdf格式

2009-09-26

谭浩强-C program

清华谭浩强版C语言教程,中文版。C语言入门学习很好的书籍。

2009-04-25

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除