Samba 3.0.22 Porting by Vidya Sagar

25
Where “theprogram” is the newly linked program, “notfound” is any :FILE equation name that has not been
defined, and “tempfile” is a temporary file where any :RUN error messages will be written.
If the program contains unresolved external references, the :RUN command will fail, and the list of unresolved
symbols will be written to the temporary file “tempfile”. But if the program does not contain any unresolved
symbols, the :RUN will still fail because the STDIN :FILE equation does not exist. It is important to note that
under no circumstances will the program actually execute as a result of this special :RUN command.
One question that may also be asked is if an unresolved routine is called by functions that are part of the “core”
functions which you care about or perhaps (hopefully) by functions you care less about. A methodology is to :RUN
program;UNSAT=DEBUG – this will run the program and the invoke the MPE system debugger when an routine
that cannot be found in the SL, XL, or NL files is actually called. This may allow to more quickly focus on those
routines which are likely to cause a problem. There are some complexities with this method, especially on
applications which fork() many child processes; also typically this may not work with exec() children. See [1] for
more information.
3.11 Strategies to resolve unresolved symbols
The following strategies can be adopted to resolve the problem of unresolved symbols:
Undef the routine switch: Some applications are coded with the knowledge that certain system functions
may or may not be present. In this case the source will have conditional compiler directives which can be
set to indicate whether or not this function is available and the application will then be compiled in the
manner necessary to account for this the lack of this functionality. For example Samba defines
HAVE_USLEEP to use usleep() if it exists on the system. However MPE/iX header have the declaration
of usleep() but left unimplemented. It can be removed from compilation as shown below:
/* MPE/iX lacks usleep */
#ifdef mpeix
#undef HAVE_USLEEP
#endif
Some applications are not set-up to use the “undef” method when accessing system functions and therefore
these functions may be viewed as mandatory for the application Several methods may be used.
Leverage routine definition: Attempt to copy the function from another source. For example in this Samba
port, MPE/iX lacks definition of strptime(). I leveraged the code (strptime.c) form latest libc source code
can be downloaded from
http://www.gnu.org/software/libc/libc.html and include the source for the
strptime() into the samba source tree into source/lib directory.
Fake the unresolved routine: telldir() and seekdir() are two routines unimplemented on MPE/iX and used
by Samba. These two routines allow offset based directory traversal by program if present. Otherwise, the
calling program uses “name” based directory traversal, i.e., directory access key can be file/directory
name instead of their offset. The lib/replace.c in Samba source tree contains definition for them as
described in
MPE/iX limitations and major issues.
You can acquire similar approach for these types of routines.
Use some other routines instead of the unresolved routines: Due to continue evolution in POSIX
interfaces many POSIX.1 compliant routines are deprecated, hence a more “modern” application
typically avoids using them. Samba uses random() and srandom() which are unimplemented on MPE/iX.
In this case use rand() instead as shown below.
#ifdef mpeix
#define random rand
#define srandom rand
#endif
Another similar instance is where Samba uses ldap_unbind_ext() because ldap_unbind_s() is
deprecated. Hence we replaced the call of ldap_unbind_ext() with ldap_unbind_s() as shown below.