1 /* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2, or (at your option)
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this software; see the file COPYING. If not, write to
15 * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
16 * Boston, MA 02111-1307 USA
18 * As a special exception, the Free Software Foundation gives permission
19 * for additional uses of the text contained in its release of GUILE.
21 * The exception is that, if you link the GUILE library with other files
22 * to produce an executable, this does not by itself cause the
23 * resulting executable to be covered by the GNU General Public License.
24 * Your use of that executable is in no way restricted on account of
25 * linking the GUILE library code into it.
27 * This exception does not however invalidate any other reasons why
28 * the executable file might be covered by the GNU General Public License.
30 * This exception applies only to the code released by the
31 * Free Software Foundation under the name GUILE. If you copy
32 * code from other Free Software Foundation releases into a copy of
33 * GUILE, as the General Public License permits, the exception does
34 * not apply to the code that you add in this way. To avoid misleading
35 * anyone as to the status of such modified files, you must delete
36 * this exception notice from them.
38 * If you write modifications of your own for GUILE, it is your choice
39 * whether to permit this exception to apply to your modifications.
40 * If you do not wish that, delete this exception notice. */
42 /* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
43 gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
53 #include "scm_validate.h"
60 #ifdef TIME_WITH_SYS_TIME
61 # include <sys/time.h>
65 # include <sys/time.h>
75 extern char *ttyname();
79 #ifdef LIBC_H_WITH_UNISTD_H
83 #include <sys/types.h>
90 # include <sys/wait.h>
93 # define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
96 # define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
101 extern FILE *popen ();
102 extern char ** environ
;
105 #include <sys/utsname.h>
109 # define NAMLEN(dirent) strlen((dirent)->d_name)
111 # define dirent direct
112 # define NAMLEN(dirent) (dirent)->d_namlen
114 # include <sys/ndir.h>
117 # include <sys/dir.h>
124 #ifdef HAVE_SETLOCALE
128 /* Some Unix systems don't define these. CPP hair is dangerous, but
129 this seems safe enough... */
146 /* On NextStep, <utime.h> doesn't define struct utime, unless we
147 #define _POSIX_SOURCE before #including it. I think this is less
148 of a kludge than defining struct utimbuf ourselves. */
149 #ifdef UTIMBUF_NEEDS_POSIX
150 #define _POSIX_SOURCE
153 #ifdef HAVE_SYS_UTIME_H
154 #include <sys/utime.h>
161 /* Please don't add any more #includes or #defines here. The hack
162 above means that _POSIX_SOURCE may be #defined, which will
163 encourage header files to do strange things. */
166 SCM_SYMBOL (sym_read_pipe
, "read pipe");
167 SCM_SYMBOL (sym_write_pipe
, "write pipe");
169 GUILE_PROC (scm_pipe
, "pipe", 0, 0, 0,
172 #define FUNC_NAME s_scm_pipe
181 p_rd
= scm_fdes_to_port (fd
[0], "r", sym_read_pipe
);
182 p_wt
= scm_fdes_to_port (fd
[1], "w", sym_write_pipe
);
183 return scm_cons (p_rd
, p_wt
);
188 #ifdef HAVE_GETGROUPS
189 GUILE_PROC (scm_getgroups
, "getgroups", 0, 0, 0,
192 #define FUNC_NAME s_scm_getgroups
195 int ngroups
= getgroups (0, NULL
);
204 groups
= SCM_MUST_MALLOC_TYPE_NUM(GETGROUPS_T
,ngroups
);
205 val
= getgroups(ngroups
, groups
);
209 scm_must_free((char *)groups
);
213 SCM_SETCHARS(grps
, groups
); /* set up grps as a GC protect */
214 SCM_SETLENGTH(grps
, 0L + ngroups
* sizeof(GETGROUPS_T
), scm_tc7_string
);
215 ans
= scm_make_vector (SCM_MAKINUM(ngroups
), SCM_UNDEFINED
);
216 while (--ngroups
>= 0) SCM_VELTS(ans
)[ngroups
] = SCM_MAKINUM(groups
[ngroups
]);
217 SCM_SETCHARS(grps
, groups
); /* to make sure grps stays around. */
226 GUILE_PROC (scm_getpwuid
, "getpw", 0, 1, 0,
229 #define FUNC_NAME s_scm_getpwuid
232 struct passwd
*entry
;
235 result
= scm_make_vector (SCM_MAKINUM (7), SCM_UNSPECIFIED
);
236 ve
= SCM_VELTS (result
);
237 if (SCM_UNBNDP (user
) || SCM_FALSEP (user
))
239 SCM_SYSCALL (entry
= getpwent ());
245 else if (SCM_INUMP (user
))
247 entry
= getpwuid (SCM_INUM (user
));
251 SCM_VALIDATE_ROSTRING(1,user
);
252 if (SCM_SUBSTRP (user
))
253 user
= scm_makfromstr (SCM_ROCHARS (user
), SCM_ROLENGTH (user
), 0);
254 entry
= getpwnam (SCM_ROCHARS (user
));
257 SCM_MISC_ERROR ("entry not found", SCM_EOL
);
259 ve
[0] = scm_makfrom0str (entry
->pw_name
);
260 ve
[1] = scm_makfrom0str (entry
->pw_passwd
);
261 ve
[2] = scm_ulong2num ((unsigned long) entry
->pw_uid
);
262 ve
[3] = scm_ulong2num ((unsigned long) entry
->pw_gid
);
263 ve
[4] = scm_makfrom0str (entry
->pw_gecos
);
265 ve
[5] = scm_makfrom0str ("");
267 ve
[5] = scm_makfrom0str (entry
->pw_dir
);
268 if (!entry
->pw_shell
)
269 ve
[6] = scm_makfrom0str ("");
271 ve
[6] = scm_makfrom0str (entry
->pw_shell
);
278 GUILE_PROC (scm_setpwent
, "setpw", 0, 1, 0,
281 #define FUNC_NAME s_scm_setpwent
283 if (SCM_UNBNDP (arg
) || SCM_FALSEP (arg
))
287 return SCM_UNSPECIFIED
;
294 /* Combines getgrgid and getgrnam. */
295 GUILE_PROC (scm_getgrgid
, "getgr", 0, 1, 0,
298 #define FUNC_NAME s_scm_getgrgid
303 result
= scm_make_vector (SCM_MAKINUM (4), SCM_UNSPECIFIED
);
304 ve
= SCM_VELTS (result
);
305 if (SCM_UNBNDP (name
) || (name
== SCM_BOOL_F
))
307 SCM_SYSCALL (entry
= getgrent ());
313 else if (SCM_INUMP (name
))
314 SCM_SYSCALL (entry
= getgrgid (SCM_INUM (name
)));
317 SCM_VALIDATE_ROSTRING(1,name
);
318 SCM_COERCE_SUBSTR (name
);
319 SCM_SYSCALL (entry
= getgrnam (SCM_ROCHARS (name
)));
324 ve
[0] = scm_makfrom0str (entry
->gr_name
);
325 ve
[1] = scm_makfrom0str (entry
->gr_passwd
);
326 ve
[2] = scm_ulong2num ((unsigned long) entry
->gr_gid
);
327 ve
[3] = scm_makfromstrs (-1, entry
->gr_mem
);
334 GUILE_PROC (scm_setgrent
, "setgr", 0, 1, 0,
337 #define FUNC_NAME s_scm_setgrent
339 if (SCM_UNBNDP (arg
) || SCM_FALSEP (arg
))
343 return SCM_UNSPECIFIED
;
349 GUILE_PROC (scm_kill
, "kill", 2, 0, 0,
352 #define FUNC_NAME s_scm_kill
354 SCM_VALIDATE_INT(1,pid
);
355 SCM_VALIDATE_INT(2,sig
);
356 /* Signal values are interned in scm_init_posix(). */
357 if (kill ((int) SCM_INUM (pid
), (int) SCM_INUM (sig
)) != 0)
359 return SCM_UNSPECIFIED
;
365 GUILE_PROC (scm_waitpid
, "waitpid", 1, 1, 0,
366 (SCM pid
, SCM options
),
368 #define FUNC_NAME s_scm_waitpid
374 SCM_VALIDATE_INT(1,pid
);
375 if (SCM_UNBNDP (options
))
379 SCM_VALIDATE_INT(2,options
);
380 /* Flags are interned in scm_init_posix. */
381 ioptions
= SCM_INUM (options
);
383 SCM_SYSCALL (i
= waitpid (SCM_INUM (pid
), &status
, ioptions
));
386 return scm_cons (SCM_MAKINUM (0L + i
), SCM_MAKINUM (0L + status
));
395 GUILE_PROC (scm_status_exit_val
, "status:exit-val", 1, 0, 0,
398 #define FUNC_NAME s_scm_status_exit_val
402 SCM_VALIDATE_INT(1,status
);
404 /* On Ultrix, the WIF... macros assume their argument is an lvalue;
405 go figure. SCM_INUM does not yield an lvalue. */
406 lstatus
= SCM_INUM (status
);
407 if (WIFEXITED (lstatus
))
408 return (SCM_MAKINUM (WEXITSTATUS (lstatus
)));
414 GUILE_PROC (scm_status_term_sig
, "status:term-sig", 1, 0, 0,
417 #define FUNC_NAME s_scm_status_term_sig
421 SCM_VALIDATE_INT(1,status
);
423 lstatus
= SCM_INUM (status
);
424 if (WIFSIGNALED (lstatus
))
425 return SCM_MAKINUM (WTERMSIG (lstatus
));
431 GUILE_PROC (scm_status_stop_sig
, "status:stop-sig", 1, 0, 0,
434 #define FUNC_NAME s_scm_status_stop_sig
438 SCM_VALIDATE_INT(1,status
);
440 lstatus
= SCM_INUM (status
);
441 if (WIFSTOPPED (lstatus
))
442 return SCM_MAKINUM (WSTOPSIG (lstatus
));
448 GUILE_PROC (scm_getppid
, "getppid", 0, 0, 0,
451 #define FUNC_NAME s_scm_getppid
453 return SCM_MAKINUM (0L + getppid ());
459 GUILE_PROC (scm_getuid
, "getuid", 0, 0, 0,
462 #define FUNC_NAME s_scm_getuid
464 return SCM_MAKINUM (0L + getuid ());
470 GUILE_PROC (scm_getgid
, "getgid", 0, 0, 0,
473 #define FUNC_NAME s_scm_getgid
475 return SCM_MAKINUM (0L + getgid ());
481 GUILE_PROC (scm_geteuid
, "geteuid", 0, 0, 0,
484 #define FUNC_NAME s_scm_geteuid
487 return SCM_MAKINUM (0L + geteuid ());
489 return SCM_MAKINUM (0L + getuid ());
496 GUILE_PROC (scm_getegid
, "getegid", 0, 0, 0,
499 #define FUNC_NAME s_scm_getegid
502 return SCM_MAKINUM (0L + getegid ());
504 return SCM_MAKINUM (0L + getgid ());
510 GUILE_PROC (scm_setuid
, "setuid", 1, 0, 0,
513 #define FUNC_NAME s_scm_setuid
515 SCM_VALIDATE_INT(1,id
);
516 if (setuid (SCM_INUM (id
)) != 0)
518 return SCM_UNSPECIFIED
;
522 GUILE_PROC (scm_setgid
, "setgid", 1, 0, 0,
525 #define FUNC_NAME s_scm_setgid
527 SCM_VALIDATE_INT(1,id
);
528 if (setgid (SCM_INUM (id
)) != 0)
530 return SCM_UNSPECIFIED
;
534 GUILE_PROC (scm_seteuid
, "seteuid", 1, 0, 0,
537 #define FUNC_NAME s_scm_seteuid
541 SCM_VALIDATE_INT(1,id
);
543 rv
= seteuid (SCM_INUM (id
));
545 rv
= setuid (SCM_INUM (id
));
549 return SCM_UNSPECIFIED
;
554 GUILE_PROC (scm_setegid
, "setegid", 1, 0, 0,
557 #define FUNC_NAME s_scm_setegid
561 SCM_VALIDATE_INT(1,id
);
563 rv
= setegid (SCM_INUM (id
));
565 rv
= setgid (SCM_INUM (id
));
569 return SCM_UNSPECIFIED
;
575 GUILE_PROC (scm_getpgrp
, "getpgrp", 0, 0, 0,
578 #define FUNC_NAME s_scm_getpgrp
581 fn
= (int (*) ()) getpgrp
;
582 return SCM_MAKINUM (fn (0));
586 GUILE_PROC (scm_setpgid
, "setpgid", 2, 0, 0,
589 #define FUNC_NAME s_scm_setpgid
592 SCM_VALIDATE_INT(1,pid
);
593 SCM_VALIDATE_INT(2,pgid
);
594 /* FIXME(?): may be known as setpgrp. */
595 if (setpgid (SCM_INUM (pid
), SCM_INUM (pgid
)) != 0)
597 return SCM_UNSPECIFIED
;
606 GUILE_PROC (scm_setsid
, "setsid", 0, 0, 0,
609 #define FUNC_NAME s_scm_setsid
612 pid_t sid
= setsid ();
615 return SCM_UNSPECIFIED
;
624 GUILE_PROC (scm_ttyname
, "ttyname", 1, 0, 0,
627 #define FUNC_NAME s_scm_ttyname
632 port
= SCM_COERCE_OUTPORT (port
);
633 SCM_VALIDATE_OPPORT(1,port
);
634 if (scm_tc16_fport
!= SCM_TYP16 (port
))
636 fd
= SCM_FPORT_FDES (port
);
637 SCM_SYSCALL (ans
= ttyname (fd
));
640 /* ans could be overwritten by another call to ttyname */
641 return (scm_makfrom0str (ans
));
646 GUILE_PROC (scm_ctermid
, "ctermid", 0, 0, 0,
649 #define FUNC_NAME s_scm_ctermid
652 char *result
= ctermid (NULL
);
655 return scm_makfrom0str (result
);
664 GUILE_PROC (scm_tcgetpgrp
, "tcgetpgrp", 1, 0, 0,
667 #define FUNC_NAME s_scm_tcgetpgrp
669 #ifdef HAVE_TCGETPGRP
673 port
= SCM_COERCE_OUTPORT (port
);
675 SCM_VALIDATE_OPFPORT(1,port
);
676 fd
= SCM_FPORT_FDES (port
);
677 if ((pgid
= tcgetpgrp (fd
)) == -1)
679 return SCM_MAKINUM (pgid
);
688 GUILE_PROC (scm_tcsetpgrp
, "tcsetpgrp", 2, 0, 0,
689 (SCM port
, SCM pgid
),
691 #define FUNC_NAME s_scm_tcsetpgrp
693 #ifdef HAVE_TCSETPGRP
696 port
= SCM_COERCE_OUTPORT (port
);
698 SCM_VALIDATE_OPFPORT(1,port
);
699 SCM_VALIDATE_INT(2,pgid
);
700 fd
= SCM_FPORT_FDES (port
);
701 if (tcsetpgrp (fd
, SCM_INUM (pgid
)) == -1)
703 return SCM_UNSPECIFIED
;
713 /* Copy exec args from an SCM vector into a new C array. */
716 scm_convert_exec_args (SCM args
, int pos
, const char *subr
)
722 SCM_ASSERT (SCM_NULLP (args
)
723 || (SCM_NIMP (args
) && SCM_CONSP (args
)),
725 num_args
= scm_ilength (args
);
727 scm_must_malloc ((num_args
+ 1) * sizeof (char *), subr
);
728 for (i
= 0; SCM_NNULLP (args
); args
= SCM_CDR (args
), ++i
)
733 SCM_ASSERT (SCM_NIMP (SCM_CAR (args
)) && SCM_ROSTRINGP (SCM_CAR (args
)),
734 SCM_CAR (args
), SCM_ARGn
, subr
);
735 len
= 1 + SCM_ROLENGTH (SCM_CAR (args
));
736 dst
= (char *) scm_must_malloc ((long) len
, subr
);
737 src
= SCM_ROCHARS (SCM_CAR (args
));
746 GUILE_PROC (scm_execl
, "execl", 1, 0, 1,
747 (SCM filename
, SCM args
),
749 #define FUNC_NAME s_scm_execl
752 SCM_VALIDATE_ROSTRING(1,filename
);
753 SCM_COERCE_SUBSTR (filename
);
754 execargv
= scm_convert_exec_args (args
, SCM_ARG2
, FUNC_NAME
);
755 execv (SCM_ROCHARS (filename
), execargv
);
762 GUILE_PROC (scm_execlp
, "execlp", 1, 0, 1,
763 (SCM filename
, SCM args
),
765 #define FUNC_NAME s_scm_execlp
768 SCM_VALIDATE_ROSTRING(1,filename
);
769 SCM_COERCE_SUBSTR (filename
);
770 execargv
= scm_convert_exec_args (args
, SCM_ARG2
, FUNC_NAME
);
771 execvp (SCM_ROCHARS (filename
), execargv
);
779 environ_list_to_c (SCM envlist
, int arg
, const char *proc
)
785 SCM_ASSERT (SCM_NULLP (envlist
)
786 || (SCM_NIMP (envlist
) && SCM_CONSP (envlist
)),
788 num_strings
= scm_ilength (envlist
);
789 result
= (char **) malloc ((num_strings
+ 1) * sizeof (char *));
791 scm_memory_error (proc
);
792 while (SCM_NNULLP (envlist
))
797 SCM_ASSERT (SCM_NIMP (SCM_CAR (envlist
))
798 && SCM_ROSTRINGP (SCM_CAR (envlist
)),
800 len
= 1 + SCM_ROLENGTH (SCM_CAR (envlist
));
801 result
[i
] = malloc ((long) len
);
802 if (result
[i
] == NULL
)
803 scm_memory_error (proc
);
804 src
= SCM_ROCHARS (SCM_CAR (envlist
));
806 result
[i
][len
] = src
[len
];
807 envlist
= SCM_CDR (envlist
);
814 GUILE_PROC (scm_execle
, "execle", 2, 0, 1,
815 (SCM filename
, SCM env
, SCM args
),
817 #define FUNC_NAME s_scm_execle
822 SCM_VALIDATE_ROSTRING(1,filename
);
823 SCM_COERCE_SUBSTR (filename
);
825 execargv
= scm_convert_exec_args (args
, SCM_ARG1
, FUNC_NAME
);
826 exec_env
= environ_list_to_c (env
, SCM_ARG2
, FUNC_NAME
);
827 execve (SCM_ROCHARS (filename
), execargv
, exec_env
);
834 GUILE_PROC (scm_fork
, "primitive-fork", 0, 0, 0,
837 #define FUNC_NAME s_scm_fork
843 return SCM_MAKINUM (0L+pid
);
848 GUILE_PROC (scm_uname
, "uname", 0, 0, 0,
851 #define FUNC_NAME s_scm_uname
855 SCM ans
= scm_make_vector (SCM_MAKINUM(5), SCM_UNSPECIFIED
);
856 SCM
*ve
= SCM_VELTS (ans
);
857 if (uname (&buf
) < 0)
859 ve
[0] = scm_makfrom0str (buf
.sysname
);
860 ve
[1] = scm_makfrom0str (buf
.nodename
);
861 ve
[2] = scm_makfrom0str (buf
.release
);
862 ve
[3] = scm_makfrom0str (buf
.version
);
863 ve
[4] = scm_makfrom0str (buf
.machine
);
866 ve[5] = scm_makfrom0str (buf.domainname);
877 GUILE_PROC (scm_environ
, "environ", 0, 1, 0,
880 #define FUNC_NAME s_scm_environ
882 if (SCM_UNBNDP (env
))
883 return scm_makfromstrs (-1, environ
);
888 new_environ
= environ_list_to_c (env
, SCM_ARG1
, FUNC_NAME
);
889 /* Free the old environment, except when called for the first
894 static int first
= 1;
897 for (ep
= environ
; *ep
!= NULL
; ep
++)
899 free ((char *) environ
);
903 environ
= new_environ
;
904 return SCM_UNSPECIFIED
;
911 GUILE_PROC (scm_tmpnam
, "tmpnam", 0, 0, 0,
914 #define FUNC_NAME s_scm_tmpnam
917 SCM_SYSCALL (tmpnam (name
););
918 return scm_makfrom0str (name
);
924 GUILE_PROC (scm_utime
, "utime", 1, 2, 0,
925 (SCM pathname
, SCM actime
, SCM modtime
),
927 #define FUNC_NAME s_scm_utime
930 struct utimbuf utm_tmp
;
932 SCM_VALIDATE_ROSTRING(1,pathname
);
933 SCM_COERCE_SUBSTR (pathname
);
934 if (SCM_UNBNDP (actime
))
935 SCM_SYSCALL (time (&utm_tmp
.actime
));
937 utm_tmp
.actime
= SCM_NUM2ULONG (2,actime
);
939 if (SCM_UNBNDP (modtime
))
940 SCM_SYSCALL (time (&utm_tmp
.modtime
));
942 utm_tmp
.modtime
= SCM_NUM2ULONG (3,modtime
);
944 SCM_SYSCALL (rv
= utime (SCM_ROCHARS (pathname
), &utm_tmp
));
947 return SCM_UNSPECIFIED
;
951 GUILE_PROC (scm_access
, "access?", 2, 0, 0,
954 #define FUNC_NAME s_scm_access
958 SCM_VALIDATE_ROSTRING(1,path
);
959 if (SCM_SUBSTRP (path
))
960 path
= scm_makfromstr (SCM_ROCHARS (path
), SCM_ROLENGTH (path
), 0);
961 SCM_VALIDATE_INT(2,how
);
962 rv
= access (SCM_ROCHARS (path
), SCM_INUM (how
));
963 return rv
? SCM_BOOL_F
: SCM_BOOL_T
;
967 GUILE_PROC (scm_getpid
, "getpid", 0, 0, 0,
970 #define FUNC_NAME s_scm_getpid
972 return SCM_MAKINUM ((unsigned long) getpid ());
976 GUILE_PROC (scm_putenv
, "putenv", 1, 0, 0,
979 #define FUNC_NAME s_scm_putenv
984 SCM_VALIDATE_ROSTRING(1,str
);
985 /* must make a new copy to be left in the environment, safe from gc. */
986 ptr
= malloc (SCM_LENGTH (str
) + 1);
989 strncpy (ptr
, SCM_ROCHARS (str
), SCM_LENGTH (str
));
990 ptr
[SCM_LENGTH(str
)] = 0;
994 return SCM_UNSPECIFIED
;
998 GUILE_PROC (scm_setlocale
, "setlocale", 1, 1, 0,
999 (SCM category
, SCM locale
),
1001 #define FUNC_NAME s_scm_setlocale
1003 #ifdef HAVE_SETLOCALE
1007 SCM_VALIDATE_INT(1,category
);
1008 if (SCM_UNBNDP (locale
))
1014 SCM_VALIDATE_ROSTRING(2,locale
);
1015 SCM_COERCE_SUBSTR (locale
);
1016 clocale
= SCM_ROCHARS (locale
);
1019 rv
= setlocale (SCM_INUM (category
), clocale
);
1022 return scm_makfrom0str (rv
);
1031 GUILE_PROC (scm_mknod
, "mknod", 4, 0, 0,
1032 (SCM path
, SCM type
, SCM perms
, SCM dev
),
1034 #define FUNC_NAME s_scm_mknod
1041 SCM_VALIDATE_ROSTRING(1,path
);
1042 SCM_VALIDATE_SYMBOL(2,type
);
1043 SCM_VALIDATE_INT(3,perms
);
1044 SCM_VALIDATE_INT(4,dev
);
1045 SCM_COERCE_SUBSTR (path
);
1047 p
= SCM_CHARS (type
);
1048 if (strcmp (p
, "regular") == 0)
1050 else if (strcmp (p
, "directory") == 0)
1052 else if (strcmp (p
, "symlink") == 0)
1054 else if (strcmp (p
, "block-special") == 0)
1056 else if (strcmp (p
, "char-special") == 0)
1058 else if (strcmp (p
, "fifo") == 0)
1060 else if (strcmp (p
, "socket") == 0)
1063 SCM_OUT_OF_RANGE (2,type
);
1065 SCM_SYSCALL (val
= mknod(SCM_ROCHARS(path
), ctype
| SCM_INUM (perms
),
1069 return SCM_UNSPECIFIED
;
1079 GUILE_PROC (scm_nice
, "nice", 1, 0, 0,
1082 #define FUNC_NAME s_scm_nice
1085 SCM_VALIDATE_INT(1,incr
);
1086 if (nice(SCM_INUM(incr
)) != 0)
1088 return SCM_UNSPECIFIED
;
1098 GUILE_PROC (scm_sync
, "sync", 0, 0, 0,
1101 #define FUNC_NAME s_scm_sync
1109 return SCM_UNSPECIFIED
;
1116 scm_add_feature ("posix");
1118 scm_add_feature ("EIDs");
1121 scm_sysintern ("WAIT_ANY", SCM_MAKINUM (WAIT_ANY
));
1124 scm_sysintern ("WAIT_MYPGRP", SCM_MAKINUM (WAIT_MYPGRP
));
1127 scm_sysintern ("WNOHANG", SCM_MAKINUM (WNOHANG
));
1130 scm_sysintern ("WUNTRACED", SCM_MAKINUM (WUNTRACED
));
1133 /* access() symbols. */
1134 scm_sysintern ("R_OK", SCM_MAKINUM (R_OK
));
1135 scm_sysintern ("W_OK", SCM_MAKINUM (W_OK
));
1136 scm_sysintern ("X_OK", SCM_MAKINUM (X_OK
));
1137 scm_sysintern ("F_OK", SCM_MAKINUM (F_OK
));
1140 scm_sysintern ("LC_COLLATE", SCM_MAKINUM (LC_COLLATE
));
1143 scm_sysintern ("LC_CTYPE", SCM_MAKINUM (LC_CTYPE
));
1146 scm_sysintern ("LC_MONETARY", SCM_MAKINUM (LC_MONETARY
));
1149 scm_sysintern ("LC_NUMERIC", SCM_MAKINUM (LC_NUMERIC
));
1152 scm_sysintern ("LC_TIME", SCM_MAKINUM (LC_TIME
));
1155 scm_sysintern ("LC_MESSAGES", SCM_MAKINUM (LC_MESSAGES
));
1158 scm_sysintern ("LC_ALL", SCM_MAKINUM (LC_ALL
));
1160 #include "cpp_sig_symbols.c"