summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2015-08-06 11:52:42 +0200
committerGiampaolo Rodola <g.rodola@gmail.com>2015-08-06 11:52:42 +0200
commitf6ade0fe9b4f793b026a25a3df52c1715e1749d8 (patch)
tree4856cfba677f34df903718de2ee25ab95a358e9e
parentbf7ce346d8a1ffb4fa499a2a8d70bdcfc3b2b77e (diff)
downloadpsutil-f6ade0fe9b4f793b026a25a3df52c1715e1749d8.tar.gz
C styling
-rw-r--r--psutil/_psutil_bsd.c43
-rw-r--r--psutil/_psutil_linux.c13
-rw-r--r--psutil/_psutil_osx.c7
-rw-r--r--psutil/_psutil_posix.c9
-rw-r--r--psutil/_psutil_sunos.c15
-rw-r--r--psutil/_psutil_windows.c13
-rw-r--r--psutil/arch/bsd/process_info.c15
-rw-r--r--psutil/arch/osx/process_info.c18
-rw-r--r--psutil/arch/windows/inet_ntop.c19
-rw-r--r--psutil/arch/windows/process_handles.c27
-rw-r--r--psutil/arch/windows/process_handles.h6
-rw-r--r--psutil/arch/windows/process_info.c21
-rw-r--r--psutil/arch/windows/security.c9
13 files changed, 81 insertions, 134 deletions
diff --git a/psutil/_psutil_bsd.c b/psutil/_psutil_bsd.c
index 97eddc63..402b9fe8 100644
--- a/psutil/_psutil_bsd.c
+++ b/psutil/_psutil_bsd.c
@@ -69,8 +69,7 @@
* Utility function which fills a kinfo_proc struct based on process pid
*/
static int
-psutil_kinfo_proc(const pid_t pid, struct kinfo_proc *proc)
-{
+psutil_kinfo_proc(const pid_t pid, struct kinfo_proc *proc) {
int mib[4];
size_t size;
mib[0] = CTL_KERN;
@@ -843,8 +842,7 @@ error:
// The tcplist fetching and walking is borrowed from netstat/inet.c.
static char *
-psutil_fetch_tcplist(void)
-{
+psutil_fetch_tcplist(void) {
char *buf;
size_t len;
@@ -868,8 +866,7 @@ psutil_fetch_tcplist(void)
}
static int
-psutil_sockaddr_port(int family, struct sockaddr_storage *ss)
-{
+psutil_sockaddr_port(int family, struct sockaddr_storage *ss) {
struct sockaddr_in6 *sin6;
struct sockaddr_in *sin;
@@ -884,8 +881,7 @@ psutil_sockaddr_port(int family, struct sockaddr_storage *ss)
}
static void *
-psutil_sockaddr_addr(int family, struct sockaddr_storage *ss)
-{
+psutil_sockaddr_addr(int family, struct sockaddr_storage *ss) {
struct sockaddr_in6 *sin6;
struct sockaddr_in *sin;
@@ -900,8 +896,7 @@ psutil_sockaddr_addr(int family, struct sockaddr_storage *ss)
}
static socklen_t
-psutil_sockaddr_addrlen(int family)
-{
+psutil_sockaddr_addrlen(int family) {
if (family == AF_INET)
return (sizeof(struct in_addr));
else
@@ -910,8 +905,7 @@ psutil_sockaddr_addrlen(int family)
static int
psutil_sockaddr_matches(int family, int port, void *pcb_addr,
- struct sockaddr_storage *ss)
-{
+ struct sockaddr_storage *ss) {
if (psutil_sockaddr_port(family, ss) != port)
return (0);
return (memcmp(psutil_sockaddr_addr(family, ss), pcb_addr,
@@ -919,8 +913,7 @@ psutil_sockaddr_matches(int family, int port, void *pcb_addr,
}
static struct tcpcb *
-psutil_search_tcplist(char *buf, struct kinfo_file *kif)
-{
+psutil_search_tcplist(char *buf, struct kinfo_file *kif) {
struct tcpcb *tp;
struct inpcb *inp;
struct xinpgen *xig, *oxig;
@@ -1671,8 +1664,7 @@ static struct xfile *psutil_xfiles;
static int psutil_nxfiles;
int
-psutil_populate_xfiles()
-{
+psutil_populate_xfiles() {
size_t len;
if ((psutil_xfiles = malloc(len = sizeof *psutil_xfiles)) == NULL) {
@@ -1699,8 +1691,7 @@ psutil_populate_xfiles()
}
int
-psutil_get_pid_from_sock(int sock_hash)
-{
+psutil_get_pid_from_sock(int sock_hash) {
struct xfile *xf;
int hash, n;
for (xf = psutil_xfiles, n = 0; n < psutil_nxfiles; ++n, ++xf) {
@@ -1717,8 +1708,7 @@ psutil_get_pid_from_sock(int sock_hash)
// Reference:
// https://gitorious.org/freebsd/freebsd/source/
// f1d6f4778d2044502209708bc167c05f9aa48615:usr.bin/sockstat/sockstat.c
-int psutil_gather_inet(int proto, PyObject *py_retlist)
-{
+int psutil_gather_inet(int proto, PyObject *py_retlist) {
struct xinpgen *xig, *exig;
struct xinpcb *xip;
struct xtcpcb *xtp;
@@ -1858,8 +1848,7 @@ error:
}
-int psutil_gather_unix(int proto, PyObject *py_retlist)
-{
+int psutil_gather_unix(int proto, PyObject *py_retlist) {
struct xunpgen *xug, *exug;
struct xunpcb *xup;
const char *varname = NULL;
@@ -1961,8 +1950,7 @@ error:
* Return system-wide open connections.
*/
static PyObject*
-psutil_net_connections(PyObject* self, PyObject* args)
-{
+psutil_net_connections(PyObject* self, PyObject* args) {
PyObject *py_retlist = PyList_New(0);
if (py_retlist == NULL)
@@ -1993,8 +1981,7 @@ error:
* Reference: http://sources.freebsd.org/RELENG_9/src/usr.bin/cpuset/cpuset.c
*/
static PyObject*
-psutil_proc_cpu_affinity_get(PyObject* self, PyObject* args)
-{
+psutil_proc_cpu_affinity_get(PyObject* self, PyObject* args) {
long pid;
int ret;
int i;
@@ -2092,8 +2079,8 @@ error:
* define the psutil C module methods and initialize the module.
*/
static PyMethodDef
-PsutilMethods[] =
-{
+PsutilMethods[] = {
+
// --- per-process functions
{"proc_name", psutil_proc_name, METH_VARARGS,
diff --git a/psutil/_psutil_linux.c b/psutil/_psutil_linux.c
index 342d844d..5c365939 100644
--- a/psutil/_psutil_linux.c
+++ b/psutil/_psutil_linux.c
@@ -59,14 +59,12 @@ enum {
#endif
static inline int
-ioprio_get(int which, int who)
-{
+ioprio_get(int which, int who) {
return syscall(__NR_ioprio_get, which, who);
}
static inline int
-ioprio_set(int which, int who, int ioprio)
-{
+ioprio_set(int which, int who, int ioprio) {
return syscall(__NR_ioprio_set, which, who, ioprio);
}
@@ -469,8 +467,7 @@ error:
* http://www.i-scream.org/libstatgrab/
*/
static PyObject*
-psutil_net_if_stats(PyObject* self, PyObject* args)
-{
+psutil_net_if_stats(PyObject* self, PyObject* args) {
char *nic_name;
int sock = 0;
int ret;
@@ -547,8 +544,8 @@ error:
* Define the psutil C module methods and initialize the module.
*/
static PyMethodDef
-PsutilMethods[] =
-{
+PsutilMethods[] = {
+
// --- per-process functions
#if PSUTIL_HAVE_IOPRIO
diff --git a/psutil/_psutil_osx.c b/psutil/_psutil_osx.c
index d884ea24..4f0ae2be 100644
--- a/psutil/_psutil_osx.c
+++ b/psutil/_psutil_osx.c
@@ -48,8 +48,7 @@
* A wrapper around host_statistics() invoked with HOST_VM_INFO.
*/
int
-psutil_sys_vminfo(vm_statistics_data_t *vmstat)
-{
+psutil_sys_vminfo(vm_statistics_data_t *vmstat) {
kern_return_t ret;
mach_msg_type_number_t count = sizeof(*vmstat) / sizeof(integer_t);
mach_port_t mport = mach_host_self();
@@ -1618,8 +1617,8 @@ error:
* define the psutil C module methods and initialize the module.
*/
static PyMethodDef
-PsutilMethods[] =
-{
+PsutilMethods[] = {
+
// --- per-process functions
{"proc_name", psutil_proc_name, METH_VARARGS,
diff --git a/psutil/_psutil_posix.c b/psutil/_psutil_posix.c
index 284f7fc5..884a8707 100644
--- a/psutil/_psutil_posix.c
+++ b/psutil/_psutil_posix.c
@@ -74,8 +74,7 @@ psutil_posix_setpriority(PyObject *self, PyObject *args) {
* Return None if address family is not AF_INET* or AF_PACKET.
*/
static PyObject *
-psutil_convert_ipaddr(struct sockaddr *addr, int family)
-{
+psutil_convert_ipaddr(struct sockaddr *addr, int family) {
char buf[NI_MAXHOST];
int err;
int addrlen;
@@ -152,8 +151,7 @@ psutil_convert_ipaddr(struct sockaddr *addr, int family)
* TODO: on Solaris we won't get any MAC address.
*/
static PyObject*
-psutil_net_if_addrs(PyObject* self, PyObject* args)
-{
+psutil_net_if_addrs(PyObject* self, PyObject* args) {
struct ifaddrs *ifaddr, *ifa;
int family;
@@ -467,8 +465,7 @@ error:
* define the psutil C module methods and initialize the module.
*/
static PyMethodDef
-PsutilMethods[] =
-{
+PsutilMethods[] = {
{"getpriority", psutil_posix_getpriority, METH_VARARGS,
"Return process priority"},
{"setpriority", psutil_posix_setpriority, METH_VARARGS,
diff --git a/psutil/_psutil_sunos.c b/psutil/_psutil_sunos.c
index 191b1e0f..e98d90c4 100644
--- a/psutil/_psutil_sunos.c
+++ b/psutil/_psutil_sunos.c
@@ -51,8 +51,7 @@
* Read a file content and fills a C structure with it.
*/
int
-psutil_file_to_struct(char *path, void *fstruct, size_t size)
-{
+psutil_file_to_struct(char *path, void *fstruct, size_t size) {
int fd;
size_t nbytes;
fd = open(path, O_RDONLY);
@@ -193,8 +192,7 @@ psutil_proc_num_ctx_switches(PyObject *self, PyObject *args) {
* ...they should be meaningless anyway.
*
static PyObject*
-proc_io_counters(PyObject* self, PyObject* args)
-{
+proc_io_counters(PyObject* self, PyObject* args) {
int pid;
char path[100];
prusage_t info;
@@ -1134,8 +1132,7 @@ error:
* http://www.i-scream.org/libstatgrab/
*/
static PyObject*
-psutil_net_if_stats(PyObject* self, PyObject* args)
-{
+psutil_net_if_stats(PyObject* self, PyObject* args) {
kstat_ctl_t *kc = NULL;
kstat_t *ksp;
kstat_named_t *knp;
@@ -1241,8 +1238,8 @@ error:
* define the psutil C module methods and initialize the module.
*/
static PyMethodDef
-PsutilMethods[] =
-{
+PsutilMethods[] = {
+
// --- process-related functions
{"proc_basic_info", psutil_proc_basic_info, METH_VARARGS,
"Return process ppid, rss, vms, ctime, nice, nthreads, status and tty"},
@@ -1281,7 +1278,7 @@ PsutilMethods[] =
{"net_if_stats", psutil_net_if_stats, METH_VARARGS,
"Return NIC stats (isup, duplex, speed, mtu)"},
-{NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL}
};
diff --git a/psutil/_psutil_windows.c b/psutil/_psutil_windows.c
index 02fd50ce..b7735097 100644
--- a/psutil/_psutil_windows.c
+++ b/psutil/_psutil_windows.c
@@ -1068,8 +1068,7 @@ error:
* Resume or suspends a process
*/
int
-psutil_proc_suspend_or_resume(DWORD pid, int suspend)
-{
+psutil_proc_suspend_or_resume(DWORD pid, int suspend) {
// a huge thanks to http://www.codeproject.com/KB/threads/pausep.aspx
HANDLE hThreadSnap = NULL;
THREADENTRY32 te32 = {0};
@@ -2319,8 +2318,7 @@ error:
}
-static char *psutil_get_drive_type(int type)
-{
+static char *psutil_get_drive_type(int type) {
switch (type) {
case DRIVE_FIXED:
return "fixed";
@@ -2724,8 +2722,7 @@ psutil_proc_info(PyObject *self, PyObject *args) {
}
-static char *get_region_protection_string(ULONG protection)
-{
+static char *get_region_protection_string(ULONG protection) {
switch (protection & 0xff) {
case PAGE_NOACCESS:
return "";
@@ -3135,8 +3132,8 @@ error:
// ------------------------ Python init ---------------------------
static PyMethodDef
-PsutilMethods[] =
-{
+PsutilMethods[] = {
+
// --- per-process functions
{"proc_cmdline", psutil_proc_cmdline, METH_VARARGS,
diff --git a/psutil/arch/bsd/process_info.c b/psutil/arch/bsd/process_info.c
index 4d739240..a895a436 100644
--- a/psutil/arch/bsd/process_info.c
+++ b/psutil/arch/bsd/process_info.c
@@ -33,8 +33,7 @@
* On error, the function returns a BSD errno value.
*/
int
-psutil_get_proc_list(struct kinfo_proc **procList, size_t *procCount)
-{
+psutil_get_proc_list(struct kinfo_proc **procList, size_t *procCount) {
int err;
struct kinfo_proc *result;
int done;
@@ -113,8 +112,7 @@ psutil_get_proc_list(struct kinfo_proc **procList, size_t *procCount)
char
-*psutil_get_cmd_path(long pid, size_t *pathsize)
-{
+*psutil_get_cmd_path(long pid, size_t *pathsize) {
int mib[4];
char *path;
size_t size = 0;
@@ -161,8 +159,7 @@ char
* 1 for insufficient privileges.
*/
char
-*psutil_get_cmd_args(long pid, size_t *argsize)
-{
+*psutil_get_cmd_args(long pid, size_t *argsize) {
int mib[4], argmax;
size_t size = sizeof(argmax);
char *procargs = NULL;
@@ -204,8 +201,7 @@ char
// returns the command line as a python list object
PyObject *
-psutil_get_arg_list(long pid)
-{
+psutil_get_arg_list(long pid) {
char *argstr = NULL;
int pos = 0;
size_t argsize = 0;
@@ -249,8 +245,7 @@ error:
* Return 1 if PID exists in the current process list, else 0.
*/
int
-psutil_pid_exists(long pid)
-{
+psutil_pid_exists(long pid) {
int kill_ret;
if (pid < 0)
diff --git a/psutil/arch/osx/process_info.c b/psutil/arch/osx/process_info.c
index b6dd5bb9..e0a908e3 100644
--- a/psutil/arch/osx/process_info.c
+++ b/psutil/arch/osx/process_info.c
@@ -27,8 +27,7 @@
* Return 1 if PID exists in the current process list, else 0.
*/
int
-psutil_pid_exists(long pid)
-{
+psutil_pid_exists(long pid) {
int kill_ret;
// save some time if it's an invalid PID
@@ -53,8 +52,7 @@ psutil_pid_exists(long pid)
* On error, the function returns a BSD errno value.
*/
int
-psutil_get_proc_list(kinfo_proc **procList, size_t *procCount)
-{
+psutil_get_proc_list(kinfo_proc **procList, size_t *procCount) {
// Declaring mib as const requires use of a cast since the
// sysctl prototype doesn't include the const modifier.
static const int mib3[3] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL };
@@ -116,8 +114,7 @@ psutil_get_proc_list(kinfo_proc **procList, size_t *procCount)
// Read the maximum argument size for processes
int
-psutil_get_argmax()
-{
+psutil_get_argmax() {
int argmax;
int mib[] = { CTL_KERN, KERN_ARGMAX };
size_t size = sizeof(argmax);
@@ -130,8 +127,7 @@ psutil_get_argmax()
// return process args as a python list
PyObject *
-psutil_get_arg_list(long pid)
-{
+psutil_get_arg_list(long pid) {
int mib[3];
int nargs;
int len;
@@ -226,8 +222,7 @@ error:
int
-psutil_get_kinfo_proc(pid_t pid, struct kinfo_proc *kp)
-{
+psutil_get_kinfo_proc(pid_t pid, struct kinfo_proc *kp) {
int mib[4];
size_t len;
mib[0] = CTL_KERN;
@@ -258,8 +253,7 @@ psutil_get_kinfo_proc(pid_t pid, struct kinfo_proc *kp)
* A thin wrapper around proc_pidinfo()
*/
int
-psutil_proc_pidinfo(long pid, int flavor, void *pti, int size)
-{
+psutil_proc_pidinfo(long pid, int flavor, void *pti, int size) {
int ret = proc_pidinfo((int)pid, flavor, 0, pti, size);
if (ret == 0) {
if (! psutil_pid_exists(pid)) {
diff --git a/psutil/arch/windows/inet_ntop.c b/psutil/arch/windows/inet_ntop.c
index b9fffd1c..50dfb6ae 100644
--- a/psutil/arch/windows/inet_ntop.c
+++ b/psutil/arch/windows/inet_ntop.c
@@ -3,13 +3,10 @@
// From: https://memset.wordpress.com/2010/10/09/inet_ntop-for-win32/
PCSTR
WSAAPI
-inet_ntop(
- __in INT Family,
- __in PVOID pAddr,
- __out_ecount(StringBufSize) PSTR pStringBuf,
- __in size_t StringBufSize
- )
-{
+inet_ntop(__in INT Family,
+ __in PVOID pAddr,
+ __out_ecount(StringBufSize) PSTR pStringBuf,
+ __in size_t StringBufSize) {
DWORD dwAddressLength = 0;
struct sockaddr_storage srcaddr;
struct sockaddr_in *srcaddr4 = (struct sockaddr_in*) &srcaddr;
@@ -31,11 +28,11 @@ inet_ntop(
}
if (WSAAddressToString((LPSOCKADDR) &srcaddr,
- dwAddressLength,
- 0,
- pStringBuf,
+ dwAddressLength,
+ 0,
+ pStringBuf,
(LPDWORD) &StringBufSize) != 0) {
return NULL;
}
return pStringBuf;
-} \ No newline at end of file
+}
diff --git a/psutil/arch/windows/process_handles.c b/psutil/arch/windows/process_handles.c
index b3f480af..2ddfa504 100644
--- a/psutil/arch/windows/process_handles.c
+++ b/psutil/arch/windows/process_handles.c
@@ -23,14 +23,13 @@ PVOID g_fiber = NULL;
PVOID
-GetLibraryProcAddress(PSTR LibraryName, PSTR ProcName)
-{
+GetLibraryProcAddress(PSTR LibraryName, PSTR ProcName) {
return GetProcAddress(GetModuleHandleA(LibraryName), ProcName);
}
+
PyObject *
-psutil_get_open_files(long dwPid, HANDLE hProcess)
-{
+psutil_get_open_files(long dwPid, HANDLE hProcess) {
OSVERSIONINFO osvi;
ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
@@ -44,9 +43,9 @@ psutil_get_open_files(long dwPid, HANDLE hProcess)
return psutil_get_open_files_getmappedfilename(dwPid, hProcess);
}
+
VOID
-psutil_get_open_files_init(BOOL threaded)
-{
+psutil_get_open_files_init(BOOL threaded) {
if (g_initialized == TRUE)
return;
@@ -65,9 +64,9 @@ psutil_get_open_files_init(BOOL threaded)
g_initialized = TRUE;
}
+
PyObject *
-psutil_get_open_files_ntqueryobject(long dwPid, HANDLE hProcess)
-{
+psutil_get_open_files_ntqueryobject(long dwPid, HANDLE hProcess) {
NTSTATUS status;
PSYSTEM_HANDLE_INFORMATION_EX pHandleInfo = NULL;
DWORD dwInfoSize = 0x10000;
@@ -273,9 +272,9 @@ cleanup:
return pyListFiles;
}
+
DWORD
-psutil_NtQueryObject()
-{
+psutil_NtQueryObject() {
DWORD dwWait = 0;
if (g_hThread == NULL)
@@ -312,9 +311,9 @@ psutil_NtQueryObject()
return dwWait;
}
+
void
-psutil_NtQueryObjectThread()
-{
+psutil_NtQueryObjectThread() {
// Prevent the thread stack from leaking when this
// thread gets terminated due to NTQueryObject hanging
g_fiber = ConvertThreadToFiber(NULL);
@@ -332,9 +331,9 @@ psutil_NtQueryObjectThread()
}
}
+
PyObject *
-psutil_get_open_files_getmappedfilename(long dwPid, HANDLE hProcess)
-{
+psutil_get_open_files_getmappedfilename(long dwPid, HANDLE hProcess) {
NTSTATUS status;
PSYSTEM_HANDLE_INFORMATION_EX pHandleInfo = NULL;
DWORD dwInfoSize = 0x10000;
diff --git a/psutil/arch/windows/process_handles.h b/psutil/arch/windows/process_handles.h
index 4cf4023e..ea5fbdbe 100644
--- a/psutil/arch/windows/process_handles.h
+++ b/psutil/arch/windows/process_handles.h
@@ -48,8 +48,7 @@ typedef NTSTATUS (NTAPI *_NtQueryObject)(
// Undocumented FILE_INFORMATION_CLASS: FileNameInformation
static const SYSTEM_INFORMATION_CLASS SystemExtendedHandleInformation = (SYSTEM_INFORMATION_CLASS)64;
-typedef struct _SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX
-{
+typedef struct _SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX {
PVOID Object;
HANDLE UniqueProcessId;
HANDLE HandleValue;
@@ -60,8 +59,7 @@ typedef struct _SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX
ULONG Reserved;
} SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX, *PSYSTEM_HANDLE_TABLE_ENTRY_INFO_EX;
-typedef struct _SYSTEM_HANDLE_INFORMATION_EX
-{
+typedef struct _SYSTEM_HANDLE_INFORMATION_EX {
ULONG_PTR NumberOfHandles;
ULONG_PTR Reserved;
SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX Handles[1];
diff --git a/psutil/arch/windows/process_info.c b/psutil/arch/windows/process_info.c
index a59cce47..b925b05f 100644
--- a/psutil/arch/windows/process_info.c
+++ b/psutil/arch/windows/process_info.c
@@ -26,8 +26,7 @@
* Return a process handle or NULL.
*/
HANDLE
-psutil_handle_from_pid_waccess(DWORD pid, DWORD dwDesiredAccess)
-{
+psutil_handle_from_pid_waccess(DWORD pid, DWORD dwDesiredAccess) {
HANDLE hProcess;
DWORD processExitCode = 0;
@@ -70,8 +69,7 @@ psutil_handle_from_pid(DWORD pid) {
// fetch the PEB base address from NtQueryInformationProcess()
PVOID
-psutil_get_peb_address(HANDLE ProcessHandle)
-{
+psutil_get_peb_address(HANDLE ProcessHandle) {
_NtQueryInformationProcess NtQueryInformationProcess =
(_NtQueryInformationProcess)GetProcAddress(
GetModuleHandleA("ntdll.dll"), "NtQueryInformationProcess");
@@ -121,8 +119,7 @@ psutil_get_pids(DWORD *numberOfReturnedPIDs) {
int
-psutil_pid_is_running(DWORD pid)
-{
+psutil_pid_is_running(DWORD pid) {
HANDLE hProcess;
DWORD exitCode;
@@ -171,8 +168,7 @@ psutil_pid_is_running(DWORD pid)
int
-psutil_pid_in_proclist(DWORD pid)
-{
+psutil_pid_in_proclist(DWORD pid) {
DWORD *proclist = NULL;
DWORD numberOfReturnedPIDs;
DWORD i;
@@ -195,8 +191,7 @@ psutil_pid_in_proclist(DWORD pid)
// Check exit code from a process handle. Return FALSE on an error also
// XXX - not used anymore
int
-handlep_is_running(HANDLE hProcess)
-{
+handlep_is_running(HANDLE hProcess) {
DWORD dwCode;
if (NULL == hProcess)
@@ -214,8 +209,7 @@ handlep_is_running(HANDLE hProcess)
* with given pid or NULL on error.
*/
PyObject *
-psutil_get_arg_list(long pid)
-{
+psutil_get_arg_list(long pid) {
int nArgs, i;
LPWSTR *szArglist = NULL;
HANDLE hProcess = NULL;
@@ -365,8 +359,7 @@ const int STATUS_BUFFER_TOO_SMALL = 0xC0000023L;
*/
int
psutil_get_proc_info(DWORD pid, PSYSTEM_PROCESS_INFORMATION *retProcess,
- PVOID *retBuffer)
-{
+ PVOID *retBuffer) {
static ULONG initialBufferSize = 0x4000;
NTSTATUS status;
PVOID buffer;
diff --git a/psutil/arch/windows/security.c b/psutil/arch/windows/security.c
index 3aabffd0..331d9622 100644
--- a/psutil/arch/windows/security.c
+++ b/psutil/arch/windows/security.c
@@ -108,8 +108,7 @@ psutil_has_system_privilege(HANDLE hProcess) {
BOOL
-psutil_set_privilege(HANDLE hToken, LPCTSTR Privilege, BOOL bEnablePrivilege)
-{
+psutil_set_privilege(HANDLE hToken, LPCTSTR Privilege, BOOL bEnablePrivilege) {
TOKEN_PRIVILEGES tp;
LUID luid;
TOKEN_PRIVILEGES tpPrevious;
@@ -159,8 +158,7 @@ psutil_set_privilege(HANDLE hToken, LPCTSTR Privilege, BOOL bEnablePrivilege)
int
-psutil_set_se_debug()
-{
+psutil_set_se_debug() {
HANDLE hToken;
if (! OpenThreadToken(GetCurrentThread(),
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
@@ -198,8 +196,7 @@ psutil_set_se_debug()
int
-psutil_unset_se_debug()
-{
+psutil_unset_se_debug() {
HANDLE hToken;
if (! OpenThreadToken(GetCurrentThread(),
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,