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>
| 2086 | 1 | /* This file is part of the Project Athena Zephyr Notification System. |
| 2 | * It contains source for the ZSendPacket function. | |
| 3 | * | |
| 4 | * Created by: Robert French | |
| 5 | * | |
| 6 | * $Source$ | |
|
8792
b0645c9dc276
[gaim-migrate @ 9554]
Christian Hammond <chipx86@chipx86.com>
parents:
7475
diff
changeset
|
7 | * $Author: chipx86 $ |
| 2086 | 8 | * |
| 9 | * Copyright (c) 1987,1991 by the Massachusetts Institute of Technology. | |
| 10 | * For copying and distribution information, see the file | |
| 11 | * "mit-copyright.h". | |
| 12 | */ | |
| 13 | /* $Header$ */ | |
| 14 | ||
| 15 | #ifndef lint | |
| 16 | static char rcsid_ZSendPacket_c[] = | |
| 17 | "$Zephyr: /mit/zephyr/src/lib/RCS/ZSendPacket.c,v 1.29 91/03/21 11:57:08 raeburn Exp $"; | |
| 18 | #endif | |
| 19 | ||
|
8792
b0645c9dc276
[gaim-migrate @ 9554]
Christian Hammond <chipx86@chipx86.com>
parents:
7475
diff
changeset
|
20 | #include "internal.h" |
| 2086 | 21 | #include <sys/socket.h> |
| 22 | ||
| 2419 | 23 | static int wait_for_hmack(); |
| 2086 | 24 | |
| 25 | Code_t ZSendPacket(packet, len, waitforack) | |
| 26 | char *packet; | |
| 27 | int len; | |
| 28 | int waitforack; | |
| 29 | { | |
| 30 | Code_t retval; | |
| 31 | struct sockaddr_in dest; | |
| 32 | ZNotice_t notice, acknotice; | |
| 33 | ||
| 34 | if (!packet || len < 0) | |
| 35 | return (ZERR_ILLVAL); | |
| 36 | ||
| 37 | if (len > Z_MAXPKTLEN) | |
| 38 | return (ZERR_PKTLEN); | |
| 39 | ||
| 40 | if (ZGetFD() < 0) | |
|
7475
987384816492
[gaim-migrate @ 8088]
Mark Doliner <markdoliner@pidgin.im>
parents:
2419
diff
changeset
|
41 | if ((retval = ZOpenPort((unsigned short *)0)) != ZERR_NONE) |
| 2086 | 42 | return (retval); |
| 43 | ||
| 44 | dest = ZGetDestAddr(); | |
| 45 | ||
| 46 | if (sendto(ZGetFD(), packet, len, 0, (struct sockaddr *)&dest, | |
| 47 | sizeof(dest)) < 0) | |
| 48 | return (errno); | |
| 49 | ||
| 50 | if (!waitforack) | |
| 51 | return (ZERR_NONE); | |
| 52 | ||
| 53 | if ((retval = ZParseNotice(packet, len, ¬ice)) != ZERR_NONE) | |
| 54 | return (retval); | |
| 55 | ||
| 2419 | 56 | retval = Z_WaitForNotice (&acknotice, wait_for_hmack, ¬ice.z_uid, |
| 2086 | 57 | HM_TIMEOUT); |
| 58 | if (retval == ETIMEDOUT) | |
| 59 | return ZERR_HMDEAD; | |
| 60 | if (retval == ZERR_NONE) | |
| 61 | ZFreeNotice (&acknotice); | |
| 62 | return retval; | |
| 63 | } | |
| 64 | ||
| 2419 | 65 | static int wait_for_hmack(notice, uid) |
| 2086 | 66 | ZNotice_t *notice; |
| 67 | ZUnique_Id_t *uid; | |
| 68 | { | |
| 2419 | 69 | return (notice->z_kind == HMACK && ZCompareUID(¬ice->z_uid, uid)); |
| 2086 | 70 | } |