1 /*****************************************************************************
2 * linux_specific.c: Linux-specific initialization
3 *****************************************************************************
4 * Copyright © 2008 Rémi Denis-Courmont
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19 *****************************************************************************/
25 #include <vlc_common.h>
26 #include "../libvlc.h"
33 static void set_libvlc_path (void)
35 static char libvlc_path[PATH_MAX];
37 assert (strlen (LIBDIR) < sizeof (libvlc_path));
38 strcpy (libvlc_path, LIBDIR); /* fail safe */
39 psz_vlcpath = libvlc_path;
41 /* Find the path to libvlc (i.e. ourselves) */
42 FILE *maps = fopen ("/proc/self/maps", "rt");
48 char buf[5000], *dir, *end;
50 if (fgets (buf, sizeof (buf), maps) == NULL)
53 dir = strchr (buf, '/');
56 end = strrchr (dir, '/');
59 if (strncmp (end + 1, "libvlc.so.", 10))
63 printf ("libvlc at %s\n", dir);
64 if (strlen (dir) < sizeof (libvlc_path))
65 strcpy (libvlc_path, dir);
73 void system_Init (libvlc_int_t *libvlc, int *argc, const char *argv[])
76 static pthread_once_t once = PTHREAD_ONCE_INIT;
77 pthread_once (&once, set_libvlc_path);
79 (void)libvlc; (void)argc; (void)argv;
82 void system_Configure (libvlc_int_t *libvlc, int *argc, const char *argv[])
84 (void)libvlc; (void)argc; (void)argv;
87 void system_End (libvlc_int_t *libvlc)