From: David Howells <dhowells@redhat.com>
To: ksummit-discuss@lists.linuxfoundation.org
Subject: Re: [Ksummit-discuss] [TECH TOPIC] Getting better/supplementary error info back to userspace
Date: Wed, 12 Jul 2017 15:57:56 +0100 [thread overview]
Message-ID: <12463.1499871476@warthog.procyon.org.uk> (raw)
In-Reply-To: <10144.1499863410@warthog.procyon.org.uk>
David Howells <dhowells@redhat.com> wrote:
> In which case, would it make sense to attach such a facility to the
> task_struct instead? I implemented a test of this using prctl, but a new
> syscall might be a better idea, at least for reading.
>
> (*) int old_setting = prctl(PR_ERRMSG_ENABLE, int setting);
>
> Enable (setting == 1) or disable (setting == 0) the facility.
> Disabling the facility clears the error buffer.
>
> (*) int size = prctl(PR_ERRMSG_READ, char *buffer, int buf_size);
>
> Read back a message and discard it.
I forgot to add that I've kept the in-kernel interface I have for this very
simple for the moment:
void errorf(const char *fmt, ...);
int invalf(const char *fmt, ...);
where these functions take printf-style arguments and where invalf() is the
same as errorf(), but returns -EINVAL for convenience. To take an example
from NFS:
- if (auth_info->flavor_len + 1 >= max_flavor_len) {
- dfprintk(MOUNT, "NFS: too many sec= flavors\n");
- return -EINVAL;
- }
+ if (auth_info->flavor_len + 1 >= max_flavor_len)
+ return invalf("NFS: too many sec= flavors");
David
next prev parent reply other threads:[~2017-07-12 14:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-12 12:43 David Howells
2017-07-12 14:33 ` Arnaldo Carvalho de Melo
2017-07-12 14:44 ` Arnaldo Carvalho de Melo
2017-07-12 14:57 ` David Howells [this message]
2017-07-12 15:21 ` Stephen Hemminger
2017-07-12 16:19 ` Linus Torvalds
2017-07-12 16:35 ` Stephen Hemminger
2017-07-19 13:02 ` Steven Rostedt
2017-07-24 7:55 ` Miklos Szeredi
2017-07-24 8:25 ` David Howells
2017-07-21 13:41 ` David Howells
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=12463.1499871476@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=ksummit-discuss@lists.linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox