Mercurial > hg > easyhg
comparison src/common.cpp @ 455:856da063d76e
Remove stale auth cache files
author | Chris Cannam |
---|---|
date | Wed, 29 Jun 2011 16:18:47 +0100 |
parents | 8506333fe65c |
children | 533519ebc0cb |
comparison
equal
deleted
inserted
replaced
454:6f5acaf27d60 | 455:856da063d76e |
---|---|
29 #ifdef Q_OS_WIN32 | 29 #ifdef Q_OS_WIN32 |
30 #define _WIN32_WINNT 0x0500 | 30 #define _WIN32_WINNT 0x0500 |
31 #define SECURITY_WIN32 | 31 #define SECURITY_WIN32 |
32 #include <windows.h> | 32 #include <windows.h> |
33 #include <security.h> | 33 #include <security.h> |
34 #include <process.h> | |
34 #else | 35 #else |
35 #include <errno.h> | 36 #include <errno.h> |
36 #include <pwd.h> | 37 #include <pwd.h> |
37 #include <unistd.h> | 38 #include <unistd.h> |
38 #include <sys/ioctl.h> | 39 #include <sys/ioctl.h> |
197 sigaddset(&sgnals, SIGCONT); | 198 sigaddset(&sgnals, SIGCONT); |
198 pthread_sigmask(SIG_BLOCK, &sgnals, 0); | 199 pthread_sigmask(SIG_BLOCK, &sgnals, 0); |
199 #endif | 200 #endif |
200 } | 201 } |
201 | 202 |
203 ProcessStatus | |
204 GetProcessStatus(int pid) | |
205 { | |
206 #ifdef _WIN32 | |
207 HANDLE handle = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid); | |
208 if (!handle) { | |
209 return ProcessNotRunning; | |
210 } else { | |
211 CloseHandle(handle); | |
212 return ProcessRunning; | |
213 } | |
214 #else | |
215 if (kill(getpid(), 0) == 0) { | |
216 if (kill(pid, 0) == 0) { | |
217 return ProcessRunning; | |
218 } else { | |
219 return ProcessNotRunning; | |
220 } | |
221 } else { | |
222 return UnknownProcessStatus; | |
223 } | |
224 #endif | |
225 } | |
226 | |
202 FolderStatus getFolderStatus(QString path) | 227 FolderStatus getFolderStatus(QString path) |
203 { | 228 { |
204 if (path != "/" && path.endsWith("/")) { | 229 if (path != "/" && path.endsWith("/")) { |
205 path = path.left(path.length()-1); | 230 path = path.left(path.length()-1); |
206 } | 231 } |