/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
* Copyright (c) 2011 Bayard G. Bell. All rights reserved.
*/
#include <sys/sysmacros.h>
#include <sys/pathname.h>
#include <sys/archsystm.h>
int *isdyn);
2,
2,
};
2,
2,
};
2,
2,
};
/*
* Module linkage information for the kernel.
*/
};
};
};
};
int
_init(void)
{
return (mod_install(&modlinkage));
}
int
_fini(void)
{
return (mod_remove(&modlinkage));
}
int
{
}
/*ARGSUSED*/
static int
{
int error;
int isdyn;
/*
* Read in and validate the file header.
*/
return (error);
return (error);
/*
* Take a quick look to see if it looks like we will have
* enough swap space for the program to get started. This
* is not a guarantee that we will succeed, but it is definitely
* better than finding this out after we are committed to the
* new memory image. Maybe what is needed is a way to "prereserve"
* swap space for some segment mappings here.
*
* But with shared libraries the process can make it through
* the exec only to have ld.so fail to get the program going
* because its mmap's will not be able to succeed if the system
* is running low on swap space. In fact this is a far more
* common failure mode, but we cannot do much about this here
* other than add some slop to our anonymous memory resources
* requirements estimate based on some guess since we cannot know
* what else the program will really need to get to a useful state.
*
* XXX - The stack size (clrnd(SSIZE + btopr(nargc))) should also
* be used when checking for swap space. This requires some work
* since nargc is actually determined in exec_args() which is done
* after this check and hence we punt for now.
*
* nargc = SA(nc + (na + 4) * NBPW) + sizeof (struct rwindow);
*/
return (ENOMEM);
/*
* Load the trap 0 interpreter.
*/
goto done;
}
return (error);
}
/*
* Determine the a.out's characteristics.
*/
/*
* Load the a.out's text and data.
*/
goto done;
goto done;
setexecenv(&exenv);
/*
* It's time to manipulate the process aux vectors.
* We need to update the AT_SUN_AUXFLAGS aux vector to set
* the AF_SUN_NOPLM flag.
*/
sizeof (auxflags_auxv32)) != 0)
return (EFAULT);
sizeof (auxflags_auxv32)) != 0)
return (EFAULT);
done:
if (error != 0)
else {
/*
* Ensure that the max fds do not exceed 256 (this is
* applicable to 4.x binaries, which is why we only
* do it on a.out files).
*/
&fdno_rlim);
}
}
return (error);
}
/*
* Read in and validate the file header.
*/
static int
{
int error;
return (error);
if (resid != 0)
return (ENOEXEC);
case OMAGIC:
break;
case ZMAGIC:
case NMAGIC:
break;
default:
return (ENOEXEC);
}
/*
* Check total memory requirements (in pages) for a new process
* against the available memory or upper limit of memory allowed.
*
* For the 64-bit kernel, the limit can be set large enough so that
* rounding it up to a page can overflow, so we check for btopr()
* overflowing here by comparing it with the unrounded limit in pages.
*/
return (ENOMEM);
}
return (0);
}
static int
{
}