* Finding disk quotas from callable interface?
@ 1998-04-17 4:00 Glenn Holliday
1998-04-18 4:00 ` Bob Harris
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Glenn Holliday @ 1998-04-17 4:00 UTC (permalink / raw)
Hello,
I know this has got to be in the docs somewhere, so your first answer
will be RTFM. I've looked through all our VMS system services manuals,
all the online bookreader docs, I've searched DejaNews and the FAQs,
and our system documentation library people say they can't find the
info either. I will be very grateful of any pointers from
people who have already found this answer...
I have an application that writes a lot of info to disk, and is run by
many different users with different quotas, using different disks at
run time. I want to check at run time that the executing process has
sufficient available disk quota on the run time target disk
before the application begins its work. There must be a system
services call to do this, right?
The application is written in C++ using DEC CXX 5.6. Our system runs
OpenVMS 6.1, soon to upgrade to 6.2. Our physical hardware has both
clusters and networked nodes, so the application might get executed on
VAX 8xxx, VAX 6xxx, or Alpha CPUs. I want to stick to the standard
OpenVMS callable services, so that none of the environment details
should matter.
Thanks for all suggestions and help.
--
Glenn Holliday ghollida@kgo.csc.com
Computer Sciences Corporation
5166 Potomac Drive King George VA 22485 540-663-9251
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Finding disk quotas from callable interface?
1998-04-17 4:00 Finding disk quotas from callable interface? Glenn Holliday
@ 1998-04-18 4:00 ` Bob Harris
1998-04-20 4:00 ` Arthur E. Ragosta
1998-04-20 4:00 ` avajhoej
2 siblings, 0 replies; 4+ messages in thread
From: Bob Harris @ 1998-04-18 4:00 UTC (permalink / raw)
In article <3537EA09.E868E862@acm.org>, ghollida@kgo.csc.com wrote:
> Hello,
> I know this has got to be in the docs somewhere, so your first answer
> will be RTFM. I've looked through all our VMS system services manuals,
> all the online bookreader docs, I've searched DejaNews and the FAQs,
> and our system documentation library people say they can't find the
> info either. I will be very grateful of any pointers from
> people who have already found this answer...
As someone else pointed out, you need to look in the I/O User's Guide
Chapter 1 for the ACP.
Here are 2 programs that demonstration accessing diskquotas
===========
1st program
===========
/*---------------------------------------------------------------------------
SHOW_QUOTA.C - quick program to demonstrate fetching Disk Quota values
using the XQP QIO interface.
-----------------------------------------------------------------------------*/
#include <stdio.h>
#include <iodef.h>
#include <ssdef.h>
#include <fibdef.h>
typedef unsigned char byte;
typedef unsigned short word;
typedef unsigned long longword;
usage()
{
#define FP(_s) fprintf( stderr, "%s\n", _s )
FP( "Usage: SHOW_QUOTA :== $disk:[dir]DIRSEQ.EXE" );
FP( " SHOW_QUOTA device [ggg,mmm]" );
FP( "" );
FP( " device - disk to look for quota information on" );
FP( " ggg - UIC Group (Octal)" );
FP( " mmm - UIC Member (Octal)" );
exit( 0x12 );
}
main( int ac, char **av )
{
longword status;
longword d_dev[2];
longword d_fib[2];
longword d_in[2];
longword d_out[2];
longword grp;
longword mem;
longword uic;
word iosb[4];
word chan;
word outlen;
struct fibdef fib;
struct z_quota {
longword flags;
longword uic;
longword usage;
longword permquota;
longword overdraft;
longword future_1;
longword future_2;
longword future_3;
};
struct z_quota in_quota;
struct z_quota out_quota;
/*---------------------------------------------------------------------------*/
if ( ac != 3 )
usage();
/*
Assign a channel to the specified device.
*/
d_dev[0] = strlen(av[1]);
d_dev[1] = av[1];
status = sys$assign( d_dev, &chan, 0, 0 );
if ( !(status & 1) )
lib$stop( status );
/*
convert the UIC for our use
*/
sscanf( av[2], "[%o,%o]", &grp, &mem );
uic = (grp << 16) | mem;
/*
Initialize the File Information Block used by the XQP
*/
d_fib[0] = sizeof(fib);
d_fib[1] = &fib;
memset( &fib, 0, sizeof(fib) );
fib.fib$r_exctl_overlay.fib$w_exctl = FIB$C_EXA_QUOTA;
/*
Initialize the quota file transfer blocks.
*/
memset( &in_quota, 0, sizeof(in_quota) );
d_in[0] = sizeof(in_quota);
d_in[1] = &in_quota;
in_quota.uic = uic;
memset( &out_quota, 0, sizeof(out_quota) );
d_out[0] = sizeof(out_quota);
d_out[1] = &out_quota;
/*
Fetch the disk quota for the specified UIC
*/
status = sys$qiow( 0, chan, IO$_ACPCONTROL, iosb, 0, 0,
d_fib, d_in, &outlen, d_out, 0, 0 );
if ( (status & 1) )
status = iosb[0];
if ( !(status & 1) )
lib$stop( status );
/*
Display the Quota information.
*/
printf( "[%o,%o] Usage:%d PermQuota:%d Overdraft:%d\n",
((out_quota.uic >> 16) & 0x0000ffff),
(out_quota.uic & 0x0000ffff),
out_quota.usage,
out_quota.permquota,
out_quota.overdraft );
/*
Free the channel.
*/
status = sys$dassgn( chan );
if ( !(status & 1) )
lib$stop( status );
}
===========
2nd program
===========
/*---------------------------------------------------------------------------
XQP_IS_QUOTA_ENABLED.C - quick program to demonstrate testing for disk
quotas being enabled.
-----------------------------------------------------------------------------*/
#include <stdio.h>
#include <iodef.h>
#include <ssdef.h>
#include <stsdef.h>
#include <fibdef.h>
#include <jpidef.h>
typedef unsigned char byte;
typedef unsigned short word;
typedef unsigned long longword;
main( int ac, char **av )
{
longword status;
longword d_dev[2];
longword d_fib[2];
longword d_in[2];
longword d_out[2];
longword uic;
word iosb[4];
word chan;
word outlen;
struct fibdef fib;
struct z_quota {
longword flags;
longword uic;
longword usage;
longword permquota;
longword overdraft;
longword future_1;
longword future_2;
longword future_3;
};
struct z_quota in_quota;
struct z_quota out_quota;
struct {
word size;
word item;
void *addr;
word *outl;
} itmlst[2];
/*---------------------------------------------------------------------------*/
if ( ac != 2 )
usage();
/*
Assign a channel to the specified device.
*/
d_dev[0] = strlen(av[1]);
d_dev[1] = av[1];
status = sys$assign( d_dev, &chan, 0, 0 );
if ( !(status & STS$M_SUCCESS) )
lib$stop( status );
/*
We need a UIC, so get our own.
*/
memset( itmlst, 0, sizeof(itmlst) );
itmlst[0].size = 4;
itmlst[0].item = JPI$_UIC;
itmlst[0].addr = &uic;
status = sys$getjpiw( 0, 0, 0, itmlst, iosb, 0, 0 );
if ( (status & STS$M_SUCCESS) )
status = iosb[0];
if ( !(status & STS$M_SUCCESS) )
lib$stop( status );
/*
Initialize the File Information Block used by the XQP
*/
d_fib[0] = sizeof(fib);
d_fib[1] = &fib;
memset( &fib, 0, sizeof(fib) );
fib.fib$r_exctl_overlay.fib$w_exctl = FIB$C_EXA_QUOTA;
/*
Initialize the quota file transfer blocks.
*/
memset( &in_quota, 0, sizeof(in_quota) );
d_in[0] = sizeof(in_quota);
d_in[1] = &in_quota;
in_quota.uic = uic;
memset( &out_quota, 0, sizeof(out_quota) );
d_out[0] = sizeof(out_quota);
d_out[1] = &out_quota;
/*
Fetch the disk quota for the specified UIC
*/
status = sys$qiow( 0, chan, IO$_ACPCONTROL, iosb, 0, 0,
d_fib, d_in, &outlen, d_out, 0, 0 );
if ( (status & STS$M_SUCCESS) )
status = iosb[0];
if ( status == SS$_QFNOTACT )
{
lib$stop( status );
}
if ( status == SS$_NODISKQUOTA )
{
/*
this is OK. We don't care if the current user doesn't have a quota
entry, we only care that we didn't get QFNOTACT error.
*/
status = SS$_NORMAL;
}
if ( !(status & STS$M_SUCCESS) )
{
lib$stop( status );
}
/*
Free the channel.
*/
status = sys$dassgn( chan );
if ( !(status & STS$M_SUCCESS) )
lib$stop( status );
exit( status );
}
usage()
{
#define FP(_s) fprintf( stderr, "%s\n", _s )
FP( "Usage: XQP_IS_QUOTA_ENABLED :== $disk:[dir]XQP_IS_QUOTA_ENABLED.EXE" );
FP( " XQP_IS_QUOTA_ENABLED device" );
FP( "" );
FP( " device - disk to check if disk quotas are enabled" );
exit( SS$_BADPARAM );
}
--
Bob Harris
I don't get to tell me what to do, I only get to tell me how to do it.
The opinions expressed are my own and do not represent Digital Equipment
Corporation
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Finding disk quotas from callable interface?
1998-04-17 4:00 Finding disk quotas from callable interface? Glenn Holliday
1998-04-18 4:00 ` Bob Harris
1998-04-20 4:00 ` Arthur E. Ragosta
@ 1998-04-20 4:00 ` avajhoej
2 siblings, 0 replies; 4+ messages in thread
From: avajhoej @ 1998-04-20 4:00 UTC (permalink / raw)
In article <3537EA09.E868E862@acm.org>,
ghollida@kgo.csc.com wrote:
> I have an application that writes a lot of info to disk, and is run by
> many different users with different quotas, using different disks at
> run time. I want to check at run time that the executing process has
> sufficient available disk quota on the run time target disk
> before the application begins its work. There must be a system
> services call to do this, right?
ftp://ftp.hhs.dk/misc/show_quota.for has an example in
Fortran.
ftp://ftp.hhs.dk/utilities/utilities.zip has examples of getting
diskquota in both Fortran, Pascal and C.
Maybe you can cook something from them.
Arne
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Finding disk quotas from callable interface?
1998-04-17 4:00 Finding disk quotas from callable interface? Glenn Holliday
1998-04-18 4:00 ` Bob Harris
@ 1998-04-20 4:00 ` Arthur E. Ragosta
1998-04-20 4:00 ` avajhoej
2 siblings, 0 replies; 4+ messages in thread
From: Arthur E. Ragosta @ 1998-04-20 4:00 UTC (permalink / raw)
To: ghollida
Glenn Holliday wrote:
> I have an application that writes a lot of info to disk, and is run by
> many different users with different quotas, using different disks at
> run time. I want to check at run time that the executing process has
> sufficient available disk quota on the run time target disk
> before the application begins its work. There must be a system
> services call to do this, right?
Check out the utility routine "QUOTA" in the MERLIB library of
utility routines. The library is available on our web server, as well
as in a number of packages.
http://afdd.arc.nasa.gov/afdd/rsd/autoteam.htm
ar
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1998-04-20 4:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-04-17 4:00 Finding disk quotas from callable interface? Glenn Holliday
1998-04-18 4:00 ` Bob Harris
1998-04-20 4:00 ` Arthur E. Ragosta
1998-04-20 4:00 ` avajhoej
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox