Thu, 07 Apr 2005 14:55:02 +0000
[gaim-migrate @ 12431]
" The following log snippets should explain it: " --rlaager
(20:24:00) rlaager: Regarding the signal handling
conversation the other day... I've written a patch to stop
calling signal handlers and return as soon as we find one
signal handler that returns TRUE to indicate that it's
handled the signal. Is this the right approach?
(20:24:22) Ethan Blanton (Paco-Paco): the trouble is that it's
documented to behave exactly the way it does
(20:24:31) Ethan Blanton (Paco-Paco): so changing it is
notbackwards compatible
(20:24:31) rlaager: I'm talking for HEAD.
(20:24:41) Ethan Blanton (Paco-Paco): oh, I think that's a
good approach, yes
(20:24:53) rlaager: The way I've described is how I
*expected* it to work, having not read the documentation.
(20:25:09) Ethan Blanton (Paco-Paco): I'm convinced
(20:27:04) Stu Tomlinson (nosnilmot): rlaager: this, I
assume, breaks the generic-ness of signals, by assuming
that any that return values return booleans?
(20:27:26) Ethan Blanton (Paco-Paco): please break it
(20:27:33) Ethan Blanton (Paco-Paco): we already have
out-parameters
(20:27:42) rlaager: nosnilmot: from what I can see, the
return type is handled as a (void *)... so I'm checking that
ret_value != NULL
(20:27:57) rlaager: nosnilmot: that's the correct way to do it,
right?
...
(20:29:01) Ethan Blanton (Paco-Paco): allowing a
meaningful return value is an over-engineering
(20:30:07) rlaager: even after this patch, you should be able
to return meaningful return values
(20:30:15) rlaager: it'll just short-circuit on the first handler
that does
committer: Luke Schierer <lschiere@pidgin.im>
| 2419 | 1 | /* This file is part of the Project Athena Zephyr Notification System. |
| 2 | * It contains the ZhmStat() function. | |
| 3 | * | |
| 4 | * Created by: Marc Horowitz | |
| 5 | * | |
|
8792
b0645c9dc276
[gaim-migrate @ 9554]
Christian Hammond <chipx86@chipx86.com>
parents:
2419
diff
changeset
|
6 | * $Id: ZhmStat.c 9554 2004-04-24 09:02:28Z chipx86 $ |
| 2419 | 7 | * |
| 8 | * Copyright (c) 1996 by the Massachusetts Institute of Technology. | |
| 9 | * For copying and distribution information, see the file | |
| 10 | * "mit-copyright.h". | |
| 11 | */ | |
| 12 | ||
|
8792
b0645c9dc276
[gaim-migrate @ 9554]
Christian Hammond <chipx86@chipx86.com>
parents:
2419
diff
changeset
|
13 | #include "internal.h" |
| 2419 | 14 | #include <sys/socket.h> |
| 15 | ||
| 16 | #ifndef INADDR_LOOPBACK | |
| 17 | #define INADDR_LOOPBACK 0x7f000001 | |
| 18 | #endif | |
| 19 | ||
| 20 | Code_t ZhmStat(hostaddr, notice) | |
| 21 | struct in_addr *hostaddr; | |
| 22 | ZNotice_t *notice; | |
| 23 | { | |
| 24 | struct servent *sp; | |
| 25 | struct sockaddr_in sin; | |
| 26 | ZNotice_t req; | |
| 27 | Code_t code; | |
| 28 | struct timeval tv; | |
| 29 | fd_set readers; | |
| 30 | ||
| 31 | (void) memset((char *)&sin, 0, sizeof(struct sockaddr_in)); | |
| 32 | ||
| 33 | sp = getservbyname(HM_SVCNAME, "udp"); | |
| 34 | ||
| 35 | sin.sin_port = (sp) ? sp->s_port : HM_SVC_FALLBACK; | |
| 36 | sin.sin_family = AF_INET; | |
| 37 | ||
| 38 | if (hostaddr) | |
| 39 | sin.sin_addr = *hostaddr; | |
| 40 | else | |
| 41 | sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); | |
| 42 | ||
| 43 | (void) memset((char *)&req, 0, sizeof(req)); | |
| 44 | req.z_kind = STAT; | |
| 45 | req.z_port = 0; | |
| 46 | req.z_class = HM_STAT_CLASS; | |
| 47 | req.z_class_inst = HM_STAT_CLIENT; | |
| 48 | req.z_opcode = HM_GIMMESTATS; | |
| 49 | req.z_sender = ""; | |
| 50 | req.z_recipient = ""; | |
| 51 | req.z_default_format = ""; | |
| 52 | req.z_message_len = 0; | |
| 53 | ||
| 54 | if ((code = ZSetDestAddr(&sin)) != ZERR_NONE) | |
| 55 | return(code); | |
| 56 | ||
| 57 | if ((code = ZSendNotice(&req, ZNOAUTH)) != ZERR_NONE) | |
| 58 | return(code); | |
| 59 | ||
| 60 | /* Wait up to ten seconds for a response. */ | |
| 61 | FD_ZERO(&readers); | |
| 62 | FD_SET(ZGetFD(), &readers); | |
| 63 | tv.tv_sec = 10; | |
| 64 | tv.tv_usec = 0; | |
| 65 | code = select(ZGetFD() + 1, &readers, NULL, NULL, &tv); | |
| 66 | if (code < 0 && errno != EINTR) | |
| 67 | return(errno); | |
| 68 | if (code == 0 || (code < 0 && errno == EINTR) || ZPending() == 0) | |
| 69 | return(ZERR_HMDEAD); | |
| 70 | ||
| 71 | return(ZReceiveNotice(notice, (struct sockaddr_in *) 0)); | |
| 72 | } |