{ "info": { "author": "Zygmunt Krynicki", "author_email": "me@zygoon.pl", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)", "Natural Language :: English", "Operating System :: MacOS :: MacOS X", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development", "Topic :: Software Development :: Libraries" ], "description": "===================================\nLow-level bindings to libproc.dylib\n===================================\n\nIntroduction\n============\n\nThis module contains descriptions and wrappers around interesting parts of the\nlibproc.dylib shared library. This library exposes internal kernel data about\nprocesses of OS X. It was developed and tested on OS X 10.7.5, using i386\narchitecture.\n\nMany aspects were traced manually from xnu source code as this library is\nseverely undocumented.\n\nLow-level API\n=============\n\nThe entire action of this library revolves around the function\n``__proc_info()`` which is a simple wrapper around a system call. The signature\nof the function is as follows (Internal private prototype taken from\n``libproc.c``)::\n\n int\n __proc_info(\n int callnum, // One of _PROC_CALLNUM_xxx constants below.\n int pid, // Varies per callnum, see below.\n int flavor, // Ditto.\n uint64_t arg, // Ditto, sometimes unused.\n void *buffer, // Output buffer.\n int buffersize // Size of output buffer.\n );\n\nThe only low level API is ``__proc_info()`` itself.\n\nThe behavior of this function depends on the first argument, *callnum*, which\nis typical of many kernel interfaces. Unfortunately distinct values of\n*callnum* do not have any official names (in the source code they are simply\nhard-coded constants. I have used a convention *_PROC_CALLNUM_xxx* where *xxx*\nis derived from the name of the kernel function multiplexed by that value.\n\nThe values I have made are::\n\n PROC_CALLNUM_LISTPIDS = 1\n PROC_CALLNUM_PIDINFO = 2\n PROC_CALLNUM_PIDFDINFO = 3\n PROC_CALLNUM_KERNMSGBUF = 4\n PROC_CALLNUM_SETCONTROL = 5\n PROC_CALLNUM_PIDFILEPORTINFO = 6\n\nYou can verify them by looking at ``proc_info_internal()`` in the xnu source\ncode: ``xnu/bsd/kern/proc_info.c``.\n\nWhenever this function is called with NULL value for *buffer*, it will compute\nand return the correct size of the buffer to pass. Looking at the source code\nof the system call it makes some conservative estimates but I suspect it is\nstill racy (a fork bomb might make the value invalid between the first and\nsecond calls).\n\nCallnum 1\n---------\n\n.. note::\n This *callnum* has a liproc-only alias of *PROC_CALLNUM_LISTPIDS*\n\nWhen *callnum* is :data:`~libproc.PROC_CALLNUM_LISTPIDS` then the function\nobtains a list of process identifiers that match some criteria.\n\nThe remaining arguments have the following meaning:\n\n*pid*:\n Contains the type of process list to obtain. The possible values are one of\n *PROC_xxx* constants listed below.\n\n :data:`~libproc.PROC_ALL_PIDS`:\n Return the full process table.\n :data:`~libproc.PROC_PGRP_ONLY`:\n Return a list of processes that have a given process group ID\n :data:`~libproc.PROC_TTY_ONLY`:\n Return a list of processes that are attached to a given TTY\n :data:`~libproc.PROC_UID_ONLY`:\n Return a list of processes that have a given user ID.\n :data:`~libproc.PROC_RUID_ONLY`:\n Return a list of processes that have a given real user ID.\n :data:`~libproc.PROC_PPID_ONLY`:\n Return a list of processes that are children of a given process.\n\n*flavor*:\n Contains the optional filtering argument for the processes that are\n returned. The value passed here is compared against the desired property of\n each process. The only exception is *PROC_ALL_PIDS* where no filtering\n takes place.\n\n*arg*:\n This parameter is unused.\n\n*buffer*:\n This parameter is the pointer to the output buffer. The buffer is an\n array of :class:`python:ctypes.c_int` of appropriate size (as determined\n by the size of the process table).\n\n As a convention, you can pass a None value (which maps to a *NULL* pointer)\n to ask the kernel for the size of the buffer. Correct buffer size in bytes\n is then returned by the call.\n\n*buf_size*:\n Size of the buffer, in bytes.\n\nThe return value is either the number of bytes needed or the number of bytes\nwritten to the buffer (see the discussion of *buffer* argument above).\n\nCallnum 2\n---------\n\n.. note::\n This *callnum* has a liproc-only alias of *PROC_CALLNUM_PIDINFO*\n\nThis *callnum* is currently undocumented.\n\nCallnum 3 \n---------\n\n.. note::\n This *callnum* has a liproc-only alias of *PROC_CALLNUM_PIDFDINFO*\n\nThis *callnum* is currently undocumented.\n\nCallnum 4\n---------\n\n.. note::\n This *callnum* has a liproc-only alias of *PROC_CALLNUM_KERNMSGBUF*\n\nThis *callnum* is currently undocumented.\n\nCallnum 5\n---------\n\n.. note::\n This *callnum* has a liproc-only alias of *PROC_CALLNUM_SETCONTROL*\n\nThis *callnum* is currently undocumented.\n\nCallnum 6\n---------\n\n.. note::\n This *callnum* has a liproc-only alias of *PROC_CALLNUM_PIDFILEPORTINFO*\n\nThis *callnum* is currently undocumented.\n\nHigher-level APIs\n=================\n\nThis library contains a number of higher-level functions that call\n``__proc_info()`` with appropriate arguments, handle buffer allocation and\nreturn friendly pythonic values.\n\nYou can find them below:\n\nCallnum 1\n---------\n\nThe following wrappers exist for this *callnum*:\n\n- :func:`~libproc.get_all_pids()`.\n- :func:`~libproc.get_pids_for_uid()`.\n- :func:`~libproc.get_pids_for_ruid()`.\n- :func:`~libproc.get_pids_for_ppid()`.\n- :func:`~libproc.get_pids_for_pgrp()`.\n- :func:`~libproc.get_pids_for_tty()`.\n\n\n\n\n\nHistory\n=======\n\n0.2 (2015-09-20)\n----------------\n\n* Initial version exposing just *callnum* 1\n (:data:`~libproc.PROC_CALLNUM_LISTPIDS`) along with pythonic wrappers and\n comprehensive demonstration tool (``exampes/listpids.py``)", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/zyga/libproc", "keywords": "libproc.dylib libproc proc bindings", "license": "LGPLv3", "maintainer": null, "maintainer_email": null, "name": "libproc", "package_url": "https://pypi.org/project/libproc/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/libproc/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/zyga/libproc" }, "release_url": "https://pypi.org/project/libproc/0.2/", "requires_dist": null, "requires_python": null, "summary": "Low-level bindings to libproc.dylib", "version": "0.2" }, "last_serial": 1730596, "releases": { "0.2": [ { "comment_text": "", "digests": { "md5": "d93292e7c6f6a6e6d176f15b0bcd58ea", "sha256": "ea3fb61c8d6975c4d671c3ecd4237680bd4958379e1146d6d22bf073be8d3db7" }, "downloads": -1, "filename": "libproc-0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d93292e7c6f6a6e6d176f15b0bcd58ea", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 24108, "upload_time": "2015-09-20T16:37:46", "url": "https://files.pythonhosted.org/packages/7e/ee/a5951a8ab38a2faffda15d9a58d8df772fb00210e103a5b704099340e172/libproc-0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b337201220ace772cfc569dc256eb390", "sha256": "b7cce4b89a8dc23405cb61421a66f391aaf1b69cd10daa6f965f1e3324add0e9" }, "downloads": -1, "filename": "libproc-0.2.tar.gz", "has_sig": false, "md5_digest": "b337201220ace772cfc569dc256eb390", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 28038, "upload_time": "2015-09-20T16:37:39", "url": "https://files.pythonhosted.org/packages/b6/5a/8beaebefc6a612a095bc4f4d9fef2708a7f0b89dd67b739e994feef76d0d/libproc-0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d93292e7c6f6a6e6d176f15b0bcd58ea", "sha256": "ea3fb61c8d6975c4d671c3ecd4237680bd4958379e1146d6d22bf073be8d3db7" }, "downloads": -1, "filename": "libproc-0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d93292e7c6f6a6e6d176f15b0bcd58ea", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 24108, "upload_time": "2015-09-20T16:37:46", "url": "https://files.pythonhosted.org/packages/7e/ee/a5951a8ab38a2faffda15d9a58d8df772fb00210e103a5b704099340e172/libproc-0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b337201220ace772cfc569dc256eb390", "sha256": "b7cce4b89a8dc23405cb61421a66f391aaf1b69cd10daa6f965f1e3324add0e9" }, "downloads": -1, "filename": "libproc-0.2.tar.gz", "has_sig": false, "md5_digest": "b337201220ace772cfc569dc256eb390", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 28038, "upload_time": "2015-09-20T16:37:39", "url": "https://files.pythonhosted.org/packages/b6/5a/8beaebefc6a612a095bc4f4d9fef2708a7f0b89dd67b739e994feef76d0d/libproc-0.2.tar.gz" } ] }