Skip to content

Commit 3374832

Browse files
committed
* win32/win32.c (set_pioinfo_extra): new function for VC++8 SP1
workaround. [ruby-core:10259] * win32/win32.c (NtInitialize): call above function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_5@11909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 22ea7b7 commit 3374832

File tree

3 files changed

+40
-5
lines changed

3 files changed

+40
-5
lines changed

ChangeLog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
Tue Feb 27 21:19:35 2007 NAKAMURA Usaku <usa@ruby-lang.org>
2+
3+
* win32/win32.c (set_pioinfo_extra): new function for VC++8 SP1
4+
workaround. [ruby-core:10259]
5+
6+
* win32/win32.c (NtInitialize): call above function.
7+
18
Mon Feb 26 09:57:58 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
29

310
* signal.c (ruby_signal): don't set SA_RESTART. a backport from

version.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#define RUBY_VERSION "1.8.5"
2-
#define RUBY_RELEASE_DATE "2007-02-26"
2+
#define RUBY_RELEASE_DATE "2007-02-27"
33
#define RUBY_VERSION_CODE 185
4-
#define RUBY_RELEASE_CODE 20070226
5-
#define RUBY_PATCHLEVEL 21
4+
#define RUBY_RELEASE_CODE 20070227
5+
#define RUBY_PATCHLEVEL 22
66

77
#define RUBY_VERSION_MAJOR 1
88
#define RUBY_VERSION_MINOR 8
99
#define RUBY_VERSION_TEENY 5
1010
#define RUBY_RELEASE_YEAR 2007
1111
#define RUBY_RELEASE_MONTH 2
12-
#define RUBY_RELEASE_DAY 26
12+
#define RUBY_RELEASE_DAY 27
1313

1414
RUBY_EXTERN const char ruby_version[];
1515
RUBY_EXTERN const char ruby_release_date[];

win32/win32.c

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,10 @@ NtInitialize(int *argc, char ***argv)
395395
int ret;
396396

397397
#if _MSC_VER >= 1400
398+
static void set_pioinfo_extra(void);
399+
398400
_set_invalid_parameter_handler(invalid_parameter);
401+
set_pioinfo_extra();
399402
#endif
400403

401404
//
@@ -1668,11 +1671,36 @@ EXTERN_C _CRTIMP ioinfo * __pioinfo[];
16681671

16691672
#define IOINFO_L2E 5
16701673
#define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E)
1671-
#define _pioinfo(i) (__pioinfo[i >> IOINFO_L2E] + (i & (IOINFO_ARRAY_ELTS - 1)))
1674+
#define _pioinfo(i) ((ioinfo*)((char*)(__pioinfo[i >> IOINFO_L2E]) + (i & (IOINFO_ARRAY_ELTS - 1)) * (sizeof(ioinfo) + pioinfo_extra)))
16721675
#define _osfhnd(i) (_pioinfo(i)->osfhnd)
16731676
#define _osfile(i) (_pioinfo(i)->osfile)
16741677
#define _pipech(i) (_pioinfo(i)->pipech)
16751678

1679+
#if _MSC_VER >= 1400
1680+
static size_t pioinfo_extra = 0; /* workaround for VC++8 SP1 */
1681+
1682+
static void
1683+
set_pioinfo_extra(void)
1684+
{
1685+
int fd;
1686+
1687+
fd = open("NUL", O_RDONLY);
1688+
for (pioinfo_extra = 0; pioinfo_extra <= 64; pioinfo_extra += sizeof(void *)) {
1689+
if (_osfhnd(fd) == _get_osfhandle(fd)) {
1690+
break;
1691+
}
1692+
}
1693+
close(fd);
1694+
1695+
if (pioinfo_extra > 64) {
1696+
/* not found, maybe something wrong... */
1697+
pioinfo_extra = 0;
1698+
}
1699+
}
1700+
#else
1701+
#define pioinfo_extra 0
1702+
#endif
1703+
16761704
#define _set_osfhnd(fh, osfh) (void)(_osfhnd(fh) = osfh)
16771705
#define _set_osflags(fh, flags) (_osfile(fh) = (flags))
16781706

0 commit comments

Comments
 (0)