Remove AIX build support

This probably won't be hard to resurrect, but I have no way to test or
know if I've broken it (and I likely already have), so I'm going to
remove it for now.

Change-Id: Ifb1d4658d00aed4d642d7f5378f3e67c0c15dcbf
Reviewed-on: https://gn-review.googlesource.com/1321
Reviewed-by: Brett Wilson <brettw@chromium.org>
diff --git a/base/process/internal_aix.cc b/base/process/internal_aix.cc
deleted file mode 100644
index 7f03aee..0000000
--- a/base/process/internal_aix.cc
+++ /dev/null
@@ -1,155 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/process/internal_aix.h"
-
-#include <sys/procfs.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <unistd.h>
-
-#include <map>
-#include <string>
-#include <vector>
-
-#include "base/files/file_util.h"
-#include "base/logging.h"
-#include "base/strings/string_number_conversions.h"
-#include "base/strings/string_split.h"
-#include "base/strings/string_util.h"
-#include "base/threading/thread_restrictions.h"
-#include "base/time/time.h"
-
-// Not defined on AIX by default.
-#define NAME_MAX 255
-
-namespace base {
-namespace internalAIX {
-
-const char kProcDir[] = "/proc";
-
-const char kStatFile[] = "psinfo";  // AIX specific
-
-FilePath GetProcPidDir(pid_t pid) {
-  return FilePath(kProcDir).Append(IntToString(pid));
-}
-
-pid_t ProcDirSlotToPid(const char* d_name) {
-  int i;
-  for (i = 0; i < NAME_MAX && d_name[i]; ++i) {
-    if (!IsAsciiDigit(d_name[i])) {
-      return 0;
-    }
-  }
-  if (i == NAME_MAX)
-    return 0;
-
-  // Read the process's command line.
-  pid_t pid;
-  std::string pid_string(d_name);
-  if (!StringToInt(pid_string, &pid)) {
-    NOTREACHED();
-    return 0;
-  }
-  return pid;
-}
-
-bool ReadProcFile(const FilePath& file, struct psinfo* info) {
-  // Synchronously reading files in /proc is safe.
-  ThreadRestrictions::ScopedAllowIO allow_io;
-  int fileId;
-  if ((fileId = open(file.value().c_str(), O_RDONLY)) < 0) {
-    DLOG(WARNING) << "Failed to open " << file.MaybeAsASCII()
-                  << " errno = " << errno;
-    return false;
-  }
-
-  if (read(fileId, info, sizeof(*info)) < 0) {
-    DLOG(WARNING) << "Failed to read " << file.MaybeAsASCII()
-                  << " errno = " << errno;
-    return false;
-  }
-
-  return true;
-}
-
-bool ReadProcStats(pid_t pid, struct psinfo* info) {
-  FilePath stat_file = internalAIX::GetProcPidDir(pid).Append(kStatFile);
-  return ReadProcFile(stat_file, info);
-}
-
-bool ParseProcStats(struct psinfo& stats_data,
-                    std::vector<std::string>* proc_stats) {
-  // The stat file is formatted as:
-  // struct psinfo
-  // see -
-  // https://www.ibm.com/support/knowledgecenter/ssw_aix_71/com.ibm.aix.files/proc.htm
-  proc_stats->clear();
-  // PID.
-  proc_stats->push_back(IntToString(stats_data.pr_pid));
-  // Process name without parentheses. // 1
-  proc_stats->push_back(stats_data.pr_fname);
-  // Process State (Not available)  // 2
-  proc_stats->push_back("0");
-  // Process id of parent  // 3
-  proc_stats->push_back(IntToString(stats_data.pr_ppid));
-
-  // Process group id // 4
-  proc_stats->push_back(IntToString(stats_data.pr_pgid));
-
-  return true;
-}
-
-typedef std::map<std::string, std::string> ProcStatMap;
-void ParseProcStat(const std::string& contents, ProcStatMap* output) {
-  StringPairs key_value_pairs;
-  SplitStringIntoKeyValuePairs(contents, ' ', '\n', &key_value_pairs);
-  for (size_t i = 0; i < key_value_pairs.size(); ++i) {
-    output->insert(key_value_pairs[i]);
-  }
-}
-
-int64_t GetProcStatsFieldAsInt64(const std::vector<std::string>& proc_stats,
-                                 ProcStatsFields field_num) {
-  DCHECK_GE(field_num, VM_PPID);
-  CHECK_LT(static_cast<size_t>(field_num), proc_stats.size());
-
-  int64_t value;
-  return StringToInt64(proc_stats[field_num], &value) ? value : 0;
-}
-
-size_t GetProcStatsFieldAsSizeT(const std::vector<std::string>& proc_stats,
-                                ProcStatsFields field_num) {
-  DCHECK_GE(field_num, VM_PPID);
-  CHECK_LT(static_cast<size_t>(field_num), proc_stats.size());
-
-  size_t value;
-  return StringToSizeT(proc_stats[field_num], &value) ? value : 0;
-}
-
-int64_t ReadProcStatsAndGetFieldAsInt64(pid_t pid, ProcStatsFields field_num) {
-  struct psinfo stats_data;
-  if (!ReadProcStats(pid, &stats_data))
-    return 0;
-  std::vector<std::string> proc_stats;
-  if (!ParseProcStats(stats_data, &proc_stats))
-    return 0;
-
-  return GetProcStatsFieldAsInt64(proc_stats, field_num);
-}
-
-size_t ReadProcStatsAndGetFieldAsSizeT(pid_t pid, ProcStatsFields field_num) {
-  struct psinfo stats_data;
-  if (!ReadProcStats(pid, &stats_data))
-    return 0;
-  std::vector<std::string> proc_stats;
-  if (!ParseProcStats(stats_data, &proc_stats))
-    return 0;
-  return GetProcStatsFieldAsSizeT(proc_stats, field_num);
-}
-
-}  // namespace internalAIX
-}  // namespace base
diff --git a/base/process/internal_aix.h b/base/process/internal_aix.h
deleted file mode 100644
index d9694ff..0000000
--- a/base/process/internal_aix.h
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// This file contains internal routines that are called by other files in
-// base/process/.
-
-#ifndef BASE_PROCESS_INTERNAL_AIX_H_
-#define BASE_PROCESS_INTERNAL_AIX_H_
-
-#include <stddef.h>
-#include <stdint.h>
-#include <unistd.h>
-
-#include "base/files/file_path.h"
-
-namespace base {
-
-namespace internalAIX {
-
-// "/proc"
-extern const char kProcDir[];
-
-// "psinfo"
-extern const char kStatFile[];
-
-// Returns a FilePath to "/proc/pid".
-base::FilePath GetProcPidDir(pid_t pid);
-
-// Take a /proc directory entry named |d_name|, and if it is the directory for
-// a process, convert it to a pid_t.
-// Returns 0 on failure.
-// e.g. /proc/self/ will return 0, whereas /proc/1234 will return 1234.
-pid_t ProcDirSlotToPid(const char* d_name);
-
-// Reads /proc/<pid>/stat into |buffer|. Returns true if the file can be read
-// and is non-empty.
-bool ReadProcStats(pid_t pid, std::string* buffer);
-
-// Takes |stats_data| and populates |proc_stats| with the values split by
-// spaces. Taking into account the 2nd field may, in itself, contain spaces.
-// Returns true if successful.
-bool ParseProcStats(const std::string& stats_data,
-                    std::vector<std::string>* proc_stats);
-
-// Fields from /proc/<pid>/psinfo.
-// If the ordering ever changes, carefully review functions that use these
-// values.
-// For AIX this is the bare minimum that we need. Most of the commented out
-// fields can still be extracted but currently none of these are required.
-enum ProcStatsFields {
-  VM_COMM = 1,  // Filename of executable, without parentheses.
-  //  VM_STATE          = 2,   // Letter indicating the state of the process.
-  VM_PPID = 3,  // PID of the parent.
-  VM_PGRP = 4,  // Process group id.
-  //  VM_UTIME          = 13,  // Time scheduled in user mode in clock ticks.
-  //  VM_STIME          = 14,  // Time scheduled in kernel mode in clock ticks.
-  //  VM_NUMTHREADS     = 19,  // Number of threads.
-  //  VM_STARTTIME      = 21,  // The time the process started in clock ticks.
-  //  VM_VSIZE          = 22,  // Virtual memory size in bytes.
-  //  VM_RSS            = 23,  // Resident Set Size in pages.
-};
-
-// Reads the |field_num|th field from |proc_stats|. Returns 0 on failure.
-// This version does not handle the first 3 values, since the first value is
-// simply |pid|, and the next two values are strings.
-int64_t GetProcStatsFieldAsInt64(const std::vector<std::string>& proc_stats,
-                                 ProcStatsFields field_num);
-
-// Same as GetProcStatsFieldAsInt64(), but for size_t values.
-size_t GetProcStatsFieldAsSizeT(const std::vector<std::string>& proc_stats,
-                                ProcStatsFields field_num);
-
-// Convenience wrapper around GetProcStatsFieldAsInt64(), ParseProcStats() and
-// ReadProcStats(). See GetProcStatsFieldAsInt64() for details.
-int64_t ReadProcStatsAndGetFieldAsInt64(pid_t pid, ProcStatsFields field_num);
-
-// Same as ReadProcStatsAndGetFieldAsInt64() but for size_t values.
-size_t ReadProcStatsAndGetFieldAsSizeT(pid_t pid, ProcStatsFields field_num);
-
-}  // namespace internal
-}  // namespace base
-
-#endif  // BASE_PROCESS_INTERNAL_AIX_H_
diff --git a/build/build_aix.ninja.template b/build/build_aix.ninja.template
deleted file mode 100644
index 5cd36d6..0000000
--- a/build/build_aix.ninja.template
+++ /dev/null
@@ -1,19 +0,0 @@
-rule cc
-  command = $cc -MMD -MF $out.d $defines $includes $cflags $cflags_c -c $in -o $out
-  description = CC $out
-  depfile = $out.d
-  deps = gcc
-
-rule cxx
-  command = $cxx -MMD -MF $out.d $defines $includes $cflags $cflags_cc -c $in -o $out
-  description = CXX $out
-  depfile = $out.d
-  deps = gcc
-
-rule alink_thin
-  command = rm -f $out && $ar rcsT $out $in
-  description = AR $out
-
-rule link
-  command = $ld $ldflags -o $out $in $libs $solibs
-  description = LINK $out
diff --git a/build/gen.py b/build/gen.py
index 9f48513..05d8763 100755
--- a/build/gen.py
+++ b/build/gen.py
@@ -23,8 +23,7 @@
 is_win = sys.platform.startswith('win')
 is_linux = sys.platform.startswith('linux')
 is_mac = sys.platform.startswith('darwin')
-is_aix = sys.platform.startswith('aix')
-is_posix = is_linux or is_mac or is_aix
+is_posix = is_linux or is_mac
 
 
 def main(argv):
@@ -63,8 +62,6 @@
     template_filename = 'build_vs.ninja.template'
   elif is_mac:
     template_filename = 'build_mac.ninja.template'
-  elif is_aix:
-    template_filename = 'build_aix.ninja.template'
   else:
     template_filename = 'build.ninja.template'
 
@@ -140,11 +137,6 @@
     cxx = os.environ.get('CXX', 'cl.exe')
     ld = os.environ.get('LD', 'link.exe')
     ar = os.environ.get('AR', 'lib.exe')
-  elif is_aix:
-    cc = os.environ.get('CC', 'gcc')
-    cxx = os.environ.get('CXX', 'c++')
-    ld = os.environ.get('LD', cxx)
-    ar = os.environ.get('AR', 'ar -X64')
   else:
     cc = os.environ.get('CC', 'cc')
     cxx = os.environ.get('CXX', 'c++')
@@ -181,9 +173,6 @@
         '-fno-exceptions'
     ])
     cflags_cc.extend(['-std=c++14', '-Wno-c++11-narrowing'])
-    if is_aix:
-     cflags.extend(['-maix64'])
-     ldflags.extend([ '-maix64 -Wl,-bbigtoc' ])
   elif is_win:
     if not options.debug:
       cflags.extend(['/Ox', '/DNDEBUG', '/GL'])
@@ -477,7 +466,7 @@
         'cflags': cflags + ['-DHAVE_CONFIG_H'],
     }
 
-  if is_linux or is_aix:
+  if is_linux:
     static_libraries['xdg_user_dirs'] = {
         'sources': [
             'base/third_party/xdg_user_dirs/xdg_user_dir_lookup.cc',
@@ -502,37 +491,24 @@
         'base/time/time_now_posix.cc',
         'base/threading/platform_thread_linux.cc',
     ])
-    if is_linux:
-      libs.extend([
-          '-lc',
-          '-lgcc_s',
-          '-lm',
-          '-lpthread',
-          '-lrt',
-          '-latomic',
-      ])
-      static_libraries['base']['sources'].extend([
-        'base/allocator/allocator_shim.cc',
-        'base/allocator/allocator_shim_default_dispatch_to_glibc.cc',
-      ])
-      static_libraries['libevent']['include_dirs'].extend([
-          os.path.join(REPO_ROOT, 'base', 'third_party', 'libevent', 'linux')
-      ])
-      static_libraries['libevent']['sources'].extend([
-         'base/third_party/libevent/epoll.c',
-      ])
-    else:
-      ldflags.extend(['-pthread'])
-      libs.extend(['-lrt'])
-      static_libraries['base']['sources'].extend([
-          'base/process/internal_aix.cc'
-      ])
-      static_libraries['libevent']['include_dirs'].extend([
-          os.path.join(REPO_ROOT, 'base', 'third_party', 'libevent', 'aix')
-      ])
-      static_libraries['libevent']['include_dirs'].extend([
-          os.path.join(REPO_ROOT, 'base', 'third_party', 'libevent', 'compat')
-      ])
+    libs.extend([
+        '-lc',
+        '-lgcc_s',
+        '-lm',
+        '-lpthread',
+        '-lrt',
+        '-latomic',
+    ])
+    static_libraries['base']['sources'].extend([
+      'base/allocator/allocator_shim.cc',
+      'base/allocator/allocator_shim_default_dispatch_to_glibc.cc',
+    ])
+    static_libraries['libevent']['include_dirs'].extend([
+        os.path.join(REPO_ROOT, 'base', 'third_party', 'libevent', 'linux')
+    ])
+    static_libraries['libevent']['sources'].extend([
+        'base/third_party/libevent/epoll.c',
+    ])
 
   if is_mac:
     static_libraries['base']['sources'].extend([