aio_write or aio_write64 on raw device fail with errno EINVAL?

aio_write or aio_write64 on raw device fail with errno EINVAL?

Post by robertwa » Mon, 12 May 2003 16:09:06



I want to use aio_write64 on raw device , eg. /dev/rtestlv. the code
likes:

s_aiocb64.aio_whence = SEEK_SET;
s_aiocb64.aio_offset = ul_offset;
s_aiocb64.aio_buf = char_buffer;
s_aiocb64.aio_nbytes = ul_nbytes;

if(aio_write64(fid, &s_aiocb64) < 0)
{
        fprintf(stderr,"aio_write64 errno:%d\n",errno);
        perror("aio_write64");
        return(1);

Quote:}

but the aio_write64 always returns EINVAL: Indicates that the
aio_whence field does not have a valid value or that the resulting
pointer is not valid.

but the same code works well with block device, eg. /dev/testlv and
jfs file.

can anyone tell me how to use aio_write64 with raw device? many
thanks.

 
 
 

aio_write or aio_write64 on raw device fail with errno EINVAL?

Post by Greg » Mon, 12 May 2003 23:43:29



> I want to use aio_write64 on raw device , eg. /dev/rtestlv. the code
> likes:

> s_aiocb64.aio_whence = SEEK_SET;
> s_aiocb64.aio_offset = ul_offset;
> s_aiocb64.aio_buf = char_buffer;
> s_aiocb64.aio_nbytes = ul_nbytes;

> if(aio_write64(fid, &s_aiocb64) < 0)
> {
>    fprintf(stderr,"aio_write64 errno:%d\n",errno);
>    perror("aio_write64");
>    return(1);
> }

> but the aio_write64 always returns EINVAL: Indicates that the
> aio_whence field does not have a valid value or that the resulting
> pointer is not valid.

> but the same code works well with block device, eg. /dev/testlv and
> jfs file.

> can anyone tell me how to use aio_write64 with raw device? many
> thanks.

Just curious, but did you bzero s_aiocb64 prior to setting the field?

(Sorry, I have to know!)

Greg

 
 
 

aio_write or aio_write64 on raw device fail with errno EINVAL?

Post by Greg » Mon, 12 May 2003 23:54:53




>> I want to use aio_write64 on raw device , eg. /dev/rtestlv. the code
>> likes:

>> s_aiocb64.aio_whence = SEEK_SET;
>> s_aiocb64.aio_offset = ul_offset;
>> s_aiocb64.aio_buf = char_buffer;
>> s_aiocb64.aio_nbytes = ul_nbytes;

>> if(aio_write64(fid, &s_aiocb64) < 0)
>> {
>>     fprintf(stderr,"aio_write64 errno:%d\n",errno);
>>     perror("aio_write64");
>>     return(1);
>> }

>> but the aio_write64 always returns EINVAL: Indicates that the
>> aio_whence field does not have a valid value or that the resulting
>> pointer is not valid.

Wait a sec..  The man page I'm looking at says:

EINVAL - The file offset value implied by aio_offset is invalid,
aio_reqprio is an invalid value, or aio_nbytes is an invalid value.

The semantics you describe for EINVAL/whence is the asynchronous
operation error code.

 
 
 

aio_write or aio_write64 on raw device fail with errno EINVAL?

Post by robertwa » Tue, 13 May 2003 10:06:37





> >> I want to use aio_write64 on raw device , eg. /dev/rtestlv. the code
> >> likes:

> >> s_aiocb64.aio_whence = SEEK_SET;
> >> s_aiocb64.aio_offset = ul_offset;
> >> s_aiocb64.aio_buf = char_buffer;
> >> s_aiocb64.aio_nbytes = ul_nbytes;

> >> if(aio_write64(fid, &s_aiocb64) < 0)
> >> {
> >>     fprintf(stderr,"aio_write64 errno:%d\n",errno);
> >>     perror("aio_write64");
> >>     return(1);
> >> }

> >> but the aio_write64 always returns EINVAL: Indicates that the
> >> aio_whence field does not have a valid value or that the resulting
> >> pointer is not valid.

> Wait a sec..  The man page I'm looking at says:

> EINVAL - The file offset value implied by aio_offset is invalid,
> aio_reqprio is an invalid value, or aio_nbytes is an invalid value.

> The semantics you describe for EINVAL/whence is the asynchronous
> operation error code.

I've bzero the s_aiocb64, and the aio.h in AIX4.3.3 MIL10 says:
aio_reqprio no used, my question is the same code works well with
block device , eg. /dev/testlv and JFS file, why can not work with raw
device? any special consideration?
 
 
 

aio_write or aio_write64 on raw device fail with errno EINVAL?

Post by robertwa » Tue, 13 May 2003 15:09:23







> >> >> I want to use aio_write64 on raw device , eg. /dev/rtestlv. the code
> >> >> likes:

> >> >> s_aiocb64.aio_whence = SEEK_SET;
> >> >> s_aiocb64.aio_offset = ul_offset;
> >> >> s_aiocb64.aio_buf = char_buffer;
> >> >> s_aiocb64.aio_nbytes = ul_nbytes;

> >> >> if(aio_write64(fid, &s_aiocb64) < 0)
> >> >> {
> >> >>     fprintf(stderr,"aio_write64 errno:%d\n",errno);
> >> >>     perror("aio_write64");
> >> >>     return(1);
> >> >> }

> >> >> but the aio_write64 always returns EINVAL: Indicates that the
> >> >> aio_whence field does not have a valid value or that the resulting
> >> >> pointer is not valid.

> >> Wait a sec..  The man page I'm looking at says:

> >> EINVAL - The file offset value implied by aio_offset is invalid,
> >> aio_reqprio is an invalid value, or aio_nbytes is an invalid value.

> >> The semantics you describe for EINVAL/whence is the asynchronous
> >> operation error code.

> r> I've bzero the s_aiocb64, and the aio.h in AIX4.3.3 MIL10 says:
> r> aio_reqprio no used, my question is the same code works well with
> r> block device , eg. /dev/testlv and JFS file, why can not work with raw
> r> device? any special consideration?

> It's my understanding that accesses to raw devices must be aligned
> on boundaries of the block size of the device itself.  What's the
> value of aio_offset in this case?

> Regards,

> Nicholas

Yes, for raw devices, offset must be aligned on boundaries , many thanks.
 
 
 

1. gethostbyname_r sets errno to EINVAL?

On some Sun machines on our network which uses NFS, gethostbyname_r is
setting errno to EINVAL (22). No non-solaris machine shows this
behaviour, also all machines which do are Solaris 8 (however not all
Solaris 8 machines show this behaviour). So I'm baffled. Does anyone
have any idea what may be going on? The man pages dont mention a thing.
Thank you.
Khan

2. can you reproduce this?

3. character device, block device , raw device?

4. Anonymous FTP

5. dl_open fail with EINVAL

6. pdf-files too big

7. Q: EINVAL set by read from device driver

8. Fontutil-0.6, Need help compiling!

9. AF_UNIX bind() fails (EINVAL) under 2.6

10. How relative do raw device bind block device on linux ?

11. Cannot open master raw device '/dev/rawctl' (No such device)

12. How relative do raw device bind block device on linux ?