Linux
Aegeaner
这个作者很懒,什么都没留下…
展开
-
Linux安全体系学习笔记之一:Linux日志系统与审计系统
最近在读倪继利的《Linux安全体系分析与编程》,想把一些笔记发出来,这是第一篇。Linux的日志系统主要就是syslog系统构架,其实现是内核函数printk将消息写入一个环形缓冲区中,供高层的sys_syslog系统调用读取。代码部分在linux/kernel/printk.c Linux的审核系统提供了一种记录系统安全信息的方法,为系统管理员在用户违反系统安全规则时提供及时的警告信息原创 2011-12-25 15:02:32 · 2476 阅读 · 0 评论 -
Qemu Networking: NAT
Configuring Network Address Translation (NAT) is a useful way to network virtual machines in a desktop environment (particularly, when using wireless networking). A NAT network will allow your guests转载 2012-09-23 15:19:04 · 1622 阅读 · 0 评论 -
用GDB调试NGINX
首先configure加上参数--with-debug。然后cd objs,修改Makefile,定义CFLAGS = -pipe -g -O0 -fno-inline -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror。最后make && sudo make install。进入/usr/local/nginx(或者其他自原创 2012-10-10 11:51:59 · 3535 阅读 · 0 评论 -
hostapd在ArchLinux上搭建无线wifi信号的配置【备忘】
上篇日志参照Ubuntu下hostapd的wifi配置,用iptables的路由转发功能把校内vpn接口的数据转发给无线网卡接口。在Ubuntu下work的配置没有保存,在重装了Arch之后又重新配置了几个小时。这次做个备忘吧,毕竟这年头智能手机在室内太需要wifi了。wifi.sh:vpn-connectiptables -Fiptables -A FORWARD -s 10.42.原创 2012-08-11 00:53:18 · 2972 阅读 · 0 评论 -
使用KGDB调试内核 on QEMU
本文由daviyang35起草,DDD最终完成。对于本文有任何疑问,可直接在文章后评论询问。1: 编译Linux + KGDB1.1: 安装编译工具请参考其他相关教程,推荐在安装系统的时候就选择上编译器及支持库1.2: 下载最新内核代码在lmkl.org下载最新的内核源码, 可以直接使用浏览器下载代码,当然也可以使用命令wget来下载,下载后需使用tar来解压源代码。这里我转载 2012-06-18 15:02:51 · 1377 阅读 · 0 评论 -
Glibc中strlen的汇编实现
strlen.c文件中的内联汇编代码如下:#include size_tstrlen (const char *str){ int cnt; asm("cld\n" /* Search forward. */ /* Some old versions of gas need `repne' instead of `repnz'. */ "r原创 2012-03-26 21:26:57 · 2025 阅读 · 0 评论 -
Linux 中 x86 的内联汇编
Bharata B. Rao ([email protected])IBM Linux 技术中心,IBM 软件实验室,印度如果您是 Linux 内核的开发人员,您会发现自己经常要对与体系结构高度相关的功能进行编码或优化代码路径。您很可能是通过将汇编语言指令插入到 C 语句的中间(又称为内联汇编的一种方法)来执行这些任务的。让我们看一下 Linux 中内联汇编的特定用法。(我们将转载 2012-03-26 21:06:12 · 891 阅读 · 0 评论 -
Redis源代码分析之七:事件驱动库分析——Ae
aeEventLoop是一个记录记录程序事件状态的结构:/* State of an event based program */typedef struct aeEventLoop { int maxfd; long long timeEventNextId; aeFileEvent events[AE_SETSIZE]; /* Registered events */原创 2012-02-27 15:12:49 · 5239 阅读 · 1 评论 -
Redis源代码分析之六:Redis执行流程
现在我们分析Redis从启动开始的执行流程,从而顺藤摸瓜地理解其事件驱动模型。首先找到main入口:int main(int argc, char **argv) { time_t start; initServerConfig(); if (argc == 2) { if (strcmp(argv[1], "-v") == 0 ||原创 2012-02-27 14:09:40 · 8606 阅读 · 0 评论 -
Rails错误:LoadError: no such file to load – openssl 解决办法
Install openssl and openssl-devel.aptitude install libssl-devGo to your Ruby source directory and run the following commands:cd ext/opensslrvmsudo ruby extconf.rbmakemake install转载 2012-02-10 11:11:58 · 1983 阅读 · 0 评论 -
Redis源代码分析之五:简单动态字符串——Sds
一个Redis字符串的结构体定义是:struct sdshdr { int len; int free; char buf[];};其中buf字符数组中储存实际的字符串。len变量保存字符串的长度。free变量指出还有多少字节可用。sds被定义为一种新的数据类型,实际就是字符指针:typedef char *sds;例如,sdsnewlen原创 2012-02-04 15:40:27 · 2297 阅读 · 0 评论 -
【Redis】Why is an Event Library needed at all?
Let us figure it out through a series of Q&As.Q: What do you expect a network server to be doing all the time? A: Watch for inbound connections on the port its listening and accept them.Q: C转载 2012-02-04 15:05:34 · 1391 阅读 · 0 评论 -
Redis源代码分析之四:Unix底层网络通信——Anet
还是先介绍接口:int anetTcpConnect(char *err, char *addr, int port);int anetTcpNonBlockConnect(char *err, char *addr, int port);int anetUnixConnect(char *err, char *path);int anetUnixNonBlockConnect(ch原创 2012-02-04 14:29:33 · 4362 阅读 · 1 评论 -
Redis源代码分析之一:内存管理——Zmalloc
首先Zmalloc的接口定义在头文件Zmalloc.h里:void *zmalloc(size_t size);void *zcalloc(size_t size);void *zrealloc(void *ptr, size_t size);void zfree(void *ptr);char *zstrdup(const char *s);size_t zmalloc_use原创 2012-02-01 19:05:05 · 8525 阅读 · 1 评论 -
Redis源代码分析之二:散列表——Dict(上)
先介绍Redis散列表实现的几个重要数据结构:字典项DictEntry:typedef struct dictEntry { void *key; void *val; struct dictEntry *next;} dictEntry;字典类型DictType:typedef struct dictType { unsigned原创 2012-02-01 20:16:48 · 3921 阅读 · 0 评论 -
Linux Console Colors —— Linux 终端控制台字体颜色
在 Linux 下若想输出 类似与 Windows 下的多颜色字体如何做呢?本文就来介绍实现的方法。首先,来看下 在Linux 下颜色的表示All the colors that I have found are:\033[22;30m - black\033[22;31m - red\033[22;32m - green\033[22;33m - brow转载 2013-03-08 14:50:21 · 7117 阅读 · 0 评论