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