[comp.os.minix] 1.5.3 init.c

cwr@pnet01.cts.com (Will Rose) (02/25/90)

I've found only one problem with 1.5.3 so far, and that is the (new) use
of execle rather than execn in init.  Execle works ok if login is found
in the first place it looks (/bin) but if login isn't there execle won't
find it in the second place it tries, /usr/bin, or anywhere else.  It just
doesn't give up gracefully.  I assume this is a stack problem, but none of
the obvious stack tinkering works.  Curiously, if you boot 1.5.0 you can 
log in, but the terminal is in raw mode.  These are deep waters, Watson...
 
Anyhow, I didn't want to keep login in /bin, so my cure was to replace the
calls to execle with calls to a modified version of the 1.5.0 execn:
 
/* execn.c:  passes only filename on the stack - Jan 90 */ 
 
#include <lib.h>
#define PTRSIZE sizeof(char *)
 
int execn(name)
char *name;                     /* pointer to file to be exec'd */
{
/* Special version used when there is one arg and no environment.  This call
 * is used only by INIT, to avoid having to allocate ARG_MAX.
 */
 
  PRIVATE char stack[PTRSIZE * 16] ; /* ACK won't auto init */
  PRIVATE char **cpp = (char **) stack;
 
  *cpp++ = (char *) 1;                  /* argc */
  *cpp++ = (char *) (PTRSIZE * 5);      /* *argv[0] */
  *cpp++ = 0;
  *cpp++ = 0;
  *cpp = 0;
 
  strcpy(stack + (PTRSIZE * 5), name); /* nb. known source, no overwrite check
*/
 
  return(callm1(MM_PROC_NR, EXEC, len(name), sizeof(stack), 0, name, stack,
NIL_PTR));
}

-----------------------------------------------------------------------
"If heaven too had passions  | Will Rose
     even heaven would       | UUCP: {nosc ucsd hplabs!hp-sdd}!crash!pnet01!cw
     grow old."  -  Li Ho.   | ARPA: crash!pnet01!cwr@nosc.mil
                             | INET: cwr@pnet01.cts.com


UUCP: {nosc ucsd hplabs!hp-sdd}!crash!pnet01!cwr
ARPA: crash!pnet01!cwr@nosc.mil
INET: cwr@pnet01.cts.com

leo@marco.UUCP (Matthias Pfaller) (02/28/90)

In article <1660@crash.cts.com>, cwr@pnet01.cts.com (Will Rose) writes:
> of execle rather than execn in init.  Execle works ok if login is found
> in the first place it looks (/bin) but if login isn't there execle won't
> find it in the second place it tries, /usr/bin, or anywhere else.  It just

The problem lies in the local version of sbrk, which can only be called once.
The new 1.5.3 execxx routines allocate memory with sbrk and free them,
if the exec call fails. The local sbrk in init.c can't handle sbrk for freeing
memory.

		leo@marco.uucp (Matthias Pfaller)