linux daemon() 用法
名称
daemon-运行于后台
概要
#include <unistd.h>
int daemon(int nochdir, int noclose);
描述
daemon()函数,主要用于某些程序希望自己脱离终端的控制而运行于后台的情况。
除非nochdir为非零值,如果nochdir为0,那么daemon会从当前目录,更改到根目录(“/”)下运行。
除非noclose为非零值,如果noclose为0,那么daemon会将标准输入,标准输出,标准错误输出重定向到/dev/null。
返回值
成功返回0,失败返回-1。
NAME
daemon - run in the background
SYNOPSIS
#include <unistd.h>
int daemon(int nochdir, int noclose);
DESCRIPTION
The daemon() function is for programs wishing to detach themselves
from the controlling terminal and run in the background as system
daemons.
Unless the argument nochdir is non-zero, daemon() changes the current
working directory to the root ("/").
Unless the argument noclose is non-zero, daemon() will redirect stan-
dard input, standard output and standard error to /dev/null.
RETURN VALUE
(This function forks, and if the fork() succeeds, the parent does
_exit(0), so that further errors are seen by the child only.) On
success zero will be returned. If an error occurs, daemon() returns
&nb
相关文档:
1. HCI层协议概述:
HCI提供一套统一的方法来访问Bluetooth底层。如图所示:
从图上可以看出,Host Controller Interface(HCI) 就是用来沟通Host和Module。Host通常就是PC, Module则是以各种物理连接形式(USB,serial,pc-card等)连接到PC上的bluetooth Dongle。
在Host这一端:application,SDP,L2cap等协议 ......
一:前言
最近在研究android的sensor driver,主要是E-compass,其中用到了Linux input子系统.在网上也看了很多这方面的资料,感觉还是这篇分析的比较细致透彻,因此转载一下以便自己学习,同时和大家分享!
(这篇博客主要是以键盘驱动为例的,不过讲解的是Linux Input Subsystem,可以仔细的研究一下!)
键盘驱动将检 ......
在控制台下,用ls,就会发现,shell将不同类型的文件项目显示为不同的颜色。者可以提高效率,不用ls -l便能大概的把各个文件的类型情况了解一下。
你有没有想过更改这个着色配置呢?
其
实,在/etc下有一个DIR_COLORS的文件,这是一个着色控制的模版。现将这个模版拷出来。如果想让这个配置在root用户下生效,边拷到
......
虽然我们习惯于linux下命令行操作,但是安装某些软件必须是基于GUI下面的,这个时候总不能跑到机房去安装吧,但我们可以使用Xmanager软件实现对linux进行远程控制.
第一步,我们在
LINUX
系统下,修改
/etc/X11/xdm/Xaccess
文件,找到下面语句:
# *# any host can get a login window
去掉最前面的
#
号 ......