forked from openafs/openafs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathistat.c
45 lines (38 loc) · 935 Bytes
/
istat.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
* Copyright 2000, International Business Machines Corporation and others.
* All Rights Reserved.
*
* This software has been released under the terms of the IBM Public
* License. For details, see the LICENSE file in the top-level source
* directory or online at http://www.openafs.org/dl/license10.html
*/
#include <afsconfig.h>
#include <afs/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/file.h>
#include <stdio.h>
#include "AFS_component_version_number.c"
main(argc, argv)
char **argv;
{
int fd;
int ino;
struct stat status;
if (stat(argv[1], &status) == -1) {
perror("stat");
exit(1);
}
ino = atoi(argv[2]);
fd = xiopen(status.st_dev, ino, O_RDONLY);
if (fd == -1) {
perror("iopen");
exit(1);
}
if (fstat(fd, &status) == -1) {
perror("fstat");
exit(1);
}
printf("links=%d, size=%d\n", status.st_nlink, status.st_size);
exit(0);
}