mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-17 15:27:36 +00:00
- Document the default disk block usage unit.
- Add option -h, human-readable output. PR: docs/53732
This commit is contained in:
parent
ea8c4b451e
commit
478bf77471
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=163599
@ -4,7 +4,7 @@
|
|||||||
PROG= quota
|
PROG= quota
|
||||||
BINOWN= root
|
BINOWN= root
|
||||||
|
|
||||||
DPADD= ${LIBRPCSVC}
|
DPADD= ${LIBRPCSVC} ${LIBUTIL}
|
||||||
LDADD= -lrpcsvc
|
LDADD= -lrpcsvc -lutil
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
.include <bsd.prog.mk>
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
.\" from: @(#)quota.1 8.1 (Berkeley) 6/6/93
|
.\" from: @(#)quota.1 8.1 (Berkeley) 6/6/93
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd August 8, 2002
|
.Dd October 22, 2006
|
||||||
.Dt QUOTA 1
|
.Dt QUOTA 1
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -43,15 +43,15 @@
|
|||||||
.Nd display disk usage and limits
|
.Nd display disk usage and limits
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm
|
.Nm
|
||||||
.Op Fl glu
|
.Op Fl ghlu
|
||||||
.Op Fl v | Fl q
|
.Op Fl v | Fl q
|
||||||
.Nm
|
.Nm
|
||||||
.Op Fl lu
|
.Op Fl hlu
|
||||||
.Op Fl v | Fl q
|
.Op Fl v | Fl q
|
||||||
.Ar user ...
|
.Ar user ...
|
||||||
.Nm
|
.Nm
|
||||||
.Fl g
|
.Fl g
|
||||||
.Op Fl l
|
.Op Fl hl
|
||||||
.Op Fl v | Fl q
|
.Op Fl v | Fl q
|
||||||
.Ar group ...
|
.Ar group ...
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
@ -59,12 +59,16 @@ The
|
|||||||
.Nm
|
.Nm
|
||||||
utility displays users' disk usage and limits.
|
utility displays users' disk usage and limits.
|
||||||
By default only the user quotas are printed.
|
By default only the user quotas are printed.
|
||||||
|
Disk block usage and limits are shown in 1024-byte blocks.
|
||||||
.Pp
|
.Pp
|
||||||
The following options are available:
|
The following options are available:
|
||||||
.Bl -tag -width indent
|
.Bl -tag -width indent
|
||||||
.It Fl g
|
.It Fl g
|
||||||
Print group quotas for the group
|
Print group quotas for the group
|
||||||
of which the user is a member.
|
of which the user is a member.
|
||||||
|
.It Fl h
|
||||||
|
"Human-readable" output.
|
||||||
|
Use unit suffixes: Byte, Kilobyte, Megabyte, Gigabyte, Terabyte and Petabyte.
|
||||||
.It Fl l
|
.It Fl l
|
||||||
Do not report quotas on
|
Do not report quotas on
|
||||||
.Tn NFS
|
.Tn NFS
|
||||||
|
@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <fstab.h>
|
#include <fstab.h>
|
||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
|
#include <libutil.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -102,6 +103,7 @@ static int callaurpc(char *host, int prognum, int versnum, int procnum,
|
|||||||
xdrproc_t inproc, char *in, xdrproc_t outproc, char *out);
|
xdrproc_t inproc, char *in, xdrproc_t outproc, char *out);
|
||||||
static int alldigits(char *s);
|
static int alldigits(char *s);
|
||||||
|
|
||||||
|
int hflag;
|
||||||
int lflag;
|
int lflag;
|
||||||
int qflag;
|
int qflag;
|
||||||
int vflag;
|
int vflag;
|
||||||
@ -113,11 +115,14 @@ main(int argc, char *argv[])
|
|||||||
gid_t mygid, gidset[NGROUPS];
|
gid_t mygid, gidset[NGROUPS];
|
||||||
int i, ch, gflag = 0, uflag = 0;
|
int i, ch, gflag = 0, uflag = 0;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "glquv")) != -1) {
|
while ((ch = getopt(argc, argv, "ghlquv")) != -1) {
|
||||||
switch(ch) {
|
switch(ch) {
|
||||||
case 'g':
|
case 'g':
|
||||||
gflag++;
|
gflag++;
|
||||||
break;
|
break;
|
||||||
|
case 'h':
|
||||||
|
hflag++;
|
||||||
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
lflag++;
|
lflag++;
|
||||||
break;
|
break;
|
||||||
@ -180,9 +185,9 @@ usage(void)
|
|||||||
{
|
{
|
||||||
|
|
||||||
fprintf(stderr, "%s\n%s\n%s\n",
|
fprintf(stderr, "%s\n%s\n%s\n",
|
||||||
"usage: quota [-glu] [-v | -q]",
|
"usage: quota [-ghlu] [-v | -q]",
|
||||||
" quota [-lu] [-v | -q] user ...",
|
" quota [-hlu] [-v | -q] user ...",
|
||||||
" quota -g [-l] [-v | -q] group ...");
|
" quota -g [-hl] [-v | -q] group ...");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,6 +253,17 @@ showgrpname(char *name)
|
|||||||
showquotas(GRPQUOTA, grp->gr_gid, name);
|
showquotas(GRPQUOTA, grp->gr_gid, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
prthumanval(int len, int64_t bytes)
|
||||||
|
{
|
||||||
|
char buf[len + 1];
|
||||||
|
|
||||||
|
humanize_number(buf, sizeof(buf), bytes, "", HN_AUTOSCALE,
|
||||||
|
HN_B | HN_NOSPACE | HN_DECIMAL);
|
||||||
|
|
||||||
|
(void)printf(" %*s", len, buf);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
showquotas(int type, u_long id, const char *name)
|
showquotas(int type, u_long id, const char *name)
|
||||||
{
|
{
|
||||||
@ -310,18 +326,25 @@ showquotas(int type, u_long id, const char *name)
|
|||||||
printf("%s\n", qup->fsname);
|
printf("%s\n", qup->fsname);
|
||||||
nam = "";
|
nam = "";
|
||||||
}
|
}
|
||||||
printf("%15s%8lu%c%7lu%8lu%8s"
|
printf("%15s", nam);
|
||||||
, nam
|
if (hflag) {
|
||||||
, (u_long) (dbtob(qup->dqblk.dqb_curblocks)
|
prthumanval(7, dbtob(qup->dqblk.dqb_curblocks));
|
||||||
/ 1024)
|
printf("%c", (msgb == (char *)0) ? ' ' : '*');
|
||||||
, (msgb == (char *)0) ? ' ' : '*'
|
prthumanval(6, dbtob(qup->dqblk.dqb_bsoftlimit));
|
||||||
, (u_long) (dbtob(qup->dqblk.dqb_bsoftlimit)
|
prthumanval(7, dbtob(qup->dqblk.dqb_bhardlimit));
|
||||||
/ 1024)
|
} else {
|
||||||
, (u_long) (dbtob(qup->dqblk.dqb_bhardlimit)
|
printf("%8lu%c%7lu%8lu"
|
||||||
/ 1024)
|
, (u_long) (dbtob(qup->dqblk.dqb_curblocks)
|
||||||
|
/ 1024)
|
||||||
|
, (msgb == (char *)0) ? ' ' : '*'
|
||||||
|
, (u_long) (dbtob(qup->dqblk.dqb_bsoftlimit)
|
||||||
|
/ 1024)
|
||||||
|
, (u_long) (dbtob(qup->dqblk.dqb_bhardlimit)
|
||||||
|
/ 1024));
|
||||||
|
}
|
||||||
|
printf("%8s%8lu%c%7lu%8lu%8s\n"
|
||||||
, (msgb == (char *)0) ? ""
|
, (msgb == (char *)0) ? ""
|
||||||
:timeprt(qup->dqblk.dqb_btime));
|
:timeprt(qup->dqblk.dqb_btime)
|
||||||
printf("%8lu%c%7lu%8lu%8s\n"
|
|
||||||
, (u_long)qup->dqblk.dqb_curinodes
|
, (u_long)qup->dqblk.dqb_curinodes
|
||||||
, (msgi == (char *)0) ? ' ' : '*'
|
, (msgi == (char *)0) ? ' ' : '*'
|
||||||
, (u_long)qup->dqblk.dqb_isoftlimit
|
, (u_long)qup->dqblk.dqb_isoftlimit
|
||||||
|
Loading…
Reference in New Issue
Block a user