Overloaded names in 2.2.0 smbwrapper.so

David Collier-Brown davecb at canada.sun.com
Tue Feb 13 13:04:16 GMT 2001


  There is a portability/stability problem in Samba 2.2.0 alpha 1
(and presumably later), in smbwrapper.so, used by smbsh.

  Appcert reports:
*******************************
ABI SYMBOL USAGE SUMMARY REPORT
*******************************

  Binary Object: smbwrapper.so
  System: SunOS elsbeth 5.8 Generic_108528-07 sun4u sparc
SUNW,Ultra-30

  5 private symbols are used:
    _acl     _facl    _llseek  _pread   _pwrite 

******************************* 

  These are part of the mappings in realcalls.h: for example,
if HAVE_SYS_ACL_H and HAVE__ACL are defined, then the smbwapper
defines real_acl() to be _acl().
  
  This works, but mostly by accident: it should be
#define real_acl(fn,cmd,n,buf)         
(syscall(SYS_acl,(fn),(cmd),(n),(buf)))
as the _ names and the __ names are reserved for system use only
in the C standard, and are used in two ways in Solaris (well, SysV):

	1) as aliases of the base names, so that one can
	   overload the base name with an interceptor and
	   have it call the _ or __ name.

	   This is an obsolete usage: with interposition and ELF 
	   libraries, we now recommend getting pointers to the
	   function and then telling the linker to interpose
	   your functions in their place.

	2) as a lower-level implementation of the base function,
	   often with different parameter lists or semantics.
	   This is the traditional use: exit() has different
	   semantics from _exit(), for example.  

	   As you might guess, this usage will badly break Samba
	   when it's encountered!  (We've been lucky so far).

  There are SYS_acl, SYS_facl, SYS_llseek, SYS_pread and SYS_pwrite 
as well as SYS_pread64 and SYS_pwrite64 values for use with syscall.

  I recommend someone with experience in configure change the
Solaris test so that it will define SYS_acl and not define HAVE__ACL
(note the double underscore), so that the macros will be defined
to use syscall.

--dave
-- 
David Collier-Brown,           | Always do right. This will gratify 
Performance & Engineering Team | some people and astonish the rest.
Americas Customer Engineering  |                      -- Mark Twain
(905) 415-2849                 | davecb at canada.sun.com




More information about the samba-technical mailing list