易截截图软件、单文件、免安装、纯绿色、仅160KB

学习linux多线程编程 相关概念

学习Linux多进程编程
一、进程的定义:程序执行和资源管理的最小单位。
二、进程控制:
(1)进程标识: 进程标识  子进程号  父进程号
 头文件  #include<unistd.h>  #include<unistd.h>
 函数功能  取得当前进程的进程号  取得当前进程的父进程号
 函数原型  Pid_t getpid(void) Pid_t getppid(void) 
 函数返回值  成功返回进程的进程标识符   成功返回父进程的进程标识符
注:Pid_t其实是一个typedef类型,相当于unsigned int.
例:
 #include<stdio.h>
#include<unistd.h>
int main()
{
   printf("系统分配的进程号是:%d\n",getpid());
   printf("系统分配的父进程号是:%d\n",getppid());
   return 0;
}
 (2)进程的创建:
    1)exec族函数:
 头文件  #include<unistd.h>
原型
int execl(const chat *path,const char *args,...)
int execv(const char *path,char const *argv[])
int execle(const cahr *path,const char *arg,...,char *const envp[])
int execve(const char *path,char *const argv[],char *const envp[])
int execlp(const char *file,char *arg,...)
int execvp(const cahr *file,char *const argv[])
 
返回  返回-1表示出错
由于比较多,在此只举例execve函数:
#include<stdio.h>
#include<unistd>
int main()
{
   char *args[]={"/usr/bin/vim",NULL};
   printf("系统分配的进程号是:%d\n",getpid());
   if(execve("/usr/bin/vim",args,NULL)<0)
     perror("创建进程出错!");
    return 0;
}
注:在用execve函数创建新进程的后,会以新的程序取代原来的进程,然后系统会从新的进程运行,但是新的进程的PID值会与原来进程的PID值相同.
2)system()函数
 头文件  #include<stdlib.h>
 功能  在进程中开始另一个进程
 原型  int system(const char *string)
 传入值  系统变量
 返回值
 成功则返回执行shell命令后的返回值,调用/bin/sh数百返回127,其他
失败返回-1,三叔string为空返回非零值
&nb


相关文档:

实战Linux Bluetooth编程(三) HCI层编程

1. HCI层协议概述:
HCI提供一套统一的方法来访问Bluetooth底层。如图所示:
从图上可以看出,Host Controller Interface(HCI)  就是用来沟通Host和Module。Host通常就是PC, Module则是以各种物理连接形式(USB,serial,pc-card等)连接到PC上的bluetooth Dongle。
在Host这一端:application,SDP,L2cap等协议 ......

LINUX下为ff添加flash 插件

首先, 我的FF版本是3.0.16的,从官网(http://get.adobe.com/flashplayer/)上下载.tar.gz包后。。解压出里面的一个*.so文件
件之后,把该文件复制到/usr/lib/mozillia/plugins下,重启ff就OK了。
(以上方法仅供参考,至少我是这样做的,并且成功了,) ......

获取Linux 2.6.x sys_call_table


在linux中所有的syscall都是调用int 0x80, int 0x80的中断服务程序为system_call(arch/x86/kernel/traps_32.c:set_system_gate(SYSCALL_VECTOR,&system_call).  system_call (arch/x86/entry_32.S)最终call *sys_call_table(,%eax,4)来完成一个syscall调用. 
即 int 0x80 -> system_call -> s ......

[转]如何实现Windows远程连接Linux操作系统

 
准备好两台已经上网的电脑。
 
1、设置等会要连接到的Linux系统
 
(1)必须是安装了telnet软件的系统,其中该软件分为两部分,分别是telnet-client和telnet-server,其中前者默认已经装好,而后者则需自己进行安装。在这里,笔者自己的是RedHat的FC6系统,所以可以输入命令yum install telnet-serve ......

linux下bin文件安装

At first you have to open a terminal/bash and then enter:
file /path/file.bin
for example file /home/user/file.bin (file is the command)
Now you should see a sentence including the word “executable” and not “non-executable, not executable,… or something completely differ ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号