XMMS2
src/xmms/compat/thread_name_prctl.c
Go to the documentation of this file.
00001 /*  XMMS2 - X Music Multiplexer System
00002  *  Copyright (C) 2003-2011 XMMS2 Team
00003  *
00004  *  PLUGINS ARE NOT CONSIDERED TO BE DERIVED WORK !!!
00005  *
00006  *  This library is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU Lesser General Public
00008  *  License as published by the Free Software Foundation; either
00009  *  version 2.1 of the License, or (at your option) any later version.
00010  *
00011  *  This library is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  *  Lesser General Public License for more details.
00015  */
00016 
00017 #include <sys/prctl.h>
00018 #include <string.h>
00019 
00020 #include "xmmspriv/xmms_thread_name.h"
00021 #include "xmms/xmms_log.h"
00022 
00023 
00024 void
00025 xmms_set_thread_name (const gchar *name)
00026 {
00027     g_return_if_fail (name != NULL && strlen (name) <= 15);
00028 
00029     if (prctl (PR_SET_NAME, (unsigned long) name, 0, 0, 0) != 0) {
00030         xmms_log_error ("Could not set thread name: %s", name);
00031     }
00032 }