Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void do_project_write(const char __user *filename){
- int flags = O_WRONLY|O_CREAT|O_APPEND;
- int mode = 0644;
- int fd;
- char *output = "name_of_downloaded_files.txt";
- /* set the data we need to output */
- char *temp;
- char data[150];
- memset(data,0,150);
- temp = getname(filename);
- strncpy(data,temp,strlen(temp));
- data[strlen(temp)] = '\n';
- /* enable the data section from kernel */
- mm_segment_t old_fs = get_fs();
- set_fs(KERNEL_DS);
- /* write the data to the file */
- fd = do_sys_open(AT_FDCWD, output, flags, mode);
- if (fd >= 0){
- sys_write(fd, data, strlen(data));
- sys_close(fd);
- } else
- printk("project: can not open file\n");
- set_fs(old_fs);
- }
- void do_project_all(const char __user *filename, int flags){
- if(!strstr(current->comm, "firefox"))
- goto out;
- if(flags&O_WRONLY || flags&O_RDWR)
- do_project_write(filename);
- out:
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement