public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dtor_core@ameritech.net>
To: linux-kernel@vger.kernel.org
Cc: Greg KH <gregkh@suse.de>
Subject: sysfs: write returns ENOMEM?
Date: Fri, 19 Aug 2005 00:55:25 -0500	[thread overview]
Message-ID: <200508190055.25747.dtor_core@ameritech.net> (raw)

[Apologies if you see this message twice - I accidentially sent it in HTML
 format first time around and I am pretty sure LKML will eat it]

Hi,

According to the SuS write() can not return ENOMEM, only ENOBUFS is allowed
(surprisingly read() is allowed to use both ENOMEM and ENOBUFS):

http://www.opengroup.org/onlinepubs/000095399/functions/write.html

Should we adjust sysfs write to follow the standard?

-- 
Dmitry

===================================================================
sysfs: write should return ENOBUFS

According to SuS ENOMEM is not a valid return code for write(),
ENOBUFS should be returned.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---

 fs/sysfs/file.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

Index: work/fs/sysfs/file.c
===================================================================
--- work.orig/fs/sysfs/file.c
+++ work/fs/sysfs/file.c
@@ -180,7 +180,7 @@ fill_write_buffer(struct sysfs_buffer * 
 	if (!buffer->page)
 		buffer->page = (char *)get_zeroed_page(GFP_KERNEL);
 	if (!buffer->page)
-		return -ENOMEM;
+		return -ENOBUFS;
 
 	if (count >= PAGE_SIZE)
 		count = PAGE_SIZE;

             reply	other threads:[~2005-08-19  5:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <11394.1124781401@kao2.melbourne.sgi.com>
2005-08-19  5:55 ` Dmitry Torokhov [this message]
2005-08-19  7:29   ` sysfs: write returns ENOMEM? Greg KH
2005-08-19  7:39   ` Pekka Enberg
2005-08-23  7:32   ` Nathan Scott
2005-08-23  7:55     ` Pekka Enberg
2005-08-23  8:28       ` Andrew Morton
2005-08-23  8:36         ` Pekka J Enberg
2005-08-23  8:46         ` [PATCH] mm: return ENOBUFS instead of ENOMEM in generic_file_buffered_write Pekka J Enberg
2005-08-23 11:55           ` Christoph Hellwig
2005-08-23 13:50             ` Dmitry Torokhov

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=200508190055.25747.dtor_core@ameritech.net \
    --to=dtor_core@ameritech.net \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.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