📄 porting
字号:
This describes how to port the smbwrapper portion of Samba to a newunix-like platform. Note that porting smbwrapper is considerablyharder than porting Samba, for Samba you generally just need to runconfigure and recompile whereas for smbwrapper some extra effort isgenerally required.STEP 1------The first step is to work out how to create a shared library on yourOS and how to compile C code to produce position independent objectfiles (PIC files). You shoud be able to find this information in theman pages for your compiler and loader (ld). Then modify configure.into give that information to Samba.STEP 2------The next step is to work out how to preload shared objects. On manysystems this is done using a LD_PRELOAD environment variable. Onothers (shc as IRIX) it may use a _RTL_LIST variable.To make sure it works I suggest you create two C files like this:/* first C file */main(){ unlink("foo.txt");}/* second C file */#include <stdio.h>int unlink(char *fname){ fprintf(stderr,"unlink(%s) called\n",fname);}then compile the first as an ordinary C program and the second as ashared library. Then use LD_PRELOAD to preload the resulting sharedlibrary. Then run the first program. It should print "unlink(foo.txt)called". If it doesn't then consult your man pages till you get itright.Once you work this out then edit smbwrapper/smbsh.in and add a sectionif necessary to correctly set the necessary preload options for yourOS. STEP 3------The next step is to work out how to make direct system calls. On mostmachines this will work without any source code changes tosmbwrapper. To test that it does work create the following C program:#include <sys/syscall.h>main(){ syscall(SYS_write, 1, "hello world\n", 12);}and try to compile/run it. If it produces "hello world" then syscall()works as expected. If not then work out what needs to be changed andthen make that change in realcalls.h. For example, on IRIX 6.4 thesystem call numbers are wrong and need to be fixed up by getting anoffset right.STEP 4------Try compiling smbwrapper! Then test it. Then debug it. Simple really :)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -