[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/7] procfs: implement /proc/N/mounts
From: |
Samuel Thibault |
Subject: |
Re: [PATCH 3/7] procfs: implement /proc/N/mounts |
Date: |
Mon, 29 Sep 2014 01:15:45 +0200 |
User-agent: |
Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) |
Justus Winter, le Mon 22 Sep 2014 11:38:40 +0200, a écrit :
> * procfs/process.c (process_gc_mounts): New function.
> (process_symlink_make_node): Likewise.
> (entries): Use the new functions to provide a symlink to ../mounts.
Mmm, I wouldn't lie like this: don't we have per-process views of what / is?
(notably through remaps)
Which application needs /proc/$$/mounts?
> ---
> procfs/process.c | 27 +++++++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
>
> diff --git a/procfs/process.c b/procfs/process.c
> index a9b1a59..f5da0d2 100644
> --- a/procfs/process.c
> +++ b/procfs/process.c
> @@ -202,6 +202,16 @@ process_file_gc_maps (struct proc_stat *ps, char
> **contents)
> return contents_len;
> }
>
> +static error_t
> +process_gc_mounts (void *hook, char **contents, ssize_t *contents_len)
> +{
> +#define MOUNTSLINK "../mounts"
> + *contents = MOUNTSLINK;
> + *contents_len = sizeof MOUNTSLINK - 1;
> +#undef MOUNTSLINK
> + return 0;
> +}
> +
> static ssize_t
> process_file_gc_stat (struct proc_stat *ps, char **contents)
> {
> @@ -420,6 +430,14 @@ process_stat_make_node (void *dir_hook, const void
> *entry_hook)
> return np;
> }
>
> +static struct node *
> +process_symlink_make_node (void *dir_hook, const void *entry_hook)
> +{
> + struct node *np = procfs_make_node (entry_hook, dir_hook);
> + if (np)
> + procfs_node_chtype (np, S_IFLNK);
> + return np;
> +}
>
> /* Implementation of the process directory per se. */
>
> @@ -450,6 +468,15 @@ static struct procfs_dir_entry entries[] = {
> },
> },
> {
> + .name = "mounts",
> + .hook = & (struct procfs_node_ops) {
> + .get_contents = process_gc_mounts,
> + },
> + .ops = {
> + .make_node = process_symlink_make_node,
> + },
> + },
> + {
> .name = "stat",
> .hook = & (struct process_file_desc) {
> .get_contents = process_file_gc_stat,
> --
> 2.1.0
>
--
Samuel
<c> tiens, je suis déçu
<c> quand on clique sur le bouton random de http://xkcd.com/221/ on ne tombe
pas (toujours) sur http://xkcd.com/4/
<c> bon, j'envoie un bug-report à l'auteur
- [PATCH 1/2] procfs: implement /proc/N/maps, Justus Winter, 2014/09/18
- [PATCH 2/2] procfs: implement /proc/filesystems, Justus Winter, 2014/09/18
- [PATCH 1/6] procfs: implement /proc/N/mounts, Justus Winter, 2014/09/21
- [PATCH 4/6] procfs: generalize the translator linkage code, Justus Winter, 2014/09/21
- Re: [PATCH 4/6] procfs: generalize the translator linkage code, Justus Winter, 2014/09/21
- [PATCH 1/7] procfs: implement /proc/N/maps, Justus Winter, 2014/09/22
- [PATCH 3/7] procfs: implement /proc/N/mounts, Justus Winter, 2014/09/22
- Re: [PATCH 3/7] procfs: implement /proc/N/mounts,
Samuel Thibault <=
- [PATCH 4/7] procfs: do not test whether /hurd/mtab exists, Justus Winter, 2014/09/22
- Re: [PATCH 4/7] procfs: do not test whether /hurd/mtab exists, Samuel Thibault, 2014/09/28
- [PATCH 2/7] procfs: implement /proc/filesystems, Justus Winter, 2014/09/22
- Re: [PATCH 2/7] procfs: implement /proc/filesystems, Samuel Thibault, 2014/09/28
- [PATCH 5/7] procfs: generalize the translator linkage code, Justus Winter, 2014/09/22
- Re: [PATCH 5/7] procfs: generalize the translator linkage code, Samuel Thibault, 2014/09/28
- [PATCH 6/7] procfs: reorganize rootdir.c, Justus Winter, 2014/09/22
- Re: [PATCH 6/7] procfs: reorganize rootdir.c, Samuel Thibault, 2014/09/28
- [PATCH 7/7] procfs: provide magic retry response for /proc/self, Justus Winter, 2014/09/22
- Re: [PATCH 7/7] procfs: provide magic retry response for /proc/self, Samuel Thibault, 2014/09/30