Changeset 3188 for trunk/essentials/dev-lang/perl/os2/os2.c
- Timestamp:
- Apr 22, 2007, 10:57:48 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/essentials/dev-lang/perl/os2/os2.c
r3187 r3188 20 20 * Various Unix compatibility functions for OS/2 21 21 */ 22 23 #ifdef __KLIBC__ 24 #define INSTALL_PREFIX "u:/perl" 25 #endif 22 26 23 27 #include <stdio.h> … … 661 665 PIB *pib; 662 666 667 #ifndef __KLIBC__ 663 668 if (!(_emx_env & 0x200)) return 1; /* not OS/2. */ 669 #endif 664 670 if (CheckOSError(DosGetInfoBlocks(&tib, &pib))) 665 671 return -1; … … 675 681 PIB *pib; 676 682 683 #ifndef __KLIBC__ 677 684 if (!(_emx_env & 0x200)) 678 685 Perl_croak_nocontext("Can't set type on DOS"); /* not OS/2. */ 686 #endif 679 687 if (CheckOSError(DosGetInfoBlocks(&tib, &pib))) 680 688 croak_with_os2error("Error getting info blocks"); … … 833 841 ULONG rc, prio = sys_prio(pid); 834 842 843 #ifndef __KLIBC__ 835 844 if (!(_emx_env & 0x200)) return 0; /* Nop if not OS/2. */ 845 #endif 836 846 if (priors[(32 - val) >> 5] + 1 == (prio >> 8)) { 837 847 /* Do not change class. */ … … 867 877 ULONG ret; 868 878 879 #ifndef __KLIBC__ 869 880 if (!(_emx_env & 0x200)) return 0; /* Nop if not OS/2. */ 881 #endif 870 882 ret = sys_prio(pid); 871 883 if (ret == PRIO_ERR) { … … 952 964 ULONG apptype; 953 965 966 #ifndef __KLIBC__ 954 967 if (!(_emx_env & 0x200)) 955 968 Perl_croak_nocontext("file_type not implemented on DOS"); /* not OS/2. */ 969 #endif 956 970 if (CheckOSError(DosQueryAppType(path, &apptype))) { 957 971 switch (rc) { … … 973 987 /* global PL_Argv[] contains arguments. */ 974 988 989 #ifndef __KLIBC__ 975 990 extern ULONG _emx_exception ( EXCEPTIONREPORTRECORD *, 976 991 EXCEPTIONREGISTRATIONRECORD *, 977 992 CONTEXTRECORD *, 978 993 void *); 994 #endif 979 995 980 996 int … … 1016 1032 reread: 1017 1033 force_shell = 0; 1034 #ifndef __KLIBC__ 1018 1035 if (_emx_env & 0x200) { /* OS/2. */ 1036 #else 1037 { 1038 #endif 1019 1039 int type = file_type(real_name); 1020 1040 type_again: … … 1254 1274 1255 1275 if (!shell) 1276 #ifndef __KLIBC__ 1256 1277 shell = ((_emx_env & 0x200) 1257 1278 ? "c:/os2/cmd.exe" 1258 1279 : "c:/command.com"); 1280 #else 1281 shell = "c:/os2/cmd.exe"; 1282 #endif 1259 1283 nargs = shell_opt ? 2 : 1; /* shell file args */ 1260 1284 exec_args[0] = shell; … … 2056 2080 int number = SvTRUE(get_sv("OS2::nsyserror", TRUE)); 2057 2081 2082 #ifndef __KLIBC__ 2058 2083 if (!(_emx_env & 0x200)) return ""; /* Nop if not OS/2. */ 2084 #endif 2059 2085 if (rc == 0) 2060 2086 return ""; … … 2262 2288 to = dllname2buffer(aTHX_ b, bl); 2263 2289 } else { /* No Perl present yet */ 2290 2264 2291 HMODULE self = find_myself(); 2265 2292 APIRET rc = DosQueryModuleName(self, bl, b); … … 2272 2299 *to = '/'; 2273 2300 to = b; 2301 2274 2302 } 2275 2303 break; … … 2618 2646 APIRET badrc; 2619 2647 2648 #ifndef __KLIBC__ 2620 2649 if (!(_emx_env & 0x200)) /* DOS */ 2621 2650 return !_sleep2(ms); 2622 2651 #endif 2623 2652 os2cp_croak(DosCreateEventSem(NULL, /* Unnamed */ 2624 2653 &hevEvent1, /* Handle of semaphore returned */ … … 3998 4027 GV *gv; 3999 4028 4029 #ifndef __KLIBC__ 4000 4030 if (_emx_env & 0x200) { /* OS/2 */ 4031 #else 4032 { 4033 #endif 4001 4034 newXS("File::Copy::syscopy", XS_File__Copy_syscopy, file); 4002 4035 newXS("Cwd::extLibpath", XS_Cwd_extLibpath, file); … … 4055 4088 GvMULTI_on(gv); 4056 4089 sv_setiv(GvSV(gv), exe_is_aout()); 4090 #ifndef __KLIBC__ 4057 4091 gv = gv_fetchpv("OS2::emx_rev", TRUE, SVt_PV); 4092 #endif 4058 4093 GvMULTI_on(gv); 4094 #ifndef __KLIBC__ 4059 4095 sv_setiv(GvSV(gv), _emx_rev); 4060 4096 sv_setpv(GvSV(gv), _emx_vprt); 4097 #endif 4061 4098 SvIOK_on(GvSV(gv)); 4099 #ifndef __KLIBC__ 4062 4100 gv = gv_fetchpv("OS2::emx_env", TRUE, SVt_PV); 4101 #endif 4063 4102 GvMULTI_on(gv); 4103 #ifndef __KLIBC__ 4064 4104 sv_setiv(GvSV(gv), _emx_env); 4105 #endif 4065 4106 gv = gv_fetchpv("OS2::os_ver", TRUE, SVt_PV); 4066 4107 GvMULTI_on(gv); … … 4073 4114 } 4074 4115 4116 #ifndef __KLIBC__ 4075 4117 extern void _emx_init(void*); 4118 #endif 4076 4119 4077 4120 static void jmp_out_of_atexit(void); … … 4080 4123 #define FORCE_EMX_INIT_INSTALL_ATEXIT 2 4081 4124 4125 #ifndef __KLIBC__ 4082 4126 static void 4083 4127 my_emx_init(void *layout) { … … 4095 4139 "popf\n" : : "r" (layout), "m" (old_esp) ); 4096 4140 } 4097 4141 #endif 4098 4142 struct layout_table_t { 4099 4143 ULONG text_base; … … 4115 4159 }; 4116 4160 4161 #ifndef __KLIBC__ 4117 4162 static ULONG 4118 4163 my_os_version() { … … 4130 4175 return osv_res; 4131 4176 } 4132 4177 #endif 4178 4179 #ifndef __KLIBC__ 4133 4180 static void 4134 4181 force_init_emx_runtime(EXCEPTIONREGISTRATIONRECORD *preg, ULONG flags) … … 4235 4282 exit(56); 4236 4283 } 4237 4284 #endif 4238 4285 static void 4239 4286 jmp_out_of_atexit(void) … … 4282 4329 #include <emx/startup.h> 4283 4330 4331 #ifndef __KLIBC__ 4284 4332 extern ULONG __os_version(); /* See system.doc */ 4285 4333 #endif 4334 4335 #ifndef __KLIBC__ 4286 4336 void 4287 4337 check_emx_runtime(char **env, EXCEPTIONREGISTRATIONRECORD *preg) … … 4339 4389 initialized either. Uninitialized EMX.DLL returns 0 in the low 4340 4390 nibble of __os_version(). */ 4391 4341 4392 v_emx = my_os_version(); 4342 4393 … … 4350 4401 v_crt = (_osmajor | _osminor); 4351 4402 4403 #ifndef __KLIBC__ 4352 4404 if ((_emx_env & 0x200) && !(v_emx & 0xFFFF)) { /* OS/2, EMX uninit. */ 4353 4405 force_init_emx_runtime( preg, 4354 4406 FORCE_EMX_INIT_CONTRACT_ARGV 4355 4407 | FORCE_EMX_INIT_INSTALL_ATEXIT ); 4408 #endif 4356 4409 emx_wasnt_initialized = 1; 4357 4410 /* Update CRTL data basing on now-valid EMX runtime data */ … … 4392 4445 DosReleaseMutexSem(hmtx_emx_init); 4393 4446 } 4394 4447 #endif 4395 4448 #define ENTRY_POINT 0x10000 4396 4449 … … 4430 4483 MALLOC_INIT; 4431 4484 4485 #ifndef __KLIBC__ 4432 4486 check_emx_runtime(env, (EXCEPTIONREGISTRATIONRECORD *)preg); 4433 4487 #endif 4434 4488 settmppath(); 4435 4489 OS2_Perl_data.xs_init = &Xs_OS2_init; … … 4442 4496 Newx(PL_sh_path, strlen(SH_PATH) + 1, char); 4443 4497 strcpy(PL_sh_path, SH_PATH); 4498 #ifndef __KLIBC__ 4444 4499 PL_sh_path[0] = shell[0]; 4500 #endif 4445 4501 } else if ( (shell = getenv("PERL_SH_DIR")) ) { 4446 4502 int l = strlen(shell), i; … … 4451 4507 strncpy(PL_sh_path, shell, l); 4452 4508 strcpy(PL_sh_path + l, "/sh.exe"); 4509 #ifndef __KLIBC__ 4453 4510 for (i = 0; i < l; i++) { 4454 4511 if (PL_sh_path[i] == '\\') PL_sh_path[i] = '/'; 4455 4512 } 4513 #endif 4456 4514 } 4457 4515 #if defined(USE_5005THREADS) || defined(USE_ITHREADS) … … 4494 4552 static ULONG max_fh = 0; 4495 4553 4554 #ifndef __KLIBC__ 4496 4555 if (!(_emx_env & 0x200)) return 1; /* not OS/2. */ 4556 #endif 4497 4557 if (fd >= max_fh) { /* Renew */ 4498 4558 LONG delta = 0; … … 4629 4689 MUTEX_UNLOCK(&perlos2_state_mutex); 4630 4690 } 4691 #ifndef __KLIBC__ 4631 4692 if (!(_emx_env & 0x200) || !use_my_flock) 4632 4693 return flock(handle, o); /* Delegate to EMX. */ 4694 #endif 4633 4695 4634 4696 /* is this a file? */ … … 4769 4831 } 4770 4832 4833 #ifndef __KLIBC__ 4771 4834 void 4772 4835 setgrent(void) … … 4787 4850 return getgrgid(0); 4788 4851 } 4789 4852 #endif 4790 4853 #undef getpwuid 4791 4854 #undef getpwnam
Note:
See TracChangeset
for help on using the changeset viewer.