LCOV - code coverage report
Current view: top level - lib/util - util_process.c (source / functions) Hit Total Coverage
Test: coverage report for v4-17-test 1498b464 Lines: 5 5 100.0 %
Date: 2024-06-13 04:01:37 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /*
       2             :  *  Unix SMB/CIFS implementation.
       3             :  *
       4             :  *  Process utils.
       5             :  *
       6             :  *  Copyright (c) 2013      Andreas Schneider <asn@samba.org>
       7             :  *
       8             :  *  This program is free software; you can redistribute it and/or modify
       9             :  *  it under the terms of the GNU General Public License as published by
      10             :  *  the Free Software Foundation; either version 3 of the License, or
      11             :  *  (at your option) any later version.
      12             :  *
      13             :  *  This program is distributed in the hope that it will be useful,
      14             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
      15             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      16             :  *  GNU General Public License for more details.
      17             :  *
      18             :  *  You should have received a copy of the GNU General Public License
      19             :  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
      20             :  */
      21             : 
      22             : #include "util_process.h"
      23             : #include "replace.h"
      24             : 
      25             : #ifdef HAVE_SYS_PRCTL_H
      26             : #include <sys/prctl.h>
      27             : #endif
      28             : 
      29       14692 : int prctl_set_comment(const char *comment_format, ...)
      30             : {
      31             : #if defined(HAVE_PRCTL) && defined(PR_SET_NAME)
      32             :         char comment[16];
      33             :         va_list ap;
      34       14692 :         va_start(ap, comment_format);
      35       14692 :         vsnprintf(comment, sizeof(comment), comment_format, ap);
      36       14692 :         va_end(ap);
      37             : 
      38       14692 :         return prctl(PR_SET_NAME, (unsigned long) comment, 0, 0, 0);
      39             : #endif
      40             :         return 0;
      41             : }

Generated by: LCOV version 1.13