LINUX C Á´±í·â×°
main.c
//³õʼ»¯¶ÓÁÐ
void InitQueue(LiQueue *q)
{
q=(LiQueue*)malloc(sizeof(LiQueue));
q->front=q->rear=NULL;
}
//ÅжÏÊÇ·ñΪ¿Õ
int QueueEmpty(LiQueue *q)
{
if(q->rear==NULL)
{
return 1;
}
else
{
return 0;
}
}
//ÊÍ·Å
void ClearQueue(LiQueue *q)
{
QNode *p=q->front,*r;
if(p!=NULL)
{
r=p->next;
while(r!=NULL)
{
free(p);
p=r;
r=p->next;
}
}
free(q);
}
//ʵÏÖ¶ÓÁеÄÈë¶Ó
void enQueue(LiQueue *q,struct TCPMASSAGE stTcpSendBuff)
{
//·â×°½áµã
QNode *s;
s=(QNode*)malloc(sizeof(QNode));
memcpy(&s->data , &stTcpSendBuff , sizeof(stTcpSendBuff));
//s->data =e;
s->next=NULL;
if(q->rear==NULL)
{
q->front =s;
q->rear =s;
}
else
{
q->rear->next =s;
q->rear =s;
}
}
//³ö¶Óº¯Êý
int deQueue(LiQueue *q,struct TCPMASSAGE stTcpSendBuff)
{
QNode *t;
if(q->rear ==NULL)
{
return 0;
}
if(q->front ==q->rear )//Ö»ÓÐÒ»¸ö½áµã
{
t=q->front;
q->front =NULL;
q->rear =NULL;
}
else
{
t=q->front;
q->front=q->front->next;
}
memcpy(stTcpSendBuff.cTcpBuff,t->data.cTcpBuff,t->data.len);
stTcpSendBuff.len = t->data.len;
free(t);
return 1;
}
/*
//³ö¶Óº¯Êý
int deQueue(LiQueue *q,char *pstbuff,int *lenth)
{
QNode *t;
if(q->rear ==NULL)
{
return 0;
}
if(q->front ==q->rear )//Ö»ÓÐÒ»¸ö½áµã
{
t=q->front;
q->front =NULL;
q->r
Ïà¹ØÎĵµ£º
Linux Input Device ½é紹: APIs
jollen 發±íì¶ April 8, 2009 12:18 PM
Linux µÄ Input Device ÊÇÖØÒªµÄÒ»個 subsystem£¬ÔÚ進ÐÐ實Àý½é紹ǰ£¬ÏÈ´óÂÔÁ˽âÒ»ÏÂÏà關µÄ API¡£
Linux Input Device
input.cÊÇLinuxµÄ”input”驅動³Ìʽ£¬Ö÷ÒªÖ ......
The Linux USB input subsystem is a single, harmonized way to manage all input devices. This is a relatively new approach for Linux, with the system being partly incorporated in kernel version 2.4 and fully integrated in the 2.5 development series.
This article covers four basic areas: a descripti ......
Ôø×ö¹ýsignalÏà¹ØµÄÒ»µã¶ù¿ª·¢£¬Ì¸Ì¸ÎÒµÄһЩÀí½â¡£
Ê×ÏÈ£¬ÐèÒªÀí½â¼¸¸ösignalÏà¹ØµÄº¯Êý¡£
sigaddset(sigset_t* sigSet, int sigNum ) : ½«ÐźÅsigNum Ìí¼Óµ½Ðźż¯ sigSet ÖУ»
sigdelset(sigset_t* sigSet, int sigNum) : ½«ÐźŠsigNum ´ÓÐźż¯ sigSet ÖÐɾ³ý£»
......
1. ѧ»áд¼òµ¥µÄmakefile
2. ±àÒ»Ó¦ÓóÌÐò£¬¿ÉÒÔÓÃmakefileÅÜÆðÀ´
3. ѧ»áдÇý¶¯µÄmakefile
4. дһ¼òµ¥charÇý¶¯£¬makefile±àÒëͨ¹ý£¬¿ÉÒÔinsmod£¬ lsmod£¬ rmmod. ÔÚÇý¶¯µÄinitº¯ÊýÀï´òÓ¡hello world£¬ insmodºóÓ¦¸ÃÄܹ»Í¨¹ýdmesg¿´µ½Êä³ö¡£
&n ......