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

linux ÍøÂç¼üÅÌ£¬Êó±ê

ÒòΪ¹«Ë¾µÄ°å×ÓÉϼüÅ̲»ºÃ°´£¬ËùÒÔд¸öÍøÂç°æµÄ£¬·½±ãµ÷ÊÔ¡£
client .c
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <linux/input.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <netdb.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
int connect_server(char * ipaddr, int myport)
{
int sockfd;
struct hostent *he;
struct sockaddr_in their_addr;
if((he=gethostbyname(ipaddr))==NULL) {
herror("gethostbyname");
return -1;
}
if ((sockfd = socket(PF_INET, SOCK_STREAM, 0)) == -1) {
perror("socket");
return -1;
}
their_addr.sin_family = PF_INET;
their_addr.sin_port = htons(myport);
their_addr.sin_addr = *((struct in_addr *)he->h_addr);
bzero(&(their_addr.sin_zero),0);
if (connect(sockfd, (struct sockaddr *)&their_addr, sizeof(struct sockaddr)) == -1) {
perror("connect");
return -1;
}
return sockfd;
}
int main(void)
{
int fds[16] = {-1};
int fd_max = -1;
char serverip[24] = {0};
int socketfd = -1;
int ret = 0;
struct input_event event_key;
char input[5*1024] = {0};
int fd = open("/proc/bus/input/devices", O_RDWR);
char dev[24] = "/dev/input/";
int len = read(fd, input, 5*1024);
printf("len = %d \n", len);
close(fd);
char *p;
p = input;
int j = 0;
strcpy(serverip, "192.168.168.114");
socketfd = connect_server(serverip, 7838);
if(socketfd == -1)
{
printf("connect_server faild \n");
return -1;
}
struct timeval select_timeout;
fd_set readfds;
select_timeout.tv_sec= 4;
select_timeout.tv_usec = 0;
for(; p != NULL; j++)
{
p = strstr(p, "event");
if (p)
{
memcpy(dev+11, p, 6);
printf("%s\n", dev);
p+= 6;
fds[j] = open(dev, O_RDWR);


Ïà¹ØÎĵµ£º

linuxµÄÎļþºÍĿ¼

chmod £»ÐÞ¸ÄĿ¼ȨÏÞ
eg£ºchmod o-t /tmp
touch:´´½¨ÐÂÎļþ
rm -rf:ɾ³ýÎļþ
set gid ¶ÔĿ¼µÄ×÷ÓÃ
1£ºÄ¬ÈÏÇé¿öÏ£¬Óû§½¨Á¢µÄÎļþÊôÓÚÓû§µ±Ç°ËùÔÚµÄ×é
2£ºÄ¿Â¼ÉÏÉèÖÃÁËsetgid£¬±íʾÔÚ´ËĿ¼ÖУ¬ÈκÎÈ˽¨Á¢µÄÎļþ£¬¶¼»áÊôÓÚĿ¼ËùÊôµÄ×é¡£
rm -rf test  //ɾ³ý֮ǰµÄtestĿ¼
mkdir test // ÔÚµ±Ç°Ä¿Â¼´´½¨Ò ......

±àÒëÒ»¸ölinuxÄÚºËÄ£¿é

¿´Ô´´úÂë¡£
#include <linux/kernel.h>
#include <linux/module.h>
#if CONFIG_MODVERSIONS==1
#define MODVERSIONS
#include <linux/modversions.h>
#endif
int init_module()
{
printk("Hello, I'm kernel\n");
return 0;
}
void cleanup_module()
{
printk("I'm kernel, bye\n");
} ......

linux ÈÃÄãµÄ½ø³Ìºǫ́ÔËÐÐ

fg¡¢bg¡¢jobs¡¢&¡¢ctrl + z¶¼ÊǸúϵͳÈÎÎñÓйصģ¬ËäÈ»ÏÖÔÚ»ù±¾Éϲ»ÔõôÐèÒªÓõ½ÕâЩÃüÁµ«Ñ§»áÁËÒ²ÊǺÜʵÓõÄ
Ò»¡£& ×î¾­³£±»Óõ½
   Õâ¸öÓÃÔÚÒ»¸öÃüÁîµÄ×îºó£¬¿ÉÒÔ°ÑÕâ¸öÃüÁî·Åµ½ºǫִ́ÐÐ
¶þ¡£ctrl + z
     ¿ÉÒÔ½«Ò»¸öÕýÔÚǰִ̨ÐеÄÃüÁî·Åµ½ºǫ́£¬²¢ÇÒÔÝÍ£
Èý¡£jobs
  & ......

linux 1ºÅ½ø³Ì

1ºÅ½ø³Ì£¬pidΪ1µÄ½ø³Ì£¬ÓÖ³Æinit½ø³Ì¡£
¡¡¡¡linuxϵͳÆô¶¯ºó£¬µÚÒ»¸ö±»´´½¨µÄÓû§Ì¬½ø³Ì¾ÍÊÇinit½ø³Ì¡£ËüÓÐÁ½ÏîʹÃü£º
¡¡¡¡1¡¢Ö´ÐÐϵͳ³õʼ»¯½Å±¾£¬´´½¨Ò»ÏµÁеĽø³Ì(ËüÃǶ¼ÊÇinit½ø³ÌµÄ×ÓËï);
¡¡¡¡2¡¢ÔÚÒ»¸öËÀÑ­»·ÖеȴýÆä×Ó½ø³ÌµÄÍ˳öʼþ£¬²¢µ÷ÓÃwaitidϵͳµ÷ÓÃÀ´Íê³É“ÊÕʬ”¹¤×÷;
¡¡¡¡init½ø³Ì²»»á±»ÔÝ ......

linux³£¼ûµÄ·¢Ðа汾

¡¡¡¡REDHAT
´´½¨ÓÚ1993Ä꣬ÊÇ
Ä¿ÊÀ½çÉÏ×î×ÊÉîµÄLinuxºÍ¿ª·ÅÔ´´úÂëÌṩÉÌ£¬Í¬Ê±Ò²ÊÇ×î»ñÈϿɵÄLinux
Æ·ÅÆ¡£»ùÓÚ¿ª·ÅÔ´´úÂëģʽ£¬ºìñΪȫÇòÆóÒµÌṩרҵ¼¼ÊõºÍ·þÎñ¡£ºìñµÄ½â¾ö
·½°¸°üÀ¨ºìñÆóÒµLinux²Ù×÷ƽ̨£¬ÒÔ¼°ÆäËûÄÚÈݹ㷺µÄ·þÎñ£¬Èç:×Éѯ£¬24X7¼¼ÊõÖ§³ÖºÍºìÃ±ÍøÂç(RHN)¡£ºìñÒÔ¶©ÔĵÄÉÌҵģʽÏòÓû§Ìṩ²»¼ä¶Ï
µ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ