annotate src/dump-data.c @ 5518:3cc7470ea71c

gnuclient: if TMPDIR was set and connect failed, try again with /tmp 2011-06-03 Aidan Kehoe <kehoea@parhasard.net> * gnuslib.c (connect_to_unix_server): Retry with /tmp as a directory in which to search for Unix sockets if an attempt to connect with some other directory failed (which may be because gnuclient and gnuserv don't share an environment value for TMPDIR, or because gnuserv was compiled with USE_TMPDIR turned off).
author Aidan Kehoe <kehoea@parhasard.net>
date Fri, 03 Jun 2011 18:40:57 +0100
parents 308d34e9f07d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2015
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
1 /* Static array to put the dumped data in and its management
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
2 Copyright (C) 2003 Olivier Galibert
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
3
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
4 This file is part of XEmacs.
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
5
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 2367
diff changeset
6 XEmacs is free software: you can redistribute it and/or modify it
2015
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 2367
diff changeset
8 Free Software Foundation, either version 3 of the License, or (at your
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 2367
diff changeset
9 option) any later version.
2015
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
10
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
14 for more details.
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
15
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 2367
diff changeset
17 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */
2015
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
18
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
19 /* Synched up with: Not in FSF. */
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
20
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
21 /* Mule-ized? Mwahahahahahaha */
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
22
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
23 /* Magic values by Larry McVoy to prevent every known compiler, including
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
24 an especially perverse HP-UX one, from putting the array in BSS.
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
25 */
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
26
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
27
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
28 #include <config.h>
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
29 #include "lisp.h"
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
30 #include "dump-data.h"
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
31
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
32 /* 4 bytes for the data size, 4096 for alignment */
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
33
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2035
diff changeset
34 static Rawbyte dumped_data[MAX_SIZE+4096+4] = {
2015
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
35 255,
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
36 6,
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
37 1,
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
38 2,
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
39 3,
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
40 4,
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
41 255,
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
42 3,
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
43 9,
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
44 62,
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
45 255,
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
46 10,
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
47 4,
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
48 61,
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
49 255
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
50 };
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
51
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
52 size_t
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2035
diff changeset
53 dumped_data_size (void)
2015
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
54 {
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2035
diff changeset
55 return dumped_data[0] | (dumped_data[1] << 8) | (dumped_data[2] << 16) |
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2035
diff changeset
56 (dumped_data[3] << 24);
2015
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
57 }
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
58
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
59 size_t
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2035
diff changeset
60 dumped_data_max_size (void)
2015
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
61 {
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
62 return MAX_SIZE;
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
63 }
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
64
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
65 size_t
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2035
diff changeset
66 dumped_data_align_offset (void)
2015
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
67 {
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2035
diff changeset
68 EMACS_INT iptr = (EMACS_INT) dumped_data;
2015
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
69 EMACS_INT iptr2;
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2035
diff changeset
70 iptr2 = (iptr + 4 + 4095) & ~(EMACS_INT) 4095;
2015
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
71
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2035
diff changeset
72 return iptr2 - iptr;
2015
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
73 }
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
74
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2035
diff changeset
75 Rawbyte *
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2035
diff changeset
76 dumped_data_get (void)
2015
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
77 {
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2035
diff changeset
78 EMACS_INT iptr = (EMACS_INT) dumped_data;
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2035
diff changeset
79 iptr = (iptr + 4 + 4095) & ~(EMACS_INT) 4095;
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2035
diff changeset
80 return (Rawbyte *) iptr;
2015
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
81 }
2364237fbc0f [xemacs-hg @ 2004-04-15 20:56:17 by olivierg]
olivierg
parents:
diff changeset
82