aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuanma Barranquero2010-09-27 18:27:37 +0200
committerJuanma Barranquero2010-09-27 18:27:37 +0200
commitbedf4aabcfdeeb65a8e6050b1f192cbd679a4172 (patch)
treee4cabb833b59c810775e18e9f01b0a9a061ac2dc
parent08609ffd4c1b513f50712046f955f0a0d68364e0 (diff)
downloademacs-bedf4aabcfdeeb65a8e6050b1f192cbd679a4172.tar.gz
emacs-bedf4aabcfdeeb65a8e6050b1f192cbd679a4172.zip
src/w32.c: Remove unused code and make static many functions.
(g_b_init_get_sid_identifier_authority, GetSidIdentifierAuthority_Proc) (get_sid_identifier_authority): Remove, not used. (globals_of_w32): Don't set g_b_init_get_sid_identifier_authority. (init_winsock): Remove useless assignment. (open_process_token, get_token_information, lookup_account_sid) (get_sid_sub_authority, get_sid_sub_authority_count, get_file_security) (get_security_descriptor_owner, get_security_descriptor_group) (is_valid_sid, equal_sid, get_length_sid, copy_sid) (get_native_system_info, get_system_times, init_user_info, crlf_to_lf) (is_unc_volume, GetCachedVolumeInformation, get_volume_info) (is_fat_volume, open_unc_volume, read_unc_volume, close_unc_volume) (unc_volume_file_attributes, convert_from_time_t) (create_toolhelp32_snapshot, process32_first, process32_next) (open_thread_token, impersonate_self, revert_to_self) (get_process_memory_info, get_process_working_set_size) (global_memory_status, global_memory_status_ex, socket_to_fd) (shutdown_handler): Make static.
-rw-r--r--src/ChangeLog21
-rw-r--r--src/w32.c280
2 files changed, 139 insertions, 162 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 828db3847ad..ca9bc2599a0 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,24 @@
12010-09-27 Juanma Barranquero <lekktu@gmail.com>
2
3 * w32.c (g_b_init_get_sid_identifier_authority)
4 (GetSidIdentifierAuthority_Proc, get_sid_identifier_authority):
5 Remove, not used.
6 (globals_of_w32): Don't set g_b_init_get_sid_identifier_authority.
7 (init_winsock): Remove useless assignment.
8 (open_process_token, get_token_information, lookup_account_sid)
9 (get_sid_sub_authority, get_sid_sub_authority_count, get_file_security)
10 (get_security_descriptor_owner, get_security_descriptor_group)
11 (is_valid_sid, equal_sid, get_length_sid, copy_sid)
12 (get_native_system_info, get_system_times, init_user_info, crlf_to_lf)
13 (is_unc_volume, GetCachedVolumeInformation, get_volume_info)
14 (is_fat_volume, open_unc_volume, read_unc_volume, close_unc_volume)
15 (unc_volume_file_attributes, convert_from_time_t)
16 (create_toolhelp32_snapshot, process32_first, process32_next)
17 (open_thread_token, impersonate_self, revert_to_self)
18 (get_process_memory_info, get_process_working_set_size)
19 (global_memory_status, global_memory_status_ex, socket_to_fd)
20 (shutdown_handler): Make static.
21
12010-09-27 Michael Albinus <michael.albinus@gmx.de> 222010-09-27 Michael Albinus <michael.albinus@gmx.de>
2 23
3 * dbusbind.c (dbus_fd_cb, xd_get_dispatch_status) 24 * dbusbind.c (dbus_fd_cb, xd_get_dispatch_status)
diff --git a/src/w32.c b/src/w32.c
index ed13c3541cc..4ccda449b47 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -78,15 +78,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
78/* Some versions of compiler define MEMORYSTATUSEX, some don't, so we 78/* Some versions of compiler define MEMORYSTATUSEX, some don't, so we
79 use a different name to avoid compilation problems. */ 79 use a different name to avoid compilation problems. */
80typedef struct _MEMORY_STATUS_EX { 80typedef struct _MEMORY_STATUS_EX {
81 DWORD dwLength; 81 DWORD dwLength;
82 DWORD dwMemoryLoad; 82 DWORD dwMemoryLoad;
83 DWORDLONG ullTotalPhys; 83 DWORDLONG ullTotalPhys;
84 DWORDLONG ullAvailPhys; 84 DWORDLONG ullAvailPhys;
85 DWORDLONG ullTotalPageFile; 85 DWORDLONG ullTotalPageFile;
86 DWORDLONG ullAvailPageFile; 86 DWORDLONG ullAvailPageFile;
87 DWORDLONG ullTotalVirtual; 87 DWORDLONG ullTotalVirtual;
88 DWORDLONG ullAvailVirtual; 88 DWORDLONG ullAvailVirtual;
89 DWORDLONG ullAvailExtendedVirtual; 89 DWORDLONG ullAvailExtendedVirtual;
90} MEMORY_STATUS_EX,*LPMEMORY_STATUS_EX; 90} MEMORY_STATUS_EX,*LPMEMORY_STATUS_EX;
91 91
92#include <lmcons.h> 92#include <lmcons.h>
@@ -100,17 +100,17 @@ typedef struct _MEMORY_STATUS_EX {
100 _WIN32_WINNT than what we use. w32api suplied with MinGW 3.15 100 _WIN32_WINNT than what we use. w32api suplied with MinGW 3.15
101 defines it in psapi.h */ 101 defines it in psapi.h */
102typedef struct _PROCESS_MEMORY_COUNTERS_EX { 102typedef struct _PROCESS_MEMORY_COUNTERS_EX {
103 DWORD cb; 103 DWORD cb;
104 DWORD PageFaultCount; 104 DWORD PageFaultCount;
105 DWORD PeakWorkingSetSize; 105 DWORD PeakWorkingSetSize;
106 DWORD WorkingSetSize; 106 DWORD WorkingSetSize;
107 DWORD QuotaPeakPagedPoolUsage; 107 DWORD QuotaPeakPagedPoolUsage;
108 DWORD QuotaPagedPoolUsage; 108 DWORD QuotaPagedPoolUsage;
109 DWORD QuotaPeakNonPagedPoolUsage; 109 DWORD QuotaPeakNonPagedPoolUsage;
110 DWORD QuotaNonPagedPoolUsage; 110 DWORD QuotaNonPagedPoolUsage;
111 DWORD PagefileUsage; 111 DWORD PagefileUsage;
112 DWORD PeakPagefileUsage; 112 DWORD PeakPagefileUsage;
113 DWORD PrivateUsage; 113 DWORD PrivateUsage;
114} PROCESS_MEMORY_COUNTERS_EX,*PPROCESS_MEMORY_COUNTERS_EX; 114} PROCESS_MEMORY_COUNTERS_EX,*PPROCESS_MEMORY_COUNTERS_EX;
115#endif 115#endif
116 116
@@ -172,7 +172,6 @@ static BOOL g_b_init_is_windows_9x;
172static BOOL g_b_init_open_process_token; 172static BOOL g_b_init_open_process_token;
173static BOOL g_b_init_get_token_information; 173static BOOL g_b_init_get_token_information;
174static BOOL g_b_init_lookup_account_sid; 174static BOOL g_b_init_lookup_account_sid;
175static BOOL g_b_init_get_sid_identifier_authority;
176static BOOL g_b_init_get_sid_sub_authority; 175static BOOL g_b_init_get_sid_sub_authority;
177static BOOL g_b_init_get_sid_sub_authority_count; 176static BOOL g_b_init_get_sid_sub_authority_count;
178static BOOL g_b_init_get_file_security; 177static BOOL g_b_init_get_file_security;
@@ -235,8 +234,6 @@ typedef BOOL (WINAPI * LookupAccountSid_Proc) (
235 LPTSTR DomainName, 234 LPTSTR DomainName,
236 LPDWORD cbDomainName, 235 LPDWORD cbDomainName,
237 PSID_NAME_USE peUse); 236 PSID_NAME_USE peUse);
238typedef PSID_IDENTIFIER_AUTHORITY (WINAPI * GetSidIdentifierAuthority_Proc) (
239 PSID pSid);
240typedef PDWORD (WINAPI * GetSidSubAuthority_Proc) ( 237typedef PDWORD (WINAPI * GetSidSubAuthority_Proc) (
241 PSID pSid, 238 PSID pSid,
242 DWORD n); 239 DWORD n);
@@ -303,13 +300,11 @@ typedef BOOL (WINAPI * GetSystemTimes_Proc) (
303 LPFILETIME lpKernelTime, 300 LPFILETIME lpKernelTime,
304 LPFILETIME lpUserTime); 301 LPFILETIME lpUserTime);
305 302
306
307
308 /* ** A utility function ** */ 303 /* ** A utility function ** */
309static BOOL 304static BOOL
310is_windows_9x (void) 305is_windows_9x (void)
311{ 306{
312 static BOOL s_b_ret=0; 307 static BOOL s_b_ret = 0;
313 OSVERSIONINFO os_ver; 308 OSVERSIONINFO os_ver;
314 if (g_b_init_is_windows_9x == 0) 309 if (g_b_init_is_windows_9x == 0)
315 { 310 {
@@ -366,10 +361,10 @@ w32_get_internal_run_time (void)
366 361
367 /* ** The wrapper functions ** */ 362 /* ** The wrapper functions ** */
368 363
369BOOL WINAPI open_process_token ( 364static BOOL WINAPI
370 HANDLE ProcessHandle, 365open_process_token (HANDLE ProcessHandle,
371 DWORD DesiredAccess, 366 DWORD DesiredAccess,
372 PHANDLE TokenHandle) 367 PHANDLE TokenHandle)
373{ 368{
374 static OpenProcessToken_Proc s_pfn_Open_Process_Token = NULL; 369 static OpenProcessToken_Proc s_pfn_Open_Process_Token = NULL;
375 HMODULE hm_advapi32 = NULL; 370 HMODULE hm_advapi32 = NULL;
@@ -396,12 +391,12 @@ BOOL WINAPI open_process_token (
396 ); 391 );
397} 392}
398 393
399BOOL WINAPI get_token_information ( 394static BOOL WINAPI
400 HANDLE TokenHandle, 395get_token_information (HANDLE TokenHandle,
401 TOKEN_INFORMATION_CLASS TokenInformationClass, 396 TOKEN_INFORMATION_CLASS TokenInformationClass,
402 LPVOID TokenInformation, 397 LPVOID TokenInformation,
403 DWORD TokenInformationLength, 398 DWORD TokenInformationLength,
404 PDWORD ReturnLength) 399 PDWORD ReturnLength)
405{ 400{
406 static GetTokenInformation_Proc s_pfn_Get_Token_Information = NULL; 401 static GetTokenInformation_Proc s_pfn_Get_Token_Information = NULL;
407 HMODULE hm_advapi32 = NULL; 402 HMODULE hm_advapi32 = NULL;
@@ -430,14 +425,14 @@ BOOL WINAPI get_token_information (
430 ); 425 );
431} 426}
432 427
433BOOL WINAPI lookup_account_sid ( 428static BOOL WINAPI
434 LPCTSTR lpSystemName, 429lookup_account_sid (LPCTSTR lpSystemName,
435 PSID Sid, 430 PSID Sid,
436 LPTSTR Name, 431 LPTSTR Name,
437 LPDWORD cbName, 432 LPDWORD cbName,
438 LPTSTR DomainName, 433 LPTSTR DomainName,
439 LPDWORD cbDomainName, 434 LPDWORD cbDomainName,
440 PSID_NAME_USE peUse) 435 PSID_NAME_USE peUse)
441{ 436{
442 static LookupAccountSid_Proc s_pfn_Lookup_Account_Sid = NULL; 437 static LookupAccountSid_Proc s_pfn_Lookup_Account_Sid = NULL;
443 HMODULE hm_advapi32 = NULL; 438 HMODULE hm_advapi32 = NULL;
@@ -468,33 +463,8 @@ BOOL WINAPI lookup_account_sid (
468 ); 463 );
469} 464}
470 465
471PSID_IDENTIFIER_AUTHORITY WINAPI get_sid_identifier_authority ( 466static PDWORD WINAPI
472 PSID pSid) 467get_sid_sub_authority (PSID pSid, DWORD n)
473{
474 static GetSidIdentifierAuthority_Proc s_pfn_Get_Sid_Identifier_Authority = NULL;
475 HMODULE hm_advapi32 = NULL;
476 if (is_windows_9x () == TRUE)
477 {
478 return NULL;
479 }
480 if (g_b_init_get_sid_identifier_authority == 0)
481 {
482 g_b_init_get_sid_identifier_authority = 1;
483 hm_advapi32 = LoadLibrary ("Advapi32.dll");
484 s_pfn_Get_Sid_Identifier_Authority =
485 (GetSidIdentifierAuthority_Proc) GetProcAddress (
486 hm_advapi32, "GetSidIdentifierAuthority");
487 }
488 if (s_pfn_Get_Sid_Identifier_Authority == NULL)
489 {
490 return NULL;
491 }
492 return (s_pfn_Get_Sid_Identifier_Authority (pSid));
493}
494
495PDWORD WINAPI get_sid_sub_authority (
496 PSID pSid,
497 DWORD n)
498{ 468{
499 static GetSidSubAuthority_Proc s_pfn_Get_Sid_Sub_Authority = NULL; 469 static GetSidSubAuthority_Proc s_pfn_Get_Sid_Sub_Authority = NULL;
500 static DWORD zero = 0U; 470 static DWORD zero = 0U;
@@ -518,8 +488,8 @@ PDWORD WINAPI get_sid_sub_authority (
518 return (s_pfn_Get_Sid_Sub_Authority (pSid, n)); 488 return (s_pfn_Get_Sid_Sub_Authority (pSid, n));
519} 489}
520 490
521PUCHAR WINAPI get_sid_sub_authority_count ( 491static PUCHAR WINAPI
522 PSID pSid) 492get_sid_sub_authority_count (PSID pSid)
523{ 493{
524 static GetSidSubAuthorityCount_Proc s_pfn_Get_Sid_Sub_Authority_Count = NULL; 494 static GetSidSubAuthorityCount_Proc s_pfn_Get_Sid_Sub_Authority_Count = NULL;
525 static UCHAR zero = 0U; 495 static UCHAR zero = 0U;
@@ -543,12 +513,12 @@ PUCHAR WINAPI get_sid_sub_authority_count (
543 return (s_pfn_Get_Sid_Sub_Authority_Count (pSid)); 513 return (s_pfn_Get_Sid_Sub_Authority_Count (pSid));
544} 514}
545 515
546BOOL WINAPI get_file_security ( 516static BOOL WINAPI
547 LPCTSTR lpFileName, 517get_file_security (LPCTSTR lpFileName,
548 SECURITY_INFORMATION RequestedInformation, 518 SECURITY_INFORMATION RequestedInformation,
549 PSECURITY_DESCRIPTOR pSecurityDescriptor, 519 PSECURITY_DESCRIPTOR pSecurityDescriptor,
550 DWORD nLength, 520 DWORD nLength,
551 LPDWORD lpnLengthNeeded) 521 LPDWORD lpnLengthNeeded)
552{ 522{
553 static GetFileSecurity_Proc s_pfn_Get_File_Security = NULL; 523 static GetFileSecurity_Proc s_pfn_Get_File_Security = NULL;
554 HMODULE hm_advapi32 = NULL; 524 HMODULE hm_advapi32 = NULL;
@@ -573,10 +543,10 @@ BOOL WINAPI get_file_security (
573 lpnLengthNeeded)); 543 lpnLengthNeeded));
574} 544}
575 545
576BOOL WINAPI get_security_descriptor_owner ( 546static BOOL WINAPI
577 PSECURITY_DESCRIPTOR pSecurityDescriptor, 547get_security_descriptor_owner (PSECURITY_DESCRIPTOR pSecurityDescriptor,
578 PSID *pOwner, 548 PSID *pOwner,
579 LPBOOL lpbOwnerDefaulted) 549 LPBOOL lpbOwnerDefaulted)
580{ 550{
581 static GetSecurityDescriptorOwner_Proc s_pfn_Get_Security_Descriptor_Owner = NULL; 551 static GetSecurityDescriptorOwner_Proc s_pfn_Get_Security_Descriptor_Owner = NULL;
582 HMODULE hm_advapi32 = NULL; 552 HMODULE hm_advapi32 = NULL;
@@ -600,10 +570,10 @@ BOOL WINAPI get_security_descriptor_owner (
600 lpbOwnerDefaulted)); 570 lpbOwnerDefaulted));
601} 571}
602 572
603BOOL WINAPI get_security_descriptor_group ( 573static BOOL WINAPI
604 PSECURITY_DESCRIPTOR pSecurityDescriptor, 574get_security_descriptor_group (PSECURITY_DESCRIPTOR pSecurityDescriptor,
605 PSID *pGroup, 575 PSID *pGroup,
606 LPBOOL lpbGroupDefaulted) 576 LPBOOL lpbGroupDefaulted)
607{ 577{
608 static GetSecurityDescriptorGroup_Proc s_pfn_Get_Security_Descriptor_Group = NULL; 578 static GetSecurityDescriptorGroup_Proc s_pfn_Get_Security_Descriptor_Group = NULL;
609 HMODULE hm_advapi32 = NULL; 579 HMODULE hm_advapi32 = NULL;
@@ -627,8 +597,8 @@ BOOL WINAPI get_security_descriptor_group (
627 lpbGroupDefaulted)); 597 lpbGroupDefaulted));
628} 598}
629 599
630BOOL WINAPI is_valid_sid ( 600static BOOL WINAPI
631 PSID sid) 601is_valid_sid (PSID sid)
632{ 602{
633 static IsValidSid_Proc s_pfn_Is_Valid_Sid = NULL; 603 static IsValidSid_Proc s_pfn_Is_Valid_Sid = NULL;
634 HMODULE hm_advapi32 = NULL; 604 HMODULE hm_advapi32 = NULL;
@@ -651,9 +621,8 @@ BOOL WINAPI is_valid_sid (
651 return (s_pfn_Is_Valid_Sid (sid)); 621 return (s_pfn_Is_Valid_Sid (sid));
652} 622}
653 623
654BOOL WINAPI equal_sid ( 624static BOOL WINAPI
655 PSID sid1, 625equal_sid (PSID sid1, PSID sid2)
656 PSID sid2)
657{ 626{
658 static EqualSid_Proc s_pfn_Equal_Sid = NULL; 627 static EqualSid_Proc s_pfn_Equal_Sid = NULL;
659 HMODULE hm_advapi32 = NULL; 628 HMODULE hm_advapi32 = NULL;
@@ -676,8 +645,8 @@ BOOL WINAPI equal_sid (
676 return (s_pfn_Equal_Sid (sid1, sid2)); 645 return (s_pfn_Equal_Sid (sid1, sid2));
677} 646}
678 647
679DWORD WINAPI get_length_sid ( 648static DWORD WINAPI
680 PSID sid) 649get_length_sid (PSID sid)
681{ 650{
682 static GetLengthSid_Proc s_pfn_Get_Length_Sid = NULL; 651 static GetLengthSid_Proc s_pfn_Get_Length_Sid = NULL;
683 HMODULE hm_advapi32 = NULL; 652 HMODULE hm_advapi32 = NULL;
@@ -700,10 +669,8 @@ DWORD WINAPI get_length_sid (
700 return (s_pfn_Get_Length_Sid (sid)); 669 return (s_pfn_Get_Length_Sid (sid));
701} 670}
702 671
703BOOL WINAPI copy_sid ( 672static BOOL WINAPI
704 DWORD destlen, 673copy_sid (DWORD destlen, PSID dest, PSID src)
705 PSID dest,
706 PSID src)
707{ 674{
708 static CopySid_Proc s_pfn_Copy_Sid = NULL; 675 static CopySid_Proc s_pfn_Copy_Sid = NULL;
709 HMODULE hm_advapi32 = NULL; 676 HMODULE hm_advapi32 = NULL;
@@ -732,8 +699,8 @@ BOOL WINAPI copy_sid (
732 supported in Windows NT / 2k / XP 699 supported in Windows NT / 2k / XP
733*/ 700*/
734 701
735void WINAPI get_native_system_info ( 702static void WINAPI
736 LPSYSTEM_INFO lpSystemInfo) 703get_native_system_info (LPSYSTEM_INFO lpSystemInfo)
737{ 704{
738 static GetNativeSystemInfo_Proc s_pfn_Get_Native_System_Info = NULL; 705 static GetNativeSystemInfo_Proc s_pfn_Get_Native_System_Info = NULL;
739 if (is_windows_9x () != TRUE) 706 if (is_windows_9x () != TRUE)
@@ -752,10 +719,10 @@ void WINAPI get_native_system_info (
752 lpSystemInfo->dwNumberOfProcessors = -1; 719 lpSystemInfo->dwNumberOfProcessors = -1;
753} 720}
754 721
755BOOL WINAPI get_system_times ( 722static BOOL WINAPI
756 LPFILETIME lpIdleTime, 723get_system_times (LPFILETIME lpIdleTime,
757 LPFILETIME lpKernelTime, 724 LPFILETIME lpKernelTime,
758 LPFILETIME lpUserTime) 725 LPFILETIME lpUserTime)
759{ 726{
760 static GetSystemTimes_Proc s_pfn_Get_System_times = NULL; 727 static GetSystemTimes_Proc s_pfn_Get_System_times = NULL;
761 if (is_windows_9x () == TRUE) 728 if (is_windows_9x () == TRUE)
@@ -1078,7 +1045,7 @@ getpwnam (char *name)
1078 return pw; 1045 return pw;
1079} 1046}
1080 1047
1081void 1048static void
1082init_user_info (void) 1049init_user_info (void)
1083{ 1050{
1084 /* Find the user's real name by opening the process token and 1051 /* Find the user's real name by opening the process token and
@@ -1284,7 +1251,7 @@ unixtodos_filename (register char *p)
1284/* Remove all CR's that are followed by a LF. 1251/* Remove all CR's that are followed by a LF.
1285 (From msdos.c...probably should figure out a way to share it, 1252 (From msdos.c...probably should figure out a way to share it,
1286 although this code isn't going to ever change.) */ 1253 although this code isn't going to ever change.) */
1287int 1254static int
1288crlf_to_lf (register int n, register unsigned char *buf) 1255crlf_to_lf (register int n, register unsigned char *buf)
1289{ 1256{
1290 unsigned char *np = buf; 1257 unsigned char *np = buf;
@@ -1423,7 +1390,7 @@ w32_get_long_filename (char * name, char * buf, int size)
1423 return TRUE; 1390 return TRUE;
1424} 1391}
1425 1392
1426int 1393static int
1427is_unc_volume (const char *filename) 1394is_unc_volume (const char *filename)
1428{ 1395{
1429 const char *ptr = filename; 1396 const char *ptr = filename;
@@ -2079,7 +2046,7 @@ add_volume_info (char * root_dir, volume_info_data * info)
2079/* Wrapper for GetVolumeInformation, which uses caching to avoid 2046/* Wrapper for GetVolumeInformation, which uses caching to avoid
2080 performance penalty (~2ms on 486 for local drives, 7.5ms for local 2047 performance penalty (~2ms on 486 for local drives, 7.5ms for local
2081 cdrom drive, ~5-10ms or more for remote drives on LAN). */ 2048 cdrom drive, ~5-10ms or more for remote drives on LAN). */
2082volume_info_data * 2049static volume_info_data *
2083GetCachedVolumeInformation (char * root_dir) 2050GetCachedVolumeInformation (char * root_dir)
2084{ 2051{
2085 volume_info_data * info; 2052 volume_info_data * info;
@@ -2170,7 +2137,7 @@ GetCachedVolumeInformation (char * root_dir)
2170 2137
2171/* Get information on the volume where name is held; set path pointer to 2138/* Get information on the volume where name is held; set path pointer to
2172 start of pathname in name (past UNC header\volume header if present). */ 2139 start of pathname in name (past UNC header\volume header if present). */
2173int 2140static int
2174get_volume_info (const char * name, const char ** pPath) 2141get_volume_info (const char * name, const char ** pPath)
2175{ 2142{
2176 char temp[MAX_PATH]; 2143 char temp[MAX_PATH];
@@ -2221,7 +2188,7 @@ get_volume_info (const char * name, const char ** pPath)
2221 2188
2222/* Determine if volume is FAT format (ie. only supports short 8.3 2189/* Determine if volume is FAT format (ie. only supports short 8.3
2223 names); also set path pointer to start of pathname in name. */ 2190 names); also set path pointer to start of pathname in name. */
2224int 2191static int
2225is_fat_volume (const char * name, const char ** pPath) 2192is_fat_volume (const char * name, const char ** pPath)
2226{ 2193{
2227 if (get_volume_info (name, pPath)) 2194 if (get_volume_info (name, pPath))
@@ -2359,9 +2326,9 @@ static WIN32_FIND_DATA dir_find_data;
2359/* Support shares on a network resource as subdirectories of a read-only 2326/* Support shares on a network resource as subdirectories of a read-only
2360 root directory. */ 2327 root directory. */
2361static HANDLE wnet_enum_handle = INVALID_HANDLE_VALUE; 2328static HANDLE wnet_enum_handle = INVALID_HANDLE_VALUE;
2362HANDLE open_unc_volume (const char *); 2329static HANDLE open_unc_volume (const char *);
2363char *read_unc_volume (HANDLE, char *, int); 2330static char *read_unc_volume (HANDLE, char *, int);
2364void close_unc_volume (HANDLE); 2331static void close_unc_volume (HANDLE);
2365 2332
2366DIR * 2333DIR *
2367opendir (char *filename) 2334opendir (char *filename)
@@ -2497,7 +2464,7 @@ readdir (DIR *dirp)
2497 return &dir_static; 2464 return &dir_static;
2498} 2465}
2499 2466
2500HANDLE 2467static HANDLE
2501open_unc_volume (const char *path) 2468open_unc_volume (const char *path)
2502{ 2469{
2503 NETRESOURCE nr; 2470 NETRESOURCE nr;
@@ -2522,7 +2489,7 @@ open_unc_volume (const char *path)
2522 return INVALID_HANDLE_VALUE; 2489 return INVALID_HANDLE_VALUE;
2523} 2490}
2524 2491
2525char * 2492static char *
2526read_unc_volume (HANDLE henum, char *readbuf, int size) 2493read_unc_volume (HANDLE henum, char *readbuf, int size)
2527{ 2494{
2528 DWORD count; 2495 DWORD count;
@@ -2547,14 +2514,14 @@ read_unc_volume (HANDLE henum, char *readbuf, int size)
2547 return readbuf; 2514 return readbuf;
2548} 2515}
2549 2516
2550void 2517static void
2551close_unc_volume (HANDLE henum) 2518close_unc_volume (HANDLE henum)
2552{ 2519{
2553 if (henum != INVALID_HANDLE_VALUE) 2520 if (henum != INVALID_HANDLE_VALUE)
2554 WNetCloseEnum (henum); 2521 WNetCloseEnum (henum);
2555} 2522}
2556 2523
2557DWORD 2524static DWORD
2558unc_volume_file_attributes (const char *path) 2525unc_volume_file_attributes (const char *path)
2559{ 2526{
2560 HANDLE henum; 2527 HANDLE henum;
@@ -3014,8 +2981,7 @@ convert_time (FILETIME ft)
3014 return (time_t) ((tmp - utc_base) / 10000000L); 2981 return (time_t) ((tmp - utc_base) / 10000000L);
3015} 2982}
3016 2983
3017 2984static void
3018void
3019convert_from_time_t (time_t time, FILETIME * pft) 2985convert_from_time_t (time_t time, FILETIME * pft)
3020{ 2986{
3021 ULARGE_INTEGER tmp; 2987 ULARGE_INTEGER tmp;
@@ -3236,10 +3202,9 @@ get_name_and_id (PSECURITY_DESCRIPTOR psd, const char *fname,
3236} 3202}
3237 3203
3238static void 3204static void
3239get_file_owner_and_group ( 3205get_file_owner_and_group (PSECURITY_DESCRIPTOR psd,
3240 PSECURITY_DESCRIPTOR psd, 3206 const char *fname,
3241 const char *fname, 3207 struct stat *st)
3242 struct stat *st)
3243{ 3208{
3244 int dflt_usr = 0, dflt_grp = 0; 3209 int dflt_usr = 0, dflt_grp = 0;
3245 3210
@@ -3492,7 +3457,6 @@ stat (const char * path, struct stat * buf)
3492 buf->st_dev = volume_info.serialnum; 3457 buf->st_dev = volume_info.serialnum;
3493 buf->st_rdev = volume_info.serialnum; 3458 buf->st_rdev = volume_info.serialnum;
3494 3459
3495
3496 buf->st_size = wfd.nFileSizeHigh; 3460 buf->st_size = wfd.nFileSizeHigh;
3497 buf->st_size <<= 32; 3461 buf->st_size <<= 32;
3498 buf->st_size += wfd.nFileSizeLow; 3462 buf->st_size += wfd.nFileSizeLow;
@@ -3665,9 +3629,8 @@ utime (const char *name, struct utimbuf *times)
3665 3629
3666/* Helper wrapper functions. */ 3630/* Helper wrapper functions. */
3667 3631
3668HANDLE WINAPI create_toolhelp32_snapshot ( 3632static HANDLE WINAPI
3669 DWORD Flags, 3633create_toolhelp32_snapshot (DWORD Flags, DWORD Ignored)
3670 DWORD Ignored)
3671{ 3634{
3672 static CreateToolhelp32Snapshot_Proc s_pfn_Create_Toolhelp32_Snapshot = NULL; 3635 static CreateToolhelp32Snapshot_Proc s_pfn_Create_Toolhelp32_Snapshot = NULL;
3673 3636
@@ -3685,9 +3648,8 @@ HANDLE WINAPI create_toolhelp32_snapshot (
3685 return (s_pfn_Create_Toolhelp32_Snapshot (Flags, Ignored)); 3648 return (s_pfn_Create_Toolhelp32_Snapshot (Flags, Ignored));
3686} 3649}
3687 3650
3688BOOL WINAPI process32_first ( 3651static BOOL WINAPI
3689 HANDLE hSnapshot, 3652process32_first (HANDLE hSnapshot, LPPROCESSENTRY32 lppe)
3690 LPPROCESSENTRY32 lppe)
3691{ 3653{
3692 static Process32First_Proc s_pfn_Process32_First = NULL; 3654 static Process32First_Proc s_pfn_Process32_First = NULL;
3693 3655
@@ -3705,9 +3667,8 @@ BOOL WINAPI process32_first (
3705 return (s_pfn_Process32_First (hSnapshot, lppe)); 3667 return (s_pfn_Process32_First (hSnapshot, lppe));
3706} 3668}
3707 3669
3708BOOL WINAPI process32_next ( 3670static BOOL WINAPI
3709 HANDLE hSnapshot, 3671process32_next (HANDLE hSnapshot, LPPROCESSENTRY32 lppe)
3710 LPPROCESSENTRY32 lppe)
3711{ 3672{
3712 static Process32Next_Proc s_pfn_Process32_Next = NULL; 3673 static Process32Next_Proc s_pfn_Process32_Next = NULL;
3713 3674
@@ -3725,11 +3686,11 @@ BOOL WINAPI process32_next (
3725 return (s_pfn_Process32_Next (hSnapshot, lppe)); 3686 return (s_pfn_Process32_Next (hSnapshot, lppe));
3726} 3687}
3727 3688
3728BOOL WINAPI open_thread_token ( 3689static BOOL WINAPI
3729 HANDLE ThreadHandle, 3690open_thread_token (HANDLE ThreadHandle,
3730 DWORD DesiredAccess, 3691 DWORD DesiredAccess,
3731 BOOL OpenAsSelf, 3692 BOOL OpenAsSelf,
3732 PHANDLE TokenHandle) 3693 PHANDLE TokenHandle)
3733{ 3694{
3734 static OpenThreadToken_Proc s_pfn_Open_Thread_Token = NULL; 3695 static OpenThreadToken_Proc s_pfn_Open_Thread_Token = NULL;
3735 HMODULE hm_advapi32 = NULL; 3696 HMODULE hm_advapi32 = NULL;
@@ -3759,8 +3720,8 @@ BOOL WINAPI open_thread_token (
3759 ); 3720 );
3760} 3721}
3761 3722
3762BOOL WINAPI impersonate_self ( 3723static BOOL WINAPI
3763 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel) 3724impersonate_self (SECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
3764{ 3725{
3765 static ImpersonateSelf_Proc s_pfn_Impersonate_Self = NULL; 3726 static ImpersonateSelf_Proc s_pfn_Impersonate_Self = NULL;
3766 HMODULE hm_advapi32 = NULL; 3727 HMODULE hm_advapi32 = NULL;
@@ -3782,7 +3743,8 @@ BOOL WINAPI impersonate_self (
3782 return s_pfn_Impersonate_Self (ImpersonationLevel); 3743 return s_pfn_Impersonate_Self (ImpersonationLevel);
3783} 3744}
3784 3745
3785BOOL WINAPI revert_to_self (void) 3746static BOOL WINAPI
3747revert_to_self (void)
3786{ 3748{
3787 static RevertToSelf_Proc s_pfn_Revert_To_Self = NULL; 3749 static RevertToSelf_Proc s_pfn_Revert_To_Self = NULL;
3788 HMODULE hm_advapi32 = NULL; 3750 HMODULE hm_advapi32 = NULL;
@@ -3804,10 +3766,10 @@ BOOL WINAPI revert_to_self (void)
3804 return s_pfn_Revert_To_Self (); 3766 return s_pfn_Revert_To_Self ();
3805} 3767}
3806 3768
3807BOOL WINAPI get_process_memory_info ( 3769static BOOL WINAPI
3808 HANDLE h_proc, 3770get_process_memory_info (HANDLE h_proc,
3809 PPROCESS_MEMORY_COUNTERS mem_counters, 3771 PPROCESS_MEMORY_COUNTERS mem_counters,
3810 DWORD bufsize) 3772 DWORD bufsize)
3811{ 3773{
3812 static GetProcessMemoryInfo_Proc s_pfn_Get_Process_Memory_Info = NULL; 3774 static GetProcessMemoryInfo_Proc s_pfn_Get_Process_Memory_Info = NULL;
3813 HMODULE hm_psapi = NULL; 3775 HMODULE hm_psapi = NULL;
@@ -3830,10 +3792,10 @@ BOOL WINAPI get_process_memory_info (
3830 return s_pfn_Get_Process_Memory_Info (h_proc, mem_counters, bufsize); 3792 return s_pfn_Get_Process_Memory_Info (h_proc, mem_counters, bufsize);
3831} 3793}
3832 3794
3833BOOL WINAPI get_process_working_set_size ( 3795static BOOL WINAPI
3834 HANDLE h_proc, 3796get_process_working_set_size (HANDLE h_proc,
3835 DWORD *minrss, 3797 DWORD *minrss,
3836 DWORD *maxrss) 3798 DWORD *maxrss)
3837{ 3799{
3838 static GetProcessWorkingSetSize_Proc 3800 static GetProcessWorkingSetSize_Proc
3839 s_pfn_Get_Process_Working_Set_Size = NULL; 3801 s_pfn_Get_Process_Working_Set_Size = NULL;
@@ -3856,8 +3818,8 @@ BOOL WINAPI get_process_working_set_size (
3856 return s_pfn_Get_Process_Working_Set_Size (h_proc, minrss, maxrss); 3818 return s_pfn_Get_Process_Working_Set_Size (h_proc, minrss, maxrss);
3857} 3819}
3858 3820
3859BOOL WINAPI global_memory_status ( 3821static BOOL WINAPI
3860 MEMORYSTATUS *buf) 3822global_memory_status (MEMORYSTATUS *buf)
3861{ 3823{
3862 static GlobalMemoryStatus_Proc s_pfn_Global_Memory_Status = NULL; 3824 static GlobalMemoryStatus_Proc s_pfn_Global_Memory_Status = NULL;
3863 3825
@@ -3879,8 +3841,8 @@ BOOL WINAPI global_memory_status (
3879 return s_pfn_Global_Memory_Status (buf); 3841 return s_pfn_Global_Memory_Status (buf);
3880} 3842}
3881 3843
3882BOOL WINAPI global_memory_status_ex ( 3844static BOOL WINAPI
3883 MEMORY_STATUS_EX *buf) 3845global_memory_status_ex (MEMORY_STATUS_EX *buf)
3884{ 3846{
3885 static GlobalMemoryStatusEx_Proc s_pfn_Global_Memory_Status_Ex = NULL; 3847 static GlobalMemoryStatusEx_Proc s_pfn_Global_Memory_Status_Ex = NULL;
3886 3848
@@ -4438,7 +4400,6 @@ init_winsock (int load_now)
4438 if (winsock_lib != NULL) 4400 if (winsock_lib != NULL)
4439 return TRUE; 4401 return TRUE;
4440 4402
4441 pfn_SetHandleInformation = NULL;
4442 pfn_SetHandleInformation 4403 pfn_SetHandleInformation
4443 = (void *) GetProcAddress (GetModuleHandle ("kernel32.dll"), 4404 = (void *) GetProcAddress (GetModuleHandle ("kernel32.dll"),
4444 "SetHandleInformation"); 4405 "SetHandleInformation");
@@ -4647,7 +4608,7 @@ sys_strerror (int error_no)
4647 4608
4648#define SOCK_HANDLE(fd) ((SOCKET) fd_info[fd].hnd) 4609#define SOCK_HANDLE(fd) ((SOCKET) fd_info[fd].hnd)
4649 4610
4650int socket_to_fd (SOCKET s); 4611static int socket_to_fd (SOCKET s);
4651 4612
4652int 4613int
4653sys_socket (int af, int type, int protocol) 4614sys_socket (int af, int type, int protocol)
@@ -4673,7 +4634,7 @@ sys_socket (int af, int type, int protocol)
4673} 4634}
4674 4635
4675/* Convert a SOCKET to a file descriptor. */ 4636/* Convert a SOCKET to a file descriptor. */
4676int 4637static int
4677socket_to_fd (SOCKET s) 4638socket_to_fd (SOCKET s)
4678{ 4639{
4679 int fd; 4640 int fd;
@@ -4766,7 +4727,6 @@ socket_to_fd (SOCKET s)
4766 return -1; 4727 return -1;
4767} 4728}
4768 4729
4769
4770int 4730int
4771sys_bind (int s, const struct sockaddr * addr, int namelen) 4731sys_bind (int s, const struct sockaddr * addr, int namelen)
4772{ 4732{
@@ -4788,7 +4748,6 @@ sys_bind (int s, const struct sockaddr * addr, int namelen)
4788 return SOCKET_ERROR; 4748 return SOCKET_ERROR;
4789} 4749}
4790 4750
4791
4792int 4751int
4793sys_connect (int s, const struct sockaddr * name, int namelen) 4752sys_connect (int s, const struct sockaddr * name, int namelen)
4794{ 4753{
@@ -4901,7 +4860,6 @@ sys_getpeername (int s, struct sockaddr *addr, int * namelen)
4901 return SOCKET_ERROR; 4860 return SOCKET_ERROR;
4902} 4861}
4903 4862
4904
4905int 4863int
4906sys_shutdown (int s, int how) 4864sys_shutdown (int s, int how)
4907{ 4865{
@@ -5168,7 +5126,6 @@ sys_dup (int fd)
5168 return new_fd; 5126 return new_fd;
5169} 5127}
5170 5128
5171
5172int 5129int
5173sys_dup2 (int src, int dst) 5130sys_dup2 (int src, int dst)
5174{ 5131{
@@ -5872,7 +5829,7 @@ init_ntproc (void)
5872 shutdown_handler ensures that buffers' autosave files are 5829 shutdown_handler ensures that buffers' autosave files are
5873 up to date when the user logs off, or the system shuts down. 5830 up to date when the user logs off, or the system shuts down.
5874*/ 5831*/
5875BOOL WINAPI 5832static BOOL WINAPI
5876shutdown_handler (DWORD type) 5833shutdown_handler (DWORD type)
5877{ 5834{
5878 /* Ctrl-C and Ctrl-Break are already suppressed, so don't handle them. */ 5835 /* Ctrl-C and Ctrl-Break are already suppressed, so don't handle them. */
@@ -5905,7 +5862,6 @@ globals_of_w32 (void)
5905 g_b_init_open_process_token = 0; 5862 g_b_init_open_process_token = 0;
5906 g_b_init_get_token_information = 0; 5863 g_b_init_get_token_information = 0;
5907 g_b_init_lookup_account_sid = 0; 5864 g_b_init_lookup_account_sid = 0;
5908 g_b_init_get_sid_identifier_authority = 0;
5909 g_b_init_get_sid_sub_authority = 0; 5865 g_b_init_get_sid_sub_authority = 0;
5910 g_b_init_get_sid_sub_authority_count = 0; 5866 g_b_init_get_sid_sub_authority_count = 0;
5911 g_b_init_get_file_security = 0; 5867 g_b_init_get_file_security = 0;