Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Linux Daemon Writing HOWTO


This document shows how to write a daemon in Linux using GCC. Knowledge of Linux and a familiarity with C are necessary to use this document. This HOWTO is Copyright by Devin Watson, under the terms of the BSD License.
1. Introduction: What is a Daemon?
2. Getting Started
3. Planning Your Daemon
3.1 What Is It Going To Do?
3.2 How Much Interaction?
4. Basic Daemon Structure
4.1 Forking The Parent Process
4.2 Changing The File Mode Mask (Umask)
4.3 Opening Logs For Writing
4.4 Creating a Unique Session ID (SID)
4.5 Changing The Working Directory
4.6 Closing Standard File Descriptors
5. Writing the Daemon Code
5.1 Initialization
5.2 The Big Loop
6. Putting It All Together
6.1 Complete Sample
1. Introduction: What is a Daemon?
A daemon (or service) is a background process that is designed to run autonomously,with little or not user intervention. The Apache web server http daemon (httpd) is one such example of a daemon. It waits in the background listening on specific ports, and serves up pages or processes scripts, based on the type of request.
Creating a daemon in Linux uses a specific set of rules in a given order. Knowing how they work will help you understand how daemons operate in userland Linux, but can operate with calls to the kernel also. In fact, a few daemons interface with kernel modules that work with hardware devices, such as external controller boards, printers,and PDAs. They are one of the fundamental building blocks in Linux that give it incredible flexibility and power.
Throughout this HOWTO, a very simple daemon will be built in C. As we go along, more code will be added, showing the proper order of execution required to get a daemon up and running.
2. Getting Started
First off, you'll need the following packages installed on your Linux machine to develop daemons, specifically:
GCC 3.2.2 or higher
Linux Development headers and libraries
If your system does not already have these installed (not likely, but che


Ïà¹ØÎĵµ£º

£Ûת£ÝLinuxÏ´´½¨×ÀÃæ¿ì½Ý·½Ê½

gnome: µãÓÒ¼ü---new Launcher£¬ÊäÈë¿ì½Ý·½Ê½µÄÃû³Æ£¬²¢Ñ¡ÔñÖ´ÐеijÌÐò¼´¿É¡£
kde: ÓÒ¼üµ¥»÷×ÀÃæµÄ¿Õ°×´¦£¬ÔÚµ¯³öµÄ¶Ô»°¿òÖÐÑ¡“н¨£­Ó¦ÓóÌÐòÁ´½Ó”¡£ÔÙÔÚµ¯³öµÄ´°¿ÚÖеã“Ö´ÐД£¬ÔÚÃüÁîÀ¸ÖеãºóÃæµÄä¯ÀÀ¼ü£¬ÕÒµ½ÏàÓ¦µÄ³ÌÐò¡£Ôٵ㓳£¹æ”£¬½øÐÐÈ¡Ãû¡¢¸ü¸Äͼ±êµÈ²Ù×÷£¬×îºóµãÈ·¶¨£¬ÕâÑù ......

Linux(Centos5.4)ÉÏ°²×°oracle10gR2(10.2.1)

http://www.puschitz.com/InstallingOracle10g.shtml
ÎÒÓõÄÊÇCentos5.4
DVD¹âÅÌ°²×°µÄlinux²Ù×÷ϵͳ£¬°²×°linuxµÄʱºòÑ¡ÉÏ¿ª·¢¹¤¾ß£¬Xmanager,ÓëÊý¾Ý¿âÏà¹ØµÄ°ü¡£
²Ù×÷ϵͳ°²×°Íê³ÉÖ®ºóÐèÒª½øÐÐһϵÁеÄÅäÖòÅÄÜ°²×°oracle10g£¬ÏÂÃæ°Ñ
Ö÷Òª²½Öè¼Ç¼ÏÂÀ´¡£
1.°²×°Íê²Ù×÷ϵͳ֮ºó»¹ÊÇÓÐЩ°üûÓа²×°£¬È»¶ø°²×°oracle10 ......

Linux TCP Socket³ÌÐò·ÖÎö

/************************
cÓïÑÔ±àдµÄtcp socketͨÐŵÄserver¶Ë¡£
¿ÉÒÔ³ÖÐø¼àÌýmyprotÖ¸¶¨µÄ¶Ë¿Ú
´òÓ¡¶Ë¿Ú½ÓÊÕµ½µÄ×Ö·ûÁ÷
Í·ÎļþÒòΪ¼âÀ¨ºÅ±»×ªÒ壬ËùÒÔÓÃÁËÒýºÅ
************************/
#include "stdio.h"
#include "stdlib.h"
#include "errno.h"
#include "string.h& ......

Ê·ÉÏ×îÅ£×îÈ«µÄLINUXÃüÁ

Unix Toolbox
This document is a collection of Unix/Linux/BSD commands and tasks which are useful for IT work or for advanced users. This is a practical guide with concise explanations, however the reader is supposed to know what s/he is doing.
Unix Toolbox revision 14.2
The latest version of this ......

linux pppd GRPS ÅäÖÃÈô¸ÉÎÊÌâ

±¾ÈËʹÓõÄTDµÄÄ£¿éÊÇLC63**,ÔÚÉϸöÔµÄÕ⼸Ìì¸ÕÄõ½°å×Ó£¬ÕÛÌÚÁ˽«½üÒ»¸öÔ£¬Õâ¸ö°å×Ó´òµç»°£¬ÉÏÍø¶¼Ã»ÓÐÎÊÌâÁË¡£
Ê×ÏÈ»¹ÊÇÓбØÒª½éÉÜÒ»ÏÂpppЭÒéÁË£¬ÊÇTDÉÏÍøµÄ»ù´¡£º
PPPÊǵã¶ÔµãµÄÁ¬½ÓЭÒé¡£ÕâÖÖÁ¬½Ó½¨Á¢Ö®ºó£¬½«¸øÁ½µã·Ö±ð·ÖÅäIPµØÖ·£¬Ê¹ÓÃÕâ¸öIP¿ÉÒÔ½øÐÐÁ½µãÖ®¼äµÄͨѶ¡£»¥ÁªÍø×î³õµÄ“²¦ºÅÉÏÍø”·½Ê½Ëµµ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ