894 lines
20 KiB
C
894 lines
20 KiB
C
/* This is an Scheme48/C interface file,
|
|
** automatically generated by a hacked version of cig 3.0.
|
|
step 4
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h> /* For malloc. */
|
|
#include "libcig.h"
|
|
|
|
#include <sys/signal.h>
|
|
#include <sys/types.h>
|
|
#include <sys/times.h>
|
|
#include <sys/time.h>
|
|
#include <fcntl.h> /* for O_RDWR */
|
|
#include <sys/stat.h>
|
|
#include <netdb.h>
|
|
#include <pwd.h>
|
|
#include <unistd.h>
|
|
|
|
/* Make sure foreign-function stubs interface to the C funs correctly: */
|
|
#include "dirstuff1.h"
|
|
#include "select1.h"
|
|
#include "syscalls1.h"
|
|
#include "userinfo1.h"
|
|
|
|
extern int errno;
|
|
|
|
#define errno_on_zero_or_false(x) ((x) ? S48_FALSE : s48_enter_fixnum(errno))
|
|
#define errno_or_false(x) (((x) == -1) ? s48_enter_fixnum(errno) : S48_FALSE)
|
|
#define False_on_zero(x) ((x) ? s48_enter_fixnum(x) : S48_FALSE)
|
|
|
|
s48_value df_getpid(void)
|
|
{
|
|
extern pid_t getpid(void);
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
pid_t r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = getpid();
|
|
ret1 = s48_enter_fixnum(r1);
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_getppid(void)
|
|
{
|
|
extern pid_t getppid(void);
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
pid_t r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = getppid();
|
|
ret1 = s48_enter_fixnum(r1);
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_getpgrp(void)
|
|
{
|
|
extern pid_t getpgrp(void);
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
pid_t r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = getpgrp();
|
|
ret1 = s48_enter_fixnum(r1);
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_setpgid(s48_value g1, s48_value g2)
|
|
{
|
|
extern int setpgid(pid_t , pid_t );
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
int r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = setpgid(s48_extract_fixnum(g1), s48_extract_fixnum(g2));
|
|
ret1 = errno_or_false(r1);
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_setsid(s48_value mv_vec)
|
|
{
|
|
extern pid_t setsid(void);
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(2);
|
|
pid_t r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_2(mv_vec,ret1);
|
|
r1 = setsid();
|
|
ret1 = errno_or_false(r1);
|
|
S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1));
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_umask(s48_value g1)
|
|
{
|
|
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
mode_t r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = umask(s48_extract_fixnum(g1));
|
|
ret1 = s48_enter_fixnum(r1);
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_process_times(s48_value mv_vec)
|
|
{
|
|
extern int process_times(clock_t *, clock_t *, clock_t *, clock_t *);
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(2);
|
|
int r1;
|
|
clock_t r2 = 0;
|
|
clock_t r3 = 0;
|
|
clock_t r4 = 0;
|
|
clock_t r5 = 0;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_2(mv_vec,ret1);
|
|
r1 = process_times(&r2, &r3, &r4, &r5);
|
|
ret1 = errno_or_false(r1);
|
|
S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r2));
|
|
S48_VECTOR_SET(mv_vec,1,s48_enter_fixnum(r3));
|
|
S48_VECTOR_SET(mv_vec,2,s48_enter_fixnum(r4));
|
|
S48_VECTOR_SET(mv_vec,3,s48_enter_fixnum(r5));
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_cpu_clock_ticks_per_sec(void)
|
|
{
|
|
extern int cpu_clock_ticks_per_sec(void);
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
int r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = cpu_clock_ticks_per_sec();
|
|
ret1 = s48_enter_integer(r1);
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_chmod(s48_value g1, s48_value g2)
|
|
{
|
|
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
int r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = chmod(s48_extract_string(g1), s48_extract_fixnum(g2));
|
|
ret1 = errno_or_false(r1);
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_fchmod(s48_value g1, s48_value g2)
|
|
{
|
|
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
int r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = fchmod(s48_extract_fixnum(g1), s48_extract_fixnum(g2));
|
|
ret1 = errno_or_false(r1);
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_chown(s48_value g1, s48_value g2, s48_value g3)
|
|
{
|
|
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
int r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = chown(s48_extract_string(g1), s48_extract_fixnum(g2), s48_extract_fixnum(g3));
|
|
ret1 = errno_or_false(r1);
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_fchown(s48_value g1, s48_value g2, s48_value g3)
|
|
{
|
|
extern int fchown(int , uid_t , gid_t );
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
int r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = fchown(s48_extract_fixnum(g1), s48_extract_fixnum(g2), s48_extract_fixnum(g3));
|
|
ret1 = errno_or_false(r1);
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_access(s48_value g1, s48_value g2)
|
|
{
|
|
extern int access(const char *, int );
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
int r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = access(s48_extract_string(g1), s48_extract_integer(g2));
|
|
ret1 = ENTER_BOOLEAN(r1);
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_link(s48_value g1, s48_value g2)
|
|
{
|
|
extern int link(const char *, const char *);
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
int r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = link(s48_extract_string(g1), s48_extract_string(g2));
|
|
ret1 = errno_or_false(r1);
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_mkfifo(s48_value g1, s48_value g2)
|
|
{
|
|
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
int r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = mkfifo(s48_extract_string(g1), s48_extract_fixnum(g2));
|
|
ret1 = errno_or_false(r1);
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_mkdir(s48_value g1, s48_value g2)
|
|
{
|
|
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
int r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = mkdir(s48_extract_string(g1), s48_extract_fixnum(g2));
|
|
ret1 = errno_or_false(r1);
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_rename(s48_value g1, s48_value g2)
|
|
{
|
|
extern int rename(const char *, const char *);
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
int r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = rename(s48_extract_string(g1), s48_extract_string(g2));
|
|
ret1 = errno_or_false(r1);
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_rmdir(s48_value g1)
|
|
{
|
|
extern int rmdir(const char *);
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
int r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = rmdir(s48_extract_string(g1));
|
|
ret1 = errno_or_false(r1);
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_scm_utime(s48_value g1, s48_value g2, s48_value g3)
|
|
{
|
|
extern int scm_utime(const char *, time_t , time_t );
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
int r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = scm_utime(s48_extract_string(g1), s48_extract_integer(g2), s48_extract_integer(g3));
|
|
ret1 = errno_or_false(r1);
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_scm_utime_now(s48_value g1)
|
|
{
|
|
extern int scm_utime_now(const char *);
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
int r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = scm_utime_now(s48_extract_string(g1));
|
|
ret1 = errno_or_false(r1);
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_symlink(s48_value g1, s48_value g2)
|
|
{
|
|
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
int r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = symlink(s48_extract_string(g1), s48_extract_string(g2));
|
|
ret1 = errno_or_false(r1);
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_truncate(s48_value g1, s48_value g2)
|
|
{
|
|
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
int r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = truncate(s48_extract_string(g1), s48_extract_fixnum(g2));
|
|
ret1 = errno_or_false(r1);
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_ftruncate(s48_value g1, s48_value g2)
|
|
{
|
|
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
int r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = ftruncate(s48_extract_fixnum(g1), s48_extract_fixnum(g2));
|
|
ret1 = errno_or_false(r1);
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_unlink(s48_value g1)
|
|
{
|
|
extern int unlink(const char *);
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
int r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = unlink(s48_extract_string(g1));
|
|
ret1 = errno_or_false(r1);
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_fsync(s48_value g1)
|
|
{
|
|
extern int fsync(int );
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
int r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = fsync(s48_extract_fixnum(g1));
|
|
ret1 = errno_or_false(r1);
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_sync(void)
|
|
{
|
|
|
|
|
|
|
|
sync();
|
|
return S48_FALSE;
|
|
}
|
|
|
|
s48_value df_close(s48_value g1)
|
|
{
|
|
extern int close(int );
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
int r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = close(s48_extract_fixnum(g1));
|
|
ret1 = errno_or_false(r1);
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_dup(s48_value g1, s48_value mv_vec)
|
|
{
|
|
extern int dup(int );
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(2);
|
|
int r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_2(mv_vec,ret1);
|
|
r1 = dup(s48_extract_fixnum(g1));
|
|
ret1 = errno_or_false(r1);
|
|
S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1));
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_dup2(s48_value g1, s48_value g2, s48_value mv_vec)
|
|
{
|
|
extern int dup2(int , int );
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(2);
|
|
int r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_2(mv_vec,ret1);
|
|
r1 = dup2(s48_extract_fixnum(g1), s48_extract_fixnum(g2));
|
|
ret1 = errno_or_false(r1);
|
|
S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1));
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_lseek(s48_value g1, s48_value g2, s48_value g3, s48_value mv_vec)
|
|
{
|
|
extern off_t lseek(int , off_t , int );
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(2);
|
|
off_t r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_2(mv_vec,ret1);
|
|
r1 = lseek(s48_extract_fixnum(g1), s48_extract_fixnum(g2), s48_extract_fixnum(g3));
|
|
ret1 = errno_or_false(r1);
|
|
S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1));
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_char_ready_fdes(s48_value g1)
|
|
{
|
|
extern s48_value char_ready_fdes(int );
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
s48_value r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = char_ready_fdes(s48_extract_fixnum(g1));
|
|
ret1 = r1;
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_open(s48_value g1, s48_value g2, s48_value g3, s48_value mv_vec)
|
|
{
|
|
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(2);
|
|
int r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_2(mv_vec,ret1);
|
|
r1 = open(s48_extract_string(g1), s48_extract_fixnum(g2), s48_extract_fixnum(g3));
|
|
ret1 = errno_or_false(r1);
|
|
S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1));
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_read_fdes_char(s48_value g1)
|
|
{
|
|
extern s48_value read_fdes_char(int );
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
s48_value r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = read_fdes_char(s48_extract_fixnum(g1));
|
|
ret1 = r1;
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_write_fdes_char(s48_value g1, s48_value g2)
|
|
{
|
|
extern int write_fdes_char(char , int );
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
int r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = write_fdes_char(s48_extract_char(g1), s48_extract_fixnum(g2));
|
|
ret1 = errno_or_false(r1);
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_read_fdes_substring(s48_value g1, s48_value g2, s48_value g3, s48_value g4, s48_value mv_vec)
|
|
{
|
|
extern ssize_t read_fdes_substring(s48_value , size_t , size_t , int );
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(2);
|
|
ssize_t r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_2(mv_vec,ret1);
|
|
r1 = read_fdes_substring(g1, s48_extract_fixnum(g2), s48_extract_fixnum(g3), s48_extract_fixnum(g4));
|
|
ret1 = errno_or_false(r1);
|
|
S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1));
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_write_fdes_substring(s48_value g1, s48_value g2, s48_value g3, s48_value g4, s48_value mv_vec)
|
|
{
|
|
extern ssize_t write_fdes_substring(s48_value , size_t , size_t , int );
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(2);
|
|
ssize_t r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_2(mv_vec,ret1);
|
|
r1 = write_fdes_substring(g1, s48_extract_fixnum(g2), s48_extract_fixnum(g3), s48_extract_fixnum(g4));
|
|
ret1 = errno_or_false(r1);
|
|
S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1));
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_pause(void)
|
|
{
|
|
|
|
|
|
|
|
pause();
|
|
return S48_FALSE;
|
|
}
|
|
|
|
s48_value df_open_dir(s48_value g1, s48_value mv_vec)
|
|
{
|
|
extern int open_dir(const char *, char** *, int *);
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(2);
|
|
int r1;
|
|
char** r2 = 0;
|
|
int r3 = 0;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_2(mv_vec,ret1);
|
|
r1 = open_dir(s48_extract_string(g1), &r2, &r3);
|
|
ret1 = False_on_zero(r1);
|
|
SetAlienVal(S48_VECTOR_REF(mv_vec,0),(long) r2);//simple-assign
|
|
S48_VECTOR_SET(mv_vec,1,s48_enter_fixnum(r3));
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_scm_sort_filevec(s48_value g1, s48_value g2)
|
|
{
|
|
extern void scm_sort_filevec(const char** , int );
|
|
|
|
|
|
scm_sort_filevec((const char** )AlienVal(g1), s48_extract_fixnum(g2));
|
|
return S48_FALSE;
|
|
}
|
|
|
|
s48_value df_scm_envvec(void)
|
|
{
|
|
extern s48_value scm_envvec(void);
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
s48_value r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = scm_envvec();
|
|
ret1 = r1;
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_install_env(s48_value g1)
|
|
{
|
|
extern int install_env(s48_value );
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
int r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = install_env(g1);
|
|
ret1 = errno_or_false(r1);
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_create_env(s48_value g1, s48_value mv_vec)
|
|
{
|
|
extern int create_env(s48_value , s48_value *);
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(2);
|
|
int r1;
|
|
s48_value r2 = 0;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_2(mv_vec,ret1);
|
|
r1 = create_env(g1, &r2);
|
|
ret1 = errno_or_false(r1);
|
|
S48_VECTOR_SET(mv_vec,0,r2);
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_align_env(s48_value g1)
|
|
{
|
|
extern void align_env(s48_value );
|
|
|
|
|
|
align_env(g1);
|
|
return S48_FALSE;
|
|
}
|
|
|
|
s48_value df_free_envvec(s48_value g1)
|
|
{
|
|
extern s48_value free_envvec(s48_value );
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
s48_value r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = free_envvec(g1);
|
|
ret1 = r1;
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_envvec_setenv(s48_value g1, s48_value g2)
|
|
{
|
|
extern s48_value envvec_setenv(s48_value , s48_value );
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
s48_value r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = envvec_setenv(g1, g2);
|
|
ret1 = r1;
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_getenv(s48_value g1, s48_value mv_vec)
|
|
{
|
|
extern char *getenv(const char *);
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(2);
|
|
char *r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_2(mv_vec,ret1);
|
|
r1 = getenv(s48_extract_string(g1));
|
|
ret1 = S48_VECTOR_REF(mv_vec,0);
|
|
SetAlienVal(S48_CAR(ret1),(long) r1); S48_SET_CDR(ret1,strlen_or_false(r1));//str-and-len
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
#define errno_on_nonzero_or_false(x) ((x) ? s48_enter_fixnum(errno) : S48_FALSE)
|
|
|
|
s48_value df_delete_env(s48_value g1)
|
|
{
|
|
extern s48_value delete_env(s48_value );
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
s48_value r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = delete_env(g1);
|
|
ret1 = r1;
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_sleep_until(s48_value g1)
|
|
{
|
|
extern s48_value sleep_until(time_t );
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
s48_value r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = sleep_until(s48_extract_integer(g1));
|
|
ret1 = r1;
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_errno_msg(s48_value g1, s48_value mv_vec)
|
|
{
|
|
extern char *errno_msg(int );
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(2);
|
|
char *r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_2(mv_vec,ret1);
|
|
r1 = errno_msg(s48_extract_integer(g1));
|
|
ret1 = S48_VECTOR_REF(mv_vec,0);
|
|
SetAlienVal(S48_CAR(ret1),(long) r1); S48_SET_CDR(ret1,strlen_or_false(r1));//str-and-len
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
void s48_init_syscalls(void)
|
|
{
|
|
S48_EXPORT_FUNCTION(scheme_exec);
|
|
S48_EXPORT_FUNCTION(scsh_exit);
|
|
S48_EXPORT_FUNCTION(scsh__exit);
|
|
S48_EXPORT_FUNCTION(scsh_fork);
|
|
S48_EXPORT_FUNCTION(wait_pid);
|
|
S48_EXPORT_FUNCTION(scsh_chdir);
|
|
S48_EXPORT_FUNCTION(scheme_cwd);
|
|
S48_EXPORT_FUNCTION(scsh_getgid);
|
|
S48_EXPORT_FUNCTION(scsh_getegid);
|
|
S48_EXPORT_FUNCTION(scsh_setgid);
|
|
S48_EXPORT_FUNCTION(scsh_setegid);
|
|
S48_EXPORT_FUNCTION(get_groups);
|
|
S48_EXPORT_FUNCTION(scsh_getuid);
|
|
S48_EXPORT_FUNCTION(scsh_geteuid);
|
|
S48_EXPORT_FUNCTION(scsh_setuid);
|
|
S48_EXPORT_FUNCTION(scsh_seteuid);
|
|
S48_EXPORT_FUNCTION(df_getpid);
|
|
S48_EXPORT_FUNCTION(df_getppid);
|
|
S48_EXPORT_FUNCTION(df_getpgrp);
|
|
S48_EXPORT_FUNCTION(df_setpgid);
|
|
S48_EXPORT_FUNCTION(df_setsid);
|
|
S48_EXPORT_FUNCTION(df_umask);
|
|
S48_EXPORT_FUNCTION(df_process_times);
|
|
S48_EXPORT_FUNCTION(df_cpu_clock_ticks_per_sec);
|
|
S48_EXPORT_FUNCTION(df_chmod);
|
|
S48_EXPORT_FUNCTION(df_fchmod);
|
|
S48_EXPORT_FUNCTION(df_chown);
|
|
S48_EXPORT_FUNCTION(df_fchown);
|
|
S48_EXPORT_FUNCTION(df_access);
|
|
S48_EXPORT_FUNCTION(df_link);
|
|
S48_EXPORT_FUNCTION(df_mkfifo);
|
|
S48_EXPORT_FUNCTION(df_mkdir);
|
|
S48_EXPORT_FUNCTION(scm_readlink);
|
|
S48_EXPORT_FUNCTION(df_rename);
|
|
S48_EXPORT_FUNCTION(df_rmdir);
|
|
S48_EXPORT_FUNCTION(df_scm_utime);
|
|
S48_EXPORT_FUNCTION(df_scm_utime_now);
|
|
S48_EXPORT_FUNCTION(scheme_stat);
|
|
S48_EXPORT_FUNCTION(scheme_fstat);
|
|
S48_EXPORT_FUNCTION(df_symlink);
|
|
S48_EXPORT_FUNCTION(df_truncate);
|
|
S48_EXPORT_FUNCTION(df_ftruncate);
|
|
S48_EXPORT_FUNCTION(df_unlink);
|
|
S48_EXPORT_FUNCTION(df_fsync);
|
|
S48_EXPORT_FUNCTION(df_sync);
|
|
S48_EXPORT_FUNCTION(df_close);
|
|
S48_EXPORT_FUNCTION(df_dup);
|
|
S48_EXPORT_FUNCTION(df_dup2);
|
|
S48_EXPORT_FUNCTION(df_lseek);
|
|
S48_EXPORT_FUNCTION(df_char_ready_fdes);
|
|
S48_EXPORT_FUNCTION(df_open);
|
|
S48_EXPORT_FUNCTION(scheme_pipe);
|
|
S48_EXPORT_FUNCTION(df_read_fdes_char);
|
|
S48_EXPORT_FUNCTION(df_write_fdes_char);
|
|
S48_EXPORT_FUNCTION(df_read_fdes_substring);
|
|
S48_EXPORT_FUNCTION(df_write_fdes_substring);
|
|
S48_EXPORT_FUNCTION(scsh_kill);
|
|
S48_EXPORT_FUNCTION(df_pause);
|
|
S48_EXPORT_FUNCTION(df_open_dir);
|
|
S48_EXPORT_FUNCTION(df_scm_sort_filevec);
|
|
S48_EXPORT_FUNCTION(df_scm_envvec);
|
|
S48_EXPORT_FUNCTION(df_install_env);
|
|
S48_EXPORT_FUNCTION(df_create_env);
|
|
S48_EXPORT_FUNCTION(df_align_env);
|
|
S48_EXPORT_FUNCTION(df_free_envvec);
|
|
S48_EXPORT_FUNCTION(df_envvec_setenv);
|
|
S48_EXPORT_FUNCTION(df_getenv);
|
|
S48_EXPORT_FUNCTION(df_delete_env);
|
|
S48_EXPORT_FUNCTION(set_cloexec);
|
|
S48_EXPORT_FUNCTION(fcntl_read);
|
|
S48_EXPORT_FUNCTION(fcntl_write);
|
|
S48_EXPORT_FUNCTION(df_sleep_until);
|
|
S48_EXPORT_FUNCTION(scm_gethostname);
|
|
S48_EXPORT_FUNCTION(df_errno_msg);
|
|
S48_EXPORT_FUNCTION(scm_crypt);
|
|
S48_EXPORT_FUNCTION(scm_openlog);
|
|
S48_EXPORT_FUNCTION(scm_syslog);
|
|
S48_EXPORT_FUNCTION(scm_closelog);
|
|
}
|