16281b30aSJason Evans /* 26281b30aSJason Evans * Copyright (C) 2001 Jason Evans <jasone@freebsd.org>. All rights reserved. 36281b30aSJason Evans * 46281b30aSJason Evans * Redistribution and use in source and binary forms, with or without 56281b30aSJason Evans * modification, are permitted provided that the following conditions 66281b30aSJason Evans * are met: 76281b30aSJason Evans * 1. Redistributions of source code must retain the above copyright 86281b30aSJason Evans * notice(s), this list of conditions and the following disclaimer as 96281b30aSJason Evans * the first lines of this file unmodified other than the possible 106281b30aSJason Evans * addition of one or more copyright notices. 116281b30aSJason Evans * 2. Redistributions in binary form must reproduce the above copyright 126281b30aSJason Evans * notice(s), this list of conditions and the following disclaimer in the 136281b30aSJason Evans * documentation and/or other materials provided with the distribution. 146281b30aSJason Evans * 156281b30aSJason Evans * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY 166281b30aSJason Evans * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 176281b30aSJason Evans * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 186281b30aSJason Evans * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY 196281b30aSJason Evans * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 206281b30aSJason Evans * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 216281b30aSJason Evans * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 226281b30aSJason Evans * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 236281b30aSJason Evans * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 246281b30aSJason Evans * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 256281b30aSJason Evans * DAMAGE. 266281b30aSJason Evans */ 276281b30aSJason Evans 286281b30aSJason Evans /* 296281b30aSJason Evans * Shared/exclusive locks. This implementation assures deterministic lock 306281b30aSJason Evans * granting behavior, so that slocks and xlocks are interleaved. 316281b30aSJason Evans * 326281b30aSJason Evans * Priority propagation will not generally raise the priority of lock holders, 336281b30aSJason Evans * so should not be relied upon in combination with sx locks. 346281b30aSJason Evans */ 356281b30aSJason Evans 36677b542eSDavid E. O'Brien #include <sys/cdefs.h> 37677b542eSDavid E. O'Brien __FBSDID("$FreeBSD$"); 38677b542eSDavid E. O'Brien 396281b30aSJason Evans #include <sys/param.h> 406281b30aSJason Evans #include <sys/systm.h> 416281b30aSJason Evans #include <sys/ktr.h> 426281b30aSJason Evans #include <sys/condvar.h> 4319284646SJohn Baldwin #include <sys/lock.h> 446281b30aSJason Evans #include <sys/mutex.h> 456281b30aSJason Evans #include <sys/sx.h> 466281b30aSJason Evans 4719284646SJohn Baldwin struct lock_class lock_class_sx = { 4819284646SJohn Baldwin "sx", 49b0b7cb50SJohn Baldwin LC_SLEEPLOCK | LC_SLEEPABLE | LC_RECURSABLE | LC_UPGRADABLE 5019284646SJohn Baldwin }; 5119284646SJohn Baldwin 52781a35dfSJohn Baldwin #ifndef INVARIANTS 53781a35dfSJohn Baldwin #define _sx_assert(sx, what, file, line) 54781a35dfSJohn Baldwin #endif 55781a35dfSJohn Baldwin 566281b30aSJason Evans void 57c27b5699SAndrew R. Reiter sx_sysinit(void *arg) 58c27b5699SAndrew R. Reiter { 59c27b5699SAndrew R. Reiter struct sx_args *sargs = arg; 60c27b5699SAndrew R. Reiter 61c27b5699SAndrew R. Reiter sx_init(sargs->sa_sx, sargs->sa_desc); 62c27b5699SAndrew R. Reiter } 63c27b5699SAndrew R. Reiter 64c27b5699SAndrew R. Reiter void 656281b30aSJason Evans sx_init(struct sx *sx, const char *description) 666281b30aSJason Evans { 6719284646SJohn Baldwin struct lock_object *lock; 686281b30aSJason Evans 6919284646SJohn Baldwin lock = &sx->sx_object; 707ada5876SJohn Baldwin KASSERT((lock->lo_flags & LO_INITIALIZED) == 0, 717ada5876SJohn Baldwin ("sx lock %s %p already initialized", description, sx)); 727ada5876SJohn Baldwin bzero(sx, sizeof(*sx)); 7319284646SJohn Baldwin lock->lo_class = &lock_class_sx; 749939f0f1SJohn Baldwin lock->lo_type = lock->lo_name = description; 75b0b7cb50SJohn Baldwin lock->lo_flags = LO_WITNESS | LO_RECURSABLE | LO_SLEEPABLE | 76b0b7cb50SJohn Baldwin LO_UPGRADABLE; 77857d9c60SDon Lewis sx->sx_lock = mtx_pool_find(mtxpool_lockbuilder, sx); 786281b30aSJason Evans sx->sx_cnt = 0; 796281b30aSJason Evans cv_init(&sx->sx_shrd_cv, description); 806281b30aSJason Evans sx->sx_shrd_wcnt = 0; 816281b30aSJason Evans cv_init(&sx->sx_excl_cv, description); 826281b30aSJason Evans sx->sx_excl_wcnt = 0; 83af761449SBosko Milekic sx->sx_xholder = NULL; 8419284646SJohn Baldwin 8519284646SJohn Baldwin LOCK_LOG_INIT(lock, 0); 8619284646SJohn Baldwin 8719284646SJohn Baldwin WITNESS_INIT(lock); 886281b30aSJason Evans } 896281b30aSJason Evans 906281b30aSJason Evans void 916281b30aSJason Evans sx_destroy(struct sx *sx) 926281b30aSJason Evans { 936281b30aSJason Evans 9419284646SJohn Baldwin LOCK_LOG_DESTROY(&sx->sx_object, 0); 9519284646SJohn Baldwin 966281b30aSJason Evans KASSERT((sx->sx_cnt == 0 && sx->sx_shrd_wcnt == 0 && sx->sx_excl_wcnt == 97a48740b6SDavid E. O'Brien 0), ("%s (%s): holders or waiters\n", __func__, 9819284646SJohn Baldwin sx->sx_object.lo_name)); 996281b30aSJason Evans 100f2860039SMatthew Dillon sx->sx_lock = NULL; 1016281b30aSJason Evans cv_destroy(&sx->sx_shrd_cv); 1026281b30aSJason Evans cv_destroy(&sx->sx_excl_cv); 10319284646SJohn Baldwin 10419284646SJohn Baldwin WITNESS_DESTROY(&sx->sx_object); 1056281b30aSJason Evans } 1066281b30aSJason Evans 1076281b30aSJason Evans void 10819284646SJohn Baldwin _sx_slock(struct sx *sx, const char *file, int line) 1096281b30aSJason Evans { 1106281b30aSJason Evans 111f2860039SMatthew Dillon mtx_lock(sx->sx_lock); 112b40ce416SJulian Elischer KASSERT(sx->sx_xholder != curthread, 113a48740b6SDavid E. O'Brien ("%s (%s): slock while xlock is held @ %s:%d\n", __func__, 1145f36700aSJohn Baldwin sx->sx_object.lo_name, file, line)); 1158d768e76SJohn Baldwin WITNESS_CHECKORDER(&sx->sx_object, LOP_NEWORDER, file, line); 1166281b30aSJason Evans 1176281b30aSJason Evans /* 1186281b30aSJason Evans * Loop in case we lose the race for lock acquisition. 1196281b30aSJason Evans */ 1206281b30aSJason Evans while (sx->sx_cnt < 0) { 1216281b30aSJason Evans sx->sx_shrd_wcnt++; 122f2860039SMatthew Dillon cv_wait(&sx->sx_shrd_cv, sx->sx_lock); 1236281b30aSJason Evans sx->sx_shrd_wcnt--; 1246281b30aSJason Evans } 1256281b30aSJason Evans 1266281b30aSJason Evans /* Acquire a shared lock. */ 1276281b30aSJason Evans sx->sx_cnt++; 1286281b30aSJason Evans 12919284646SJohn Baldwin LOCK_LOG_LOCK("SLOCK", &sx->sx_object, 0, 0, file, line); 13019284646SJohn Baldwin WITNESS_LOCK(&sx->sx_object, 0, file, line); 13119284646SJohn Baldwin 132f2860039SMatthew Dillon mtx_unlock(sx->sx_lock); 1336281b30aSJason Evans } 1346281b30aSJason Evans 1355f36700aSJohn Baldwin int 1365f36700aSJohn Baldwin _sx_try_slock(struct sx *sx, const char *file, int line) 1375f36700aSJohn Baldwin { 1385f36700aSJohn Baldwin 139f2860039SMatthew Dillon mtx_lock(sx->sx_lock); 1405f36700aSJohn Baldwin if (sx->sx_cnt >= 0) { 1415f36700aSJohn Baldwin sx->sx_cnt++; 1425f36700aSJohn Baldwin LOCK_LOG_TRY("SLOCK", &sx->sx_object, 0, 1, file, line); 1435f36700aSJohn Baldwin WITNESS_LOCK(&sx->sx_object, LOP_TRYLOCK, file, line); 144f2860039SMatthew Dillon mtx_unlock(sx->sx_lock); 1455f36700aSJohn Baldwin return (1); 1465f36700aSJohn Baldwin } else { 1475f36700aSJohn Baldwin LOCK_LOG_TRY("SLOCK", &sx->sx_object, 0, 0, file, line); 148f2860039SMatthew Dillon mtx_unlock(sx->sx_lock); 1495f36700aSJohn Baldwin return (0); 1505f36700aSJohn Baldwin } 1515f36700aSJohn Baldwin } 1525f36700aSJohn Baldwin 1536281b30aSJason Evans void 15419284646SJohn Baldwin _sx_xlock(struct sx *sx, const char *file, int line) 1556281b30aSJason Evans { 1566281b30aSJason Evans 157f2860039SMatthew Dillon mtx_lock(sx->sx_lock); 1586281b30aSJason Evans 159af761449SBosko Milekic /* 160af761449SBosko Milekic * With sx locks, we're absolutely not permitted to recurse on 161af761449SBosko Milekic * xlocks, as it is fatal (deadlock). Normally, recursion is handled 162af761449SBosko Milekic * by WITNESS, but as it is not semantically correct to hold the 163af761449SBosko Milekic * xlock while in here, we consider it API abuse and put it under 164af761449SBosko Milekic * INVARIANTS. 165af761449SBosko Milekic */ 166b40ce416SJulian Elischer KASSERT(sx->sx_xholder != curthread, 167a48740b6SDavid E. O'Brien ("%s (%s): xlock already held @ %s:%d", __func__, 16819284646SJohn Baldwin sx->sx_object.lo_name, file, line)); 1698d768e76SJohn Baldwin WITNESS_CHECKORDER(&sx->sx_object, LOP_NEWORDER | LOP_EXCLUSIVE, file, 1708d768e76SJohn Baldwin line); 171af761449SBosko Milekic 1726281b30aSJason Evans /* Loop in case we lose the race for lock acquisition. */ 1736281b30aSJason Evans while (sx->sx_cnt != 0) { 1746281b30aSJason Evans sx->sx_excl_wcnt++; 175f2860039SMatthew Dillon cv_wait(&sx->sx_excl_cv, sx->sx_lock); 1766281b30aSJason Evans sx->sx_excl_wcnt--; 1776281b30aSJason Evans } 1786281b30aSJason Evans 179af761449SBosko Milekic MPASS(sx->sx_cnt == 0); 180af761449SBosko Milekic 1816281b30aSJason Evans /* Acquire an exclusive lock. */ 1826281b30aSJason Evans sx->sx_cnt--; 183b40ce416SJulian Elischer sx->sx_xholder = curthread; 1846281b30aSJason Evans 18519284646SJohn Baldwin LOCK_LOG_LOCK("XLOCK", &sx->sx_object, 0, 0, file, line); 1862d96f0b1SJohn Baldwin WITNESS_LOCK(&sx->sx_object, LOP_EXCLUSIVE, file, line); 18719284646SJohn Baldwin 188f2860039SMatthew Dillon mtx_unlock(sx->sx_lock); 1896281b30aSJason Evans } 1906281b30aSJason Evans 1915f36700aSJohn Baldwin int 1925f36700aSJohn Baldwin _sx_try_xlock(struct sx *sx, const char *file, int line) 1935f36700aSJohn Baldwin { 1945f36700aSJohn Baldwin 195f2860039SMatthew Dillon mtx_lock(sx->sx_lock); 1965f36700aSJohn Baldwin if (sx->sx_cnt == 0) { 1975f36700aSJohn Baldwin sx->sx_cnt--; 198b40ce416SJulian Elischer sx->sx_xholder = curthread; 1995f36700aSJohn Baldwin LOCK_LOG_TRY("XLOCK", &sx->sx_object, 0, 1, file, line); 2005f36700aSJohn Baldwin WITNESS_LOCK(&sx->sx_object, LOP_EXCLUSIVE | LOP_TRYLOCK, file, 2015f36700aSJohn Baldwin line); 202f2860039SMatthew Dillon mtx_unlock(sx->sx_lock); 2035f36700aSJohn Baldwin return (1); 2045f36700aSJohn Baldwin } else { 2055f36700aSJohn Baldwin LOCK_LOG_TRY("XLOCK", &sx->sx_object, 0, 0, file, line); 206f2860039SMatthew Dillon mtx_unlock(sx->sx_lock); 2075f36700aSJohn Baldwin return (0); 2085f36700aSJohn Baldwin } 2095f36700aSJohn Baldwin } 2105f36700aSJohn Baldwin 2116281b30aSJason Evans void 21219284646SJohn Baldwin _sx_sunlock(struct sx *sx, const char *file, int line) 2136281b30aSJason Evans { 2146281b30aSJason Evans 2154e5e677bSJohn Baldwin _sx_assert(sx, SX_SLOCKED, file, line); 216f2860039SMatthew Dillon mtx_lock(sx->sx_lock); 2176281b30aSJason Evans 21819284646SJohn Baldwin WITNESS_UNLOCK(&sx->sx_object, 0, file, line); 21919284646SJohn Baldwin 2206281b30aSJason Evans /* Release. */ 2216281b30aSJason Evans sx->sx_cnt--; 2226281b30aSJason Evans 2236281b30aSJason Evans /* 2246281b30aSJason Evans * If we just released the last shared lock, wake any waiters up, giving 2256281b30aSJason Evans * exclusive lockers precedence. In order to make sure that exclusive 2266281b30aSJason Evans * lockers won't be blocked forever, don't wake shared lock waiters if 2276281b30aSJason Evans * there are exclusive lock waiters. 2286281b30aSJason Evans */ 2296281b30aSJason Evans if (sx->sx_excl_wcnt > 0) { 2306281b30aSJason Evans if (sx->sx_cnt == 0) 2316281b30aSJason Evans cv_signal(&sx->sx_excl_cv); 2326281b30aSJason Evans } else if (sx->sx_shrd_wcnt > 0) 2336281b30aSJason Evans cv_broadcast(&sx->sx_shrd_cv); 2346281b30aSJason Evans 23519284646SJohn Baldwin LOCK_LOG_LOCK("SUNLOCK", &sx->sx_object, 0, 0, file, line); 23619284646SJohn Baldwin 237f2860039SMatthew Dillon mtx_unlock(sx->sx_lock); 2386281b30aSJason Evans } 2396281b30aSJason Evans 2406281b30aSJason Evans void 24119284646SJohn Baldwin _sx_xunlock(struct sx *sx, const char *file, int line) 2426281b30aSJason Evans { 2436281b30aSJason Evans 2444e5e677bSJohn Baldwin _sx_assert(sx, SX_XLOCKED, file, line); 245f2860039SMatthew Dillon mtx_lock(sx->sx_lock); 246af761449SBosko Milekic MPASS(sx->sx_cnt == -1); 2476281b30aSJason Evans 2482d96f0b1SJohn Baldwin WITNESS_UNLOCK(&sx->sx_object, LOP_EXCLUSIVE, file, line); 24919284646SJohn Baldwin 2506281b30aSJason Evans /* Release. */ 2516281b30aSJason Evans sx->sx_cnt++; 252af761449SBosko Milekic sx->sx_xholder = NULL; 2536281b30aSJason Evans 2546281b30aSJason Evans /* 2556281b30aSJason Evans * Wake up waiters if there are any. Give precedence to slock waiters. 2566281b30aSJason Evans */ 2576281b30aSJason Evans if (sx->sx_shrd_wcnt > 0) 2586281b30aSJason Evans cv_broadcast(&sx->sx_shrd_cv); 2596281b30aSJason Evans else if (sx->sx_excl_wcnt > 0) 2606281b30aSJason Evans cv_signal(&sx->sx_excl_cv); 2616281b30aSJason Evans 26219284646SJohn Baldwin LOCK_LOG_LOCK("XUNLOCK", &sx->sx_object, 0, 0, file, line); 26319284646SJohn Baldwin 264f2860039SMatthew Dillon mtx_unlock(sx->sx_lock); 2656281b30aSJason Evans } 266d55229b7SJason Evans 267d55229b7SJason Evans int 268d55229b7SJason Evans _sx_try_upgrade(struct sx *sx, const char *file, int line) 269d55229b7SJason Evans { 270d55229b7SJason Evans 2714e5e677bSJohn Baldwin _sx_assert(sx, SX_SLOCKED, file, line); 272f2860039SMatthew Dillon mtx_lock(sx->sx_lock); 273d55229b7SJason Evans 274d55229b7SJason Evans if (sx->sx_cnt == 1) { 275d55229b7SJason Evans sx->sx_cnt = -1; 276b40ce416SJulian Elischer sx->sx_xholder = curthread; 277d55229b7SJason Evans 278d55229b7SJason Evans LOCK_LOG_TRY("XUPGRADE", &sx->sx_object, 0, 1, file, line); 279b0b7cb50SJohn Baldwin WITNESS_UPGRADE(&sx->sx_object, LOP_EXCLUSIVE | LOP_TRYLOCK, 280b0b7cb50SJohn Baldwin file, line); 281d55229b7SJason Evans 282f2860039SMatthew Dillon mtx_unlock(sx->sx_lock); 283d55229b7SJason Evans return (1); 284d55229b7SJason Evans } else { 285d55229b7SJason Evans LOCK_LOG_TRY("XUPGRADE", &sx->sx_object, 0, 0, file, line); 286f2860039SMatthew Dillon mtx_unlock(sx->sx_lock); 287d55229b7SJason Evans return (0); 288d55229b7SJason Evans } 289d55229b7SJason Evans } 290d55229b7SJason Evans 291d55229b7SJason Evans void 292d55229b7SJason Evans _sx_downgrade(struct sx *sx, const char *file, int line) 293d55229b7SJason Evans { 294d55229b7SJason Evans 2954e5e677bSJohn Baldwin _sx_assert(sx, SX_XLOCKED, file, line); 296f2860039SMatthew Dillon mtx_lock(sx->sx_lock); 297d55229b7SJason Evans MPASS(sx->sx_cnt == -1); 298d55229b7SJason Evans 299b0b7cb50SJohn Baldwin WITNESS_DOWNGRADE(&sx->sx_object, 0, file, line); 300d55229b7SJason Evans 301d55229b7SJason Evans sx->sx_cnt = 1; 302e2870579SJohn Baldwin sx->sx_xholder = NULL; 303d55229b7SJason Evans if (sx->sx_shrd_wcnt > 0) 304d55229b7SJason Evans cv_broadcast(&sx->sx_shrd_cv); 305d55229b7SJason Evans 306d55229b7SJason Evans LOCK_LOG_LOCK("XDOWNGRADE", &sx->sx_object, 0, 0, file, line); 307d55229b7SJason Evans 308f2860039SMatthew Dillon mtx_unlock(sx->sx_lock); 309d55229b7SJason Evans } 3104e5e677bSJohn Baldwin 3114e5e677bSJohn Baldwin #ifdef INVARIANT_SUPPORT 312781a35dfSJohn Baldwin #ifndef INVARIANTS 313781a35dfSJohn Baldwin #undef _sx_assert 314781a35dfSJohn Baldwin #endif 315781a35dfSJohn Baldwin 3164e5e677bSJohn Baldwin /* 3174e5e677bSJohn Baldwin * In the non-WITNESS case, sx_assert() can only detect that at least 3184e5e677bSJohn Baldwin * *some* thread owns an slock, but it cannot guarantee that *this* 3194e5e677bSJohn Baldwin * thread owns an slock. 3204e5e677bSJohn Baldwin */ 3214e5e677bSJohn Baldwin void 3224e5e677bSJohn Baldwin _sx_assert(struct sx *sx, int what, const char *file, int line) 3234e5e677bSJohn Baldwin { 3244e5e677bSJohn Baldwin 3254e5e677bSJohn Baldwin switch (what) { 3264e5e677bSJohn Baldwin case SX_LOCKED: 3274e5e677bSJohn Baldwin case SX_SLOCKED: 3284e5e677bSJohn Baldwin #ifdef WITNESS 3294e5e677bSJohn Baldwin witness_assert(&sx->sx_object, what, file, line); 3304e5e677bSJohn Baldwin #else 331f2860039SMatthew Dillon mtx_lock(sx->sx_lock); 3324e5e677bSJohn Baldwin if (sx->sx_cnt <= 0 && 33398bf25aaSSeigo Tanimura (what == SX_SLOCKED || sx->sx_xholder != curthread)) 33498bf25aaSSeigo Tanimura printf("Lock %s not %slocked @ %s:%d\n", 3354e5e677bSJohn Baldwin sx->sx_object.lo_name, (what == SX_SLOCKED) ? 3364e5e677bSJohn Baldwin "share " : "", file, line); 337f2860039SMatthew Dillon mtx_unlock(sx->sx_lock); 3384e5e677bSJohn Baldwin #endif 3394e5e677bSJohn Baldwin break; 3404e5e677bSJohn Baldwin case SX_XLOCKED: 341f2860039SMatthew Dillon mtx_lock(sx->sx_lock); 3424e5e677bSJohn Baldwin if (sx->sx_xholder != curthread) 34398bf25aaSSeigo Tanimura printf("Lock %s not exclusively locked @ %s:%d\n", 3444e5e677bSJohn Baldwin sx->sx_object.lo_name, file, line); 345f2860039SMatthew Dillon mtx_unlock(sx->sx_lock); 3464e5e677bSJohn Baldwin break; 34719b0efd3SPawel Jakub Dawidek case SX_UNLOCKED: 34819b0efd3SPawel Jakub Dawidek #ifdef WITNESS 34919b0efd3SPawel Jakub Dawidek witness_assert(&sx->sx_object, what, file, line); 35019b0efd3SPawel Jakub Dawidek #else 351f6739b1dSPawel Jakub Dawidek /* 352f6739b1dSPawel Jakub Dawidek * We are able to check only exclusive lock here, 353f6739b1dSPawel Jakub Dawidek * we cannot assert that *this* thread owns slock. 354f6739b1dSPawel Jakub Dawidek */ 35519b0efd3SPawel Jakub Dawidek mtx_lock(sx->sx_lock); 356f6739b1dSPawel Jakub Dawidek if (sx->sx_xholder == curthread) 35719b0efd3SPawel Jakub Dawidek printf("Lock %s locked @ %s:%d\n", 35819b0efd3SPawel Jakub Dawidek sx->sx_object.lo_name, file, line); 35919b0efd3SPawel Jakub Dawidek mtx_unlock(sx->sx_lock); 36019b0efd3SPawel Jakub Dawidek #endif 36119b0efd3SPawel Jakub Dawidek break; 3624e5e677bSJohn Baldwin default: 3634e5e677bSJohn Baldwin panic("Unknown sx lock assertion: %d @ %s:%d", what, file, 3644e5e677bSJohn Baldwin line); 3654e5e677bSJohn Baldwin } 3664e5e677bSJohn Baldwin } 3674e5e677bSJohn Baldwin #endif /* INVARIANT_SUPPORT */ 368