lkml.org 
[lkml]   [2005]   [Aug]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subjectsysfs: write returns ENOMEM?
Date
[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;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-08-19 07:58    [W:0.061 / U:0.356 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site