File: alibc.c

package info (click to toggle)
libmems 1.6.0%2B4725-11
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,148 kB
  • sloc: cpp: 21,579; ansic: 4,313; xml: 115; makefile: 107; sh: 26
file content (47 lines) | stat: -rw-r--r-- 925 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "libMems/dmSML/asyncio.h"
#include "libMems/dmSML/alibc.h"

#if defined USE_LIBC

int OpenLibC( aFILE * file, const char *path, int mode ) {
    FILE * result = fopen( path, mode == A_READ ? "rb" : "wb" );
    file->libchandle = result;
    if( result == NULL ) {
        return( 0 );
    }
    return( 1 );
}


int CloseLibC( aFILE * file ) {
    fclose( file->libchandle );
    return( 1 );
}


int WriteLibC( aFILE * file, aIORec * rec ) {
    fwrite( rec->buf, rec->size, rec->count, file->libchandle );
    return( 1 );
}

int ReadLibC( aFILE * file, aIORec * rec ) {
    fread( rec->buf, rec->size, rec->count, file->libchandle );
    return( 1 );
}


int OperationCompleteLibC( aFILE * file ) {
    // libc operations are atomic
    return( 1 );
}

int FileBusyLibC( aFILE * file ) {
    // libc operations are atomic
    return( 1 );
}

#endif /* USE_LIBC */