cap.c revision 56deab0745753336570f5c63c3b5fa565eaab8f1
/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <debug.h>
#include <conv.h>
#include "_rtld.h"
#include "_audit.h"
#include "msg.h"
/*
* qsort(3c) comparison function.
*/
static int
{
return (-1);
return (1);
return (0);
return (-1);
return (1);
return (0);
}
/*
* Process any hardware capabilities.
*/
int
{
/*
* Ensure that the kernel can cope with the required capabilities.
*/
static Conv_cap_val_hw1_buf_t cap_buf;
return (0);
}
return (1);
}
/*
* Process any software capabilities.
*/
/* ARGSUSED0 */
int
{
#if defined(_ELF64)
/*
* A 64-bit executable that started the process can be restricted to a
* 32-bit address space. A 64-bit dependency that is restricted to a
* 32-bit address space can not be loaded unless the executable has
* established this requirement.
*/
static Conv_cap_val_sf1_buf_t cap_buf;
return (0);
}
#endif
return (1);
}
/*
* When $HWCAP is used to represent dependencies, take the associated directory
* and analyze all the files it contains.
*/
static int
{
const char *src;
int error = 0;
/*
* Access the directory in preparation for reading its entries. If
* successful, establish the initial pathname.
*/
return (0);
}
*dst++ = '/';
/*
* Read each entry from the directory and determine whether it is a
* valid ELF file.
*/
char *_dst;
/*
* Ignore "." and ".." entries.
*/
continue;
/*
* Complete the full pathname.
*/
*_dst = '\0';
/*
* Trace the inspection of this file, and determine any
* auditor substitution.
*/
continue;
/*
* Note, all directory entries are processed by find_path(),
* even entries that are directories themselves. This single
* point for control keeps the number of stat()'s down, and
* provides a single point for error diagnostics.
*/
continue;
}
/*
* If this object has already been loaded, obtain the hardware
* capabilities for later sorting. Otherwise we have a new
* candidate.
*/
AL_CNT_HWCAP) == NULL) {
error = 1;
break;
}
}
/*
* If no objects have been found, we're done. Also, if an allocation
* error occurred while processing any object, remove any objects that
* had already been added to the list and return.
*/
if (fdalp)
return (0);
}
/*
* Having processed and retained all candidates from this directory,
* sort them, based on the precedence of their hardware capabilities.
*/
return (1);
}
int
int *in_nfavl)
{
int unused = 0;
return (0);
/*
* Now complete the mapping of each of the ordered objects, adding
* each object to a new pathname descriptor.
*/
int audit = 0;
if (unused)
continue;
/*
* Complete mapping the file, obtaining a handle, and continue
* to analyze the object, establishing dependencies and
* relocating. Remove the file descriptor at this point, as it
* is no longer required.
*/
if (nlmp == 0)
continue;
/*
* Create a new pathname descriptor to represent this filtee,
* and insert this descriptor in the Alist following the
* hardware descriptor that seeded this processing.
* capability directory).
*/
if (ghp)
return (0);
}
/*
* Establish the filter handle to prevent any recursion.
*/
}
/*
* indicates the auditor wishes to ignore this filtee.
*/
audit = 1;
nlmp = 0;
}
}
/*
* Finish processing the objects associated with this request.
*/
/*
* If the filtee has been successfully processed, then create
* an association between the filter and the filtee. This
* association provides sufficient information to tear down the
* filter and filtee if necessary.
*/
/*
* If this object is marked an end-filtee, we're done.
*/
unused = 1;
/*
* If this filtee loading has failed, generate a diagnostic.
* Null out the path name descriptor entry, and continue the
* search.
*/
/*
* If attempting to load this filtee required a new
* link-map control list to which this request has
* added objects, then remove all the objects that
* have been associated to this request.
*/
}
}
return (1);
}
/*
* Load an individual hardware capabilities object.
*/
Rt_map *
{
int found = 0;
/*
* Obtain the sorted list of hardware capabilities objects available.
*/
return (NULL);
/*
* From the list of hardware capability objects, use the first and
* discard the rest.
*/
found++;
}
return (lmp);
}