PATCH/OBVIOUS Remove various trailing spaces in linux-osdata.c
[deliverable/binutils-gdb.git] / gdb / nat / linux-procfs.c
index a12f6228cba34b9d47b2f9003c37acb772b3ca89..6c15ea5cce3c6da23d3688ba84d0a99589d593fd 100644 (file)
@@ -1,5 +1,5 @@
 /* Linux-specific PROCFS manipulation routines.
-   Copyright (C) 2009-2017 Free Software Foundation, Inc.
+   Copyright (C) 2009-2018 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -96,7 +96,7 @@ enum proc_state
 static enum proc_state
 parse_proc_status_state (const char *state)
 {
-  state = skip_spaces_const (state);
+  state = skip_spaces (state);
 
   switch (state[0])
     {
@@ -104,10 +104,10 @@ parse_proc_status_state (const char *state)
       return PROC_STATE_TRACING_STOP;
     case 'T':
       /* Before Linux 2.6.33, tracing stop used uppercase T.  */
-      if (strcmp (state, "T (tracing stop)") == 0)
-       return PROC_STATE_TRACING_STOP;
-      else
+      if (strcmp (state, "T (stopped)\n") == 0)
        return PROC_STATE_STOPPED;
+      else /* "T (tracing stop)\n" */
+       return PROC_STATE_TRACING_STOP;
     case 'X':
       return PROC_STATE_DEAD;
     case 'Z':
@@ -239,8 +239,8 @@ linux_proc_tid_get_name (ptid_t ptid)
   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);
@@ -308,7 +308,7 @@ linux_proc_attach_tgid_threads (pid_t pid,
          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;
@@ -357,3 +357,20 @@ linux_proc_pid_to_exec_file (int pid)
 
   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."));
+}
This page took 0.025661 seconds and 4 git commands to generate.