/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
* The Regents of the University of California
* All Rights Reserved
*
* University Acknowledgment- Portions of this document are derived from
* software developed by the University of California, Berkeley, and its
* contributors.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Quota report
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <strings.h>
#include <errno.h>
#include <fcntl.h>
#include <pwd.h>
struct username {
};
static int repquota(char *, char *, char *);
static void header(void);
static void usage(void);
static void fmttime(char *, long);
static int oneof(char *, char **, int);
extern char *mntopt();
extern char *hasmntopt();
static char **listbuf;
#if DEV_BSIZE < 1024
#else
#endif
int
{
char **listp;
int listcnt;
int listmax = 0;
int errs = 0;
int opt;
}
switch (opt) {
case 'v':
vflag++;
break;
case 'a':
aflag++;
break;
case 'V': {
/* Print command line */
char *optt;
int optc;
(void) printf("repquota -F ufs ");
if (optt)
}
(void) putchar('\n');
}
break;
case '?':
default:
usage();
}
usage();
/*
* Sync quota information to disk (as userdata). On logging
* file systems, this operation does nothing because quota
* information is treated as metadata. Logging file systems
* are dealt with below in repquota().
*/
(void) printf("Warning: "
"Quotas are not available in this kernel\n");
/*
* If aflag go through vfstab and make a list of appropriate
* filesystems.
*/
if (aflag) {
listcnt = 0;
}
(vfsbuf.vfs_mntopts == 0) ||
continue;
listp++;
listcnt++;
/* grow listbuf if needed */
sizeof (char *) * listmax);
"Can't grow listbuf.\n");
}
}
}
*listp = (char *)0;
} else {
}
}
}
}
while (listcnt--) {
if (*listp)
listp++;
}
if (errs > 0)
return (0);
}
static int
{
return (1);
}
return (1);
}
/*
* Flush the file system. On logging file systems, this makes
* sure that the quota information (as metadata) gets rolled
* forward.
*/
qffile);
return (1);
}
header();
break;
if (!vflag &&
continue;
}
return (0);
}
static void
header(void)
{
(void) printf(" Block limits"
" File limits\n");
(void) printf("User used soft hard timeleft"
" used soft hard timeleft\n");
}
static void
{
return;
if (up)
else
if (dqp->dqb_bsoftlimit &&
if (dqp->dqb_btimelimit == 0)
else
} else
btimeleft[0] = '\0';
if (dqp->dqb_ftimelimit == 0)
else
} else
ftimeleft[0] = '\0';
(void) printf("%c%c %6lu %6lu %6lu %11s %7lu %6lu %6lu %11s\n",
(dqp->dqb_bsoftlimit &&
(dqp->dqb_fsoftlimit &&
}
static void
{
int i;
static struct {
} cunits [] = {
{60*60*24*28, "months"},
{60*60*24*7, "weeks"},
{60*60*24, "days"},
{60*60, "hours"},
{60, "mins"},
{1, "secs"}
};
if (time <= 0) {
return;
}
break;
}
}
static int
{
int n = on;
while (n--) {
*listp = (char *)0;
return (1);
}
listp++;
}
return (0);
}
static struct username *
{
return (up);
return ((struct username *)0);
return (up);
}
/*
* adduid() should *ONLY* be called from lookup in order
* to avoid duplicate entries.
*/
static struct username *
{
if (up == 0) {
"out of memory for username structures\n");
}
return (up);
}
static void
usage(void)
{
}
static int
{
int fd;
int status;
/*
* Find the mount point of the special device. This is
* because the ioctl that implements the quotactl call has
* to go to a real file, and not to the block device.
*/
perror("open");
}
fd = -1;
continue;
sizeof (qfile))) {
continue;
}
/* If we find *ANY* valid "quotas" file, use it */
break;
}
if (fd == -1) {
(void) printf("quotactl: no quotas file "
"on any mounted file system\n");
return (-1);
}
}
return (status);
}
static char *
{
char *f, *opts;
static char *tmpopts;
if (tmpopts == 0) {
if (tmpopts == 0)
return (0);
}
}
return (NULL);
}