Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Message-ID: <431F2D6D.8000200@lapo.it>
Date: Wed, 07 Sep 2005 20:11:57 +0200
From: Lapo Luchini <lapo@lapo.it>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.7.6) Gecko/20050317 Thunderbird/1.0.2 Mnenhy/0.7.2.0
MIME-Version: 1.0
To: "[ML] CygWin " <cygwin@cygwin.com>
Subject: Re: happily messing up with raw devices (aka: lseek problems)
References: <431F266D.3050604@lapo.it> <20050907174848.GR5555@calimero.vinschen.de>
In-Reply-To: <20050907174848.GR5555@calimero.vinschen.de>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Corinna Vinschen wrote:
> I really thought you know better.

But you know that using a "user" mailing list you can't resist to do
silly question ;-)
Except jokes, what I really forgot to tell is that the program is still
that small (119 lines) that would be a good testcase in itself (and for
now it is O_RDONLY so there is no probability it will do strange things
to the hard drive).

Seek error in file [/dev/sdb] (-1/22528): Invalid argument

That would be an error 22 aka EINVAL at line 93 of gagulator.c
(which should be downloadable from here: http://tinyurl.com/77jne )

> - What about a simple testcase(tm) to demonstrate the problem?

At the bare minumum it all boils down to:

% cat short.c
#include <sys/stat.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#define GAG_OFFSET 0x59BD
main() {
  char sect[512];
  int dev, i;
  dev = open("/dev/sdb", O_RDONLY | O_BINARY, 0);
  if (dev < 0) perror("open");
  i = lseek(dev, GAG_OFFSET & (~0x1FF), SEEK_SET);
  if (i < 0) perror("seek");
}
% gcc -O -ggdb -o short short.c
% ./short
seek: Invalid argument

- --
L a p o   L u c h i n i
l a p o @ l a p o . i t
w w w . l a p o . i t /
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iEYEARECAAYFAkMfLW0ACgkQaJiCLMjyUvucyACg4Geer9+n3vT2y7BaiLncK1bO
XHkAoLbXI9BRkeVM8QZXBtMOzZ4yzkVW
=p98+
-----END PGP SIGNATURE-----

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

