Samba 3.0.22 Porting by Vidya Sagar

5
MPE/iX header files and libraries
It is a good idea to be familiar with what header files and libraries are available on MPE/iX which will be used by the
portable applications. In this section we will discuss the header and libraries which are a part of FOS as well as other
headers and libraries like libbsd and POSIX wrappers required for porting applications. Please refer to the
Build Machine
configuration section which discusses how to install libbsd and POSIX wrappers.
1.A.1 MPE/iX Headers
Header files are the source of routine and data type declarations which require their inclusion into the application source
file using #include directive to achieve successful compilation of the code. The standard convention requires that
header files are placed into the directory named “include” and libraries are placed into the “lib” directory.
MPE/iX header files are available through three sources:
1. System and libc headers: The system and C-library header files are generally located inside /usr/include and the
subdirectories within. For example, some system specific header files reside inside /usr/include/sys directory.
Most of the compilers e.g. gcc, cc, c89 by default search header files in /usr/include directory. Please refer to the
manpage of the specific compiler to know the default header file search directory. If you want to include some
specific header files two strategies can be followed:
Defined in “C” Source, using #include directive: Supply the path of header file relative to /usr/include directory.
In order to include header file from current directory the header file name should be enclosed with double quote.
#include <sys/time.h> /* Include /usr/include/sys/time.h */
#include “yourhdr.h” /* Includes yourhdr.h from current directory */
Defined at Compile time: Using –I compiler flag: You can tell compiler to search the header in the directories
using –I<dir> -I<dir2> … Refer manpage of gcc for more details.
2. libbsd headers: Not all the routines required are available through system and C libraries. A fair amount of
routines declarations missing in system and libc headers are available through libbsd and their corresponding
header files located inside /usr/include/bsd. The header files are listed in
Appendix G.
It is necessary to add –I/usr/include/bsd into your compiler options to tell the compiler to search header files
required for BSD library.
3. POSIX wrappers: Additional routines missing from system, libc and libbsd headers and required by MPE/iX are
made available through POSIX wrappers. POSIX wrappers are installed in the POSIXC60 account. Hence their
header files are located at /POSIXC60/include and libraries are at /POSIXC60/lib.
Appendix H lists those header
files.
Add –I/POSIC60/include to compiler option to tell compiler to search the include directory of POSIX wrappers.
Many header files included into the application source code may not really required on MPE/iX. Such header files should
be by passed from the compilation unit using the best portable strategy, #ifndef#else#endif method, shown below:
#ifndef mpeix
#include <sys/param.h> /* This header file is not required for MPE/iX */
#endif
On compiling the above code with option –Dmpeix, compiler preprocessor does not include the header file “sys/param.h”.
Conversely, #ifdef#else#endif is widely used approach to include system specific piece of code in portable software
environment.
Mark Bixby’s porting notes [3] lists a few symbols found absent in the above mentioned header files. This porting note
also lists the missing header files on MPE/iX.