🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.ibm.pc.rt
2 messages
2 total messages Started by Eddy J. Gurney Wed, 27 Jun 1990 17:34
Problems with Sendmail 5.64 (w/IDA enhancements) on PC/RT (Long)
#762
Author: Eddy J. Gurney
Date: Wed, 27 Jun 1990 17:34
62 lines
4145 bytes
Well, I've been anxious to get Sendmail 5.64+ installed on my PC RT, and,
unsurprisingly, I've run into a bunch of problems.

First and foremost, the RT does NOT have an 'flock' function call.  It does
have a 'lockf' function call, which locks certain 'regions' of a file.  Per
a previous request for info on 'lockf', Ed Clarke (clarke@acheron.uucp),
posted a sample change he made in "alias.c" to use 'lockf' instead of 'flock'.
I made similar changes to the rest of the 'flock' calls, and those APPEAR to
have worked.  The reason I say "appear" is because the man page for 'lockf'
says it does not work with standard, buffered I/O, which is what Sendmail
uses. :-)  So I'm not sure if this is actually the correct way to handle the
situation.  I'm wondering if a call to 'fcntl' might not be more appropriate.
I don't have a man page for it, though, so I'm looking for info on it. (Hint,
hint...)

OK.  Below are the rest of the changes (as far as I can remember) that I made
to the distribution version of Sendmail 5.64 with the IDA/BIU enhancements,
which I got from uxc.cso.uiuc.edu:

. Set the compiler flag '-DBSD_INCLUDES', so <sys/dir.h> would include 
  <dirent.h>, which has the necessary definition of 'DIR' used in "queue.c"
. Added "getenv.c" and "setenv.c" to the /src directory, copied from the
  /support directory of the distribution, edited Makefile accordingly
. Changed the 'getla()' routine in "conf.c" to also return 0, since I don't
  think the RT has anyway of determining the load average (I don't use this
  feature anyway); removed 'getloadavg.c/.o' from the Makefile
. Changed all the calls to 'flock' to 'lockf' in "alias.c", "daemon.c", and
  "queue.c" as demonstrated by Ed Clarke in his post to comp.sys.ibm.pc.rt
. Set the compiler flag '-DVMUNIX', which works on the RT except for one
  #ifdef in "deliver.c", which tries to assign FORK to 'vfork'.
. Changed "sendmail.h" to #include <fcntl.h>, since two or three other files
  needed definitions from this include file.
. Added EPROCLIM = 98 to the list of returned error flags (thanks again to
  Ed Clarke for that info)
. It is currently compiled with only DBM defined, not NDBM or SDBM; all the
  other default options were left the same (I think), including having
  NAMED_BIND on, etc.  (named is running :-)

Now all this compiles fine with only a few warnings here and there.  But for
some reason, Sendmail doesn't appear to function properly.  For one thing,
if you try to run sendmail/newaliases/mailq with the '-d' flag, the only debug
output you get is "Sendmail 5.64+", then a nice "Bus error (core dumped)" 
message.  HOWEVER, if you also run with the '-C' flag (to NOT use the frozen
configuration file or something), the debug option works as expected.

Even worse, though, is that mail sent to the new sendmail daemon from a remote
host fails with a "couldn't execute /usr/lib/sendmail" error, although local
mail works fine.

Finally...
On the topic of the last item, I also (successfully?) compiled gdbm 1.3, which
is the GNU version of DBM/NDBM.  I installed the gdbm.a library in /usr/lib,
and tried to link Sendmail 5.64 with it, but I get errors from syslog telling
me that the database /etc/sendmail/aliases could not be opened when I tried to
run newaliases and sendmail.  Has anyone compiled/used GNU's dbm?  Does it
work correctly in Sendmail?  (I also installed the 'ndmb.h' include file from 
the GNU dbm in /usr/include.)

Any help/suggestions with any of this would be GREATLY appreciated.

--
Eddy J. Gurney, N8FPW  --  gurney@frith.egr.msu.edu
Re: Problems with Sendmail 5.64 (w/IDA enhancements) on PC/RT (Long)
#763
Author: Andy Linton
Date: Wed, 27 Jun 1990 21:55
266 lines
8155 bytes
In article <1990Jun27.173453.25710@msuinfo.cl.msu.edu>,
gurney@frith.egr.msu.edu (Eddy J. Gurney) writes:
|> Well, I've been anxious to get Sendmail 5.64+ installed on my PC RT, and,
|> unsurprisingly, I've run into a bunch of problems.
|> 
|> First and foremost, the RT does NOT have an 'flock' function call.  It does
|> have a 'lockf' function call, which locks certain 'regions' of a file.  Per
|> a previous request for info on 'lockf', Ed Clarke (clarke@acheron.uucp),
|> posted a sample change he made in "alias.c" to use 'lockf' instead of
'flock'.
|> I made similar changes to the rest of the 'flock' calls, and those APPEAR to
|> have worked.  The reason I say "appear" is because the man page for 'lockf'
|> says it does not work with standard, buffered I/O, which is what Sendmail
|> uses. :-)  So I'm not sure if this is actually the correct way to handle the
|> situation.  I'm wondering if a call to 'fcntl' might not be more
appropriate.
|> I don't have a man page for it, though, so I'm looking for info on
it. (Hint,
|> hint...)
|>

I had this problem with compiling the code on HP-UX 7.0 which I sorted
out using these routines. One word of warning though - to obtain an
exclusive lock (F_WRLCK) when using 'fcntl' (this is the equivalent of
the flock 'LOCK_EX' flag) the file *must* be open for writing. This
means that some of the 'open' calls need modified or the type of lock
requested must be changed. I have posted the changes I made for HPUX to
Paul Pomes at UIUC and he will incorporate them into the distribution
there. I could supply such details but we are at the end of a slow link
down here and I don't want to clog it.


|> . Changed the 'getla()' routine in "conf.c" to also return 0, since I don't
|>   think the RT has anyway of determining the load average (I don't use this
|>   feature anyway); removed 'getloadavg.c/.o' from the Makefile

I include a patch to make 'getla()' run on HPUX - this may give some
pointers on what you need to do. Can someone confirm that the
'getloadavg.c/.o' code is for 4.4BSD?

*** /tmp/,RCSt1a21545	Wed Jun 27 12:34:27 1990
--- conf.c	Fri Jun 22 13:34:12 1990
***************
*** 24,29 ****
--- 24,32 ----
  
  # include <sys/ioctl.h>
  # include <sys/param.h>
+ # if defined(hpux)
+ # include <sgtty.h>
+ # endif /* hpux */
  # include <pwd.h>
  # include "sendmail.h"
  # include "pathnames.h"
***************
*** 128,135 ****
  /*
  **  Miscellaneous stuff.
  */
! 
! int	DtableSize =	50;		/* max open files; reset in 4.2bsd */
  extern int la;				/* load average */
  /*
  **  SETDEFAULTS -- set default values
--- 131,142 ----
  /*
  **  Miscellaneous stuff.
  */
! #ifdef hpux
! #include <stdio.h>
! int             DtableSize = _NFILE;    /* max open files */
! #else
! int             DtableSize = 50;/* max open files; reset in 4.2bsd */
! #endif
  extern int la;				/* load average */
  /*
  **  SETDEFAULTS -- set default values
***************
*** 423,429 ****
  **		none.
  */
  
! #ifndef sun
  
  getla()
  {
--- 430,436 ----
  **		none.
  */
  
! #if !defined(sun) && !defined (hpux)
  
  getla()
  {
***************
*** 434,446 ****
  	return ((int) (avenrun[0] + 0.5));
  }
  
! #else /* sun */
  
  #include <nlist.h>
  
  struct	nlist Nl[] =
  {
! 	{ "_avenrun" },
  #define	X_AVENRUN	0
  	{ 0 },
  };
--- 441,457 ----
  	return ((int) (avenrun[0] + 0.5));
  }
  
! #else /* sun  || hpux */
  
  #include <nlist.h>
  
  struct	nlist Nl[] =
  {
! #ifdef hp9000s800
! 	{"avenrun"},
! #else
! 	{"_avenrun"},
! #endif hp9000s800
  #define	X_AVENRUN	0
  	{ 0 },
  };
***************
*** 451,457 ****
--- 462,472 ----
  	return (1);
  # else /* !sequent */
  	static int kmem = -1;
+ # if defined(hpux)
+ 	double avenrun[3];
+ # else
  	long avenrun[3];
+ # endif /* hpux */
  	extern off_t lseek();
  
  	if (kmem < 0)
***************
*** 460,468 ****
  		if (kmem < 0)
  			return (-1);
  		(void) ioctl(kmem, (int) FIOCLEX, (char *) 0);
! 		nlist("/vmunix", Nl);
  		if (Nl[0].n_type == 0)
  			return (-1);
  	}
  	if (lseek(kmem, (off_t) Nl[X_AVENRUN].n_value, 0) == -1 ||
  	    read(kmem, (char *) avenrun, sizeof(avenrun)) < sizeof(avenrun))
--- 475,495 ----
  		if (kmem < 0)
  			return (-1);
  		(void) ioctl(kmem, (int) FIOCLEX, (char *) 0);
! #if defined(hpux)
! 		(void) nlist ("/hp-ux", Nl);
! #else
! 		(void) nlist ("/vmunix", Nl);
! #endif /* hpux */
  		if (Nl[0].n_type == 0)
+ 		{
+ 			/*
+ 			 * if nlist() has failed we can't use Nl to grope 
+ 			 * about in kmem on subsequent calls to getla()
+ 			 */
+ 		  	close (kmem);
+ 			kmem = -1;
  			return (-1);
+ 		}
  	}
  	if (lseek(kmem, (off_t) Nl[X_AVENRUN].n_value, 0) == -1 ||
  	    read(kmem, (char *) avenrun, sizeof(avenrun)) < sizeof(avenrun))
***************
*** 470,477 ****
  		/* thank you Ian */
  		return (-1);
  	}
  	return ((int) (avenrun[0] + FSCALE/2) >> FSHIFT);
! 	/* return ((int) (avenrun[0] + 0.5)); */
  # endif /* sequent */
  }
  
--- 497,507 ----
  		/* thank you Ian */
  		return (-1);
  	}
+ # if defined(hpux)
+ 	return ((int) (avenrun[0] + 0.5));
+ # else
  	return ((int) (avenrun[0] + FSCALE/2) >> FSHIFT);
! # endif /* hpux */
  # endif /* sequent */
  }
  
--
#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  flock.c flock.h
# Wrapped by mark@the-taj.comp.vuw.ac.nz on Tue Jun 20 21:37:36 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'flock.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'flock.c'\"
else
echo shar: Extracting \"'flock.c'\" \(551 characters\)
sed "s/^X//" >'flock.c' <<'END_OF_FILE'
X
X#include <fcntl.h>
X#include <errno.h>
X#include "flock.h"               /* defines normally in <sys/file.h> */
X
Xflock(fd, operation)
Xint fd, operation;
X{
X	int op, ret;
X	struct flock arg;
X	extern int errno;
X
X	op = (LOCK_NB & operation) ? F_SETLK : F_SETLKW;
X	
X	arg.l_type = (LOCK_EX & operation) ? F_WRLCK :
X		(LOCK_SH & operation) ? F_RDLCK : F_UNLCK;
X	arg.l_whence = 0;
X	arg.l_start = 0;
X	arg.l_len = 0;
X	arg.l_pid = 0;
X	
X	if ((ret = fcntl(fd, op, &arg)) == -1) {
X		if (errno == EACCES || errno == EAGAIN)
X			errno = EWOULDBLOCK;
X	}
X	return (ret);
X}
END_OF_FILE
if test 551 -ne `wc -c <'flock.c'`; then
    echo shar: \"'flock.c'\" unpacked with wrong size!
fi
# end of 'flock.c'
fi
if test -f 'flock.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'flock.h'\"
else
echo shar: Extracting \"'flock.h'\" \(288 characters\)
sed "s/^X//" >'flock.h' <<'END_OF_FILE'
X/* These definitions are in <sys/file.h> on BSD 4.3 */
X/*
X * Flock call.
X */
X#define LOCK_SH         1       /* shared lock */
X#define LOCK_EX         2       /* exclusive lock */
X#define LOCK_NB         4       /* don't block when locking */
X#define LOCK_UN         8       /* unlock */
END_OF_FILE
if test 288 -ne `wc -c <'flock.h'`; then
    echo shar: \"'flock.h'\" unpacked with wrong size!
fi
# end of 'flock.h'
fi
echo shar: End of shell archive.
exit 0
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads