]> gitweb @ CieloNegro.org - pkgsrc-ghc.git/blob - files/capi-wrappers-freebsd-i386.c
We got a working GHC 7.4.1 for FreeBSD/i386
[pkgsrc-ghc.git] / files / capi-wrappers-freebsd-i386.c
1 #include "HsFFI.h"
2 #include <assert.h>
3 #include <fcntl.h>
4 #include <sys/time.h>
5 #include <utime.h>
6
7 /* A quick and dirty hack to resurrect -fvia-C from bitrot.
8  *
9  * The newest CapiFFI extension doesn't play nice with -fvia-C,
10  * generating function wrappers without saving them into the .hc
11  * files.
12  */
13
14 int ghc_wrapper_d2lL_fcntl(int filedes, int cmd);
15 int ghc_wrapper_d2lz_fcntl(int filedes, int cmd, long arg);
16 int ghc_wrapper_d2lk_fcntl(int filedes, int cmd, struct flock* arg);
17 int ghc_wrapper_d1mv_gettimeofday(struct timeval* tp, struct timezone* tzp);
18 int ghc_wrapper_d2jA_utime(const char *path, const struct utimbuf *times);
19 HsInt32 SystemziConsoleziTerminfoziBase_d2eD(StgStablePtr the_stableptr, void* original_return_addr, HsInt32 a1);
20
21 /* c_fcntl_read */
22 int ghc_wrapper_d2lL_fcntl(int filedes, int cmd) {
23     return fcntl(filedes, cmd);
24 }
25
26 /* c_fcntl_write */
27 int ghc_wrapper_d2lz_fcntl(int filedes, int cmd, long arg) {
28     return fcntl(filedes, cmd, arg);
29 }
30
31 /* c_fcntl_lock */
32 int ghc_wrapper_d2lk_fcntl(int filedes, int cmd, struct flock* arg) {
33     return fcntl(filedes, cmd, arg);
34 }
35
36 int ghc_wrapper_d1mv_gettimeofday(struct timeval* tp, struct timezone* tzp) {
37     return gettimeofday(tp, tzp);
38 }
39
40 int ghc_wrapper_d2jA_utime(const char *path, const struct utimbuf *times) {
41     return utime(path, times);
42 }
43
44 HsInt32 SystemziConsoleziTerminfoziBase_d2eD(StgStablePtr the_stableptr, void* original_return_addr, HsInt32 a1) {
45     /* The recipe to create this function is somewhere in
46      * compiler/deSugar/DsForeign.lhs, but... I don't want to bother
47      * replicating that here.
48      */
49     assert("DO NOT CALL THIS FUNCTION" == NULL);
50     return -1;
51 }