1This describes how to port the smbwrapper portion of Samba to a new 2unix-like platform. Note that porting smbwrapper is considerably 3harder than porting Samba, for Samba you generally just need to run 4configure and recompile whereas for smbwrapper some extra effort is 5generally required. 6 7 8STEP 1 9------ 10 11The first step is to work out how to create a shared library on your 12OS and how to compile C code to produce position independent object 13files (PIC files). You shoud be able to find this information in the 14man pages for your compiler and loader (ld). Then modify configure.in 15to give that information to Samba. 16 17 18STEP 2 19------ 20 21The next step is to work out how to preload shared objects. On many 22systems this is done using a LD_PRELOAD environment variable. On 23others (shc as IRIX) it may use a _RTL_LIST variable. 24 25To make sure it works I suggest you create two C files like this: 26 27/* first C file */ 28main() 29{ 30 unlink("foo.txt"); 31} 32 33/* second C file */ 34#include <stdio.h> 35 36int unlink(char *fname) 37{ 38 fprintf(stderr,"unlink(%s) called\n",fname); 39} 40 41 42then compile the first as an ordinary C program and the second as a 43shared library. Then use LD_PRELOAD to preload the resulting shared 44library. Then run the first program. It should print "unlink(foo.txt) 45called". If it doesn't then consult your man pages till you get it 46right. 47 48Once you work this out then edit smbwrapper/smbsh.in and add a section 49if necessary to correctly set the necessary preload options for your 50OS. 51 52 53STEP 3 54------ 55 56The next step is to work out how to make direct system calls. On most 57machines this will work without any source code changes to 58smbwrapper. To test that it does work create the following C program: 59 60#include <sys/syscall.h> 61main() 62{ 63 syscall(SYS_write, 1, "hello world\n", 12); 64} 65 66and try to compile/run it. If it produces "hello world" then syscall() 67works as expected. If not then work out what needs to be changed and 68then make that change in realcalls.h. For example, on IRIX 6.4 the 69system call numbers are wrong and need to be fixed up by getting an 70offset right. 71 72 73STEP 4 74------ 75 76Try compiling smbwrapper! Then test it. Then debug it. Simple really :) 77 78