Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * Hypervisor Software File: squander.c | |
5 | * | |
6 | * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. | |
7 | * | |
8 | * - Do no alter or remove copyright notices | |
9 | * | |
10 | * - Redistribution and use of this software in source and binary forms, with | |
11 | * or without modification, are permitted provided that the following | |
12 | * conditions are met: | |
13 | * | |
14 | * - Redistribution of source code must retain the above copyright notice, | |
15 | * this list of conditions and the following disclaimer. | |
16 | * | |
17 | * - Redistribution in binary form must reproduce the above copyright notice, | |
18 | * this list of conditions and the following disclaimer in the | |
19 | * documentation and/or other materials provided with the distribution. | |
20 | * | |
21 | * Neither the name of Sun Microsystems, Inc. or the names of contributors | |
22 | * may be used to endorse or promote products derived from this software | |
23 | * without specific prior written permission. | |
24 | * | |
25 | * This software is provided "AS IS," without a warranty of any kind. | |
26 | * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, | |
27 | * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A | |
28 | * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN | |
29 | * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR | |
30 | * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR | |
31 | * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN | |
32 | * OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR | |
33 | * FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE | |
34 | * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, | |
35 | * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF | |
36 | * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. | |
37 | * | |
38 | * You acknowledge that this software is not designed, licensed or | |
39 | * intended for use in the design, construction, operation or maintenance of | |
40 | * any nuclear facility. | |
41 | * | |
42 | * ========== Copyright Header End ============================================ | |
43 | */ | |
44 | /* | |
45 | * CDDL HEADER START | |
46 | * | |
47 | * The contents of this file are subject to the terms of the | |
48 | * Common Development and Distribution License (the "License"). | |
49 | * You may not use this file except in compliance with the License. | |
50 | * | |
51 | * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE | |
52 | * or http://www.opensolaris.org/os/licensing. | |
53 | * See the License for the specific language governing permissions | |
54 | * and limitations under the License. | |
55 | * | |
56 | * When distributing Covered Code, include this CDDL HEADER in each | |
57 | * file and include the License file at usr/src/OPENSOLARIS.LICENSE. | |
58 | * If applicable, add the following below this CDDL HEADER, with the | |
59 | * fields enclosed by brackets "[]" replaced with your own identifying | |
60 | * information: Portions Copyright [yyyy] [name of copyright owner] | |
61 | * | |
62 | * CDDL HEADER END | |
63 | */ | |
64 | ||
65 | /* | |
66 | * Copyright 2006 Sun Microsystems, Inc. All rights reserved. | |
67 | * Use is subject to license terms. | |
68 | */ | |
69 | ||
70 | #pragma ident "@(#)squander.c 1.1 06/10/26 SMI" | |
71 | ||
72 | #include <unistd.h> | |
73 | #include <math.h> | |
74 | #include "stabs.h" | |
75 | ||
76 | void squander_do_sou(struct tdesc *tdp, struct node *np); | |
77 | void squander_do_enum(struct tdesc *tdp, struct node *np); | |
78 | void squander_do_intrinsic(struct tdesc *tdp, struct node *np); | |
79 | ||
80 | void | |
81 | squander_do_intrinsic(struct tdesc *tdp, struct node *np) | |
82 | { | |
83 | } | |
84 | ||
85 | void | |
86 | squander_do_sou(struct tdesc *tdp, struct node *np) | |
87 | { | |
88 | struct mlist *mlp; | |
89 | size_t msize = 0; | |
90 | unsigned long offset; | |
91 | ||
92 | if (np->name == NULL) | |
93 | return; | |
94 | if (tdp->type == UNION) | |
95 | return; | |
96 | ||
97 | offset = 0; | |
98 | for (mlp = tdp->data.members.forw; mlp != NULL; mlp = mlp->next) { | |
99 | if (offset != (mlp->offset / 8)) { | |
100 | printf("%lu wasted bytes before %s.%s (%lu, %lu)\n", | |
101 | (mlp->offset / 8) - offset, | |
102 | np->name, | |
103 | mlp->name == NULL ? "(null)" : mlp->name, | |
104 | offset, mlp->offset / 8); | |
105 | } | |
106 | msize += (mlp->size / 8); | |
107 | offset = (mlp->offset / 8) + (mlp->size / 8); | |
108 | } | |
109 | ||
110 | printf("%s: sizeof: %lu total: %lu wasted: %lu\n", np->name, | |
111 | tdp->size, msize, tdp->size - msize); | |
112 | } | |
113 | ||
114 | void | |
115 | squander_do_enum(struct tdesc *tdp, struct node *np) | |
116 | { | |
117 | } |