2003-10-10 00:58:11 +04:00
/* this test should find out what quota api is available on the os */
2005-04-13 01:56:34 +04:00
int autoconf_quota ( void ) ;
2003-10-10 00:58:11 +04:00
# if defined(HAVE_QUOTACTL_4A)
/* long quotactl(int cmd, char *special, qid_t id, caddr_t addr) */
# ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
# endif
# ifdef HAVE_ASM_TYPES_H
# include <asm/types.h>
# endif
# if defined(HAVE_LINUX_QUOTA_H)
# include <linux / quota.h>
# if defined(HAVE_STRUCT_IF_DQBLK)
# define SYS_DQBLK if_dqblk
# elif defined(HAVE_STRUCT_MEM_DQBLK)
# define SYS_DQBLK mem_dqblk
# endif
# elif defined(HAVE_SYS_QUOTA_H)
# include <sys / quota.h>
# endif
2012-09-11 02:07:45 +04:00
# ifdef HPUX
/* HPUX has no prototype for quotactl but we test compile with strict
error checks , which would fail without function prototype */
extern int quotactl ( int cmd , const char * special , uid_t uid , void * addr ) ;
# endif
2003-10-10 00:58:11 +04:00
# ifndef SYS_DQBLK
# define SYS_DQBLK dqblk
# endif
2005-05-02 21:49:43 +04:00
int autoconf_quota ( void ) ;
2003-10-10 00:58:11 +04:00
int autoconf_quota ( void )
{
int ret = - 1 ;
struct SYS_DQBLK D ;
ret = quotactl ( Q_GETQUOTA , " /dev/hda1 " , 0 , ( void * ) & D ) ;
2012-09-29 08:28:57 +04:00
2003-10-10 00:58:11 +04:00
return ret ;
}
# elif defined(HAVE_QUOTACTL_4B)
/* int quotactl(const char *path, int cmd, int id, char *addr); */
2012-07-01 16:35:55 +04:00
# ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
# endif
2003-10-10 00:58:11 +04:00
# ifdef HAVE_SYS_QUOTA_H
# include <sys/quota.h>
# else /* *BSD */
# include <sys/types.h>
2012-09-07 17:59:16 +04:00
# ifdef HAVE_UFS_UFS_QUOTA_H
2003-10-10 00:58:11 +04:00
# include <ufs/ufs/quota.h>
2012-09-07 17:59:16 +04:00
# endif
2003-10-10 00:58:11 +04:00
# include <machine/param.h>
# endif
int autoconf_quota ( void )
{
int ret = - 1 ;
struct dqblk D ;
ret = quotactl ( " / " , Q_GETQUOTA , 0 , ( char * ) & D ) ;
return ret ;
}
# elif defined(HAVE_QUOTACTL_2)
# error HAVE_QUOTACTL_2 not implemented
# else
# error Unknow QUOTACTL prototype
# endif
int main ( void )
2012-09-29 08:28:57 +04:00
{
2003-10-10 00:58:11 +04:00
autoconf_quota ( ) ;
return 0 ;
}