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 ......
ÏÈÓÃwhoÃüÁî²é¿´ËùÓеǽÖÕ¶Ë
#who -uH
Êä³öÈçÏ£º
NAME LINE TIME IDLE PID COMMENT
root :0 2010-03-01 19:13 ? & ......
-----------------------------
Based on Fedora 8 version:
-----------------------------
1. No common command like ifconfig in os?
Root cause is the standard search path not include /sbin and /usr/sbin. Try to include them in /etc/profile. As belows:
#Kenny add /sbin and /usr/sbin here.
&n ......
1. ×Ö·û´®²Ù×÷º¯Êý
³ÌÐò°´¹¦ÄÜ»®·Ö¿É·ÖΪÊýÖµÔËËã¡¢·ûºÅ´¦ÀíºÍI/O²Ù×÷ÈýÀ࣬·ûºÅ´¦Àí³ÌÐòÕ¼Ï൱´óµÄ±ÈÀý£¬·ûºÅ´¦Àí³ÌÐòÎÞ´¦²»ÔÚ£¬±àÒëÆ÷¡¢ä¯ÀÀÆ÷¡¢OfficeÌ×¼þµÈ³ÌÐòµÄÖ÷Òª¹¦Äܶ¼ÊÇ·ûºÅ´¦Àí¡£ÎÞÂ۶ิÔӵķûºÅ´¦Àí¶¼ÊÇÓɸ÷ÖÖ»ù±¾µÄ×Ö·û´®²Ù×÷×é³ÉµÄ£¬±¾½Ú½éÉÜÈçºÎÓÃCÓïÑԵĿ⺯Êý×ö×Ö·û´®³õʼ»¯¡¢È¡³¤¶È¡¢¿½±´¡¢Á¬½ ......