trinity-devel@lists.pearsoncomputing.net

Message: previous - next
Month: February 2011

Re: [trinity-devel] Patch

From: "Timothy Pearson" <kb9vqf@...>
Date: Mon, 21 Feb 2011 12:45:17 -0600
> Today I received the following patch from Novell, for better support of
> newer
> kernels:
>
> Index: kdelibs-3.5.10/kinit/start_kdeinit.c
> ===================================================================
> --- kdelibs-3.5.10.orig/kinit/start_kdeinit.c
> +++ kdelibs-3.5.10/kinit/start_kdeinit.c
> @@ -44,11 +44,30 @@ static int set_protection( pid_t pid, in
>  {
>     char buf[ 1024 ];
>     int procfile;
> +   struct stat st;
> +
> +   /* Newer kernels (noticed in 2.6.36) */
> +   sprintf( buf, "/proc/%d/oom_score_adj", pid );
> +   if ( lstat (buf, &st) == 0) {
> +     if( !enable ) {
> +       /* Be paranoid and check that the pid we got from the pipe
> +          belongs to this user. */
> +       if( st.st_uid != getuid())
> +           return 0;
> +     }
> +     procfile = open(buf, O_WRONLY);
> +     if( enable )
> +       write( procfile, "-300", sizeof( "-300" ));
> +     else
> +       write( procfile, "0", sizeof( "0" ));
> +     close( procfile );
> +     return 1;
> +   }
> +
>     sprintf( buf, "/proc/%d/stat", pid );
>     if( !enable ) {
>         /* Be paranoid and check that the pid we got from the pipe
>            belongs to this user. */
> -       struct stat st;
>         if( lstat( buf, &st ) < 0 || st.st_uid != getuid())
>             return 0;
>     }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> trinity-devel-unsubscribe@...
> For additional commands, e-mail:
> trinity-devel-help@...
> Read list messsages on the Web archive:
> http://trinity-devel.pearsoncomputing.net/
> Please remember not to top-post:
> http://trinity.pearsoncomputing.net/mailing_lists/#top-posting
>
>

Committed to SVN.

Thanks!

Tim