java.c revision 93cf283ac1d0119d2ee3842f515f8d0e1bc7cbdb
/*
* 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 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Launch Java executables via exec(2).
*
* Java executables are platform-independent executable files
* based on the JAR file format. Executable JAR files contain a
* special 'extra field' header in the first file of the archive
* that marks the file as a true executable. The data in that field
* is used to pass additional run-time information to the Java VM.
*
* This handler looks for the appropriate magic number on the
* front of the file, checks that the JAR file is executable, then
* invokes the Java runtime environment to do the rest of the work.
*/
#include <sys/pathname.h>
/*
* and debugging. See PSARC/1997/123.
*
* Modified by PSARC/1999/012 to be Contract Private between Solaris and
* the Java Technology Group. It is expected that any future change to
* these variables be coordinated between the consolidations.
*/
#if defined(__sparc)
#else
#error "Unknown ISA"
#endif
char *jexec_arg = "-jar";
/*
*/
#define SIGSIZ 4
#define LOCSIG "PK\003\004"
#define LOCHDRSIZ 30
#define CH(b, n) (((unsigned char *)(b))[n])
/*ARGSUSED3*/
static int
{
int error;
char *opath;
if (level)
return (ENOEXEC); /* no recursion */
/*
* Read in the full local file header, and validate
* the initial signature.
*/
return (error);
return (ENOEXEC);
/*
* Ok, so this -is- a ZIP file, and might even be a JAR file.
* Is it a Java executable?
*/
return (error);
if (resid != 0)
return (ENOEXEC);
break;
}
return (ENOEXEC);
/*
* Note: If we ever make setid execution work, we need to ensure
* security hole.
*/
if (setid)
return (EACCES);
/*
* Find and invoke the Java runtime environment on the file
*/
return (error);
return (ENOEXEC);
}
/* don't free resolvepn until we are done with args */
if (!error) {
/*
* Close this Java executable as the interpreter
* will open and close it later on.
*/
}
return (error);
}
0,
4,
};
};
static struct modlinkage jmodlinkage = {
};
int
_init(void)
{
return (mod_install(&jmodlinkage));
}
int
_fini(void)
{
return (mod_remove(&jmodlinkage));
}
int
{
}