LINUX 进程间 信号
#include <iostream>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <signal.h>
using namespace std;
extern char **environ;
void signal_handle(int signal_no){
cout << "sign:" <<signal_no << endl;
}
int main(int args,char *argc[]){
pid_t pid=fork();
if(pid<0){
cout << "fork error!" <<endl;
}else if(pid==0){
signal(SIGUSR1,signal_handle_kill);
int count=0;
while(count<10){
count++;
cout << "count:" <<count <<endl;
sleep(1);
}
kill(getppid(),SIGUSR1);
}else{
signal(SIGUSR1,signal_handle);
pause();
}
}
相关文档:
#!/bin/bash
#Key Words:linux0.11 bochs harddisk bash
#mount hdimg name:hdimage-devel
#mount point:/mnt/initrd
hdimg=hdimage-devel
mpoint=/mnt/initrd
if [ "$1" == "mount" ]
then
#mount hdimg
echo "$1 START"
&n ......
linux目录架构
/ 根目录
/bin 常用的命令 binary file 的目錄
/boot 存放系统启动时必须读取的档案,包括核心 (kernel) 在内
/boot/grub/menu.lst GRUB设置
/boot/vmlinuz 内核
/boot/initrd 核心解壓縮所需 RAM Disk
/dev 系统周边设备
/etc ......
摘要:本章将向读者依次解释中断概念,解析Linux中的中断实现机理以及Linux下中断如何被使用。作为实例我们第一将向《i386体系结构》一章中打造的系统加入一个时钟中断;第二将为大家注解RTC中断,希望通过这两个实例可以帮助读者掌握中断相关的概念、实现和编程方法。
中断是什么
中断的汉语解释是半中间发生阻隔、停顿或 ......
1.时间表示
在程序当中,我们经常要输出系统当前的时间,比如我们使用date命令的输出结果。这个时候我们可以使用下面两个函数
time_t time(time_t *tloc); //时间精度为秒
char *ctime(const time_ ......