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. */
45 /* Make GNU/Linux libc declare everything it has. */
51 #include "libguile/_scm.h"
52 #include "libguile/fports.h"
53 #include "libguile/scmsigs.h"
54 #include "libguile/feature.h"
55 #include "libguile/strings.h"
56 #include "libguile/vectors.h"
58 #include "libguile/validate.h"
59 #include "libguile/posix.h"
65 #ifdef TIME_WITH_SYS_TIME
66 # include <sys/time.h>
70 # include <sys/time.h>
80 extern char *ttyname();
84 #ifdef LIBC_H_WITH_UNISTD_H
88 #include <sys/types.h>
98 #ifdef HAVE_WINSOCK2_H
103 /* Some defines for Windows here. */
104 # include <process.h>
105 # define pipe(fd) _pipe (fd, 256, O_BINARY)
106 #endif /* __MINGW32__ */
109 # include <sys/wait.h>
112 # define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
115 # define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
120 extern char ** environ
;
125 #ifdef HAVE_SYS_UTSNAME_H
126 #include <sys/utsname.h>
131 # define NAMLEN(dirent) strlen((dirent)->d_name)
133 # define dirent direct
134 # define NAMLEN(dirent) (dirent)->d_namlen
136 # include <sys/ndir.h>
139 # include <sys/dir.h>
146 #ifdef HAVE_SETLOCALE
150 #if HAVE_LIBCRYPT && HAVE_CRYPT_H
154 #if HAVE_SYS_RESOURCE_H
155 # include <sys/resource.h>
159 # include <sys/file.h>
162 /* Some Unix systems don't define these. CPP hair is dangerous, but
163 this seems safe enough... */
180 /* On NextStep, <utime.h> doesn't define struct utime, unless we
181 #define _POSIX_SOURCE before #including it. I think this is less
182 of a kludge than defining struct utimbuf ourselves. */
183 #ifdef UTIMBUF_NEEDS_POSIX
184 #define _POSIX_SOURCE
187 #ifdef HAVE_SYS_UTIME_H
188 #include <sys/utime.h>
195 /* Please don't add any more #includes or #defines here. The hack
196 above means that _POSIX_SOURCE may be #defined, which will
197 encourage header files to do strange things. */
200 SCM_SYMBOL (sym_read_pipe
, "read pipe");
201 SCM_SYMBOL (sym_write_pipe
, "write pipe");
203 SCM_DEFINE (scm_pipe
, "pipe", 0, 0, 0,
205 "Return a newly created pipe: a pair of ports which are linked\n"
206 "together on the local machine. The @emph{car} is the input\n"
207 "port and the @emph{cdr} is the output port. Data written (and\n"
208 "flushed) to the output port can be read from the input port.\n"
209 "Pipes are commonly used for communication with a newly forked\n"
210 "child process. The need to flush the output port can be\n"
211 "avoided by making it unbuffered using @code{setvbuf}.\n"
213 "Writes occur atomically provided the size of the data in bytes\n"
214 "is not greater than the value of @code{PIPE_BUF}. Note that\n"
215 "the output port is likely to block if too much data (typically\n"
216 "equal to @code{PIPE_BUF}) has been written but not yet read\n"
217 "from the input port.")
218 #define FUNC_NAME s_scm_pipe
227 p_rd
= scm_fdes_to_port (fd
[0], "r", sym_read_pipe
);
228 p_wt
= scm_fdes_to_port (fd
[1], "w", sym_write_pipe
);
229 return scm_cons (p_rd
, p_wt
);
234 #ifdef HAVE_GETGROUPS
235 SCM_DEFINE (scm_getgroups
, "getgroups", 0, 0, 0,
237 "Return a vector of integers representing the current\n"
238 "supplimentary group IDs.")
239 #define FUNC_NAME s_scm_getgroups
246 ngroups
= getgroups (0, NULL
);
250 size
= ngroups
* sizeof (GETGROUPS_T
);
251 groups
= scm_must_malloc (size
, FUNC_NAME
);
252 getgroups (ngroups
, groups
);
254 ans
= scm_c_make_vector (ngroups
, SCM_UNDEFINED
);
255 while (--ngroups
>= 0)
256 SCM_VELTS (ans
) [ngroups
] = SCM_MAKINUM (groups
[ngroups
]);
258 scm_must_free (groups
);
259 scm_done_free (size
);
267 SCM_DEFINE (scm_getpwuid
, "getpw", 0, 1, 0,
269 "Look up an entry in the user database. @var{obj} can be an integer,\n"
270 "a string, or omitted, giving the behaviour of getpwuid, getpwnam\n"
271 "or getpwent respectively.")
272 #define FUNC_NAME s_scm_getpwuid
275 struct passwd
*entry
;
278 result
= scm_c_make_vector (7, SCM_UNSPECIFIED
);
279 ve
= SCM_VELTS (result
);
280 if (SCM_UNBNDP (user
) || SCM_FALSEP (user
))
282 SCM_SYSCALL (entry
= getpwent ());
288 else if (SCM_INUMP (user
))
290 entry
= getpwuid (SCM_INUM (user
));
294 SCM_VALIDATE_STRING (1, user
);
295 entry
= getpwnam (SCM_STRING_CHARS (user
));
298 SCM_MISC_ERROR ("entry not found", SCM_EOL
);
300 ve
[0] = scm_makfrom0str (entry
->pw_name
);
301 ve
[1] = scm_makfrom0str (entry
->pw_passwd
);
302 ve
[2] = scm_ulong2num ((unsigned long) entry
->pw_uid
);
303 ve
[3] = scm_ulong2num ((unsigned long) entry
->pw_gid
);
304 ve
[4] = scm_makfrom0str (entry
->pw_gecos
);
306 ve
[5] = scm_makfrom0str ("");
308 ve
[5] = scm_makfrom0str (entry
->pw_dir
);
309 if (!entry
->pw_shell
)
310 ve
[6] = scm_makfrom0str ("");
312 ve
[6] = scm_makfrom0str (entry
->pw_shell
);
316 #endif /* HAVE_GETPWENT */
320 SCM_DEFINE (scm_setpwent
, "setpw", 0, 1, 0,
322 "If called with a true argument, initialize or reset the password data\n"
323 "stream. Otherwise, close the stream. The @code{setpwent} and\n"
324 "@code{endpwent} procedures are implemented on top of this.")
325 #define FUNC_NAME s_scm_setpwent
327 if (SCM_UNBNDP (arg
) || SCM_FALSEP (arg
))
331 return SCM_UNSPECIFIED
;
338 /* Combines getgrgid and getgrnam. */
339 SCM_DEFINE (scm_getgrgid
, "getgr", 0, 1, 0,
341 "Look up an entry in the group database. @var{obj} can be an integer,\n"
342 "a string, or omitted, giving the behaviour of getgrgid, getgrnam\n"
343 "or getgrent respectively.")
344 #define FUNC_NAME s_scm_getgrgid
349 result
= scm_c_make_vector (4, SCM_UNSPECIFIED
);
350 ve
= SCM_VELTS (result
);
351 if (SCM_UNBNDP (name
) || SCM_FALSEP (name
))
353 SCM_SYSCALL (entry
= getgrent ());
359 else if (SCM_INUMP (name
))
360 SCM_SYSCALL (entry
= getgrgid (SCM_INUM (name
)));
363 SCM_VALIDATE_STRING (1, name
);
364 SCM_SYSCALL (entry
= getgrnam (SCM_STRING_CHARS (name
)));
369 ve
[0] = scm_makfrom0str (entry
->gr_name
);
370 ve
[1] = scm_makfrom0str (entry
->gr_passwd
);
371 ve
[2] = scm_ulong2num ((unsigned long) entry
->gr_gid
);
372 ve
[3] = scm_makfromstrs (-1, entry
->gr_mem
);
379 SCM_DEFINE (scm_setgrent
, "setgr", 0, 1, 0,
381 "If called with a true argument, initialize or reset the group data\n"
382 "stream. Otherwise, close the stream. The @code{setgrent} and\n"
383 "@code{endgrent} procedures are implemented on top of this.")
384 #define FUNC_NAME s_scm_setgrent
386 if (SCM_UNBNDP (arg
) || SCM_FALSEP (arg
))
390 return SCM_UNSPECIFIED
;
393 #endif /* HAVE_GETGRENT */
396 SCM_DEFINE (scm_kill
, "kill", 2, 0, 0,
398 "Sends a signal to the specified process or group of processes.\n\n"
399 "@var{pid} specifies the processes to which the signal is sent:\n\n"
401 "@item @var{pid} greater than 0\n"
402 "The process whose identifier is @var{pid}.\n"
403 "@item @var{pid} equal to 0\n"
404 "All processes in the current process group.\n"
405 "@item @var{pid} less than -1\n"
406 "The process group whose identifier is -@var{pid}\n"
407 "@item @var{pid} equal to -1\n"
408 "If the process is privileged, all processes except for some special\n"
409 "system processes. Otherwise, all processes with the current effective\n"
412 "@var{sig} should be specified using a variable corresponding to\n"
413 "the Unix symbolic name, e.g.,\n\n"
418 "Interrupt signal.\n"
420 #define FUNC_NAME s_scm_kill
422 SCM_VALIDATE_INUM (1,pid
);
423 SCM_VALIDATE_INUM (2,sig
);
424 /* Signal values are interned in scm_init_posix(). */
426 if (kill ((int) SCM_INUM (pid
), (int) SCM_INUM (sig
)) != 0)
428 if ((int) SCM_INUM (pid
) == getpid ())
429 if (raise ((int) SCM_INUM (sig
)) != 0)
432 return SCM_UNSPECIFIED
;
437 SCM_DEFINE (scm_waitpid
, "waitpid", 1, 1, 0,
438 (SCM pid
, SCM options
),
439 "This procedure collects status information from a child process which\n"
440 "has terminated or (optionally) stopped. Normally it will\n"
441 "suspend the calling process until this can be done. If more than one\n"
442 "child process is eligible then one will be chosen by the operating system.\n\n"
443 "The value of @var{pid} determines the behaviour:\n\n"
445 "@item @var{pid} greater than 0\n"
446 "Request status information from the specified child process.\n"
447 "@item @var{pid} equal to -1 or WAIT_ANY\n"
448 "Request status information for any child process.\n"
449 "@item @var{pid} equal to 0 or WAIT_MYPGRP\n"
450 "Request status information for any child process in the current process\n"
452 "@item @var{pid} less than -1\n"
453 "Request status information for any child process whose process group ID\n"
456 "The @var{options} argument, if supplied, should be the bitwise OR of the\n"
457 "values of zero or more of the following variables:\n\n"
459 "Return immediately even if there are no child processes to be collected.\n"
461 "@defvar WUNTRACED\n"
462 "Report status information for stopped processes as well as terminated\n"
465 "The return value is a pair containing:\n\n"
468 "The process ID of the child process, or 0 if @code{WNOHANG} was\n"
469 "specified and no process was collected.\n"
471 "The integer status value.\n"
473 #define FUNC_NAME s_scm_waitpid
478 SCM_VALIDATE_INUM (1,pid
);
479 if (SCM_UNBNDP (options
))
483 SCM_VALIDATE_INUM (2,options
);
484 /* Flags are interned in scm_init_posix. */
485 ioptions
= SCM_INUM (options
);
487 SCM_SYSCALL (i
= waitpid (SCM_INUM (pid
), &status
, ioptions
));
490 return scm_cons (SCM_MAKINUM (0L + i
), SCM_MAKINUM (0L + status
));
493 #endif /* HAVE_WAITPID */
496 SCM_DEFINE (scm_status_exit_val
, "status:exit-val", 1, 0, 0,
498 "Return the exit status value, as would be set if a process\n"
499 "ended normally through a call to @code{exit} or @code{_exit},\n"
500 "if any, otherwise @code{#f}.")
501 #define FUNC_NAME s_scm_status_exit_val
505 SCM_VALIDATE_INUM (1,status
);
507 /* On Ultrix, the WIF... macros assume their argument is an lvalue;
508 go figure. SCM_INUM does not yield an lvalue. */
509 lstatus
= SCM_INUM (status
);
510 if (WIFEXITED (lstatus
))
511 return (SCM_MAKINUM (WEXITSTATUS (lstatus
)));
517 SCM_DEFINE (scm_status_term_sig
, "status:term-sig", 1, 0, 0,
519 "Return the signal number which terminated the process, if any,\n"
520 "otherwise @code{#f}.")
521 #define FUNC_NAME s_scm_status_term_sig
525 SCM_VALIDATE_INUM (1,status
);
527 lstatus
= SCM_INUM (status
);
528 if (WIFSIGNALED (lstatus
))
529 return SCM_MAKINUM (WTERMSIG (lstatus
));
535 SCM_DEFINE (scm_status_stop_sig
, "status:stop-sig", 1, 0, 0,
537 "Return the signal number which stopped the process, if any,\n"
538 "otherwise @code{#f}.")
539 #define FUNC_NAME s_scm_status_stop_sig
543 SCM_VALIDATE_INUM (1,status
);
545 lstatus
= SCM_INUM (status
);
546 if (WIFSTOPPED (lstatus
))
547 return SCM_MAKINUM (WSTOPSIG (lstatus
));
552 #endif /* __MINGW32__ */
555 SCM_DEFINE (scm_getppid
, "getppid", 0, 0, 0,
557 "Return an integer representing the process ID of the parent\n"
559 #define FUNC_NAME s_scm_getppid
561 return SCM_MAKINUM (0L + getppid ());
564 #endif /* HAVE_GETPPID */
568 SCM_DEFINE (scm_getuid
, "getuid", 0, 0, 0,
570 "Return an integer representing the current real user ID.")
571 #define FUNC_NAME s_scm_getuid
573 return SCM_MAKINUM (0L + getuid ());
579 SCM_DEFINE (scm_getgid
, "getgid", 0, 0, 0,
581 "Return an integer representing the current real group ID.")
582 #define FUNC_NAME s_scm_getgid
584 return SCM_MAKINUM (0L + getgid ());
590 SCM_DEFINE (scm_geteuid
, "geteuid", 0, 0, 0,
592 "Return an integer representing the current effective user ID.\n"
593 "If the system does not support effective IDs, then the real ID\n"
594 "is returned. @code{(feature? 'EIDs)} reports whether the\n"
595 "system supports effective IDs.")
596 #define FUNC_NAME s_scm_geteuid
599 return SCM_MAKINUM (0L + geteuid ());
601 return SCM_MAKINUM (0L + getuid ());
607 SCM_DEFINE (scm_getegid
, "getegid", 0, 0, 0,
609 "Return an integer representing the current effective group ID.\n"
610 "If the system does not support effective IDs, then the real ID\n"
611 "is returned. @code{(feature? 'EIDs)} reports whether the\n"
612 "system supports effective IDs.")
613 #define FUNC_NAME s_scm_getegid
616 return SCM_MAKINUM (0L + getegid ());
618 return SCM_MAKINUM (0L + getgid ());
624 SCM_DEFINE (scm_setuid
, "setuid", 1, 0, 0,
626 "Sets both the real and effective user IDs to the integer @var{id}, provided\n"
627 "the process has appropriate privileges.\n"
628 "The return value is unspecified.")
629 #define FUNC_NAME s_scm_setuid
631 SCM_VALIDATE_INUM (1,id
);
632 if (setuid (SCM_INUM (id
)) != 0)
634 return SCM_UNSPECIFIED
;
638 SCM_DEFINE (scm_setgid
, "setgid", 1, 0, 0,
640 "Sets both the real and effective group IDs to the integer @var{id}, provided\n"
641 "the process has appropriate privileges.\n"
642 "The return value is unspecified.")
643 #define FUNC_NAME s_scm_setgid
645 SCM_VALIDATE_INUM (1,id
);
646 if (setgid (SCM_INUM (id
)) != 0)
648 return SCM_UNSPECIFIED
;
652 SCM_DEFINE (scm_seteuid
, "seteuid", 1, 0, 0,
654 "Sets the effective user ID to the integer @var{id}, provided the process\n"
655 "has appropriate privileges. If effective IDs are not supported, the\n"
656 "real ID is set instead -- @code{(feature? 'EIDs)} reports whether the\n"
657 "system supports effective IDs.\n"
658 "The return value is unspecified.")
659 #define FUNC_NAME s_scm_seteuid
663 SCM_VALIDATE_INUM (1,id
);
665 rv
= seteuid (SCM_INUM (id
));
667 rv
= setuid (SCM_INUM (id
));
671 return SCM_UNSPECIFIED
;
674 #endif /* __MINGW32__ */
678 SCM_DEFINE (scm_setegid
, "setegid", 1, 0, 0,
680 "Sets the effective group ID to the integer @var{id}, provided the process\n"
681 "has appropriate privileges. If effective IDs are not supported, the\n"
682 "real ID is set instead -- @code{(feature? 'EIDs)} reports whether the\n"
683 "system supports effective IDs.\n"
684 "The return value is unspecified.")
685 #define FUNC_NAME s_scm_setegid
689 SCM_VALIDATE_INUM (1,id
);
691 rv
= setegid (SCM_INUM (id
));
693 rv
= setgid (SCM_INUM (id
));
697 return SCM_UNSPECIFIED
;
705 SCM_DEFINE (scm_getpgrp
, "getpgrp", 0, 0, 0,
707 "Return an integer representing the current process group ID.\n"
708 "This is the POSIX definition, not BSD.")
709 #define FUNC_NAME s_scm_getpgrp
712 fn
= (int (*) ()) getpgrp
;
713 return SCM_MAKINUM (fn (0));
716 #endif /* HAVE_GETPGRP */
720 SCM_DEFINE (scm_setpgid
, "setpgid", 2, 0, 0,
722 "Move the process @var{pid} into the process group @var{pgid}. @var{pid} or\n"
723 "@var{pgid} must be integers: they can be zero to indicate the ID of the\n"
725 "Fails on systems that do not support job control.\n"
726 "The return value is unspecified.")
727 #define FUNC_NAME s_scm_setpgid
729 SCM_VALIDATE_INUM (1,pid
);
730 SCM_VALIDATE_INUM (2,pgid
);
731 /* FIXME(?): may be known as setpgrp. */
732 if (setpgid (SCM_INUM (pid
), SCM_INUM (pgid
)) != 0)
734 return SCM_UNSPECIFIED
;
737 #endif /* HAVE_SETPGID */
740 SCM_DEFINE (scm_setsid
, "setsid", 0, 0, 0,
742 "Creates a new session. The current process becomes the session leader\n"
743 "and is put in a new process group. The process will be detached\n"
744 "from its controlling terminal if it has one.\n"
745 "The return value is an integer representing the new process group ID.")
746 #define FUNC_NAME s_scm_setsid
748 pid_t sid
= setsid ();
751 return SCM_UNSPECIFIED
;
754 #endif /* HAVE_SETSID */
757 SCM_DEFINE (scm_ttyname
, "ttyname", 1, 0, 0,
759 "Return a string with the name of the serial terminal device\n"
760 "underlying @var{port}.")
761 #define FUNC_NAME s_scm_ttyname
766 port
= SCM_COERCE_OUTPORT (port
);
767 SCM_VALIDATE_OPPORT (1,port
);
768 if (!SCM_FPORTP (port
))
770 fd
= SCM_FPORT_FDES (port
);
771 SCM_SYSCALL (ans
= ttyname (fd
));
774 /* ans could be overwritten by another call to ttyname */
775 return (scm_makfrom0str (ans
));
778 #endif /* HAVE_TTYNAME */
781 SCM_DEFINE (scm_ctermid
, "ctermid", 0, 0, 0,
783 "Return a string containing the file name of the controlling\n"
784 "terminal for the current process.")
785 #define FUNC_NAME s_scm_ctermid
787 char *result
= ctermid (NULL
);
790 return scm_makfrom0str (result
);
793 #endif /* HAVE_CTERMID */
795 #ifdef HAVE_TCGETPGRP
796 SCM_DEFINE (scm_tcgetpgrp
, "tcgetpgrp", 1, 0, 0,
798 "Return the process group ID of the foreground process group\n"
799 "associated with the terminal open on the file descriptor\n"
800 "underlying @var{port}.\n"
802 "If there is no foreground process group, the return value is a\n"
803 "number greater than 1 that does not match the process group ID\n"
804 "of any existing process group. This can happen if all of the\n"
805 "processes in the job that was formerly the foreground job have\n"
806 "terminated, and no other job has yet been moved into the\n"
808 #define FUNC_NAME s_scm_tcgetpgrp
813 port
= SCM_COERCE_OUTPORT (port
);
815 SCM_VALIDATE_OPFPORT (1,port
);
816 fd
= SCM_FPORT_FDES (port
);
817 if ((pgid
= tcgetpgrp (fd
)) == -1)
819 return SCM_MAKINUM (pgid
);
822 #endif /* HAVE_TCGETPGRP */
824 #ifdef HAVE_TCSETPGRP
825 SCM_DEFINE (scm_tcsetpgrp
, "tcsetpgrp", 2, 0, 0,
826 (SCM port
, SCM pgid
),
827 "Set the foreground process group ID for the terminal used by the file\n"
828 "descriptor underlying @var{port} to the integer @var{pgid}.\n"
829 "The calling process\n"
830 "must be a member of the same session as @var{pgid} and must have the same\n"
831 "controlling terminal. The return value is unspecified.")
832 #define FUNC_NAME s_scm_tcsetpgrp
836 port
= SCM_COERCE_OUTPORT (port
);
838 SCM_VALIDATE_OPFPORT (1,port
);
839 SCM_VALIDATE_INUM (2,pgid
);
840 fd
= SCM_FPORT_FDES (port
);
841 if (tcsetpgrp (fd
, SCM_INUM (pgid
)) == -1)
843 return SCM_UNSPECIFIED
;
846 #endif /* HAVE_TCSETPGRP */
848 /* Create a new C argv array from a scheme list of strings. */
849 /* Dirk:FIXME:: A quite similar function is implemented in dynl.c */
850 /* Dirk:FIXME:: In case of assertion errors, we get memory leaks */
853 scm_convert_exec_args (SCM args
, int argn
, const char *subr
)
859 argc
= scm_ilength (args
);
860 SCM_ASSERT (argc
>= 0, args
, argn
, subr
);
861 argv
= (char **) scm_must_malloc ((argc
+ 1) * sizeof (char *), subr
);
862 for (i
= 0; !SCM_NULLP (args
); args
= SCM_CDR (args
), ++i
)
864 SCM arg
= SCM_CAR (args
);
869 SCM_ASSERT (SCM_STRINGP (arg
), args
, argn
, subr
);
870 len
= SCM_STRING_LENGTH (arg
);
871 src
= SCM_STRING_CHARS (arg
);
872 dst
= (char *) scm_must_malloc (len
+ 1, subr
);
873 memcpy (dst
, src
, len
);
881 SCM_DEFINE (scm_execl
, "execl", 1, 0, 1,
882 (SCM filename
, SCM args
),
883 "Executes the file named by @var{path} as a new process image.\n"
884 "The remaining arguments are supplied to the process; from a C program\n"
885 "they are accessable as the @code{argv} argument to @code{main}.\n"
886 "Conventionally the first @var{arg} is the same as @var{path}.\n"
887 "All arguments must be strings. \n\n"
888 "If @var{arg} is missing, @var{path} is executed with a null\n"
889 "argument list, which may have system-dependent side-effects.\n\n"
890 "This procedure is currently implemented using the @code{execv} system\n"
891 "call, but we call it @code{execl} because of its Scheme calling interface.")
892 #define FUNC_NAME s_scm_execl
895 SCM_VALIDATE_STRING (1, filename
);
896 execargv
= scm_convert_exec_args (args
, SCM_ARG2
, FUNC_NAME
);
897 execv (SCM_STRING_CHARS (filename
), execargv
);
904 SCM_DEFINE (scm_execlp
, "execlp", 1, 0, 1,
905 (SCM filename
, SCM args
),
906 "Similar to @code{execl}, however if\n"
907 "@var{filename} does not contain a slash\n"
908 "then the file to execute will be located by searching the\n"
909 "directories listed in the @code{PATH} environment variable.\n\n"
910 "This procedure is currently implemented using the @code{execvp} system\n"
911 "call, but we call it @code{execlp} because of its Scheme calling interface.")
912 #define FUNC_NAME s_scm_execlp
915 SCM_VALIDATE_STRING (1, filename
);
916 execargv
= scm_convert_exec_args (args
, SCM_ARG2
, FUNC_NAME
);
917 execvp (SCM_STRING_CHARS (filename
), execargv
);
925 environ_list_to_c (SCM envlist
, int arg
, const char *proc
)
931 num_strings
= scm_ilength (envlist
);
932 SCM_ASSERT (num_strings
>= 0, envlist
, arg
, proc
);
933 result
= (char **) malloc ((num_strings
+ 1) * sizeof (char *));
935 scm_memory_error (proc
);
936 for (i
= 0; !SCM_NULLP (envlist
); ++i
, envlist
= SCM_CDR (envlist
))
938 SCM str
= SCM_CAR (envlist
);
942 SCM_ASSERT (SCM_STRINGP (str
), envlist
, arg
, proc
);
943 len
= SCM_STRING_LENGTH (str
);
944 src
= SCM_STRING_CHARS (str
);
945 result
[i
] = malloc (len
+ 1);
946 if (result
[i
] == NULL
)
947 scm_memory_error (proc
);
948 memcpy (result
[i
], src
, len
);
955 SCM_DEFINE (scm_execle
, "execle", 2, 0, 1,
956 (SCM filename
, SCM env
, SCM args
),
957 "Similar to @code{execl}, but the environment of the new process is\n"
958 "specified by @var{env}, which must be a list of strings as returned by the\n"
959 "@code{environ} procedure.\n\n"
960 "This procedure is currently implemented using the @code{execve} system\n"
961 "call, but we call it @code{execle} because of its Scheme calling interface.")
962 #define FUNC_NAME s_scm_execle
967 SCM_VALIDATE_STRING (1, filename
);
969 execargv
= scm_convert_exec_args (args
, SCM_ARG1
, FUNC_NAME
);
970 exec_env
= environ_list_to_c (env
, SCM_ARG2
, FUNC_NAME
);
971 execve (SCM_STRING_CHARS (filename
), execargv
, exec_env
);
979 SCM_DEFINE (scm_fork
, "primitive-fork", 0, 0, 0,
981 "Creates a new \"child\" process by duplicating the current \"parent\" process.\n"
982 "In the child the return value is 0. In the parent the return value is\n"
983 "the integer process ID of the child.\n\n"
984 "This procedure has been renamed from @code{fork} to avoid a naming conflict\n"
985 "with the scsh fork.")
986 #define FUNC_NAME s_scm_fork
992 return SCM_MAKINUM (0L+pid
);
995 #endif /* HAVE_FORK */
998 SCM_DEFINE (scm_uname
, "uname", 0, 0, 0,
1000 "Return an object with some information about the computer\n"
1001 "system the program is running on.")
1002 #define FUNC_NAME s_scm_uname
1005 SCM ans
= scm_c_make_vector (5, SCM_UNSPECIFIED
);
1006 SCM
*ve
= SCM_VELTS (ans
);
1007 if (uname (&buf
) < 0)
1009 ve
[0] = scm_makfrom0str (buf
.sysname
);
1010 ve
[1] = scm_makfrom0str (buf
.nodename
);
1011 ve
[2] = scm_makfrom0str (buf
.release
);
1012 ve
[3] = scm_makfrom0str (buf
.version
);
1013 ve
[4] = scm_makfrom0str (buf
.machine
);
1016 ve[5] = scm_makfrom0str (buf.domainname);
1021 #endif /* HAVE_UNAME */
1023 SCM_DEFINE (scm_environ
, "environ", 0, 1, 0,
1025 "If @var{env} is omitted, return the current environment (in the\n"
1026 "Unix sense) as a list of strings. Otherwise set the current\n"
1027 "environment, which is also the default environment for child\n"
1028 "processes, to the supplied list of strings. Each member of\n"
1029 "@var{env} should be of the form @code{NAME=VALUE} and values of\n"
1030 "@code{NAME} should not be duplicated. If @var{env} is supplied\n"
1031 "then the return value is unspecified.")
1032 #define FUNC_NAME s_scm_environ
1034 if (SCM_UNBNDP (env
))
1035 return scm_makfromstrs (-1, environ
);
1040 new_environ
= environ_list_to_c (env
, SCM_ARG1
, FUNC_NAME
);
1041 /* Free the old environment, except when called for the first
1046 static int first
= 1;
1049 for (ep
= environ
; *ep
!= NULL
; ep
++)
1051 free ((char *) environ
);
1055 environ
= new_environ
;
1056 return SCM_UNSPECIFIED
;
1063 SCM_DEFINE (scm_tmpnam
, "tmpnam", 0, 0, 0,
1065 "Return a name in the file system that does not match any\n"
1066 "existing file. However there is no guarantee that another\n"
1067 "process will not create the file after @code{tmpnam} is called.\n"
1068 "Care should be taken if opening the file, e.g., use the\n"
1069 "@code{O_EXCL} open flag or use @code{mkstemp!} instead.")
1070 #define FUNC_NAME s_scm_tmpnam
1072 char name
[L_tmpnam
];
1075 SCM_SYSCALL (rv
= tmpnam (name
));
1077 /* not SCM_SYSERROR since errno probably not set. */
1078 SCM_MISC_ERROR ("tmpnam failed", SCM_EOL
);
1079 return scm_makfrom0str (name
);
1085 SCM_DEFINE (scm_mkstemp
, "mkstemp!", 1, 0, 0,
1087 "Create a new unique file in the file system and returns a new\n"
1088 "buffered port open for reading and writing to the file.\n"
1089 "@var{tmpl} is a string specifying where the file should be\n"
1090 "created: it must end with @code{XXXXXX} and will be changed in\n"
1091 "place to return the name of the temporary file.")
1092 #define FUNC_NAME s_scm_mkstemp
1097 SCM_VALIDATE_STRING_COPY (1, tmpl
, c_tmpl
);
1098 SCM_SYSCALL (rv
= mkstemp (c_tmpl
));
1101 return scm_fdes_to_port (rv
, "w+", tmpl
);
1105 SCM_DEFINE (scm_utime
, "utime", 1, 2, 0,
1106 (SCM pathname
, SCM actime
, SCM modtime
),
1107 "@code{utime} sets the access and modification times for the\n"
1108 "file named by @var{path}. If @var{actime} or @var{modtime} is\n"
1109 "not supplied, then the current time is used. @var{actime} and\n"
1110 "@var{modtime} must be integer time values as returned by the\n"
1111 "@code{current-time} procedure.\n"
1113 "(utime \"foo\" (- (current-time) 3600))\n"
1115 "will set the access time to one hour in the past and the\n"
1116 "modification time to the current time.")
1117 #define FUNC_NAME s_scm_utime
1120 struct utimbuf utm_tmp
;
1122 SCM_VALIDATE_STRING (1, pathname
);
1123 if (SCM_UNBNDP (actime
))
1124 SCM_SYSCALL (time (&utm_tmp
.actime
));
1126 utm_tmp
.actime
= SCM_NUM2ULONG (2, actime
);
1128 if (SCM_UNBNDP (modtime
))
1129 SCM_SYSCALL (time (&utm_tmp
.modtime
));
1131 utm_tmp
.modtime
= SCM_NUM2ULONG (3, modtime
);
1133 SCM_SYSCALL (rv
= utime (SCM_STRING_CHARS (pathname
), &utm_tmp
));
1136 return SCM_UNSPECIFIED
;
1140 SCM_DEFINE (scm_access
, "access?", 2, 0, 0,
1141 (SCM path
, SCM how
),
1142 "Return @code{#t} if @var{path} corresponds to an existing file\n"
1143 "and the current process has the type of access specified by\n"
1144 "@var{how}, otherwise @code{#f}. @var{how} should be specified\n"
1145 "using the values of the variables listed below. Multiple\n"
1146 "values can be combined using a bitwise or, in which case\n"
1147 "@code{#t} will only be returned if all accesses are granted.\n"
1149 "Permissions are checked using the real id of the current\n"
1150 "process, not the effective id, although it's the effective id\n"
1151 "which determines whether the access would actually be granted.\n"
1154 "test for read permission.\n"
1157 "test for write permission.\n"
1160 "test for execute permission.\n"
1163 "test for existence of the file.\n"
1165 #define FUNC_NAME s_scm_access
1169 SCM_VALIDATE_STRING (1, path
);
1170 SCM_VALIDATE_INUM (2, how
);
1171 rv
= access (SCM_STRING_CHARS (path
), SCM_INUM (how
));
1172 return SCM_NEGATE_BOOL(rv
);
1176 SCM_DEFINE (scm_getpid
, "getpid", 0, 0, 0,
1178 "Return an integer representing the current process ID.")
1179 #define FUNC_NAME s_scm_getpid
1181 return SCM_MAKINUM ((unsigned long) getpid ());
1185 SCM_DEFINE (scm_putenv
, "putenv", 1, 0, 0,
1187 "Modifies the environment of the current process, which is\n"
1188 "also the default environment inherited by child processes.\n\n"
1189 "If @var{string} is of the form @code{NAME=VALUE} then it will be written\n"
1190 "directly into the environment, replacing any existing environment string\n"
1192 "name matching @code{NAME}. If @var{string} does not contain an equal\n"
1193 "sign, then any existing string with name matching @var{string} will\n"
1195 "The return value is unspecified.")
1196 #define FUNC_NAME s_scm_putenv
1201 SCM_VALIDATE_STRING (1, str
);
1202 /* must make a new copy to be left in the environment, safe from gc. */
1203 ptr
= malloc (SCM_STRING_LENGTH (str
) + 1);
1206 strncpy (ptr
, SCM_STRING_CHARS (str
), SCM_STRING_LENGTH (str
));
1207 ptr
[SCM_STRING_LENGTH (str
)] = 0;
1211 return SCM_UNSPECIFIED
;
1215 #ifdef HAVE_SETLOCALE
1216 SCM_DEFINE (scm_setlocale
, "setlocale", 1, 1, 0,
1217 (SCM category
, SCM locale
),
1218 "If @var{locale} is omitted, return the current value of the\n"
1219 "specified locale category as a system-dependent string.\n"
1220 "@var{category} should be specified using the values\n"
1221 "@code{LC_COLLATE}, @code{LC_ALL} etc.\n"
1223 "Otherwise the specified locale category is set to the string\n"
1224 "@var{locale} and the new value is returned as a\n"
1225 "system-dependent string. If @var{locale} is an empty string,\n"
1226 "the locale will be set using envirionment variables.")
1227 #define FUNC_NAME s_scm_setlocale
1232 SCM_VALIDATE_INUM (1,category
);
1233 if (SCM_UNBNDP (locale
))
1239 SCM_VALIDATE_STRING (2, locale
);
1240 clocale
= SCM_STRING_CHARS (locale
);
1243 rv
= setlocale (SCM_INUM (category
), clocale
);
1246 return scm_makfrom0str (rv
);
1249 #endif /* HAVE_SETLOCALE */
1252 SCM_DEFINE (scm_mknod
, "mknod", 4, 0, 0,
1253 (SCM path
, SCM type
, SCM perms
, SCM dev
),
1254 "Creates a new special file, such as a file corresponding to a device.\n"
1255 "@var{path} specifies the name of the file. @var{type} should\n"
1256 "be one of the following symbols:\n"
1257 "regular, directory, symlink, block-special, char-special,\n"
1258 "fifo, or socket. @var{perms} (an integer) specifies the file permissions.\n"
1259 "@var{dev} (an integer) specifies which device the special file refers\n"
1260 "to. Its exact interpretation depends on the kind of special file\n"
1261 "being created.\n\n"
1264 "(mknod \"/dev/fd0\" 'block-special #o660 (+ (* 2 256) 2))\n"
1266 "The return value is unspecified.")
1267 #define FUNC_NAME s_scm_mknod
1273 SCM_VALIDATE_STRING (1, path
);
1274 SCM_VALIDATE_SYMBOL (2,type
);
1275 SCM_VALIDATE_INUM (3,perms
);
1276 SCM_VALIDATE_INUM (4,dev
);
1278 p
= SCM_SYMBOL_CHARS (type
);
1279 if (strcmp (p
, "regular") == 0)
1281 else if (strcmp (p
, "directory") == 0)
1283 else if (strcmp (p
, "symlink") == 0)
1285 else if (strcmp (p
, "block-special") == 0)
1287 else if (strcmp (p
, "char-special") == 0)
1289 else if (strcmp (p
, "fifo") == 0)
1292 else if (strcmp (p
, "socket") == 0)
1296 SCM_OUT_OF_RANGE (2,type
);
1298 SCM_SYSCALL (val
= mknod (SCM_STRING_CHARS (path
), ctype
| SCM_INUM (perms
),
1302 return SCM_UNSPECIFIED
;
1305 #endif /* HAVE_MKNOD */
1308 SCM_DEFINE (scm_nice
, "nice", 1, 0, 0,
1310 "Increment the priority of the current process by @var{incr}. A higher\n"
1311 "priority value means that the process runs less often.\n"
1312 "The return value is unspecified.")
1313 #define FUNC_NAME s_scm_nice
1315 SCM_VALIDATE_INUM (1,incr
);
1316 if (nice(SCM_INUM(incr
)) != 0)
1318 return SCM_UNSPECIFIED
;
1321 #endif /* HAVE_NICE */
1324 SCM_DEFINE (scm_sync
, "sync", 0, 0, 0,
1326 "Flush the operating system disk buffers.\n"
1327 "The return value is unspecified.")
1328 #define FUNC_NAME s_scm_sync
1331 return SCM_UNSPECIFIED
;
1334 #endif /* HAVE_SYNC */
1336 #if HAVE_LIBCRYPT && HAVE_CRYPT_H
1337 SCM_DEFINE (scm_crypt
, "crypt", 2, 0, 0,
1338 (SCM key
, SCM salt
),
1339 "Encrypt @var{key} using @var{salt} as the salt value to the\n"
1340 "crypt(3) library call\n")
1341 #define FUNC_NAME s_scm_crypt
1345 SCM_VALIDATE_STRING (1, key
);
1346 SCM_VALIDATE_STRING (2, salt
);
1348 p
= crypt (SCM_STRING_CHARS (key
), SCM_STRING_CHARS (salt
));
1349 return scm_makfrom0str (p
);
1352 #endif /* HAVE_LIBCRYPT && HAVE_CRYPT_H */
1355 SCM_DEFINE (scm_chroot
, "chroot", 1, 0, 0,
1357 "Change the root directory to that specified in @var{path}.\n"
1358 "This directory will be used for path names beginning with\n"
1359 "@file{/}. The root directory is inherited by all children\n"
1360 "of the current process. Only the superuser may change the\n"
1362 #define FUNC_NAME s_scm_chroot
1364 SCM_VALIDATE_STRING (1, path
);
1366 if (chroot (SCM_STRING_CHARS (path
)) == -1)
1368 return SCM_UNSPECIFIED
;
1371 #endif /* HAVE_CHROOT */
1375 /* Wrapper function to supplying `getlogin()' under Windows. */
1376 static char * getlogin (void)
1378 static char user
[256];
1379 static unsigned long len
= 256;
1381 if (!GetUserName (user
, &len
))
1385 #endif /* __MINGW32__ */
1389 SCM_DEFINE (scm_getlogin
, "getlogin", 0, 0, 0,
1391 "Return a string containing the name of the user logged in on\n"
1392 "the controlling terminal of the process, or @code{#f} if this\n"
1393 "information cannot be obtained.")
1394 #define FUNC_NAME s_scm_getlogin
1401 return scm_makfrom0str (p
);
1404 #endif /* HAVE_GETLOGIN */
1407 SCM_DEFINE (scm_cuserid
, "cuserid", 0, 0, 0,
1409 "Return a string containing a user name associated with the\n"
1410 "effective user id of the process. Return @code{#f} if this\n"
1411 "information cannot be obtained.")
1412 #define FUNC_NAME s_scm_cuserid
1419 return scm_makfrom0str (p
);
1422 #endif /* HAVE_CUSERID */
1424 #if HAVE_GETPRIORITY
1425 SCM_DEFINE (scm_getpriority
, "getpriority", 2, 0, 0,
1426 (SCM which
, SCM who
),
1427 "Return the scheduling priority of the process, process group\n"
1428 "or user, as indicated by @var{which} and @var{who}. @var{which}\n"
1429 "is one of the variables @code{PRIO_PROCESS}, @code{PRIO_PGRP}\n"
1430 "or @code{PRIO_USER}, and @var{who} is interpreted relative to\n"
1431 "@var{which} (a process identifier for @code{PRIO_PROCESS},\n"
1432 "process group identifier for @code{PRIO_PGRP}, and a user\n"
1433 "identifier for @code{PRIO_USER}. A zero value of @var{who}\n"
1434 "denotes the current process, process group, or user. Return\n"
1435 "the highest priority (lowest numerical value) of any of the\n"
1436 "specified processes.")
1437 #define FUNC_NAME s_scm_getpriority
1439 int cwhich
, cwho
, ret
;
1441 SCM_VALIDATE_INUM_COPY (1, which
, cwhich
);
1442 SCM_VALIDATE_INUM_COPY (2, who
, cwho
);
1444 /* We have to clear errno and examine it later, because -1 is a
1445 legal return value for getpriority(). */
1447 ret
= getpriority (cwhich
, cwho
);
1450 return SCM_MAKINUM (ret
);
1453 #endif /* HAVE_GETPRIORITY */
1455 #if HAVE_SETPRIORITY
1456 SCM_DEFINE (scm_setpriority
, "setpriority", 3, 0, 0,
1457 (SCM which
, SCM who
, SCM prio
),
1458 "Set the scheduling priority of the process, process group\n"
1459 "or user, as indicated by @var{which} and @var{who}. @var{which}\n"
1460 "is one of the variables @code{PRIO_PROCESS}, @code{PRIO_PGRP}\n"
1461 "or @code{PRIO_USER}, and @var{who} is interpreted relative to\n"
1462 "@var{which} (a process identifier for @code{PRIO_PROCESS},\n"
1463 "process group identifier for @code{PRIO_PGRP}, and a user\n"
1464 "identifier for @code{PRIO_USER}. A zero value of @var{who}\n"
1465 "denotes the current process, process group, or user.\n"
1466 "@var{prio} is a value in the range -20 and 20, the default\n"
1467 "priority is 0; lower priorities cause more favorable\n"
1468 "scheduling. Sets the priority of all of the specified\n"
1469 "processes. Only the super-user may lower priorities.\n"
1470 "The return value is not specified.")
1471 #define FUNC_NAME s_scm_setpriority
1473 int cwhich
, cwho
, cprio
;
1475 SCM_VALIDATE_INUM_COPY (1, which
, cwhich
);
1476 SCM_VALIDATE_INUM_COPY (2, who
, cwho
);
1477 SCM_VALIDATE_INUM_COPY (3, prio
, cprio
);
1479 if (setpriority (cwhich
, cwho
, cprio
) == -1)
1481 return SCM_UNSPECIFIED
;
1484 #endif /* HAVE_SETPRIORITY */
1487 SCM_DEFINE (scm_getpass
, "getpass", 1, 0, 0,
1489 "Display @var{prompt} to the standard error output and read\n"
1490 "a password from @file{/dev/tty}. If this file is not\n"
1491 "accessible, it reads from standard input. The password may be\n"
1492 "up to 127 characters in length. Additional characters and the\n"
1493 "terminating newline character are discarded. While reading\n"
1494 "the password, echoing and the generation of signals by special\n"
1495 "characters is disabled.")
1496 #define FUNC_NAME s_scm_getpass
1501 SCM_VALIDATE_STRING (1, prompt
);
1503 p
= getpass(SCM_STRING_CHARS (prompt
));
1504 passwd
= scm_makfrom0str (p
);
1506 /* Clear out the password in the static buffer. */
1507 memset (p
, 0, strlen (p
));
1512 #endif /* HAVE_GETPASS */
1515 SCM_DEFINE (scm_flock
, "flock", 2, 0, 0,
1516 (SCM file
, SCM operation
),
1517 "Apply or remove an advisory lock on an open file.\n"
1518 "@var{operation} specifies the action to be done:\n"
1521 "Shared lock. More than one process may hold a shared lock\n"
1522 "for a given file at a given time.\n"
1524 "Exclusive lock. Only one process may hold an exclusive lock\n"
1525 "for a given file at a given time.\n"
1527 "Unlock the file.\n"
1529 "Don't block when locking. May be specified by bitwise OR'ing\n"
1530 "it to one of the other operations.\n"
1532 "The return value is not specified. @var{file} may be an open\n"
1533 "file descriptor or an open file descriptior port.")
1534 #define FUNC_NAME s_scm_flock
1536 int coperation
, fdes
;
1538 if (SCM_INUMP (file
))
1539 fdes
= SCM_INUM (file
);
1542 SCM_VALIDATE_OPFPORT (2, file
);
1544 fdes
= SCM_FPORT_FDES (file
);
1546 SCM_VALIDATE_INUM_COPY (2, operation
, coperation
);
1547 if (flock (fdes
, coperation
) == -1)
1549 return SCM_UNSPECIFIED
;
1552 #endif /* HAVE_FLOCK */
1554 #if HAVE_SETHOSTNAME
1555 SCM_DEFINE (scm_sethostname
, "sethostname", 1, 0, 0,
1557 "Set the host name of the current processor to @var{name}. May\n"
1558 "only be used by the superuser. The return value is not\n"
1560 #define FUNC_NAME s_scm_sethostname
1562 SCM_VALIDATE_STRING (1, name
);
1564 if (sethostname (SCM_STRING_CHARS (name
), SCM_STRING_LENGTH (name
)) == -1)
1566 return SCM_UNSPECIFIED
;
1569 #endif /* HAVE_SETHOSTNAME */
1571 #if HAVE_GETHOSTNAME
1572 SCM_DEFINE (scm_gethostname
, "gethostname", 0, 0, 0,
1574 "Return the host name of the current processor.")
1575 #define FUNC_NAME s_scm_gethostname
1577 /* 256 is for Solaris, under Linux ENAMETOOLONG is returned if not
1580 char *p
= scm_must_malloc (len
, "gethostname");
1583 res
= gethostname (p
, len
);
1584 while (res
== -1 && errno
== ENAMETOOLONG
)
1586 p
= scm_must_realloc (p
, len
, len
* 2, "gethostname");
1588 res
= gethostname (p
, len
);
1595 name
= scm_makfrom0str (p
);
1600 #endif /* HAVE_GETHOSTNAME */
1605 scm_add_feature ("posix");
1607 scm_add_feature ("EIDs");
1610 scm_c_define ("WAIT_ANY", SCM_MAKINUM (WAIT_ANY
));
1613 scm_c_define ("WAIT_MYPGRP", SCM_MAKINUM (WAIT_MYPGRP
));
1616 scm_c_define ("WNOHANG", SCM_MAKINUM (WNOHANG
));
1619 scm_c_define ("WUNTRACED", SCM_MAKINUM (WUNTRACED
));
1622 /* access() symbols. */
1623 scm_c_define ("R_OK", SCM_MAKINUM (R_OK
));
1624 scm_c_define ("W_OK", SCM_MAKINUM (W_OK
));
1625 scm_c_define ("X_OK", SCM_MAKINUM (X_OK
));
1626 scm_c_define ("F_OK", SCM_MAKINUM (F_OK
));
1629 scm_c_define ("LC_COLLATE", SCM_MAKINUM (LC_COLLATE
));
1632 scm_c_define ("LC_CTYPE", SCM_MAKINUM (LC_CTYPE
));
1635 scm_c_define ("LC_MONETARY", SCM_MAKINUM (LC_MONETARY
));
1638 scm_c_define ("LC_NUMERIC", SCM_MAKINUM (LC_NUMERIC
));
1641 scm_c_define ("LC_TIME", SCM_MAKINUM (LC_TIME
));
1644 scm_c_define ("LC_MESSAGES", SCM_MAKINUM (LC_MESSAGES
));
1647 scm_c_define ("LC_ALL", SCM_MAKINUM (LC_ALL
));
1650 scm_c_define ("PIPE_BUF", scm_long2num (PIPE_BUF
));
1654 scm_c_define ("PRIO_PROCESS", SCM_MAKINUM (PRIO_PROCESS
));
1657 scm_c_define ("PRIO_PGRP", SCM_MAKINUM (PRIO_PGRP
));
1660 scm_c_define ("PRIO_USER", SCM_MAKINUM (PRIO_USER
));
1664 scm_c_define ("LOCK_SH", SCM_MAKINUM (LOCK_SH
));
1667 scm_c_define ("LOCK_EX", SCM_MAKINUM (LOCK_EX
));
1670 scm_c_define ("LOCK_UN", SCM_MAKINUM (LOCK_UN
));
1673 scm_c_define ("LOCK_NB", SCM_MAKINUM (LOCK_NB
));
1676 #include "libguile/cpp_sig_symbols.c"
1677 #ifndef SCM_MAGIC_SNARFER
1678 #include "libguile/posix.x"