Lines Matching refs:info
135 #define DBA_FETCH_RESOURCE(info, id) \ argument
136 …if ((info = (dba_info *)zend_fetch_resource2(Z_RES_P(id), "DBA identifier", le_db, le_pdb)) == NUL…
141 #define DBA_WRITE_CHECK(info) \ argument
142 if ((info)->mode != DBA_WRITER && (info)->mode != DBA_TRUNC && (info)->mode != DBA_CREAT) { \
260 static void dba_close(dba_info *info) in dba_close() argument
262 if (info->hnd) { in dba_close()
263 info->hnd->close(info); in dba_close()
265 if (info->path) { in dba_close()
266 pefree(info->path, info->flags&DBA_PERSISTENT); in dba_close()
268 if (info->fp && info->fp != info->lock.fp) { in dba_close()
269 if (info->flags & DBA_PERSISTENT) { in dba_close()
270 php_stream_pclose(info->fp); in dba_close()
272 php_stream_close(info->fp); in dba_close()
275 if (info->lock.fp) { in dba_close()
276 if (info->flags & DBA_PERSISTENT) { in dba_close()
277 php_stream_pclose(info->lock.fp); in dba_close()
279 php_stream_close(info->lock.fp); in dba_close()
282 pefree(info, info->flags&DBA_PERSISTENT); in dba_close()
289 dba_info *info = (dba_info *)rsrc->ptr; in dba_close_rsrc() local
291 dba_close(info); in dba_close_rsrc()
313 dba_info *info = (dba_info *)rsrc->ptr; in dba_close_pe_rsrc() local
316 zend_hash_apply_with_argument(&EG(persistent_list), dba_close_pe_rsrc_deleter, info); in dba_close_pe_rsrc()
406 dba_info *info = NULL; in php_dba_update() local
417 DBA_FETCH_RESOURCE(info, id); in php_dba_update()
418 DBA_WRITE_CHECK(info); in php_dba_update()
428 RETVAL_BOOL(info->hnd->update(info, key_str, value, mode) == SUCCESS); in php_dba_update()
437 dba_info *info; in php_dba_find() local
446 info = (dba_info *)(le->ptr); in php_dba_find()
447 if (!strcmp(info->path, path)) { in php_dba_find()
463 dba_info *info, *other; in php_dba_open() local
538 info = (dba_info *)le->ptr; in php_dba_open()
541 RETURN_RES(zend_register_resource(info, le_pdb)); in php_dba_open()
725 info = pemalloc(sizeof(dba_info), persistent); in php_dba_open()
726 memset(info, 0, sizeof(dba_info)); in php_dba_open()
727 info->path = pestrdup(ZSTR_VAL(path), persistent); in php_dba_open()
728 info->mode = modenr; in php_dba_open()
729 info->file_permission = permission; in php_dba_open()
730 info->map_size = map_size; in php_dba_open()
731 info->driver_flags = driver_flags; in php_dba_open()
732 …info->flags = (hptr->flags & ~DBA_LOCK_ALL) | (lock_flag & DBA_LOCK_ALL) | (persistent ? DBA_PERSI… in php_dba_open()
733 info->lock.mode = lock_mode; in php_dba_open()
740 if ((other = php_dba_find(info->path)) != NULL) { in php_dba_open()
756 spprintf(&lock_name, 0, "%s.lck", info->path); in php_dba_open()
761 …info->lock.fp = php_stream_open_wrapper(lock_name, lock_file_mode, STREAM_MUST_SEEK|IGNORE_PATH|pe… in php_dba_open()
766 if (!info->lock.fp) { in php_dba_open()
771 if (!info->lock.fp) { in php_dba_open()
772 …info->lock.fp = php_stream_open_wrapper(lock_name, lock_file_mode, STREAM_MUST_SEEK|REPORT_ERRORS|… in php_dba_open()
773 if (info->lock.fp) { in php_dba_open()
777 pefree(info->path, persistent); in php_dba_open()
778 info->path = pestrndup(ZSTR_VAL(opened_path), ZSTR_LEN(opened_path), persistent); in php_dba_open()
792 if (!info->lock.fp) { in php_dba_open()
793 dba_close(info); in php_dba_open()
798 if (!error && !php_stream_supports_lock(info->lock.fp)) { in php_dba_open()
801 if (!error && php_stream_lock(info->lock.fp, lock_mode)) { in php_dba_open()
808 if (info->lock.fp && is_db_lock) { in php_dba_open()
809 info->fp = info->lock.fp; /* use the same stream for locking and database access */ in php_dba_open()
811 …info->fp = php_stream_open_wrapper(info->path, file_mode, STREAM_MUST_SEEK|REPORT_ERRORS|IGNORE_PA… in php_dba_open()
813 if (!info->fp) { in php_dba_open()
814 dba_close(info); in php_dba_open()
823 if (SUCCESS != php_stream_cast(info->fp, PHP_STREAM_AS_FD, (void*)&info->fd, 1)) { in php_dba_open()
825 dba_close(info); in php_dba_open()
830 int flags = fcntl(info->fd, F_GETFL); in php_dba_open()
831 fcntl(info->fd, F_SETFL, flags & ~O_APPEND); in php_dba_open()
834 if (info->lock.fp != NULL) { in php_dba_open()
835 …php_stream_free(info->lock.fp, persistent ? PHP_STREAM_FREE_CLOSE_PERSISTENT : PHP_STREAM_FREE_CLO… in php_dba_open()
837 if (info->fp != info->lock.fp) { in php_dba_open()
838 … php_stream_free(info->fp, persistent ? PHP_STREAM_FREE_CLOSE_PERSISTENT : PHP_STREAM_FREE_CLOSE); in php_dba_open()
840 info->fp = NULL; in php_dba_open()
841 info->lock.fp = NULL; in php_dba_open()
842 info->fd = -1; in php_dba_open()
853 if (error || hptr->open(info, &error) == FAILURE) { in php_dba_open()
854 dba_close(info); in php_dba_open()
866 info->hnd = hptr; in php_dba_open()
870 if (zend_register_persistent_resource_ex(persistent_resource_key, info, le_pdb) == NULL) { in php_dba_open()
871 dba_close(info); in php_dba_open()
879 RETURN_RES(zend_register_resource(info, (persistent ? le_pdb : le_db))); in php_dba_open()
901 dba_info *info = NULL; in PHP_FUNCTION() local
907 DBA_FETCH_RESOURCE(info, id); in PHP_FUNCTION()
917 dba_info *info = NULL; in PHP_FUNCTION() local
926 DBA_FETCH_RESOURCE(info, id); in PHP_FUNCTION()
936 RETVAL_BOOL(info->hnd->exists(info, key_str) == SUCCESS); in PHP_FUNCTION()
945 dba_info *info = NULL; in PHP_FUNCTION() local
967 DBA_FETCH_RESOURCE(info, id); in PHP_FUNCTION()
978 if (!strcmp(info->hnd->name, "cdb")) { in PHP_FUNCTION()
981 …Handler %s accepts only skip values greater than or equal to zero, using skip=0", info->hnd->name); in PHP_FUNCTION()
984 } else if (!strcmp(info->hnd->name, "inifile")) { in PHP_FUNCTION()
993 …ULL, E_NOTICE, "Handler %s accepts only skip value -1 and greater, using skip=0", info->hnd->name); in PHP_FUNCTION()
997 …"Handler %s does not support optional skip parameter, the value will be ignored", info->hnd->name); in PHP_FUNCTION()
1003 if ((val = info->hnd->fetch(info, key_str, skip)) == NULL) { in PHP_FUNCTION()
1045 dba_info *info = NULL; in PHP_FUNCTION() local
1051 DBA_FETCH_RESOURCE(info, id); in PHP_FUNCTION()
1053 zend_string *fkey = info->hnd->firstkey(info); in PHP_FUNCTION()
1067 dba_info *info = NULL; in PHP_FUNCTION() local
1073 DBA_FETCH_RESOURCE(info, id); in PHP_FUNCTION()
1075 zend_string *nkey = info->hnd->nextkey(info); in PHP_FUNCTION()
1090 dba_info *info = NULL; in PHP_FUNCTION() local
1099 DBA_FETCH_RESOURCE(info, id); in PHP_FUNCTION()
1100 DBA_WRITE_CHECK(info); in PHP_FUNCTION()
1110 RETVAL_BOOL(info->hnd->delete(info, key_str) == SUCCESS); in PHP_FUNCTION()
1135 dba_info *info = NULL; in PHP_FUNCTION() local
1141 DBA_FETCH_RESOURCE(info, id); in PHP_FUNCTION()
1142 DBA_WRITE_CHECK(info); in PHP_FUNCTION()
1144 if (info->hnd->optimize(info) == SUCCESS) { in PHP_FUNCTION()
1156 dba_info *info = NULL; in PHP_FUNCTION() local
1162 DBA_FETCH_RESOURCE(info, id); in PHP_FUNCTION()
1164 if (info->hnd->sync(info) == SUCCESS) { in PHP_FUNCTION()
1187 char *str = hptr->info(hptr, NULL); in PHP_FUNCTION()
1202 dba_info *info; in PHP_FUNCTION() local
1216 info = (dba_info *)(le->ptr); in PHP_FUNCTION()
1217 add_index_string(return_value, i, info->path); in PHP_FUNCTION()