{"action":"created","comment":{"url":"https://api.github.com/repos/facebook/osquery/pulls/comments/189100311","pull_request_review_id":121215400,"id":189100311,"diff_hunk":"@@ -0,0 +1,68 @@\n+/**\n+ *  Copyright (c) 2014-present, Facebook, Inc.\n+ *  All rights reserved.\n+ *\n+ *  This source code is licensed under both the Apache 2.0 license (found in the\n+ *  LICENSE file in the root directory of this source tree) and the GPLv2 (found\n+ *  in the COPYING file in the root directory of this source tree).\n+ *  You may select, at your option, one of the above-listed licenses.\n+ */\n+\n+#include <climits>\n+#include <map>\n+#include <string>\n+\n+#include <sys/resource.h>\n+\n+#include <osquery/logger.h>\n+#include <osquery/tables.h>\n+\n+namespace osquery {\n+namespace tables {\n+\n+void getLimit(QueryData& results) {\n+  std::map<std::string, int> resource_map;","path":"osquery/tables/system/posix/ulimit_info.cpp","position":24,"original_position":24,"commit_id":"445a3d235bfb2e50137d8cddf435e9d2b992d256","original_commit_id":"445a3d235bfb2e50137d8cddf435e9d2b992d256","user":{"login":"muffins","id":1328916,"avatar_url":"https://avatars1.githubusercontent.com/u/1328916?v=4","gravatar_id":"","url":"https://api.github.com/users/muffins","html_url":"https://github.com/muffins","followers_url":"https://api.github.com/users/muffins/followers","following_url":"https://api.github.com/users/muffins/following{/other_user}","gists_url":"https://api.github.com/users/muffins/gists{/gist_id}","starred_url":"https://api.github.com/users/muffins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/muffins/subscriptions","organizations_url":"https://api.github.com/users/muffins/orgs","repos_url":"https://api.github.com/users/muffins/repos","events_url":"https://api.github.com/users/muffins/events{/privacy}","received_events_url":"https://api.github.com/users/muffins/received_events","type":"User","site_admin":false},"body":"Rather than assigning all of the values after declaring the variable, let's initialize this:\r\n```\r\nstd::map<std::string, int> resource_map = {\r\n    { \"cpu\", RLIMIT_CPU},\r\n    { \"fsize\", RLIMIT_FSIZE},\r\n    { \"data\", RLIMIT_DATA},\r\n    { \"stack\", RLIMIT_STACK},\r\n    { \"core\", RLIMIT_CORE},\r\n    { \"rss\", RLIMIT_RSS},\r\n    { \"memlock\", RLIMIT_MEMLOCK},\r\n    { \"nproc\", RLIMIT_NPROC},\r\n    { \"nofile\", RLIMIT_NOFILE},\r\n    { \"as\", RLIMIT_AS},\r\n    { \"locks\", RLIMIT_LOCKS},\r\n    { \"sigpending\", RLIMIT_SIGPENDING},\r\n    { \"msgqueue\", RLIMIT_MSGQUEUE},\r\n    { \"nice\", RLIMIT_NICE},\r\n    { \"rtprio\", RLIMIT_RTPRIO},\r\n};\r\n```","created_at":"2018-05-17T21:02:57Z","updated_at":"2018-05-17T21:03:34Z","html_url":"https://github.com/facebook/osquery/pull/4219#discussion_r189100311","pull_request_url":"https://api.github.com/repos/facebook/osquery/pulls/4219","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/facebook/osquery/pulls/comments/189100311"},"html":{"href":"https://github.com/facebook/osquery/pull/4219#discussion_r189100311"},"pull_request":{"href":"https://api.github.com/repos/facebook/osquery/pulls/4219"}}},"pull_request":{"url":"https://api.github.com/repos/facebook/osquery/pulls/4219","id":177557603,"html_url":"https://github.com/facebook/osquery/pull/4219","diff_url":"https://github.com/facebook/osquery/pull/4219.diff","patch_url":"https://github.com/facebook/osquery/pull/4219.patch","issue_url":"https://api.github.com/repos/facebook/osquery/issues/4219","number":4219,"state":"open","locked":false,"title":"tables: Report process limits on darwin and linux #3999","user":{"login":"micheal-o","id":22627292,"avatar_url":"https://avatars3.githubusercontent.com/u/22627292?v=4","gravatar_id":"","url":"https://api.github.com/users/micheal-o","html_url":"https://github.com/micheal-o","followers_url":"https://api.github.com/users/micheal-o/followers","following_url":"https://api.github.com/users/micheal-o/following{/other_user}","gists_url":"https://api.github.com/users/micheal-o/gists{/gist_id}","starred_url":"https://api.github.com/users/micheal-o/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/micheal-o/subscriptions","organizations_url":"https://api.github.com/users/micheal-o/orgs","repos_url":"https://api.github.com/users/micheal-o/repos","events_url":"https://api.github.com/users/micheal-o/events{/privacy}","received_events_url":"https://api.github.com/users/micheal-o/received_events","type":"User","site_admin":false},"body":"New table \"ulimit\" to report process limits (issue:#3999). Commit includes table spec and implementation.","created_at":"2018-03-26T20:23:57Z","updated_at":"2018-05-17T21:03:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9e476b8065ab6611c55bbd16cc91d8efc1497908","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":118805409,"url":"https://api.github.com/repos/facebook/osquery/labels/Linux","name":"Linux","color":"d4c5f9","default":false},{"id":196858822,"url":"https://api.github.com/repos/facebook/osquery/labels/cla%20signed","name":"cla signed","color":"ededed","default":false},{"id":144337630,"url":"https://api.github.com/repos/facebook/osquery/labels/needs%20response","name":"needs response","color":"f7c6c7","default":false},{"id":118805314,"url":"https://api.github.com/repos/facebook/osquery/labels/virtual%20tables","name":"virtual tables","color":"207de5","default":false}],"milestone":{"url":"https://api.github.com/repos/facebook/osquery/milestones/35","html_url":"https://github.com/facebook/osquery/milestone/35","labels_url":"https://api.github.com/repos/facebook/osquery/milestones/35/labels","id":3262851,"number":35,"title":"3.3.0","description":"The next large feature release of osquery. The plan is for this to contain:\r\n\r\n* Braced initialization codemods\r\n* Process Table Improvements\r\n* Linux services table\r\n* Thread names\r\n* ...\r\n\r\nAmong many other new features in osquery.","creator":{"login":"obelisk","id":2386877,"avatar_url":"https://avatars1.githubusercontent.com/u/2386877?v=4","gravatar_id":"","url":"https://api.github.com/users/obelisk","html_url":"https://github.com/obelisk","followers_url":"https://api.github.com/users/obelisk/followers","following_url":"https://api.github.com/users/obelisk/following{/other_user}","gists_url":"https://api.github.com/users/obelisk/gists{/gist_id}","starred_url":"https://api.github.com/users/obelisk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/obelisk/subscriptions","organizations_url":"https://api.github.com/users/obelisk/orgs","repos_url":"https://api.github.com/users/obelisk/repos","events_url":"https://api.github.com/users/obelisk/events{/privacy}","received_events_url":"https://api.github.com/users/obelisk/received_events","type":"User","site_admin":false},"open_issues":19,"closed_issues":42,"state":"open","created_at":"2018-04-12T17:47:57Z","updated_at":"2018-05-17T20:49:34Z","due_on":"2018-05-21T07:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/facebook/osquery/pulls/4219/commits","review_comments_url":"https://api.github.com/repos/facebook/osquery/pulls/4219/comments","review_comment_url":"https://api.github.com/repos/facebook/osquery/pulls/comments{/number}","comments_url":"https://api.github.com/repos/facebook/osquery/issues/4219/comments","statuses_url":"https://api.github.com/repos/facebook/osquery/statuses/445a3d235bfb2e50137d8cddf435e9d2b992d256","head":{"label":"micheal-o:process_limit_feature","ref":"process_limit_feature","sha":"445a3d235bfb2e50137d8cddf435e9d2b992d256","user":{"login":"micheal-o","id":22627292,"avatar_url":"https://avatars3.githubusercontent.com/u/22627292?v=4","gravatar_id":"","url":"https://api.github.com/users/micheal-o","html_url":"https://github.com/micheal-o","followers_url":"https://api.github.com/users/micheal-o/followers","following_url":"https://api.github.com/users/micheal-o/following{/other_user}","gists_url":"https://api.github.com/users/micheal-o/gists{/gist_id}","starred_url":"https://api.github.com/users/micheal-o/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/micheal-o/subscriptions","organizations_url":"https://api.github.com/users/micheal-o/orgs","repos_url":"https://api.github.com/users/micheal-o/repos","events_url":"https://api.github.com/users/micheal-o/events{/privacy}","received_events_url":"https://api.github.com/users/micheal-o/received_events","type":"User","site_admin":false},"repo":{"id":101767891,"name":"osquery","full_name":"micheal-o/osquery","owner":{"login":"micheal-o","id":22627292,"avatar_url":"https://avatars3.githubusercontent.com/u/22627292?v=4","gravatar_id":"","url":"https://api.github.com/users/micheal-o","html_url":"https://github.com/micheal-o","followers_url":"https://api.github.com/users/micheal-o/followers","following_url":"https://api.github.com/users/micheal-o/following{/other_user}","gists_url":"https://api.github.com/users/micheal-o/gists{/gist_id}","starred_url":"https://api.github.com/users/micheal-o/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/micheal-o/subscriptions","organizations_url":"https://api.github.com/users/micheal-o/orgs","repos_url":"https://api.github.com/users/micheal-o/repos","events_url":"https://api.github.com/users/micheal-o/events{/privacy}","received_events_url":"https://api.github.com/users/micheal-o/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/micheal-o/osquery","description":"SQL powered operating system instrumentation, monitoring, and analytics.","fork":true,"url":"https://api.github.com/repos/micheal-o/osquery","forks_url":"https://api.github.com/repos/micheal-o/osquery/forks","keys_url":"https://api.github.com/repos/micheal-o/osquery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/micheal-o/osquery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/micheal-o/osquery/teams","hooks_url":"https://api.github.com/repos/micheal-o/osquery/hooks","issue_events_url":"https://api.github.com/repos/micheal-o/osquery/issues/events{/number}","events_url":"https://api.github.com/repos/micheal-o/osquery/events","assignees_url":"https://api.github.com/repos/micheal-o/osquery/assignees{/user}","branches_url":"https://api.github.com/repos/micheal-o/osquery/branches{/branch}","tags_url":"https://api.github.com/repos/micheal-o/osquery/tags","blobs_url":"https://api.github.com/repos/micheal-o/osquery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/micheal-o/osquery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/micheal-o/osquery/git/refs{/sha}","trees_url":"https://api.github.com/repos/micheal-o/osquery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/micheal-o/osquery/statuses/{sha}","languages_url":"https://api.github.com/repos/micheal-o/osquery/languages","stargazers_url":"https://api.github.com/repos/micheal-o/osquery/stargazers","contributors_url":"https://api.github.com/repos/micheal-o/osquery/contributors","subscribers_url":"https://api.github.com/repos/micheal-o/osquery/subscribers","subscription_url":"https://api.github.com/repos/micheal-o/osquery/subscription","commits_url":"https://api.github.com/repos/micheal-o/osquery/commits{/sha}","git_commits_url":"https://api.github.com/repos/micheal-o/osquery/git/commits{/sha}","comments_url":"https://api.github.com/repos/micheal-o/osquery/comments{/number}","issue_comment_url":"https://api.github.com/repos/micheal-o/osquery/issues/comments{/number}","contents_url":"https://api.github.com/repos/micheal-o/osquery/contents/{+path}","compare_url":"https://api.github.com/repos/micheal-o/osquery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/micheal-o/osquery/merges","archive_url":"https://api.github.com/repos/micheal-o/osquery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/micheal-o/osquery/downloads","issues_url":"https://api.github.com/repos/micheal-o/osquery/issues{/number}","pulls_url":"https://api.github.com/repos/micheal-o/osquery/pulls{/number}","milestones_url":"https://api.github.com/repos/micheal-o/osquery/milestones{/number}","notifications_url":"https://api.github.com/repos/micheal-o/osquery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/micheal-o/osquery/labels{/name}","releases_url":"https://api.github.com/repos/micheal-o/osquery/releases{/id}","deployments_url":"https://api.github.com/repos/micheal-o/osquery/deployments","created_at":"2017-08-29T14:03:15Z","updated_at":"2018-05-12T23:45:45Z","pushed_at":"2018-05-13T01:14:41Z","git_url":"git://github.com/micheal-o/osquery.git","ssh_url":"git@github.com:micheal-o/osquery.git","clone_url":"https://github.com/micheal-o/osquery.git","svn_url":"https://github.com/micheal-o/osquery","homepage":"https://osquery.io","size":14660,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"facebook:master","ref":"master","sha":"122b3867bd98b7b314da44cae27b8d412dfd3415","user":{"login":"facebook","id":69631,"avatar_url":"https://avatars3.githubusercontent.com/u/69631?v=4","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"repo":{"id":22394357,"name":"osquery","full_name":"facebook/osquery","owner":{"login":"facebook","id":69631,"avatar_url":"https://avatars3.githubusercontent.com/u/69631?v=4","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/facebook/osquery","description":"SQL powered operating system instrumentation, monitoring, and analytics.","fork":false,"url":"https://api.github.com/repos/facebook/osquery","forks_url":"https://api.github.com/repos/facebook/osquery/forks","keys_url":"https://api.github.com/repos/facebook/osquery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/facebook/osquery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/facebook/osquery/teams","hooks_url":"https://api.github.com/repos/facebook/osquery/hooks","issue_events_url":"https://api.github.com/repos/facebook/osquery/issues/events{/number}","events_url":"https://api.github.com/repos/facebook/osquery/events","assignees_url":"https://api.github.com/repos/facebook/osquery/assignees{/user}","branches_url":"https://api.github.com/repos/facebook/osquery/branches{/branch}","tags_url":"https://api.github.com/repos/facebook/osquery/tags","blobs_url":"https://api.github.com/repos/facebook/osquery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/facebook/osquery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/facebook/osquery/git/refs{/sha}","trees_url":"https://api.github.com/repos/facebook/osquery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/facebook/osquery/statuses/{sha}","languages_url":"https://api.github.com/repos/facebook/osquery/languages","stargazers_url":"https://api.github.com/repos/facebook/osquery/stargazers","contributors_url":"https://api.github.com/repos/facebook/osquery/contributors","subscribers_url":"https://api.github.com/repos/facebook/osquery/subscribers","subscription_url":"https://api.github.com/repos/facebook/osquery/subscription","commits_url":"https://api.github.com/repos/facebook/osquery/commits{/sha}","git_commits_url":"https://api.github.com/repos/facebook/osquery/git/commits{/sha}","comments_url":"https://api.github.com/repos/facebook/osquery/comments{/number}","issue_comment_url":"https://api.github.com/repos/facebook/osquery/issues/comments{/number}","contents_url":"https://api.github.com/repos/facebook/osquery/contents/{+path}","compare_url":"https://api.github.com/repos/facebook/osquery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/facebook/osquery/merges","archive_url":"https://api.github.com/repos/facebook/osquery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/facebook/osquery/downloads","issues_url":"https://api.github.com/repos/facebook/osquery/issues{/number}","pulls_url":"https://api.github.com/repos/facebook/osquery/pulls{/number}","milestones_url":"https://api.github.com/repos/facebook/osquery/milestones{/number}","notifications_url":"https://api.github.com/repos/facebook/osquery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/facebook/osquery/labels{/name}","releases_url":"https://api.github.com/repos/facebook/osquery/releases{/id}","deployments_url":"https://api.github.com/repos/facebook/osquery/deployments","created_at":"2014-07-29T20:27:33Z","updated_at":"2018-05-17T21:01:58Z","pushed_at":"2018-05-17T20:49:34Z","git_url":"git://github.com/facebook/osquery.git","ssh_url":"git@github.com:facebook/osquery.git","clone_url":"https://github.com/facebook/osquery.git","svn_url":"https://github.com/facebook/osquery","homepage":"https://osquery.io","size":14699,"stargazers_count":12338,"watchers_count":12338,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1390,"mirror_url":null,"archived":false,"open_issues_count":225,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":1390,"open_issues":225,"watchers":12338,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/facebook/osquery/pulls/4219"},"html":{"href":"https://github.com/facebook/osquery/pull/4219"},"issue":{"href":"https://api.github.com/repos/facebook/osquery/issues/4219"},"comments":{"href":"https://api.github.com/repos/facebook/osquery/issues/4219/comments"},"review_comments":{"href":"https://api.github.com/repos/facebook/osquery/pulls/4219/comments"},"review_comment":{"href":"https://api.github.com/repos/facebook/osquery/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/facebook/osquery/pulls/4219/commits"},"statuses":{"href":"https://api.github.com/repos/facebook/osquery/statuses/445a3d235bfb2e50137d8cddf435e9d2b992d256"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"muffins"}}