summaryrefslogtreecommitdiff
path: root/dircat.c
diff options
context:
space:
mode:
authorJeremie Koenig <jk@jk.fr.eu.org>2010-08-23 20:43:16 +0000
committerJeremie Koenig <jk@jk.fr.eu.org>2010-08-30 14:31:32 +0200
commitc9bfe14f2e5e09b1692ae4a120de1df2cf835d05 (patch)
tree197c1f3acfccdd1e51b9ea098fac59ef24678d3b /dircat.c
parent59b3864bbd09e81df1a5934a02d8af7f4eec0b28 (diff)
Refresh nodes when they're read from the start.
This is necessary for top, for instance, which keeps some files open and re-reads them regularly. As an extra bonus we can drop the refresh hack. * procfs.c, procfs.h: Remove the refresh hack. (procfs_refresh): New function, invalidates the cached contents. * netfs.c (netfs_attempt_read, netfs_get_dirents): Call procfs_refresh when the read is from offset 0. * proclist.c (proclist_make_node): Remove the refresh hack. * dircat.c (dircat_make_node): Likewise. (dircat_get_contents): Use procfs_refresh to avoid keeping old data from the component nodes.
Diffstat (limited to 'dircat.c')
-rw-r--r--dircat.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/dircat.c b/dircat.c
index d043486d..d24e8345 100644
--- a/dircat.c
+++ b/dircat.c
@@ -23,6 +23,9 @@ dircat_get_contents (void *hook, char **contents, ssize_t *contents_len)
char *subcon;
ssize_t sublen;
+ /* Make sure we're not getting some old stuff. */
+ procfs_refresh (dcn->dirs[i]);
+
err = procfs_get_contents (dcn->dirs[i], &subcon, &sublen);
if (err)
{
@@ -83,8 +86,6 @@ dircat_make_node (struct node *const *dirs, int num_dirs)
.cleanup_contents = procfs_cleanup_contents_with_free,
.lookup = dircat_lookup,
.cleanup = dircat_cleanup,
- /* necessary so that it propagates to proclist */
- .enable_refresh_hack_and_break_readdir = 1,
};
struct dircat_node *dcn;
int i;