lkml.org 
[lkml]   [2004]   [May]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectReading from file in module fails
    Hi,
    I'm writing module which needs to read from file. I've got this simple sample code:

    char buffer[4096];
    ssize_t read;
    file *f;
    f = filp_open("/some/file",O_RDONLY | O_LARGEFILE,0);
    f->f_pos = 0;
    read = vfs_read(f,(char __user *) buffer,4096,&f->f_pos);

    but here read value is "-14" (-EINVAL?) Does anybody has idea what's wrong?

    It seems that file is opened OK (I've tested:
    if (f->f_op->read) {
    read = f->f_op->read(file, buf, count, pos);
    }
    and result was the same - so I assume that file is opened OK and structure "file f" is filled correctly.


    I need to copy files (yes - I know that kernel shouldn't do this but I REALLY need) and there is nothing like "sys_copy" and "sys_sendfile" is not exported (which seems strange to me but there is nothing like EXPORT_SYMBOL(sys_sendfile) in fs/read_write.c


    Thanks,
    Libor Vanek

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 14:02    [W:0.018 / U:2.124 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site