Linuxƽ̨É϶¯Ì¬Á´½Ó¿âµÄ´´½¨Óë¼ÓÔØ
ÔÚ¶Ájvm´úÂëʱ£¬Ñ§Ï°Á˶ÁÈ¡¶¯Ì¬Á´½Ó¿âµÄ·½·¨¡£ÏÂÃæ¾Í.soÎļþµÄ´´½¨ºÍ¶ÁÈ¡×öÒ»¸ö¼òµ¥µÄ×ܽᡣ
1.´´½¨.soÎļþ
add.h
#ifndef ADD_H
#define ADD_H
int add(int arg1,int arg2);
#endif
add.c
#include "add.h"
int add(int arg1,int arg2)
{
return arg1 + arg2;
}
±àÒëΪ.oÎļþ:
gcc -fPIC -c add.c
Éú³É¿âÎļþ£º
gcc -shared -Wl,-soname,libadd.so.1 -o libadd.so.1.0 add.o
cp libadd.so.1.0 libadd.so
ÕâÑù¾ÍÉú³ÉÁËlibadd.so¿âÎļþ¡£ÐÞ¸ÄLD_LIBRARY_PATH,½«libadd.so¼ÓÈ뵽·¾¶ÖС£
2.¼ÓÔØ.soÎļþ£¬µ÷Óú¯Êý¡£
dltest.c,²Î¿¼man 3 dlopen °ïÖúÎļþÖеÄÀý×Ó¡£
#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>
int main(int argc, char **argv)
{
void *handle;
int (*add)(int,int);
char *error;
handle = dlopen ("libadd.so", RTLD_LAZY);
if (!handle) {
fprintf (stderr, "%s\n", dlerror());
exit(1);
}
dlerror(); /* Clear any existing error */
add = dlsym(handle, "add");
if ((error = dlerror()) != NULL) {
fprintf (stderr, "%s\n", error);
exit(1);
}
printf ("%d\n", add(3,5));
dlclose(handle);
return 0;
}
±àÒ룺
gcc -rdynamic -o dltest dltest.c -ldl
Ö´ÐÐdltestµÃµ½½á¹ûΪ8¡£
Ïà¹ØÎĵµ£º
£¨L2CAPÐÒé¼ò½é£¬L2CAPÔÚBlueZÖеÄʵÏÖÒÔ¼°L2CAP±à³Ì½Ó¿Ú£©
Ò»£ºL2CAPÐÒé¼ò½é£º
Logical Link Control and Adaptation Protocol(L2CAP)
Âß¼Á¬½Ó¿ØÖƺÍÊÊÅäÐÒé (L2CAP) ΪÉϲãÐÒéÌá¹©ÃæÏòÁ¬½ÓºÍÎÞÁ¬½ÓµÄÊý¾Ý·þÎñ£¬²¢Ìṩ¶àÐÒ鹦ÄܺͷָîÖØ×é²Ù×÷¡£L2CAP ³äÐíÉϲãÐÒéºÍÓ¦ÓÃÈí¼þ´«ÊäºÍ½ÓÊÕ×î´ó³¤¶ÈΪ 64K µÄ L2CAP Ê ......
·À»ðǽÏàÓ¦¶Ë¿ÚûÓдò¿ª¡£
´ò¿ª·½·¨ÈçÏ£º
vi /etc/sysconfig/iptables
¼ÓÈëÈçϵÄÒ»ÐУº
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3690 -j ACCEPT
ÖØÆôiptables:
/etc/init.d/iptables restart
²é¿´¶Ë¿ÚÊÇ·ñÕæµÄ´ò¿ª:
/etc/init.d/iptables status ......
www.csdn.net
www.linux.org
www.chinaunix.net
http://www.loveunix.net/
http://www.linuxsir.org/main/
http://www.linuxforum.net/
http://www.codeproject.com/
http://www.codeplex.com/
http://sourceforge.net/
python:
http://www.python.org/
agile:
http://www.thoughtworks.com/ ......
LinuxÓëFreeBSD¼ò½é
Linux×÷ΪһÖÖ¿ª·ÅÔ´´úÂëµÄ²Ù×÷ϵͳ£¬×Ô1991ÄêÎÊÊÀÒÔÀ´£¬²»¹ÜÊÇ´Ó¹¦ÄÜÉÏ£¬»¹ÊÇ´ÓÁ÷´«µÄ¹ã¶ÈÉÏ£¬¶¼µÃµ½ÁËÎȲ½µÄÔö³¤¡£Linuxϵͳ°üº¬Á˽¨Á¢InternetÍøÂç»·¾³ËùÓзþÎñµÄÈí¼þ°ü£¬ÈçApache Web·þÎñÆ÷¡¢MAIL·þÎñÆ÷¡¢firewall¡¢Database·þÎñÆ÷µÈ¡£Òò´ËÑо¿Linux²Ù×÷ϵͳϵÄTCP/IPÐÒéÕ»µÄʵÏÖ¾ßÓÐÖØÒ ......
ÄÚ´æ¿ØÖÆÆª
calloc
free
getpagesize
malloc
mmap
munmap
calloc£¨ÅäÖÃÄÚ´æ¿Õ¼ä£©
Ïà¹Øº¯Êý
malloc£¬free£¬realloc£¬brk
±íÍ·Îļþ
#include <stdlib.h>
¶¨Ò庯Êý
void *calloc(size_t nmemb£¬size_t size);
º¯Êý˵Ã÷
calloc()ÓÃÀ´ÅäÖÃnmemb¸öÏàÁÚµÄÄڴ浥λ£¬Ã¿Ò»µ¥Î»µÄ´óСΪsize£¬²¢·µ»ØÖ¸ÏòµÚ ......