s3: libsmbclient: Re-resolving targetcli on every read/write/lseek/ftruncate/close...
[Samba.git] / tests / sysquotas.c
blobafec3f162446a492450baceee37030822a40c861
1 /* this test should find out what quota api is available on the os */
3 int autoconf_quota(void);
5 #if defined(HAVE_QUOTACTL_4A)
6 /* long quotactl(int cmd, char *special, qid_t id, caddr_t addr) */
8 #ifdef HAVE_SYS_TYPES_H
9 #include <sys/types.h>
10 #endif
12 #ifdef HAVE_ASM_TYPES_H
13 #include <asm/types.h>
14 #endif
16 #if defined(HAVE_LINUX_QUOTA_H)
17 # include <linux/quota.h>
18 # if defined(HAVE_STRUCT_IF_DQBLK)
19 # define SYS_DQBLK if_dqblk
20 # elif defined(HAVE_STRUCT_MEM_DQBLK)
21 # define SYS_DQBLK mem_dqblk
22 # endif
23 #elif defined(HAVE_SYS_QUOTA_H)
24 # include <sys/quota.h>
25 #endif
27 #ifdef HPUX
28 /* HPUX has no prototype for quotactl but we test compile with strict
29 error checks, which would fail without function prototype */
30 extern int quotactl(int cmd, const char *special, uid_t uid, void *addr);
31 #endif
33 #ifndef SYS_DQBLK
34 #define SYS_DQBLK dqblk
35 #endif
37 int autoconf_quota(void);
39 int autoconf_quota(void)
41 int ret = -1;
42 struct SYS_DQBLK D;
44 ret = quotactl(Q_GETQUOTA,"/dev/hda1",0,(void *)&D);
46 return ret;
49 #elif defined(HAVE_QUOTACTL_4B)
50 /* int quotactl(const char *path, int cmd, int id, char *addr); */
52 #ifdef HAVE_SYS_TYPES_H
53 #include <sys/types.h>
54 #endif
56 #ifdef HAVE_SYS_QUOTA_H
57 #include <sys/quota.h>
58 #else /* *BSD */
59 #include <sys/types.h>
60 #ifdef HAVE_UFS_UFS_QUOTA_H
61 #include <ufs/ufs/quota.h>
62 #endif
63 #include <machine/param.h>
64 #endif
66 int autoconf_quota(void)
68 int ret = -1;
69 struct dqblk D;
71 ret = quotactl("/",Q_GETQUOTA,0,(char *) &D);
73 return ret;
76 #elif defined(HAVE_QUOTACTL_2)
78 #error HAVE_QUOTACTL_2 not implemented
80 #else
82 #error Unknow QUOTACTL prototype
84 #endif
86 int main(void)
88 autoconf_quota();
89 return 0;