|
Hi Werner, > I would appreciate If someone can give me an example of a RPG prototype > for STATVFS as I'm (not yet) familiar with C specifications. I've got a test program that just displays the info with the DSPLY op-code... It either requires V5R1 or V5R2, I don't remember which. I hope that's not a problem. I'll include the source at the bottom of this message. > I'll also have a look on the mentioned link to your utility with the > QP0LROR API. It could be helpful in some cases. Not my work, but Carsten Flensburg's work... but yes, I think it could be useful. If nothing else, it lets you see whos using a file in the IFS, which would otherwise be hard to do. Here's the source for member "DSPVFS": H DFTACTGRP(*NO) /copy statvfs_h D chkflag PR 1N D field 10U 0 value D bit 10U 0 value D getsize PR 15A varying D size 10U 0 value D fstype s 80A varying D vfs ds likeds(ds_statvfs) D msg s 52A D peObj s 32A c *entry plist c parm peObj c if statvfs(%trimr(peObj): vfs) = -1 c eval msg = 'statvfs() failed.' c dsply msg c eval *inlr = *on c return c endif c eval msg = 'Object = ' + peObj c msg dsply c eval fstype = %str(%addr(vfs.f_basetype)) c eval msg = 'FS Type: ' + fstype c msg dsply c eval msg = 'Block size: ' + c getsize(vfs.f_bsize) c msg dsply c if vfs.f_bsize <> 0 c eval msg = 'Total blocks: ' + c %char(vfs.f_blocks) c msg dsply c eval msg = 'Blocks free: ' + c %char(vfs.f_bfree) c msg dsply c endif c eval msg = 'Object link maximum: ' + c %char(vfs.f_objlinkmax) c msg dsply c eval msg = 'Directory link maximum: ' + c %char(vfs.f_dirlinkmax) c msg dsply c eval msg = 'Pathname component max: ' + c getsize(vfs.f_namemax) c msg dsply c eval msg = 'Path name maximum: ' + c getsize(vfs.f_pathmax) c msg dsply c if chkflag(vfs.f_flag: ST_RDONLY) c eval msg = 'Read Only = Yes' c else c eval msg = 'Read Only = No' c endif c msg dsply c if chkflag(vfs.f_flag: ST_NOSUID) c eval msg = 'Set Userid Allowed = No' c else c eval msg = 'Set Userid Allowed = Yes' c endif c msg dsply c if chkflag(vfs.f_flag: ST_CASE_SENSITITIVE) c eval msg = 'Case Sensitivity = Yes' c else c eval msg = 'Case Sensitivity = No' c endif c msg dsply c if chkflag(vfs.f_flag: ST_CHOWN_RESTRICTED) c eval msg = 'Chg Owner restricted = Yes' c else c eval msg = 'Chg Owner restricted = No' c endif c msg dsply c if chkflag(vfs.f_flag: ST_THREAD_SAFE) c eval msg = 'Threadsafe = Yes' c else c eval msg = 'Threadsafe = No' c endif c msg dsply c if chkflag(vfs.f_flag: ST_DYNAMIC_MOUNT) c eval msg = 'Dynamic mount = Yes' c else c eval msg = 'Dynamic mount = No' c endif c msg dsply c if chkflag(vfs.f_flag: ST_NO_EXPORTS) c eval msg = 'Can be exported = No' c else c eval msg = 'Can be exported = Yes' c endif c msg dsply c if chkflag(vfs.f_flag: ST_SYNCHRONOUS) c eval msg = 'Sync write support = Yes' c else c eval msg = 'Sync write support = No' c endif c dsply msg c eval *inlr = *on c return *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * chkflag(): Check whether a flag bit is set *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ P chkflag B D chkflag PI 1N D field 10U 0 value D bit 10U 0 value c return (%bitand(field:bit) <> 0) P E *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * getsize(): Get human-readable size info *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ P getsize B D getsize PI 15A varying D size 10U 0 value c select c when size = 0 c return 'Not defined' c when size = *HIVAL c return 'No maximum' c other c return %char(size) c endsl P E Here's the source for member "STATVFS_H": /if defined(STATVFS_H_DEFINED) /eof /endif /define STATVFS_H_DEFINED *--------------------------------------------------------------- * ds_statvfs - data structure to receive file system info * * f_bsize = file system block size (in bytes) * f_frsize = fundamental block size in bytes. * if this is zero, f_blocks, f_bfree and f_bavail * are undefined. * f_blocks = total number of blocks (in f_frsize) * f_bfree = total free blocks in filesystem (in f_frsize) * f_bavail = total blocks available to users (in f_frsize) * f_files = total number of file serial numbers * f_ffree = total number of unused file serial numbers * f_favail = number of available file serial numbers to users * f_fsid = filesystem ID. This will be 4294967295 if it's * too large for a 10U 0 field. (see f_fsid64) * f_flag = file system flags (see below) * f_namemax = max filename length. May be 4294967295 to * indicate that there is no maximum. * f_pathmax = max pathname legnth. May be 4294967295 to * indicate that there is no maximum. * f_objlinkmax = maximum number of hard-links for objects * other than directories * f_dirlinkmax = maximum number of hard-links for directories * f_fsid64 = filesystem id (in a 64-bit integer) * f_basetype = null-terminated string containing the file * system type name. For example, this might * be "root" or "Network File System (NFS)" * * Since f_basetype is null-terminated, you should read it * in ILE RPG with: * myString = %str(%addr(ds_statvfs.f_basetype)) *--------------------------------------------------------------- D ds_statvfs DS qualified D f_bsize 10U 0 D f_frsize 10U 0 D f_blocks 20U 0 D f_bfree 20U 0 D f_bavail 20U 0 D f_files 10U 0 D f_ffree 10U 0 D f_favail 10U 0 D f_fsid 10U 0 D f_flag 10U 0 D f_namemax 10U 0 D f_pathmax 10U 0 D f_objlinkmax 10I 0 D f_dirlinkmax 10I 0 D f_reserved1 4A D f_fsid64 20U 0 D f_basetype 80A *--------------------------------------------------------------- * flags specified in the f_flags element of the ds_statvfs * data structure. *--------------------------------------------------------------- D ST_RDONLY... D C CONST(1) D ST_NOSUID... D C CONST(2) D ST_CASE_SENSITITIVE... D C CONST(4) D ST_CHOWN_RESTRICTED... D C CONST(8) D ST_THREAD_SAFE... D C CONST(16) D ST_DYNAMIC_MOUNT... D C CONST(32) D ST_NO_MOUNT_OVER... D C CONST(64) D ST_NO_EXPORTS... D C CONST(128) D ST_SYNCHRONOUS... D C CONST(256) *--------------------------------------------------------------- * statvfs() -- Get file system status * * path = (input) pathname of a link ("file") in the IFS. * buf = (output) data structure containing file system info * * Returns 0 if successful, -1 upon error. * (error information is returned via the "errno" variable) *--------------------------------------------------------------- D statvfs PR 10I 0 ExtProc('statvfs64') D path * value options(*string) D buf like(ds_statvfs)
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.