diff options
| author | Daniel Colascione | 2012-10-07 14:31:58 -0800 |
|---|---|---|
| committer | Daniel Colascione | 2012-10-07 14:31:58 -0800 |
| commit | 36a305a723c63fd345be65c536c52fe9765c14be (patch) | |
| tree | fb89d9e103552863214c60297a65320917109357 /src/w32.c | |
| parent | 2ab329f3b5d52a39f0a45c3d9c129f1c19560142 (diff) | |
| parent | 795b1482a9e314cda32d62ac2988f573d359366e (diff) | |
| download | emacs-36a305a723c63fd345be65c536c52fe9765c14be.tar.gz emacs-36a305a723c63fd345be65c536c52fe9765c14be.zip | |
Merge from trunk
Diffstat (limited to 'src/w32.c')
| -rw-r--r-- | src/w32.c | 129 |
1 files changed, 50 insertions, 79 deletions
| @@ -1511,52 +1511,6 @@ is_unc_volume (const char *filename) | |||
| 1511 | return 1; | 1511 | return 1; |
| 1512 | } | 1512 | } |
| 1513 | 1513 | ||
| 1514 | /* Routines that are no-ops on NT but are defined to get Emacs to compile. */ | ||
| 1515 | int | ||
| 1516 | sigemptyset (sigset_t *set) | ||
| 1517 | { | ||
| 1518 | *set = 0; | ||
| 1519 | return 0; | ||
| 1520 | } | ||
| 1521 | |||
| 1522 | int | ||
| 1523 | sigaddset (sigset_t *set, int signo) | ||
| 1524 | { | ||
| 1525 | return 0; | ||
| 1526 | } | ||
| 1527 | |||
| 1528 | int | ||
| 1529 | sigfillset (sigset_t *set) | ||
| 1530 | { | ||
| 1531 | return 0; | ||
| 1532 | } | ||
| 1533 | |||
| 1534 | int | ||
| 1535 | sigprocmask (int how, const sigset_t *set, sigset_t *oset) | ||
| 1536 | { | ||
| 1537 | return 0; | ||
| 1538 | } | ||
| 1539 | |||
| 1540 | int | ||
| 1541 | pthread_sigmask (int how, const sigset_t *set, sigset_t *oset) | ||
| 1542 | { | ||
| 1543 | if (sigprocmask (how, set, oset) == -1) | ||
| 1544 | return EINVAL; | ||
| 1545 | return 0; | ||
| 1546 | } | ||
| 1547 | |||
| 1548 | int | ||
| 1549 | setpgrp (int pid, int gid) | ||
| 1550 | { | ||
| 1551 | return 0; | ||
| 1552 | } | ||
| 1553 | |||
| 1554 | int | ||
| 1555 | alarm (int seconds) | ||
| 1556 | { | ||
| 1557 | return 0; | ||
| 1558 | } | ||
| 1559 | |||
| 1560 | #define REG_ROOT "SOFTWARE\\GNU\\Emacs" | 1514 | #define REG_ROOT "SOFTWARE\\GNU\\Emacs" |
| 1561 | 1515 | ||
| 1562 | LPBYTE | 1516 | LPBYTE |
| @@ -1767,7 +1721,8 @@ init_environment (char ** argv) | |||
| 1767 | /* FIXME: should use substring of get_emacs_configuration (). | 1721 | /* FIXME: should use substring of get_emacs_configuration (). |
| 1768 | But I don't think the Windows build supports alpha, mips etc | 1722 | But I don't think the Windows build supports alpha, mips etc |
| 1769 | anymore, so have taken the easy option for now. */ | 1723 | anymore, so have taken the easy option for now. */ |
| 1770 | else if (p && xstrcasecmp (p, "\\i386") == 0) | 1724 | else if (p && (xstrcasecmp (p, "\\i386") == 0 |
| 1725 | || xstrcasecmp (p, "\\AMD64") == 0)) | ||
| 1771 | { | 1726 | { |
| 1772 | *p = 0; | 1727 | *p = 0; |
| 1773 | p = strrchr (modname, '\\'); | 1728 | p = strrchr (modname, '\\'); |
| @@ -1915,7 +1870,16 @@ get_emacs_configuration (void) | |||
| 1915 | case PROCESSOR_INTEL_386: | 1870 | case PROCESSOR_INTEL_386: |
| 1916 | case PROCESSOR_INTEL_486: | 1871 | case PROCESSOR_INTEL_486: |
| 1917 | case PROCESSOR_INTEL_PENTIUM: | 1872 | case PROCESSOR_INTEL_PENTIUM: |
| 1873 | #ifdef _WIN64 | ||
| 1874 | arch = "amd64"; | ||
| 1875 | #else | ||
| 1918 | arch = "i386"; | 1876 | arch = "i386"; |
| 1877 | #endif | ||
| 1878 | break; | ||
| 1879 | #endif | ||
| 1880 | #ifdef PROCESSOR_AMD_X8664 | ||
| 1881 | case PROCESSOR_AMD_X8664: | ||
| 1882 | arch = "amd64"; | ||
| 1919 | break; | 1883 | break; |
| 1920 | #endif | 1884 | #endif |
| 1921 | 1885 | ||
| @@ -3971,9 +3935,13 @@ utime (const char *name, struct utimbuf *times) | |||
| 3971 | } | 3935 | } |
| 3972 | 3936 | ||
| 3973 | /* Need write access to set times. */ | 3937 | /* Need write access to set times. */ |
| 3974 | fh = CreateFile (name, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, | 3938 | fh = CreateFile (name, FILE_WRITE_ATTRIBUTES, |
| 3975 | 0, OPEN_EXISTING, 0, NULL); | 3939 | /* If NAME specifies a directory, FILE_SHARE_DELETE |
| 3976 | if (fh) | 3940 | allows other processes to delete files inside it, |
| 3941 | while we have the directory open. */ | ||
| 3942 | FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, | ||
| 3943 | 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); | ||
| 3944 | if (fh != INVALID_HANDLE_VALUE) | ||
| 3977 | { | 3945 | { |
| 3978 | convert_from_time_t (times->actime, &atime); | 3946 | convert_from_time_t (times->actime, &atime); |
| 3979 | convert_from_time_t (times->modtime, &mtime); | 3947 | convert_from_time_t (times->modtime, &mtime); |
| @@ -6504,33 +6472,27 @@ sys_localtime (const time_t *t) | |||
| 6504 | 6472 | ||
| 6505 | 6473 | ||
| 6506 | 6474 | ||
| 6507 | /* Delayed loading of libraries. */ | 6475 | /* Try loading LIBRARY_ID from the file(s) specified in |
| 6508 | 6476 | Vdynamic_library_alist. If the library is loaded successfully, | |
| 6509 | Lisp_Object Vlibrary_cache; | 6477 | return the handle of the DLL, and record the filename in the |
| 6510 | 6478 | property :loaded-from of LIBRARY_ID. If the library could not be | |
| 6511 | /* The argument LIBRARIES is an alist that associates a symbol | 6479 | found, or when it was already loaded (because the handle is not |
| 6512 | LIBRARY_ID, identifying an external DLL library known to Emacs, to | 6480 | recorded anywhere, and so is lost after use), return NULL. |
| 6513 | a list of filenames under which the library is usually found. In | 6481 | |
| 6514 | most cases, the argument passed as LIBRARIES is the variable | 6482 | We could also save the handle in :loaded-from, but currently |
| 6515 | `dynamic-library-alist', which is initialized to a list of common | 6483 | there's no use case for it. */ |
| 6516 | library names. If the function loads the library successfully, it | ||
| 6517 | returns the handle of the DLL, and records the filename in the | ||
| 6518 | property :loaded-from of LIBRARY_ID; it returns NULL if the library | ||
| 6519 | could not be found, or when it was already loaded (because the | ||
| 6520 | handle is not recorded anywhere, and so is lost after use). It | ||
| 6521 | would be trivial to save the handle too in :loaded-from, but | ||
| 6522 | currently there's no use case for it. */ | ||
| 6523 | HMODULE | 6484 | HMODULE |
| 6524 | w32_delayed_load (Lisp_Object libraries, Lisp_Object library_id) | 6485 | w32_delayed_load (Lisp_Object library_id) |
| 6525 | { | 6486 | { |
| 6526 | HMODULE library_dll = NULL; | 6487 | HMODULE library_dll = NULL; |
| 6527 | 6488 | ||
| 6528 | CHECK_SYMBOL (library_id); | 6489 | CHECK_SYMBOL (library_id); |
| 6529 | 6490 | ||
| 6530 | if (CONSP (libraries) && NILP (Fassq (library_id, Vlibrary_cache))) | 6491 | if (CONSP (Vdynamic_library_alist) |
| 6492 | && NILP (Fassq (library_id, Vlibrary_cache))) | ||
| 6531 | { | 6493 | { |
| 6532 | Lisp_Object found = Qnil; | 6494 | Lisp_Object found = Qnil; |
| 6533 | Lisp_Object dlls = Fassq (library_id, libraries); | 6495 | Lisp_Object dlls = Fassq (library_id, Vdynamic_library_alist); |
| 6534 | 6496 | ||
| 6535 | if (CONSP (dlls)) | 6497 | if (CONSP (dlls)) |
| 6536 | for (dlls = XCDR (dlls); CONSP (dlls); dlls = XCDR (dlls)) | 6498 | for (dlls = XCDR (dlls); CONSP (dlls); dlls = XCDR (dlls)) |
| @@ -6609,8 +6571,12 @@ check_windows_init_file (void) | |||
| 6609 | } | 6571 | } |
| 6610 | 6572 | ||
| 6611 | void | 6573 | void |
| 6612 | term_ntproc (void) | 6574 | term_ntproc (int ignored) |
| 6613 | { | 6575 | { |
| 6576 | (void)ignored; | ||
| 6577 | |||
| 6578 | term_timers (); | ||
| 6579 | |||
| 6614 | /* shutdown the socket interface if necessary */ | 6580 | /* shutdown the socket interface if necessary */ |
| 6615 | term_winsock (); | 6581 | term_winsock (); |
| 6616 | 6582 | ||
| @@ -6618,8 +6584,10 @@ term_ntproc (void) | |||
| 6618 | } | 6584 | } |
| 6619 | 6585 | ||
| 6620 | void | 6586 | void |
| 6621 | init_ntproc (void) | 6587 | init_ntproc (int dumping) |
| 6622 | { | 6588 | { |
| 6589 | sigset_t initial_mask = 0; | ||
| 6590 | |||
| 6623 | /* Initialize the socket interface now if available and requested by | 6591 | /* Initialize the socket interface now if available and requested by |
| 6624 | the user by defining PRELOAD_WINSOCK; otherwise loading will be | 6592 | the user by defining PRELOAD_WINSOCK; otherwise loading will be |
| 6625 | delayed until open-network-stream is called (w32-has-winsock can | 6593 | delayed until open-network-stream is called (w32-has-winsock can |
| @@ -6675,19 +6643,19 @@ init_ntproc (void) | |||
| 6675 | fclose (stderr); | 6643 | fclose (stderr); |
| 6676 | 6644 | ||
| 6677 | if (stdin_save != INVALID_HANDLE_VALUE) | 6645 | if (stdin_save != INVALID_HANDLE_VALUE) |
| 6678 | _open_osfhandle ((long) stdin_save, O_TEXT); | 6646 | _open_osfhandle ((intptr_t) stdin_save, O_TEXT); |
| 6679 | else | 6647 | else |
| 6680 | _open ("nul", O_TEXT | O_NOINHERIT | O_RDONLY); | 6648 | _open ("nul", O_TEXT | O_NOINHERIT | O_RDONLY); |
| 6681 | _fdopen (0, "r"); | 6649 | _fdopen (0, "r"); |
| 6682 | 6650 | ||
| 6683 | if (stdout_save != INVALID_HANDLE_VALUE) | 6651 | if (stdout_save != INVALID_HANDLE_VALUE) |
| 6684 | _open_osfhandle ((long) stdout_save, O_TEXT); | 6652 | _open_osfhandle ((intptr_t) stdout_save, O_TEXT); |
| 6685 | else | 6653 | else |
| 6686 | _open ("nul", O_TEXT | O_NOINHERIT | O_WRONLY); | 6654 | _open ("nul", O_TEXT | O_NOINHERIT | O_WRONLY); |
| 6687 | _fdopen (1, "w"); | 6655 | _fdopen (1, "w"); |
| 6688 | 6656 | ||
| 6689 | if (stderr_save != INVALID_HANDLE_VALUE) | 6657 | if (stderr_save != INVALID_HANDLE_VALUE) |
| 6690 | _open_osfhandle ((long) stderr_save, O_TEXT); | 6658 | _open_osfhandle ((intptr_t) stderr_save, O_TEXT); |
| 6691 | else | 6659 | else |
| 6692 | _open ("nul", O_TEXT | O_NOINHERIT | O_WRONLY); | 6660 | _open ("nul", O_TEXT | O_NOINHERIT | O_WRONLY); |
| 6693 | _fdopen (2, "w"); | 6661 | _fdopen (2, "w"); |
| @@ -6695,7 +6663,13 @@ init_ntproc (void) | |||
| 6695 | 6663 | ||
| 6696 | /* unfortunately, atexit depends on implementation of malloc */ | 6664 | /* unfortunately, atexit depends on implementation of malloc */ |
| 6697 | /* atexit (term_ntproc); */ | 6665 | /* atexit (term_ntproc); */ |
| 6698 | signal (SIGABRT, term_ntproc); | 6666 | if (!dumping) |
| 6667 | { | ||
| 6668 | /* Make sure we start with all signals unblocked. */ | ||
| 6669 | sigprocmask (SIG_SETMASK, &initial_mask, NULL); | ||
| 6670 | signal (SIGABRT, term_ntproc); | ||
| 6671 | } | ||
| 6672 | init_timers (); | ||
| 6699 | 6673 | ||
| 6700 | /* determine which drives are fixed, for GetCachedVolumeInformation */ | 6674 | /* determine which drives are fixed, for GetCachedVolumeInformation */ |
| 6701 | { | 6675 | { |
| @@ -6752,9 +6726,6 @@ globals_of_w32 (void) | |||
| 6752 | 6726 | ||
| 6753 | DEFSYM (QCloaded_from, ":loaded-from"); | 6727 | DEFSYM (QCloaded_from, ":loaded-from"); |
| 6754 | 6728 | ||
| 6755 | Vlibrary_cache = Qnil; | ||
| 6756 | staticpro (&Vlibrary_cache); | ||
| 6757 | |||
| 6758 | g_b_init_is_windows_9x = 0; | 6729 | g_b_init_is_windows_9x = 0; |
| 6759 | g_b_init_open_process_token = 0; | 6730 | g_b_init_open_process_token = 0; |
| 6760 | g_b_init_get_token_information = 0; | 6731 | g_b_init_get_token_information = 0; |
| @@ -6805,7 +6776,7 @@ serial_open (char *port) | |||
| 6805 | OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0); | 6776 | OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0); |
| 6806 | if (hnd == INVALID_HANDLE_VALUE) | 6777 | if (hnd == INVALID_HANDLE_VALUE) |
| 6807 | error ("Could not open %s", port); | 6778 | error ("Could not open %s", port); |
| 6808 | fd = (int) _open_osfhandle ((int) hnd, 0); | 6779 | fd = (int) _open_osfhandle ((intptr_t) hnd, 0); |
| 6809 | if (fd == -1) | 6780 | if (fd == -1) |
| 6810 | error ("Could not open %s", port); | 6781 | error ("Could not open %s", port); |
| 6811 | 6782 | ||