~ubuntu-branches/ubuntu/trusty/erlang/trusty

« back to all changes in this revision

Viewing changes to erts/emulator/drivers/common/ram_file_drv.c

  • Committer: Bazaar Package Importer
  • Author(s): Clint Byrum
  • Date: 2011-05-05 15:48:43 UTC
  • mfrom: (3.5.13 sid)
  • Revision ID: james.westby@ubuntu.com-20110505154843-0om6ekzg6m7ugj27
Tags: 1:14.b.2-dfsg-3ubuntu1
* Merge from debian unstable.  Remaining changes:
  - Drop libwxgtk2.8-dev build dependency. Wx isn't in main, and not
    supposed to.
  - Drop erlang-wx binary.
  - Drop erlang-wx dependency from -megaco, -common-test, and -reltool, they
    do not really need wx. Also drop it from -debugger; the GUI needs wx,
    but it apparently has CLI bits as well, and is also needed by -megaco,
    so let's keep the package for now.
  - debian/patches/series: Do what I meant, and enable build-options.patch
    instead.
* Additional changes:
  - Drop erlang-wx from -et
* Dropped Changes:
  - patches/pcre-crash.patch: CVE-2008-2371: outer level option with
    alternatives caused crash. (Applied Upstream)
  - fix for ssl certificate verification in newSSL: 
    ssl_cacertfile_fix.patch (Applied Upstream)
  - debian/patches/series: Enable native.patch again, to get stripped beam
    files and reduce the package size again. (build-options is what
    actually accomplished this)
  - Remove build-options.patch on advice from upstream and because it caused
    odd build failures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * %CopyrightBegin%
3
 
 * 
4
 
 * Copyright Ericsson AB 1997-2009. All Rights Reserved.
5
 
 * 
 
3
 *
 
4
 * Copyright Ericsson AB 1997-2010. All Rights Reserved.
 
5
 *
6
6
 * The contents of this file are subject to the Erlang Public License,
7
7
 * Version 1.1, (the "License"); you may not use this file except in
8
8
 * compliance with the License. You should have received a copy of the
9
9
 * Erlang Public License along with this software. If not, it can be
10
10
 * retrieved online at http://www.erlang.org/.
11
 
 * 
 
11
 *
12
12
 * Software distributed under the License is distributed on an "AS IS"
13
13
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14
14
 * the License for the specific language governing rights and limitations
15
15
 * under the License.
16
 
 * 
 
16
 *
17
17
 * %CopyrightEnd%
18
18
 */
19
19
/*
35
35
#define RAM_FILE_TRUNCATE      14
36
36
#define RAM_FILE_PREAD         17
37
37
#define RAM_FILE_PWRITE        18
 
38
#define RAM_FILE_FDATASYNC     19
38
39
 
39
40
/* other operations */
40
41
#define RAM_FILE_GET           30
45
46
#define RAM_FILE_UUENCODE      35  /* uuencode file */
46
47
#define RAM_FILE_UUDECODE      36  /* uudecode file */
47
48
#define RAM_FILE_SIZE          37  /* get file size */
 
49
#define RAM_FILE_ADVISE        38  /* predeclare the access
 
50
                                    * pattern for file data */
48
51
/* possible new operations include:
49
52
   DES_ENCRYPT
50
53
   DES_DECRYPT
388
391
{
389
392
    int code_len = UULINE(UNIX_LINE);
390
393
    int len = f->end;
391
 
    int usize = (len*4+2)/3 + 2*(len/code_len+1) + 2 + 1;
 
394
    int usize = 4*((len+2)/3) + 2*((len+code_len-1)/code_len) + 2;    
392
395
    ErlDrvBinary* bin;
393
396
    uchar* inp;
394
397
    uchar* outp;
433
436
    *outp++ = ' ';   /* this end of file 0 length !!! */
434
437
    *outp++ = '\n';
435
438
    count += 2;
436
 
 
 
439
    ASSERT(count == usize);
437
440
    driver_free_binary(f->bin);
438
441
    ram_file_set(f, bin, usize, count);
439
442
    return numeric_reply(f, count);
558
561
            numeric_reply(f, 0); /* 0 is not used */
559
562
        break;
560
563
 
 
564
    case RAM_FILE_FDATASYNC:
 
565
        if (f->flags == 0)
 
566
            error_reply(f, EBADF);
 
567
        else
 
568
            reply(f, 1, 0);
 
569
        break;
 
570
 
561
571
    case RAM_FILE_FSYNC:
562
572
        if (f->flags == 0)
563
573
            error_reply(f, EBADF);
685
695
    case RAM_FILE_UUDECODE:   /* uudecode file */
686
696
        ram_file_uudecode(f);
687
697
        break;
 
698
 
 
699
    case RAM_FILE_ADVISE:
 
700
        if (f->flags == 0)
 
701
            error_reply(f, EBADF);
 
702
        else
 
703
            reply(f, 1, 0);
 
704
        break;
688
705
    }
689
706
    /*
690
707
     * Ignore anything else -- let the caller hang.