Re: How to check root powers on a struct proc ?

2005-06-17 Thread John Baldwin
On Friday 17 June 2005 03:03 pm, Julian Elischer wrote: > Aziz Kezzou wrote: > >>Aziz Kezzou wrote: > >>>Hi all, > >>>I am trying to check that a process (struct proc) has root powers when > >>>it calls my KLD system call. > >>>I know fro

Re: How to check root powers on a struct proc ?

2005-06-17 Thread Julian Elischer
Aziz Kezzou wrote: Aziz Kezzou wrote: Hi all, I am trying to check that a process (struct proc) has root powers when it calls my KLD system call. I know from kern_jail.c that I can use suser() but this function takes a struct thread* instead of struct proc* although the credentials

Re: How to check root powers on a struct proc ?

2005-06-17 Thread Aziz Kezzou
> Aziz Kezzou wrote: > > Hi all, > > I am trying to check that a process (struct proc) has root powers when > > it calls my KLD system call. > > I know from kern_jail.c that I can use suser() but this function takes > > a struct thread* instead of struct proc* alt

Re: How to check root powers on a struct proc ?

2005-06-17 Thread Julian Elischer
Aziz Kezzou wrote: Hi all, I am trying to check that a process (struct proc) has root powers when it calls my KLD system call. I know from kern_jail.c that I can use suser() but this function takes a struct thread* instead of struct proc* although the credentials (struct ucred *p_ucred;) are

Re: How to check root powers on a struct proc ?

2005-06-17 Thread Joseph Koshy
> I am trying to check that a process (struct proc) has root > powers when it calls my KLD system call. Don't you get a 'struct thread *' as an argument to your system call entry point? The 'flag' argument to suser_cred(9) is documented in its manual page.

How to check root powers on a struct proc ?

2005-06-17 Thread Aziz Kezzou
Hi all, I am trying to check that a process (struct proc) has root powers when it calls my KLD system call. I know from kern_jail.c that I can use suser() but this function takes a struct thread* instead of struct proc* although the credentials (struct ucred *p_ucred;) are stored in proc ! Is

Re: struct proc - basic question

2004-09-13 Thread Sam Lawrance
On Mon, 2004-09-13 at 22:51, Peter Pentchev wrote: > On Mon, Sep 13, 2004 at 10:30:31PM +1000, Sam Lawrance wrote: > > On Mon, 2004-09-13 at 22:01, Joanna Sledzik wrote: > > > Hi :) > > > I'm very very begginer in Unix system programming. > > > What funct

Re: struct proc - basic question

2004-09-13 Thread Peter Pentchev
On Mon, Sep 13, 2004 at 02:01:39PM +0200, Joanna Sledzik wrote: > Hi :) > I'm very very begginer in Unix system programming. > What function should I use to catch the struct proc for some process? > Is it possible to get the pointer to struct proc using for example the > pid_

Re: struct proc - basic question

2004-09-13 Thread Peter Pentchev
On Mon, Sep 13, 2004 at 10:30:31PM +1000, Sam Lawrance wrote: > On Mon, 2004-09-13 at 22:01, Joanna Sledzik wrote: > > Hi :) > > I'm very very begginer in Unix system programming. > > What function should I use to catch the struct proc for some process? > > Is i

Re: struct proc - basic question

2004-09-13 Thread Sam Lawrance
On Mon, 2004-09-13 at 22:01, Joanna Sledzik wrote: > Hi :) > I'm very very begginer in Unix system programming. > What function should I use to catch the struct proc for some process? > Is it possible to get the pointer to struct proc using for example the pid_t pid > as

struct proc - basic question

2004-09-13 Thread Joanna Sledzik
Hi :) I'm very very begginer in Unix system programming. What function should I use to catch the struct proc for some process? Is it possible to get the pointer to struct proc using for example the pid_t pid as an argument? Thanks for help Joanna Sl

Re: kernel modules programming: struct proc question

2004-03-17 Thread Jacques A. Vidrine
On Wed, Mar 17, 2004 at 09:36:39PM +0300, Roman Bogorodskiy wrote: > static int > new_open(struct proc *p, register struct open_args *uap) Er, the first argument passed to a system call in 5.x is a `struct thread', not a `struct proc'. Cheers, -- Jacques Vidrine / [EMAIL PRO

Re: kernel modules programming: struct proc question

2004-03-17 Thread Roman Bogorodskiy
John wrote: > Also, you might consider using strncmp() to make the code a bit easier to > read, i.e.: > > if (strncmp(name, "/tmp/", 5) == 0) > printf("open(2): %s by pid %d (%s)\n", name, td->td_proc->p_pid, > td->td_proc->p_comm); Thank you very much, it

Re: kernel modules programming: struct proc question

2004-03-17 Thread Roman Bogorodskiy
e full code: module.c >---cut 8<--- #include #include #include #include #include #include #include #include #include #include #include static int new_open(struct proc *p, register struct open_args *); static int offset = NO_SYSCALL; static int new_open(struct proc *p, register

Re: kernel modules programming: struct proc question

2004-03-17 Thread Jacques A. Vidrine
On Wed, Mar 17, 2004 at 04:45:30PM +0100, Toni Andjelkovic wrote: > On Wed, Mar 17 2004 (17:00:02 +0200), Artis Caune wrote: > > "pid_t" is signed int type, or am I missing something? > > You are right, pid_t is __int32_t, which is signed, so "%d" > is the correct format. That's only correct for

Re: kernel modules programming: struct proc question

2004-03-17 Thread Toni Andjelkovic
On Wed, Mar 17 2004 (17:00:02 +0200), Artis Caune wrote: > "pid_t" is signed int type, or am I missing something? You are right, pid_t is __int32_t, which is signed, so "%d" is the correct format. I assumed that in this case, the signed integer overflowed, so maybe interpreting it as an unsigned

Re: kernel modules programming: struct proc question

2004-03-17 Thread John Baldwin
ing in `/tmp' dir. I've wrote a simple > "syscall" module which replaces open(2) syscall. My new open(2) looks > > like this: > >---cut 8<--- > > static int > new_open(struct proc *p, register struct open_args *uap) > { > char name[NAME_MA

Re: kernel modules programming: struct proc question

2004-03-17 Thread Artis Caune
"pid_t" is signed int type, or am I missing something? try this one: static int new_open (struct proc *p, register struct open_args *uap) { pid_t pid; pid = p->p_pid; printf("open(2): pid: %d\n", pid); return (open(p,uap)); } On Wed, 17 Mar 2004 17:24:51 +

Re: kernel modules programming: struct proc question

2004-03-17 Thread Roman Bogorodskiy
Toni wrote: > pid_t is an unsigned number, so try "%u" in printf() instead. > There's no need to cast a pid_t to int. Doesn't help. It shows wrong pid's again... -Roman Bogorodskiy pgp0.pgp Description: PGP signature

Re: kernel modules programming: struct proc question

2004-03-16 Thread Pawel Jakub Dawidek
On Tue, Mar 16, 2004 at 07:39:56PM +0300, Roman Bogorodskiy wrote: +> I hope it's a right place for kernel module programming related +> questions, in another case I'd be glad if you point me to the right +> maillist. +> +> So, my aim is to log every file opening in `/tmp' dir. I've wrote a

Re: kernel modules programming: struct proc question

2004-03-16 Thread Toni Andjelkovic
On Tue, Mar 16 2004 (19:39:56 +0300), Roman Bogorodskiy wrote: [...] > printf("open(2): %s pid: %i\n", name, (int)p->p_pid); [...] > Mar 16 19:15:44 nov kernel: open(2): /tmp/asfdasfsaf pid: -1002890624 pid_t is an unsigned number, so try "%u" in printf() instead. There's no need to

kernel modules programming: struct proc question

2004-03-16 Thread Roman Bogorodskiy
open(2) syscall. My new open(2) looks like this: >---cut 8<--- static int new_open(struct proc *p, register struct open_args *uap) { char name[NAME_MAX]; size_t size; if((const void*)copyinstr(uap->path, name,

struct proc and struct vmspace help, please

2000-10-18 Thread Nathan Boeger
_vm . vm_rssize ( like top ) but from inside the struct proc what do I use ? I have tried the struct vmspace but it give me strange numbers (well, maybe not strange but are they in pages ? bytes ? and why are they 0 sometimes ? ) I have looked and explored all over the headers, but I am stuck. Any help w

Re: struct proc

2000-06-26 Thread Boris Popov
On Mon, 26 Jun 2000, Matthew Dillon wrote: > This whole p vs curproc thing is a huge mess. 95% of the time > p == curproc. The only places where it might not is in I/O ops > that are completed by an interrupt or (in the case of NFS) some > other process. Any chances to

Re: struct proc

2000-06-26 Thread Matthew Dillon
:>p is the process that made the syscall, curproc is the current :> running process. You should be using p for the process that :> called my_syscall. : :Since only one process can enter the kernel at a time (currently), :and p is the process that made the system call, it is also the :current

Re: struct proc

2000-06-26 Thread John Polstra
In article <[EMAIL PROTECTED]>, Chris Costello <[EMAIL PROTECTED]> wrote: > On Monday, June 26, 2000, Fox Anderson wrote: > > What is the difference between p and curproc in my syscall? > > > > static int > > my_syscall(struct proc *p, my_sysc

Re: struct proc

2000-06-26 Thread Chris Costello
On Monday, June 26, 2000, Fox Anderson wrote: > Hi all! > > What is the difference between p and curproc in my syscall? > > static int > my_syscall(struct proc *p, my_syscallargs *uap) { > curproc->.. > } p is the process that made the sysc

struct proc

2000-06-26 Thread Fox Anderson
Hi all! What is the difference between p and curproc in my syscall? static int my_syscall(struct proc *p, my_syscallargs *uap) { curproc->.. } To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message