diff options
Diffstat (limited to 'otherlibs/unix')
89 files changed, 209 insertions, 205 deletions
diff --git a/otherlibs/unix/.depend b/otherlibs/unix/.depend index 809339c35..081555a1a 100644 --- a/otherlibs/unix/.depend +++ b/otherlibs/unix/.depend @@ -12,8 +12,8 @@ closedir.o: closedir.c unixsupport.h connect.o: connect.c unixsupport.h socketaddr.h cst2constr.o: cst2constr.c cst2constr.h cstringv.o: cstringv.c unixsupport.h -dup.o: dup.c unixsupport.h dup2.o: dup2.c unixsupport.h +dup.o: dup.c unixsupport.h envir.o: envir.c errmsg.o: errmsg.c execv.o: execv.c unixsupport.h @@ -71,8 +71,8 @@ setuid.o: setuid.c unixsupport.h shutdown.o: shutdown.c unixsupport.h signals.o: signals.c unixsupport.h sleep.o: sleep.c unixsupport.h -socket.o: socket.c unixsupport.h socketaddr.o: socketaddr.c unixsupport.h socketaddr.h +socket.o: socket.c unixsupport.h socketpair.o: socketpair.c unixsupport.h sockopt.o: sockopt.c unixsupport.h socketaddr.h stat.o: stat.c unixsupport.h cst2constr.h diff --git a/otherlibs/unix/Makefile b/otherlibs/unix/Makefile index fe5267871..17288e3ab 100644 --- a/otherlibs/unix/Makefile +++ b/otherlibs/unix/Makefile @@ -18,9 +18,10 @@ include ../../config/Makefile # Compilation options CC=$(BYTECC) -CFLAGS=-I../../byterun -O $(BYTECCCOMPOPTS) +CFLAGS=-I../../byterun -O $(BYTECCCOMPOPTS) $(SHAREDCCCOMPOPTS) CAMLC=../../boot/ocamlrun ../../ocamlc -I ../../stdlib CAMLOPT=../../boot/ocamlrun ../../ocamlopt -I ../../stdlib +MKLIB=../../tools/ocamlmklib OBJS=accept.o access.o addrofstr.o alarm.o bind.o chdir.o chmod.o \ chown.o chroot.o close.o closedir.o connect.o cst2constr.o cstringv.o \ @@ -43,15 +44,13 @@ all: libunix.a unix.cmi unix.cma allopt: libunix.a unix.cmi unix.cmxa libunix.a: $(OBJS) - rm -f libunix.a - ar rc libunix.a $(OBJS) - $(RANLIB) libunix.a + $(MKLIB) -o unix $(OBJS) unix.cma: unix.cmo - $(CAMLC) -a -linkall -custom -o unix.cma unix.cmo -cclib -lunix + $(MKLIB) -o unix -ocamlc '$(CAMLC)' -linkall unix.cmo unix.cmxa: unix.cmx - $(CAMLOPT) -a -linkall -o unix.cmxa unix.cmx -cclib -lunix + $(MKLIB) -o unix -ocamlopt '$(CAMLOPT)' -linkall unix.cmx unix.cmx: ../../ocamlopt @@ -59,9 +58,10 @@ partialclean: rm -f *.cm* clean: partialclean - rm -f *.a *.o + rm -f *.a *.o *.so install: + test -f libunix.so && cp libunix.so $(LIBDIR)/libunix.so cp libunix.a $(LIBDIR)/libunix.a cd $(LIBDIR); $(RANLIB) libunix.a cp unix.cmi unix.cma unix.mli $(LIBDIR) diff --git a/otherlibs/unix/accept.c b/otherlibs/unix/accept.c index 03f8c3c3c..6f5ae2932 100644 --- a/otherlibs/unix/accept.c +++ b/otherlibs/unix/accept.c @@ -22,7 +22,7 @@ #include "socketaddr.h" -value unix_accept(value sock) /* ML */ +CAMLprim value unix_accept(value sock) { int retcode; value res; @@ -46,6 +46,6 @@ value unix_accept(value sock) /* ML */ #else -value unix_accept(value sock) { invalid_argument("accept not implemented"); } +CAMLprim value unix_accept(value sock) { invalid_argument("accept not implemented"); } #endif diff --git a/otherlibs/unix/access.c b/otherlibs/unix/access.c index 99432235e..72e3d77fb 100644 --- a/otherlibs/unix/access.c +++ b/otherlibs/unix/access.c @@ -39,7 +39,7 @@ static int access_permission_table[] = { R_OK, W_OK, X_OK, F_OK }; -value unix_access(value path, value perms) /* ML */ +CAMLprim value unix_access(value path, value perms) { int ret; ret = access(String_val(path), diff --git a/otherlibs/unix/addrofstr.c b/otherlibs/unix/addrofstr.c index ab9e271d2..767918052 100644 --- a/otherlibs/unix/addrofstr.c +++ b/otherlibs/unix/addrofstr.c @@ -20,7 +20,7 @@ #include "socketaddr.h" -value unix_inet_addr_of_string(value s) /* ML */ +CAMLprim value unix_inet_addr_of_string(value s) { #ifdef HAS_INET_ATON struct in_addr address; @@ -37,7 +37,7 @@ value unix_inet_addr_of_string(value s) /* ML */ #else -value unix_inet_addr_of_string(value s) +CAMLprim value unix_inet_addr_of_string(value s) { invalid_argument("inet_addr_of_string not implemented"); } #endif diff --git a/otherlibs/unix/alarm.c b/otherlibs/unix/alarm.c index c52a4074f..95f2a19e9 100644 --- a/otherlibs/unix/alarm.c +++ b/otherlibs/unix/alarm.c @@ -15,7 +15,7 @@ #include <mlvalues.h> #include "unixsupport.h" -value unix_alarm(t) /* ML */ +CAMLprim value unix_alarm(t) value t; { return Val_int(alarm((unsigned int) Long_val(t))); diff --git a/otherlibs/unix/bind.c b/otherlibs/unix/bind.c index aa111d3b7..9dd660d9b 100644 --- a/otherlibs/unix/bind.c +++ b/otherlibs/unix/bind.c @@ -19,7 +19,7 @@ #include "socketaddr.h" -value unix_bind(value socket, value address) /* ML */ +CAMLprim value unix_bind(value socket, value address) { int ret; union sock_addr_union addr; @@ -33,7 +33,7 @@ value unix_bind(value socket, value address) /* ML */ #else -value unix_bind(value socket, value address) +CAMLprim value unix_bind(value socket, value address) { invalid_argument("bind not implemented"); } #endif diff --git a/otherlibs/unix/chdir.c b/otherlibs/unix/chdir.c index 63c92c03a..003e8e4cf 100644 --- a/otherlibs/unix/chdir.c +++ b/otherlibs/unix/chdir.c @@ -15,7 +15,7 @@ #include <mlvalues.h> #include "unixsupport.h" -value unix_chdir(value path) /* ML */ +CAMLprim value unix_chdir(value path) { int ret; ret = chdir(String_val(path)); diff --git a/otherlibs/unix/chmod.c b/otherlibs/unix/chmod.c index de13f4a42..9ab44e96c 100644 --- a/otherlibs/unix/chmod.c +++ b/otherlibs/unix/chmod.c @@ -17,7 +17,7 @@ #include <mlvalues.h> #include "unixsupport.h" -value unix_chmod(value path, value perm) /* ML */ +CAMLprim value unix_chmod(value path, value perm) { int ret; ret = chmod(String_val(path), Int_val(perm)); diff --git a/otherlibs/unix/chown.c b/otherlibs/unix/chown.c index 90034fa72..5cc1c3e53 100644 --- a/otherlibs/unix/chown.c +++ b/otherlibs/unix/chown.c @@ -15,7 +15,7 @@ #include <mlvalues.h> #include "unixsupport.h" -value unix_chown(value path, value uid, value gid) /* ML */ +CAMLprim value unix_chown(value path, value uid, value gid) { int ret; ret = chown(String_val(path), Int_val(uid), Int_val(gid)); diff --git a/otherlibs/unix/chroot.c b/otherlibs/unix/chroot.c index 5432789e3..fedb0de50 100644 --- a/otherlibs/unix/chroot.c +++ b/otherlibs/unix/chroot.c @@ -15,7 +15,7 @@ #include <mlvalues.h> #include "unixsupport.h" -value unix_chroot(value path) /* ML */ +CAMLprim value unix_chroot(value path) { int ret; ret = chroot(String_val(path)); diff --git a/otherlibs/unix/close.c b/otherlibs/unix/close.c index 0e2caae07..be929cb6e 100644 --- a/otherlibs/unix/close.c +++ b/otherlibs/unix/close.c @@ -15,7 +15,7 @@ #include <mlvalues.h> #include "unixsupport.h" -value unix_close(value fd) /* ML */ +CAMLprim value unix_close(value fd) { if (close(Int_val(fd)) == -1) uerror("close", Nothing); return Val_unit; diff --git a/otherlibs/unix/closedir.c b/otherlibs/unix/closedir.c index d44ba896a..baa63b9dd 100644 --- a/otherlibs/unix/closedir.c +++ b/otherlibs/unix/closedir.c @@ -21,7 +21,7 @@ #include <sys/dir.h> #endif -value unix_closedir(value d) /* ML */ +CAMLprim value unix_closedir(value d) { closedir((DIR *) d); return Val_unit; diff --git a/otherlibs/unix/connect.c b/otherlibs/unix/connect.c index fbe4a3276..f74c275b3 100644 --- a/otherlibs/unix/connect.c +++ b/otherlibs/unix/connect.c @@ -20,7 +20,7 @@ #include "socketaddr.h" -value unix_connect(value socket, value address) /* ML */ +CAMLprim value unix_connect(value socket, value address) { int retcode; union sock_addr_union addr; @@ -36,7 +36,7 @@ value unix_connect(value socket, value address) /* ML */ #else -value unix_connect(value socket, value address) +CAMLprim value unix_connect(value socket, value address) { invalid_argument("connect not implemented"); } #endif diff --git a/otherlibs/unix/dup.c b/otherlibs/unix/dup.c index d4af26f5b..d9c6d3bcb 100644 --- a/otherlibs/unix/dup.c +++ b/otherlibs/unix/dup.c @@ -15,7 +15,7 @@ #include <mlvalues.h> #include "unixsupport.h" -value unix_dup(value fd) /* ML */ +CAMLprim value unix_dup(value fd) { int ret; ret = dup(Int_val(fd)); diff --git a/otherlibs/unix/dup2.c b/otherlibs/unix/dup2.c index 96e841ff3..e0b756841 100644 --- a/otherlibs/unix/dup2.c +++ b/otherlibs/unix/dup2.c @@ -17,7 +17,7 @@ #ifdef HAS_DUP2 -value unix_dup2(value fd1, value fd2) /* ML */ +CAMLprim value unix_dup2(value fd1, value fd2) { if (dup2(Int_val(fd1), Int_val(fd2)) == -1) uerror("dup2", Nothing); return Val_unit; @@ -38,7 +38,7 @@ static int do_dup2(int fd1, int fd2) return res; } -value unix_dup2(value fd1, value fd2) +CAMLprim value unix_dup2(value fd1, value fd2) { close(Int_val(fd2)); if (do_dup2(Int_val(fd1), Int_val(fd2)) == -1) uerror("dup2", Nothing); diff --git a/otherlibs/unix/envir.c b/otherlibs/unix/envir.c index a25263c1c..a9d36e96a 100644 --- a/otherlibs/unix/envir.c +++ b/otherlibs/unix/envir.c @@ -15,9 +15,11 @@ #include <mlvalues.h> #include <alloc.h> +#ifndef _WIN32 extern char ** environ; +#endif -value unix_environment(void) /* ML */ +CAMLprim value unix_environment(void) { return copy_string_array((const char**)environ); } diff --git a/otherlibs/unix/errmsg.c b/otherlibs/unix/errmsg.c index 65d51a725..9d218f9e2 100644 --- a/otherlibs/unix/errmsg.c +++ b/otherlibs/unix/errmsg.c @@ -22,7 +22,7 @@ extern int error_table[]; extern char * strerror(int); -value unix_error_message(value err) /* ML */ +CAMLprim value unix_error_message(value err) { int errnum; errnum = Is_block(err) ? Int_val(Field(err, 0)) : error_table[Int_val(err)]; @@ -34,7 +34,7 @@ value unix_error_message(value err) /* ML */ extern int sys_nerr; extern char *sys_errlist[]; -value unix_error_message(value err) +CAMLprim value unix_error_message(value err) { int errnum; errnum = Is_block(err) ? Int_val(Field(err, 0)) : error_table[Int_val(err)]; diff --git a/otherlibs/unix/execv.c b/otherlibs/unix/execv.c index d7e3ddb44..0a56c4ae8 100644 --- a/otherlibs/unix/execv.c +++ b/otherlibs/unix/execv.c @@ -18,7 +18,7 @@ extern char ** cstringvect(); -value unix_execv(value path, value args) /* ML */ +CAMLprim value unix_execv(value path, value args) { char ** argv; argv = cstringvect(args); diff --git a/otherlibs/unix/execve.c b/otherlibs/unix/execve.c index ba8873288..bc5409f59 100644 --- a/otherlibs/unix/execve.c +++ b/otherlibs/unix/execve.c @@ -18,7 +18,7 @@ extern char ** cstringvect(); -value unix_execve(value path, value args, value env) /* ML */ +CAMLprim value unix_execve(value path, value args, value env) { char ** argv; char ** envp; diff --git a/otherlibs/unix/execvp.c b/otherlibs/unix/execvp.c index 36f7284c5..657184e41 100644 --- a/otherlibs/unix/execvp.c +++ b/otherlibs/unix/execvp.c @@ -17,9 +17,11 @@ #include "unixsupport.h" extern char ** cstringvect(); +#ifndef _WIN32 extern char ** environ; +#endif -value unix_execvp(value path, value args) /* ML */ +CAMLprim value unix_execvp(value path, value args) { char ** argv; argv = cstringvect(args); @@ -30,7 +32,7 @@ value unix_execvp(value path, value args) /* ML */ /* from smart compilers */ } -value unix_execvpe(value path, value args, value env) /* ML */ +CAMLprim value unix_execvpe(value path, value args, value env) { char ** argv; char ** saved_environ; diff --git a/otherlibs/unix/exit.c b/otherlibs/unix/exit.c index 4511d4366..604e70f84 100644 --- a/otherlibs/unix/exit.c +++ b/otherlibs/unix/exit.c @@ -15,7 +15,7 @@ #include <mlvalues.h> #include "unixsupport.h" -value unix_exit(value n) /* ML */ +CAMLprim value unix_exit(value n) { _exit(Int_val(n)); return Val_unit; /* never reached, but suppress warnings */ diff --git a/otherlibs/unix/fchmod.c b/otherlibs/unix/fchmod.c index e41357b33..5bb03ff9c 100644 --- a/otherlibs/unix/fchmod.c +++ b/otherlibs/unix/fchmod.c @@ -19,7 +19,7 @@ #ifdef HAS_FCHMOD -value unix_fchmod(value fd, value perm) /* ML */ +CAMLprim value unix_fchmod(value fd, value perm) { if (fchmod(Int_val(fd), Int_val(perm)) == -1) uerror("fchmod", Nothing); return Val_unit; @@ -27,7 +27,7 @@ value unix_fchmod(value fd, value perm) /* ML */ #else -value unix_fchmod(value fd, value perm) +CAMLprim value unix_fchmod(value fd, value perm) { invalid_argument("fchmod not implemented"); } #endif diff --git a/otherlibs/unix/fchown.c b/otherlibs/unix/fchown.c index caef5fd64..58a734c38 100644 --- a/otherlibs/unix/fchown.c +++ b/otherlibs/unix/fchown.c @@ -17,7 +17,7 @@ #ifdef HAS_FCHMOD -value unix_fchown(value fd, value uid, value gid) /* ML */ +CAMLprim value unix_fchown(value fd, value uid, value gid) { if (fchown(Int_val(fd), Int_val(uid), Int_val(gid)) == -1) uerror("fchown", Nothing); @@ -26,7 +26,7 @@ value unix_fchown(value fd, value uid, value gid) /* ML */ #else -value unix_fchown(value fd, value uid, value gid) +CAMLprim value unix_fchown(value fd, value uid, value gid) { invalid_argument("fchown not implemented"); } #endif diff --git a/otherlibs/unix/fcntl.c b/otherlibs/unix/fcntl.c index d52dbc733..58eff00e7 100644 --- a/otherlibs/unix/fcntl.c +++ b/otherlibs/unix/fcntl.c @@ -23,7 +23,7 @@ #define O_NONBLOCK O_NDELAY #endif -value unix_set_nonblock(value fd) /* ML */ +CAMLprim value unix_set_nonblock(value fd) { int retcode; retcode = fcntl(Int_val(fd), F_GETFL, 0); @@ -33,7 +33,7 @@ value unix_set_nonblock(value fd) /* ML */ return Val_unit; } -value unix_clear_nonblock(value fd) /* ML */ +CAMLprim value unix_clear_nonblock(value fd) { int retcode; retcode = fcntl(Int_val(fd), F_GETFL, 0); @@ -45,7 +45,7 @@ value unix_clear_nonblock(value fd) /* ML */ #ifdef FD_CLOEXEC -value unix_set_close_on_exec(value fd) /* ML */ +CAMLprim value unix_set_close_on_exec(value fd) { int retcode; retcode = fcntl(Int_val(fd), F_GETFD, 0); @@ -55,7 +55,7 @@ value unix_set_close_on_exec(value fd) /* ML */ return Val_unit; } -value unix_clear_close_on_exec(value fd) /* ML */ +CAMLprim value unix_clear_close_on_exec(value fd) { int retcode; retcode = fcntl(Int_val(fd), F_GETFD, 0); @@ -67,10 +67,10 @@ value unix_clear_close_on_exec(value fd) /* ML */ #else -value unix_set_close_on_exec(value fd) +CAMLprim value unix_set_close_on_exec(value fd) { invalid_argument("set_close_on_exec not implemented"); } -value unix_clear_close_on_exec(value fd) +CAMLprim value unix_clear_close_on_exec(value fd) { invalid_argument("clear_close_on_exec not implemented"); } #endif diff --git a/otherlibs/unix/fork.c b/otherlibs/unix/fork.c index 5d1017ca1..6fd38f48b 100644 --- a/otherlibs/unix/fork.c +++ b/otherlibs/unix/fork.c @@ -15,7 +15,7 @@ #include <mlvalues.h> #include "unixsupport.h" -value unix_fork(value unit) /* ML */ +CAMLprim value unix_fork(value unit) { int ret; ret = fork(); diff --git a/otherlibs/unix/ftruncate.c b/otherlibs/unix/ftruncate.c index 7dbc957dd..cc9f978c6 100644 --- a/otherlibs/unix/ftruncate.c +++ b/otherlibs/unix/ftruncate.c @@ -17,7 +17,7 @@ #ifdef HAS_TRUNCATE -value unix_ftruncate(value fd, value len) /* ML */ +CAMLprim value unix_ftruncate(value fd, value len) { if (ftruncate(Int_val(fd), Long_val(len)) == -1) uerror("ftruncate", Nothing); @@ -26,7 +26,7 @@ value unix_ftruncate(value fd, value len) /* ML */ #else -value unix_ftruncate(value fd, value len) +CAMLprim value unix_ftruncate(value fd, value len) { invalid_argument("ftruncate not implemented"); } #endif diff --git a/otherlibs/unix/getcwd.c b/otherlibs/unix/getcwd.c index dd5194428..3f8cf7d89 100644 --- a/otherlibs/unix/getcwd.c +++ b/otherlibs/unix/getcwd.c @@ -30,7 +30,7 @@ #ifdef HAS_GETCWD -value unix_getcwd(value unit) /* ML */ +CAMLprim value unix_getcwd(value unit) { char buff[PATH_MAX]; if (getcwd(buff, sizeof(buff)) == 0) uerror("getcwd", Nothing); @@ -40,7 +40,7 @@ value unix_getcwd(value unit) /* ML */ #else #ifdef HAS_GETWD -value unix_getcwd(value unit) +CAMLprim value unix_getcwd(value unit) { char buff[PATH_MAX]; if (getwd(buff) == 0) uerror("getcwd", copy_string(buff)); @@ -49,7 +49,7 @@ value unix_getcwd(value unit) #else -value unix_getcwd(value unit) +CAMLprim value unix_getcwd(value unit) { invalid_argument("getcwd not implemented"); } #endif diff --git a/otherlibs/unix/getegid.c b/otherlibs/unix/getegid.c index f0864c95c..2d6a0a816 100644 --- a/otherlibs/unix/getegid.c +++ b/otherlibs/unix/getegid.c @@ -15,7 +15,7 @@ #include <mlvalues.h> #include "unixsupport.h" -value unix_getegid(void) /* ML */ +CAMLprim value unix_getegid(void) { return Val_int(getegid()); } diff --git a/otherlibs/unix/geteuid.c b/otherlibs/unix/geteuid.c index a018c9d0a..6e80b1886 100644 --- a/otherlibs/unix/geteuid.c +++ b/otherlibs/unix/geteuid.c @@ -15,7 +15,7 @@ #include <mlvalues.h> #include "unixsupport.h" -value unix_geteuid(void) /* ML */ +CAMLprim value unix_geteuid(void) { return Val_int(geteuid()); } diff --git a/otherlibs/unix/getgid.c b/otherlibs/unix/getgid.c index 06526f1de..f64f885fd 100644 --- a/otherlibs/unix/getgid.c +++ b/otherlibs/unix/getgid.c @@ -15,7 +15,7 @@ #include <mlvalues.h> #include "unixsupport.h" -value unix_getgid(void) /* ML */ +CAMLprim value unix_getgid(void) { return Val_int(getgid()); } diff --git a/otherlibs/unix/getgr.c b/otherlibs/unix/getgr.c index 812b16828..02fa6f2bf 100644 --- a/otherlibs/unix/getgr.c +++ b/otherlibs/unix/getgr.c @@ -38,7 +38,7 @@ static value alloc_group_entry(struct group *entry) return res; } -value unix_getgrnam(value name) /* ML */ +CAMLprim value unix_getgrnam(value name) { struct group * entry; entry = getgrnam(String_val(name)); @@ -46,7 +46,7 @@ value unix_getgrnam(value name) /* ML */ return alloc_group_entry(entry); } -value unix_getgrgid(value gid) /* ML */ +CAMLprim value unix_getgrgid(value gid) { struct group * entry; entry = getgrgid(Int_val(gid)); diff --git a/otherlibs/unix/getgroups.c b/otherlibs/unix/getgroups.c index 3e4242672..d548aad4f 100644 --- a/otherlibs/unix/getgroups.c +++ b/otherlibs/unix/getgroups.c @@ -24,7 +24,7 @@ #include <limits.h> #include "unixsupport.h" -value unix_getgroups(value unit) /* ML */ +CAMLprim value unix_getgroups(value unit) { gid_t gidset[NGROUPS_MAX]; int n; @@ -41,7 +41,7 @@ value unix_getgroups(value unit) /* ML */ #else -value unix_getgroups(value unit) +CAMLprim value unix_getgroups(value unit) { invalid_argument("getgroups not implemented"); } #endif diff --git a/otherlibs/unix/gethost.c b/otherlibs/unix/gethost.c index ca22e39b3..65d10595c 100644 --- a/otherlibs/unix/gethost.c +++ b/otherlibs/unix/gethost.c @@ -64,7 +64,7 @@ static value alloc_host_entry(struct hostent *entry) return res; } -value unix_gethostbyaddr(value a) /* ML */ +CAMLprim value unix_gethostbyaddr(value a) { uint32 adr; struct hostent * entry; @@ -76,7 +76,7 @@ value unix_gethostbyaddr(value a) /* ML */ return alloc_host_entry(entry); } -value unix_gethostbyname(value name) /* ML */ +CAMLprim value unix_gethostbyname(value name) { char hostname[256]; struct hostent * entry; @@ -91,10 +91,10 @@ value unix_gethostbyname(value name) /* ML */ #else -value unix_gethostbyaddr(value name) +CAMLprim value unix_gethostbyaddr(value name) { invalid_argument("gethostbyaddr not implemented"); } -value unix_gethostbyname(value name) +CAMLprim value unix_gethostbyname(value name) { invalid_argument("gethostbyname not implemented"); } #endif diff --git a/otherlibs/unix/gethostname.c b/otherlibs/unix/gethostname.c index 084c1c85a..ed12cb1d8 100644 --- a/otherlibs/unix/gethostname.c +++ b/otherlibs/unix/gethostname.c @@ -27,7 +27,7 @@ #define MAXHOSTNAMELEN 256 #endif -value unix_gethostname(value unit) /* ML */ +CAMLprim value unix_gethostname(value unit) { char name[MAXHOSTNAMELEN]; gethostname(name, MAXHOSTNAMELEN); @@ -40,7 +40,7 @@ value unix_gethostname(value unit) /* ML */ #include <sys/utsname.h> -value unix_gethostname(value unit) +CAMLprim value unix_gethostname(value unit) { struct utsname un; uname(&un); @@ -49,7 +49,7 @@ value unix_gethostname(value unit) #else -value unix_gethostname(value unit) +CAMLprim value unix_gethostname(value unit) { invalid_argument("gethostname not implemented"); } #endif diff --git a/otherlibs/unix/getlogin.c b/otherlibs/unix/getlogin.c index 18c734221..c749da8b0 100644 --- a/otherlibs/unix/getlogin.c +++ b/otherlibs/unix/getlogin.c @@ -19,7 +19,7 @@ extern char * getlogin(void); -value unix_getlogin(void) /* ML */ +CAMLprim value unix_getlogin(void) { char * name; name = getlogin(); diff --git a/otherlibs/unix/getpeername.c b/otherlibs/unix/getpeername.c index 6c175bd89..1498bedb2 100644 --- a/otherlibs/unix/getpeername.c +++ b/otherlibs/unix/getpeername.c @@ -19,7 +19,7 @@ #include "socketaddr.h" -value unix_getpeername(value sock) /* ML */ +CAMLprim value unix_getpeername(value sock) { int retcode; union sock_addr_union addr; @@ -33,7 +33,7 @@ value unix_getpeername(value sock) /* ML */ #else -value unix_getpeername(value sock) +CAMLprim value unix_getpeername(value sock) { invalid_argument("getpeername not implemented"); } #endif diff --git a/otherlibs/unix/getpid.c b/otherlibs/unix/getpid.c index df3946038..37a4fadac 100644 --- a/otherlibs/unix/getpid.c +++ b/otherlibs/unix/getpid.c @@ -15,7 +15,7 @@ #include <mlvalues.h> #include "unixsupport.h" -value unix_getpid(void) /* ML */ +CAMLprim value unix_getpid(void) { return Val_int(getpid()); } diff --git a/otherlibs/unix/getppid.c b/otherlibs/unix/getppid.c index af5ca3e0d..4cd09eae9 100644 --- a/otherlibs/unix/getppid.c +++ b/otherlibs/unix/getppid.c @@ -15,7 +15,7 @@ #include <mlvalues.h> #include "unixsupport.h" -value unix_getppid(void) /* ML */ +CAMLprim value unix_getppid(void) { return Val_int(getppid()); } diff --git a/otherlibs/unix/getproto.c b/otherlibs/unix/getproto.c index 74d2ca551..0158ae3c8 100644 --- a/otherlibs/unix/getproto.c +++ b/otherlibs/unix/getproto.c @@ -42,7 +42,7 @@ static value alloc_proto_entry(struct protoent *entry) return res; } -value unix_getprotobyname(value name) /* ML */ +CAMLprim value unix_getprotobyname(value name) { struct protoent * entry; entry = getprotobyname(String_val(name)); @@ -50,7 +50,7 @@ value unix_getprotobyname(value name) /* ML */ return alloc_proto_entry(entry); } -value unix_getprotobynumber(value proto) /* ML */ +CAMLprim value unix_getprotobynumber(value proto) { struct protoent * entry; entry = getprotobynumber(Int_val(proto)); @@ -60,10 +60,10 @@ value unix_getprotobynumber(value proto) /* ML */ #else -value unix_getprotobynumber(value proto) +CAMLprim value unix_getprotobynumber(value proto) { invalid_argument("getprotobynumber not implemented"); } -value unix_getprotobyname(value name) +CAMLprim value unix_getprotobyname(value name) { invalid_argument("getprotobyname not implemented"); } #endif diff --git a/otherlibs/unix/getpw.c b/otherlibs/unix/getpw.c index 6585cfc17..c0a315e21 100644 --- a/otherlibs/unix/getpw.c +++ b/otherlibs/unix/getpw.c @@ -47,7 +47,7 @@ static value alloc_passwd_entry(struct passwd *entry) return res; } -value unix_getpwnam(value name) /* ML */ +CAMLprim value unix_getpwnam(value name) { struct passwd * entry; entry = getpwnam(String_val(name)); @@ -55,7 +55,7 @@ value unix_getpwnam(value name) /* ML */ return alloc_passwd_entry(entry); } -value unix_getpwuid(value uid) /* ML */ +CAMLprim value unix_getpwuid(value uid) { struct passwd * entry; entry = getpwuid(Int_val(uid)); diff --git a/otherlibs/unix/getserv.c b/otherlibs/unix/getserv.c index b1f03c950..cb3698711 100644 --- a/otherlibs/unix/getserv.c +++ b/otherlibs/unix/getserv.c @@ -48,7 +48,7 @@ static value alloc_service_entry(struct servent *entry) return res; } -value unix_getservbyname(value name, value proto) /* ML */ +CAMLprim value unix_getservbyname(value name, value proto) { struct servent * entry; entry = getservbyname(String_val(name), String_val(proto)); @@ -56,7 +56,7 @@ value unix_getservbyname(value name, value proto) /* ML */ return alloc_service_entry(entry); } -value unix_getservbyport(value port, value proto) /* ML */ +CAMLprim value unix_getservbyport(value port, value proto) { struct servent * entry; entry = getservbyport(htons(Int_val(port)), String_val(proto)); @@ -66,10 +66,10 @@ value unix_getservbyport(value port, value proto) /* ML */ #else -value unix_getservbyport(value port, value proto) +CAMLprim value unix_getservbyport(value port, value proto) { invalid_argument("getservbyport not implemented"); } -value unix_getservbyname(value name, value proto) +CAMLprim value unix_getservbyname(value name, value proto) { invalid_argument("getservbyname not implemented"); } #endif diff --git a/otherlibs/unix/getsockname.c b/otherlibs/unix/getsockname.c index 920900e48..db6ccb2bf 100644 --- a/otherlibs/unix/getsockname.c +++ b/otherlibs/unix/getsockname.c @@ -19,7 +19,7 @@ #include "socketaddr.h" -value unix_getsockname(value sock) /* ML */ +CAMLprim value unix_getsockname(value sock) { int retcode; union sock_addr_union addr; @@ -33,7 +33,7 @@ value unix_getsockname(value sock) /* ML */ #else -value unix_getsockname(value sock) +CAMLprim value unix_getsockname(value sock) { invalid_argument("getsockname not implemented"); } #endif diff --git a/otherlibs/unix/gettimeofday.c b/otherlibs/unix/gettimeofday.c index 5c50855b6..6e436b58d 100644 --- a/otherlibs/unix/gettimeofday.c +++ b/otherlibs/unix/gettimeofday.c @@ -21,7 +21,7 @@ #include <sys/types.h> #include <sys/time.h> -value unix_gettimeofday(value unit) /* ML */ +CAMLprim value unix_gettimeofday(value unit) { struct timeval tp; if (gettimeofday(&tp, NULL) == -1) uerror("gettimeofday", Nothing); @@ -30,7 +30,7 @@ value unix_gettimeofday(value unit) /* ML */ #else -value unix_gettimeofday(value unit) +CAMLprim value unix_gettimeofday(value unit) { invalid_argument("gettimeofday not implemented"); } #endif diff --git a/otherlibs/unix/getuid.c b/otherlibs/unix/getuid.c index 39387f5f7..c3e2be6e9 100644 --- a/otherlibs/unix/getuid.c +++ b/otherlibs/unix/getuid.c @@ -15,7 +15,7 @@ #include <mlvalues.h> #include "unixsupport.h" -value unix_getuid(void) /* ML */ +CAMLprim value unix_getuid(void) { return Val_int(getuid()); } diff --git a/otherlibs/unix/gmtime.c b/otherlibs/unix/gmtime.c index 2a75bce2c..5a71e5e40 100644 --- a/otherlibs/unix/gmtime.c +++ b/otherlibs/unix/gmtime.c @@ -35,7 +35,7 @@ static value alloc_tm(struct tm *tm) return res; } -value unix_gmtime(value t) /* ML */ +CAMLprim value unix_gmtime(value t) { time_t clock; struct tm * tm; @@ -45,7 +45,7 @@ value unix_gmtime(value t) /* ML */ return alloc_tm(tm); } -value unix_localtime(value t) /* ML */ +CAMLprim value unix_localtime(value t) { time_t clock; struct tm * tm; @@ -57,7 +57,7 @@ value unix_localtime(value t) /* ML */ #ifdef HAS_MKTIME -value unix_mktime(value t) /* ML */ +CAMLprim value unix_mktime(value t) { struct tm tm; time_t clock; @@ -87,6 +87,6 @@ value unix_mktime(value t) /* ML */ #else -value unix_mktime(value t) { invalid_argument("mktime not implemented"); } +CAMLprim value unix_mktime(value t) { invalid_argument("mktime not implemented"); } #endif diff --git a/otherlibs/unix/itimer.c b/otherlibs/unix/itimer.c index b3e298afc..3bab202fd 100644 --- a/otherlibs/unix/itimer.c +++ b/otherlibs/unix/itimer.c @@ -37,7 +37,7 @@ static value unix_convert_itimer(struct itimerval *tp) static int itimers[3] = { ITIMER_REAL, ITIMER_VIRTUAL, ITIMER_PROF }; -value unix_setitimer(value which, value newval) /* ML */ +CAMLprim value unix_setitimer(value which, value newval) { struct itimerval new, old; Set_timeval(new.it_interval, Double_field(newval, 0)); @@ -47,7 +47,7 @@ value unix_setitimer(value which, value newval) /* ML */ return unix_convert_itimer(&old); } -value unix_getitimer(value which) /* ML */ +CAMLprim value unix_getitimer(value which) { struct itimerval val; if (getitimer(itimers[Int_val(which)], &val) == -1) @@ -57,9 +57,9 @@ value unix_getitimer(value which) /* ML */ #else -value unix_setitimer(value which, value newval) +CAMLprim value unix_setitimer(value which, value newval) { invalid_argument("setitimer not implemented"); } -value unix_getitimer(value which) +CAMLprim value unix_getitimer(value which) { invalid_argument("getitimer not implemented"); } #endif diff --git a/otherlibs/unix/kill.c b/otherlibs/unix/kill.c index 264f9c76e..36e81b391 100644 --- a/otherlibs/unix/kill.c +++ b/otherlibs/unix/kill.c @@ -18,7 +18,7 @@ #include <signal.h> #include <signals.h> -value unix_kill(value pid, value signal) /* ML */ +CAMLprim value unix_kill(value pid, value signal) { int sig; sig = convert_signal_number(Int_val(signal)); diff --git a/otherlibs/unix/link.c b/otherlibs/unix/link.c index 9afe116e4..81c06de92 100644 --- a/otherlibs/unix/link.c +++ b/otherlibs/unix/link.c @@ -15,7 +15,7 @@ #include <mlvalues.h> #include "unixsupport.h" -value unix_link(value path1, value path2) /* ML */ +CAMLprim value unix_link(value path1, value path2) { if (link(String_val(path1), String_val(path2)) == -1) uerror("link", path2); return Val_unit; diff --git a/otherlibs/unix/listen.c b/otherlibs/unix/listen.c index 15bccc0e8..2a19bdcaa 100644 --- a/otherlibs/unix/listen.c +++ b/otherlibs/unix/listen.c @@ -19,7 +19,7 @@ #include <sys/socket.h> -value unix_listen(value sock, value backlog) /* ML */ +CAMLprim value unix_listen(value sock, value backlog) { if (listen(Int_val(sock), Int_val(backlog)) == -1) uerror("listen", Nothing); return Val_unit; @@ -27,7 +27,7 @@ value unix_listen(value sock, value backlog) /* ML */ #else -value unix_listen(value sock, value backlog) +CAMLprim value unix_listen(value sock, value backlog) { invalid_argument("listen not implemented"); } #endif diff --git a/otherlibs/unix/lockf.c b/otherlibs/unix/lockf.c index 5a8ea4369..aed8710f7 100644 --- a/otherlibs/unix/lockf.c +++ b/otherlibs/unix/lockf.c @@ -19,7 +19,7 @@ #if defined(F_GETLK) && defined(F_SETLK) && defined(F_SETLKW) -value unix_lockf(value fd, value cmd, value span) /* ML */ +CAMLprim value unix_lockf(value fd, value cmd, value span) { struct flock l; int ret; @@ -93,7 +93,7 @@ static int lock_command_table[] = { F_ULOCK, F_LOCK, F_TLOCK, F_TEST, F_LOCK, F_TLOCK }; -value unix_lockf(value fd, value cmd, value span) +CAMLprim value unix_lockf(value fd, value cmd, value span) { if (lockf(Int_val(fd), lock_command_table[Int_val(cmd)], Long_val(span)) == -1) uerror("lockf", Nothing); @@ -102,7 +102,7 @@ value unix_lockf(value fd, value cmd, value span) #else -value unix_lockf(value fd, value cmd, value span) +CAMLprim value unix_lockf(value fd, value cmd, value span) { invalid_argument("lockf not implemented"); } #endif diff --git a/otherlibs/unix/lseek.c b/otherlibs/unix/lseek.c index fc0a3b7fb..567f44d4e 100644 --- a/otherlibs/unix/lseek.c +++ b/otherlibs/unix/lseek.c @@ -27,7 +27,7 @@ static int seek_command_table[] = { SEEK_SET, SEEK_CUR, SEEK_END }; -value unix_lseek(value fd, value ofs, value cmd) /* ML */ +CAMLprim value unix_lseek(value fd, value ofs, value cmd) { long ret; ret = lseek(Int_val(fd), Long_val(ofs), diff --git a/otherlibs/unix/mkdir.c b/otherlibs/unix/mkdir.c index 3630b2ee4..058ade946 100644 --- a/otherlibs/unix/mkdir.c +++ b/otherlibs/unix/mkdir.c @@ -17,7 +17,7 @@ #include <mlvalues.h> #include "unixsupport.h" -value unix_mkdir(value path, value perm) /* ML */ +CAMLprim value unix_mkdir(value path, value perm) { if (mkdir(String_val(path), Int_val(perm)) == -1) uerror("mkdir", path); return Val_unit; diff --git a/otherlibs/unix/mkfifo.c b/otherlibs/unix/mkfifo.c index 708a75199..997a0a5a7 100644 --- a/otherlibs/unix/mkfifo.c +++ b/otherlibs/unix/mkfifo.c @@ -19,7 +19,7 @@ #ifdef HAS_MKFIFO -value unix_mkfifo(value path, value mode) /* ML */ +CAMLprim value unix_mkfifo(value path, value mode) { if (mkfifo(String_val(path), Int_val(mode)) == -1) uerror("mkfifo", path); @@ -33,7 +33,7 @@ value unix_mkfifo(value path, value mode) /* ML */ #ifdef S_IFIFO -value unix_mkfifo(value path, value mode) +CAMLprim value unix_mkfifo(value path, value mode) { if (mknod(String_val(path), (Int_val(mode) & 07777) | S_IFIFO, 0) == -1) uerror("mkfifo", path); @@ -42,7 +42,7 @@ value unix_mkfifo(value path, value mode) #else -value unix_mkfifo() { invalid_argument("mkfifo not implemented"); } +CAMLprim value unix_mkfifo() { invalid_argument("mkfifo not implemented"); } #endif #endif diff --git a/otherlibs/unix/nice.c b/otherlibs/unix/nice.c index c9ea81134..068a9101e 100644 --- a/otherlibs/unix/nice.c +++ b/otherlibs/unix/nice.c @@ -22,7 +22,7 @@ #include <sys/time.h> #include <sys/resource.h> -value unix_nice(value incr) /* ML */ +CAMLprim value unix_nice(value incr) { int prio; errno = 0; @@ -37,7 +37,7 @@ value unix_nice(value incr) /* ML */ #else -value unix_nice(value incr) +CAMLprim value unix_nice(value incr) { int ret; errno = 0; diff --git a/otherlibs/unix/open.c b/otherlibs/unix/open.c index b15198412..068227a33 100644 --- a/otherlibs/unix/open.c +++ b/otherlibs/unix/open.c @@ -25,7 +25,7 @@ static int open_flag_table[] = { O_RDONLY, O_WRONLY, O_RDWR, O_NONBLOCK, O_APPEND, O_CREAT, O_TRUNC, O_EXCL }; -value unix_open(value path, value flags, value perm) /* ML */ +CAMLprim value unix_open(value path, value flags, value perm) { int ret; diff --git a/otherlibs/unix/opendir.c b/otherlibs/unix/opendir.c index 567acdac1..0a1c8b98e 100644 --- a/otherlibs/unix/opendir.c +++ b/otherlibs/unix/opendir.c @@ -21,7 +21,7 @@ #include <sys/dir.h> #endif -value unix_opendir(value path) /* ML */ +CAMLprim value unix_opendir(value path) { DIR * d; d = opendir(String_val(path)); diff --git a/otherlibs/unix/pipe.c b/otherlibs/unix/pipe.c index c9dae68d2..36a1903ef 100644 --- a/otherlibs/unix/pipe.c +++ b/otherlibs/unix/pipe.c @@ -16,7 +16,7 @@ #include <alloc.h> #include "unixsupport.h" -value unix_pipe(void) /* ML */ +CAMLprim value unix_pipe(void) { int fd[2]; value res; diff --git a/otherlibs/unix/putenv.c b/otherlibs/unix/putenv.c index 257a5c58d..c20fb8d25 100644 --- a/otherlibs/unix/putenv.c +++ b/otherlibs/unix/putenv.c @@ -22,7 +22,7 @@ #ifdef HAS_PUTENV -value unix_putenv(value name, value val) /* ML */ +CAMLprim value unix_putenv(value name, value val) { mlsize_t namelen = string_length(name); mlsize_t vallen = string_length(val); @@ -38,7 +38,7 @@ value unix_putenv(value name, value val) /* ML */ #else -value unix_putenv(value name, value val) +CAMLprim value unix_putenv(value name, value val) { invalid_argument("putenv not implemented"); } #endif diff --git a/otherlibs/unix/read.c b/otherlibs/unix/read.c index eab87d344..ac8362399 100644 --- a/otherlibs/unix/read.c +++ b/otherlibs/unix/read.c @@ -18,7 +18,7 @@ #include <signals.h> #include "unixsupport.h" -value unix_read(value fd, value buf, value ofs, value len) /* ML */ +CAMLprim value unix_read(value fd, value buf, value ofs, value len) { long numbytes; int ret; diff --git a/otherlibs/unix/readdir.c b/otherlibs/unix/readdir.c index 6c059d8bc..b3dd67dd9 100644 --- a/otherlibs/unix/readdir.c +++ b/otherlibs/unix/readdir.c @@ -25,7 +25,7 @@ typedef struct dirent directory_entry; typedef struct direct directory_entry; #endif -value unix_readdir(value d) /* ML */ +CAMLprim value unix_readdir(value d) { directory_entry * e; diff --git a/otherlibs/unix/readlink.c b/otherlibs/unix/readlink.c index 4bccff407..e843b571d 100644 --- a/otherlibs/unix/readlink.c +++ b/otherlibs/unix/readlink.c @@ -28,7 +28,7 @@ #endif #endif -value unix_readlink(value path) /* ML */ +CAMLprim value unix_readlink(value path) { char buffer[PATH_MAX]; int len; @@ -40,7 +40,7 @@ value unix_readlink(value path) /* ML */ #else -value unix_readlink(value path) +CAMLprim value unix_readlink(value path) { invalid_argument("readlink not implemented"); } #endif diff --git a/otherlibs/unix/rename.c b/otherlibs/unix/rename.c index 727c901d5..619e64348 100644 --- a/otherlibs/unix/rename.c +++ b/otherlibs/unix/rename.c @@ -16,7 +16,7 @@ #include <mlvalues.h> #include "unixsupport.h" -value unix_rename(value path1, value path2) /* ML */ +CAMLprim value unix_rename(value path1, value path2) { if (rename(String_val(path1), String_val(path2)) == -1) uerror("rename", path1); diff --git a/otherlibs/unix/rewinddir.c b/otherlibs/unix/rewinddir.c index 38488f2ca..fc59a5bf5 100644 --- a/otherlibs/unix/rewinddir.c +++ b/otherlibs/unix/rewinddir.c @@ -23,7 +23,7 @@ #ifdef HAS_REWINDDIR -value unix_rewinddir(value d) /* ML */ +CAMLprim value unix_rewinddir(value d) { rewinddir((DIR *) d); return Val_unit; @@ -31,7 +31,7 @@ value unix_rewinddir(value d) /* ML */ #else -value unix_rewinddir(value d) +CAMLprim value unix_rewinddir(value d) { invalid_argument("rewinddir not implemented"); } #endif diff --git a/otherlibs/unix/rmdir.c b/otherlibs/unix/rmdir.c index e08dcfcf2..167d8c8c7 100644 --- a/otherlibs/unix/rmdir.c +++ b/otherlibs/unix/rmdir.c @@ -15,7 +15,7 @@ #include <mlvalues.h> #include "unixsupport.h" -value unix_rmdir(value path) /* ML */ +CAMLprim value unix_rmdir(value path) { if (rmdir(String_val(path)) == -1) uerror("rmdir", path); return Val_unit; diff --git a/otherlibs/unix/select.c b/otherlibs/unix/select.c index 07459fb6f..681b0aaf3 100644 --- a/otherlibs/unix/select.c +++ b/otherlibs/unix/select.c @@ -59,7 +59,7 @@ static value fdset_to_fdlist(file_descr_set *fdset) return res; } -value unix_select(value readfds, value writefds, value exceptfds, value timeout) /* ML */ +CAMLprim value unix_select(value readfds, value writefds, value exceptfds, value timeout) { file_descr_set read, write, except; double tm; @@ -98,7 +98,7 @@ value unix_select(value readfds, value writefds, value exceptfds, value timeout) #else -value unix_select(value readfds, value writefds, value exceptfds, value timeout) +CAMLprim value unix_select(value readfds, value writefds, value exceptfds, value timeout) { invalid_argument("select not implemented"); } #endif diff --git a/otherlibs/unix/sendrecv.c b/otherlibs/unix/sendrecv.c index f576fa4c7..8aef01982 100644 --- a/otherlibs/unix/sendrecv.c +++ b/otherlibs/unix/sendrecv.c @@ -26,7 +26,7 @@ static int msg_flag_table[] = { MSG_OOB, MSG_DONTROUTE, MSG_PEEK }; -value unix_recv(value sock, value buff, value ofs, value len, value flags) /* ML */ +CAMLprim value unix_recv(value sock, value buff, value ofs, value len, value flags) { int ret; long numbytes; @@ -45,7 +45,7 @@ value unix_recv(value sock, value buff, value ofs, value len, value flags) /* ML return Val_int(ret); } -value unix_recvfrom(value sock, value buff, value ofs, value len, value flags) /* ML */ +CAMLprim value unix_recvfrom(value sock, value buff, value ofs, value len, value flags) { int ret; long numbytes; @@ -74,7 +74,7 @@ value unix_recvfrom(value sock, value buff, value ofs, value len, value flags) / return res; } -value unix_send(value sock, value buff, value ofs, value len, value flags) /* ML */ +CAMLprim value unix_send(value sock, value buff, value ofs, value len, value flags) { int ret; long numbytes; @@ -91,7 +91,7 @@ value unix_send(value sock, value buff, value ofs, value len, value flags) /* ML return Val_int(ret); } -value unix_sendto_native(value sock, value buff, value ofs, value len, value flags, value dest) +CAMLprim value unix_sendto_native(value sock, value buff, value ofs, value len, value flags, value dest) { int ret; long numbytes; @@ -112,7 +112,7 @@ value unix_sendto_native(value sock, value buff, value ofs, value len, value fla return Val_int(ret); } -value unix_sendto(value *argv, int argc) /* ML */ +CAMLprim value unix_sendto(value *argv, int argc) { return unix_sendto_native (argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]); @@ -120,19 +120,19 @@ value unix_sendto(value *argv, int argc) /* ML */ #else -value unix_recv(value sock, value buff, value ofs, value len, value flags) +CAMLprim value unix_recv(value sock, value buff, value ofs, value len, value flags) { invalid_argument("recv not implemented"); } -value unix_recvfrom(value sock, value buff, value ofs, value len, value flags) +CAMLprim value unix_recvfrom(value sock, value buff, value ofs, value len, value flags) { invalid_argument("recvfrom not implemented"); } -value unix_send(value sock, value buff, value ofs, value len, value flags) +CAMLprim value unix_send(value sock, value buff, value ofs, value len, value flags) { invalid_argument("send not implemented"); } -value unix_sendto_native(value sock, value buff, value ofs, value len, value flags, value dest) +CAMLprim value unix_sendto_native(value sock, value buff, value ofs, value len, value flags, value dest) { invalid_argument("sendto not implemented"); } -value unix_sendto(value *argv, int argc) +CAMLprim value unix_sendto(value *argv, int argc) { invalid_argument("sendto not implemented"); } #endif diff --git a/otherlibs/unix/setgid.c b/otherlibs/unix/setgid.c index f37b57629..c481594b4 100644 --- a/otherlibs/unix/setgid.c +++ b/otherlibs/unix/setgid.c @@ -15,7 +15,7 @@ #include <mlvalues.h> #include "unixsupport.h" -value unix_setgid(value gid) /* ML */ +CAMLprim value unix_setgid(value gid) { if (setgid(Int_val(gid)) == -1) uerror("setgid", Nothing); return Val_unit; diff --git a/otherlibs/unix/setsid.c b/otherlibs/unix/setsid.c index c75893ac3..3c2bbaedd 100644 --- a/otherlibs/unix/setsid.c +++ b/otherlibs/unix/setsid.c @@ -18,7 +18,7 @@ #include <unistd.h> #endif -value unix_setsid(value unit) /* ML */ +CAMLprim value unix_setsid(value unit) { #ifdef HAS_SETSID return Val_int(setsid()); diff --git a/otherlibs/unix/setuid.c b/otherlibs/unix/setuid.c index 7c613f04b..346f948c4 100644 --- a/otherlibs/unix/setuid.c +++ b/otherlibs/unix/setuid.c @@ -15,7 +15,7 @@ #include <mlvalues.h> #include "unixsupport.h" -value unix_setuid(value uid) /* ML */ +CAMLprim value unix_setuid(value uid) { if (setuid(Int_val(uid)) == -1) uerror("setuid", Nothing); return Val_unit; diff --git a/otherlibs/unix/shutdown.c b/otherlibs/unix/shutdown.c index 7004752a9..a6e3cf52c 100644 --- a/otherlibs/unix/shutdown.c +++ b/otherlibs/unix/shutdown.c @@ -23,7 +23,7 @@ static int shutdown_command_table[] = { 0, 1, 2 }; -value unix_shutdown(value sock, value cmd) /* ML */ +CAMLprim value unix_shutdown(value sock, value cmd) { if (shutdown(Int_val(sock), shutdown_command_table[Int_val(cmd)]) == -1) uerror("shutdown", Nothing); @@ -32,7 +32,7 @@ value unix_shutdown(value sock, value cmd) /* ML */ #else -value unix_shutdown(value sock, value cmd) +CAMLprim value unix_shutdown(value sock, value cmd) { invalid_argument("shutdown not implemented"); } #endif diff --git a/otherlibs/unix/signals.c b/otherlibs/unix/signals.c index 9810d7439..3800c7238 100644 --- a/otherlibs/unix/signals.c +++ b/otherlibs/unix/signals.c @@ -56,7 +56,7 @@ static value encode_sigset(sigset_t * set) static int sigprocmask_cmd[3] = { SIG_SETMASK, SIG_BLOCK, SIG_UNBLOCK }; -value unix_sigprocmask(value vaction, value vset) /* ML */ +CAMLprim value unix_sigprocmask(value vaction, value vset) { int how; sigset_t set, oldset; @@ -71,14 +71,14 @@ value unix_sigprocmask(value vaction, value vset) /* ML */ return encode_sigset(&oldset); } -value unix_sigpending(value unit) /* ML */ +CAMLprim value unix_sigpending(value unit) { sigset_t pending; if (sigpending(&pending) == -1) uerror("sigpending", Nothing); return encode_sigset(&pending); } -value unix_sigsuspend(value vset) /* ML */ +CAMLprim value unix_sigsuspend(value vset) { sigset_t set; int retcode; @@ -92,13 +92,13 @@ value unix_sigsuspend(value vset) /* ML */ #else -value unix_sigprocmask(value vaction, value vset) +CAMLprim value unix_sigprocmask(value vaction, value vset) { invalid_argument("Unix.sigprocmask not available"); } -value unix_sigpending(value unit) +CAMLprim value unix_sigpending(value unit) { invalid_argument("Unix.sigpending not available"); } -value unix_sigsuspend(value vset) +CAMLprim value unix_sigsuspend(value vset) { invalid_argument("Unix.sigsuspend not available"); } #endif diff --git a/otherlibs/unix/sleep.c b/otherlibs/unix/sleep.c index 69b317a05..9044b84da 100644 --- a/otherlibs/unix/sleep.c +++ b/otherlibs/unix/sleep.c @@ -16,7 +16,7 @@ #include <signals.h> #include "unixsupport.h" -value unix_sleep(value t) /* ML */ +CAMLprim value unix_sleep(value t) { enter_blocking_section(); sleep(Int_val(t)); diff --git a/otherlibs/unix/socket.c b/otherlibs/unix/socket.c index 4b678595c..f7a8af079 100644 --- a/otherlibs/unix/socket.c +++ b/otherlibs/unix/socket.c @@ -28,7 +28,7 @@ int socket_type_table[] = { SOCK_STREAM, SOCK_DGRAM, SOCK_RAW, SOCK_SEQPACKET }; -value unix_socket(value domain, value type, value proto) /* ML */ +CAMLprim value unix_socket(value domain, value type, value proto) { int retcode; retcode = socket(socket_domain_table[Int_val(domain)], @@ -41,7 +41,7 @@ value unix_socket(value domain, value type, value proto) /* ML */ #else -value unix_socket(value domain, value type, value proto) +CAMLprim value unix_socket(value domain, value type, value proto) { invalid_argument("socket not implemented"); } #endif diff --git a/otherlibs/unix/socketaddr.h b/otherlibs/unix/socketaddr.h index 3fc858092..df8e9b93a 100644 --- a/otherlibs/unix/socketaddr.h +++ b/otherlibs/unix/socketaddr.h @@ -36,8 +36,8 @@ typedef int socklen_param_type; void get_sockaddr (value mladdr, union sock_addr_union * addr /*out*/, socklen_param_type * addr_len /*out*/); -value alloc_sockaddr (union sock_addr_union * addr /*in*/, +CAMLprim value alloc_sockaddr (union sock_addr_union * addr /*in*/, socklen_param_type addr_len); -value alloc_inet_addr (uint32 inaddr); +CAMLprim value alloc_inet_addr (uint32 inaddr); #define GET_INET_ADDR(v) (*((uint32 *) (v))) diff --git a/otherlibs/unix/socketpair.c b/otherlibs/unix/socketpair.c index 6976d146f..86c383b84 100644 --- a/otherlibs/unix/socketpair.c +++ b/otherlibs/unix/socketpair.c @@ -22,7 +22,7 @@ extern int socket_domain_table[], socket_type_table[]; -value unix_socketpair(value domain, value type, value proto) /* ML */ +CAMLprim value unix_socketpair(value domain, value type, value proto) { int sv[2]; value res; @@ -38,7 +38,7 @@ value unix_socketpair(value domain, value type, value proto) /* ML */ #else -value unix_socketpair(value domain, value type, value proto) +CAMLprim value unix_socketpair(value domain, value type, value proto) { invalid_argument("socketpair not implemented"); } #endif diff --git a/otherlibs/unix/sockopt.c b/otherlibs/unix/sockopt.c index cd6e4b132..210e2134b 100644 --- a/otherlibs/unix/sockopt.c +++ b/otherlibs/unix/sockopt.c @@ -84,7 +84,7 @@ static int sockopt_optint[] = { SO_LINGER }; static int sockopt_float[] = { SO_RCVTIMEO, SO_SNDTIMEO }; -value getsockopt_int(int *sockopt, value socket, value level, value option) +CAMLprim value getsockopt_int(int *sockopt, value socket, value level, value option) { int optval; socklen_param_type optsize; @@ -96,7 +96,7 @@ value getsockopt_int(int *sockopt, value socket, value level, value option) return Val_int(optval); } -value setsockopt_int(int *sockopt, value socket, value level, +CAMLprim value setsockopt_int(int *sockopt, value socket, value level, value option, value status) { int optval = Int_val(status); @@ -106,25 +106,25 @@ value setsockopt_int(int *sockopt, value socket, value level, return Val_unit; } -value unix_getsockopt_bool(value socket, value option) { /* ML */ +CAMLprim value unix_getsockopt_bool(value socket, value option) { /* ML */ return getsockopt_int(sockopt_bool, socket, Val_int(SOL_SOCKET), option); } -value unix_setsockopt_bool(value socket, value option, value status) /* ML */ +CAMLprim value unix_setsockopt_bool(value socket, value option, value status) { return setsockopt_int(sockopt_bool, socket, Val_int(SOL_SOCKET), option, status); } -value unix_getsockopt_int(value socket, value option) { /* ML */ +CAMLprim value unix_getsockopt_int(value socket, value option) { /* ML */ return getsockopt_int(sockopt_int, socket, Val_int(SOL_SOCKET), option); } -value unix_setsockopt_int(value socket, value option, value status) /* ML */ +CAMLprim value unix_setsockopt_int(value socket, value option, value status) { return setsockopt_int(sockopt_int, socket, Val_int(SOL_SOCKET), option, status); } -value getsockopt_optint(int *sockopt, value socket, value level, value option) +CAMLprim value getsockopt_optint(int *sockopt, value socket, value level, value option) { struct linger optval; socklen_param_type optsize; @@ -141,7 +141,7 @@ value getsockopt_optint(int *sockopt, value socket, value level, value option) return res; } -value setsockopt_optint(int *sockopt, value socket, value level, +CAMLprim value setsockopt_optint(int *sockopt, value socket, value level, value option, value status) { struct linger optval; @@ -155,17 +155,17 @@ value setsockopt_optint(int *sockopt, value socket, value level, return Val_unit; } -value unix_getsockopt_optint(value socket, value option) /* ML */ +CAMLprim value unix_getsockopt_optint(value socket, value option) { return getsockopt_optint(sockopt_optint, socket, Val_int(SOL_SOCKET), option); } -value unix_setsockopt_optint(value socket, value option, value status) /* ML */ +CAMLprim value unix_setsockopt_optint(value socket, value option, value status) { return setsockopt_optint(sockopt_optint, socket, Val_int(SOL_SOCKET), option, status); } -value getsockopt_float(int *sockopt, value socket, value level, value option) +CAMLprim value getsockopt_float(int *sockopt, value socket, value level, value option) { struct timeval tv; socklen_param_type optsize; @@ -177,7 +177,7 @@ value getsockopt_float(int *sockopt, value socket, value level, value option) return copy_double((double) tv.tv_sec + (double) tv.tv_usec / 1e6); } -value setsockopt_float(int *sockopt, value socket, value level, +CAMLprim value setsockopt_float(int *sockopt, value socket, value level, value option, value status) { struct timeval tv; @@ -192,40 +192,40 @@ value setsockopt_float(int *sockopt, value socket, value level, return Val_unit; } -value unix_getsockopt_float(value socket, value option) /* ML */ +CAMLprim value unix_getsockopt_float(value socket, value option) { return getsockopt_float(sockopt_float, socket, Val_int(SOL_SOCKET), option); } -value unix_setsockopt_float(value socket, value option, value status) /* ML */ +CAMLprim value unix_setsockopt_float(value socket, value option, value status) { return setsockopt_float(sockopt_float, socket, Val_int(SOL_SOCKET), option, status); } #else -value unix_getsockopt(value socket, value option) +CAMLprim value unix_getsockopt(value socket, value option) { invalid_argument("getsockopt not implemented"); } -value unix_setsockopt(value socket, value option, value status) +CAMLprim value unix_setsockopt(value socket, value option, value status) { invalid_argument("setsockopt not implemented"); } -value unix_getsockopt_int(value socket, value option) +CAMLprim value unix_getsockopt_int(value socket, value option) { invalid_argument("getsockopt_int not implemented"); } -value unix_setsockopt_int(value socket, value option, value status) +CAMLprim value unix_setsockopt_int(value socket, value option, value status) { invalid_argument("setsockopt_int not implemented"); } -value unix_getsockopt_optint(value socket, value option) +CAMLprim value unix_getsockopt_optint(value socket, value option) { invalid_argument("getsockopt_optint not implemented"); } -value unix_setsockopt_optint(value socket, value option, value status) +CAMLprim value unix_setsockopt_optint(value socket, value option, value status) { invalid_argument("setsockopt_optint not implemented"); } -value unix_getsockopt_float(value socket, value option) +CAMLprim value unix_getsockopt_float(value socket, value option) { invalid_argument("getsockopt_float not implemented"); } -value unix_setsockopt_float(value socket, value option, value status) +CAMLprim value unix_setsockopt_float(value socket, value option, value status) { invalid_argument("setsockopt_float not implemented"); } #endif diff --git a/otherlibs/unix/stat.c b/otherlibs/unix/stat.c index 12b36e098..a3c0f854f 100644 --- a/otherlibs/unix/stat.c +++ b/otherlibs/unix/stat.c @@ -64,7 +64,7 @@ static value stat_aux(struct stat *buf) return v; } -value unix_stat(value path) /* ML */ +CAMLprim value unix_stat(value path) { int ret; struct stat buf; @@ -73,7 +73,7 @@ value unix_stat(value path) /* ML */ return stat_aux(&buf); } -value unix_lstat(value path) /* ML */ +CAMLprim value unix_lstat(value path) { int ret; struct stat buf; @@ -86,7 +86,7 @@ value unix_lstat(value path) /* ML */ return stat_aux(&buf); } -value unix_fstat(value fd) /* ML */ +CAMLprim value unix_fstat(value fd) { int ret; struct stat buf; diff --git a/otherlibs/unix/strofaddr.c b/otherlibs/unix/strofaddr.c index 4bbc206a9..e89ad9dbf 100644 --- a/otherlibs/unix/strofaddr.c +++ b/otherlibs/unix/strofaddr.c @@ -20,7 +20,7 @@ #include "socketaddr.h" -value unix_string_of_inet_addr(value a) /* ML */ +CAMLprim value unix_string_of_inet_addr(value a) { struct in_addr address; address.s_addr = GET_INET_ADDR(a); @@ -29,7 +29,7 @@ value unix_string_of_inet_addr(value a) /* ML */ #else -value unix_string_of_inet_addr(value a) +CAMLprim value unix_string_of_inet_addr(value a) { invalid_argument("string_of_inet_addr not implemented"); } #endif diff --git a/otherlibs/unix/symlink.c b/otherlibs/unix/symlink.c index c0314c48c..e24e68ef7 100644 --- a/otherlibs/unix/symlink.c +++ b/otherlibs/unix/symlink.c @@ -17,7 +17,7 @@ #ifdef HAS_SYMLINK -value unix_symlink(value path1, value path2) /* ML */ +CAMLprim value unix_symlink(value path1, value path2) { if (symlink(String_val(path1), String_val(path2)) == -1) uerror("symlink", path2); @@ -26,7 +26,7 @@ value unix_symlink(value path1, value path2) /* ML */ #else -value unix_symlink(value path1, value path2) +CAMLprim value unix_symlink(value path1, value path2) { invalid_argument("symlink not implemented"); } #endif diff --git a/otherlibs/unix/termios.c b/otherlibs/unix/termios.c index 9a8b58616..29f8c70ca 100644 --- a/otherlibs/unix/termios.c +++ b/otherlibs/unix/termios.c @@ -229,7 +229,7 @@ static void decode_terminal_status(value *src) } } -value unix_tcgetattr(value fd) /* ML */ +CAMLprim value unix_tcgetattr(value fd) { value res; @@ -244,7 +244,7 @@ static int when_flag_table[] = { TCSANOW, TCSADRAIN, TCSAFLUSH }; -value unix_tcsetattr(value fd, value when, value arg) /* ML */ +CAMLprim value unix_tcsetattr(value fd, value when, value arg) { if (tcgetattr(Int_val(fd), &terminal_status) == -1) uerror("tcsetattr", Nothing); @@ -256,14 +256,14 @@ value unix_tcsetattr(value fd, value when, value arg) /* ML */ return Val_unit; } -value unix_tcsendbreak(value fd, value delay) /* ML */ +CAMLprim value unix_tcsendbreak(value fd, value delay) { if (tcsendbreak(Int_val(fd), Int_val(delay)) == -1) uerror("tcsendbreak", Nothing); return Val_unit; } -value unix_tcdrain(value fd) /* ML */ +CAMLprim value unix_tcdrain(value fd) { if (tcdrain(Int_val(fd)) == -1) uerror("tcdrain", Nothing); return Val_unit; @@ -273,7 +273,7 @@ static int queue_flag_table[] = { TCIFLUSH, TCOFLUSH, TCIOFLUSH }; -value unix_tcflush(value fd, value queue) /* ML */ +CAMLprim value unix_tcflush(value fd, value queue) { if (tcflush(Int_val(fd), queue_flag_table[Int_val(queue)]) == -1) uerror("tcflush", Nothing); @@ -284,7 +284,7 @@ static int action_flag_table[] = { TCOOFF, TCOON, TCIOFF, TCION }; -value unix_tcflow(value fd, value action) /* ML */ +CAMLprim value unix_tcflow(value fd, value action) { if (tcflow(Int_val(fd), action_flag_table[Int_val(action)]) == -1) uerror("tcflow", Nothing); @@ -293,22 +293,22 @@ value unix_tcflow(value fd, value action) /* ML */ #else -value unix_tcgetattr(value fd) +CAMLprim value unix_tcgetattr(value fd) { invalid_argument("tcgetattr not implemented"); } -value unix_tcsetattr(value fd, value when, value arg) +CAMLprim value unix_tcsetattr(value fd, value when, value arg) { invalid_argument("tcsetattr not implemented"); } -value unix_tcsendbreak(value fd, value delay) +CAMLprim value unix_tcsendbreak(value fd, value delay) { invalid_argument("tcsendbreak not implemented"); } -value unix_tcdrain(value fd) +CAMLprim value unix_tcdrain(value fd) { invalid_argument("tcdrain not implemented"); } -value unix_tcflush(value fd, value queue) +CAMLprim value unix_tcflush(value fd, value queue) { invalid_argument("tcflush not implemented"); } -value unix_tcflow(value fd, value action) +CAMLprim value unix_tcflow(value fd, value action) { invalid_argument("tcflow not implemented"); } #endif diff --git a/otherlibs/unix/time.c b/otherlibs/unix/time.c index 936b96b69..1d32c22c4 100644 --- a/otherlibs/unix/time.c +++ b/otherlibs/unix/time.c @@ -17,7 +17,7 @@ #include <alloc.h> #include "unixsupport.h" -value unix_time(void) /* ML */ +CAMLprim value unix_time(void) { return copy_double((double) time((time_t *) NULL)); } diff --git a/otherlibs/unix/times.c b/otherlibs/unix/times.c index fc0c4c432..fecc272b5 100644 --- a/otherlibs/unix/times.c +++ b/otherlibs/unix/times.c @@ -28,7 +28,7 @@ #endif #endif -value unix_times(void) /* ML */ +CAMLprim value unix_times(void) { value res; struct tms buffer; diff --git a/otherlibs/unix/truncate.c b/otherlibs/unix/truncate.c index b05f65c84..57d912317 100644 --- a/otherlibs/unix/truncate.c +++ b/otherlibs/unix/truncate.c @@ -17,7 +17,7 @@ #ifdef HAS_TRUNCATE -value unix_truncate(value path, value len) /* ML */ +CAMLprim value unix_truncate(value path, value len) { if (truncate(String_val(path), Long_val(len)) == -1) uerror("truncate", path); @@ -26,7 +26,7 @@ value unix_truncate(value path, value len) /* ML */ #else -value unix_truncate(value path, value len) +CAMLprim value unix_truncate(value path, value len) { invalid_argument("truncate not implemented"); } #endif diff --git a/otherlibs/unix/umask.c b/otherlibs/unix/umask.c index 1833e4c52..9750f7fc5 100644 --- a/otherlibs/unix/umask.c +++ b/otherlibs/unix/umask.c @@ -17,7 +17,7 @@ #include <mlvalues.h> #include "unixsupport.h" -value unix_umask(value perm) /* ML */ +CAMLprim value unix_umask(value perm) { return Val_int(umask(Int_val(perm))); } diff --git a/otherlibs/unix/unlink.c b/otherlibs/unix/unlink.c index 44234181e..ae2116948 100644 --- a/otherlibs/unix/unlink.c +++ b/otherlibs/unix/unlink.c @@ -15,7 +15,7 @@ #include <mlvalues.h> #include "unixsupport.h" -value unix_unlink(value path) /* ML */ +CAMLprim value unix_unlink(value path) { if (unlink(String_val(path)) == -1) uerror("unlink", path); return Val_unit; diff --git a/otherlibs/unix/utimes.c b/otherlibs/unix/utimes.c index 97d8958ff..abd3e3423 100644 --- a/otherlibs/unix/utimes.c +++ b/otherlibs/unix/utimes.c @@ -24,7 +24,7 @@ #include <sys/utime.h> #endif -value unix_utimes(value path, value atime, value mtime) /* ML */ +CAMLprim value unix_utimes(value path, value atime, value mtime) { struct utimbuf times, * t; times.actime = Double_val(atime); @@ -44,7 +44,7 @@ value unix_utimes(value path, value atime, value mtime) /* ML */ #include <sys/types.h> #include <sys/time.h> -value unix_utimes(value path, value atime, value mtime) /* ML */ +CAMLprim value unix_utimes(value path, value atime, value mtime) { struct timeval tv[2], * t; double at = Double_val(atime); @@ -63,7 +63,7 @@ value unix_utimes(value path, value atime, value mtime) /* ML */ #else -value unix_utimes(value path, value atime, value mtime) +CAMLprim value unix_utimes(value path, value atime, value mtime) { invalid_argument("utimes not implemented"); } #endif diff --git a/otherlibs/unix/wait.c b/otherlibs/unix/wait.c index 9e252a780..f8c12d5e4 100644 --- a/otherlibs/unix/wait.c +++ b/otherlibs/unix/wait.c @@ -59,7 +59,7 @@ static value alloc_process_status(int pid, int status) return res; } -value unix_wait(void) /* ML */ +CAMLprim value unix_wait(void) { int pid, status; @@ -80,7 +80,7 @@ static int wait_flag_table[] = { WNOHANG, WUNTRACED }; -value unix_waitpid(value flags, value pid_req) /* ML */ +CAMLprim value unix_waitpid(value flags, value pid_req) { int pid, status; @@ -94,7 +94,7 @@ value unix_waitpid(value flags, value pid_req) /* ML */ #else -value unix_waitpid(value flags, value pid_req) +CAMLprim value unix_waitpid(value flags, value pid_req) { invalid_argument("waitpid not implemented"); } #endif diff --git a/otherlibs/unix/write.c b/otherlibs/unix/write.c index b887f213c..447ceeef7 100644 --- a/otherlibs/unix/write.c +++ b/otherlibs/unix/write.c @@ -26,7 +26,7 @@ #define EWOULDBLOCK (-1) #endif -value unix_write(value fd, value buf, value vofs, value vlen) /* ML */ +CAMLprim value unix_write(value fd, value buf, value vofs, value vlen) { long ofs, len, written; int numbytes, ret; |