~ubuntu-branches/ubuntu/vivid/basilisk2/vivid

« back to all changes in this revision

Viewing changes to src/Unix/ether_unix.cpp

  • Committer: Package Import Robot
  • Author(s): Jonas Smedegaard, Jonas Smedegaard, Jérémy Lal, Giulio Paci
  • Date: 2012-05-19 02:08:30 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20120519020830-o59ui1wsfftg55m6
Tags: 0.9.20120331-1
* Upstream update

[ Jonas Smedegaard ]
* Drop local CDBS snippets: All included in main cdbs now.
* Use source format 3.0 (quilt), and stop including patchsys-quilt.mk.
  Stop build-depending on quilt, patchutils.
* Add full licensing header to debian/rules, and update copyright
  years.
* Add README.source (and drop outdated README.cdbs-tweaks).
* Refresh patches with shortening quilt options --no-index
  --no-timestamps -pab, and fix their path prefix.
* Rewrite copyright file using draft DEP-5 format.
* Update control file Vcs-* fields: Packaging moved to Git.
* Ease building with git-buildpackage:
  + Add gbp.conf, enabling pristine-tar and tag signing.
  + Git-ignore quilt .pc dir.
* Bump debhelper compat level to 7.
* Update Vcs-Browser field to use anonscm.debian.org.
* Add Giulio Paci and Jérémy Lal as uploaders, and permit Debian
  Maintainers to upload.

[ Jérémy Lal ]
* Drop patch 1002 to fix capitalized flag: corrected upstream.

[ Giulio Paci ]
* Restart package development.
  Closes: #662175.
* Add patches to fix compilation and documentation.
* Provide JIT flavor on supported architectures (i386 and amd64).
* Bump standards-version to 3.9.3.
* Update copyright file:
  + Adjust licenses now clarified/improved upstream.
* Update ChangeLog.cvs.
* Enable CDBS autogeneration of autotools files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 *  ether_unix.cpp - Ethernet device driver, Unix specific stuff (Linux and FreeBSD)
3
3
 *
4
 
 *  Basilisk II (C) 1997-2005 Christian Bauer
 
4
 *  Basilisk II (C) 1997-2008 Christian Bauer
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
47
47
#include <semaphore.h>
48
48
#include <errno.h>
49
49
#include <stdio.h>
 
50
#include <signal.h>
50
51
#include <map>
51
52
 
52
53
#if defined(__FreeBSD__) || defined(sgi) || (defined(__APPLE__) && defined(__MACH__))
124
125
// Prototypes
125
126
static void *receive_func(void *arg);
126
127
static void *slirp_receive_func(void *arg);
127
 
static int poll_fd(int fd);
128
128
static int16 ether_do_add_multicast(uint8 *addr);
129
129
static int16 ether_do_del_multicast(uint8 *addr);
130
130
static int16 ether_do_write(uint32 arg);
225
225
 
226
226
bool ether_init(void)
227
227
{
228
 
        int val, nonblock = 1;
 
228
        int val;
229
229
        char str[256];
230
230
 
231
231
        // Do nothing if no Ethernet device specified
248
248
        else
249
249
                net_if_type = NET_IF_SHEEPNET;
250
250
 
 
251
        // Don't raise SIGPIPE, let errno be set to EPIPE
 
252
        struct sigaction sigpipe_sa;
 
253
        if (sigaction(SIGPIPE, NULL, &sigpipe_sa) == 0) {
 
254
                assert(sigpipe_sa.sa_handler == SIG_DFL || sigpipe_sa.sa_handler == SIG_IGN);
 
255
                sigfillset(&sigpipe_sa.sa_mask);
 
256
                sigpipe_sa.sa_flags = 0;
 
257
                sigpipe_sa.sa_handler = SIG_IGN;
 
258
                sigaction(SIGPIPE, &sigpipe_sa, NULL);
 
259
        }
 
260
 
251
261
#ifdef HAVE_SLIRP
252
262
        // Initialize slirp library
253
263
        if (net_if_type == NET_IF_SLIRP) {
254
264
                if (slirp_init() < 0) {
255
 
                        sprintf(str, GetString(STR_SLIRP_NO_DNS_FOUND_WARN));
 
265
                        sprintf(str, "%s", GetString(STR_SLIRP_NO_DNS_FOUND_WARN));
256
266
                        WarningAlert(str);
257
267
                        return false;
258
268
                }
337
347
 
338
348
        // Set nonblocking I/O
339
349
#ifdef USE_FIONBIO
 
350
        int nonblock = 1;
340
351
        if (ioctl(fd, FIONBIO, &nonblock) < 0) {
341
352
                sprintf(str, GetString(STR_BLOCKING_NET_SOCKET_WARN), strerror(errno));
342
353
                WarningAlert(str);