From: "Joakim Tjernlund" <Joakim.Tjernlund@transmode.se>
To: "'Timur Tabi'" <timur@freescale.com>, <linuxppc-dev@ozlabs.org>
Subject: RE: lseek() on entries in /proc/device-tree returns EINVAL
Date: Wed, 16 Apr 2008 23:09:27 +0200 [thread overview]
Message-ID: <062501c8a006$27b17b90$771472b0$@Tjernlund@transmode.se> (raw)
In-Reply-To: <48066857.4030109@freescale.com>
> -----Original Message-----
> From: linuxppc-dev-bounces+joakim.tjernlund=transmode.se@ozlabs.org [mailto:linuxppc-dev-
> bounces+joakim.tjernlund=transmode.se@ozlabs.org] On Behalf Of Timur Tabi
> Sent: den 16 april 2008 22:58
> To: linuxppc-dev@ozlabs.org
> Subject: lseek() on entries in /proc/device-tree returns EINVAL
>
> I'm writing a utility that parses the device tree in /proc/device-tree, and in
> order to read a property into memory, I have to first find out how large it is.
> So I have the following code:
>
> off_t off;
> int f;
>
> f = open(filename, O_RDONLY);
> if (f == -1) {
> perror(__func__);
> return NULL;
> }
>
> off = lseek(f, 0, SEEK_END);
> if (off == -1) {
> perror(__func__);
> goto fail;
> }
>
> The lseek() call returns -1, and errno is set to EINVAL. According to the man
> page, this means:
>
> EINVAL The whence argument is not a proper value, or the resulting
> file offset would be negative for a regular file, block special
> file, or directory.
>
> Is there a limitation for the implementation of /proc/device-tree that prevents
> lseek() from working? If so, how do I determine the size of a property?
Yeah, just reported a similar problem at LKML. busybox start-stop-daemon broke
between 2.6.23 and current tree. The change was intentional but the borkage
was not. Al Viro has been informed, lets see what comes of it.
Jocke
next prev parent reply other threads:[~2008-04-16 21:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-16 20:57 lseek() on entries in /proc/device-tree returns EINVAL Timur Tabi
2008-04-16 21:01 ` Scott Wood
2008-04-16 21:09 ` Joakim Tjernlund [this message]
2008-04-16 21:10 ` Timur Tabi
2008-04-16 21:13 ` Joakim Tjernlund
2008-04-16 21:16 ` Timur Tabi
2008-04-16 21:40 ` Joakim Tjernlund
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='062501c8a006$27b17b90$771472b0$@Tjernlund@transmode.se' \
--to=joakim.tjernlund@transmode.se \
--cc=linuxppc-dev@ozlabs.org \
--cc=timur@freescale.com \
/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;
as well as URLs for NNTP newsgroup(s).