summaryrefslogtreecommitdiff
path: root/procfs.h
diff options
context:
space:
mode:
Diffstat (limited to 'procfs.h')
-rw-r--r--procfs.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/procfs.h b/procfs.h
index 8336ee85..e8ef18b3 100644
--- a/procfs.h
+++ b/procfs.h
@@ -16,9 +16,11 @@ struct procfs_node_ops
symlink or directory, as determined by the file mode in
netnode->nn_stat. For regular files and symlinks, they are what
you would expect; for directories, they are an argz vector of the
- names of the entries. */
- error_t (*get_contents) (void *hook, char **contents, size_t *contents_len);
- void (*cleanup_contents) (void *hook, char *contents, size_t contents_len);
+ names of the entries. If upon return, *CONTENTS_LEN is negative or
+ unchanged, the call is considered to have failed because of a memory
+ allocation error. */
+ error_t (*get_contents) (void *hook, char **contents, ssize_t *contents_len);
+ void (*cleanup_contents) (void *hook, char *contents, ssize_t contents_len);
/* Lookup NAME in this directory, and store the result in *np. The
returned node should be created by lookup() using procfs_make_node()
@@ -41,8 +43,8 @@ struct procfs_node_ops
};
/* These helper functions can be used as procfs_node_ops.cleanup_contents. */
-void procfs_cleanup_contents_with_free (void *, char *, size_t);
-void procfs_cleanup_contents_with_vm_deallocate (void *, char *, size_t);
+void procfs_cleanup_contents_with_free (void *, char *, ssize_t);
+void procfs_cleanup_contents_with_vm_deallocate (void *, char *, ssize_t);
/* Create a new node and return it. Returns NULL if it fails to allocate
enough memory. In this case, ops->cleanup will be invoked. */
@@ -69,7 +71,7 @@ void procfs_node_chtype (struct node *np, mode_t type);
corresponding child nodes. */
ino64_t procfs_make_ino (struct node *np, const char *filename);
-error_t procfs_get_contents (struct node *np, char **data, size_t *data_len);
+error_t procfs_get_contents (struct node *np, char **data, ssize_t *data_len);
error_t procfs_lookup (struct node *np, const char *name, struct node **npp);
void procfs_cleanup (struct node *np);