1 /* Copyright (C) 1995,1996,1997,1998,1999,2000,2001 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 */
47 /* Make GNU/Linux libc declare everything it has. */
53 #include "libguile/_scm.h"
54 #include "libguile/fports.h"
55 #include "libguile/scmsigs.h"
56 #include "libguile/feature.h"
57 #include "libguile/strings.h"
58 #include "libguile/vectors.h"
60 #include "libguile/validate.h"
61 #include "libguile/posix.h"
67 #ifdef TIME_WITH_SYS_TIME
68 # include <sys/time.h>
72 # include <sys/time.h>
82 extern char *ttyname();
86 #ifdef LIBC_H_WITH_UNISTD_H
90 #include <sys/types.h>
97 # include <sys/wait.h>
100 # define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
103 # define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
108 extern char ** environ
;
111 #include <sys/utsname.h>
115 # define NAMLEN(dirent) strlen((dirent)->d_name)
117 # define dirent direct
118 # define NAMLEN(dirent) (dirent)->d_namlen
120 # include <sys/ndir.h>
123 # include <sys/dir.h>
130 #ifdef HAVE_SETLOCALE
134 #if HAVE_LIBCRYPT && HAVE_CRYPT_H
138 #if HAVE_SYS_RESOURCE_H
139 # include <sys/resource.h>
143 # include <sys/file.h>
146 /* Some Unix systems don't define these. CPP hair is dangerous, but
147 this seems safe enough... */
164 /* On NextStep, <utime.h> doesn't define struct utime, unless we
165 #define _POSIX_SOURCE before #including it. I think this is less
166 of a kludge than defining struct utimbuf ourselves. */
167 #ifdef UTIMBUF_NEEDS_POSIX
168 #define _POSIX_SOURCE
171 #ifdef HAVE_SYS_UTIME_H
172 #include <sys/utime.h>
179 /* Please don't add any more #includes or #defines here. The hack
180 above means that _POSIX_SOURCE may be #defined, which will
181 encourage header files to do strange things. */
184 SCM_SYMBOL (sym_read_pipe
, "read pipe");
185 SCM_SYMBOL (sym_write_pipe
, "write pipe");
187 SCM_DEFINE (scm_pipe
, "pipe", 0, 0, 0,
189 "Return a newly created pipe: a pair of ports which are linked\n"
190 "together on the local machine. The @emph{car} is the input\n"
191 "port and the @emph{cdr} is the output port. Data written (and\n"
192 "flushed) to the output port can be read from the input port.\n"
193 "Pipes are commonly used for communication with a newly forked\n"
194 "child process. The need to flush the output port can be\n"
195 "avoided by making it unbuffered using @code{setvbuf}.\n"
197 "Writes occur atomically provided the size of the data in bytes\n"
198 "is not greater than the value of @code{PIPE_BUF}. Note that\n"
199 "the output port is likely to block if too much data (typically\n"
200 "equal to @code{PIPE_BUF}) has been written but not yet read\n"
201 "from the input port.")
202 #define FUNC_NAME s_scm_pipe
211 p_rd
= scm_fdes_to_port (fd
[0], "r", sym_read_pipe
);
212 p_wt
= scm_fdes_to_port (fd
[1], "w", sym_write_pipe
);
213 return scm_cons (p_rd
, p_wt
);
218 #ifdef HAVE_GETGROUPS
219 SCM_DEFINE (scm_getgroups
, "getgroups", 0, 0, 0,
221 "Return a vector of integers representing the current\n"
222 "supplimentary group IDs.")
223 #define FUNC_NAME s_scm_getgroups
230 ngroups
= getgroups (0, NULL
);
234 size
= ngroups
* sizeof (GETGROUPS_T
);
235 groups
= scm_must_malloc (size
, FUNC_NAME
);
236 getgroups (ngroups
, groups
);
238 ans
= scm_c_make_vector (ngroups
, SCM_UNDEFINED
);
239 while (--ngroups
>= 0)
240 SCM_VELTS (ans
) [ngroups
] = SCM_MAKINUM (groups
[ngroups
]);
242 scm_must_free (groups
);
243 scm_done_free (size
);
251 SCM_DEFINE (scm_getpwuid
, "getpw", 0, 1, 0,
253 "Look up an entry in the user database. @var{obj} can be an integer,\n"
254 "a string, or omitted, giving the behaviour of getpwuid, getpwnam\n"
255 "or getpwent respectively.")
256 #define FUNC_NAME s_scm_getpwuid
259 struct passwd
*entry
;
262 result
= scm_c_make_vector (7, SCM_UNSPECIFIED
);
263 ve
= SCM_VELTS (result
);
264 if (SCM_UNBNDP (user
) || SCM_FALSEP (user
))
266 SCM_SYSCALL (entry
= getpwent ());
272 else if (SCM_INUMP (user
))
274 entry
= getpwuid (SCM_INUM (user
));
278 SCM_VALIDATE_STRING (1, user
);
279 SCM_STRING_COERCE_0TERMINATION_X (user
);
280 entry
= getpwnam (SCM_STRING_CHARS (user
));
283 SCM_MISC_ERROR ("entry not found", SCM_EOL
);
285 ve
[0] = scm_makfrom0str (entry
->pw_name
);
286 ve
[1] = scm_makfrom0str (entry
->pw_passwd
);
287 ve
[2] = scm_ulong2num ((unsigned long) entry
->pw_uid
);
288 ve
[3] = scm_ulong2num ((unsigned long) entry
->pw_gid
);
289 ve
[4] = scm_makfrom0str (entry
->pw_gecos
);
291 ve
[5] = scm_makfrom0str ("");
293 ve
[5] = scm_makfrom0str (entry
->pw_dir
);
294 if (!entry
->pw_shell
)
295 ve
[6] = scm_makfrom0str ("");
297 ve
[6] = scm_makfrom0str (entry
->pw_shell
);
304 SCM_DEFINE (scm_setpwent
, "setpw", 0, 1, 0,
306 "If called with a true argument, initialize or reset the password data\n"
307 "stream. Otherwise, close the stream. The @code{setpwent} and\n"
308 "@code{endpwent} procedures are implemented on top of this.")
309 #define FUNC_NAME s_scm_setpwent
311 if (SCM_UNBNDP (arg
) || SCM_FALSEP (arg
))
315 return SCM_UNSPECIFIED
;
322 /* Combines getgrgid and getgrnam. */
323 SCM_DEFINE (scm_getgrgid
, "getgr", 0, 1, 0,
325 "Look up an entry in the group database. @var{obj} can be an integer,\n"
326 "a string, or omitted, giving the behaviour of getgrgid, getgrnam\n"
327 "or getgrent respectively.")
328 #define FUNC_NAME s_scm_getgrgid
333 result
= scm_c_make_vector (4, SCM_UNSPECIFIED
);
334 ve
= SCM_VELTS (result
);
335 if (SCM_UNBNDP (name
) || SCM_FALSEP (name
))
337 SCM_SYSCALL (entry
= getgrent ());
343 else if (SCM_INUMP (name
))
344 SCM_SYSCALL (entry
= getgrgid (SCM_INUM (name
)));
347 SCM_VALIDATE_STRING (1, name
);
348 SCM_STRING_COERCE_0TERMINATION_X (name
);
349 SCM_SYSCALL (entry
= getgrnam (SCM_STRING_CHARS (name
)));
354 ve
[0] = scm_makfrom0str (entry
->gr_name
);
355 ve
[1] = scm_makfrom0str (entry
->gr_passwd
);
356 ve
[2] = scm_ulong2num ((unsigned long) entry
->gr_gid
);
357 ve
[3] = scm_makfromstrs (-1, entry
->gr_mem
);
364 SCM_DEFINE (scm_setgrent
, "setgr", 0, 1, 0,
366 "If called with a true argument, initialize or reset the group data\n"
367 "stream. Otherwise, close the stream. The @code{setgrent} and\n"
368 "@code{endgrent} procedures are implemented on top of this.")
369 #define FUNC_NAME s_scm_setgrent
371 if (SCM_UNBNDP (arg
) || SCM_FALSEP (arg
))
375 return SCM_UNSPECIFIED
;
381 SCM_DEFINE (scm_kill
, "kill", 2, 0, 0,
383 "Sends a signal to the specified process or group of processes.\n\n"
384 "@var{pid} specifies the processes to which the signal is sent:\n\n"
386 "@item @var{pid} greater than 0\n"
387 "The process whose identifier is @var{pid}.\n"
388 "@item @var{pid} equal to 0\n"
389 "All processes in the current process group.\n"
390 "@item @var{pid} less than -1\n"
391 "The process group whose identifier is -@var{pid}\n"
392 "@item @var{pid} equal to -1\n"
393 "If the process is privileged, all processes except for some special\n"
394 "system processes. Otherwise, all processes with the current effective\n"
397 "@var{sig} should be specified using a variable corresponding to\n"
398 "the Unix symbolic name, e.g.,\n\n"
403 "Interrupt signal.\n"
405 #define FUNC_NAME s_scm_kill
407 SCM_VALIDATE_INUM (1,pid
);
408 SCM_VALIDATE_INUM (2,sig
);
409 /* Signal values are interned in scm_init_posix(). */
410 if (kill ((int) SCM_INUM (pid
), (int) SCM_INUM (sig
)) != 0)
412 return SCM_UNSPECIFIED
;
417 SCM_DEFINE (scm_waitpid
, "waitpid", 1, 1, 0,
418 (SCM pid
, SCM options
),
419 "This procedure collects status information from a child process which\n"
420 "has terminated or (optionally) stopped. Normally it will\n"
421 "suspend the calling process until this can be done. If more than one\n"
422 "child process is eligible then one will be chosen by the operating system.\n\n"
423 "The value of @var{pid} determines the behaviour:\n\n"
425 "@item @var{pid} greater than 0\n"
426 "Request status information from the specified child process.\n"
427 "@item @var{pid} equal to -1 or WAIT_ANY\n"
428 "Request status information for any child process.\n"
429 "@item @var{pid} equal to 0 or WAIT_MYPGRP\n"
430 "Request status information for any child process in the current process\n"
432 "@item @var{pid} less than -1\n"
433 "Request status information for any child process whose process group ID\n"
436 "The @var{options} argument, if supplied, should be the bitwise OR of the\n"
437 "values of zero or more of the following variables:\n\n"
439 "Return immediately even if there are no child processes to be collected.\n"
441 "@defvar WUNTRACED\n"
442 "Report status information for stopped processes as well as terminated\n"
445 "The return value is a pair containing:\n\n"
448 "The process ID of the child process, or 0 if @code{WNOHANG} was\n"
449 "specified and no process was collected.\n"
451 "The integer status value.\n"
453 #define FUNC_NAME s_scm_waitpid
458 SCM_VALIDATE_INUM (1,pid
);
459 if (SCM_UNBNDP (options
))
463 SCM_VALIDATE_INUM (2,options
);
464 /* Flags are interned in scm_init_posix. */
465 ioptions
= SCM_INUM (options
);
467 SCM_SYSCALL (i
= waitpid (SCM_INUM (pid
), &status
, ioptions
));
470 return scm_cons (SCM_MAKINUM (0L + i
), SCM_MAKINUM (0L + status
));
473 #endif /* HAVE_WAITPID */
475 SCM_DEFINE (scm_status_exit_val
, "status:exit-val", 1, 0, 0,
477 "Return the exit status value, as would be set if a process\n"
478 "ended normally through a call to @code{exit} or @code{_exit},\n"
479 "if any, otherwise @code{#f}.")
480 #define FUNC_NAME s_scm_status_exit_val
484 SCM_VALIDATE_INUM (1,status
);
486 /* On Ultrix, the WIF... macros assume their argument is an lvalue;
487 go figure. SCM_INUM does not yield an lvalue. */
488 lstatus
= SCM_INUM (status
);
489 if (WIFEXITED (lstatus
))
490 return (SCM_MAKINUM (WEXITSTATUS (lstatus
)));
496 SCM_DEFINE (scm_status_term_sig
, "status:term-sig", 1, 0, 0,
498 "Return the signal number which terminated the process, if any,\n"
499 "otherwise @code{#f}.")
500 #define FUNC_NAME s_scm_status_term_sig
504 SCM_VALIDATE_INUM (1,status
);
506 lstatus
= SCM_INUM (status
);
507 if (WIFSIGNALED (lstatus
))
508 return SCM_MAKINUM (WTERMSIG (lstatus
));
514 SCM_DEFINE (scm_status_stop_sig
, "status:stop-sig", 1, 0, 0,
516 "Return the signal number which stopped the process, if any,\n"
517 "otherwise @code{#f}.")
518 #define FUNC_NAME s_scm_status_stop_sig
522 SCM_VALIDATE_INUM (1,status
);
524 lstatus
= SCM_INUM (status
);
525 if (WIFSTOPPED (lstatus
))
526 return SCM_MAKINUM (WSTOPSIG (lstatus
));
532 SCM_DEFINE (scm_getppid
, "getppid", 0, 0, 0,
534 "Return an integer representing the process ID of the parent\n"
536 #define FUNC_NAME s_scm_getppid
538 return SCM_MAKINUM (0L + getppid ());
544 SCM_DEFINE (scm_getuid
, "getuid", 0, 0, 0,
546 "Return an integer representing the current real user ID.")
547 #define FUNC_NAME s_scm_getuid
549 return SCM_MAKINUM (0L + getuid ());
555 SCM_DEFINE (scm_getgid
, "getgid", 0, 0, 0,
557 "Return an integer representing the current real group ID.")
558 #define FUNC_NAME s_scm_getgid
560 return SCM_MAKINUM (0L + getgid ());
566 SCM_DEFINE (scm_geteuid
, "geteuid", 0, 0, 0,
568 "Return an integer representing the current effective user ID.\n"
569 "If the system does not support effective IDs, then the real ID\n"
570 "is returned. @code{(feature? 'EIDs)} reports whether the\n"
571 "system supports effective IDs.")
572 #define FUNC_NAME s_scm_geteuid
575 return SCM_MAKINUM (0L + geteuid ());
577 return SCM_MAKINUM (0L + getuid ());
584 SCM_DEFINE (scm_getegid
, "getegid", 0, 0, 0,
586 "Return an integer representing the current effective group ID.\n"
587 "If the system does not support effective IDs, then the real ID\n"
588 "is returned. @code{(feature? 'EIDs)} reports whether the\n"
589 "system supports effective IDs.")
590 #define FUNC_NAME s_scm_getegid
593 return SCM_MAKINUM (0L + getegid ());
595 return SCM_MAKINUM (0L + getgid ());
601 SCM_DEFINE (scm_setuid
, "setuid", 1, 0, 0,
603 "Sets both the real and effective user IDs to the integer @var{id}, provided\n"
604 "the process has appropriate privileges.\n"
605 "The return value is unspecified.")
606 #define FUNC_NAME s_scm_setuid
608 SCM_VALIDATE_INUM (1,id
);
609 if (setuid (SCM_INUM (id
)) != 0)
611 return SCM_UNSPECIFIED
;
615 SCM_DEFINE (scm_setgid
, "setgid", 1, 0, 0,
617 "Sets both the real and effective group IDs to the integer @var{id}, provided\n"
618 "the process has appropriate privileges.\n"
619 "The return value is unspecified.")
620 #define FUNC_NAME s_scm_setgid
622 SCM_VALIDATE_INUM (1,id
);
623 if (setgid (SCM_INUM (id
)) != 0)
625 return SCM_UNSPECIFIED
;
629 SCM_DEFINE (scm_seteuid
, "seteuid", 1, 0, 0,
631 "Sets the effective user ID to the integer @var{id}, provided the process\n"
632 "has appropriate privileges. If effective IDs are not supported, the\n"
633 "real ID is set instead -- @code{(feature? 'EIDs)} reports whether the\n"
634 "system supports effective IDs.\n"
635 "The return value is unspecified.")
636 #define FUNC_NAME s_scm_seteuid
640 SCM_VALIDATE_INUM (1,id
);
642 rv
= seteuid (SCM_INUM (id
));
644 rv
= setuid (SCM_INUM (id
));
648 return SCM_UNSPECIFIED
;
653 SCM_DEFINE (scm_setegid
, "setegid", 1, 0, 0,
655 "Sets the effective group ID to the integer @var{id}, provided the process\n"
656 "has appropriate privileges. If effective IDs are not supported, the\n"
657 "real ID is set instead -- @code{(feature? 'EIDs)} reports whether the\n"
658 "system supports effective IDs.\n"
659 "The return value is unspecified.")
660 #define FUNC_NAME s_scm_setegid
664 SCM_VALIDATE_INUM (1,id
);
666 rv
= setegid (SCM_INUM (id
));
668 rv
= setgid (SCM_INUM (id
));
672 return SCM_UNSPECIFIED
;
678 SCM_DEFINE (scm_getpgrp
, "getpgrp", 0, 0, 0,
680 "Return an integer representing the current process group ID.\n"
681 "This is the POSIX definition, not BSD.")
682 #define FUNC_NAME s_scm_getpgrp
685 fn
= (int (*) ()) getpgrp
;
686 return SCM_MAKINUM (fn (0));
691 SCM_DEFINE (scm_setpgid
, "setpgid", 2, 0, 0,
693 "Move the process @var{pid} into the process group @var{pgid}. @var{pid} or\n"
694 "@var{pgid} must be integers: they can be zero to indicate the ID of the\n"
696 "Fails on systems that do not support job control.\n"
697 "The return value is unspecified.")
698 #define FUNC_NAME s_scm_setpgid
700 SCM_VALIDATE_INUM (1,pid
);
701 SCM_VALIDATE_INUM (2,pgid
);
702 /* FIXME(?): may be known as setpgrp. */
703 if (setpgid (SCM_INUM (pid
), SCM_INUM (pgid
)) != 0)
705 return SCM_UNSPECIFIED
;
708 #endif /* HAVE_SETPGID */
711 SCM_DEFINE (scm_setsid
, "setsid", 0, 0, 0,
713 "Creates a new session. The current process becomes the session leader\n"
714 "and is put in a new process group. The process will be detached\n"
715 "from its controlling terminal if it has one.\n"
716 "The return value is an integer representing the new process group ID.")
717 #define FUNC_NAME s_scm_setsid
719 pid_t sid
= setsid ();
722 return SCM_UNSPECIFIED
;
725 #endif /* HAVE_SETSID */
727 SCM_DEFINE (scm_ttyname
, "ttyname", 1, 0, 0,
729 "Return a string with the name of the serial terminal device\n"
730 "underlying @var{port}.")
731 #define FUNC_NAME s_scm_ttyname
736 port
= SCM_COERCE_OUTPORT (port
);
737 SCM_VALIDATE_OPPORT (1,port
);
738 if (!SCM_FPORTP (port
))
740 fd
= SCM_FPORT_FDES (port
);
741 SCM_SYSCALL (ans
= ttyname (fd
));
744 /* ans could be overwritten by another call to ttyname */
745 return (scm_makfrom0str (ans
));
750 SCM_DEFINE (scm_ctermid
, "ctermid", 0, 0, 0,
752 "Return a string containing the file name of the controlling\n"
753 "terminal for the current process.")
754 #define FUNC_NAME s_scm_ctermid
756 char *result
= ctermid (NULL
);
759 return scm_makfrom0str (result
);
762 #endif /* HAVE_CTERMID */
764 #ifdef HAVE_TCGETPGRP
765 SCM_DEFINE (scm_tcgetpgrp
, "tcgetpgrp", 1, 0, 0,
767 "Return the process group ID of the foreground process group\n"
768 "associated with the terminal open on the file descriptor\n"
769 "underlying @var{port}.\n"
771 "If there is no foreground process group, the return value is a\n"
772 "number greater than 1 that does not match the process group ID\n"
773 "of any existing process group. This can happen if all of the\n"
774 "processes in the job that was formerly the foreground job have\n"
775 "terminated, and no other job has yet been moved into the\n"
777 #define FUNC_NAME s_scm_tcgetpgrp
782 port
= SCM_COERCE_OUTPORT (port
);
784 SCM_VALIDATE_OPFPORT (1,port
);
785 fd
= SCM_FPORT_FDES (port
);
786 if ((pgid
= tcgetpgrp (fd
)) == -1)
788 return SCM_MAKINUM (pgid
);
791 #endif /* HAVE_TCGETPGRP */
793 #ifdef HAVE_TCSETPGRP
794 SCM_DEFINE (scm_tcsetpgrp
, "tcsetpgrp", 2, 0, 0,
795 (SCM port
, SCM pgid
),
796 "Set the foreground process group ID for the terminal used by the file\n"
797 "descriptor underlying @var{port} to the integer @var{pgid}.\n"
798 "The calling process\n"
799 "must be a member of the same session as @var{pgid} and must have the same\n"
800 "controlling terminal. The return value is unspecified.")
801 #define FUNC_NAME s_scm_tcsetpgrp
805 port
= SCM_COERCE_OUTPORT (port
);
807 SCM_VALIDATE_OPFPORT (1,port
);
808 SCM_VALIDATE_INUM (2,pgid
);
809 fd
= SCM_FPORT_FDES (port
);
810 if (tcsetpgrp (fd
, SCM_INUM (pgid
)) == -1)
812 return SCM_UNSPECIFIED
;
815 #endif /* HAVE_TCSETPGRP */
817 /* Create a new C argv array from a scheme list of strings. */
818 /* Dirk:FIXME:: A quite similar function is implemented in dynl.c */
819 /* Dirk:FIXME:: In case of assertion errors, we get memory leaks */
822 scm_convert_exec_args (SCM args
, int argn
, const char *subr
)
828 argc
= scm_ilength (args
);
829 SCM_ASSERT (argc
>= 0, args
, argn
, subr
);
830 argv
= (char **) scm_must_malloc ((argc
+ 1) * sizeof (char *), subr
);
831 for (i
= 0; !SCM_NULLP (args
); args
= SCM_CDR (args
), ++i
)
833 SCM arg
= SCM_CAR (args
);
838 SCM_ASSERT (SCM_STRINGP (arg
), args
, argn
, subr
);
839 len
= SCM_STRING_LENGTH (arg
);
840 src
= SCM_STRING_CHARS (arg
);
841 dst
= (char *) scm_must_malloc (len
+ 1, subr
);
842 memcpy (dst
, src
, len
);
850 SCM_DEFINE (scm_execl
, "execl", 1, 0, 1,
851 (SCM filename
, SCM args
),
852 "Executes the file named by @var{path} as a new process image.\n"
853 "The remaining arguments are supplied to the process; from a C program\n"
854 "they are accessable as the @code{argv} argument to @code{main}.\n"
855 "Conventionally the first @var{arg} is the same as @var{path}.\n"
856 "All arguments must be strings. \n\n"
857 "If @var{arg} is missing, @var{path} is executed with a null\n"
858 "argument list, which may have system-dependent side-effects.\n\n"
859 "This procedure is currently implemented using the @code{execv} system\n"
860 "call, but we call it @code{execl} because of its Scheme calling interface.")
861 #define FUNC_NAME s_scm_execl
864 SCM_VALIDATE_STRING (1, filename
);
865 SCM_STRING_COERCE_0TERMINATION_X (filename
);
866 execargv
= scm_convert_exec_args (args
, SCM_ARG2
, FUNC_NAME
);
867 execv (SCM_STRING_CHARS (filename
), execargv
);
874 SCM_DEFINE (scm_execlp
, "execlp", 1, 0, 1,
875 (SCM filename
, SCM args
),
876 "Similar to @code{execl}, however if\n"
877 "@var{filename} does not contain a slash\n"
878 "then the file to execute will be located by searching the\n"
879 "directories listed in the @code{PATH} environment variable.\n\n"
880 "This procedure is currently implemented using the @code{execvp} system\n"
881 "call, but we call it @code{execlp} because of its Scheme calling interface.")
882 #define FUNC_NAME s_scm_execlp
885 SCM_VALIDATE_STRING (1, filename
);
886 SCM_STRING_COERCE_0TERMINATION_X (filename
);
887 execargv
= scm_convert_exec_args (args
, SCM_ARG2
, FUNC_NAME
);
888 execvp (SCM_STRING_CHARS (filename
), execargv
);
896 environ_list_to_c (SCM envlist
, int arg
, const char *proc
)
902 num_strings
= scm_ilength (envlist
);
903 SCM_ASSERT (num_strings
>= 0, envlist
, arg
, proc
);
904 result
= (char **) malloc ((num_strings
+ 1) * sizeof (char *));
906 scm_memory_error (proc
);
907 for (i
= 0; !SCM_NULLP (envlist
); ++i
, envlist
= SCM_CDR (envlist
))
909 SCM str
= SCM_CAR (envlist
);
913 SCM_ASSERT (SCM_STRINGP (str
), envlist
, arg
, proc
);
914 len
= SCM_STRING_LENGTH (str
);
915 src
= SCM_STRING_CHARS (str
);
916 result
[i
] = malloc (len
+ 1);
917 if (result
[i
] == NULL
)
918 scm_memory_error (proc
);
919 memcpy (result
[i
], src
, len
);
926 SCM_DEFINE (scm_execle
, "execle", 2, 0, 1,
927 (SCM filename
, SCM env
, SCM args
),
928 "Similar to @code{execl}, but the environment of the new process is\n"
929 "specified by @var{env}, which must be a list of strings as returned by the\n"
930 "@code{environ} procedure.\n\n"
931 "This procedure is currently implemented using the @code{execve} system\n"
932 "call, but we call it @code{execle} because of its Scheme calling interface.")
933 #define FUNC_NAME s_scm_execle
938 SCM_VALIDATE_STRING (1, filename
);
939 SCM_STRING_COERCE_0TERMINATION_X (filename
);
941 execargv
= scm_convert_exec_args (args
, SCM_ARG1
, FUNC_NAME
);
942 exec_env
= environ_list_to_c (env
, SCM_ARG2
, FUNC_NAME
);
943 execve (SCM_STRING_CHARS (filename
), execargv
, exec_env
);
950 SCM_DEFINE (scm_fork
, "primitive-fork", 0, 0, 0,
952 "Creates a new \"child\" process by duplicating the current \"parent\" process.\n"
953 "In the child the return value is 0. In the parent the return value is\n"
954 "the integer process ID of the child.\n\n"
955 "This procedure has been renamed from @code{fork} to avoid a naming conflict\n"
956 "with the scsh fork.")
957 #define FUNC_NAME s_scm_fork
963 return SCM_MAKINUM (0L+pid
);
968 SCM_DEFINE (scm_uname
, "uname", 0, 0, 0,
970 "Return an object with some information about the computer\n"
971 "system the program is running on.")
972 #define FUNC_NAME s_scm_uname
975 SCM ans
= scm_c_make_vector (5, SCM_UNSPECIFIED
);
976 SCM
*ve
= SCM_VELTS (ans
);
977 if (uname (&buf
) < 0)
979 ve
[0] = scm_makfrom0str (buf
.sysname
);
980 ve
[1] = scm_makfrom0str (buf
.nodename
);
981 ve
[2] = scm_makfrom0str (buf
.release
);
982 ve
[3] = scm_makfrom0str (buf
.version
);
983 ve
[4] = scm_makfrom0str (buf
.machine
);
986 ve[5] = scm_makfrom0str (buf.domainname);
991 #endif /* HAVE_UNAME */
993 SCM_DEFINE (scm_environ
, "environ", 0, 1, 0,
995 "If @var{env} is omitted, return the current environment (in the\n"
996 "Unix sense) as a list of strings. Otherwise set the current\n"
997 "environment, which is also the default environment for child\n"
998 "processes, to the supplied list of strings. Each member of\n"
999 "@var{env} should be of the form @code{NAME=VALUE} and values of\n"
1000 "@code{NAME} should not be duplicated. If @var{env} is supplied\n"
1001 "then the return value is unspecified.")
1002 #define FUNC_NAME s_scm_environ
1004 if (SCM_UNBNDP (env
))
1005 return scm_makfromstrs (-1, environ
);
1010 new_environ
= environ_list_to_c (env
, SCM_ARG1
, FUNC_NAME
);
1011 /* Free the old environment, except when called for the first
1016 static int first
= 1;
1019 for (ep
= environ
; *ep
!= NULL
; ep
++)
1021 free ((char *) environ
);
1025 environ
= new_environ
;
1026 return SCM_UNSPECIFIED
;
1033 SCM_DEFINE (scm_tmpnam
, "tmpnam", 0, 0, 0,
1035 "Return a name in the file system that does not match any\n"
1036 "existing file. However there is no guarantee that another\n"
1037 "process will not create the file after @code{tmpnam} is called.\n"
1038 "Care should be taken if opening the file, e.g., use the\n"
1039 "@code{O_EXCL} open flag or use @code{mkstemp!} instead.")
1040 #define FUNC_NAME s_scm_tmpnam
1042 char name
[L_tmpnam
];
1045 SCM_SYSCALL (rv
= tmpnam (name
));
1047 /* not SCM_SYSERROR since errno probably not set. */
1048 SCM_MISC_ERROR ("tmpnam failed", SCM_EOL
);
1049 return scm_makfrom0str (name
);
1055 SCM_DEFINE (scm_mkstemp
, "mkstemp!", 1, 0, 0,
1057 "Create a new unique file in the file system and returns a new\n"
1058 "buffered port open for reading and writing to the file.\n"
1059 "@var{tmpl} is a string specifying where the file should be\n"
1060 "created: it must end with @code{XXXXXX} and will be changed in\n"
1061 "place to return the name of the temporary file.")
1062 #define FUNC_NAME s_scm_mkstemp
1067 SCM_STRING_COERCE_0TERMINATION_X (tmpl
);
1068 SCM_VALIDATE_STRING_COPY (1, tmpl
, c_tmpl
);
1069 SCM_SYSCALL (rv
= mkstemp (c_tmpl
));
1072 return scm_fdes_to_port (rv
, "w+", tmpl
);
1076 SCM_DEFINE (scm_utime
, "utime", 1, 2, 0,
1077 (SCM pathname
, SCM actime
, SCM modtime
),
1078 "@code{utime} sets the access and modification times for the\n"
1079 "file named by @var{path}. If @var{actime} or @var{modtime} is\n"
1080 "not supplied, then the current time is used. @var{actime} and\n"
1081 "@var{modtime} must be integer time values as returned by the\n"
1082 "@code{current-time} procedure.\n"
1084 "(utime \"foo\" (- (current-time) 3600))\n"
1086 "will set the access time to one hour in the past and the\n"
1087 "modification time to the current time.")
1088 #define FUNC_NAME s_scm_utime
1091 struct utimbuf utm_tmp
;
1093 SCM_VALIDATE_STRING (1, pathname
);
1094 SCM_STRING_COERCE_0TERMINATION_X (pathname
);
1095 if (SCM_UNBNDP (actime
))
1096 SCM_SYSCALL (time (&utm_tmp
.actime
));
1098 utm_tmp
.actime
= SCM_NUM2ULONG (2, actime
);
1100 if (SCM_UNBNDP (modtime
))
1101 SCM_SYSCALL (time (&utm_tmp
.modtime
));
1103 utm_tmp
.modtime
= SCM_NUM2ULONG (3, modtime
);
1105 SCM_SYSCALL (rv
= utime (SCM_STRING_CHARS (pathname
), &utm_tmp
));
1108 return SCM_UNSPECIFIED
;
1112 SCM_DEFINE (scm_access
, "access?", 2, 0, 0,
1113 (SCM path
, SCM how
),
1114 "Return @code{#t} if @var{path} corresponds to an existing file\n"
1115 "and the current process has the type of access specified by\n"
1116 "@var{how}, otherwise @code{#f}. @var{how} should be specified\n"
1117 "using the values of the variables listed below. Multiple\n"
1118 "values can be combined using a bitwise or, in which case\n"
1119 "@code{#t} will only be returned if all accesses are granted.\n"
1121 "Permissions are checked using the real id of the current\n"
1122 "process, not the effective id, although it's the effective id\n"
1123 "which determines whether the access would actually be granted.\n"
1126 "test for read permission.\n"
1129 "test for write permission.\n"
1132 "test for execute permission.\n"
1135 "test for existence of the file.\n"
1137 #define FUNC_NAME s_scm_access
1141 SCM_VALIDATE_STRING (1, path
);
1142 SCM_STRING_COERCE_0TERMINATION_X (path
);
1143 SCM_VALIDATE_INUM (2, how
);
1144 rv
= access (SCM_STRING_CHARS (path
), SCM_INUM (how
));
1145 return SCM_NEGATE_BOOL(rv
);
1149 SCM_DEFINE (scm_getpid
, "getpid", 0, 0, 0,
1151 "Return an integer representing the current process ID.")
1152 #define FUNC_NAME s_scm_getpid
1154 return SCM_MAKINUM ((unsigned long) getpid ());
1158 SCM_DEFINE (scm_putenv
, "putenv", 1, 0, 0,
1160 "Modifies the environment of the current process, which is\n"
1161 "also the default environment inherited by child processes.\n\n"
1162 "If @var{string} is of the form @code{NAME=VALUE} then it will be written\n"
1163 "directly into the environment, replacing any existing environment string\n"
1165 "name matching @code{NAME}. If @var{string} does not contain an equal\n"
1166 "sign, then any existing string with name matching @var{string} will\n"
1168 "The return value is unspecified.")
1169 #define FUNC_NAME s_scm_putenv
1174 SCM_VALIDATE_STRING (1, str
);
1175 /* must make a new copy to be left in the environment, safe from gc. */
1176 ptr
= malloc (SCM_STRING_LENGTH (str
) + 1);
1179 strncpy (ptr
, SCM_STRING_CHARS (str
), SCM_STRING_LENGTH (str
));
1180 ptr
[SCM_STRING_LENGTH (str
)] = 0;
1184 return SCM_UNSPECIFIED
;
1188 #ifdef HAVE_SETLOCALE
1189 SCM_DEFINE (scm_setlocale
, "setlocale", 1, 1, 0,
1190 (SCM category
, SCM locale
),
1191 "If @var{locale} is omitted, return the current value of the\n"
1192 "specified locale category as a system-dependent string.\n"
1193 "@var{category} should be specified using the values\n"
1194 "@code{LC_COLLATE}, @code{LC_ALL} etc.\n"
1196 "Otherwise the specified locale category is set to the string\n"
1197 "@var{locale} and the new value is returned as a\n"
1198 "system-dependent string. If @var{locale} is an empty string,\n"
1199 "the locale will be set using envirionment variables.")
1200 #define FUNC_NAME s_scm_setlocale
1205 SCM_VALIDATE_INUM (1,category
);
1206 if (SCM_UNBNDP (locale
))
1212 SCM_VALIDATE_STRING (2, locale
);
1213 SCM_STRING_COERCE_0TERMINATION_X (locale
);
1214 clocale
= SCM_STRING_CHARS (locale
);
1217 rv
= setlocale (SCM_INUM (category
), clocale
);
1220 return scm_makfrom0str (rv
);
1223 #endif /* HAVE_SETLOCALE */
1226 SCM_DEFINE (scm_mknod
, "mknod", 4, 0, 0,
1227 (SCM path
, SCM type
, SCM perms
, SCM dev
),
1228 "Creates a new special file, such as a file corresponding to a device.\n"
1229 "@var{path} specifies the name of the file. @var{type} should\n"
1230 "be one of the following symbols:\n"
1231 "regular, directory, symlink, block-special, char-special,\n"
1232 "fifo, or socket. @var{perms} (an integer) specifies the file permissions.\n"
1233 "@var{dev} (an integer) specifies which device the special file refers\n"
1234 "to. Its exact interpretation depends on the kind of special file\n"
1235 "being created.\n\n"
1238 "(mknod \"/dev/fd0\" 'block-special #o660 (+ (* 2 256) 2))\n"
1240 "The return value is unspecified.")
1241 #define FUNC_NAME s_scm_mknod
1247 SCM_VALIDATE_STRING (1, path
);
1248 SCM_VALIDATE_SYMBOL (2,type
);
1249 SCM_VALIDATE_INUM (3,perms
);
1250 SCM_VALIDATE_INUM (4,dev
);
1251 SCM_STRING_COERCE_0TERMINATION_X (path
);
1253 p
= SCM_SYMBOL_CHARS (type
);
1254 if (strcmp (p
, "regular") == 0)
1256 else if (strcmp (p
, "directory") == 0)
1258 else if (strcmp (p
, "symlink") == 0)
1260 else if (strcmp (p
, "block-special") == 0)
1262 else if (strcmp (p
, "char-special") == 0)
1264 else if (strcmp (p
, "fifo") == 0)
1267 else if (strcmp (p
, "socket") == 0)
1271 SCM_OUT_OF_RANGE (2,type
);
1273 SCM_SYSCALL (val
= mknod (SCM_STRING_CHARS (path
), ctype
| SCM_INUM (perms
),
1277 return SCM_UNSPECIFIED
;
1280 #endif /* HAVE_MKNOD */
1283 SCM_DEFINE (scm_nice
, "nice", 1, 0, 0,
1285 "Increment the priority of the current process by @var{incr}. A higher\n"
1286 "priority value means that the process runs less often.\n"
1287 "The return value is unspecified.")
1288 #define FUNC_NAME s_scm_nice
1290 SCM_VALIDATE_INUM (1,incr
);
1291 if (nice(SCM_INUM(incr
)) != 0)
1293 return SCM_UNSPECIFIED
;
1296 #endif /* HAVE_NICE */
1299 SCM_DEFINE (scm_sync
, "sync", 0, 0, 0,
1301 "Flush the operating system disk buffers.\n"
1302 "The return value is unspecified.")
1303 #define FUNC_NAME s_scm_sync
1306 return SCM_UNSPECIFIED
;
1309 #endif /* HAVE_SYNC */
1311 #if HAVE_LIBCRYPT && HAVE_CRYPT_H
1312 SCM_DEFINE (scm_crypt
, "crypt", 2, 0, 0,
1313 (SCM key
, SCM salt
),
1314 "Encrypt @var{key} using @var{salt} as the salt value to the\n"
1315 "crypt(3) library call\n")
1316 #define FUNC_NAME s_scm_crypt
1320 SCM_VALIDATE_STRING (1, key
);
1321 SCM_VALIDATE_STRING (2, salt
);
1322 SCM_STRING_COERCE_0TERMINATION_X (key
);
1323 SCM_STRING_COERCE_0TERMINATION_X (salt
);
1325 p
= crypt (SCM_STRING_CHARS (key
), SCM_STRING_CHARS (salt
));
1326 return scm_makfrom0str (p
);
1329 #endif /* HAVE_LIBCRYPT && HAVE_CRYPT_H */
1332 SCM_DEFINE (scm_chroot
, "chroot", 1, 0, 0,
1334 "Change the root directory to that specified in @var{path}.\n"
1335 "This directory will be used for path names beginning with\n"
1336 "@file{/}. The root directory is inherited by all children\n"
1337 "of the current process. Only the superuser may change the\n"
1339 #define FUNC_NAME s_scm_chroot
1341 SCM_VALIDATE_STRING (1, path
);
1342 SCM_STRING_COERCE_0TERMINATION_X (path
);
1344 if (chroot (SCM_STRING_CHARS (path
)) == -1)
1346 return SCM_UNSPECIFIED
;
1349 #endif /* HAVE_CHROOT */
1352 SCM_DEFINE (scm_getlogin
, "getlogin", 0, 0, 0,
1354 "Return a string containing the name of the user logged in on\n"
1355 "the controlling terminal of the process, or @code{#f} if this\n"
1356 "information cannot be obtained.")
1357 #define FUNC_NAME s_scm_getlogin
1364 return scm_makfrom0str (p
);
1367 #endif /* HAVE_GETLOGIN */
1370 SCM_DEFINE (scm_cuserid
, "cuserid", 0, 0, 0,
1372 "Return a string containing a user name associated with the\n"
1373 "effective user id of the process. Return @code{#f} if this\n"
1374 "information cannot be obtained.")
1375 #define FUNC_NAME s_scm_cuserid
1382 return scm_makfrom0str (p
);
1385 #endif /* HAVE_CUSERID */
1387 #if HAVE_GETPRIORITY
1388 SCM_DEFINE (scm_getpriority
, "getpriority", 2, 0, 0,
1389 (SCM which
, SCM who
),
1390 "Return the scheduling priority of the process, process group\n"
1391 "or user, as indicated by @var{which} and @var{who}. @var{which}\n"
1392 "is one of the variables @code{PRIO_PROCESS}, @code{PRIO_PGRP}\n"
1393 "or @code{PRIO_USER}, and @var{who} is interpreted relative to\n"
1394 "@var{which} (a process identifier for @code{PRIO_PROCESS},\n"
1395 "process group identifier for @code{PRIO_PGRP}, and a user\n"
1396 "identifier for @code{PRIO_USER}. A zero value of @var{who}\n"
1397 "denotes the current process, process group, or user. Return\n"
1398 "the highest priority (lowest numerical value) of any of the\n"
1399 "specified processes.")
1400 #define FUNC_NAME s_scm_getpriority
1402 int cwhich
, cwho
, ret
;
1404 SCM_VALIDATE_INUM_COPY (1, which
, cwhich
);
1405 SCM_VALIDATE_INUM_COPY (2, who
, cwho
);
1407 /* We have to clear errno and examine it later, because -1 is a
1408 legal return value for getpriority(). */
1410 ret
= getpriority (cwhich
, cwho
);
1413 return SCM_MAKINUM (ret
);
1416 #endif /* HAVE_GETPRIORITY */
1418 #if HAVE_SETPRIORITY
1419 SCM_DEFINE (scm_setpriority
, "setpriority", 3, 0, 0,
1420 (SCM which
, SCM who
, SCM prio
),
1421 "Set the scheduling priority of the process, process group\n"
1422 "or user, as indicated by @var{which} and @var{who}. @var{which}\n"
1423 "is one of the variables @code{PRIO_PROCESS}, @code{PRIO_PGRP}\n"
1424 "or @code{PRIO_USER}, and @var{who} is interpreted relative to\n"
1425 "@var{which} (a process identifier for @code{PRIO_PROCESS},\n"
1426 "process group identifier for @code{PRIO_PGRP}, and a user\n"
1427 "identifier for @code{PRIO_USER}. A zero value of @var{who}\n"
1428 "denotes the current process, process group, or user.\n"
1429 "@var{prio} is a value in the range -20 and 20, the default\n"
1430 "priority is 0; lower priorities cause more favorable\n"
1431 "scheduling. Sets the priority of all of the specified\n"
1432 "processes. Only the super-user may lower priorities.\n"
1433 "The return value is not specified.")
1434 #define FUNC_NAME s_scm_setpriority
1436 int cwhich
, cwho
, cprio
;
1438 SCM_VALIDATE_INUM_COPY (1, which
, cwhich
);
1439 SCM_VALIDATE_INUM_COPY (2, who
, cwho
);
1440 SCM_VALIDATE_INUM_COPY (3, prio
, cprio
);
1442 if (setpriority (cwhich
, cwho
, cprio
) == -1)
1444 return SCM_UNSPECIFIED
;
1447 #endif /* HAVE_SETPRIORITY */
1450 SCM_DEFINE (scm_getpass
, "getpass", 1, 0, 0,
1452 "Display @var{prompt} to the standard error output and read\n"
1453 "a password from @file{/dev/tty}. If this file is not\n"
1454 "accessible, it reads from standard input. The password may be\n"
1455 "up to 127 characters in length. Additional characters and the\n"
1456 "terminating newline character are discarded. While reading\n"
1457 "the password, echoing and the generation of signals by special\n"
1458 "characters is disabled.")
1459 #define FUNC_NAME s_scm_getpass
1464 SCM_VALIDATE_STRING (1, prompt
);
1465 SCM_STRING_COERCE_0TERMINATION_X (prompt
);
1467 p
= getpass(SCM_STRING_CHARS (prompt
));
1468 passwd
= scm_makfrom0str (p
);
1470 /* Clear out the password in the static buffer. */
1471 memset (p
, 0, strlen (p
));
1476 #endif /* HAVE_GETPASS */
1479 SCM_DEFINE (scm_flock
, "flock", 2, 0, 0,
1480 (SCM file
, SCM operation
),
1481 "Apply or remove an advisory lock on an open file.\n"
1482 "@var{operation} specifies the action to be done:\n"
1485 "Shared lock. More than one process may hold a shared lock\n"
1486 "for a given file at a given time.\n"
1488 "Exclusive lock. Only one process may hold an exclusive lock\n"
1489 "for a given file at a given time.\n"
1491 "Unlock the file.\n"
1493 "Don't block when locking. May be specified by bitwise OR'ing\n"
1494 "it to one of the other operations.\n"
1496 "The return value is not specified. @var{file} may be an open\n"
1497 "file descriptor or an open file descriptior port.")
1498 #define FUNC_NAME s_scm_flock
1500 int coperation
, fdes
;
1502 if (SCM_INUMP (file
))
1503 fdes
= SCM_INUM (file
);
1506 SCM_VALIDATE_OPFPORT (2, file
);
1508 fdes
= SCM_FPORT_FDES (file
);
1510 SCM_VALIDATE_INUM_COPY (2, operation
, coperation
);
1511 if (flock (fdes
, coperation
) == -1)
1513 return SCM_UNSPECIFIED
;
1516 #endif /* HAVE_FLOCK */
1518 #if HAVE_SETHOSTNAME
1519 SCM_DEFINE (scm_sethostname
, "sethostname", 1, 0, 0,
1521 "Set the host name of the current processor to @var{name}. May\n"
1522 "only be used by the superuser. The return value is not\n"
1524 #define FUNC_NAME s_scm_sethostname
1526 SCM_VALIDATE_STRING (1, name
);
1527 SCM_STRING_COERCE_0TERMINATION_X (name
);
1529 if (sethostname (SCM_STRING_CHARS (name
), SCM_STRING_LENGTH (name
)) == -1)
1531 return SCM_UNSPECIFIED
;
1534 #endif /* HAVE_SETHOSTNAME */
1536 #if HAVE_GETHOSTNAME
1537 SCM_DEFINE (scm_gethostname
, "gethostname", 0, 0, 0,
1539 "Return the host name of the current processor.")
1540 #define FUNC_NAME s_scm_gethostname
1542 /* 256 is for Solaris, under Linux ENAMETOOLONG is returned if not
1545 char *p
= scm_must_malloc (len
, "gethostname");
1548 res
= gethostname (p
, len
);
1549 while (res
== -1 && errno
== ENAMETOOLONG
)
1551 p
= scm_must_realloc (p
, len
, len
* 2, "gethostname");
1553 res
= gethostname (p
, len
);
1560 name
= scm_makfrom0str (p
);
1565 #endif /* HAVE_GETHOSTNAME */
1570 scm_add_feature ("posix");
1572 scm_add_feature ("EIDs");
1575 scm_c_define ("WAIT_ANY", SCM_MAKINUM (WAIT_ANY
));
1578 scm_c_define ("WAIT_MYPGRP", SCM_MAKINUM (WAIT_MYPGRP
));
1581 scm_c_define ("WNOHANG", SCM_MAKINUM (WNOHANG
));
1584 scm_c_define ("WUNTRACED", SCM_MAKINUM (WUNTRACED
));
1587 /* access() symbols. */
1588 scm_c_define ("R_OK", SCM_MAKINUM (R_OK
));
1589 scm_c_define ("W_OK", SCM_MAKINUM (W_OK
));
1590 scm_c_define ("X_OK", SCM_MAKINUM (X_OK
));
1591 scm_c_define ("F_OK", SCM_MAKINUM (F_OK
));
1594 scm_c_define ("LC_COLLATE", SCM_MAKINUM (LC_COLLATE
));
1597 scm_c_define ("LC_CTYPE", SCM_MAKINUM (LC_CTYPE
));
1600 scm_c_define ("LC_MONETARY", SCM_MAKINUM (LC_MONETARY
));
1603 scm_c_define ("LC_NUMERIC", SCM_MAKINUM (LC_NUMERIC
));
1606 scm_c_define ("LC_TIME", SCM_MAKINUM (LC_TIME
));
1609 scm_c_define ("LC_MESSAGES", SCM_MAKINUM (LC_MESSAGES
));
1612 scm_c_define ("LC_ALL", SCM_MAKINUM (LC_ALL
));
1615 scm_c_define ("PIPE_BUF", scm_long2num (PIPE_BUF
));
1619 scm_c_define ("PRIO_PROCESS", SCM_MAKINUM (PRIO_PROCESS
));
1622 scm_c_define ("PRIO_PGRP", SCM_MAKINUM (PRIO_PGRP
));
1625 scm_c_define ("PRIO_USER", SCM_MAKINUM (PRIO_USER
));
1629 scm_c_define ("LOCK_SH", SCM_MAKINUM (LOCK_SH
));
1632 scm_c_define ("LOCK_EX", SCM_MAKINUM (LOCK_EX
));
1635 scm_c_define ("LOCK_UN", SCM_MAKINUM (LOCK_UN
));
1638 scm_c_define ("LOCK_NB", SCM_MAKINUM (LOCK_NB
));
1641 #include "libguile/cpp_sig_symbols.c"
1642 #ifndef SCM_MAGIC_SNARFER
1643 #include "libguile/posix.x"