process.c revision 8a16d130bdea488abf40f6692135d3c5b462fda4
/*
* 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.
*/
/* Copyright (c) 1988 AT&T */
/* Copyright (c) 1989 AT&T */
/* All Rights Reserved */
/* UNIX HEADER */
#include <stdio.h>
/* SIZE HEADERS */
#include "defs.h"
/* ELF HEADERS */
#include "gelf.h"
/* SIZE FUNCTIONS CALLED */
extern void error();
/* FORMAT STRINGS */
static const char *prusect[3] = {
"%llx",
"%llo",
"%lld"
};
static const char *prusum[3] = {
" = 0x%llx\n",
" = 0%llo\n",
" = %lld\n"
};
static const char *format[3] = {
"%llx + %llx + %llx = 0x%llx\n",
"%llo + %llo + %llo = 0%llo\n",
"%lld + %lld + %lld = %lld\n"
};
void
{
/* EXTERNAL VARIABLES USED */
extern int fflag; /* full format for sections */
extern int Fflag; /* full format for segments */
extern int nflag; /* include non-loadable segments or sections */
extern int numbase; /* hex, octal, or decimal */
extern char *fname;
extern char *archive;
extern int is_archive;
extern int oneflag;
/* LOCAL VARIABLES */
/*
* size of first, second, third number and total size
* in default case for sections.
*/
int numsect = 0;
int notfirst = 0;
int i;
char *name = 0;
/*
* If there is a program header and the -f flag requesting section infor-
* mation is not set, then process segments with the process_phdr function.
* Otherwise, process sections. For the default case, the first number
* shall be the size of all sections that are allocatable, nonwritable and
* not of type NOBITS; the second number shall be the size of all sections
* that are allocatable, writable, and not of type NOBITS; the third number
* is the size of all sections that are writable and not of type NOBITS.
* If -f is set, print the size of each allocatable section, followed by
* the section name in parentheses.
* If -n is set, print the size of all sections, followed by the section
* name in parentheses.
*/
return;
}
return;
}
if (is_archive) {
} else if (!oneflag && !is_archive) {
}
scn = 0;
size = 0;
if (shnum == 0)
for (i = 0; i < numsect; i++) {
break;
}
break;
}
return;
continue;
continue;
}
if (notfirst) {
(void) printf(" + ");
}
}
notfirst++;
}
}
}
if (Fflag) {
return;
} else {
return;
}
}
}
/*
* If there is a program exection header, process segments. In the default
* case, the first number is the file size of all nonwritable segments
* of type PT_LOAD; the second number is the file size of all writable
* segments whose type is PT_LOAD; the third number is the memory size
* minus the file size of all writable segments of type PT_LOAD.
* If the -F flag is set, size will print the memory size of each loadable
* segment, followed by its permission flags.
* If -n is set, size will print the memory size of all loadable segments
* and the file size of all non-loadable segments, followed by their
* permission flags.
*/
static void
{
int i;
int notfirst = 0;
GElf_Phdr p;
extern int Fflag;
extern int nflag;
extern int numbase;
extern char *fname;
extern char *archive;
extern int is_archive;
extern int oneflag;
if (is_archive) {
} else if (!oneflag && !is_archive) {
}
for (i = 0; i < (int)num; i++) {
return;
}
}
if (notfirst) {
(void) printf(" + ");
}
notfirst++;
}
if (notfirst) {
(void) printf(" + ");
}
notfirst++;
}
if (notfirst) {
(void) printf(" + ");
}
notfirst++;
}
continue;
}
switch (p.p_flags) {
case 0: (void) printf("(---)"); break;
}
}
}
if (nflag) {
}
}
}
}