| LIBQUOTA(3) | Library Functions Manual | LIBQUOTA(3) | 
libquota, quota_open,
  quota_close,
  quota_getmountdevice,
  quota_getmountpoint,
  quota_getimplname,
  quota_getrestrictions,
  quota_getnumidtypes,
  quota_getnumobjtypes,
  quota_idtype_getname,
  quota_objtype_getname,
  quota_objtype_isbytes,
  quota_get, quota_put,
  quota_delete,
  quota_opencursor,
  quotacursor_close,
  quotacursor_skipidtype,
  quotacursor_get,
  quotacursor_getn,
  quotacursor_atend,
  quotacursor_rewind,
  quota_quotaon, quota_quotaoff,
  quotaval_clear —
#include <quota.h>
struct quotahandle *
  
  quota_open(const
    char *path);
void
  
  quota_close(struct
    quotahandle *qh);
const char *
  
  quota_getmountdevice(struct
    quotahandle *qh);
const char *
  
  quota_getmountpoint(struct
    quotahandle *qh);
const char *
  
  quota_getimplname(struct
    quotahandle *qh);
unsigned
  
  quota_getrestrictions(struct
    quotahandle *qh);
int
  
  quota_getnumidtypes(struct
    quotahandle *qh);
int
  
  quota_getnumobjtypes(struct
    quotahandle *qh);
const char *
  
  quota_idtype_getname(struct
    quotahandle *qh, int
    idtype);
const char *
  
  quota_objtype_getname(struct
    quotahandle *qh, int
    objtype);
int
  
  quota_objtype_isbytes(struct
    quotahandle *qh, int
    objtype);
int
  
  quota_get(struct
    quotahandle *qh, const
    struct quotakey *key,
    struct quotaval
  *val);
int
  
  quota_put(struct
    quotahandle *qh, const
    struct quotakey *key,
    const struct quotaval
    *val);
int
  
  quota_delete(struct
    quotahandle *qh, const
    struct quotakey *key);
struct quotacursor *
  
  quota_opencursor(struct
    quotahandle *qh);
void
  
  quotacursor_close(struct
    quotacursor *qc);
int
  
  quotacursor_skipidtype(struct
    quotacursor *qc, int
    idtype);
int
  
  quotacursor_get(struct
    quotacursor *qc, struct
    quotakey *key, const
    struct quotaval *val);
int
  
  quotacursor_getn(struct
    quotacursor *qc, struct
    quotakey *keys, const
    struct quotaval *vals,
    unsigned maxnum);
int
  
  quotacursor_atend(struct
    quotacursor *qc);
int
  
  quotacursor_rewind(struct
    quotacursor *qc);
int
  
  quota_quotaon(struct
    quotahandle *qh, int
    idtype);
int
  
  quota_quotaoff(struct
    quotahandle *qh, int
    idtype);
void
  
  quotaval_clear(struct
    quotaval *qv);
libquota library provides uniform access to disk
  quota functionality across all file systems and file system types. Programs
  should be linked with -lquota
  -lrpcsvc.
Quota information is organized as a key/value store, where the key names a particular limit and the value contains information about that limit. The information includes a configured soft limit, hard limit, and grace time, as well as the current usage and the expire time of any pending grace period. The soft limit may be exceeded temporarily, but only for the length of time specified; after that further usage is rejected. The hard limit may not be exceeded.
Each mounted file system that supports quotas contains its own key/value store for quota information. (The underlying representation may vary.) The library supports get, put, and delete operations, as well as a cursor interface for iterating an entire store. It also provides functions for inspecting the properties of a particular file system's quota implementation.
All functionality is accessed by first calling
    quota_open() on a particular volume to get a handle
    for that volume's quota information. Other operations can be called at this
    point. The quota_close() function should be called
    when done to release internal resources.
struct
  quotakey, which contains the following members:
struct
  quotaval, which contains the following members:
QUOTA_IDTYPE_USER is the code number for quotas on
  users; QUOTA_IDTYPE_GROUP is the code number for
  quotas on groups. Similarly, QUOTA_OBJTYPE_BLOCKS
  retrieves limits on file system blocks, while
  QUOTA_OBJTYPE_FILES retrieves limits on the number of
  existing files.
Some backends support a default configuration; this can be
    accessed by using QUOTA_DEFAULTID as the ID
  number.
When no limit is in place, the value
    QUOTA_NOLIMIT appears in the limit fields of struct
    quotaval, and if no time is indicated the value
    QUOTA_NOTIME appears in the time fields.
userquota and/or groupquota
  mount options specified. The tools
  quotacheck(8) and
  quotaon(8) must be used on
  quota v1 volumes before quotas become fully operational, and
  quotaoff(8) must be used at
  system shutdown time. The libquota library provides
  access to quota v1 data even before
  quotaon(8) is called by direct
  access to the on-disk quota information. However, this method is not
  recommended. Note that the userquota and
  groupquota mount options are read and interpreted at
  quotaon time, not mount(8) time.
  This allowed historic implementations to avoid storing the path in the kernel.
libquota client code to adapt or to provide more
  helpful diagnostic messages.
QUOTA_DEFAULTID) quota entry.QUOTA_NOLIMIT.quota_put() or other functions will fail.quota_open()NULL and sets
      errno.quota_close()quota_open().quota_getmountdevice()quota_getmountpoint()quota_getimplname()quota_getrestrictions()quota_getnumidtypes()quota_getnumobjtypes()quota_idtype_getname()quota_objtype_getname()quota_objtype_isbytes()quota_get()errno.quota_put()libquota. If it becomes incorrect or
      corrupted, quotacheck(8)
      or fsck(8) must be used. Also
      note that sufficient privilege is required. On failure, returns -1 and
      sets errno.quota_delete()errno.quota_opencursor()NULL and sets errno.quotacursor_close()quota_opencursor(). This releases internal
      storage.quotacursor_skipidtype()errno.quotacursor_get()errno.quotacursor_getn()errno.quotacursor_atend()quotacursor_rewind()quota_quotaon()userquota or
      groupquota, must be set therein. The path name for
      the quota file is retrieved from
      fstab(5) and passed to the
      kernel. This function will fail if used on newer quota implementations
      with in-file-system quotas.quota_quotaoff()quotaval_clear()EDEADLK]quotacursor_get() or
      quotacursor_getn(). The application should discard
      information collected so far and use
      quotacursor_rewind() to start the iteration
    over.ENOENT]quota_get()
      does not exist.ENXIO]quota_open() was on a volume whose quota support
      is not enabled.EOPNOTSUPP]quota_open() was on a volume that has no quota
      support. Or, the iterator functions, quota_put(),
      or other unsupported operations were attempted on an NFS volume, or on
      some other volume type that does not support the full semantic range of
      quota information.libquota library first appeared in
  NetBSD 6.0.
libquota library was written by
  David A. Holland.
| February 13, 2012 | NetBSD 10.0 |