4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
35 #include <sys/types.h>
37 #include <sys/signal.h>
38 #include <sys/fault.h>
39 #include <sys/syscall.h>
44 void show_stat32(private_t
*, long);
46 void show_stat64(private_t
*, long);
50 show_stat(private_t
*pri
, long offset
)
53 if (data_model
== PR_MODEL_LP64
)
54 show_stat64(pri
, offset
);
56 show_stat32(pri
, offset
);
58 show_stat32(pri
, offset
);
63 show_stat32(private_t
*pri
, long offset
)
69 Pread(Proc
, &statb
, sizeof (statb
), offset
) == sizeof (statb
)) {
71 "%s d=0x%.8X i=%-5u m=0%.6o l=%-2u u=%-5u g=%-5u",
80 switch (statb
.st_mode
& S_IFMT
) {
83 (void) printf(" rdev=0x%.8X\n", statb
.st_rdev
);
86 (void) printf(" sz=%u\n", statb
.st_size
);
90 TIMESPEC32_TO_TIMESPEC(&ts
, &statb
.st_atim
);
91 prtimestruc(pri
, "at = ", &ts
);
92 TIMESPEC32_TO_TIMESPEC(&ts
, &statb
.st_mtim
);
93 prtimestruc(pri
, "mt = ", &ts
);
94 TIMESPEC32_TO_TIMESPEC(&ts
, &statb
.st_ctim
);
95 prtimestruc(pri
, "ct = ", &ts
);
98 "%s bsz=%-5d blks=%-5d fs=%.*s\n",
108 show_stat64_32(private_t
*pri
, long offset
)
110 struct stat64_32 statb
;
113 if (offset
!= NULL
&&
114 Pread(Proc
, &statb
, sizeof (statb
), offset
) == sizeof (statb
)) {
116 "%s d=0x%.8X i=%-5llu m=0%.6o l=%-2u u=%-5u g=%-5u",
119 (u_longlong_t
)statb
.st_ino
,
125 switch (statb
.st_mode
& S_IFMT
) {
128 (void) printf(" rdev=0x%.8X\n", statb
.st_rdev
);
131 (void) printf(" sz=%llu\n", (long long)statb
.st_size
);
135 TIMESPEC32_TO_TIMESPEC(&ts
, &statb
.st_atim
);
136 prtimestruc(pri
, "at = ", &ts
);
137 TIMESPEC32_TO_TIMESPEC(&ts
, &statb
.st_mtim
);
138 prtimestruc(pri
, "mt = ", &ts
);
139 TIMESPEC32_TO_TIMESPEC(&ts
, &statb
.st_ctim
);
140 prtimestruc(pri
, "ct = ", &ts
);
142 (void) printf("%s bsz=%-5d blks=%-5lld fs=%.*s\n",
145 (longlong_t
)statb
.st_blocks
,
153 show_stat64(private_t
*pri
, long offset
)
157 if (offset
!= NULL
&&
158 Pread(Proc
, &statb
, sizeof (statb
), offset
) == sizeof (statb
)) {
160 "%s d=0x%.16lX i=%-5lu m=0%.6o l=%-2u u=%-5u g=%-5u",
169 switch (statb
.st_mode
& S_IFMT
) {
172 (void) printf(" rdev=0x%.16lX\n", statb
.st_rdev
);
175 (void) printf(" sz=%lu\n", statb
.st_size
);
179 prtimestruc(pri
, "at = ", (timestruc_t
*)&statb
.st_atim
);
180 prtimestruc(pri
, "mt = ", (timestruc_t
*)&statb
.st_mtim
);
181 prtimestruc(pri
, "ct = ", (timestruc_t
*)&statb
.st_ctim
);
184 "%s bsz=%-5d blks=%-5ld fs=%.*s\n",