0N/A# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
3364N/A# Use is subject to license terms.
0N/A# Permission is hereby granted, free of charge, to any person obtaining a
0N/A# copy of this software and associated documentation files (the
0N/A# "Software"), to deal in the Software without restriction, including
0N/A# without limitation the rights to use, copy, modify, merge, publish,
0N/A# distribute,
and/or sell copies of the Software, and to permit persons
0N/A# to whom the Software is furnished to do so, provided that the above
0N/A# copyright notice(s) and this permission notice appear in all copies of
0N/A# the Software and that both the above copyright notice(s) and this
0N/A# permission notice appear in supporting documentation.
0N/A# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
0N/A# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
0N/A# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
0N/A# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
0N/A# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
1472N/A# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
1472N/A# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
1472N/A# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
0N/A# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
0N/A# Except as contained in this notice, the name of a copyright holder
0N/A# shall not be used in advertising or otherwise to promote the sale, use
0N/A# or other dealings in this Software without prior written authorization
0N/A# of the copyright holder.
1123N/A@@ -167,6 +167,13 @@ InitPathList(const char *path)
0N/A list[n][len - 1] = '/';
3364N/A+#ifdef SUNSOFT /* strip amd64/ off loader path if it's there */
2790N/A+ if (strcmp(list[n] + (len - 6), "amd64/") == 0) {
0N/A+ list[n][len - 6] = '\0';
0N/A elem = strtok(NULL, ",");
0N/A@@ -392,6 +399,18 @@ FindModuleInSubdir(const char *dirpath,
0N/A char *ret = NULL, tmpBuf[PATH_MAX];
0N/A struct stat stat_buf;
0N/A+#if defined(SUNSOFT) && defined(__x86)
0N/A+ Bool in_64_dir = FALSE;
0N/A+ if (strstr(dirpath, "/amd64") != NULL) {
0N/A+# if !(defined(__amd64) || defined(__amd64__))
3393N/A@@ -399,6 +418,13 @@ FindModuleInSubdir(const char *dirpath,
3393N/A while ((direntry = readdir(dir))) {
2790N/A if (direntry->d_name[0] == '.')
3393N/A+#if defined(SUNSOFT) && (defined(__i386) || defined(__i386__))
3393N/A+ /* skip 64-bit subdirectories when running 32-bit server */
2790N/A+ if (strcmp(direntry->d_name, "amd64") == 0)
2790N/A snprintf(tmpBuf, PATH_MAX, "%s%s/", dirpath, direntry->d_name);
2790N/A /* the stat with the appended / fails for normal files,
2790N/A and works for sub dirs fine, looks a bit strange in strace
2790N/A@@ -408,6 +434,12 @@ FindModuleInSubdir(const char *dirpath,
3364N/A+#if defined(SUNSOFT) && (defined(__amd64) || defined(__amd64__))
3364N/A+ /* Don't match files in non-amd64 directories */
2790N/A snprintf(tmpBuf, PATH_MAX, "lib%
s.so", module);
2790N/A if (strcmp(direntry->d_name, tmpBuf) == 0) {