head 1.10; access; symbols pkgsrc-2026Q1:1.10.0.112 pkgsrc-2026Q1-base:1.10 pkgsrc-2025Q4:1.10.0.110 pkgsrc-2025Q4-base:1.10 pkgsrc-2025Q3:1.10.0.108 pkgsrc-2025Q3-base:1.10 pkgsrc-2025Q2:1.10.0.106 pkgsrc-2025Q2-base:1.10 pkgsrc-2025Q1:1.10.0.104 pkgsrc-2025Q1-base:1.10 pkgsrc-2024Q4:1.10.0.102 pkgsrc-2024Q4-base:1.10 pkgsrc-2024Q3:1.10.0.100 pkgsrc-2024Q3-base:1.10 pkgsrc-2024Q2:1.10.0.98 pkgsrc-2024Q2-base:1.10 pkgsrc-2024Q1:1.10.0.96 pkgsrc-2024Q1-base:1.10 pkgsrc-2023Q4:1.10.0.94 pkgsrc-2023Q4-base:1.10 pkgsrc-2023Q3:1.10.0.92 pkgsrc-2023Q3-base:1.10 pkgsrc-2023Q2:1.10.0.90 pkgsrc-2023Q2-base:1.10 pkgsrc-2023Q1:1.10.0.88 pkgsrc-2023Q1-base:1.10 pkgsrc-2022Q4:1.10.0.86 pkgsrc-2022Q4-base:1.10 pkgsrc-2022Q3:1.10.0.84 pkgsrc-2022Q3-base:1.10 pkgsrc-2022Q2:1.10.0.82 pkgsrc-2022Q2-base:1.10 pkgsrc-2022Q1:1.10.0.80 pkgsrc-2022Q1-base:1.10 pkgsrc-2021Q4:1.10.0.78 pkgsrc-2021Q4-base:1.10 pkgsrc-2021Q3:1.10.0.76 pkgsrc-2021Q3-base:1.10 pkgsrc-2021Q2:1.10.0.74 pkgsrc-2021Q2-base:1.10 pkgsrc-2021Q1:1.10.0.72 pkgsrc-2021Q1-base:1.10 pkgsrc-2020Q4:1.10.0.70 pkgsrc-2020Q4-base:1.10 pkgsrc-2020Q3:1.10.0.68 pkgsrc-2020Q3-base:1.10 pkgsrc-2020Q2:1.10.0.64 pkgsrc-2020Q2-base:1.10 pkgsrc-2020Q1:1.10.0.44 pkgsrc-2020Q1-base:1.10 pkgsrc-2019Q4:1.10.0.66 pkgsrc-2019Q4-base:1.10 pkgsrc-2019Q3:1.10.0.62 pkgsrc-2019Q3-base:1.10 pkgsrc-2019Q2:1.10.0.60 pkgsrc-2019Q2-base:1.10 pkgsrc-2019Q1:1.10.0.58 pkgsrc-2019Q1-base:1.10 pkgsrc-2018Q4:1.10.0.56 pkgsrc-2018Q4-base:1.10 pkgsrc-2018Q3:1.10.0.54 pkgsrc-2018Q3-base:1.10 pkgsrc-2018Q2:1.10.0.52 pkgsrc-2018Q2-base:1.10 pkgsrc-2018Q1:1.10.0.50 pkgsrc-2018Q1-base:1.10 pkgsrc-2017Q4:1.10.0.48 pkgsrc-2017Q4-base:1.10 pkgsrc-2017Q3:1.10.0.46 pkgsrc-2017Q3-base:1.10 pkgsrc-2017Q2:1.10.0.42 pkgsrc-2017Q2-base:1.10 pkgsrc-2017Q1:1.10.0.40 pkgsrc-2017Q1-base:1.10 pkgsrc-2016Q4:1.10.0.38 pkgsrc-2016Q4-base:1.10 pkgsrc-2016Q3:1.10.0.36 pkgsrc-2016Q3-base:1.10 pkgsrc-2016Q2:1.10.0.34 pkgsrc-2016Q2-base:1.10 pkgsrc-2016Q1:1.10.0.32 pkgsrc-2016Q1-base:1.10 pkgsrc-2015Q4:1.10.0.30 pkgsrc-2015Q4-base:1.10 pkgsrc-2015Q3:1.10.0.28 pkgsrc-2015Q3-base:1.10 pkgsrc-2015Q2:1.10.0.26 pkgsrc-2015Q2-base:1.10 pkgsrc-2015Q1:1.10.0.24 pkgsrc-2015Q1-base:1.10 pkgsrc-2014Q4:1.10.0.22 pkgsrc-2014Q4-base:1.10 pkgsrc-2014Q3:1.10.0.20 pkgsrc-2014Q3-base:1.10 pkgsrc-2014Q2:1.10.0.18 pkgsrc-2014Q2-base:1.10 pkgsrc-2014Q1:1.10.0.16 pkgsrc-2014Q1-base:1.10 pkgsrc-2013Q4:1.10.0.14 pkgsrc-2013Q4-base:1.10 pkgsrc-2013Q3:1.10.0.12 pkgsrc-2013Q3-base:1.10 pkgsrc-2013Q2:1.10.0.10 pkgsrc-2013Q2-base:1.10 pkgsrc-2013Q1:1.10.0.8 pkgsrc-2013Q1-base:1.10 pkgsrc-2012Q4:1.10.0.6 pkgsrc-2012Q4-base:1.10 pkgsrc-2012Q3:1.10.0.4 pkgsrc-2012Q3-base:1.10 pkgsrc-2012Q2:1.10.0.2 pkgsrc-2012Q2-base:1.10 pkgsrc-2012Q1:1.9.0.14 pkgsrc-2012Q1-base:1.9 pkgsrc-2011Q4:1.9.0.12 pkgsrc-2011Q4-base:1.9 pkgsrc-2011Q3:1.9.0.10 pkgsrc-2011Q3-base:1.9 pkgsrc-2011Q2:1.9.0.8 pkgsrc-2011Q2-base:1.9 pkgsrc-2011Q1:1.9.0.6 pkgsrc-2011Q1-base:1.9 pkgsrc-2010Q4:1.9.0.4 pkgsrc-2010Q4-base:1.9 pkgsrc-2010Q3:1.9.0.2 pkgsrc-2010Q3-base:1.9 pkgsrc-2010Q2:1.8.0.2 pkgsrc-2010Q2-base:1.8 pkgsrc-2010Q1:1.6.0.2 pkgsrc-2010Q1-base:1.6 pkgsrc-2009Q4:1.5.0.2 pkgsrc-2009Q4-base:1.5 pkgsrc-2009Q3:1.4.0.30 pkgsrc-2009Q3-base:1.4 pkgsrc-2009Q2:1.4.0.28 pkgsrc-2009Q2-base:1.4 pkgsrc-2009Q1:1.4.0.26 pkgsrc-2009Q1-base:1.4 pkgsrc-2008Q4:1.4.0.24 pkgsrc-2008Q4-base:1.4 pkgsrc-2008Q3:1.4.0.22 pkgsrc-2008Q3-base:1.4 cube-native-xorg:1.4.0.20 cube-native-xorg-base:1.4 pkgsrc-2008Q2:1.4.0.18 pkgsrc-2008Q2-base:1.4 cwrapper:1.4.0.16 pkgsrc-2008Q1:1.4.0.14 pkgsrc-2008Q1-base:1.4 pkgsrc-2007Q4:1.4.0.12 pkgsrc-2007Q4-base:1.4 pkgsrc-2007Q3:1.4.0.10 pkgsrc-2007Q3-base:1.4 pkgsrc-2007Q2:1.4.0.8 pkgsrc-2007Q2-base:1.4 pkgsrc-2007Q1:1.4.0.6 pkgsrc-2007Q1-base:1.4 pkgsrc-2006Q4:1.4.0.4 pkgsrc-2006Q4-base:1.4 pkgsrc-2006Q3:1.4.0.2 pkgsrc-2006Q3-base:1.4 pkgsrc-2006Q2:1.3.0.4 pkgsrc-2006Q2-base:1.3 pkgsrc-2006Q1:1.3.0.2 pkgsrc-2006Q1-base:1.3 pkgsrc-2005Q4:1.2.0.10 pkgsrc-2005Q4-base:1.2 pkgsrc-2005Q3:1.2.0.8 pkgsrc-2005Q3-base:1.2 pkgsrc-2005Q2:1.2.0.6 pkgsrc-2005Q2-base:1.2 pkgsrc-2005Q1:1.2.0.4 pkgsrc-2005Q1-base:1.2 pkgsrc-2004Q4:1.2.0.2 pkgsrc-2004Q4-base:1.2; locks; strict; comment @# @; 1.10 date 2012.05.12.23.10.30; author dholland; state Exp; branches; next 1.9; 1.9 date 2010.09.10.07.58.45; author taca; state Exp; branches 1.9.14.1; next 1.8; 1.8 date 2010.04.22.15.01.07; author taca; state Exp; branches; next 1.7; 1.7 date 2010.04.21.05.34.31; author taca; state Exp; branches; next 1.6; 1.6 date 2010.03.21.14.49.10; author taca; state Exp; branches; next 1.5; 1.5 date 2009.10.27.15.29.33; author taca; state Exp; branches; next 1.4; 1.4 date 2006.09.24.15.40.38; author joerg; state Exp; branches; next 1.3; 1.3 date 2006.01.25.15.48.50; author joerg; state Exp; branches; next 1.2; 1.2 date 2004.12.15.13.23.12; author taca; state Exp; branches; next 1.1; 1.1 date 2004.11.28.04.21.42; author taca; state Exp; branches; next ; 1.9.14.1 date 2012.05.14.12.26.00; author tron; state Exp; branches; next ; desc @@ 1.10 log @Fix build on netbsd-6 and up. @ text @$NetBSD: patch-ab,v 1.9 2010/09/10 07:58:45 taca Exp $ - fix package's version number - remove a debug printout - need unistd.h for some things - support dragonfly - support linux 2.6+ with slightly different API - support netbsd-3+ with statvfs - support netbsd-6+ with libquota - fix solaris code - ruby API fixes - ...? --- quota.c.orig 2002-03-30 14:59:12.000000000 +0000 +++ quota.c @@@@ -5,17 +5,25 @@@@ #include "ruby.h" -#define RUBY_QUOTA_VERSION "0.4.1" +#define RUBY_QUOTA_VERSION "0.5.1" -#ifdef HAVE_LINUX_QUOTA_H /* for linux-2.4.x */ +#ifdef HAVE_UNISTD_H +#include +#endif + +#ifdef HAVE_LINUX_QUOTA_H /* for linux */ # define USE_LINUX_QUOTA #endif #ifdef HAVE_SYS_FS_UFS_QUOTA_H /* for Solaris-2.6,7,8 */ # define USE_SOLARIS_QUOTA #endif -#ifdef HAVE_UFS_UFS_QUOTA_H /* for *BSD */ +#ifdef HAVE_QUOTA_H /* for NetBSD-6 and up */ +# define USE_NETBSD_QUOTA +#else +#ifdef HAVE_UFS_UFS_QUOTA_H /* for traditional *BSD */ # define USE_BSD_QUOTA #endif +#endif #ifdef USE_LINUX_QUOTA #ifdef HAVE_LINUX_TYPES_H @@@@ -29,10 +37,16 @@@@ # include #endif #include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) +# define USE_LINUX_QUOTA_26 +# define qid_t uid_t +# define dqblk if_dqblk +#else +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) # define USE_LINUX_QUOTA_24 # define uid_t qid_t # define dqblk disk_dqblk +# endif #endif #endif @@@@ -42,6 +56,12 @@@@ #include #endif +#ifdef USE_NETBSD_QUOTA +#include +#include +#include +#endif + #ifdef USE_BSD_QUOTA #include #include @@@@ -51,6 +71,12 @@@@ #if defined(SYS_UCRED_H) # include /* required by NetBSD,FreeBSD */ #endif +#if defined(__DragonFly__) +# include +# if __DragonFly_version >= 160000 +# define dqblk ufs_dqblk +# endif +#endif #endif static VALUE rb_mQuota; @@@@ -144,7 +170,6 @@@@ rb_quotactl(int cmd, char *dev, VALUE vu uid_t uid; get_uid(vuid, &uid, &is_gid); - printf("cmd = %d, dev = %s, uid = %d, gid? = %d\n", cmd, dev, uid, is_gid); if( is_gid ){ return quotactl(QCMD(cmd,GRPQUOTA),dev,(qid_t)uid,addr); } @@@@ -152,14 +177,18 @@@@ rb_quotactl(int cmd, char *dev, VALUE vu return quotactl(QCMD(cmd,USRQUOTA),dev,(qid_t)uid,addr); }; }; -#elif defined(USE_BSD_QUOTA) /* for *BSD */ +#elif defined(USE_BSD_QUOTA) /* for traditional *BSD */ static int rb_quotactl(int cmd, char *dev, VALUE vuid, caddr_t addr) { char *path; int is_gid; uid_t uid; +#if defined(HAVE_SYS_STATVFS_H) && !defined(__DragonFly__) + struct statvfs *buff; +#else struct statfs *buff; +#endif int i, count, ret; buff = 0; @@@@ -187,12 +216,16 @@@@ rb_quotactl(int cmd, char *dev, VALUE vu static int rb_quotactl(int cmd, char *dev, VALUE vuid, caddr_t addr) { - struct quotctl qctl = {cmd, uid, addr}; + struct quotctl qctl; int fd; uid_t uid; get_uid(vuid, &uid, 0); + qctl.op = cmd; + qctl.uid = uid; + qctl.addr = addr; + switch( cmd ){ case Q_QUOTAON: case Q_QUOTAOFF: @@@@ -225,17 +258,217 @@@@ rb_quotactl(int cmd, char *dev, VALUE vu }; #endif +#ifdef USE_NETBSD_QUOTA + +static struct quotahandle * +rb_quotaopen(char *dev) +{ + char *path; +#if defined(HAVE_SYS_STATVFS_H) && !defined(__DragonFly__) + struct statvfs *buff; +#else + struct statfs *buff; +#endif + int i, count; + + buff = 0; + path = dev; + count = getmntinfo(&buff, MNT_WAIT); + for( i=0; iqv_hardlimit = GetMemberU("bhardlimit"); + c_blocks->qv_softlimit = GetMemberU("bsoftlimit"); + c_blocks->qv_usage = GetMemberU("curblocks"); + c_blocks->qv_expiretime = GetMemberS("btimelimit"); + c_blocks->qv_grace = GetMemberS("bgrace"); + c_files->qv_hardlimit = GetMemberU("ihardlimit"); + c_files->qv_softlimit = GetMemberU("isoftlimit"); + c_files->qv_usage = GetMemberU("curinodes"); + c_files->qv_expiretime = GetMemberS("itimelimit"); + c_files->qv_grace = GetMemberS("igrace"); + +#undef GetMemberU +#undef GetMemberS +} + +VALUE +rb_diskquota_new(struct quotaval *c_blocks, struct quotaval *c_files) +{ + VALUE dqb; + + dqb = rb_struct_new(rb_sDiskQuota, + ULL2NUM(c_blocks->qv_hardlimit), + ULL2NUM(c_blocks->qv_softlimit), + ULL2NUM(c_blocks->qv_usage), + ULL2NUM(c_files->qv_hardlimit), + ULL2NUM(c_files->qv_softlimit), + ULL2NUM(c_files->qv_usage), + LL2NUM(c_blocks->qv_expiretime), + LL2NUM(c_files->qv_expiretime), +#if 0 /* not yet */ + LL2NUM(c_blocks->qv_grace), + LL2NUM(c_files->qv_grace), +#endif + 0); + return dqb; +} + +#else /* not USE_NETBSD_QUOTA */ + void rb_diskquota_get(VALUE dqb, struct dqblk * c_dqb) { VALUE v; +#if defined(USE_LINUX_QUOTA) && \ + (defined(USE_LINUX_QUOTA_24) || defined(USE_LINUX_QUOTA_26)) +#define GetMember(mem) \ + ((v = rb_struct_getmember(dqb,rb_intern(mem))) == Qnil) ? 0 : (NUM2ULL(v)) +#else #define GetMember(mem) \ ((v = rb_struct_getmember(dqb,rb_intern(mem))) == Qnil) ? 0 : (NUM2UINT(v)) +#endif #if defined(USE_LINUX_QUOTA) c_dqb->dqb_bhardlimit = GetMember("bhardlimit"); c_dqb->dqb_bsoftlimit = GetMember("bsoftlimit"); -#if !defined(USE_LINUX_QUOTA_24) +#if defined(USE_LINUX_QUOTA_24) || defined(USE_LINUX_QUOTA_26) + c_dqb->dqb_curspace = GetMember("curspace"); +#else c_dqb->dqb_curblocks = GetMember("curblocks"); #endif c_dqb->dqb_ihardlimit = GetMember("ihardlimit"); @@@@ -271,20 +504,29 @@@@ rb_diskquota_new(struct dqblk *c_dqb) VALUE dqb; #if defined(USE_LINUX_QUOTA) +#if defined(USE_LINUX_QUOTA_24) || defined(USE_LINUX_QUOTA_26) + dqb = rb_struct_new(rb_sDiskQuota, + ULL2NUM(c_dqb->dqb_bhardlimit), + ULL2NUM(c_dqb->dqb_bsoftlimit), + ULL2NUM(c_dqb->dqb_curspace), + ULL2NUM(c_dqb->dqb_ihardlimit), + ULL2NUM(c_dqb->dqb_isoftlimit), + ULL2NUM(c_dqb->dqb_curinodes), + ULL2NUM(c_dqb->dqb_btime), + ULL2NUM(c_dqb->dqb_itime), + 0); +#else dqb = rb_struct_new(rb_sDiskQuota, UINT2NUM(c_dqb->dqb_bhardlimit), UINT2NUM(c_dqb->dqb_bsoftlimit), -#if defined(USE_LINUX_QUOTA_24) - UINT2NUM(c_dqb->dqb_curspace), -#else UINT2NUM(c_dqb->dqb_curblocks), -#endif UINT2NUM(c_dqb->dqb_ihardlimit), UINT2NUM(c_dqb->dqb_isoftlimit), UINT2NUM(c_dqb->dqb_curinodes), UINT2NUM(c_dqb->dqb_btime), UINT2NUM(c_dqb->dqb_itime), 0); +#endif #elif defined(USE_BSD_QUOTA) dqb = rb_struct_new(rb_sDiskQuota, UINT2NUM(c_dqb->dqb_bhardlimit), @@@@ -296,7 +538,7 @@@@ rb_diskquota_new(struct dqblk *c_dqb) UINT2NUM(c_dqb->dqb_btime), UINT2NUM(c_dqb->dqb_itime), 0); -#elif defined(USE_SOLARIS) +#elif defined(USE_SOLARIS_QUOTA) dqb = rb_struct_new(rb_sDiskQuota, UINT2NUM(c_dqb->dqb_bhardlimit), UINT2NUM(c_dqb->dqb_bsoftlimit), @@@@ -311,18 +553,34 @@@@ rb_diskquota_new(struct dqblk *c_dqb) return dqb; }; +#endif /* USE_NETBSD_QUOTA */ + static VALUE rb_quota_getquota(VALUE self, VALUE dev, VALUE uid) { - char *c_dev = STR2CSTR(dev); + char *c_dev = StringValuePtr(dev); +#ifdef USE_NETBSD_QUOTA + struct quotaval c_blocks, c_files; +#else struct dqblk c_dqb; +#endif VALUE dqb = Qnil; +#ifdef USE_NETBSD_QUOTA + if( rb_quotaget(c_dev, uid, &c_blocks, &c_files) == -1 ){ + rb_sys_fail("quota_get"); + }; +#else if( rb_quotactl(Q_GETQUOTA,c_dev,uid,(caddr_t)(&c_dqb)) == -1 ){ rb_sys_fail("quotactl"); }; +#endif +#ifdef USE_NETBSD_QUOTA + dqb = rb_diskquota_new(&c_blocks, &c_files); +#else dqb = rb_diskquota_new(&c_dqb); +#endif return dqb; }; @@@@ -330,11 +588,17 @@@@ rb_quota_getquota(VALUE self, VALUE dev, VALUE rb_quota_quotaoff(VALUE self, VALUE dev) { - char *c_dev = STR2CSTR(dev); + char *c_dev = StringValuePtr(dev); +#ifdef USE_NETBSD_QUOTA + if( rb_quotaoff(c_dev) == -1 ){ + rb_sys_fail("quota_quotaoff"); + }; +#else if( rb_quotactl(Q_QUOTAOFF,c_dev,Qnil,NULL) == -1 ){ rb_sys_fail("quotactl"); }; +#endif return Qnil; }; @@@@ -342,12 +606,20 @@@@ rb_quota_quotaoff(VALUE self, VALUE dev) VALUE rb_quota_quotaon(VALUE self, VALUE dev, VALUE quotas) { - char *c_dev = STR2CSTR(dev); - char *c_quotas = STR2CSTR(quotas); + char *c_dev = StringValuePtr(dev); + char *c_quotas = StringValuePtr(quotas); +#ifdef USE_NETBSD_QUOTA + /* ignore the quota file names - they must be placed in /etc/fstab */ + (void)quotas; + if( rb_quotaon(c_dev) == -1 ){ + rb_sys_fail("quota_quotaon"); + }; +#else if( rb_quotactl(Q_QUOTAON,c_dev,Qnil,(caddr_t)c_quotas) == -1 ){ rb_sys_fail("quotactl"); }; +#endif return Qnil; }; @@@@ -355,14 +627,28 @@@@ rb_quota_quotaon(VALUE self, VALUE dev, VALUE rb_quota_setquota(VALUE self, VALUE dev, VALUE uid, VALUE dqb) { - char *c_dev = STR2CSTR(dev); + char *c_dev = StringValuePtr(dev); +#ifdef USE_NETBSD_QUOTA + struct quotaval c_qvb, c_qvf; +#else struct dqblk c_dqb; +#endif +#ifdef USE_NETBSD_QUOTA + rb_diskquota_get(dqb, &c_qvb, &c_qvf); +#else rb_diskquota_get(dqb, &c_dqb); +#endif +#ifdef USE_NETBSD_QUOTA + if( rb_quotaput(c_dev,uid,&c_qvb, &c_qvf) == -1 ){ + rb_sys_fail("quota_put"); + }; +#else if( rb_quotactl(Q_SETQUOTA,c_dev,uid,(caddr_t)(&c_dqb)) == -1 ){ rb_sys_fail("quotactl"); }; +#endif return Qnil; }; @@@@ -371,7 +657,7 @@@@ VALUE rb_quota_setqlim(VALUE self, VALUE dev, VALUE uid, VALUE dqb) { #ifdef Q_SETQLIM - char *c_dev = STR2CSTR(dev); + char *c_dev = StringValuePtr(dev); struct dqblk c_dqb; rb_diskquota_get(dqb, &c_dqb); @@@@ -392,18 +678,22 @@@@ rb_quota_setqlim(VALUE self, VALUE dev, VALUE rb_quota_sync(VALUE self, VALUE dev) { +#ifdef USE_NETBSD_QUOTA + /* nothing */ +#else char *c_dev; if( dev == Qnil ){ c_dev = NULL; } else{ - c_dev = STR2CSTR(dev); + c_dev = StringValuePtr(dev); }; if( rb_quotactl(Q_SYNC,c_dev,Qnil,NULL) == -1 ){ /* uid and addr are ignored */ rb_sys_fail("quotactl"); }; +#endif /* USE_NETBSD_QUOTA */ return Qnil; }; @@@@ -442,7 +732,7 @@@@ Init_quota() "curinodes", "btimelimit", "itimelimit", - 0); + NULL); /* for compatibility */ #define DQ_ALIAS(a,b) rb_alias(rb_sDiskQuota,rb_intern(#a),rb_intern(#b)) @@@@ -454,7 +744,7 @@@@ Init_quota() DQ_ALIAS(fsoftlimit=, isoftlimit=); DQ_ALIAS(curfiles=, curinodes=); DQ_ALIAS(ftimelimit=, itimelimit=); -#if defined(USE_LINUX_QUOTA_24) +#if defined(USE_LINUX_QUOTA_24) || defined(USE_LINUX_QUOTA_26) DQ_ALIAS(curspace, curblocks); DQ_ALIAS(curspace=, curblocks=); #endif @ 1.9 log @* Use lang/ruby/gem.mk instead of misc/rubygems/rubygem.mk. * Remove RUBY_HAS_ARCHLIB. * Change PKG_DESTDIR_SUPPORT to user-destdir. * Update patch to support both ruby18 and ruby19. No functional change. @ text @d1 12 a12 1 $NetBSD: patch-ab,v 1.8 2010/04/22 15:01:07 taca Exp $ d16 1 a16 1 @@@@ -5,9 +5,13 @@@@ d32 14 a45 1 @@@@ -29,10 +33,16 @@@@ d63 14 a76 1 @@@@ -51,6 +61,12 @@@@ d89 1 a89 1 @@@@ -144,7 +160,6 @@@@ rb_quotactl(int cmd, char *dev, VALUE vu d97 9 a105 1 @@@@ -159,7 +174,11 @@@@ rb_quotactl(int cmd, char *dev, VALUE vu d117 1 a117 1 @@@@ -187,12 +206,16 @@@@ rb_quotactl(int cmd, char *dev, VALUE vu d135 198 a332 1 @@@@ -230,12 +253,20 @@@@ rb_diskquota_get(VALUE dqb, struct dqblk d354 1 a354 1 @@@@ -271,20 +302,29 @@@@ rb_diskquota_new(struct dqblk *c_dqb) d388 15 a402 1 @@@@ -314,7 +354,7 @@@@ rb_diskquota_new(struct dqblk *c_dqb) d408 3 d412 1 d415 19 a433 1 @@@@ -330,7 +370,7 @@@@ rb_quota_getquota(VALUE self, VALUE dev, d440 5 d447 6 a452 1 @@@@ -342,8 +382,8 @@@@ rb_quota_quotaoff(VALUE self, VALUE dev) d461 7 d470 6 a475 1 @@@@ -355,7 +395,7 @@@@ rb_quota_quotaon(VALUE self, VALUE dev, d481 3 d485 1 d487 3 d491 15 a505 1 @@@@ -371,7 +411,7 @@@@ VALUE d514 10 a523 1 @@@@ -398,7 +438,7 @@@@ rb_quota_sync(VALUE self, VALUE dev) d532 7 a538 1 @@@@ -442,7 +482,7 @@@@ Init_quota() d547 1 a547 1 @@@@ -454,7 +494,7 @@@@ Init_quota() @ 1.9.14.1 log @Pullup ticket #3784 - requested by dholland sysutils/ruby-quota: build fix Revisions pulled up: - sysutils/ruby-quota/distinfo 1.15 - sysutils/ruby-quota/patches/patch-aa 1.3 - sysutils/ruby-quota/patches/patch-ab 1.10 --- Module Name: pkgsrc Committed By: dholland Date: Sat May 12 23:10:30 UTC 2012 Modified Files: pkgsrc/sysutils/ruby-quota: distinfo pkgsrc/sysutils/ruby-quota/patches: patch-aa patch-ab Log Message: Fix build on netbsd-6 and up. @ text @d1 1 a1 12 $NetBSD$ - fix package's version number - remove a debug printout - need unistd.h for some things - support dragonfly - support linux 2.6+ with slightly different API - support netbsd-3+ with statvfs - support netbsd-6+ with libquota - fix solaris code - ruby API fixes - ...? d5 1 a5 1 @@@@ -5,17 +5,25 @@@@ d21 1 a21 14 # define USE_SOLARIS_QUOTA #endif -#ifdef HAVE_UFS_UFS_QUOTA_H /* for *BSD */ +#ifdef HAVE_QUOTA_H /* for NetBSD-6 and up */ +# define USE_NETBSD_QUOTA +#else +#ifdef HAVE_UFS_UFS_QUOTA_H /* for traditional *BSD */ # define USE_BSD_QUOTA #endif +#endif #ifdef USE_LINUX_QUOTA #ifdef HAVE_LINUX_TYPES_H @@@@ -29,10 +37,16 @@@@ d39 1 a39 14 @@@@ -42,6 +56,12 @@@@ #include #endif +#ifdef USE_NETBSD_QUOTA +#include +#include +#include +#endif + #ifdef USE_BSD_QUOTA #include #include @@@@ -51,6 +71,12 @@@@ d52 1 a52 1 @@@@ -144,7 +170,6 @@@@ rb_quotactl(int cmd, char *dev, VALUE vu d60 1 a60 9 @@@@ -152,14 +177,18 @@@@ rb_quotactl(int cmd, char *dev, VALUE vu return quotactl(QCMD(cmd,USRQUOTA),dev,(qid_t)uid,addr); }; }; -#elif defined(USE_BSD_QUOTA) /* for *BSD */ +#elif defined(USE_BSD_QUOTA) /* for traditional *BSD */ static int rb_quotactl(int cmd, char *dev, VALUE vuid, caddr_t addr) { d72 1 a72 1 @@@@ -187,12 +216,16 @@@@ rb_quotactl(int cmd, char *dev, VALUE vu d90 1 a90 198 @@@@ -225,17 +258,217 @@@@ rb_quotactl(int cmd, char *dev, VALUE vu }; #endif +#ifdef USE_NETBSD_QUOTA + +static struct quotahandle * +rb_quotaopen(char *dev) +{ + char *path; +#if defined(HAVE_SYS_STATVFS_H) && !defined(__DragonFly__) + struct statvfs *buff; +#else + struct statfs *buff; +#endif + int i, count; + + buff = 0; + path = dev; + count = getmntinfo(&buff, MNT_WAIT); + for( i=0; iqv_hardlimit = GetMemberU("bhardlimit"); + c_blocks->qv_softlimit = GetMemberU("bsoftlimit"); + c_blocks->qv_usage = GetMemberU("curblocks"); + c_blocks->qv_expiretime = GetMemberS("btimelimit"); + c_blocks->qv_grace = GetMemberS("bgrace"); + c_files->qv_hardlimit = GetMemberU("ihardlimit"); + c_files->qv_softlimit = GetMemberU("isoftlimit"); + c_files->qv_usage = GetMemberU("curinodes"); + c_files->qv_expiretime = GetMemberS("itimelimit"); + c_files->qv_grace = GetMemberS("igrace"); + +#undef GetMemberU +#undef GetMemberS +} + +VALUE +rb_diskquota_new(struct quotaval *c_blocks, struct quotaval *c_files) +{ + VALUE dqb; + + dqb = rb_struct_new(rb_sDiskQuota, + ULL2NUM(c_blocks->qv_hardlimit), + ULL2NUM(c_blocks->qv_softlimit), + ULL2NUM(c_blocks->qv_usage), + ULL2NUM(c_files->qv_hardlimit), + ULL2NUM(c_files->qv_softlimit), + ULL2NUM(c_files->qv_usage), + LL2NUM(c_blocks->qv_expiretime), + LL2NUM(c_files->qv_expiretime), +#if 0 /* not yet */ + LL2NUM(c_blocks->qv_grace), + LL2NUM(c_files->qv_grace), +#endif + 0); + return dqb; +} + +#else /* not USE_NETBSD_QUOTA */ + void rb_diskquota_get(VALUE dqb, struct dqblk * c_dqb) d112 1 a112 1 @@@@ -271,20 +504,29 @@@@ rb_diskquota_new(struct dqblk *c_dqb) d146 1 a146 15 @@@@ -296,7 +538,7 @@@@ rb_diskquota_new(struct dqblk *c_dqb) UINT2NUM(c_dqb->dqb_btime), UINT2NUM(c_dqb->dqb_itime), 0); -#elif defined(USE_SOLARIS) +#elif defined(USE_SOLARIS_QUOTA) dqb = rb_struct_new(rb_sDiskQuota, UINT2NUM(c_dqb->dqb_bhardlimit), UINT2NUM(c_dqb->dqb_bsoftlimit), @@@@ -311,18 +553,34 @@@@ rb_diskquota_new(struct dqblk *c_dqb) return dqb; }; +#endif /* USE_NETBSD_QUOTA */ + a151 3 +#ifdef USE_NETBSD_QUOTA + struct quotaval c_blocks, c_files; +#else a152 1 +#endif d155 1 a155 19 +#ifdef USE_NETBSD_QUOTA + if( rb_quotaget(c_dev, uid, &c_blocks, &c_files) == -1 ){ + rb_sys_fail("quota_get"); + }; +#else if( rb_quotactl(Q_GETQUOTA,c_dev,uid,(caddr_t)(&c_dqb)) == -1 ){ rb_sys_fail("quotactl"); }; +#endif +#ifdef USE_NETBSD_QUOTA + dqb = rb_diskquota_new(&c_blocks, &c_files); +#else dqb = rb_diskquota_new(&c_dqb); +#endif return dqb; }; @@@@ -330,11 +588,17 @@@@ rb_quota_getquota(VALUE self, VALUE dev, a161 5 +#ifdef USE_NETBSD_QUOTA + if( rb_quotaoff(c_dev) == -1 ){ + rb_sys_fail("quota_quotaoff"); + }; +#else d164 1 a164 6 }; +#endif return Qnil; }; @@@@ -342,12 +606,20 @@@@ rb_quota_quotaoff(VALUE self, VALUE dev) a172 7 +#ifdef USE_NETBSD_QUOTA + /* ignore the quota file names - they must be placed in /etc/fstab */ + (void)quotas; + if( rb_quotaon(c_dev) == -1 ){ + rb_sys_fail("quota_quotaon"); + }; +#else d175 1 a175 6 }; +#endif return Qnil; }; @@@@ -355,14 +627,28 @@@@ rb_quota_quotaon(VALUE self, VALUE dev, a180 3 +#ifdef USE_NETBSD_QUOTA + struct quotaval c_qvb, c_qvf; +#else a181 1 +#endif a182 3 +#ifdef USE_NETBSD_QUOTA + rb_diskquota_get(dqb, &c_qvb, &c_qvf); +#else d184 1 a184 15 +#endif +#ifdef USE_NETBSD_QUOTA + if( rb_quotaput(c_dev,uid,&c_qvb, &c_qvf) == -1 ){ + rb_sys_fail("quota_put"); + }; +#else if( rb_quotactl(Q_SETQUOTA,c_dev,uid,(caddr_t)(&c_dqb)) == -1 ){ rb_sys_fail("quotactl"); }; +#endif return Qnil; }; @@@@ -371,7 +657,7 @@@@ VALUE d193 1 a193 10 @@@@ -392,18 +678,22 @@@@ rb_quota_setqlim(VALUE self, VALUE dev, VALUE rb_quota_sync(VALUE self, VALUE dev) { +#ifdef USE_NETBSD_QUOTA + /* nothing */ +#else char *c_dev; if( dev == Qnil ){ d202 1 a202 7 rb_sys_fail("quotactl"); }; +#endif /* USE_NETBSD_QUOTA */ return Qnil; }; @@@@ -442,7 +732,7 @@@@ Init_quota() d211 1 a211 1 @@@@ -454,7 +744,7 @@@@ Init_quota() @ 1.8 log @Make ruby-quota really usable on Linux. It wasn't considered about member of struct dqblk, unsigned 64bit integer. Bump PKG_REVISION. @ text @d1 1 a1 1 $NetBSD: patch-ab,v 1.7 2010/04/21 05:34:31 taca Exp $ d146 56 @ 1.7 log @Remove debugging printf() on Linux. Bump PKGREVISION. @ text @d1 1 a1 1 $NetBSD: patch-ab,v 1.6 2010/03/21 14:49:10 taca Exp $ d90 12 a101 1 @@@@ -235,7 +258,9 @@@@ rb_diskquota_get(VALUE dqb, struct dqblk d112 16 a127 1 @@@@ -274,7 +299,7 @@@@ rb_diskquota_new(struct dqblk *c_dqb) d132 2 a133 3 +#if defined(USE_LINUX_QUOTA_24) || defined(USE_LINUX_QUOTA_26) UINT2NUM(c_dqb->dqb_curspace), #else d135 12 a146 1 @@@@ -442,7 +467,7 @@@@ Init_quota() d155 1 a155 1 @@@@ -454,7 +479,7 @@@@ Init_quota() @ 1.6 log @Improve portability (NULL v.s. 0). Bump PKGREVISION. @ text @d1 1 a1 1 $NetBSD: patch-ab,v 1.5 2009/10/27 15:29:33 taca Exp $ d52 9 a60 1 @@@@ -159,7 +175,11 @@@@ rb_quotactl(int cmd, char *dev, VALUE vu d72 1 a72 1 @@@@ -187,12 +207,16 @@@@ rb_quotactl(int cmd, char *dev, VALUE vu d90 1 a90 1 @@@@ -235,7 +259,9 @@@@ rb_diskquota_get(VALUE dqb, struct dqblk d101 1 a101 1 @@@@ -274,7 +300,7 @@@@ rb_diskquota_new(struct dqblk *c_dqb) d110 1 a110 1 @@@@ -442,7 +468,7 @@@@ Init_quota() d119 1 a119 1 @@@@ -454,7 +480,7 @@@@ Init_quota() @ 1.5 log @ * Fix build problem on Linux 2.6 and later. * Fix module's version was still "0.4.1". Bump PKGREVISION. @ text @d1 1 a1 1 $NetBSD: patch-ab,v 1.4 2006/09/24 15:40:38 joerg Exp $ d3 1 a3 1 --- quota.c.orig 2002-03-30 23:59:12.000000000 +0900 d102 9 @ 1.4 log @Fix build on DragonFly 1.6+. @ text @d1 1 a1 1 $NetBSD$ d3 1 a3 1 --- quota.c.orig 2002-03-30 14:59:12.000000000 +0000 d5 35 a39 1 @@@@ -51,6 +51,12 @@@@ d52 1 a52 1 @@@@ -159,7 +165,11 @@@@ rb_quotactl(int cmd, char *dev, VALUE vu d64 1 a64 1 @@@@ -187,12 +197,16 @@@@ rb_quotactl(int cmd, char *dev, VALUE vu d82 29 @ 1.3 log @getmntinfo still needs a statfs * on DragonFly. @ text @d1 1 a1 1 $NetBSD: patch-ab,v 1.2 2004/12/15 13:23:12 taca Exp $ d3 1 a3 1 --- quota.c.orig 2002-03-30 23:59:12.000000000 +0900 d5 14 a18 1 @@@@ -159,7 +159,11 @@@@ rb_quotactl(int cmd, char *dev, VALUE vu d30 1 a30 1 @@@@ -187,12 +191,16 @@@@ rb_quotactl(int cmd, char *dev, VALUE vu @ 1.2 log @ Fix build problem on Solaris. Bump PKGREVISION. @ text @d1 1 a1 1 $NetBSD: patch-ab,v 1.1 2004/11/28 04:21:42 taca Exp $ d9 1 a9 1 +#if defined(HAVE_SYS_STATVFS_H) @ 1.1 log @Migrate ruby-quota to use new framework for Ruby packages. Add patches for support statvfs(2) support, too. @ text @d1 1 a1 1 $NetBSD$ d17 18 @