Revision 511d2b14
b/block-dmg.c | ||
---|---|---|
85 | 85 |
return -errno; |
86 | 86 |
bs->read_only = 1; |
87 | 87 |
s->n_chunks = 0; |
88 |
s->offsets = s->lengths = s->sectors = s->sectorcounts = 0;
|
|
88 |
s->offsets = s->lengths = s->sectors = s->sectorcounts = NULL;
|
|
89 | 89 |
|
90 | 90 |
/* read offset of info blocks */ |
91 | 91 |
if(lseek(s->fd,-0x1d8,SEEK_END)<0) { |
b/block-vmdk.c | ||
---|---|---|
134 | 134 |
cid_str_size = sizeof("CID"); |
135 | 135 |
} |
136 | 136 |
|
137 |
if ((p_name = strstr(desc,cid_str)) != 0) {
|
|
137 |
if ((p_name = strstr(desc,cid_str)) != NULL) {
|
|
138 | 138 |
p_name += cid_str_size; |
139 | 139 |
sscanf(p_name,"%x",&cid); |
140 | 140 |
} |
... | ... | |
154 | 154 |
|
155 | 155 |
tmp_str = strstr(desc,"parentCID"); |
156 | 156 |
pstrcpy(tmp_desc, sizeof(tmp_desc), tmp_str); |
157 |
if ((p_name = strstr(desc,"CID")) != 0) {
|
|
157 |
if ((p_name = strstr(desc,"CID")) != NULL) {
|
|
158 | 158 |
p_name += sizeof("CID"); |
159 | 159 |
snprintf(p_name, sizeof(desc) - (p_name - desc), "%x\n", cid); |
160 | 160 |
pstrcat(desc, sizeof(desc), tmp_desc); |
... | ... | |
239 | 239 |
if (read(p_fd, p_desc, DESC_SIZE) != DESC_SIZE) |
240 | 240 |
goto fail; |
241 | 241 |
|
242 |
if ((p_name = strstr(p_desc,"CID")) != 0) {
|
|
242 |
if ((p_name = strstr(p_desc,"CID")) != NULL) {
|
|
243 | 243 |
p_name += sizeof("CID"); |
244 | 244 |
sscanf(p_name,"%x",&p_cid); |
245 | 245 |
} |
... | ... | |
330 | 330 |
if (bdrv_pread(s->hd, 0x200, desc, DESC_SIZE) != DESC_SIZE) |
331 | 331 |
return -1; |
332 | 332 |
|
333 |
if ((p_name = strstr(desc,"parentFileNameHint")) != 0) {
|
|
333 |
if ((p_name = strstr(desc,"parentFileNameHint")) != NULL) {
|
|
334 | 334 |
char *end_name; |
335 | 335 |
struct stat file_buf; |
336 | 336 |
|
337 | 337 |
p_name += sizeof("parentFileNameHint") + 1; |
338 |
if ((end_name = strchr(p_name,'\"')) == 0)
|
|
338 |
if ((end_name = strchr(p_name,'\"')) == NULL)
|
|
339 | 339 |
return -1; |
340 | 340 |
if ((end_name - p_name) > sizeof (s->hd->backing_file) - 1) |
341 | 341 |
return -1; |
b/block-vvfat.c | ||
---|---|---|
78 | 78 |
|
79 | 79 |
static inline void array_init(array_t* array,unsigned int item_size) |
80 | 80 |
{ |
81 |
array->pointer=0;
|
|
81 |
array->pointer = NULL;
|
|
82 | 82 |
array->size=0; |
83 | 83 |
array->next=0; |
84 | 84 |
array->item_size=item_size; |
... | ... | |
129 | 129 |
int increment=count*array->item_size; |
130 | 130 |
array->pointer=qemu_realloc(array->pointer,array->size+increment); |
131 | 131 |
if(!array->pointer) |
132 |
return 0;
|
|
132 |
return NULL;
|
|
133 | 133 |
array->size+=increment; |
134 | 134 |
} |
135 | 135 |
memmove(array->pointer+(index+count)*array->item_size, |
... | ... | |
604 | 604 |
unsigned int directory_start, const char* filename, int is_dot) |
605 | 605 |
{ |
606 | 606 |
int i,j,long_index=s->directory.next; |
607 |
direntry_t* entry=0;
|
|
608 |
direntry_t* entry_long=0;
|
|
607 |
direntry_t* entry = NULL;
|
|
608 |
direntry_t* entry_long = NULL;
|
|
609 | 609 |
|
610 | 610 |
if(is_dot) { |
611 | 611 |
entry=array_get_next(&(s->directory)); |
... | ... | |
696 | 696 |
int first_cluster = mapping->begin; |
697 | 697 |
int parent_index = mapping->info.dir.parent_mapping_index; |
698 | 698 |
mapping_t* parent_mapping = (mapping_t*) |
699 |
(parent_index >= 0 ? array_get(&(s->mapping), parent_index) : 0);
|
|
699 |
(parent_index >= 0 ? array_get(&(s->mapping), parent_index) : NULL);
|
|
700 | 700 |
int first_cluster_of_parent = parent_mapping ? parent_mapping->begin : -1; |
701 | 701 |
|
702 | 702 |
DIR* dir=opendir(dirname); |
... | ... | |
1125 | 1125 |
int index=find_mapping_for_cluster_aux(s,cluster_num,0,s->mapping.next); |
1126 | 1126 |
mapping_t* mapping; |
1127 | 1127 |
if(index>=s->mapping.next) |
1128 |
return 0;
|
|
1128 |
return NULL;
|
|
1129 | 1129 |
mapping=array_get(&(s->mapping),index); |
1130 | 1130 |
if(mapping->begin>cluster_num) |
1131 |
return 0;
|
|
1131 |
return NULL;
|
|
1132 | 1132 |
assert(mapping->begin<=cluster_num && mapping->end>cluster_num); |
1133 | 1133 |
return mapping; |
1134 | 1134 |
} |
b/bt-host.c | ||
---|---|---|
171 | 171 |
if (fd < 0) { |
172 | 172 |
fprintf(stderr, "qemu: Can't open `%s': %s (%i)\n", |
173 | 173 |
id, strerror(errno), errno); |
174 |
return 0;
|
|
174 |
return NULL;
|
|
175 | 175 |
} |
176 | 176 |
|
177 | 177 |
# ifdef CONFIG_BLUEZ |
... | ... | |
192 | 192 |
s->hci.acl_send = bt_host_acl; |
193 | 193 |
s->hci.bdaddr_set = bt_host_bdaddr_set; |
194 | 194 |
|
195 |
qemu_set_fd_handler2(s->fd, bt_host_read_poll, bt_host_read, 0, s);
|
|
195 |
qemu_set_fd_handler2(s->fd, bt_host_read_poll, bt_host_read, NULL, s);
|
|
196 | 196 |
|
197 | 197 |
return &s->hci; |
198 | 198 |
} |
b/bt-vhci.c | ||
---|---|---|
165 | 165 |
s->info->evt_recv = vhci_out_hci_packet_event; |
166 | 166 |
s->info->acl_recv = vhci_out_hci_packet_acl; |
167 | 167 |
|
168 |
qemu_set_fd_handler(s->fd, vhci_read, 0, s);
|
|
168 |
qemu_set_fd_handler(s->fd, vhci_read, NULL, s);
|
|
169 | 169 |
} |
b/console.c | ||
---|---|---|
1327 | 1327 |
unsigned height; |
1328 | 1328 |
static int color_inited; |
1329 | 1329 |
|
1330 |
s = new_console(ds, (p == 0) ? TEXT_CONSOLE : TEXT_CONSOLE_FIXED_SIZE);
|
|
1330 |
s = new_console(ds, (p == NULL) ? TEXT_CONSOLE : TEXT_CONSOLE_FIXED_SIZE);
|
|
1331 | 1331 |
if (!s) { |
1332 | 1332 |
free(chr); |
1333 | 1333 |
return; |
... | ... | |
1353 | 1353 |
s->y = 0; |
1354 | 1354 |
width = ds_get_width(s->ds); |
1355 | 1355 |
height = ds_get_height(s->ds); |
1356 |
if (p != 0) {
|
|
1356 |
if (p != NULL) {
|
|
1357 | 1357 |
width = strtoul(p, (char **)&p, 10); |
1358 | 1358 |
if (*p == 'C') { |
1359 | 1359 |
p++; |
b/curses.c | ||
---|---|---|
21 | 21 |
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
22 | 22 |
* THE SOFTWARE. |
23 | 23 |
*/ |
24 |
|
|
25 |
#include "qemu-common.h" |
|
26 |
#include "console.h" |
|
27 |
#include "sysemu.h" |
|
28 |
|
|
29 | 24 |
#include <curses.h> |
30 | 25 |
|
31 | 26 |
#ifndef _WIN32 |
... | ... | |
38 | 33 |
#define resize_term resizeterm |
39 | 34 |
#endif |
40 | 35 |
|
36 |
#include "qemu-common.h" |
|
37 |
#include "console.h" |
|
38 |
#include "sysemu.h" |
|
39 |
|
|
41 | 40 |
#define FONT_HEIGHT 16 |
42 | 41 |
#define FONT_WIDTH 8 |
43 | 42 |
|
b/exec.c | ||
---|---|---|
179 | 179 |
CPUWriteMemoryFunc *io_mem_write[IO_MEM_NB_ENTRIES][4]; |
180 | 180 |
CPUReadMemoryFunc *io_mem_read[IO_MEM_NB_ENTRIES][4]; |
181 | 181 |
void *io_mem_opaque[IO_MEM_NB_ENTRIES]; |
182 |
char io_mem_used[IO_MEM_NB_ENTRIES]; |
|
182 |
static char io_mem_used[IO_MEM_NB_ENTRIES];
|
|
183 | 183 |
static int io_mem_watch; |
184 | 184 |
#endif |
185 | 185 |
|
b/hw/bt-hci.c | ||
---|---|---|
446 | 446 |
mask_byte = (evt - 1) >> 3; |
447 | 447 |
mask = 1 << ((evt - 1) & 3); |
448 | 448 |
if (mask & bt_event_reserved_mask[mask_byte] & ~hci->event_mask[mask_byte]) |
449 |
return 0;
|
|
449 |
return NULL;
|
|
450 | 450 |
|
451 | 451 |
packet = hci->evt_packet(hci->opaque); |
452 | 452 |
packet[0] = evt; |
... | ... | |
664 | 664 |
static void bt_hci_lmp_link_teardown(struct bt_hci_s *hci, uint16_t handle) |
665 | 665 |
{ |
666 | 666 |
handle &= ~HCI_HANDLE_OFFSET; |
667 |
hci->lm.handle[handle].link = 0;
|
|
667 |
hci->lm.handle[handle].link = NULL;
|
|
668 | 668 |
|
669 | 669 |
if (bt_hci_role_master(hci, handle)) { |
670 | 670 |
qemu_del_timer(hci->lm.handle[handle].acl_mode_timer); |
... | ... | |
1138 | 1138 |
hci->device.page_scan = 0; |
1139 | 1139 |
if (hci->device.lmp_name) |
1140 | 1140 |
qemu_free((void *) hci->device.lmp_name); |
1141 |
hci->device.lmp_name = 0;
|
|
1141 |
hci->device.lmp_name = NULL;
|
|
1142 | 1142 |
hci->device.class[0] = 0x00; |
1143 | 1143 |
hci->device.class[1] = 0x00; |
1144 | 1144 |
hci->device.class[2] = 0x00; |
... | ... | |
1617 | 1617 |
|
1618 | 1618 |
bt_hci_event_status(hci, HCI_SUCCESS); |
1619 | 1619 |
bt_hci_connection_accept(hci, hci->conn_req_host); |
1620 |
hci->conn_req_host = 0;
|
|
1620 |
hci->conn_req_host = NULL;
|
|
1621 | 1621 |
break; |
1622 | 1622 |
|
1623 | 1623 |
case cmd_opcode_pack(OGF_LINK_CTL, OCF_REJECT_CONN_REQ): |
... | ... | |
1634 | 1634 |
bt_hci_connection_reject(hci, hci->conn_req_host, |
1635 | 1635 |
PARAM(reject_conn_req, reason)); |
1636 | 1636 |
bt_hci_connection_reject_event(hci, &hci->conn_req_host->bd_addr); |
1637 |
hci->conn_req_host = 0;
|
|
1637 |
hci->conn_req_host = NULL;
|
|
1638 | 1638 |
break; |
1639 | 1639 |
|
1640 | 1640 |
case cmd_opcode_pack(OGF_LINK_CTL, OCF_AUTH_REQUESTED): |
b/hw/bt-hid.c | ||
---|---|---|
324 | 324 |
break; |
325 | 325 |
} |
326 | 326 |
s->proto = parameter; |
327 |
s->usbdev->handle_control(s->usbdev, SET_PROTOCOL, s->proto, 0, 0, 0); |
|
327 |
s->usbdev->handle_control(s->usbdev, SET_PROTOCOL, s->proto, 0, 0, |
|
328 |
NULL); |
|
328 | 329 |
ret = BT_HS_SUCCESSFUL; |
329 | 330 |
break; |
330 | 331 |
|
... | ... | |
347 | 348 |
/* We don't need to know about the Idle Rate here really, |
348 | 349 |
* so just pass it on to the device. */ |
349 | 350 |
ret = s->usbdev->handle_control(s->usbdev, |
350 |
SET_IDLE, data[1], 0, 0, 0) ?
|
|
351 |
SET_IDLE, data[1], 0, 0, NULL) ?
|
|
351 | 352 |
BT_HS_SUCCESSFUL : BT_HS_ERR_INVALID_PARAMETER; |
352 | 353 |
/* XXX: Does this generate a handshake? */ |
353 | 354 |
break; |
... | ... | |
462 | 463 |
{ |
463 | 464 |
struct bt_hid_device_s *hid = opaque; |
464 | 465 |
|
465 |
hid->control = 0;
|
|
466 |
hid->control = NULL;
|
|
466 | 467 |
bt_hid_connected_update(hid); |
467 | 468 |
} |
468 | 469 |
|
... | ... | |
470 | 471 |
{ |
471 | 472 |
struct bt_hid_device_s *hid = opaque; |
472 | 473 |
|
473 |
hid->interrupt = 0;
|
|
474 |
hid->interrupt = NULL;
|
|
474 | 475 |
bt_hid_connected_update(hid); |
475 | 476 |
} |
476 | 477 |
|
b/hw/bt-l2cap.c | ||
---|---|---|
401 | 401 |
static struct l2cap_chan_s *l2cap_channel_open(struct l2cap_instance_s *l2cap, |
402 | 402 |
int psm, int source_cid) |
403 | 403 |
{ |
404 |
struct l2cap_chan_s *ch = 0;
|
|
404 |
struct l2cap_chan_s *ch = NULL;
|
|
405 | 405 |
struct bt_l2cap_psm_s *psm_info; |
406 | 406 |
int result, status; |
407 | 407 |
int cid = l2cap_cid_new(l2cap); |
... | ... | |
452 | 452 |
static void l2cap_channel_close(struct l2cap_instance_s *l2cap, |
453 | 453 |
int cid, int source_cid) |
454 | 454 |
{ |
455 |
struct l2cap_chan_s *ch = 0;
|
|
455 |
struct l2cap_chan_s *ch = NULL;
|
|
456 | 456 |
|
457 | 457 |
/* According to Volume 3, section 6.1.1, pg 1048 of BT Core V2.0, a |
458 | 458 |
* connection in CLOSED state still responds with a L2CAP_DisconnectRsp |
... | ... | |
472 | 472 |
return; |
473 | 473 |
} |
474 | 474 |
|
475 |
l2cap->cid[cid] = 0;
|
|
475 |
l2cap->cid[cid] = NULL;
|
|
476 | 476 |
|
477 | 477 |
ch->params.close(ch->params.opaque); |
478 | 478 |
qemu_free(ch); |
... | ... | |
484 | 484 |
static void l2cap_channel_config_null(struct l2cap_instance_s *l2cap, |
485 | 485 |
struct l2cap_chan_s *ch) |
486 | 486 |
{ |
487 |
l2cap_configuration_request(l2cap, ch->remote_cid, 0, 0, 0);
|
|
487 |
l2cap_configuration_request(l2cap, ch->remote_cid, 0, NULL, 0);
|
|
488 | 488 |
ch->config_req_id = l2cap->last_id; |
489 | 489 |
ch->config &= ~L2CAP_CFG_INIT; |
490 | 490 |
} |
b/hw/bt-sdp.c | ||
---|---|---|
948 | 948 |
&sdp_service_sdp_s, |
949 | 949 |
&sdp_service_hid_s, |
950 | 950 |
&sdp_service_pnp_s, |
951 |
0,
|
|
951 |
NULL,
|
|
952 | 952 |
}; |
953 | 953 |
|
954 | 954 |
sdp->channel = params; |
b/hw/ppce500_mpc8544ds.c | ||
---|---|---|
47 | 47 |
#define MPC8544_PCI_IO 0xE1000000 |
48 | 48 |
#define MPC8544_PCI_IOLEN 0x10000 |
49 | 49 |
|
50 |
#ifdef HAVE_FDT |
|
50 | 51 |
static int mpc8544_copy_soc_cell(void *fdt, const char *node, const char *prop) |
51 | 52 |
{ |
52 | 53 |
uint32_t cell; |
... | ... | |
68 | 69 |
out: |
69 | 70 |
return ret; |
70 | 71 |
} |
72 |
#endif |
|
71 | 73 |
|
72 | 74 |
static void *mpc8544_load_device_tree(void *addr, |
73 | 75 |
uint32_t ramsize, |
b/hw/usb-bt.c | ||
---|---|---|
612 | 612 |
{ |
613 | 613 |
struct USBBtState *s = (struct USBBtState *) dev->opaque; |
614 | 614 |
|
615 |
s->hci->opaque = 0;
|
|
616 |
s->hci->evt_recv = 0;
|
|
617 |
s->hci->acl_recv = 0;
|
|
615 |
s->hci->opaque = NULL;
|
|
616 |
s->hci->evt_recv = NULL;
|
|
617 |
s->hci->acl_recv = NULL;
|
|
618 | 618 |
qemu_free(s); |
619 | 619 |
} |
620 | 620 |
|
b/hw/vmware_vga.c | ||
---|---|---|
230 | 230 |
#ifdef VERBOSE |
231 | 231 |
# define GUEST_OS_BASE 0x5001 |
232 | 232 |
static const char *vmsvga_guest_id[] = { |
233 |
[0x00 ... 0x15] = "an unknown OS", |
|
234 | 233 |
[0x00] = "Dos", |
235 | 234 |
[0x01] = "Windows 3.1", |
236 | 235 |
[0x02] = "Windows 95", |
... | ... | |
240 | 239 |
[0x06] = "Windows 2000", |
241 | 240 |
[0x07] = "Linux", |
242 | 241 |
[0x08] = "OS/2", |
242 |
[0x09] = "an unknown OS", |
|
243 | 243 |
[0x0a] = "BSD", |
244 | 244 |
[0x0b] = "Whistler", |
245 |
[0x0c] = "an unknown OS", |
|
246 |
[0x0d] = "an unknown OS", |
|
247 |
[0x0e] = "an unknown OS", |
|
248 |
[0x0f] = "an unknown OS", |
|
249 |
[0x10] = "an unknown OS", |
|
250 |
[0x11] = "an unknown OS", |
|
251 |
[0x12] = "an unknown OS", |
|
252 |
[0x13] = "an unknown OS", |
|
253 |
[0x14] = "an unknown OS", |
|
245 | 254 |
[0x15] = "Windows 2003", |
246 | 255 |
}; |
247 | 256 |
#endif |
b/hw/wm8750.c | ||
---|---|---|
184 | 184 |
for (i = 0; i < IN_PORT_N; i ++) |
185 | 185 |
if (s->adc_voice[i]) { |
186 | 186 |
AUD_close_in(&s->card, s->adc_voice[i]); |
187 |
s->adc_voice[i] = 0;
|
|
187 |
s->adc_voice[i] = NULL;
|
|
188 | 188 |
} |
189 | 189 |
for (i = 0; i < OUT_PORT_N; i ++) |
190 | 190 |
if (s->dac_voice[i]) { |
191 | 191 |
AUD_close_out(&s->card, s->dac_voice[i]); |
192 |
s->dac_voice[i] = 0;
|
|
192 |
s->dac_voice[i] = NULL;
|
|
193 | 193 |
} |
194 | 194 |
|
195 | 195 |
if (!s->enable) |
b/monitor.c | ||
---|---|---|
21 | 21 |
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
22 | 22 |
* THE SOFTWARE. |
23 | 23 |
*/ |
24 |
#include <dirent.h> |
|
24 | 25 |
#include "hw/hw.h" |
25 | 26 |
#include "hw/usb.h" |
26 | 27 |
#include "hw/pcmcia.h" |
... | ... | |
37 | 38 |
#include "audio/audio.h" |
38 | 39 |
#include "disas.h" |
39 | 40 |
#include "balloon.h" |
40 |
#include <dirent.h> |
|
41 | 41 |
#include "qemu-timer.h" |
42 | 42 |
#include "migration.h" |
43 | 43 |
#include "kvm.h" |
b/net.c | ||
---|---|---|
21 | 21 |
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
22 | 22 |
* THE SOFTWARE. |
23 | 23 |
*/ |
24 |
#include "qemu-common.h" |
|
25 |
#include "net.h" |
|
26 |
#include "monitor.h" |
|
27 |
#include "sysemu.h" |
|
28 |
#include "qemu-timer.h" |
|
29 |
#include "qemu-char.h" |
|
30 |
#include "audio/audio.h" |
|
31 |
|
|
32 | 24 |
#include <unistd.h> |
33 | 25 |
#include <fcntl.h> |
34 | 26 |
#include <signal.h> |
... | ... | |
98 | 90 |
#endif |
99 | 91 |
#endif |
100 | 92 |
|
101 |
#include "qemu_socket.h" |
|
102 |
|
|
103 |
#if defined(CONFIG_SLIRP) |
|
104 |
#include "libslirp.h" |
|
105 |
#endif |
|
106 |
|
|
107 | 93 |
#if defined(__OpenBSD__) |
108 | 94 |
#include <util.h> |
109 | 95 |
#endif |
... | ... | |
120 | 106 |
#define memalign(align, size) malloc(size) |
121 | 107 |
#endif |
122 | 108 |
|
109 |
#include "qemu-common.h" |
|
110 |
#include "net.h" |
|
111 |
#include "monitor.h" |
|
112 |
#include "sysemu.h" |
|
113 |
#include "qemu-timer.h" |
|
114 |
#include "qemu-char.h" |
|
115 |
#include "audio/audio.h" |
|
116 |
#include "qemu_socket.h" |
|
117 |
|
|
118 |
#if defined(CONFIG_SLIRP) |
|
119 |
#include "libslirp.h" |
|
120 |
#endif |
|
121 |
|
|
122 |
|
|
123 | 123 |
static VLANState *first_vlan; |
124 | 124 |
|
125 | 125 |
/***********************************************************/ |
... | ... | |
585 | 585 |
char filename[1024]; |
586 | 586 |
|
587 | 587 |
/* erase all the files in the directory */ |
588 |
if ((d = opendir(dir_name)) != 0) {
|
|
588 |
if ((d = opendir(dir_name)) != NULL) {
|
|
589 | 589 |
for(;;) { |
590 | 590 |
de = readdir(d); |
591 | 591 |
if (!de) |
... | ... | |
673 | 673 |
struct VMChannel { |
674 | 674 |
CharDriverState *hd; |
675 | 675 |
int port; |
676 |
} *vmchannels;
|
|
676 |
}; |
|
677 | 677 |
|
678 | 678 |
static int vmchannel_can_read(void *opaque) |
679 | 679 |
{ |
b/osdep.c | ||
---|---|---|
33 | 33 |
#include <sys/statvfs.h> |
34 | 34 |
#endif |
35 | 35 |
|
36 |
#include "qemu-common.h" |
|
37 |
#include "sysemu.h" |
|
38 |
|
|
39 | 36 |
#ifdef _WIN32 |
40 | 37 |
#define WIN32_LEAN_AND_MEAN |
41 | 38 |
#include <windows.h> |
... | ... | |
45 | 42 |
#include <malloc.h> |
46 | 43 |
#endif |
47 | 44 |
|
45 |
#include "qemu-common.h" |
|
46 |
#include "sysemu.h" |
|
48 | 47 |
#include "qemu_socket.h" |
49 | 48 |
|
50 | 49 |
#if defined(_WIN32) |
b/savevm.c | ||
---|---|---|
21 | 21 |
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
22 | 22 |
* THE SOFTWARE. |
23 | 23 |
*/ |
24 |
#include "qemu-common.h" |
|
25 |
#include "hw/hw.h" |
|
26 |
#include "net.h" |
|
27 |
#include "monitor.h" |
|
28 |
#include "sysemu.h" |
|
29 |
#include "qemu-timer.h" |
|
30 |
#include "qemu-char.h" |
|
31 |
#include "block.h" |
|
32 |
#include "audio/audio.h" |
|
33 |
#include "migration.h" |
|
34 |
#include "qemu_socket.h" |
|
35 |
|
|
36 | 24 |
#include <unistd.h> |
37 | 25 |
#include <fcntl.h> |
38 | 26 |
#include <signal.h> |
... | ... | |
87 | 75 |
#define memalign(align, size) malloc(size) |
88 | 76 |
#endif |
89 | 77 |
|
78 |
#include "qemu-common.h" |
|
79 |
#include "hw/hw.h" |
|
80 |
#include "net.h" |
|
81 |
#include "monitor.h" |
|
82 |
#include "sysemu.h" |
|
83 |
#include "qemu-timer.h" |
|
84 |
#include "qemu-char.h" |
|
85 |
#include "block.h" |
|
86 |
#include "audio/audio.h" |
|
87 |
#include "migration.h" |
|
88 |
#include "qemu_socket.h" |
|
89 |
|
|
90 | 90 |
/* point to the block driver where the snapshots are managed */ |
91 | 91 |
static BlockDriverState *bs_snapshots; |
92 | 92 |
|
b/sdl.c | ||
---|---|---|
21 | 21 |
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
22 | 22 |
* THE SOFTWARE. |
23 | 23 |
*/ |
24 |
#include "qemu-common.h" |
|
25 |
#include "console.h" |
|
26 |
#include "sysemu.h" |
|
27 |
#include "x_keymap.h" |
|
28 |
|
|
29 | 24 |
#include <SDL.h> |
30 | 25 |
#include <SDL/SDL_syswm.h> |
31 | 26 |
|
... | ... | |
33 | 28 |
#include <signal.h> |
34 | 29 |
#endif |
35 | 30 |
|
31 |
#include "qemu-common.h" |
|
32 |
#include "console.h" |
|
33 |
#include "sysemu.h" |
|
34 |
#include "x_keymap.h" |
|
35 |
|
|
36 | 36 |
static DisplayChangeListener *dcl; |
37 | 37 |
static SDL_Surface *real_screen; |
38 | 38 |
static SDL_Surface *guest_screen = NULL; |
b/slirp/if.c | ||
---|---|---|
32 | 32 |
} |
33 | 33 |
|
34 | 34 |
void |
35 |
if_init() |
|
35 |
if_init(void)
|
|
36 | 36 |
{ |
37 | 37 |
if_fastq.ifq_next = if_fastq.ifq_prev = &if_fastq; |
38 | 38 |
if_batchq.ifq_next = if_batchq.ifq_prev = &if_batchq; |
... | ... | |
133 | 133 |
* it'll temporarily get downgraded to the batchq) |
134 | 134 |
*/ |
135 | 135 |
void |
136 |
if_output(so, ifm) |
|
137 |
struct socket *so; |
|
138 |
struct mbuf *ifm; |
|
136 |
if_output(struct socket *so, struct mbuf *ifm) |
|
139 | 137 |
{ |
140 | 138 |
struct mbuf *ifq; |
141 | 139 |
int on_fastq = 1; |
b/slirp/ip_icmp.c | ||
---|---|---|
68 | 68 |
* Process a received ICMP message. |
69 | 69 |
*/ |
70 | 70 |
void |
71 |
icmp_input(m, hlen) |
|
72 |
struct mbuf *m; |
|
73 |
int hlen; |
|
71 |
icmp_input(struct mbuf *m, int hlen) |
|
74 | 72 |
{ |
75 | 73 |
register struct icmp *icp; |
76 | 74 |
register struct ip *ip=mtod(m, struct ip *); |
... | ... | |
319 | 317 |
* Reflect the ip packet back to the source |
320 | 318 |
*/ |
321 | 319 |
void |
322 |
icmp_reflect(m) |
|
323 |
struct mbuf *m; |
|
320 |
icmp_reflect(struct mbuf *m) |
|
324 | 321 |
{ |
325 | 322 |
register struct ip *ip = mtod(m, struct ip *); |
326 | 323 |
int hlen = ip->ip_hl << 2; |
b/slirp/ip_input.c | ||
---|---|---|
60 | 60 |
* All protocols not implemented in kernel go to raw IP protocol handler. |
61 | 61 |
*/ |
62 | 62 |
void |
63 |
ip_init() |
|
63 |
ip_init(void)
|
|
64 | 64 |
{ |
65 | 65 |
ipq.ip_link.next = ipq.ip_link.prev = &ipq.ip_link; |
66 | 66 |
ip_id = tt.tv_sec & 0xffff; |
... | ... | |
73 | 73 |
* try to reassemble. Process options. Pass to next level. |
74 | 74 |
*/ |
75 | 75 |
void |
76 |
ip_input(m) |
|
77 |
struct mbuf *m; |
|
76 |
ip_input(struct mbuf *m) |
|
78 | 77 |
{ |
79 | 78 |
register struct ip *ip; |
80 | 79 |
int hlen; |
... | ... | |
222 | 221 |
if (ip->ip_tos & 1 || ip->ip_off) { |
223 | 222 |
STAT(ipstat.ips_fragments++); |
224 | 223 |
ip = ip_reass(ip, fp); |
225 |
if (ip == 0)
|
|
224 |
if (ip == NULL)
|
|
226 | 225 |
return; |
227 | 226 |
STAT(ipstat.ips_reassembled++); |
228 | 227 |
m = dtom(ip); |
... | ... | |
289 | 288 |
/* |
290 | 289 |
* If first fragment to arrive, create a reassembly queue. |
291 | 290 |
*/ |
292 |
if (fp == 0) {
|
|
291 |
if (fp == NULL) {
|
|
293 | 292 |
struct mbuf *t; |
294 | 293 |
if ((t = m_get()) == NULL) goto dropfrag; |
295 | 294 |
fp = mtod(t, struct ipq *); |
... | ... | |
357 | 356 |
for (q = fp->frag_link.next; q != (struct ipasfrag*)&fp->frag_link; |
358 | 357 |
q = q->ipf_next) { |
359 | 358 |
if (q->ipf_off != next) |
360 |
return (0);
|
|
359 |
return NULL;
|
|
361 | 360 |
next += q->ipf_len; |
362 | 361 |
} |
363 | 362 |
if (((struct ipasfrag *)(q->ipf_prev))->ipf_tos & 1) |
364 |
return (0);
|
|
363 |
return NULL;
|
|
365 | 364 |
|
366 | 365 |
/* |
367 | 366 |
* Reassembly is complete; concatenate fragments. |
... | ... | |
414 | 413 |
dropfrag: |
415 | 414 |
STAT(ipstat.ips_fragdropped++); |
416 | 415 |
m_freem(m); |
417 |
return (0);
|
|
416 |
return NULL;
|
|
418 | 417 |
} |
419 | 418 |
|
420 | 419 |
/* |
... | ... | |
466 | 465 |
* queue, discard it. |
467 | 466 |
*/ |
468 | 467 |
void |
469 |
ip_slowtimo() |
|
468 |
ip_slowtimo(void)
|
|
470 | 469 |
{ |
471 | 470 |
struct qlink *l; |
472 | 471 |
|
... | ... | |
474 | 473 |
|
475 | 474 |
l = ipq.ip_link.next; |
476 | 475 |
|
477 |
if (l == 0)
|
|
476 |
if (l == NULL)
|
|
478 | 477 |
return; |
479 | 478 |
|
480 | 479 |
while (l != &ipq.ip_link) { |
... | ... | |
702 | 701 |
* (XXX) should be deleted; last arg currently ignored. |
703 | 702 |
*/ |
704 | 703 |
void |
705 |
ip_stripoptions(m, mopt) |
|
706 |
register struct mbuf *m; |
|
707 |
struct mbuf *mopt; |
|
704 |
ip_stripoptions(register struct mbuf *m, struct mbuf *mopt) |
|
708 | 705 |
{ |
709 | 706 |
register int i; |
710 | 707 |
struct ip *ip = mtod(m, struct ip *); |
b/slirp/ip_output.c | ||
---|---|---|
53 | 53 |
* The mbuf opt, if present, will not be freed. |
54 | 54 |
*/ |
55 | 55 |
int |
56 |
ip_output(so, m0) |
|
57 |
struct socket *so; |
|
58 |
struct mbuf *m0; |
|
56 |
ip_output(struct socket *so, struct mbuf *m0) |
|
59 | 57 |
{ |
60 | 58 |
register struct ip *ip; |
61 | 59 |
register struct mbuf *m = m0; |
... | ... | |
135 | 133 |
for (off = hlen + len; off < (u_int16_t)ip->ip_len; off += len) { |
136 | 134 |
register struct ip *mhip; |
137 | 135 |
m = m_get(); |
138 |
if (m == 0) {
|
|
136 |
if (m == NULL) {
|
|
139 | 137 |
error = -1; |
140 | 138 |
STAT(ipstat.ips_odropped++); |
141 | 139 |
goto sendorfree; |
... | ... | |
185 | 183 |
sendorfree: |
186 | 184 |
for (m = m0; m; m = m0) { |
187 | 185 |
m0 = m->m_nextpkt; |
188 |
m->m_nextpkt = 0;
|
|
186 |
m->m_nextpkt = NULL;
|
|
189 | 187 |
if (error == 0) |
190 | 188 |
if_output(so, m); |
191 | 189 |
else |
b/slirp/libslirp.h | ||
---|---|---|
5 | 5 |
extern "C" { |
6 | 6 |
#endif |
7 | 7 |
|
8 |
void slirp_init(int restrict, char *special_ip); |
|
8 |
void slirp_init(int restricted, char *special_ip);
|
|
9 | 9 |
|
10 | 10 |
void slirp_select_fill(int *pnfds, |
11 | 11 |
fd_set *readfds, fd_set *writefds, fd_set *xfds); |
b/slirp/mbuf.c | ||
---|---|---|
29 | 29 |
#define SLIRP_MSIZE (IF_MTU + IF_MAXLINKHDR + sizeof(struct m_hdr ) + 6) |
30 | 30 |
|
31 | 31 |
void |
32 |
m_init() |
|
32 |
m_init(void)
|
|
33 | 33 |
{ |
34 | 34 |
m_freelist.m_next = m_freelist.m_prev = &m_freelist; |
35 | 35 |
m_usedlist.m_next = m_usedlist.m_prev = &m_usedlist; |
... | ... | |
44 | 44 |
* which tells m_free to actually free() it |
45 | 45 |
*/ |
46 | 46 |
struct mbuf * |
47 |
m_get() |
|
47 |
m_get(void)
|
|
48 | 48 |
{ |
49 | 49 |
register struct mbuf *m; |
50 | 50 |
int flags = 0; |
... | ... | |
72 | 72 |
m->m_size = SLIRP_MSIZE - sizeof(struct m_hdr); |
73 | 73 |
m->m_data = m->m_dat; |
74 | 74 |
m->m_len = 0; |
75 |
m->m_nextpkt = 0;
|
|
76 |
m->m_prevpkt = 0;
|
|
75 |
m->m_nextpkt = NULL;
|
|
76 |
m->m_prevpkt = NULL;
|
|
77 | 77 |
end_error: |
78 | 78 |
DEBUG_ARG("m = %lx", (long )m); |
79 | 79 |
return m; |
80 | 80 |
} |
81 | 81 |
|
82 | 82 |
void |
83 |
m_free(m) |
|
84 |
struct mbuf *m; |
|
83 |
m_free(struct mbuf *m) |
|
85 | 84 |
{ |
86 | 85 |
|
87 | 86 |
DEBUG_CALL("m_free"); |
... | ... | |
115 | 114 |
* an M_EXT data segment |
116 | 115 |
*/ |
117 | 116 |
void |
118 |
m_cat(m, n) |
|
119 |
register struct mbuf *m, *n; |
|
117 |
m_cat(struct mbuf *m, struct mbuf *n) |
|
120 | 118 |
{ |
121 | 119 |
/* |
122 | 120 |
* If there's no room, realloc |
... | ... | |
133 | 131 |
|
134 | 132 |
/* make m size bytes large */ |
135 | 133 |
void |
136 |
m_inc(m, size) |
|
137 |
struct mbuf *m; |
|
138 |
int size; |
|
134 |
m_inc(struct mbuf *m, int size) |
|
139 | 135 |
{ |
140 | 136 |
int datasize; |
141 | 137 |
|
... | ... | |
170 | 166 |
|
171 | 167 |
|
172 | 168 |
void |
173 |
m_adj(m, len) |
|
174 |
struct mbuf *m; |
|
175 |
int len; |
|
169 |
m_adj(struct mbuf *m, int len) |
|
176 | 170 |
{ |
177 | 171 |
if (m == NULL) |
178 | 172 |
return; |
... | ... | |
192 | 186 |
* Copy len bytes from m, starting off bytes into n |
193 | 187 |
*/ |
194 | 188 |
int |
195 |
m_copy(n, m, off, len) |
|
196 |
struct mbuf *n, *m; |
|
197 |
int off, len; |
|
189 |
m_copy(struct mbuf *n, struct mbuf *m, int off, int len) |
|
198 | 190 |
{ |
199 | 191 |
if (len > M_FREEROOM(n)) |
200 | 192 |
return -1; |
... | ... | |
211 | 203 |
* Fortunately, it's not used often |
212 | 204 |
*/ |
213 | 205 |
struct mbuf * |
214 |
dtom(dat) |
|
215 |
void *dat; |
|
206 |
dtom(void *dat) |
|
216 | 207 |
{ |
217 | 208 |
struct mbuf *m; |
218 | 209 |
|
b/slirp/misc.c | ||
---|---|---|
70 | 70 |
* Get our IP address and put it in our_addr |
71 | 71 |
*/ |
72 | 72 |
void |
73 |
getouraddr() |
|
73 |
getouraddr(void)
|
|
74 | 74 |
{ |
75 | 75 |
char buff[256]; |
76 | 76 |
struct hostent *he = NULL; |
... | ... | |
89 | 89 |
}; |
90 | 90 |
|
91 | 91 |
inline void |
92 |
insque(a, b) |
|
93 |
void *a, *b; |
|
92 |
insque(void *a, void *b) |
|
94 | 93 |
{ |
95 | 94 |
register struct quehead *element = (struct quehead *) a; |
96 | 95 |
register struct quehead *head = (struct quehead *) b; |
... | ... | |
102 | 101 |
} |
103 | 102 |
|
104 | 103 |
inline void |
105 |
remque(a) |
|
106 |
void *a; |
|
104 |
remque(void *a) |
|
107 | 105 |
{ |
108 | 106 |
register struct quehead *element = (struct quehead *) a; |
109 | 107 |
((struct quehead *)(element->qh_link))->qh_rlink = element->qh_rlink; |
... | ... | |
116 | 114 |
|
117 | 115 |
|
118 | 116 |
int |
119 |
add_exec(ex_ptr, do_pty, exec, addr, port) |
|
120 |
struct ex_list **ex_ptr; |
|
121 |
int do_pty; |
|
122 |
char *exec; |
|
123 |
int addr; |
|
124 |
int port; |
|
117 |
add_exec(struct ex_list **ex_ptr, int do_pty, char *exec, int addr, int port) |
|
125 | 118 |
{ |
126 | 119 |
struct ex_list *tmp_ptr; |
127 | 120 |
|
... | ... | |
363 | 356 |
argv[i++] = strdup(curarg); |
364 | 357 |
} while (c); |
365 | 358 |
|
366 |
argv[i] = 0;
|
|
359 |
argv[i] = NULL;
|
|
367 | 360 |
execvp(argv[0], (char **)argv); |
368 | 361 |
|
369 | 362 |
/* Ooops, failed, let's tell the user why */ |
... | ... | |
402 | 395 |
fd_nonblock(so->s); |
403 | 396 |
|
404 | 397 |
/* Append the telnet options now */ |
405 |
if (so->so_m != 0 && do_pty == 1) {
|
|
398 |
if (so->so_m != NULL && do_pty == 1) {
|
|
406 | 399 |
sbappend(so, so->so_m); |
407 |
so->so_m = 0;
|
|
400 |
so->so_m = NULL;
|
|
408 | 401 |
} |
409 | 402 |
|
410 | 403 |
return 1; |
... | ... | |
764 | 757 |
#endif |
765 | 758 |
|
766 | 759 |
void |
767 |
u_sleep(usec) |
|
768 |
int usec; |
|
760 |
u_sleep(int usec) |
|
769 | 761 |
{ |
770 | 762 |
struct timeval t; |
771 | 763 |
fd_set fdset; |
... | ... | |
783 | 775 |
*/ |
784 | 776 |
|
785 | 777 |
void |
786 |
fd_nonblock(fd) |
|
787 |
int fd; |
|
778 |
fd_nonblock(int fd) |
|
788 | 779 |
{ |
789 | 780 |
#ifdef FIONBIO |
790 | 781 |
int opt = 1; |
... | ... | |
800 | 791 |
} |
801 | 792 |
|
802 | 793 |
void |
803 |
fd_block(fd) |
|
804 |
int fd; |
|
794 |
fd_block(int fd) |
|
805 | 795 |
{ |
806 | 796 |
#ifdef FIONBIO |
807 | 797 |
int opt = 0; |
b/slirp/sbuf.c | ||
---|---|---|
18 | 18 |
*/ |
19 | 19 |
|
20 | 20 |
void |
21 |
sbfree(sb) |
|
22 |
struct sbuf *sb; |
|
21 |
sbfree(struct sbuf *sb) |
|
23 | 22 |
{ |
24 | 23 |
free(sb->sb_data); |
25 | 24 |
} |
26 | 25 |
|
27 | 26 |
void |
28 |
sbdrop(sb, num) |
|
29 |
struct sbuf *sb; |
|
30 |
int num; |
|
27 |
sbdrop(struct sbuf *sb, int num) |
|
31 | 28 |
{ |
32 | 29 |
/* |
33 | 30 |
* We can only drop how much we have |
... | ... | |
43 | 40 |
} |
44 | 41 |
|
45 | 42 |
void |
46 |
sbreserve(sb, size) |
|
47 |
struct sbuf *sb; |
|
48 |
int size; |
|
43 |
sbreserve(struct sbuf *sb, int size) |
|
49 | 44 |
{ |
50 | 45 |
if (sb->sb_data) { |
51 | 46 |
/* Already alloced, realloc if necessary */ |
... | ... | |
74 | 69 |
* (the socket is non-blocking, so we won't hang) |
75 | 70 |
*/ |
76 | 71 |
void |
77 |
sbappend(so, m) |
|
78 |
struct socket *so; |
|
79 |
struct mbuf *m; |
|
72 |
sbappend(struct socket *so, struct mbuf *m) |
|
80 | 73 |
{ |
81 | 74 |
int ret = 0; |
82 | 75 |
|
... | ... | |
173 | 166 |
* done in sbdrop when the data is acked |
174 | 167 |
*/ |
175 | 168 |
void |
176 |
sbcopy(sb, off, len, to) |
|
177 |
struct sbuf *sb; |
|
178 |
int off; |
|
179 |
int len; |
|
180 |
char *to; |
|
169 |
sbcopy(struct sbuf *sb, int off, int len, char *to) |
|
181 | 170 |
{ |
182 | 171 |
char *from; |
183 | 172 |
|
b/slirp/slirp.c | ||
---|---|---|
50 | 50 |
|
51 | 51 |
const char *slirp_special_ip = CTL_SPECIAL; |
52 | 52 |
int slirp_restrict; |
53 |
int do_slowtimo; |
|
53 |
static int do_slowtimo;
|
|
54 | 54 |
int link_up; |
55 | 55 |
struct timeval tt; |
56 | 56 |
FILE *lfd; |
... | ... | |
171 | 171 |
static void slirp_state_save(QEMUFile *f, void *opaque); |
172 | 172 |
static int slirp_state_load(QEMUFile *f, void *opaque, int version_id); |
173 | 173 |
|
174 |
void slirp_init(int restrict, char *special_ip) |
|
174 |
void slirp_init(int restricted, char *special_ip)
|
|
175 | 175 |
{ |
176 | 176 |
// debug_init("/tmp/slirp.log", DEBUG_DEFAULT); |
177 | 177 |
|
... | ... | |
184 | 184 |
#endif |
185 | 185 |
|
186 | 186 |
link_up = 1; |
187 |
slirp_restrict = restrict; |
|
187 |
slirp_restrict = restricted;
|
|
188 | 188 |
|
189 | 189 |
if_init(); |
190 | 190 |
ip_init(); |
... | ... | |
228 | 228 |
#else |
229 | 229 |
static void updtime(void) |
230 | 230 |
{ |
231 |
gettimeofday(&tt, 0);
|
|
231 |
gettimeofday(&tt, NULL);
|
|
232 | 232 |
|
233 | 233 |
curtime = (u_int)tt.tv_sec * (u_int)1000; |
234 | 234 |
curtime += (u_int)tt.tv_usec / (u_int)1000; |
b/slirp/socket.c | ||
---|---|---|
25 | 25 |
#endif |
26 | 26 |
|
27 | 27 |
struct socket * |
28 |
solookup(head, laddr, lport, faddr, fport) |
|
29 |
struct socket *head; |
|
30 |
struct in_addr laddr; |
|
31 |
u_int lport; |
|
32 |
struct in_addr faddr; |
|
33 |
u_int fport; |
|
28 |
solookup(struct socket *head, struct in_addr laddr, u_int lport, |
|
29 |
struct in_addr faddr, u_int fport) |
|
34 | 30 |
{ |
35 | 31 |
struct socket *so; |
36 | 32 |
|
... | ... | |
54 | 50 |
* insque() it into the correct linked-list |
55 | 51 |
*/ |
56 | 52 |
struct socket * |
57 |
socreate() |
|
53 |
socreate(void)
|
|
58 | 54 |
{ |
59 | 55 |
struct socket *so; |
60 | 56 |
|
... | ... | |
71 | 67 |
* remque and free a socket, clobber cache |
72 | 68 |
*/ |
73 | 69 |
void |
74 |
sofree(so) |
|
75 |
struct socket *so; |
|
70 |
sofree(struct socket *so) |
|
76 | 71 |
{ |
77 | 72 |
if (so->so_emu==EMU_RSH && so->extra) { |
78 | 73 |
sofree(so->extra); |
... | ... | |
158 | 153 |
* a read() of 0 (or less) means it's disconnected |
159 | 154 |
*/ |
160 | 155 |
int |
161 |
soread(so) |
|
162 |
struct socket *so; |
|
156 |
soread(struct socket *so) |
|
163 | 157 |
{ |
164 | 158 |
int n, nn; |
165 | 159 |
struct sbuf *sb = &so->so_snd; |
... | ... | |
269 | 263 |
* in the send buffer is sent as urgent data |
270 | 264 |
*/ |
271 | 265 |
void |
272 |
sorecvoob(so) |
|
273 |
struct socket *so; |
|
266 |
sorecvoob(struct socket *so) |
|
274 | 267 |
{ |
275 | 268 |
struct tcpcb *tp = sototcpcb(so); |
276 | 269 |
|
... | ... | |
297 | 290 |
* There's a lot duplicated code here, but... |
298 | 291 |
*/ |
299 | 292 |
int |
300 |
sosendoob(so) |
|
301 |
struct socket *so; |
|
293 |
sosendoob(struct socket *so) |
|
302 | 294 |
{ |
303 | 295 |
struct sbuf *sb = &so->so_rcv; |
304 | 296 |
char buff[2048]; /* XXX Shouldn't be sending more oob data than this */ |
... | ... | |
356 | 348 |
* updating all sbuf field as necessary |
357 | 349 |
*/ |
358 | 350 |
int |
359 |
sowrite(so) |
|
360 |
struct socket *so; |
|
351 |
sowrite(struct socket *so) |
|
361 | 352 |
{ |
362 | 353 |
int n,nn; |
363 | 354 |
struct sbuf *sb = &so->so_rcv; |
... | ... | |
451 | 442 |
* recvfrom() a UDP socket |
452 | 443 |
*/ |
453 | 444 |
void |
454 |
sorecvfrom(so) |
|
455 |
struct socket *so; |
|
445 |
sorecvfrom(struct socket *so) |
|
456 | 446 |
{ |
457 | 447 |
struct sockaddr_in addr; |
458 | 448 |
socklen_t addrlen = sizeof(struct sockaddr_in); |
... | ... | |
479 | 469 |
icmp_error(so->so_m, ICMP_UNREACH,code, 0,strerror(errno)); |
480 | 470 |
} else { |
481 | 471 |
icmp_reflect(so->so_m); |
482 |
so->so_m = 0; /* Don't m_free() it again! */
|
|
472 |
so->so_m = NULL; /* Don't m_free() it again! */
|
|
483 | 473 |
} |
484 | 474 |
/* No need for this socket anymore, udp_detach it */ |
485 | 475 |
udp_detach(so); |
... | ... | |
551 | 541 |
* sendto() a socket |
552 | 542 |
*/ |
553 | 543 |
int |
554 |
sosendto(so, m) |
|
555 |
struct socket *so; |
|
556 |
struct mbuf *m; |
|
544 |
sosendto(struct socket *so, struct mbuf *m) |
|
557 | 545 |
{ |
558 | 546 |
int ret; |
559 | 547 |
struct sockaddr_in addr; |
... | ... | |
600 | 588 |
* XXX This should really be tcp_listen |
601 | 589 |
*/ |
602 | 590 |
struct socket * |
603 |
solisten(port, laddr, lport, flags) |
|
604 |
u_int port; |
|
605 |
u_int32_t laddr; |
|
606 |
u_int lport; |
|
607 |
int flags; |
|
591 |
solisten(u_int port, u_int32_t laddr, u_int lport, int flags) |
|
608 | 592 |
{ |
609 | 593 |
struct sockaddr_in addr; |
610 | 594 |
struct socket *so; |
... | ... | |
706 | 690 |
* times each when only 1 was needed |
707 | 691 |
*/ |
708 | 692 |
void |
709 |
soisfconnecting(so) |
|
710 |
register struct socket *so; |
|
693 |
soisfconnecting(struct socket *so) |
|
711 | 694 |
{ |
712 | 695 |
so->so_state &= ~(SS_NOFDREF|SS_ISFCONNECTED|SS_FCANTRCVMORE| |
713 | 696 |
SS_FCANTSENDMORE|SS_FWDRAIN); |
... | ... | |
715 | 698 |
} |
716 | 699 |
|
717 | 700 |
void |
718 |
soisfconnected(so) |
|
719 |
register struct socket *so; |
|
701 |
soisfconnected(struct socket *so) |
|
720 | 702 |
{ |
721 | 703 |
so->so_state &= ~(SS_ISFCONNECTING|SS_FWDRAIN|SS_NOFDREF); |
722 | 704 |
so->so_state |= SS_ISFCONNECTED; /* Clobber other states */ |
... | ... | |
758 | 740 |
} |
759 | 741 |
|
760 | 742 |
void |
761 |
soisfdisconnected(so) |
|
762 |
struct socket *so; |
|
743 |
soisfdisconnected(struct socket *so) |
|
763 | 744 |
{ |
764 | 745 |
/* so->so_state &= ~(SS_ISFCONNECTING|SS_ISFCONNECTED); */ |
765 | 746 |
/* close(so->s); */ |
... | ... | |
774 | 755 |
* Set CANTSENDMORE once all data has been write()n |
775 | 756 |
*/ |
776 | 757 |
void |
777 |
sofwdrain(so) |
|
778 |
struct socket *so; |
|
758 |
sofwdrain(struct socket *so) |
|
779 | 759 |
{ |
780 | 760 |
if (so->so_rcv.sb_cc) |
781 | 761 |
so->so_state |= SS_FWDRAIN; |
b/slirp/tcp_input.c | ||
---|---|---|
121 | 121 |
int flags; |
122 | 122 |
|
123 | 123 |
/* |
124 |
* Call with ti==0 after become established to
|
|
124 |
* Call with ti==NULL after become established to
|
|
125 | 125 |
* force pre-ESTABLISHED data up to user socket. |
126 | 126 |
*/ |
127 |
if (ti == 0)
|
|
127 |
if (ti == NULL)
|
|
128 | 128 |
goto present; |
129 | 129 |
|
130 | 130 |
/* |
... | ... | |
230 | 230 |
* protocol specification dated September, 1981 very closely. |
231 | 231 |
*/ |
232 | 232 |
void |
233 |
tcp_input(m, iphlen, inso) |
|
234 |
register struct mbuf *m; |
|
235 |
int iphlen; |
|
236 |
struct socket *inso; |
|
233 |
tcp_input(struct mbuf *m, int iphlen, struct socket *inso) |
|
237 | 234 |
{ |
238 | 235 |
struct ip save_ip, *ip; |
239 | 236 |
register struct tcpiphdr *ti; |
240 | 237 |
caddr_t optp = NULL; |
241 | 238 |
int optlen = 0; |
242 | 239 |
int len, tlen, off; |
243 |
register struct tcpcb *tp = 0;
|
|
240 |
register struct tcpcb *tp = NULL;
|
|
244 | 241 |
register int tiflags; |
245 |
struct socket *so = 0;
|
|
242 |
struct socket *so = NULL;
|
|
246 | 243 |
int todrop, acked, ourfinisacked, needoutput = 0; |
247 | 244 |
/* int dropsocket = 0; */ |
248 | 245 |
int iss = 0; |
... | ... | |
264 | 261 |
/* Re-set a few variables */ |
265 | 262 |
tp = sototcpcb(so); |
266 | 263 |
m = so->so_m; |
267 |
so->so_m = 0;
|
|
264 |
so->so_m = NULL;
|
|
268 | 265 |
ti = so->so_ti; |
269 | 266 |
tiwin = ti->ti_win; |
270 | 267 |
tiflags = ti->ti_flags; |
... | ... | |
298 | 295 |
* Checksum extended TCP header and data. |
299 | 296 |
*/ |
300 | 297 |
tlen = ((struct ip *)ti)->ip_len; |
301 |
tcpiphdr2qlink(ti)->next = tcpiphdr2qlink(ti)->prev = 0;
|
|
302 |
memset(&ti->ti_i.ih_mbuf, 0 , sizeof(struct mbuf_ptr)); |
|
298 |
tcpiphdr2qlink(ti)->next = tcpiphdr2qlink(ti)->prev = NULL;
|
|
299 |
memset(&ti->ti_i.ih_mbuf, 0 , sizeof(struct mbuf_ptr));
|
|
303 | 300 |
ti->ti_x1 = 0; |
304 | 301 |
ti->ti_len = htons((u_int16_t)tlen); |
305 | 302 |
len = sizeof(struct ip ) + tlen; |
... | ... | |
399 | 396 |
* the only flag set, then create a session, mark it |
400 | 397 |
* as if it was LISTENING, and continue... |
401 | 398 |
*/ |
402 |
if (so == 0) {
|
|
399 |
if (so == NULL) {
|
|
403 | 400 |
if ((tiflags & (TH_SYN|TH_FIN|TH_RST|TH_URG|TH_ACK)) != TH_SYN) |
404 | 401 |
goto dropwithreset; |
405 | 402 |
|
... | ... | |
439 | 436 |
tp = sototcpcb(so); |
440 | 437 |
|
441 | 438 |
/* XXX Should never fail */ |
442 |
if (tp == 0)
|
|
439 |
if (tp == NULL)
|
|
443 | 440 |
goto dropwithreset; |
444 | 441 |
if (tp->t_state == TCPS_CLOSED) |
445 | 442 |
goto drop; |
... | ... | |
1697 | 1694 |
*/ |
1698 | 1695 |
|
1699 | 1696 |
int |
1700 |
tcp_mss(tp, offer) |
|
1701 |
register struct tcpcb *tp; |
|
1702 |
u_int offer; |
|
1697 |
tcp_mss(struct tcpcb *tp, u_int offer) |
|
1703 | 1698 |
{ |
1704 | 1699 |
struct socket *so = tp->t_socket; |
1705 | 1700 |
int mss; |
b/slirp/tcp_output.c | ||
---|---|---|
64 | 64 |
* Tcp output routine: figure out what should be sent and send it. |
65 | 65 |
*/ |
66 | 66 |
int |
67 |
tcp_output(tp) |
|
68 |
register struct tcpcb *tp; |
|
67 |
tcp_output(struct tcpcb *tp) |
|
69 | 68 |
{ |
70 | 69 |
register struct socket *so = tp->t_socket; |
71 | 70 |
register long len, win; |
... | ... | |
582 | 581 |
} |
583 | 582 |
|
584 | 583 |
void |
585 |
tcp_setpersist(tp) |
|
586 |
register struct tcpcb *tp; |
|
584 |
tcp_setpersist(struct tcpcb *tp) |
|
587 | 585 |
{ |
588 | 586 |
int t = ((tp->t_srtt >> 2) + tp->t_rttvar) >> 1; |
589 | 587 |
|
b/slirp/tcp_subr.c | ||
---|---|---|
49 | 49 |
* Tcp initialization |
50 | 50 |
*/ |
51 | 51 |
void |
52 |
tcp_init() |
|
52 |
tcp_init(void)
|
|
53 | 53 |
{ |
54 | 54 |
tcp_iss = 1; /* wrong */ |
55 | 55 |
tcb.so_next = tcb.so_prev = &tcb; |
... | ... | |
63 | 63 |
*/ |
64 | 64 |
/* struct tcpiphdr * */ |
65 | 65 |
void |
66 |
tcp_template(tp) |
|
67 |
struct tcpcb *tp; |
|
66 |
tcp_template(struct tcpcb *tp) |
|
68 | 67 |
{ |
69 | 68 |
struct socket *so = tp->t_socket; |
70 | 69 |
register struct tcpiphdr *n = &tp->t_template; |
... | ... | |
102 | 101 |
* segment are as specified by the parameters. |
103 | 102 |
*/ |
104 | 103 |
void |
105 |
tcp_respond(tp, ti, m, ack, seq, flags) |
|
106 |
struct tcpcb *tp; |
|
107 |
register struct tcpiphdr *ti; |
|
108 |
register struct mbuf *m; |
|
109 |
tcp_seq ack, seq; |
|
110 |
int flags; |
|
104 |
tcp_respond(struct tcpcb *tp, struct tcpiphdr *ti, struct mbuf *m, |
|
105 |
tcp_seq ack, tcp_seq seq, int flags) |
|
111 | 106 |
{ |
112 | 107 |
register int tlen; |
113 | 108 |
int win = 0; |
... | ... | |
122 | 117 |
|
123 | 118 |
if (tp) |
124 | 119 |
win = sbspace(&tp->t_socket->so_rcv); |
125 |
if (m == 0) {
|
|
120 |
if (m == NULL) {
|
|
126 | 121 |
if ((m = m_get()) == NULL) |
127 | 122 |
return; |
128 | 123 |
#ifdef TCP_COMPAT_42 |
... | ... | |
152 | 147 |
tlen += sizeof (struct tcpiphdr); |
153 | 148 |
m->m_len = tlen; |
154 | 149 |
|
155 |
ti->ti_mbuf = 0;
|
|
150 |
ti->ti_mbuf = NULL;
|
|
156 | 151 |
ti->ti_x1 = 0; |
157 | 152 |
ti->ti_seq = htonl(seq); |
158 | 153 |
ti->ti_ack = htonl(ack); |
... | ... | |
182 | 177 |
* protocol control block. |
183 | 178 |
*/ |
184 | 179 |
struct tcpcb * |
185 |
tcp_newtcpcb(so) |
|
186 |
struct socket *so; |
|
180 |
tcp_newtcpcb(struct socket *so) |
|
187 | 181 |
{ |
188 | 182 |
register struct tcpcb *tp; |
189 | 183 |
|
... | ... | |
257 | 251 |
* wake up any sleepers |
258 | 252 |
*/ |
259 | 253 |
struct tcpcb * |
260 |
tcp_close(tp) |
|
261 |
register struct tcpcb *tp; |
|
254 |
tcp_close(struct tcpcb *tp) |
|
262 | 255 |
{ |
263 | 256 |
register struct tcpiphdr *t; |
264 | 257 |
struct socket *so = tp->t_socket; |
... | ... | |
281 | 274 |
*/ |
282 | 275 |
/* free(tp, M_PCB); */ |
283 | 276 |
free(tp); |
284 |
so->so_tcpcb = 0;
|
|
277 |
so->so_tcpcb = NULL;
|
|
285 | 278 |
soisfdisconnected(so); |
286 | 279 |
/* clobber input socket cache if we're closing the cached connection */ |
287 | 280 |
if (so == tcp_last_so) |
... | ... | |
333 | 326 |
* We can let the user exit from the close as soon as the FIN is acked. |
334 | 327 |
*/ |
335 | 328 |
void |
336 |
tcp_sockclosed(tp) |
|
337 |
struct tcpcb *tp; |
|
329 |
tcp_sockclosed(struct tcpcb *tp) |
|
338 | 330 |
{ |
339 | 331 |
|
340 | 332 |
DEBUG_CALL("tcp_sockclosed"); |
... | ... | |
375 | 367 |
* nonblocking. Connect returns after the SYN is sent, and does |
376 | 368 |
* not wait for ACK+SYN. |
377 | 369 |
*/ |
378 |
int tcp_fconnect(so) |
|
379 |
struct socket *so; |
|
370 |
int tcp_fconnect(struct socket *so) |
|
380 | 371 |
{ |
381 | 372 |
int ret=0; |
382 | 373 |
|
... | ... | |
438 | 429 |
* here and SYN the local-host. |
439 | 430 |
*/ |
Also available in: Unified diff