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

linux ¶¨Ê±Æ÷ʹÓöþ

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <ctype.h>
#include <time.h>
#include <unistd.h>
#include <signal.h>
static char *runStatusFile   = "/syscfg/etc/runStatusFile";
FILE *pFile = NULL;
char runCountStr[6]={0};
unsigned runCountInt = 0;
char runTimeStr[6]={0};
unsigned runTimeInt = 0;
void doTask()
{
 
 pFile = fopen(runStatusFile, "r+");
 fseek (pFile, 6L, SEEK_SET);
 fread (runTimeStr, sizeof(char), 5, pFile);
 runTimeInt = atoi(runTimeStr);
 runTimeInt += 10;
 fseek (pFile, 6L, SEEK_SET);
 sprintf(runTimeStr,"%d",runTimeInt);
 fwrite(runTimeStr, sizeof(char),5, pFile);
 
 //fseek (pFile, 6L, SEEK_SET);
 //fread (runTimeStr, sizeof(char), 5, pFile);
 //printf("runTimeStr = %s\n",runTimeStr);
 fclose(pFile); 
}
int main()
{
 pFile = fopen(runStatusFile, "r+");
 if(pFile == NULL)
 {
  pFile = fopen(runStatusFile,"w+");
  fseek (pFile, 0L, SEEK_SET);
  fwrite("0", sizeof(char), 1, pFile);
  fseek (pFile, 6L, SEEK_SET);
  fwrite("0", sizeof(char), 1, pFile);
 }  
 fseek (pFile, 0L, SEEK_SET);
 fread (runCountStr, sizeof(char), 5, pFile);
 runCountInt = atoi(runCountStr);
 runCountInt++;  
 sprintf(runCountStr,"%d",runCountInt);
 fseek (pFile, 0L, SEEK_SET);
 fwrite(runCountStr, sizeof(char), 5, pFile); 
 fclose(pFile);
 
 
 struct sigaction act;
 union sigval tsval;
 act.sa_handler = doTask;
 act.sa_flags = 0;
 sigemptyset(&act.sa_mask);
 sigaction(50, &act, NULL);
 
 while(1)
 {
  sleep(10); //˯Ãß10Ãë
  sigqueue(getpid(), 50, tsval);//ÏòÖ÷½ø³Ì·¢ËÍÐźţ¬Êµ¼ÊÉÏÊÇ×Ô¼º¸ø×Ô¼º·¢ÐźÅ
 }
 
 return 0;


Ïà¹ØÎĵµ£º

ʵսLinux Bluetooth±à³Ì£¨ËÄ£© L2CAP²ã±à³Ì

£¨L2CAPЭÒé¼ò½é£¬L2CAPÔÚBlueZÖеÄʵÏÖÒÔ¼°L2CAP±à³Ì½Ó¿Ú£©
Ò»£ºL2CAPЭÒé¼ò½é£º
Logical Link Control and Adaptation Protocol(L2CAP)
Âß¼­Á¬½Ó¿ØÖƺÍÊÊÅäЭÒé (L2CAP) ΪÉϲãЭÒéÌá¹©ÃæÏòÁ¬½ÓºÍÎÞÁ¬½ÓµÄÊý¾Ý·þÎñ£¬²¢Ìṩ¶àЭÒ鹦ÄܺͷָîÖØ×é²Ù×÷¡£L2CAP ³äÐíÉϲãЭÒéºÍÓ¦ÓÃÈí¼þ´«ÊäºÍ½ÓÊÕ×î´ó³¤¶ÈΪ 64K µÄ L2CAP Ê ......

ʵսLinux Bluetooth±à³Ì (Æß) SDPЭÒé

Service Discovery Protocol(SDP)ÌṩһÖÖÄÜÁ¦£¬ÈÃÓ¦ÓóÌÐòÓз½·¨·¢ÏÖÄÄÖÖ·þÎñ¿ÉÓÃÒÔ¼°ÕâÖÖ·þÎñµÄÌØÐÔ¡£
·þÎñ·¢ÏÖЭÒé(SDP»òBluetooth SDP)ÔÚÀ¶ÑÀЭÒéÕ»ÖжÔÀ¶ÑÀ»·¾³ÖеÄÓ¦ÓóÌÐòÓÐÌØÊâµÄº¬Ò⣬·¢ÏÖÄĸö·þÎñÊÇ¿ÉÓõĺÍÈ·¶¨ÕâЩ¿ÉÓ÷þÎñµÄÌØÕ÷¡£SDP¶¨ÒåÁËbluetooth client·¢ÏÖ¿ÉÓÃbluetooth server·þÎñºÍËüÃǵÄÌØÕ÷µÄ·½·¨¡£ ......

linuxÏÂÇý¶¯µÄÈë¿Úº¯Êý¼°¼ÓÔØ

      ¼¸ºõÿ¸ölinuxÇý¶¯¶¼Óиömodule_init¡£Ã»´í£¬Çý¶¯µÄ¼ÓÔØ¾Í¿¿Ëü¡£ÏÈÀ´·ÖÎöÒ»ÏÂmodule_init¡£¶¨ÒåÈçÏ£º
#define module_init(x)     __initcall(x);              //include\linux\init.h
#define ......

linuxʹÓÃÐÂÓ²ÅÌ


linuxϰ²×°ÐÂÓ²Å̲¢¼ÓÔØÊ¹ÓÃÊÖ¼Ç
================================================================================
Ò»¡¢¹ý³Ì²½Öè
1¡¢#kudzu                          //¼ì²âÐÂÓ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ