linux»ñÈ¡ÍøÂç½Ó¿ÚÃû£ºÈçeth0
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<net/if.h>
static char *bad_interface_names[] = {
"lo:",
"lo",
"stf", /* pseudo-device 6to4 tunnel interface */
"gif", /* psuedo-device generic tunnel interface */
"dummy",
"vmnet",
NULL /* last entry must be NULL */
};
static int is_bad_interface_name(char *i) {
char **p;
for (p = bad_interface_names; *p; ++p)
if (strncmp(i, *p, strlen(*p)) == 0)
return 1;
return 0;
}
/* This finds the first interface which is up and is not the loopback
* interface or one of the interface types listed in bad_interface_names. */
static char *get_first_interface(void) {
struct if_nameindex * nameindex;
char *i = NULL;
int j = 0;
/* Use if_nameindex(3) instead? */
nameindex = if_nameindex();
if(nameindex == NULL) {
return NULL;
}
while(nameindex[j].if_index != 0) {
if (strcmp(nameindex[j].if_name, "lo") != 0 && !is_bad_interface_name(nameindex[j
Ïà¹ØÎĵµ£º
Linux USBÇý¶¯¿ò¼Ü·ÖÎö£¨Ò»£©
³õ´Î½Ó´¥ÓëOSÏà¹ØµÄÉ豸Çý¶¯±àд£¬¸Ð¾õ»¹Í¦ÓÐÒâ˼µÄ£¬ÎªÁ˲»ÖÁÓÚÍüµô¿´¹ýµÄ¶«Î÷£¬±Ê¼Ç¸ú×ܽᵱȻ²»¿Éȱ£¬¸üºÎ¿öÎÒ¾ö¶¨ÎªÇ¶ÈëʽÂôÃüÁË¡£ºÃ£¬ÑÔ¹éÕý´«£¬ÎÒ˵һ˵Õâ¶Îʱ¼äµÄÊÕ»ñ£¬¸ú´ó¼Ò·ÖÏíÒ»ÏÂLinuxµÄÇý¶¯¿ª·¢¡£µ«Õâ´ÎÖ»ÏÈÕë¶ÔLinuxµÄUSB×Óϵͳ×÷·ÖÎö£¬ÒòΪÖÜÎåÑÐÌÖÀϰå´ß» ......
½ñÌì·¢Ïֺܶà³ÌÐòËÀÔÚlinux ·þÎñ½øÖÐ
ÎʸöÎÊÌâ ½ñÌì·¢Ïֺܶà³ÌÐòËÀÔÚlinux ·þÎñ½øÖÐ
ÒѾËÀÁ˺öàÌìÁË¡£ÓÃcrontab ¶¼¶¨ÔÚ Á賿0µãÅÜ¡£
ÏëÖªµÀÈçºÎ²é¿´ ·þÎñÆ÷ÄÄ·½ÃæµÄ×ÊÔ´Ì«ÉÙµ¼Ö½ø³ÌËÀÔÚÀïÃæ£¿
ps -ef|grep load/script | awk '{print $2}' °ÑËÀ½ø³ÌµÄ ID ´òÓ¡³öÀ´
......
ÒÔÏÂÊÇÎҵIJâÊÔociµÄÀý×Ó£¡
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "oci.h"
static OCIServer *srvhp;
static OCISession *p_session;
static OCIEnv &nb ......
3¡¢Ï̱߳êʶ
º¯ÊýÔÐÍ£º
#include <pthread.h>
pthread_t pthread_self(void);
pid_t getpid(void);
getpid()ÓÃÀ´È¡µÃĿǰ½ø³ÌµÄ½ø³Ìʶ±ðÂë,º¯Êý˵Ã÷
Àý³Ì8
³ÌÐòÄ¿µÄ£ºÊµÏÖÔÚн¨Á¢µÄÏß³ÌÖдòÓ¡¸ÃÏ̵߳ÄidºÍ½ø ......