#include <cmsstat.h> int sfsstat(const char *path, struct sfsstat *buf);
sfsstat
function fills in an sfsstat
structure with
system-dependent information about a Shared File System (SFS) file or
directory. You can specify the path
parameter as any name in the
sf
or sfd
style. The buf
parameter must point to an
sfsstat
structure as defined in <cmsstat.h>
. The sfsstat
structure is defined as
struct sfsstat { time_t st_updt; /* date and time last updated */ time_t st_crdt; /* date and time file was created */ unsigned int st_type; /* device type flag */ /* S_DISK - disk file */ /* S_SFS -shared file system file*/ /* S_SFSDIR - sfs directory */ /* S_DIRCNTL -sfs dircontrol dir */ /* S_FILCNTL -sfs filecontrol dir*/ char st_owner[9]; /* null-terminated owner id */ char st_dir[154] /* null-terminated directory name */ char st_fname[9]; /* null-terminated CMS filename */ char st_ftype[9]; /* null-terminated CMS filetype */ char st_fmno[2]; /* null-terminated CMS fm number */ char st_flags; /* access flags */ /* S_RW - read/write */ /* S_RO - only readable */ /* S_NO - not read or write */ /* S_EP - externally protected */ int st_dirlen; /* length of directory name */ int st_numblks; /* number of blocks in file */ unsigned int st_lrecl; /* logical record length (LRECL) */ int st_norecs; /* number of logical records */ char st_recfm; /* record format (RECFM) */ char st_status; /* '1'= base, '2'= alias, */ /* '3'= erased, '4'=revoked */ char st_dirauth; /* special directory authorities */ /* S_NR - NewRead auth on dir */ /* S_NW - NewWrite auth on dir */ /* S_AR - Accessed Read only */ /* S_AW - Accessed Write */ char st_resrv1; /* reserved */ unsigned int st_resrv2; /* reserved */ unsigned int st_resrv3; /* reserved */ unsigned int st_resrv4; /* reserved */ unsigned int st_resrv5; /* reserved */ };
The st_type
flag can have one of, or a combination of, these
values:
The st_flags
access flag can have one of these values:
The st_status
flag can have one of these values:
The st_dirauth
flag can have one of, or a combination of, these
values:
sfsstat
returns 0 and fills in the appropriate
fields in the sfsstat
structure. If the file does not exist, the program
has insufficient authority, or the fileid is invalid, sfsstat
returns
- 1.
sfsstat
structure may not be useful for all successful
calls to sfsstat
. For some files, some of the fields of the
sfsstat
structure are not applicable or are unavailable in some releases
of CMS.
The values returned for each such field are
Function Return Values
sfsstat.st_updt (time_t) -1 sfsstat.st_crdt (time_t) -1 sfsstat.st_fname "" sfsstat.st_ftype "" sfsstat.st_fmno "" sfsstat.st_recfm 0xffff sfsstat.st_lrecl 0xffff sfsstat.st_numblks -1 sfsstat.st_norecs -1 sfsstat.st_status 0xffff st_dirauth '\0'
Fields in the sfsstat
structure may have been modified, even if the
function returns - 1.
#include <cmsstat.h> #include <stdio.h> main() { struct sfsstat info; int rc; rc = sfsstat("sf:my file cuser.subdir1", &info); if (rc == 0){ puts("access field (auth)"); if (info.st_flags == S_RW) puts(" st_flags = S_RW"); if ((info.st_flags & S_RO) == S_RO) puts(" st_flags = S_RO"); if ((info.st_flags & S_NO) == S_NO) puts(" st_flags = S_NO"); if ((info.st_flags & S_EP) == S_EP) puts(" st_flags = S_EP"); } return rc; }
cmsstat
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.