Mercurial > hg > xemacs-beta
comparison src/nt.c @ 404:2f8bb876ab1d r21-2-32
Import from CVS: tag r21-2-32
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:16:07 +0200 |
parents | a86b2b5e0111 |
children | 501cfd01ee6d |
comparison
equal
deleted
inserted
replaced
403:9f011ab08d48 | 404:2f8bb876ab1d |
---|---|
46 #include <string.h> | 46 #include <string.h> |
47 #include <stdlib.h> | 47 #include <stdlib.h> |
48 #include <stdio.h> | 48 #include <stdio.h> |
49 | 49 |
50 #include <windows.h> | 50 #include <windows.h> |
51 #ifndef __MINGW32__ | |
52 #include <mmsystem.h> | 51 #include <mmsystem.h> |
53 #else | |
54 typedef void (CALLBACK TIMECALLBACK)(UINT uTimerID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2); | |
55 | |
56 typedef TIMECALLBACK FAR *LPTIMECALLBACK; | |
57 DWORD WINAPI timeGetTime(void); | |
58 MMRESULT WINAPI timeSetEvent(UINT uDelay, UINT uResolution, | |
59 LPTIMECALLBACK fptc, DWORD dwUser, UINT fuEvent); | |
60 MMRESULT WINAPI timeKillEvent(UINT uTimerID); | |
61 MMRESULT WINAPI timeGetDevCaps(TIMECAPS* ptc, UINT cbtc); | |
62 MMRESULT WINAPI timeBeginPeriod(UINT uPeriod); | |
63 MMRESULT WINAPI timeEndPeriod(UINT uPeriod); | |
64 #endif | |
65 | 52 |
66 #include "nt.h" | 53 #include "nt.h" |
67 #include <sys/dir.h> | 54 #include <sys/dir.h> |
68 #include "ntheap.h" | 55 #include "ntheap.h" |
69 | 56 |
130 the_passwd_dir, | 117 the_passwd_dir, |
131 the_passwd_shell, | 118 the_passwd_shell, |
132 }; | 119 }; |
133 | 120 |
134 uid_t | 121 uid_t |
135 getuid () | 122 getuid (void) |
136 { | 123 { |
137 return nt_fake_unix_uid; | 124 return nt_fake_unix_uid; |
138 } | 125 } |
139 | 126 |
140 uid_t | 127 uid_t |
141 geteuid () | 128 geteuid (void) |
142 { | 129 { |
143 return nt_fake_unix_uid; | 130 return nt_fake_unix_uid; |
144 } | 131 } |
145 | 132 |
146 gid_t | 133 gid_t |
147 getgid () | 134 getgid (void) |
148 { | 135 { |
149 return the_passwd.pw_gid; | 136 return the_passwd.pw_gid; |
150 } | 137 } |
151 | 138 |
152 gid_t | 139 gid_t |
153 getegid () | 140 getegid (void) |
154 { | 141 { |
155 return getgid (); | 142 return getgid (); |
156 } | 143 } |
157 | 144 |
158 struct passwd * | 145 struct passwd * |
181 | 168 |
182 return pw; | 169 return pw; |
183 } | 170 } |
184 | 171 |
185 void | 172 void |
186 init_user_info () | 173 init_user_info (void) |
187 { | 174 { |
188 /* This code is pretty much of ad hoc nature. There is no unix-like | 175 /* This code is pretty much of ad hoc nature. There is no unix-like |
189 UIDs under Windows NT. There is no concept of root user, because | 176 UIDs under Windows NT. There is no concept of root user, because |
190 all security is ACL-based. Instead, let's use a simple variable, | 177 all security is ACL-based. Instead, let's use a simple variable, |
191 nt-fake-unix-uid, which would allow the user to have a uid of | 178 nt-fake-unix-uid, which would allow the user to have a uid of |
591 | 578 |
592 return (NULL); | 579 return (NULL); |
593 } | 580 } |
594 | 581 |
595 void | 582 void |
596 init_environment () | 583 init_environment (void) |
597 { | 584 { |
598 /* Check for environment variables and use registry if they don't exist */ | 585 /* Check for environment variables and use registry if they don't exist */ |
599 { | 586 { |
600 int i; | 587 int i; |
601 LPBYTE lpval; | 588 LPBYTE lpval; |
613 "EMACSPATH", | 600 "EMACSPATH", |
614 "EMACSPACKAGEPATH", | 601 "EMACSPACKAGEPATH", |
615 "EMACSLOCKDIR", | 602 "EMACSLOCKDIR", |
616 "INFOPATH" | 603 "INFOPATH" |
617 }; | 604 }; |
618 #ifdef HEAP_IN_DATA | 605 #if defined (HEAP_IN_DATA) && !defined(PDUMP) |
619 cache_system_info (); | 606 cache_system_info (); |
620 #endif | 607 #endif |
621 for (i = 0; i < countof (env_vars); i++) | 608 for (i = 0; i < countof (env_vars); i++) |
622 { | 609 { |
623 if (!getenv (env_vars[i]) && | 610 if (!getenv (env_vars[i]) && |
1248 ret -= utc_base; | 1235 ret -= utc_base; |
1249 return (time_t) (ret * 1e-7); | 1236 return (time_t) (ret * 1e-7); |
1250 } | 1237 } |
1251 #else | 1238 #else |
1252 | 1239 |
1240 #if defined(__MINGW32__) && CYGWIN_VERSION_DLL_MAJOR <= 21 | |
1241 #define LowPart u.LowPart | |
1242 #define HighPart u.HighPart | |
1243 #endif | |
1244 | |
1253 static LARGE_INTEGER utc_base_li; | 1245 static LARGE_INTEGER utc_base_li; |
1254 | 1246 |
1255 time_t | 1247 time_t |
1256 convert_time (FILETIME uft) | 1248 convert_time (FILETIME uft) |
1257 { | 1249 { |
1317 #endif | 1309 #endif |
1318 | 1310 |
1319 return ret; | 1311 return ret; |
1320 } | 1312 } |
1321 #endif | 1313 #endif |
1314 #if defined(__MINGW32__) && CYGWIN_VERSION_DLL_MAJOR <= 21 | |
1315 #undef LowPart | |
1316 #undef HighPart | |
1317 #endif | |
1322 | 1318 |
1323 #if 0 | 1319 #if 0 |
1324 /* in case we ever have need of this */ | 1320 /* in case we ever have need of this */ |
1325 void | 1321 void |
1326 convert_from_time_t (time_t time, FILETIME * pft) | 1322 convert_from_time_t (time_t time, FILETIME * pft) |
1398 | 1394 |
1399 /* stat has been fixed since MSVC 5.0. | 1395 /* stat has been fixed since MSVC 5.0. |
1400 Oh, and do not encapsulater stat for non-MS compilers, too */ | 1396 Oh, and do not encapsulater stat for non-MS compilers, too */ |
1401 /* #### popineau@ese-metz.fr says they still might be broken. | 1397 /* #### popineau@ese-metz.fr says they still might be broken. |
1402 Oh well... Let's add that `1 ||' condition.... --kkm */ | 1398 Oh well... Let's add that `1 ||' condition.... --kkm */ |
1399 /* #### aichner@ecf.teradyne.com reported that with the library | |
1400 provided stat/fstat, (file-exist "d:\\tmp\\") =>> nil, | |
1401 (file-exist "d:\\tmp") =>> t, when d:\tmp exists. Whenever | |
1402 we opt to use non-encapsulated stat(), this should serve as | |
1403 a compatibility test. --kkm */ | |
1404 | |
1403 #if 1 || defined(_MSC_VER) && _MSC_VER < 1100 | 1405 #if 1 || defined(_MSC_VER) && _MSC_VER < 1100 |
1404 | 1406 |
1405 /* Since stat is encapsulated on Windows NT, we need to encapsulate | 1407 /* Since stat is encapsulated on Windows NT, we need to encapsulate |
1406 the equally broken fstat as well. */ | 1408 the equally broken fstat as well. */ |
1407 int _cdecl | 1409 int _cdecl |
1665 term_ntproc (int unused) | 1667 term_ntproc (int unused) |
1666 { | 1668 { |
1667 } | 1669 } |
1668 | 1670 |
1669 void | 1671 void |
1670 init_ntproc () | 1672 init_ntproc (void) |
1671 { | 1673 { |
1672 /* Initial preparation for subprocess support: replace our standard | 1674 /* Initial preparation for subprocess support: replace our standard |
1673 handles with non-inheritable versions. */ | 1675 handles with non-inheritable versions. */ |
1674 { | 1676 { |
1675 HANDLE parent; | 1677 HANDLE parent; |