~statik/ubuntu/maverick/erlang/erlang-merge-testing

« back to all changes in this revision

Viewing changes to erts/emulator/sys/vxworks/sys.c

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2009-05-01 10:14:38 UTC
  • mfrom: (3.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090501101438-6qlr6rsdxgyzrg2z
Tags: 1:13.b-dfsg-2
* Cleaned up patches: removed unneeded patch which helped to support
  different SCTP library versions, made sure that changes for m68k
  architecture applied only when building on this architecture.
* Removed duplicated information from binary packages descriptions.
* Don't require libsctp-dev build-dependency on solaris-i386 architecture
  which allows to build Erlang on Nexenta (thanks to Tim Spriggs for
  the suggestion).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* ``The contents of this file are subject to the Erlang Public License,
 
1
/*
 
2
 * %CopyrightBegin%
 
3
 * 
 
4
 * Copyright Ericsson AB 1997-2009. All Rights Reserved.
 
5
 * 
 
6
 * The contents of this file are subject to the Erlang Public License,
2
7
 * Version 1.1, (the "License"); you may not use this file except in
3
8
 * compliance with the License. You should have received a copy of the
4
9
 * Erlang Public License along with this software. If not, it can be
5
 
 * retrieved via the world wide web at http://www.erlang.org/.
 
10
 * retrieved online at http://www.erlang.org/.
6
11
 * 
7
12
 * Software distributed under the License is distributed on an "AS IS"
8
13
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
9
14
 * the License for the specific language governing rights and limitations
10
15
 * under the License.
11
16
 * 
12
 
 * The Initial Developer of the Original Code is Ericsson Utvecklings AB.
13
 
 * Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings
14
 
 * AB. All Rights Reserved.''
15
 
 * 
16
 
 *     $Id$
 
17
 * %CopyrightEnd%
17
18
 */
18
19
/*
19
20
 * system-dependent functions
552
553
static void ready_input(ErlDrvData fd, ErlDrvEvent ready_fd);
553
554
static void ready_output(ErlDrvData fd, ErlDrvEvent ready_fd);
554
555
static void output(ErlDrvData fd, char *buf, int len);
 
556
static void stop_select(ErlDrvEvent, void*);
555
557
 
556
558
struct erl_drv_entry spawn_driver_entry = {
557
559
    spawn_init,
561
563
    ready_input,
562
564
    ready_output,
563
565
    "spawn",
564
 
    NULL,
565
 
    NULL,
566
 
    NULL,
567
 
    NULL,
568
 
    NULL,
569
 
    NULL
 
566
    NULL, /* finish */
 
567
    NULL, /* handle */
 
568
    NULL, /* control */
 
569
    NULL, /* timeout */
 
570
    NULL, /* outputv */
 
571
    NULL, /* ready_async */
 
572
    NULL, /* flush */
 
573
    NULL, /* call */
 
574
    NULL, /* event */
 
575
    ERL_DRV_EXTENDED_MARKER,
 
576
    ERL_DRV_EXTENDED_MAJOR_VERSION,
 
577
    ERL_DRV_EXTENDED_MINOR_VERSION,
 
578
    0, /* ERL_DRV_FLAGs */
 
579
    NULL, /* handle2 */
 
580
    NULL, /* process_exit */
 
581
    stop_select
 
582
 
570
583
};
571
584
struct erl_drv_entry fd_driver_entry = {
572
585
    NULL,
576
589
    ready_input,
577
590
    ready_output,
578
591
    "fd",
579
 
    NULL,
580
 
    NULL,
581
 
    NULL,
582
 
    NULL,
583
 
    NULL,
584
 
    NULL
 
592
    NULL, /* finish */
 
593
    NULL, /* handle */
 
594
    NULL, /* control */
 
595
    NULL, /* timeout */
 
596
    NULL, /* outputv */
 
597
    NULL, /* ready_async */
 
598
    NULL, /* flush */
 
599
    NULL, /* call */
 
600
    NULL, /* event */
 
601
    ERL_DRV_EXTENDED_MARKER,
 
602
    ERL_DRV_EXTENDED_MAJOR_VERSION,
 
603
    ERL_DRV_EXTENDED_MINOR_VERSION,
 
604
    0, /* ERL_DRV_FLAGs */
 
605
    NULL, /* handle2 */
 
606
    NULL, /* process_exit */
 
607
    stop_select
585
608
};
586
609
struct erl_drv_entry vanilla_driver_entry = {
587
610
    NULL,
591
614
    ready_input,
592
615
    ready_output,
593
616
    "vanilla",
594
 
    NULL,
595
 
    NULL,
596
 
    NULL,
597
 
    NULL,
598
 
    NULL,
599
 
    NULL
 
617
    NULL, /* finish */
 
618
    NULL, /* handle */
 
619
    NULL, /* control */
 
620
    NULL, /* timeout */
 
621
    NULL, /* outputv */
 
622
    NULL, /* ready_async */
 
623
    NULL, /* flush */
 
624
    NULL, /* call */
 
625
    NULL, /* event */
 
626
    ERL_DRV_EXTENDED_MARKER,
 
627
    ERL_DRV_EXTENDED_MAJOR_VERSION,
 
628
    ERL_DRV_EXTENDED_MINOR_VERSION,
 
629
    0, /* ERL_DRV_FLAGs */
 
630
    NULL, /* handle2 */
 
631
    NULL, /* process_exit */
 
632
    stop_select
600
633
};
601
634
 
602
635
/*
649
682
    } else {                    /* DO_READ only */
650
683
      driver_data[ifd].ofd = -1;
651
684
    }
652
 
    (void) driver_select(port_num, ifd, DO_READ, 1);
 
685
    (void) driver_select(port_num, ifd, ERL_DRV_READ|ERL_DRV_USE, 1);
653
686
    return(ifd);
654
687
  } else {                      /* DO_WRITE only */
655
688
    driver_data[ofd].packet_bytes = packet_bytes;
1020
1053
{
1021
1054
  Pend *p, *p1;
1022
1055
    
1023
 
  driver_select(port_num,fd,DO_READ|DO_WRITE,0);
 
1056
  driver_select(port_num, fd, ERL_DRV_READ|ERL_DRV_WRITE, 0);
1024
1057
  clear_fd_data(fd);
1025
1058
  p = fd_data[fd].pending;
1026
1059
  SET_BLOCKING(fd);
1091
1124
 
1092
1125
    port_num = driver_data[fd].port_num;
1093
1126
    nbio_stop_fd(port_num, fd);
1094
 
    close(fd);
 
1127
    driver_select(port_num, fd, ERL_DRV_USE, 0); /* close(fd) */
1095
1128
 
1096
1129
    ofd = driver_data[fd].ofd;
1097
1130
    if (ofd != fd && ofd != -1) {
1098
1131
        nbio_stop_fd(port_num, ofd);
1099
 
        close(ofd);
 
1132
        driver_select(port_num, ofd, ERL_DRV_USE, 0); /* close(fd) */
1100
1133
    }
1101
1134
}
1102
1135
 
1118
1151
  case 0: break;                /* Handles this case too */
1119
1152
  }
1120
1153
  sys_memcpy(p->buf + pb, buf, len);
1121
 
  driver_select(port_num, fd, DO_WRITE, 1);
 
1154
  driver_select(port_num, fd, ERL_DRV_WRITE|ERL_DRV_USE, 1);
1122
1155
  p->cpos = p->buf;
1123
1156
  p->fd = fd;
1124
1157
  p->next = NULL;
1203
1236
    sched_write(port_num, ofd, buf + buf_done, len - buf_done,0);
1204
1237
}
1205
1238
 
 
1239
static void stop_select(ErlDrvEvent fd, void* _)
 
1240
{
 
1241
    close((int)fd);
 
1242
}
1206
1243
 
1207
1244
static int ensure_header(int fd,char *buf,int packet_size, int sofar)
1208
1245
{
1223
1260
 
1224
1261
static int port_inp_failure(int port_num, int ready_fd, int res)
1225
1262
{
1226
 
    (void) driver_select(port_num, ready_fd, DO_READ|DO_WRITE, 0); 
 
1263
    (void) driver_select(port_num, ready_fd, ERL_DRV_READ|ERL_DRV_WRITE, 0); 
1227
1264
    clear_fd_data(ready_fd);
1228
1265
    if (res == 0) {
1229
1266
        if (driver_data[ready_fd].report_exit) {
1395
1432
  while(1) {
1396
1433
    if ((p = fd_data[ready_fd].pending) == NULL) {
1397
1434
      driver_select(driver_data[fd].port_num, ready_fd, 
1398
 
                    DO_WRITE, 0);
 
1435
                    ERL_DRV_WRITE, 0);
1399
1436
      return;
1400
1437
    }
1401
1438
    wval = write(p->fd, p->cpos, p->remain);
1404
1441
      erts_free(ERTS_ALC_T_PEND_DATA, p);
1405
1442
      if (fd_data[ready_fd].pending == NULL) {
1406
1443
        driver_select(driver_data[fd].port_num, ready_fd, 
1407
 
                      DO_WRITE, 0);
 
1444
                      ERL_DRV_WRITE, 0);
1408
1445
        set_busy_port(driver_data[fd].port_num, 0);
1409
1446
        return;
1410
1447
      }
1416
1453
        return;
1417
1454
      else {
1418
1455
        driver_select(driver_data[fd].port_num, ready_fd, 
1419
 
                      DO_WRITE, 0);
 
1456
                      ERL_DRV_WRITE, 0);
1420
1457
        driver_failure(driver_data[fd].port_num, -1);
1421
1458
        return;
1422
1459
      }