--- Ian jonhson <[EMAIL PROTECTED]> wrote:

> If my value is a struct, how to set in
> /proc/self/attr/current? I
> tested the procfs using the following codes:
> 
> struct mystruct{
> int v1;
> int v2;
> } my_struct;
> 
> my_struct.v1 = 1;
> my_struct.v2 = 2;
> 
> sprintf(path, "/proc/%d/attr/current", pid);   //

you could use self instead of the pid number here.

> pid is the process id
> int fd = open(path, O_WRONLY);
> if (fd != -1) {
>       rc = write(fd, my_struct, sizeof(mystruct));

If this is c code you need an ampersand (&) in
front of "my_struct".

>       close(fd);
> }
> 
> return rc;
> 
> After the code running, I got the error message:-1.

check the errno to see what the error was. Are
you sure the open was successful?


Casey Schaufler
[EMAIL PROTECTED]
-
To unsubscribe from this list: send the line "unsubscribe 
linux-security-module" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to