Changeset 988 for vendor/current/lib/tdb/include
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/lib/tdb/include/tdb.h
r986 r988 32 32 33 33 #include <signal.h> 34 #include <stdbool.h> 34 35 35 36 /** … … 81 82 #define TDB_DISALLOW_NESTING 1024 /** Disallow transactions to nest */ 82 83 #define TDB_INCOMPATIBLE_HASH 2048 /** Better hashing: can't be opened by tdb < 1.2.6. */ 84 #define TDB_MUTEX_LOCKING 4096 /** optimized locking using robust mutexes if supported, 85 only with tdb >= 1.3.0 and TDB_CLEAR_IF_FIRST 86 after checking tdb_runtime_check_for_robust_mutexes() */ 83 87 84 88 /** The tdb error codes */ … … 133 137 * TDB_CLEAR_IF_FIRST - Clear database if we are the 134 138 * only one with it open\n 135 * TDB_INTERNAL - Don't use a file, inst aed store the139 * TDB_INTERNAL - Don't use a file, instead store the 136 140 * data in memory. The filename is 137 141 * ignored in this case.\n … … 144 148 * TDB_ALLOW_NESTING - Allow transactions to nest.\n 145 149 * TDB_DISALLOW_NESTING - Disallow transactions to nest.\n 150 * TDB_INCOMPATIBLE_HASH - Better hashing: can't be opened by tdb < 1.2.6.\n 151 * TDB_MUTEX_LOCKING - Optimized locking using robust mutexes if supported, 152 * can't be opened by tdb < 1.3.0. 153 * Only valid in combination with TDB_CLEAR_IF_FIRST 154 * after checking tdb_runtime_check_for_robust_mutexes()\n 146 155 * 147 156 * @param[in] open_flags Flags for the open(2) function. … … 169 178 * TDB_CLEAR_IF_FIRST - Clear database if we are the 170 179 * only one with it open\n 171 * TDB_INTERNAL - Don't use a file, inst aed store the180 * TDB_INTERNAL - Don't use a file, instead store the 172 181 * data in memory. The filename is 173 182 * ignored in this case.\n … … 180 189 * TDB_ALLOW_NESTING - Allow transactions to nest.\n 181 190 * TDB_DISALLOW_NESTING - Disallow transactions to nest.\n 191 * TDB_INCOMPATIBLE_HASH - Better hashing: can't be opened by tdb < 1.2.6.\n 192 * TDB_MUTEX_LOCKING - Optimized locking using robust mutexes if supported, 193 * can't be opened by tdb < 1.3.0. 194 * Only valid in combination with TDB_CLEAR_IF_FIRST 195 * after checking tdb_runtime_check_for_robust_mutexes()\n 182 196 * 183 197 * @param[in] open_flags Flags for the open(2) function. … … 213 227 * pointer from our parent and to re-establish locks. 214 228 * 215 * @param[in] tdb The database to reopen. 229 * @param[in] tdb The database to reopen. It will be free'd on error! 216 230 * 217 231 * @return 0 on success, -1 on error. 232 * 233 * @note Don't call tdb_error() after this function cause the tdb context will 234 * be freed on error. 218 235 */ 219 236 int tdb_reopen(struct tdb_context *tdb); … … 362 379 * @brief Close a database. 363 380 * 364 * @param[in] tdb The database to close. 381 * @param[in] tdb The database to close. The context will be free'd. 365 382 * 366 383 * @return 0 for success, -1 on error. 384 * 385 * @note Don't call tdb_error() after this function cause the tdb context will 386 * be freed on error. 367 387 */ 368 388 int tdb_close(struct tdb_context *tdb); … … 397 417 * @brief Traverse the entire database. 398 418 * 399 * While traver ing the function fn(tdb, key, data, state) is called on each419 * While traversing the function fn(tdb, key, data, state) is called on each 400 420 * element. If fn is NULL then it is not called. A non-zero return value from 401 421 * fn() indicates that the traversal should stop. Traversal callbacks may not … … 772 792 * 773 793 * This only works if the tdb has been opened using the TDB_SEQNUM flag or 774 * enabled us eing tdb_enable_seqnum().794 * enabled using tdb_enable_seqnum(). 775 795 * 776 796 * @param[in] tdb The database to increment the sequence number. … … 814 834 int (*check) (TDB_DATA key, TDB_DATA data, void *private_data), 815 835 void *private_data); 836 837 /** 838 * @brief Dump all possible records in a corrupt database. 839 * 840 * This is the only way to get data out of a database where tdb_check() fails. 841 * It will call walk() with anything which looks like a database record; this 842 * may well include invalid, incomplete or duplicate records. 843 * 844 * @param[in] tdb The database to check. 845 * 846 * @param[in] walk The walk function to use. 847 * 848 * @param[in] private_data the private data to pass to the walk function. 849 * 850 * @return 0 on success, -1 on error with error code set. 851 * 852 * @see tdb_error() 853 * @see tdb_errorstr() 854 */ 855 int tdb_rescue(struct tdb_context *tdb, 856 void (*walk) (TDB_DATA key, TDB_DATA data, void *private_data), 857 void *private_data); 858 859 /** 860 * @brief Check if support for TDB_MUTEX_LOCKING is available at runtime. 861 * 862 * On some systems the API for pthread_mutexattr_setrobust() is not available. 863 * On other systems there are some bugs in the interaction between glibc and 864 * the linux kernel. 865 * 866 * This function provides a runtime check if robust mutexes are really 867 * available. 868 * 869 * This needs to be called and return true before TDB_MUTEX_LOCKING 870 * can be used at runtime. 871 * 872 * @note This calls fork(), but the SIGCHILD handling should be transparent. 873 * 874 * @return true if supported, false otherwise. 875 * 876 * @see TDB_MUTEX_LOCKING 877 */ 878 bool tdb_runtime_check_for_robust_mutexes(void); 816 879 817 880 /* @} ******************************************************************/ … … 822 885 int tdb_chainunlock(struct tdb_context *tdb, TDB_DATA key); 823 886 int tdb_chainlock_read(struct tdb_context *tdb, TDB_DATA key); 887 int tdb_chainlock_read_nonblock(struct tdb_context *tdb, TDB_DATA key); 824 888 int tdb_chainunlock_read(struct tdb_context *tdb, TDB_DATA key); 825 889 int tdb_chainlock_mark(struct tdb_context *tdb, TDB_DATA key);
Note:
See TracChangeset
for help on using the changeset viewer.