Mercurial > hg > xemacs-beta
comparison src/sysdep.c @ 259:11cf20601dec r20-5b28
Import from CVS: tag r20-5b28
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:23:02 +0200 |
parents | 084402c475ba |
children | 727739f917cb |
comparison
equal
deleted
inserted
replaced
258:58424f6abf56 | 259:11cf20601dec |
---|---|
892 static void | 892 static void |
893 init_sigio_on_device (struct device *d) | 893 init_sigio_on_device (struct device *d) |
894 { | 894 { |
895 int filedesc = DEVICE_INFD (d); | 895 int filedesc = DEVICE_INFD (d); |
896 | 896 |
897 #if defined (I_SETSIG) && !defined(HPUX10) | |
898 ioctl (filedesc, I_GETSIG, &DEVICE_OLD_SIGIO_FLAG (d)); | |
899 DEVICE_OLD_SIGIO_FLAG (d) &= ~S_INPUT; | |
900 #elif defined (FASYNC) | |
901 DEVICE_OLD_SIGIO_FLAG (d) = | |
902 fcntl (filedesc, F_GETFL, 0) & ~FASYNC; | |
903 #endif | |
904 | |
905 #if defined (FIOSSAIOOWN) | 897 #if defined (FIOSSAIOOWN) |
906 { /* HPUX stuff */ | 898 { /* HPUX stuff */ |
907 int owner = getpid (); | 899 int owner = getpid (); |
908 int ioctl_status; | 900 int ioctl_status; |
909 if (DEVICE_TTY_P (d)) | 901 if (DEVICE_TTY_P (d)) |
962 static void | 954 static void |
963 request_sigio_on_device (struct device *d) | 955 request_sigio_on_device (struct device *d) |
964 { | 956 { |
965 int filedesc = DEVICE_INFD (d); | 957 int filedesc = DEVICE_INFD (d); |
966 | 958 |
967 /* prevent redundant ioctl()s, which may cause syslog messages | |
968 (e.g. on Solaris) */ | |
969 if (d->sigio_enabled) | |
970 return; | |
971 | |
972 #if defined (I_SETSIG) && !defined(HPUX10) | 959 #if defined (I_SETSIG) && !defined(HPUX10) |
973 ioctl (filedesc, I_SETSIG, DEVICE_OLD_SIGIO_FLAG (d) | S_INPUT); | 960 { |
961 int events=0; | |
962 ioctl (filedesc, I_GETSIG, &events); | |
963 ioctl (filedesc, I_SETSIG, events | S_INPUT); | |
964 } | |
974 #elif defined (FASYNC) | 965 #elif defined (FASYNC) |
975 fcntl (filedesc, F_SETFL, DEVICE_OLD_SIGIO_FLAG (d) | FASYNC); | 966 fcntl (filedesc, F_SETFL, fcntl (filedesc, F_GETFL, 0) | FASYNC); |
976 #elif defined (FIOSSAIOSTAT) | 967 #elif defined (FIOSSAIOSTAT) |
977 { | 968 { |
978 /* DG: Changed for HP-UX. HP-UX uses different IOCTLs for | 969 /* DG: Changed for HP-UX. HP-UX uses different IOCTLs for |
979 sockets and other devices for some bizarre reason. We guess | 970 sockets and other devices for some bizarre reason. We guess |
980 that an X device is a socket, and tty devices aren't. We then | 971 that an X device is a socket, and tty devices aren't. We then |
1001 #endif | 992 #endif |
1002 | 993 |
1003 #if defined (_CX_UX) /* #### Is this crap necessary? */ | 994 #if defined (_CX_UX) /* #### Is this crap necessary? */ |
1004 EMACS_UNBLOCK_SIGNAL (SIGIO); | 995 EMACS_UNBLOCK_SIGNAL (SIGIO); |
1005 #endif | 996 #endif |
1006 | |
1007 d->sigio_enabled = 1; | |
1008 } | 997 } |
1009 | 998 |
1010 static void | 999 static void |
1011 unrequest_sigio_on_device (struct device *d) | 1000 unrequest_sigio_on_device (struct device *d) |
1012 { | 1001 { |
1013 int filedesc = DEVICE_INFD (d); | 1002 int filedesc = DEVICE_INFD (d); |
1014 | 1003 |
1015 /* prevent redundant ioctl()s, which may cause syslog messages | |
1016 (e.g. on Solaris) */ | |
1017 if (!d->sigio_enabled) | |
1018 return; | |
1019 | |
1020 #if defined (I_SETSIG) && !defined(HPUX10) | 1004 #if defined (I_SETSIG) && !defined(HPUX10) |
1021 ioctl (filedesc, I_SETSIG, DEVICE_OLD_SIGIO_FLAG (d)); | 1005 { |
1006 int events=0; | |
1007 ioctl (filedesc, I_GETSIG, &events); | |
1008 ioctl (filedesc, I_SETSIG, events & ~S_INPUT); | |
1009 } | |
1022 #elif defined (FASYNC) | 1010 #elif defined (FASYNC) |
1023 fcntl (filedesc, F_SETFL, DEVICE_OLD_SIGIO_FLAG (d)); | 1011 fcntl (filedesc, F_SETFL, fcntl (filedesc, F_GETFL, 0) & ~FASYNC); |
1024 #elif defined (FIOSSAIOSTAT) | 1012 #elif defined (FIOSSAIOSTAT) |
1025 { | 1013 { |
1026 /* DG: Changed for HP-UX. HP-UX uses different IOCTLs for | 1014 /* DG: Changed for HP-UX. HP-UX uses different IOCTLs for |
1027 sockets and other devices for some bizarre reason. We guess | 1015 sockets and other devices for some bizarre reason. We guess |
1028 that an X device is a socket, and tty devices aren't. We then | 1016 that an X device is a socket, and tty devices aren't. We then |
1046 { | 1034 { |
1047 int off = 0; | 1035 int off = 0; |
1048 ioctl (filedesc, FIOASYNC, &off); | 1036 ioctl (filedesc, FIOASYNC, &off); |
1049 } | 1037 } |
1050 #endif | 1038 #endif |
1051 | |
1052 d->sigio_enabled = 0; | |
1053 } | 1039 } |
1054 | 1040 |
1055 void | 1041 void |
1056 request_sigio (void) | 1042 request_sigio (void) |
1057 { | 1043 { |