lkml.org 
[lkml]   [2003]   [Feb]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: O_DIRECT foolish question
On Wed, Feb 12, 2003 at 06:02:58PM -0500, Bruno Diniz de Paula wrote:

> ext2.

are you able to test with another fs? (reiserfs and XFS also support
O_DIRECT)

> read(3, "", 4096) = 0

odd... I'm not sure why you get this

i tested locally here and it works as expected ... my test code is
appended.


--cw

#define _GNU_SOURCE

#include <unistd.h>

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>

int main()
{
int h;
int ps;
char *buf;
ssize_t n;

ps = getpagesize();
if (!(buf = valloc(ps)))
return 1;
if ((h = open("test", O_RDONLY)) < 0)
return 1;
n = read(h, buf, ps);
printf("read %d bytes\n", n);
close(h);

return 0;
}
\
 
 \ /
  Last update: 2005-03-22 13:33    [W:0.048 / U:1.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site