LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 02-02-2012, 12:55 PM   #1
karan2386
Member
 
Registered: Jan 2012
Posts: 34

Rep: Reputation: Disabled
task_struct


i have written module which reads and write on /proc file and is working fine but want to use permissions with it when i make the function for permissions shown below its gives me error (basically i want every one could read the file but only root could write in it).

int my_permission(struct inode *inode, int op)
{
if(op == 4||(op == 2 && current->euid = 0)) //euid is not a member of task_struct
return 0;
return -EACCES;
}
const struct inode_operations my_iops = {
.permission = my_permission,
};

but its giving me error as follow:

/home/karan/practice/procf/testproc1.c: In function ‘my_permission’:
/home/karan/practice/procf/testproc1.c:50:32: error: ‘struct task_struct’ has no member named ‘euid'

I think there is other member in task_struct which points to user id . I am interested in solution as well as description of task_struct members field used for.

regards
karan

Last edited by karan2386; 02-02-2012 at 12:56 PM.
 
Old 02-02-2012, 02:56 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
It is in the credential structures. It may be better to use the right API, however. You can find the documentation here: http://lwn.net/Articles/287091/
 
Old 02-02-2012, 11:20 PM   #3
bsat
Member
 
Registered: Feb 2009
Posts: 347

Rep: Reputation: 72
current->euid used to exist before, which has been modified to current_euid() now. The article given by Mara gives the explanation for it.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
task_struct structure gpg Linux - Newbie 0 01-27-2009 05:56 AM
How to get details from task_struct imsandy_007 Programming 1 02-13-2007 11:08 AM
task_struct access swaroopjoshi Linux - Kernel 1 11-15-2006 01:25 PM
task_struct of a process swaroopjoshi Linux - Kernel 1 11-09-2006 04:08 PM
Stuct task_struct dami Programming 1 10-13-2003 01:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 02:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration