delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/09/07/14:12:21

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <431F2D6D.8000200@lapo.it>
Date: Wed, 07 Sep 2005 20:11:57 +0200
From: Lapo Luchini <lapo AT lapo DOT 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 AT cygwin DOT com>
Subject: Re: happily messing up with raw devices (aka: lseek problems)
References: <431F266D DOT 3050604 AT lapo DOT it> <20050907174848 DOT GR5555 AT calimero DOT vinschen DOT de>
In-Reply-To: <20050907174848.GR5555@calimero.vinschen.de>

-----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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019