lkml.org 
[lkml]   [2011]   [Aug]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: PROBLEM: 2.6.35.7 to 3.0 Inotify events missing
    Hi,

    On Sat, Aug 20, 2011 at 12:37:56AM +0100, Jamie Lokier wrote:
    >
    > Can it also be bypassed with sys_open_by_handle_at?

    Just checked that and... as planned it can be bypassed with
    name_to_handle_at/open_by_handle_at as well.

    (I added my quick'n'dirty test code, maybe someone will be interested by
    a working fhandle example on Linux 3.0.x).

    Sylvain
    #include <stdio.h>
    #include <stdlib.h>

    #include <fcntl.h>
    #include <unistd.h>
    #include <errno.h>
    #include <string.h>

    struct file_handle {
    int handle_size;
    int handle_type;
    void *f_handle;
    };


    int main(int argc, char *argv[])
    {
    int ret;
    int fd;
    int mntfd;
    struct file_handle fh;
    fh.handle_type = 0;
    fh.f_handle = malloc(100);
    fh.handle_size = 100/sizeof(int);
    errno = 0;

    printf("%s\n", argv[1]);

    int mntid = 20;

    ret = syscall(303, 0, argv[1], &fh, &mntid, 0);
    if (ret) {
    perror("303 Error:");
    exit(1);
    }
    printf("%d - %d\n", mntid, fh.handle_size);

    printf("sleep\n");
    sleep(60);


    mntfd = open("/data", O_RDONLY);
    printf("dir = %d\n", mntfd );

    fd = syscall(304, mntfd, &fh, O_WRONLY);
    if (fd < 0 ) {
    perror("304 Error:");
    exit(1);
    }
    printf("fd = %d\n", fd);


    write(fd, "toto", 4);


    if( close(fd) ) {
    printf("close failed\n");
    }

    return 0;
    }



    [unhandled content-type:application/pgp-signature]
    \
     
     \ /
      Last update: 2011-08-25 23:49    [W:0.024 / U:29.296 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site