1078 lines
24 KiB
C
1078 lines
24 KiB
C
/* This is an Scheme48/C interface file,
|
|
** automatically generated by a hacked version of cig 3.0.
|
|
step 3
|
|
*/
|
|
|
|
#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_scheme_exec(s48_value g1, s48_value g2, s48_value g3)
|
|
{
|
|
extern int scheme_exec(const char *, s48_value , s48_value );
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = scheme_exec(s48_extract_string(g1), g2, g3);
|
|
ret1 = s48_enter_fixnum(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_exit(s48_value g1)
|
|
{
|
|
extern void exit(int );
|
|
|
|
|
|
exit(s48_extract_fixnum(g1));
|
|
return S48_FALSE;
|
|
}
|
|
|
|
s48_value df__exit(s48_value g1)
|
|
{
|
|
extern void _exit(int );
|
|
|
|
|
|
_exit(s48_extract_fixnum(g1));
|
|
return S48_FALSE;
|
|
}
|
|
|
|
s48_value df_fork(s48_value mv_vec)
|
|
{
|
|
extern pid_t fork(void);
|
|
s48_value ret1;
|
|
pid_t r1;
|
|
|
|
|
|
r1 = fork();
|
|
ret1 = errno_or_false(r1);
|
|
S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1));
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_wait_pid(s48_value g1, s48_value g2, s48_value mv_vec)
|
|
{
|
|
extern s48_value wait_pid(int , int , int *, int *);
|
|
s48_value ret1;
|
|
s48_value r1;
|
|
int r2;
|
|
int r3;
|
|
|
|
|
|
r1 = wait_pid(s48_extract_fixnum(g1), s48_extract_fixnum(g2), &r2, &r3);
|
|
ret1 = r1;
|
|
S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r2));
|
|
S48_VECTOR_SET(mv_vec,1,s48_enter_fixnum(r3));
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_chdir(s48_value g1)
|
|
{
|
|
extern int chdir(const char *);
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = chdir(s48_extract_string(g1));
|
|
ret1 = errno_or_false(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_scheme_cwd(s48_value mv_vec)
|
|
{
|
|
extern int scheme_cwd(const char **);
|
|
s48_value ret1;
|
|
int r1;
|
|
const char *r2;
|
|
|
|
|
|
r1 = scheme_cwd(&r2);
|
|
ret1 = False_on_zero(r1);
|
|
SetAlienVal(S48_CAR(S48_VECTOR_REF(mv_vec,0)),(long) r2); S48_SET_CDR(S48_VECTOR_REF(mv_vec,0),strlen_or_false(r2));//str-and-len
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_getgid(void)
|
|
{
|
|
extern gid_t getgid(void);
|
|
s48_value ret1;
|
|
gid_t r1;
|
|
|
|
|
|
r1 = getgid();
|
|
ret1 = s48_enter_fixnum(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_getegid(void)
|
|
{
|
|
extern gid_t getegid(void);
|
|
s48_value ret1;
|
|
gid_t r1;
|
|
|
|
|
|
r1 = getegid();
|
|
ret1 = s48_enter_fixnum(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_setgid(s48_value g1)
|
|
{
|
|
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = setgid(s48_extract_fixnum(g1));
|
|
ret1 = errno_or_false(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_num_supp_groups(s48_value mv_vec)
|
|
{
|
|
extern int num_supp_groups(void);
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = num_supp_groups();
|
|
ret1 = errno_or_false(r1);
|
|
S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1));
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_get_groups(s48_value g1, s48_value mv_vec)
|
|
{
|
|
extern int get_groups(s48_value );
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = get_groups(g1);
|
|
ret1 = errno_or_false(r1);
|
|
S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1));
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_getuid(void)
|
|
{
|
|
extern uid_t getuid(void);
|
|
s48_value ret1;
|
|
uid_t r1;
|
|
|
|
|
|
r1 = getuid();
|
|
ret1 = s48_enter_fixnum(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_geteuid(void)
|
|
{
|
|
extern uid_t geteuid(void);
|
|
s48_value ret1;
|
|
uid_t r1;
|
|
|
|
|
|
r1 = geteuid();
|
|
ret1 = s48_enter_fixnum(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_setuid(s48_value g1)
|
|
{
|
|
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = setuid(s48_extract_fixnum(g1));
|
|
ret1 = errno_or_false(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_my_username(s48_value mv_vec)
|
|
{
|
|
extern char *my_username(void);
|
|
s48_value ret1;
|
|
char *r1;
|
|
|
|
|
|
r1 = my_username();
|
|
ret1 = S48_VECTOR_REF(mv_vec,0);
|
|
SetAlienVal(S48_CAR(ret1),(long) r1); S48_SET_CDR(ret1,strlen_or_false(r1));//str-and-len
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_getpid(void)
|
|
{
|
|
extern pid_t getpid(void);
|
|
s48_value ret1;
|
|
pid_t r1;
|
|
|
|
|
|
r1 = getpid();
|
|
ret1 = s48_enter_fixnum(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_getppid(void)
|
|
{
|
|
extern pid_t getppid(void);
|
|
s48_value ret1;
|
|
pid_t r1;
|
|
|
|
|
|
r1 = getppid();
|
|
ret1 = s48_enter_fixnum(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_getpgrp(void)
|
|
{
|
|
extern pid_t getpgrp(void);
|
|
s48_value ret1;
|
|
pid_t r1;
|
|
|
|
|
|
r1 = getpgrp();
|
|
ret1 = s48_enter_fixnum(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_setpgid(s48_value g1, s48_value g2)
|
|
{
|
|
extern int setpgid(pid_t , pid_t );
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = setpgid(s48_extract_fixnum(g1), s48_extract_fixnum(g2));
|
|
ret1 = errno_or_false(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_setsid(s48_value mv_vec)
|
|
{
|
|
extern pid_t setsid(void);
|
|
s48_value ret1;
|
|
pid_t r1;
|
|
|
|
|
|
r1 = setsid();
|
|
ret1 = errno_or_false(r1);
|
|
S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1));
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_umask(s48_value g1)
|
|
{
|
|
|
|
s48_value ret1;
|
|
mode_t r1;
|
|
|
|
|
|
r1 = umask(s48_extract_fixnum(g1));
|
|
ret1 = s48_enter_fixnum(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_process_times(s48_value mv_vec)
|
|
{
|
|
extern int process_times(int *, int *, int *, int *);
|
|
s48_value ret1;
|
|
int r1;
|
|
int r2;
|
|
int r3;
|
|
int r4;
|
|
int r5;
|
|
|
|
|
|
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));
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_cpu_clock_ticks_per_sec(void)
|
|
{
|
|
extern int cpu_clock_ticks_per_sec(void);
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = cpu_clock_ticks_per_sec();
|
|
ret1 = s48_enter_fixnum(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_chmod(s48_value g1, s48_value g2)
|
|
{
|
|
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = chmod(s48_extract_string(g1), s48_extract_fixnum(g2));
|
|
ret1 = errno_or_false(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_fchmod(s48_value g1, s48_value g2)
|
|
{
|
|
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = fchmod(s48_extract_fixnum(g1), s48_extract_fixnum(g2));
|
|
ret1 = errno_or_false(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_chown(s48_value g1, s48_value g2, s48_value g3)
|
|
{
|
|
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = chown(s48_extract_string(g1), s48_extract_fixnum(g2), s48_extract_fixnum(g3));
|
|
ret1 = errno_or_false(r1);
|
|
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;
|
|
int r1;
|
|
|
|
|
|
r1 = fchown(s48_extract_fixnum(g1), s48_extract_fixnum(g2), s48_extract_fixnum(g3));
|
|
ret1 = errno_or_false(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_access(s48_value g1, s48_value g2)
|
|
{
|
|
extern int access(const char *, int );
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = access(s48_extract_string(g1), s48_extract_fixnum(g2));
|
|
ret1 = ENTER_BOOLEAN(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_link(s48_value g1, s48_value g2)
|
|
{
|
|
extern int link(const char *, const char *);
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = link(s48_extract_string(g1), s48_extract_string(g2));
|
|
ret1 = errno_or_false(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_mkfifo(s48_value g1, s48_value g2)
|
|
{
|
|
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = mkfifo(s48_extract_string(g1), s48_extract_fixnum(g2));
|
|
ret1 = errno_or_false(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_mkdir(s48_value g1, s48_value g2)
|
|
{
|
|
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = mkdir(s48_extract_string(g1), s48_extract_fixnum(g2));
|
|
ret1 = errno_or_false(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_scm_readlink(s48_value g1, s48_value mv_vec)
|
|
{
|
|
extern const char *scm_readlink(const char *);
|
|
s48_value ret1;
|
|
const char *r1;
|
|
|
|
|
|
r1 = scm_readlink(s48_extract_string(g1));
|
|
ret1 = errno_on_zero_or_false(r1);
|
|
SetAlienVal(S48_CAR(S48_VECTOR_REF(mv_vec,0)),(long) r1); S48_SET_CDR(S48_VECTOR_REF(mv_vec,0),strlen_or_false(r1));//str-and-len
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_rename(s48_value g1, s48_value g2)
|
|
{
|
|
extern int rename(const char *, const char *);
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = rename(s48_extract_string(g1), s48_extract_string(g2));
|
|
ret1 = errno_or_false(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_rmdir(s48_value g1)
|
|
{
|
|
extern int rmdir(const char *);
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = rmdir(s48_extract_string(g1));
|
|
ret1 = errno_or_false(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_scm_utime(s48_value g1, s48_value g2, s48_value g3, s48_value g4, s48_value g5)
|
|
{
|
|
extern int scm_utime(const char *, int , int , int , int );
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = scm_utime(s48_extract_string(g1), s48_extract_fixnum(g2), s48_extract_fixnum(g3), s48_extract_fixnum(g4), s48_extract_fixnum(g5));
|
|
ret1 = errno_or_false(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_scm_utime_now(s48_value g1)
|
|
{
|
|
extern int scm_utime_now(const char *);
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = scm_utime_now(s48_extract_string(g1));
|
|
ret1 = errno_or_false(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_scheme_stat(s48_value g1, s48_value g2, s48_value g3)
|
|
{
|
|
extern int scheme_stat(const char *, s48_value , int );
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = scheme_stat(s48_extract_string(g1), g2, EXTRACT_BOOLEAN(g3));
|
|
ret1 = False_on_zero(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_scheme_fstat(s48_value g1, s48_value g2)
|
|
{
|
|
extern int scheme_fstat(int , s48_value );
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = scheme_fstat(s48_extract_fixnum(g1), g2);
|
|
ret1 = False_on_zero(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_symlink(s48_value g1, s48_value g2)
|
|
{
|
|
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = symlink(s48_extract_string(g1), s48_extract_string(g2));
|
|
ret1 = errno_or_false(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_truncate(s48_value g1, s48_value g2)
|
|
{
|
|
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = truncate(s48_extract_string(g1), s48_extract_fixnum(g2));
|
|
ret1 = errno_or_false(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_ftruncate(s48_value g1, s48_value g2)
|
|
{
|
|
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = ftruncate(s48_extract_fixnum(g1), s48_extract_fixnum(g2));
|
|
ret1 = errno_or_false(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_unlink(s48_value g1)
|
|
{
|
|
extern int unlink(const char *);
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = unlink(s48_extract_string(g1));
|
|
ret1 = errno_or_false(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_fsync(s48_value g1)
|
|
{
|
|
extern int fsync(int );
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = fsync(s48_extract_fixnum(g1));
|
|
ret1 = errno_or_false(r1);
|
|
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;
|
|
int r1;
|
|
|
|
|
|
r1 = close(s48_extract_fixnum(g1));
|
|
ret1 = errno_or_false(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_dup(s48_value g1, s48_value mv_vec)
|
|
{
|
|
extern int dup(int );
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = dup(s48_extract_fixnum(g1));
|
|
ret1 = errno_or_false(r1);
|
|
S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1));
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_dup2(s48_value g1, s48_value g2, s48_value mv_vec)
|
|
{
|
|
extern int dup2(int , int );
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
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));
|
|
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;
|
|
off_t r1;
|
|
|
|
|
|
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));
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_char_ready_fdes(s48_value g1)
|
|
{
|
|
extern s48_value char_ready_fdes(int );
|
|
s48_value ret1;
|
|
s48_value r1;
|
|
|
|
|
|
r1 = char_ready_fdes(s48_extract_fixnum(g1));
|
|
ret1 = r1;
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_open(s48_value g1, s48_value g2, s48_value g3, s48_value mv_vec)
|
|
{
|
|
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
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));
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_scheme_pipe(s48_value mv_vec)
|
|
{
|
|
extern int scheme_pipe(int *, int *);
|
|
s48_value ret1;
|
|
int r1;
|
|
int r2;
|
|
int r3;
|
|
|
|
|
|
r1 = scheme_pipe(&r2, &r3);
|
|
ret1 = False_on_zero(r1);
|
|
S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r2));
|
|
S48_VECTOR_SET(mv_vec,1,s48_enter_fixnum(r3));
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_read_fdes_char(s48_value g1)
|
|
{
|
|
extern s48_value read_fdes_char(int );
|
|
s48_value ret1;
|
|
s48_value r1;
|
|
|
|
|
|
r1 = read_fdes_char(s48_extract_fixnum(g1));
|
|
ret1 = r1;
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_write_fdes_char(s48_value g1, s48_value g2)
|
|
{
|
|
extern int write_fdes_char(char , int );
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = write_fdes_char(s48_extract_char(g1), s48_extract_fixnum(g2));
|
|
ret1 = errno_or_false(r1);
|
|
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 int read_fdes_substring(s48_value , int , int , int );
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
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));
|
|
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 int write_fdes_substring(s48_value , int , int , int );
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
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));
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_kill(s48_value g1, s48_value g2)
|
|
{
|
|
extern int kill(pid_t , int );
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = kill(s48_extract_fixnum(g1), s48_extract_fixnum(g2));
|
|
ret1 = errno_or_false(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_pause(void)
|
|
{
|
|
|
|
|
|
|
|
pause();
|
|
return S48_FALSE;
|
|
}
|
|
|
|
s48_value df_alarm(s48_value g1)
|
|
{
|
|
extern unsigned int alarm(unsigned int );
|
|
s48_value ret1;
|
|
unsigned int r1;
|
|
|
|
|
|
r1 = alarm(s48_extract_fixnum(g1));
|
|
ret1 = s48_enter_fixnum(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_user_info_uid(s48_value g1, s48_value mv_vec)
|
|
{
|
|
extern int user_info_uid(uid_t , char **, gid_t *, char **, char **);
|
|
s48_value ret1;
|
|
int r1;
|
|
char *r2;
|
|
gid_t r3;
|
|
char *r4;
|
|
char *r5;
|
|
|
|
|
|
r1 = user_info_uid(s48_extract_fixnum(g1), &r2, &r3, &r4, &r5);
|
|
ret1 = ENTER_BOOLEAN(r1);
|
|
SetAlienVal(S48_CAR(S48_VECTOR_REF(mv_vec,0)),(long) r2); S48_SET_CDR(S48_VECTOR_REF(mv_vec,0),strlen_or_false(r2));//str-and-len
|
|
S48_VECTOR_SET(mv_vec,1,s48_enter_fixnum(r3));
|
|
SetAlienVal(S48_CAR(S48_VECTOR_REF(mv_vec,2)),(long) r4); S48_SET_CDR(S48_VECTOR_REF(mv_vec,2),strlen_or_false(r4));//str-and-len
|
|
SetAlienVal(S48_CAR(S48_VECTOR_REF(mv_vec,3)),(long) r5); S48_SET_CDR(S48_VECTOR_REF(mv_vec,3),strlen_or_false(r5));//str-and-len
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_user_info_name(s48_value g1, s48_value mv_vec)
|
|
{
|
|
extern int user_info_name(const char *, uid_t *, gid_t *, char **, char **);
|
|
s48_value ret1;
|
|
int r1;
|
|
uid_t r2;
|
|
gid_t r3;
|
|
char *r4;
|
|
char *r5;
|
|
|
|
|
|
r1 = user_info_name(s48_extract_string(g1), &r2, &r3, &r4, &r5);
|
|
ret1 = ENTER_BOOLEAN(r1);
|
|
S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r2));
|
|
S48_VECTOR_SET(mv_vec,1,s48_enter_fixnum(r3));
|
|
SetAlienVal(S48_CAR(S48_VECTOR_REF(mv_vec,2)),(long) r4); S48_SET_CDR(S48_VECTOR_REF(mv_vec,2),strlen_or_false(r4));//str-and-len
|
|
SetAlienVal(S48_CAR(S48_VECTOR_REF(mv_vec,3)),(long) r5); S48_SET_CDR(S48_VECTOR_REF(mv_vec,3),strlen_or_false(r5));//str-and-len
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_group_info_gid(s48_value g1, s48_value mv_vec)
|
|
{
|
|
extern int group_info_gid(int , char **, char** *, int *);
|
|
s48_value ret1;
|
|
int r1;
|
|
char *r2;
|
|
char** r3;
|
|
int r4;
|
|
|
|
|
|
r1 = group_info_gid(s48_extract_fixnum(g1), &r2, &r3, &r4);
|
|
ret1 = ENTER_BOOLEAN(r1);
|
|
SetAlienVal(S48_CAR(S48_VECTOR_REF(mv_vec,0)),(long) r2); S48_SET_CDR(S48_VECTOR_REF(mv_vec,0),strlen_or_false(r2));//str-and-len
|
|
SetAlienVal(S48_VECTOR_REF(mv_vec,1),(long) r3);//simple-assign
|
|
S48_VECTOR_SET(mv_vec,2,s48_enter_fixnum(r4));
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_group_info_name(s48_value g1, s48_value mv_vec)
|
|
{
|
|
extern int group_info_name(const char *, int *, char** *, int *);
|
|
s48_value ret1;
|
|
int r1;
|
|
int r2;
|
|
char** r3;
|
|
int r4;
|
|
|
|
|
|
r1 = group_info_name(s48_extract_string(g1), &r2, &r3, &r4);
|
|
ret1 = ENTER_BOOLEAN(r1);
|
|
S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r2));
|
|
SetAlienVal(S48_VECTOR_REF(mv_vec,1),(long) r3);//simple-assign
|
|
S48_VECTOR_SET(mv_vec,2,s48_enter_fixnum(r4));
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_open_dir(s48_value g1, s48_value mv_vec)
|
|
{
|
|
extern int open_dir(const char *, char** *, int *);
|
|
s48_value ret1;
|
|
int r1;
|
|
char** r2;
|
|
int r3;
|
|
|
|
|
|
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));
|
|
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(s48_value mv_vec)
|
|
{
|
|
extern char** scm_envvec(int *);
|
|
s48_value ret1;
|
|
char** r1;
|
|
int r2;
|
|
|
|
|
|
r1 = scm_envvec(&r2);
|
|
ret1 = S48_VECTOR_REF(mv_vec,0);
|
|
SetAlienVal(ret1,(long) r1);//simple-assign
|
|
S48_VECTOR_SET(mv_vec,1,s48_enter_fixnum(r2));
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_install_env(s48_value g1)
|
|
{
|
|
extern int install_env(s48_value );
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = install_env(g1);
|
|
ret1 = errno_or_false(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_getenv(s48_value g1, s48_value mv_vec)
|
|
{
|
|
extern char *getenv(const char *);
|
|
s48_value ret1;
|
|
char *r1;
|
|
|
|
|
|
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
|
|
return ret1;
|
|
}
|
|
|
|
#define errno_on_nonzero_or_false(x) ((x) ? s48_enter_fixnum(errno) : S48_FALSE)
|
|
|
|
s48_value df_putenv(s48_value g1)
|
|
{
|
|
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = putenv(scheme2c_strcpy(g1));
|
|
ret1 = errno_on_nonzero_or_false(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_delete_env(s48_value g1)
|
|
{
|
|
extern void delete_env(const char *);
|
|
|
|
|
|
delete_env(s48_extract_string(g1));
|
|
return S48_FALSE;
|
|
}
|
|
|
|
s48_value df_set_cloexec(s48_value g1, s48_value g2)
|
|
{
|
|
extern int set_cloexec(int , int );
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = set_cloexec(s48_extract_fixnum(g1), EXTRACT_BOOLEAN(g2));
|
|
ret1 = errno_or_false(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_fcntl_read(s48_value g1, s48_value g2, s48_value mv_vec)
|
|
{
|
|
extern int fcntl_read(int , int );
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = fcntl_read(s48_extract_fixnum(g1), s48_extract_fixnum(g2));
|
|
ret1 = errno_or_false(r1);
|
|
S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1));
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_fcntl_write(s48_value g1, s48_value g2, s48_value g3)
|
|
{
|
|
extern int fcntl_write(int , int , int );
|
|
s48_value ret1;
|
|
int r1;
|
|
|
|
|
|
r1 = fcntl_write(s48_extract_fixnum(g1), s48_extract_fixnum(g2), s48_extract_fixnum(g3));
|
|
ret1 = errno_or_false(r1);
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_sleep_until(s48_value g1, s48_value g2)
|
|
{
|
|
extern s48_value sleep_until(int , int );
|
|
s48_value ret1;
|
|
s48_value r1;
|
|
|
|
|
|
r1 = sleep_until(s48_extract_fixnum(g1), s48_extract_fixnum(g2));
|
|
ret1 = r1;
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_scm_gethostname(s48_value mv_vec)
|
|
{
|
|
extern char *scm_gethostname(void);
|
|
s48_value ret1;
|
|
char *r1;
|
|
|
|
|
|
r1 = scm_gethostname();
|
|
ret1 = S48_VECTOR_REF(mv_vec,0);
|
|
SetAlienVal(S48_CAR(ret1),(long) r1); S48_SET_CDR(ret1,strlen_or_false(r1));//str-and-len
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_errno_msg(s48_value g1, s48_value mv_vec)
|
|
{
|
|
extern char *errno_msg(int );
|
|
s48_value ret1;
|
|
char *r1;
|
|
|
|
|
|
r1 = errno_msg(s48_extract_fixnum(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
|
|
return ret1;
|
|
}
|
|
|
|
s48_value s48_init_syscalls(void)
|
|
{
|
|
S48_EXPORT_FUNCTION(df_scheme_exec);
|
|
S48_EXPORT_FUNCTION(df_exit);
|
|
S48_EXPORT_FUNCTION(df__exit);
|
|
S48_EXPORT_FUNCTION(df_fork);
|
|
S48_EXPORT_FUNCTION(df_wait_pid);
|
|
S48_EXPORT_FUNCTION(df_chdir);
|
|
S48_EXPORT_FUNCTION(df_scheme_cwd);
|
|
S48_EXPORT_FUNCTION(df_getgid);
|
|
S48_EXPORT_FUNCTION(df_getegid);
|
|
S48_EXPORT_FUNCTION(df_setgid);
|
|
S48_EXPORT_FUNCTION(df_num_supp_groups);
|
|
S48_EXPORT_FUNCTION(df_get_groups);
|
|
S48_EXPORT_FUNCTION(df_getuid);
|
|
S48_EXPORT_FUNCTION(df_geteuid);
|
|
S48_EXPORT_FUNCTION(df_setuid);
|
|
S48_EXPORT_FUNCTION(df_my_username);
|
|
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(df_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(df_scheme_stat);
|
|
S48_EXPORT_FUNCTION(df_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(df_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(df_kill);
|
|
S48_EXPORT_FUNCTION(df_pause);
|
|
S48_EXPORT_FUNCTION(df_alarm);
|
|
S48_EXPORT_FUNCTION(df_user_info_uid);
|
|
S48_EXPORT_FUNCTION(df_user_info_name);
|
|
S48_EXPORT_FUNCTION(df_group_info_gid);
|
|
S48_EXPORT_FUNCTION(df_group_info_name);
|
|
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_getenv);
|
|
S48_EXPORT_FUNCTION(df_putenv);
|
|
S48_EXPORT_FUNCTION(df_delete_env);
|
|
S48_EXPORT_FUNCTION(df_set_cloexec);
|
|
S48_EXPORT_FUNCTION(df_fcntl_read);
|
|
S48_EXPORT_FUNCTION(df_fcntl_write);
|
|
S48_EXPORT_FUNCTION(df_sleep_until);
|
|
S48_EXPORT_FUNCTION(df_scm_gethostname);
|
|
S48_EXPORT_FUNCTION(df_errno_msg);
|
|
|
|
return S48_UNSPECIFIC;
|
|
}
|