#include "xalloc.h"
#include "nls.h"
#include "buffer.h"
+#include "idcache.h"
#include "libsmartcols.h"
#include "lsfd.h"
+static struct idcache *username_cache;
+
static const char *assocstr[N_ASSOCS] = {
[ASSOC_CWD] = "cwd",
[ASSOC_EXE] = "exe",
return file;
}
+static void file_class_initialize(void)
+{
+ username_cache = new_idcache();
+ if (!username_cache)
+ err(EXIT_FAILURE, _("failed to allocate UID cache"));
+}
+
+static void file_class_finalize(void)
+{
+ free_idcache(username_cache);
+}
+
const struct file_class file_class = {
.super = NULL,
.size = sizeof(struct file),
+ .initialize_class = file_class_initialize,
+ .finalize_class = file_class_finalize,
.fill_column = file_fill_column,
.handle_fdinfo = file_handle_fdinfo,
.free_content = file_free_content,
unsigned int read:1, write:1, exec:1, shared:1;
};
-/*
- * idcaches
- */
-struct idcache *username_cache;
-
/*
* Column related stuffs
*/
&ncolumns, column_name_to_id) < 0)
return EXIT_FAILURE;
- username_cache = new_idcache();
- if (!username_cache)
- err(EXIT_FAILURE, _("failed to allocate UID cache"));
-
scols_init_debug(0);
ctl.tb = scols_new_table();
emit(&ctl);
delete(&procs, &ctl);
- free_idcache(username_cache);
-
finalize_classes();
return 0;
#include <sys/stat.h>
#include <dirent.h>
-#include "idcache.h"
#include "list.h"
/*
struct file *make_unkn(const struct file_class *class,
struct stat *sb, const char *name, int fd);
-extern struct idcache *username_cache;
-
#endif /* UTIL_LINUX_LSFD_H */