@@ -20,10 +20,11 @@ static pthread_key_t interpKey; struct appfs_thread_data { sqlite3 *db; const char *cachedir; + time_t boottime; }; struct appfs_thread_data globalThread; typedef enum { @@ -676,10 +677,11 @@ sites = appfs_getsites(&sites_count); pathinfo->type = APPFS_PATHTYPE_DIRECTORY; pathinfo->typeinfo.dir.childcount = sites_count; pathinfo->hostname[0] = '\0'; + pathinfo->time = globalThread.boottime; if (children) { for (site = sites; site; site = site->_next) { node = (void *) ckalloc(sizeof(*node)); node->_next = *children; @@ -718,10 +720,11 @@ if (packagename == NULL) { /* Request for a single hostname */ pathinfo->type = APPFS_PATHTYPE_DIRECTORY; pathinfo->typeinfo.dir.childcount = packages_count; + pathinfo->time = globalThread.boottime; if (children) { for (package = packages; package; package = package->_next) { node = (void *) ckalloc(sizeof(*node)); node->_next = *children; @@ -739,10 +742,11 @@ os_cpuArch = strchr(packagename, '/'); if (os_cpuArch == NULL) { /* Request for OS and CPU Arch for a specific package */ pathinfo->type = APPFS_PATHTYPE_DIRECTORY; + pathinfo->time = globalThread.boottime; os_cpuArch_count = 0; for (package = packages; package; package = package->_next) { if (strcmp(package->name, packagename) != 0) { APPFS_DEBUG("Skipping package named \"%s\", does not match requested package: \"%s\"", package->name, packagename); @@ -793,10 +797,11 @@ os_val = appfs_convert_os_fromString(os); if (version == NULL) { /* Request for version list for a package on an OS/CPU */ pathinfo->type = APPFS_PATHTYPE_DIRECTORY; + pathinfo->time = globalThread.boottime; version_count = 0; for (package = packages; package; package = package->_next) { if (strcmp(package->name, packagename) != 0) { APPFS_DEBUG("Skipping package named \"%s\", does not match requested package: \"%s\"", package->name, packagename); @@ -855,10 +860,11 @@ APPFS_DEBUG(" ... which hash a hash of %s", package_hash); if (strcmp(path, "") == 0) { pathinfo->type = APPFS_PATHTYPE_DIRECTORY; + pathinfo->time = globalThread.boottime; } else { fileinfo_ret = appfs_getfileinfo(hostname, package_hash, path, pathinfo); if (fileinfo_ret != 0) { free(path_s); @@ -1073,10 +1079,11 @@ const char *cachedir = APPFS_CACHEDIR; char dbfilename[1024]; int pthread_ret, snprintf_ret, sqlite_ret; globalThread.cachedir = cachedir; + globalThread.boottime = time(NULL); pthread_ret = pthread_key_create(&interpKey, NULL); if (pthread_ret != 0) { fprintf(stderr, "Unable to create TSD key for Tcl. Aborting.\n");