LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 01-09-2010, 03:34 PM   #1
kindlike
LQ Newbie
 
Registered: Jan 2010
Posts: 3

Rep: Reputation: 0
modify the kernel and compiled but got "dereferencing pointer to incomplete type" err


Hi,

I modified the write() function in linux kernel as follows:

static ssize_t write(struct file *file, const char __user *userbuf,
size_t bytes, loff_t *off)

{ struct bin_buffer *bb = file->private_data;
struct dentry *dentry = file->f_path.dentry;
int size = dentry->d_inode->i_size;
int uid=dentry->d_inode->i_uid;
loff_t offs = *off;
int count = min_t(size_t, bytes, PAGE_SIZE);
char *temp;

...
if ((current_euid()!=uid)&&(dentry->d_inode.i_iflag==1)offs=size;/*I added the line where happened*/
...
}

Because I want to know the current user id when doing write function,I used current_euid() to access the current user id.I also included the definition file for current_euid() as follows:

#include <linux/cred.h>

But when I compiled the kernel, I got such error,
"fs/sysfs/bin.c: In function ‘write’:
fs/sysfs/bin.c:175: error: dereferencing pointer to incomplete type
"

The definition for current_euid() is in linux/cred.h as follows:
#define current_euid() (current_cred_xxx(euid))


I don't know how to fix the problem or is there any other way to access current user id in write function?

Thank you.

Last edited by kindlike; 01-09-2010 at 03:43 PM.
 
Old 01-10-2010, 02:36 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
You're lacking definition of 'current'. To get it, include asm/current.h before linux/cred.h
 
Old 01-10-2010, 05:58 PM   #3
kindlike
LQ Newbie
 
Registered: Jan 2010
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Mara View Post
You're lacking definition of 'current'. To get it, include asm/current.h before linux/cred.h
After I add include <asm/current.h> before include <linux/cred.h>,
I still get the same error "dereferencing pointer to incomplete type"
 
Old 04-09-2011, 02:01 PM   #4
pholasek
LQ Newbie
 
Registered: Apr 2011
Posts: 2

Rep: Reputation: 0
linux/security.h

When you'll include linux/security.h the problem should have been solved.
 
  


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
dereferencing pointer to incomplete type sweetymobil Programming 7 06-22-2009 07:46 AM
dereferencing pointer to incomplete type (just built a new kernel) 144419855310001 Linux - Kernel 0 10-03-2007 03:58 PM
error: dereferencing pointer to incomplete type ChullDouvre Programming 2 05-02-2007 12:16 AM
Error: dereferencing pointer to incomplete type cynthia_thomas Programming 1 05-01-2006 08:10 AM
C error "dereferencing pointer to incomplete type" lucs Slackware 6 02-21-2005 09:33 AM

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

All times are GMT -5. The time now is 06:37 PM.

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