* [rfc/rfa] [1/4] SPU enhancements: preparation
@ 2007-06-02 19:31 Ulrich Weigand
2007-06-04 19:27 ` Daniel Jacobowitz
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Ulrich Weigand @ 2007-06-02 19:31 UTC (permalink / raw)
To: gdb-patches
Hello,
this is a small fix in preparation for adding extended SPU query support.
Some files in spufs accessed via the spu_proc_xfer_spu routines in
spu-linux-nat.c and gdbserver/spu-low.c are non-seekable. Currently,
any attempt to access those at non-zero offset results in a failure.
However, that is a problem when trying to use those files via the
target object mechanism. For example, the target_read routine will
first read a chunk at offset zero (which succeeds, and in fact is
generally sufficient to retrieve the full contents as the non-seekable
files are small). But then it attempts a second read at an offset
corresponding to the length of the first chunk read, which now fails.
This patch changes spu_proc_xfer_spu to simply return zero (i.e. no
more data available) on any attempt to access a non-seekable spufs
file at non-zero offset.
Tested on spu-elf in conjunction with the other patches.
Bye,
Ulrich
ChangeLog:
* spu-linux-nat.c (spu_proc_xfer_spu): Do not return failure when
accessing non-seekable spufs files.
gdbserver/ChangeLog:
* spu-low.c (spu_proc_xfer_spu): Do not return failure when
accessing non-seekable spufs files.
diff -urNp gdb-orig/gdb/gdbserver/spu-low.c gdb-head/gdb/gdbserver/spu-low.c
--- gdb-orig/gdb/gdbserver/spu-low.c 2007-05-10 23:34:34.000000000 +0200
+++ gdb-head/gdb/gdbserver/spu-low.c 2007-06-01 19:21:10.212694495 +0200
@@ -248,7 +248,7 @@ spu_proc_xfer_spu (const char *annex, un
&& lseek (fd, (off_t) offset, SEEK_SET) != (off_t) offset)
{
close (fd);
- return -1;
+ return 0;
}
if (writebuf)
diff -urNp gdb-orig/gdb/spu-linux-nat.c gdb-head/gdb/spu-linux-nat.c
--- gdb-orig/gdb/spu-linux-nat.c 2007-05-09 01:01:49.000000000 +0200
+++ gdb-head/gdb/spu-linux-nat.c 2007-06-01 19:21:10.362672892 +0200
@@ -250,7 +250,7 @@ spu_proc_xfer_spu (const char *annex, gd
&& lseek (fd, (off_t) offset, SEEK_SET) != (off_t) offset)
{
close (fd);
- return -1;
+ return 0;
}
if (writebuf)
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [rfc/rfa] [1/4] SPU enhancements: preparation
2007-06-02 19:31 [rfc/rfa] [1/4] SPU enhancements: preparation Ulrich Weigand
@ 2007-06-04 19:27 ` Daniel Jacobowitz
2007-06-12 14:40 ` Ulrich Weigand
2007-06-15 15:50 ` Mark Kettenis
2 siblings, 0 replies; 5+ messages in thread
From: Daniel Jacobowitz @ 2007-06-04 19:27 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: gdb-patches
On Sat, Jun 02, 2007 at 09:31:11PM +0200, Ulrich Weigand wrote:
> Hello,
>
> this is a small fix in preparation for adding extended SPU query support.
> Some files in spufs accessed via the spu_proc_xfer_spu routines in
> spu-linux-nat.c and gdbserver/spu-low.c are non-seekable. Currently,
> any attempt to access those at non-zero offset results in a failure.
>
> However, that is a problem when trying to use those files via the
> target object mechanism. For example, the target_read routine will
> first read a chunk at offset zero (which succeeds, and in fact is
> generally sufficient to retrieve the full contents as the non-seekable
> files are small). But then it attempts a second read at an offset
> corresponding to the length of the first chunk read, which now fails.
>
> This patch changes spu_proc_xfer_spu to simply return zero (i.e. no
> more data available) on any attempt to access a non-seekable spufs
> file at non-zero offset.
>
> Tested on spu-elf in conjunction with the other patches.
Seems reasonable to me.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [rfc/rfa] [1/4] SPU enhancements: preparation
2007-06-02 19:31 [rfc/rfa] [1/4] SPU enhancements: preparation Ulrich Weigand
2007-06-04 19:27 ` Daniel Jacobowitz
@ 2007-06-12 14:40 ` Ulrich Weigand
2007-06-15 15:50 ` Mark Kettenis
2 siblings, 0 replies; 5+ messages in thread
From: Ulrich Weigand @ 2007-06-12 14:40 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: gdb-patches
> ChangeLog:
>
> * spu-linux-nat.c (spu_proc_xfer_spu): Do not return failure when
> accessing non-seekable spufs files.
>
> gdbserver/ChangeLog:
>
> * spu-low.c (spu_proc_xfer_spu): Do not return failure when
> accessing non-seekable spufs files.
I've committed this now.
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [rfc/rfa] [1/4] SPU enhancements: preparation
2007-06-02 19:31 [rfc/rfa] [1/4] SPU enhancements: preparation Ulrich Weigand
2007-06-04 19:27 ` Daniel Jacobowitz
2007-06-12 14:40 ` Ulrich Weigand
@ 2007-06-15 15:50 ` Mark Kettenis
2007-06-15 15:54 ` Ulrich Weigand
2 siblings, 1 reply; 5+ messages in thread
From: Mark Kettenis @ 2007-06-15 15:50 UTC (permalink / raw)
To: uweigand; +Cc: gdb-patches
> Date: Sat, 2 Jun 2007 21:31:11 +0200 (CEST)
> From: "Ulrich Weigand" <uweigand@de.ibm.com>
>
> Hello,
>
> this is a small fix in preparation for adding extended SPU query support.
> Some files in spufs accessed via the spu_proc_xfer_spu routines in
> spu-linux-nat.c and gdbserver/spu-low.c are non-seekable. Currently,
> any attempt to access those at non-zero offset results in a failure.
Are these files inherently non-seekable (side-effects?) or is this
just a Linux quirk you're trying to work around?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [rfc/rfa] [1/4] SPU enhancements: preparation
2007-06-15 15:50 ` Mark Kettenis
@ 2007-06-15 15:54 ` Ulrich Weigand
0 siblings, 0 replies; 5+ messages in thread
From: Ulrich Weigand @ 2007-06-15 15:54 UTC (permalink / raw)
To: Mark Kettenis; +Cc: gdb-patches
Mark Kettenis wrote:
> > this is a small fix in preparation for adding extended SPU query support.
> > Some files in spufs accessed via the spu_proc_xfer_spu routines in
> > spu-linux-nat.c and gdbserver/spu-low.c are non-seekable. Currently,
> > any attempt to access those at non-zero offset results in a failure.
>
> Are these files inherently non-seekable (side-effects?) or is this
> just a Linux quirk you're trying to work around?
spufs is a pseudo-filesystem implemented by the Linux kernel
(similar to the /proc or /sys file systems); files in spufs
aren't actually real files, but provide information about
status of SPU contexts.
Most of those files simply do not support seeking; you can
only open them, and read their contents out (once). The
content typically represents a single data item (like the
current SPU event status).
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-06-15 15:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-02 19:31 [rfc/rfa] [1/4] SPU enhancements: preparation Ulrich Weigand
2007-06-04 19:27 ` Daniel Jacobowitz
2007-06-12 14:40 ` Ulrich Weigand
2007-06-15 15:50 ` Mark Kettenis
2007-06-15 15:54 ` Ulrich Weigand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox