/* Linux-specific PROCFS manipulation routines.
- Copyright (C) 2009-2018 Free Software Foundation, Inc.
+ Copyright (C) 2009-2019 Free Software Foundation, Inc.
This file is part of GDB.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include "common-defs.h"
+#include "gdbsupport/common-defs.h"
#include "linux-procfs.h"
-#include "filestuff.h"
+#include "gdbsupport/filestuff.h"
#include <dirent.h>
#include <sys/stat.h>
static char comm_buf[TASK_COMM_LEN];
char comm_path[100];
const char *comm_val;
- pid_t pid = ptid_get_pid (ptid);
- pid_t tid = ptid_lwp_p (ptid) ? ptid_get_lwp (ptid) : ptid_get_pid (ptid);
+ pid_t pid = ptid.pid ();
+ pid_t tid = ptid.lwp_p () ? ptid.lwp () : ptid.pid ();
xsnprintf (comm_path, sizeof (comm_path),
"/proc/%ld/task/%ld/comm", (long) pid, (long) tid);
lwp = strtoul (dp->d_name, NULL, 10);
if (lwp != 0)
{
- ptid_t ptid = ptid_build (pid, lwp, 0);
+ ptid_t ptid = ptid_t (pid, lwp, 0);
if (attach_lwp (ptid))
new_threads_found = 1;
return buf;
}
+
+/* See linux-procfs.h. */
+
+void
+linux_proc_init_warnings ()
+{
+ static bool warned = false;
+
+ if (warned)
+ return;
+ warned = true;
+
+ struct stat st;
+
+ if (stat ("/proc/self", &st) != 0)
+ warning (_("/proc is not accessible."));
+}