[lkml]   [2012]   [Jul]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectNeed to know the size of data send from Kernel to USer Ap

    I am new to kernel programming so can anyone point me to the right
    forum/reply for the question below.

    I would like to implement a character device and using a node of type
    character read and write data. However I am not sure of the length of
    data from kernel which a user app will receive, so I would like to code
    safely. If the data exceeds the application gets killed.
    Any idea or API to perform the task of knowing the data length when
    passing data to and fro from kernel to user level would be appreciated.

    Kernel code:

    copy_to_user(buff, kernel_msg, strlen(kernel_msg));

    User App:
    ret=read(fd,buff,strlen(buf)); //How can I know
    the size of buff, which would be sent/filled from kernel???


     \ /
      Last update: 2012-07-24 11:02    [W:0.019 / U:84.300 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site