linux知识

针对Ubuntu14.04简单配置samba服务器

★1.更新源 sudo apt-get update ★2.安装samba sudo apt-get install samba samba-common由于Ubuntu版本问题也许会用到 sudo apt-get install samba sudo apt-get install smbfs ★3.创建一个文件夹 mkdir ~/fzh_share sudo chmod 777 ~/fzh_share ★4.创建用户…

内核模块参数设置

内核模块参数设置 通过宏 module_param 来指定模块参数,模块参数用于在加载模块时传递参数给内核模块. 定义如下 module_param(name,type,perm) name 是模块参数的名称. type 是这个参数的类型. perm 是模块参数的访问权限 type常见值 bool布尔 int整型 charp…

内核模块的安装和卸载

* 加载内核模块 insmod hello.ko * 卸载内核模块 rmmod hello * 查看内核模块 lsmod * 含有依赖的内核模块加载 modprobe hello与insmod区别在于,此命令会根据文件/lib/modules//modules.dep 来查看要加载的模块,看是否依赖于其他模块,如果需要modprobe会首先…

内核模块程序结构以及编译内核模块(单个文件以及多个文件)

单个文件编译的内核模块例子 #include <linux/module.h> #include <linux/init.h> static int __init hello_init() { printk("Hello world!\n"); } static int __exit hello_exit() { printk("<7>Hello <0>exit!\n"); } module_init( hello_init); module_exit( hello_exit); 1.模块加载函</linux/init.h></linux/module.h>…

makefile简单概述

首先写一个简单的makefile hello: main.o func1.o func2.o (TAB)gcc main.o func1.o func2.o -o hello main.o : main.c (TAB)gcc -c main.c func1.o : func1.c (TAB)gcc -c func1.c func2.o : func2.c (TAB)gcc -c func2.c .PHONY : clean clean: (TAB)rm -f…

GDB使用方法

例子程序tst.c #include <stdio.h> void main() { int i; long result = 0; for ( i=1; i <= 100; i++) { result += i; } printf("result = %d\n",result); } 1.首先编译程序tst.c生成可执行程序tst gcc -g tst.c -o tst 2.启动GDB gdb tst 3.在main处设置断点 (b=bre</stdio.h>…