[問題] 有關kernel module寫檔

看板Linux作者 (晨星)時間15年前 (2009/06/20 01:27), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/1
參考了這個網頁 http://loda.zhupiter.com/LinuxProtectModeArch.htm 在 module 中加入 struct file *filp; mm_segment_t oldfs; char buf[] = "123"; filp=filp_open("/file",O_CREAT|O_RDWR,0777); oldfs=get_fs(); set_fs(KERNEL_DS); filp->f_op->write(filp,buf,strlen(buf),&filp->f_pos); set_fs(oldfs); filp_close(filp,NULL); 目前是可以寫檔了, 但發現以下問題 1.寫檔超過一定大小 就會發生溢位 (從f_pos觀察到的) 2.不能是nfs的檔案 (/mnt/file) 請問是否有解決辦法呢 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.115.222.85

06/22 16:34, , 1F
我也想知道耶!! 有高手知道嗎?
06/22 16:34, 1F
文章代碼(AID): #1AEyfbyM (Linux)