aout.c revision be10f7d91e42e379302ee5ead703b5f0bf8b47c6
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/sysmacros.h>
#include <sys/pathname.h>
#include <sys/archsystm.h>
int *isdyn);
#ifdef _LP64
#else /* _LP64 */
#endif /* _LP64 */
char _depends_on[] = "exec/elfexec";
2,
2,
};
2,
2,
};
2,
2,
};
/*
* Module linkage information for the kernel.
*/
};
};
};
static struct modlinkage modlinkage = {
};
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;
}
#ifdef _LP64
#else /* _LP64 */
#endif /* _LP64 */
{
return (error);
}
/*
* Determine the a.out's characteristics.
*/
/*
* Load the a.out's text and data.
*/
goto done;
goto done;
setexecenv(&exenv);
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
{
#ifdef _LP64
#else
#endif
}