1 /****************************************************************************
2 * Copyright 2018-2022,2023 Thomas E. Dickey *
3 * Copyright 1998-2016,2017 Free Software Foundation, Inc. *
5 * Permission is hereby granted, free of charge, to any person obtaining a *
6 * copy of this software and associated documentation files (the *
7 * "Software"), to deal in the Software without restriction, including *
8 * without limitation the rights to use, copy, modify, merge, publish, *
9 * distribute, distribute with modifications, sublicense, and/or sell *
10 * copies of the Software, and to permit persons to whom the Software is *
11 * furnished to do so, subject to the following conditions: *
13 * The above copyright notice and this permission notice shall be included *
14 * in all copies or substantial portions of the Software. *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
19 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
21 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
22 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
24 * Except as contained in this notice, the name(s) of the above copyright *
25 * holders shall not be used in advertising or otherwise to promote the *
26 * sale, use or other dealings in this Software without prior written *
28 ****************************************************************************/
30 /****************************************************************************
31 * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
32 * and: Eric S. Raymond <esr@snark.thyrsus.com> *
33 * and: Thomas E. Dickey 1996-on *
34 ****************************************************************************/
37 * write_entry.c -- write a terminfo structure onto the file system
40 #include <curses.priv.h>
41 #include <hashed_db.h>
45 MODULE_ID("$Id: write_entry.c,v 1.127 2023/05/27 20:13:10 tom Exp $")
48 #define TRACE_OUT(p) DEBUG(2, p)
49 #define TRACE_NUM(n) if (VALID_NUMERIC(Numbers[n])) { \
50 TRACE_OUT(("put Numbers[%u]=%d", (unsigned) (n), Numbers[n])); }
52 #define TRACE_OUT(p) /*nothing */
53 #define TRACE_NUM(n) /* nothing */
57 * FIXME: special case to work around Cygwin bug in link(), which updates
58 * the target file's timestamp.
60 #if HAVE_LINK && !USE_SYMLINKS && !MIXEDCASE_FILENAMES && defined(__CYGWIN__)
61 #define LINK_TOUCHES 1
63 #define LINK_TOUCHES 0
66 static int total_written;
67 static int total_parts;
68 static int total_size;
70 static int make_db_root(const char *);
74 write_file(char *filename, TERMTYPE2 *tp)
76 char buffer[MAX_ENTRY_SIZE];
77 unsigned limit = sizeof(buffer);
80 if (_nc_write_object(tp, buffer, &offset, limit) == ERR) {
81 _nc_warning("entry is larger than %u bytes", limit);
83 FILE *fp = ((_nc_access(filename, W_OK) == 0)
84 ? safe_fopen(filename, BIN_W)
90 _nc_syserr_abort("cannot open %s/%s", _nc_tic_dir(0), filename);
93 actual = fwrite(buffer, sizeof(char), (size_t) offset, fp);
94 if (actual != offset) {
95 int myerr = ferror(fp) ? errno : 0;
97 _nc_syserr_abort("error writing %s/%s: %s",
102 _nc_syserr_abort("error writing %s/%s: %u bytes vs actual %lu",
106 (unsigned long) actual);
110 DEBUG(1, ("Created %s", filename));
116 * Check for access rights to destination directories
117 * Create any directories which don't exist.
119 * Note: there's no reason to return the result of make_db_root(), since
120 * this function is called only in instances where that has to succeed.
123 check_writeable(int code)
125 static const char dirnames[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
126 static bool verified[sizeof(dirnames)];
128 char dir[sizeof(LEAF_FMT)];
131 if (code == 0 || (s = (strchr) (dirnames, code)) == 0) {
132 _nc_err_abort("Illegal terminfo subdirectory \"" LEAF_FMT "\"", code);
133 } else if (!verified[s - dirnames]) {
134 _nc_SPRINTF(dir, _nc_SLIMIT(sizeof(dir)) LEAF_FMT, code);
135 if (make_db_root(dir) < 0) {
136 _nc_err_abort("%s/%s: permission denied", _nc_tic_dir(0), dir);
138 verified[s - dirnames] = TRUE;
142 #endif /* !USE_HASHED_DB */
145 make_db_path(char *dst, const char *src, size_t limit)
148 const char *top = _nc_tic_dir(0);
150 if (src == top || _nc_is_abs_path(src)) {
151 if (strlen(src) + 1 <= limit) {
152 _nc_STRCPY(dst, src, limit);
156 if ((strlen(top) + strlen(src) + 6) <= limit) {
157 _nc_SPRINTF(dst, _nc_SLIMIT(limit) "%s/%s", top, src);
163 static const char suffix[] = DBM_SUFFIX;
164 size_t have = strlen(dst);
165 size_t need = strlen(suffix);
166 if (have > need && strcmp(dst + (int) (have - need), suffix)) {
167 if (have + need <= limit) {
168 _nc_STRCAT(dst, suffix, limit);
172 } else if (_nc_is_dir_path(dst)) {
181 * Make a database-root if it doesn't exist.
184 make_db_root(const char *path)
187 char fullpath[PATH_MAX];
189 if ((rc = make_db_path(fullpath, path, sizeof(fullpath))) == 0) {
193 if ((capdbp = _nc_db_open(fullpath, TRUE)) == NULL) {
195 } else if (_nc_db_close(capdbp) < 0) {
201 if ((rc = stat(path, &statbuf)) == -1) {
207 } else if (_nc_access(path, R_OK | W_OK | X_OK) < 0) {
208 rc = -1; /* permission denied */
209 } else if (!(S_ISDIR(statbuf.st_mode))) {
210 rc = -1; /* not a directory */
218 * Set the write directory for compiled entries.
221 _nc_set_writedir(const char *dir)
223 const char *destination;
224 char actual[PATH_MAX];
226 if (dir == 0 && use_terminfo_vars())
227 dir = getenv("TERMINFO");
230 (void) _nc_tic_dir(dir);
232 destination = _nc_tic_dir(0);
233 if (make_db_root(destination) < 0) {
234 char *home = _nc_home_terminfo();
238 if (make_db_root(destination) < 0)
239 _nc_err_abort("%s: permission denied (errno %d)",
245 * Note: because of this code, this logic should be exercised
246 * *once only* per run.
249 make_db_path(actual, destination, sizeof(actual));
251 if (chdir(_nc_tic_dir(destination)) < 0
252 || getcwd(actual, sizeof(actual)) == 0)
253 _nc_err_abort("%s: not a directory", destination);
255 _nc_keep_tic_dir(actual);
259 * Save the compiled version of a description in the filesystem.
261 * make a copy of the name-list
262 * break it up into first-name and all-but-last-name
264 * write object information to first-name
266 * for each name in all-but-last-name
269 * Using 'time()' to obtain a reference for file timestamps is unreliable,
270 * e.g., with NFS, because the filesystem may have a different time
271 * reference. We check for pre-existence of links by latching the first
272 * timestamp from a file that we create.
274 * The _nc_warning() calls will report a correct line number only if
275 * _nc_curr_line is properly set before the write_entry() call.
279 _nc_write_entry(TERMTYPE2 *const tp)
283 char buffer[MAX_ENTRY_SIZE + 1];
284 unsigned limit = sizeof(buffer);
287 #else /* !USE_HASHED_DB */
290 char filename[PATH_MAX];
291 char linkname[PATH_MAX];
293 char symlinkname[PATH_MAX];
298 #endif /* USE_SYMLINKS */
300 unsigned limit2 = sizeof(filename) - (2 + LEAF_LEN);
303 static int call_count;
304 static time_t start_time; /* time at start of writes */
306 #endif /* USE_HASHED_DB */
308 char name_list[MAX_TERMINFO_LENGTH];
309 char *first_name, *other_names;
311 char *term_names = tp->term_names;
312 size_t name_size = strlen(term_names);
314 if (name_size == 0) {
315 _nc_syserr_abort("no terminal name found.");
316 } else if (name_size >= sizeof(name_list) - 1) {
317 _nc_syserr_abort("terminal name too long: %s", term_names);
320 _nc_STRCPY(name_list, term_names, sizeof(name_list));
321 DEBUG(7, ("Name list = '%s'", name_list));
323 first_name = name_list;
325 ptr = &name_list[name_size - 1];
326 other_names = ptr + 1;
328 while (ptr > name_list && *ptr != '|')
331 if (ptr != name_list) {
334 for (ptr = name_list; *ptr != '\0' && *ptr != '|'; ptr++) {
342 other_names = ptr + 1;
346 DEBUG(7, ("First name = '%s'", first_name));
347 DEBUG(7, ("Other names = '%s'", other_names));
349 _nc_set_type(first_name);
352 if (_nc_write_object(tp, buffer + 1, &offset, limit - 1) != ERR) {
353 DB *capdb = _nc_db_open(_nc_tic_dir(0), TRUE);
359 memset(&key, 0, sizeof(key));
360 key.data = term_names;
361 key.size = name_size;
363 memset(&data, 0, sizeof(data));
365 data.size = offset + 1;
367 _nc_db_put(capdb, &key, &data);
371 key.data = name_list;
372 key.size = strlen(name_list);
374 _nc_STRCPY(buffer + 1,
377 data.size = name_size + 1;
379 total_size += data.size;
381 _nc_db_put(capdb, &key, &data);
383 while (*other_names != '\0') {
385 assert(ptr < buffer + sizeof(buffer) - 1);
386 while (*other_names != '|' && *other_names != '\0')
389 if (*other_names != '\0')
390 *(other_names++) = '\0';
393 key.size = strlen(ptr);
395 total_size += data.size;
397 _nc_db_put(capdb, &key, &data);
401 #else /* !USE_HASHED_DB */
402 if (call_count++ == 0) {
406 if (strlen(first_name) >= limit2) {
407 _nc_warning("terminal name too long.");
408 saved = first_name[limit2];
409 first_name[limit2] = '\0';
412 _nc_SPRINTF(filename, _nc_SLIMIT(sizeof(filename))
413 LEAF_FMT "/%.*s", UChar(first_name[0]),
414 (int) (sizeof(filename) - (LEAF_LEN + 2)),
418 first_name[limit2] = saved;
421 * Has this primary name been written since the first call to
422 * write_entry()? If so, the newer write will step on the older,
425 if (start_time > 0 &&
426 stat(filename, &statbuf) >= 0
427 && statbuf.st_mtime >= start_time) {
428 #if HAVE_LINK && !USE_SYMLINKS
430 * If the file has more than one link, the reason for the previous
431 * write could be that the current primary name used to be an alias for
432 * the previous entry. In that case, unlink the file so that we will
433 * not modify the previous entry as we write this one.
435 if (statbuf.st_nlink > 1) {
436 _nc_warning("name redefined.");
439 _nc_warning("name multiply defined.");
442 _nc_warning("name multiply defined.");
446 check_writeable(first_name[0]);
447 write_file(filename, tp);
449 if (start_time == 0) {
450 if (stat(filename, &statbuf) == -1
451 || (start_time = statbuf.st_mtime) == 0) {
452 _nc_syserr_abort("error obtaining time from %s/%s",
453 _nc_tic_dir(0), filename);
456 while (*other_names != '\0') {
458 while (*other_names != '|' && *other_names != '\0')
461 if (*other_names != '\0')
462 *(other_names++) = '\0';
464 if (strlen(ptr) > sizeof(linkname) - (2 + LEAF_LEN)) {
465 _nc_warning("terminal alias %s too long.", ptr);
468 if (strchr(ptr, '/') != 0) {
469 _nc_warning("cannot link alias %s.", ptr);
473 check_writeable(ptr[0]);
474 _nc_SPRINTF(linkname, _nc_SLIMIT(sizeof(linkname))
475 LEAF_FMT "/%.*s", ptr[0],
476 (int) sizeof(linkname) - (2 + LEAF_LEN), ptr);
478 if (strcmp(filename, linkname) == 0) {
479 _nc_warning("self-synonym ignored");
482 else if (stat(linkname, &statbuf) >= 0 &&
483 statbuf.st_mtime < start_time) {
484 _nc_warning("alias %s multiply defined.", ptr);
487 else if (_nc_access(linkname, W_OK) == 0)
492 #define MY_SIZE sizeof(symlinkname) - 1
493 if (first_name[0] == linkname[0]) {
494 _nc_STRNCPY(symlinkname, first_name, MY_SIZE);
496 _nc_STRCPY(symlinkname, "../", sizeof(symlinkname));
497 _nc_STRNCPY(symlinkname + 3, filename, MY_SIZE - 3);
499 symlinkname[MY_SIZE] = '\0';
500 #endif /* USE_SYMLINKS */
502 code = remove(linkname);
504 code = unlink(linkname);
506 if (code != 0 && errno == ENOENT)
509 if (symlink(symlinkname, linkname) < 0)
511 if (link(filename, linkname) < 0)
512 #endif /* USE_SYMLINKS */
515 * If there wasn't anything there, and we cannot
516 * link to the target because it is the same as the
517 * target, then the source must be on a filesystem
518 * that uses caseless filenames, such as Win32, etc.
520 if (code == 0 && errno == EEXIST)
521 _nc_warning("can't link %s to %s", filename, linkname);
522 else if (code == 0 && (errno == EPERM || errno == ENOENT))
523 write_file(linkname, tp);
525 #if MIXEDCASE_FILENAMES
526 _nc_syserr_abort("cannot link %s to %s", filename, linkname);
528 _nc_warning("cannot link %s to %s (errno=%d)", filename,
533 DEBUG(1, ("Linked %s", linkname));
536 #else /* just make copies */
537 write_file(linkname, tp);
538 #endif /* HAVE_LINK */
540 #endif /* USE_HASHED_DB */
544 fake_write(char *dst,
551 size_t have = (limit - *offset);
557 memcpy(dst + *offset, src, want);
558 *offset += (unsigned) want;
562 return (want / size);
565 #define Write(buf, size, count) fake_write(buffer, offset, (size_t) limit, (char *) buf, (size_t) count, (size_t) size)
567 #undef LITTLE_ENDIAN /* BSD/OS defines this as a feature macro */
568 #define HI(x) ((x) / 256)
569 #define LO(x) ((x) % 256)
570 #define LITTLE_ENDIAN(p, x) (p)[0] = (unsigned char)LO(x), \
571 (p)[1] = (unsigned char)HI(x)
573 #define WRITE_STRING(str) (Write(str, sizeof(char), strlen(str) + 1) == strlen(str) + 1)
576 compute_offsets(char **Strings, size_t strmax, short *offsets)
581 for (i = 0; i < strmax; i++) {
582 if (Strings[i] == ABSENT_STRING) {
584 } else if (Strings[i] == CANCELLED_STRING) {
587 offsets[i] = (short) nextfree;
588 nextfree += (int) strlen(Strings[i]) + 1;
589 TRACE_OUT(("put Strings[%d]=%s(%d)", (int) i,
590 _nc_visbuf(Strings[i]), (int) nextfree));
597 convert_shorts(unsigned char *buf, short *Numbers, size_t count)
600 for (i = 0; i < count; i++) {
601 if (Numbers[i] == ABSENT_NUMERIC) { /* HI/LO won't work */
602 buf[2 * i] = buf[2 * i + 1] = 0377;
603 } else if (Numbers[i] == CANCELLED_NUMERIC) { /* HI/LO won't work */
605 buf[2 * i + 1] = 0377;
607 LITTLE_ENDIAN(buf + 2 * i, Numbers[i]);
608 TRACE_OUT(("put Numbers[%u]=%d", (unsigned) i, Numbers[i]));
614 #if NCURSES_EXT_NUMBERS
616 convert_16bit(unsigned char *buf, NCURSES_INT2 *Numbers, size_t count)
619 size_t size = SIZEOF_SHORT;
620 for (i = 0; i < count; i++) {
621 unsigned value = (unsigned) Numbers[i];
623 for (j = 0; j < size; ++j) {
624 *buf++ = value & 0xff;
632 convert_32bit(unsigned char *buf, NCURSES_INT2 *Numbers, size_t count)
635 size_t size = SIZEOF_INT2;
636 for (i = 0; i < count; i++) {
637 unsigned value = (unsigned) Numbers[i];
639 for (j = 0; j < size; ++j) {
640 *buf++ = value & 0xff;
648 #define even_boundary(value) \
649 ((value) % 2 != 0 && Write(&zero, sizeof(char), 1) != 1)
653 extended_Booleans(TERMTYPE2 *tp)
658 for (i = 0; i < tp->ext_Booleans; ++i) {
659 if (tp->Booleans[BOOLCOUNT + i] == TRUE)
666 extended_Numbers(TERMTYPE2 *tp)
671 for (i = 0; i < tp->ext_Numbers; ++i) {
672 if (tp->Numbers[NUMCOUNT + i] != ABSENT_NUMERIC)
679 extended_Strings(TERMTYPE2 *tp)
681 unsigned short result = 0;
684 for (i = 0; i < tp->ext_Strings; ++i) {
685 if (tp->Strings[STRCOUNT + i] != ABSENT_STRING)
686 result = (unsigned short) (i + 1);
692 * _nc_align_termtype() will extend entries that are referenced in a use=
693 * clause - discard the unneeded data.
696 extended_object(TERMTYPE2 *tp)
700 if (_nc_user_definable) {
701 result = ((extended_Booleans(tp)
702 + extended_Numbers(tp)
703 + extended_Strings(tp)) != 0);
710 _nc_write_object(TERMTYPE2 *tp, char *buffer, unsigned *offset, unsigned limit)
713 size_t namelen, boolmax, nummax, strmax, numlen;
717 short offsets[MAX_ENTRY_SIZE / 2];
718 unsigned char buf[MAX_ENTRY_SIZE];
719 unsigned last_bool = BOOLWRITE;
720 unsigned last_num = NUMWRITE;
721 unsigned last_str = STRWRITE;
722 #if NCURSES_EXT_NUMBERS
723 bool need_ints = FALSE;
724 size_t (*convert_numbers) (unsigned char *, NCURSES_INT2 *, size_t);
726 #define convert_numbers convert_shorts
731 * Normally we limit the list of values to exclude the "obsolete"
732 * capabilities. However, if we are accepting extended names, add
733 * these as well, since they are used for supporting translation
736 if (_nc_user_definable) {
737 last_bool = BOOLCOUNT;
743 namelist = tp->term_names;
744 namelen = strlen(namelist) + 1;
747 for (i = 0; i < last_bool; i++) {
748 if (tp->Booleans[i] == TRUE) {
754 for (i = 0; i < last_num; i++) {
755 if (tp->Numbers[i] != ABSENT_NUMERIC) {
757 #if NCURSES_EXT_NUMBERS
758 if (tp->Numbers[i] > MAX_OF_TYPE(NCURSES_COLOR_T)) {
766 for (i = 0; i < last_str; i++) {
767 if (tp->Strings[i] != ABSENT_STRING)
771 nextfree = compute_offsets(tp->Strings, strmax, offsets);
773 /* fill in the header */
774 #if NCURSES_EXT_NUMBERS
776 convert_numbers = convert_32bit;
777 LITTLE_ENDIAN(buf, MAGIC2);
779 convert_numbers = convert_16bit;
780 LITTLE_ENDIAN(buf, MAGIC);
783 LITTLE_ENDIAN(buf, MAGIC);
785 LITTLE_ENDIAN(buf + 2, min(namelen, MAX_NAME_SIZE + 1));
786 LITTLE_ENDIAN(buf + 4, boolmax);
787 LITTLE_ENDIAN(buf + 6, nummax);
788 LITTLE_ENDIAN(buf + 8, strmax);
789 LITTLE_ENDIAN(buf + 10, nextfree);
791 /* write out the header */
792 TRACE_OUT(("Header of %s @%d", namelist, *offset));
793 if (Write(buf, 12, 1) != 1
794 || Write(namelist, sizeof(char), namelen) != namelen) {
798 for (i = 0; i < boolmax; i++) {
799 if (tp->Booleans[i] == TRUE) {
805 if (Write(buf, sizeof(char), boolmax) != boolmax) {
809 if (even_boundary(namelen + boolmax)) {
813 TRACE_OUT(("Numerics begin at %04x", *offset));
816 numlen = convert_numbers(buf, tp->Numbers, nummax);
817 if (Write(buf, numlen, nummax) != nummax) {
821 TRACE_OUT(("String offsets begin at %04x", *offset));
823 /* the string offsets */
824 convert_shorts(buf, offsets, strmax);
825 if (Write(buf, SIZEOF_SHORT, strmax) != strmax) {
829 TRACE_OUT(("String table begins at %04x", *offset));
832 for (i = 0; i < strmax; i++) {
833 if (VALID_STRING(tp->Strings[i])) {
834 if (!WRITE_STRING(tp->Strings[i])) {
841 if (extended_object(tp)) {
842 unsigned ext_total = (unsigned) NUM_EXT_NAMES(tp);
843 unsigned ext_usage = ext_total;
845 if (even_boundary(nextfree)) {
849 nextfree = compute_offsets(tp->Strings + STRCOUNT,
850 (size_t) tp->ext_Strings,
852 TRACE_OUT(("after extended string capabilities, nextfree=%d", nextfree));
854 if (tp->ext_Strings >= SIZEOF(offsets)) {
858 nextfree += compute_offsets(tp->ext_Names,
860 offsets + tp->ext_Strings);
861 TRACE_OUT(("after extended capnames, nextfree=%d", nextfree));
862 strmax = tp->ext_Strings + ext_total;
863 for (i = 0; i < tp->ext_Strings; ++i) {
864 if (VALID_STRING(tp->Strings[i + STRCOUNT])) {
868 TRACE_OUT(("will write %u/%lu strings", ext_usage, (unsigned long) strmax));
871 * Write the extended header
873 LITTLE_ENDIAN(buf + 0, tp->ext_Booleans);
874 LITTLE_ENDIAN(buf + 2, tp->ext_Numbers);
875 LITTLE_ENDIAN(buf + 4, tp->ext_Strings);
876 LITTLE_ENDIAN(buf + 6, ext_usage);
877 LITTLE_ENDIAN(buf + 8, nextfree);
878 TRACE_OUT(("WRITE extended-header @%d", *offset));
879 if (Write(buf, 10, 1) != 1) {
883 TRACE_OUT(("WRITE %d booleans @%d", tp->ext_Booleans, *offset));
885 && Write(tp->Booleans + BOOLCOUNT, sizeof(char),
886 tp->ext_Booleans) != tp->ext_Booleans) {
890 if (even_boundary(tp->ext_Booleans)) {
894 TRACE_OUT(("WRITE %d numbers @%d", tp->ext_Numbers, *offset));
895 if (tp->ext_Numbers) {
896 numlen = convert_numbers(buf, tp->Numbers + NUMCOUNT, (size_t) tp->ext_Numbers);
897 if (Write(buf, numlen, tp->ext_Numbers) != tp->ext_Numbers) {
903 * Convert the offsets for the ext_Strings and ext_Names tables,
906 convert_shorts(buf, offsets, strmax);
907 TRACE_OUT(("WRITE offsets @%d", *offset));
908 if (Write(buf, SIZEOF_SHORT, strmax) != strmax) {
913 * Write the string table after the offset tables so we do not
914 * have to do anything about alignment.
916 for (i = 0; i < tp->ext_Strings; i++) {
917 if (VALID_STRING(tp->Strings[i + STRCOUNT])) {
918 TRACE_OUT(("WRITE ext_Strings[%d]=%s", (int) i,
919 _nc_visbuf(tp->Strings[i + STRCOUNT])));
920 if (!WRITE_STRING(tp->Strings[i + STRCOUNT])) {
927 * Write the extended names
929 for (i = 0; i < ext_total; i++) {
930 TRACE_OUT(("WRITE ext_Names[%d]=%s", (int) i, tp->ext_Names[i]));
931 if (!WRITE_STRING(tp->ext_Names[i])) {
937 #endif /* NCURSES_XNAMES */
941 total_size = total_size + (int) (*offset + 1);
946 * Returns the total number of entries written by this process
949 _nc_tic_written(void)
951 TR(TRACE_DATABASE, ("_nc_tic_written %d entries, %d parts, %d size",
952 total_written, total_parts, total_size));
953 return total_written;