1 /* Copyright (C) 1995, 96, 97, 98, 99, 2000 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 */
48 #include "libguile/_scm.h"
49 #include "libguile/fports.h"
50 #include "libguile/scmsigs.h"
51 #include "libguile/feature.h"
52 #include "libguile/strings.h"
53 #include "libguile/vectors.h"
55 #include "libguile/validate.h"
56 #include "libguile/posix.h"
62 #ifdef TIME_WITH_SYS_TIME
63 # include <sys/time.h>
67 # include <sys/time.h>
74 /* GNU/Linux libc requires __USE_XOPEN or cuserid() is not defined. */
79 extern char *ttyname();
83 #ifdef LIBC_H_WITH_UNISTD_H
87 #include <sys/types.h>
94 # include <sys/wait.h>
97 # define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
100 # define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
105 extern char ** environ
;
108 #include <sys/utsname.h>
112 # define NAMLEN(dirent) strlen((dirent)->d_name)
114 # define dirent direct
115 # define NAMLEN(dirent) (dirent)->d_namlen
117 # include <sys/ndir.h>
120 # include <sys/dir.h>
127 #ifdef HAVE_SETLOCALE
131 #if HAVE_LIBCRYPT && HAVE_CRYPT_H
135 #if HAVE_SYS_RESOURCE_H
136 # include <sys/resource.h>
140 # include <sys/file.h>
143 /* Some Unix systems don't define these. CPP hair is dangerous, but
144 this seems safe enough... */
161 /* On NextStep, <utime.h> doesn't define struct utime, unless we
162 #define _POSIX_SOURCE before #including it. I think this is less
163 of a kludge than defining struct utimbuf ourselves. */
164 #ifdef UTIMBUF_NEEDS_POSIX
165 #define _POSIX_SOURCE
168 #ifdef HAVE_SYS_UTIME_H
169 #include <sys/utime.h>
176 /* Please don't add any more #includes or #defines here. The hack
177 above means that _POSIX_SOURCE may be #defined, which will
178 encourage header files to do strange things. */
181 SCM_SYMBOL (sym_read_pipe
, "read pipe");
182 SCM_SYMBOL (sym_write_pipe
, "write pipe");
184 SCM_DEFINE (scm_pipe
, "pipe", 0, 0, 0,
186 "Returns a newly created pipe: a pair of ports which are linked\n"
187 "together on the local machine. The CAR is the input port and\n"
188 "the CDR is the output port. Data written (and flushed) to the\n"
189 "output port can be read from the input port.\n"
190 "Pipes are commonly used for communication with a newly\n"
191 "forked child process. The need to flush the output port\n"
192 "can be avoided by making it unbuffered using @code{setvbuf}.\n\n"
193 "Writes occur atomically provided the size of the data in\n"
194 "bytes is not greater than the value of @code{PIPE_BUF}\n"
195 "Note that the output port is likely to block if too much data\n"
196 "(typically equal to @code{PIPE_BUF}) has been written but not\n"
197 "yet read from the input port\n"
199 #define FUNC_NAME s_scm_pipe
208 p_rd
= scm_fdes_to_port (fd
[0], "r", sym_read_pipe
);
209 p_wt
= scm_fdes_to_port (fd
[1], "w", sym_write_pipe
);
210 return scm_cons (p_rd
, p_wt
);
215 #ifdef HAVE_GETGROUPS
216 SCM_DEFINE (scm_getgroups
, "getgroups", 0, 0, 0,
218 "Returns a vector of integers representing the current supplimentary group IDs.")
219 #define FUNC_NAME s_scm_getgroups
226 ngroups
= getgroups (0, NULL
);
230 size
= ngroups
* sizeof (GETGROUPS_T
);
231 groups
= scm_must_malloc (size
, FUNC_NAME
);
232 getgroups (ngroups
, groups
);
234 ans
= scm_c_make_vector (ngroups
, SCM_UNDEFINED
);
235 while (--ngroups
>= 0)
236 SCM_VELTS (ans
) [ngroups
] = SCM_MAKINUM (groups
[ngroups
]);
238 scm_must_free (groups
);
239 scm_done_free (size
);
247 SCM_DEFINE (scm_getpwuid
, "getpw", 0, 1, 0,
249 "Look up an entry in the user database. @var{obj} can be an integer,\n"
250 "a string, or omitted, giving the behaviour of getpwuid, getpwnam\n"
251 "or getpwent respectively.")
252 #define FUNC_NAME s_scm_getpwuid
255 struct passwd
*entry
;
258 result
= scm_c_make_vector (7, SCM_UNSPECIFIED
);
259 ve
= SCM_VELTS (result
);
260 if (SCM_UNBNDP (user
) || SCM_FALSEP (user
))
262 SCM_SYSCALL (entry
= getpwent ());
268 else if (SCM_INUMP (user
))
270 entry
= getpwuid (SCM_INUM (user
));
274 SCM_VALIDATE_STRING (1, user
);
275 SCM_STRING_COERCE_0TERMINATION_X (user
);
276 entry
= getpwnam (SCM_STRING_CHARS (user
));
279 SCM_MISC_ERROR ("entry not found", SCM_EOL
);
281 ve
[0] = scm_makfrom0str (entry
->pw_name
);
282 ve
[1] = scm_makfrom0str (entry
->pw_passwd
);
283 ve
[2] = scm_ulong2num ((unsigned long) entry
->pw_uid
);
284 ve
[3] = scm_ulong2num ((unsigned long) entry
->pw_gid
);
285 ve
[4] = scm_makfrom0str (entry
->pw_gecos
);
287 ve
[5] = scm_makfrom0str ("");
289 ve
[5] = scm_makfrom0str (entry
->pw_dir
);
290 if (!entry
->pw_shell
)
291 ve
[6] = scm_makfrom0str ("");
293 ve
[6] = scm_makfrom0str (entry
->pw_shell
);
300 SCM_DEFINE (scm_setpwent
, "setpw", 0, 1, 0,
302 "If called with a true argument, initialize or reset the password data\n"
303 "stream. Otherwise, close the stream. The @code{setpwent} and\n"
304 "@code{endpwent} procedures are implemented on top of this.")
305 #define FUNC_NAME s_scm_setpwent
307 if (SCM_UNBNDP (arg
) || SCM_FALSEP (arg
))
311 return SCM_UNSPECIFIED
;
318 /* Combines getgrgid and getgrnam. */
319 SCM_DEFINE (scm_getgrgid
, "getgr", 0, 1, 0,
321 "Look up an entry in the group database. @var{obj} can be an integer,\n"
322 "a string, or omitted, giving the behaviour of getgrgid, getgrnam\n"
323 "or getgrent respectively.")
324 #define FUNC_NAME s_scm_getgrgid
329 result
= scm_c_make_vector (4, SCM_UNSPECIFIED
);
330 ve
= SCM_VELTS (result
);
331 if (SCM_UNBNDP (name
) || SCM_FALSEP (name
))
333 SCM_SYSCALL (entry
= getgrent ());
339 else if (SCM_INUMP (name
))
340 SCM_SYSCALL (entry
= getgrgid (SCM_INUM (name
)));
343 SCM_VALIDATE_STRING (1, name
);
344 SCM_STRING_COERCE_0TERMINATION_X (name
);
345 SCM_SYSCALL (entry
= getgrnam (SCM_STRING_CHARS (name
)));
350 ve
[0] = scm_makfrom0str (entry
->gr_name
);
351 ve
[1] = scm_makfrom0str (entry
->gr_passwd
);
352 ve
[2] = scm_ulong2num ((unsigned long) entry
->gr_gid
);
353 ve
[3] = scm_makfromstrs (-1, entry
->gr_mem
);
360 SCM_DEFINE (scm_setgrent
, "setgr", 0, 1, 0,
362 "If called with a true argument, initialize or reset the group data\n"
363 "stream. Otherwise, close the stream. The @code{setgrent} and\n"
364 "@code{endgrent} procedures are implemented on top of this.")
365 #define FUNC_NAME s_scm_setgrent
367 if (SCM_UNBNDP (arg
) || SCM_FALSEP (arg
))
371 return SCM_UNSPECIFIED
;
377 SCM_DEFINE (scm_kill
, "kill", 2, 0, 0,
379 "Sends a signal to the specified process or group of processes.\n\n"
380 "@var{pid} specifies the processes to which the signal is sent:\n\n"
382 "@item @var{pid} greater than 0\n"
383 "The process whose identifier is @var{pid}.\n"
384 "@item @var{pid} equal to 0\n"
385 "All processes in the current process group.\n"
386 "@item @var{pid} less than -1\n"
387 "The process group whose identifier is -@var{pid}\n"
388 "@item @var{pid} equal to -1\n"
389 "If the process is privileged, all processes except for some special\n"
390 "system processes. Otherwise, all processes with the current effective\n"
393 "@var{sig} should be specified using a variable corresponding to\n"
394 "the Unix symbolic name, e.g.,\n\n"
399 "Interrupt signal.\n"
401 #define FUNC_NAME s_scm_kill
403 SCM_VALIDATE_INUM (1,pid
);
404 SCM_VALIDATE_INUM (2,sig
);
405 /* Signal values are interned in scm_init_posix(). */
406 if (kill ((int) SCM_INUM (pid
), (int) SCM_INUM (sig
)) != 0)
408 return SCM_UNSPECIFIED
;
413 SCM_DEFINE (scm_waitpid
, "waitpid", 1, 1, 0,
414 (SCM pid
, SCM options
),
415 "This procedure collects status information from a child process which\n"
416 "has terminated or (optionally) stopped. Normally it will\n"
417 "suspend the calling process until this can be done. If more than one\n"
418 "child process is eligible then one will be chosen by the operating system.\n\n"
419 "The value of @var{pid} determines the behaviour:\n\n"
421 "@item @var{pid} greater than 0\n"
422 "Request status information from the specified child process.\n"
423 "@item @var{pid} equal to -1 or WAIT_ANY\n"
424 "Request status information for any child process.\n"
425 "@item @var{pid} equal to 0 or WAIT_MYPGRP\n"
426 "Request status information for any child process in the current process\n"
428 "@item @var{pid} less than -1\n"
429 "Request status information for any child process whose process group ID\n"
432 "The @var{options} argument, if supplied, should be the bitwise OR of the\n"
433 "values of zero or more of the following variables:\n\n"
435 "Return immediately even if there are no child processes to be collected.\n"
437 "@defvar WUNTRACED\n"
438 "Report status information for stopped processes as well as terminated\n"
441 "The return value is a pair containing:\n\n"
444 "The process ID of the child process, or 0 if @code{WNOHANG} was\n"
445 "specified and no process was collected.\n"
447 "The integer status value.\n"
449 #define FUNC_NAME s_scm_waitpid
454 SCM_VALIDATE_INUM (1,pid
);
455 if (SCM_UNBNDP (options
))
459 SCM_VALIDATE_INUM (2,options
);
460 /* Flags are interned in scm_init_posix. */
461 ioptions
= SCM_INUM (options
);
463 SCM_SYSCALL (i
= waitpid (SCM_INUM (pid
), &status
, ioptions
));
466 return scm_cons (SCM_MAKINUM (0L + i
), SCM_MAKINUM (0L + status
));
469 #endif /* HAVE_WAITPID */
471 SCM_DEFINE (scm_status_exit_val
, "status:exit-val", 1, 0, 0,
473 "Returns the exit status value, as would be\n"
474 "set if a process ended normally through a\n"
475 "call to @code{exit} or @code{_exit}, if any, otherwise @code{#f}.")
476 #define FUNC_NAME s_scm_status_exit_val
480 SCM_VALIDATE_INUM (1,status
);
482 /* On Ultrix, the WIF... macros assume their argument is an lvalue;
483 go figure. SCM_INUM does not yield an lvalue. */
484 lstatus
= SCM_INUM (status
);
485 if (WIFEXITED (lstatus
))
486 return (SCM_MAKINUM (WEXITSTATUS (lstatus
)));
492 SCM_DEFINE (scm_status_term_sig
, "status:term-sig", 1, 0, 0,
494 "Returns the signal number which terminated the\n"
495 "process, if any, otherwise @code{#f}.")
496 #define FUNC_NAME s_scm_status_term_sig
500 SCM_VALIDATE_INUM (1,status
);
502 lstatus
= SCM_INUM (status
);
503 if (WIFSIGNALED (lstatus
))
504 return SCM_MAKINUM (WTERMSIG (lstatus
));
510 SCM_DEFINE (scm_status_stop_sig
, "status:stop-sig", 1, 0, 0,
512 "Returns the signal number which stopped the\n"
513 "process, if any, otherwise @code{#f}.")
514 #define FUNC_NAME s_scm_status_stop_sig
518 SCM_VALIDATE_INUM (1,status
);
520 lstatus
= SCM_INUM (status
);
521 if (WIFSTOPPED (lstatus
))
522 return SCM_MAKINUM (WSTOPSIG (lstatus
));
528 SCM_DEFINE (scm_getppid
, "getppid", 0, 0, 0,
530 "Returns an integer representing the process ID of the parent process.")
531 #define FUNC_NAME s_scm_getppid
533 return SCM_MAKINUM (0L + getppid ());
539 SCM_DEFINE (scm_getuid
, "getuid", 0, 0, 0,
541 "Returns an integer representing the current real user ID.")
542 #define FUNC_NAME s_scm_getuid
544 return SCM_MAKINUM (0L + getuid ());
550 SCM_DEFINE (scm_getgid
, "getgid", 0, 0, 0,
552 "Returns an integer representing the current real group ID.")
553 #define FUNC_NAME s_scm_getgid
555 return SCM_MAKINUM (0L + getgid ());
561 SCM_DEFINE (scm_geteuid
, "geteuid", 0, 0, 0,
563 "Returns an integer representing the current effective user ID.\n"
564 "If the system does not support effective IDs, then the real ID\n"
565 "is returned. @code{(feature? 'EIDs)} reports whether the system\n"
566 "supports effective IDs.")
567 #define FUNC_NAME s_scm_geteuid
570 return SCM_MAKINUM (0L + geteuid ());
572 return SCM_MAKINUM (0L + getuid ());
579 SCM_DEFINE (scm_getegid
, "getegid", 0, 0, 0,
581 "Returns an integer representing the current effective group ID.\n"
582 "If the system does not support effective IDs, then the real ID\n"
583 "is returned. @code{(feature? 'EIDs)} reports whether the system\n"
584 "supports effective IDs.")
585 #define FUNC_NAME s_scm_getegid
588 return SCM_MAKINUM (0L + getegid ());
590 return SCM_MAKINUM (0L + getgid ());
596 SCM_DEFINE (scm_setuid
, "setuid", 1, 0, 0,
598 "Sets both the real and effective user IDs to the integer @var{id}, provided\n"
599 "the process has appropriate privileges.\n"
600 "The return value is unspecified.")
601 #define FUNC_NAME s_scm_setuid
603 SCM_VALIDATE_INUM (1,id
);
604 if (setuid (SCM_INUM (id
)) != 0)
606 return SCM_UNSPECIFIED
;
610 SCM_DEFINE (scm_setgid
, "setgid", 1, 0, 0,
612 "Sets both the real and effective group IDs to the integer @var{id}, provided\n"
613 "the process has appropriate privileges.\n"
614 "The return value is unspecified.")
615 #define FUNC_NAME s_scm_setgid
617 SCM_VALIDATE_INUM (1,id
);
618 if (setgid (SCM_INUM (id
)) != 0)
620 return SCM_UNSPECIFIED
;
624 SCM_DEFINE (scm_seteuid
, "seteuid", 1, 0, 0,
626 "Sets the effective user ID to the integer @var{id}, provided the process\n"
627 "has appropriate privileges. If effective IDs are not supported, the\n"
628 "real ID is set instead -- @code{(feature? 'EIDs)} reports whether the\n"
629 "system supports effective IDs.\n"
630 "The return value is unspecified.")
631 #define FUNC_NAME s_scm_seteuid
635 SCM_VALIDATE_INUM (1,id
);
637 rv
= seteuid (SCM_INUM (id
));
639 rv
= setuid (SCM_INUM (id
));
643 return SCM_UNSPECIFIED
;
648 SCM_DEFINE (scm_setegid
, "setegid", 1, 0, 0,
650 "Sets the effective group ID to the integer @var{id}, provided the process\n"
651 "has appropriate privileges. If effective IDs are not supported, the\n"
652 "real ID is set instead -- @code{(feature? 'EIDs)} reports whether the\n"
653 "system supports effective IDs.\n"
654 "The return value is unspecified.")
655 #define FUNC_NAME s_scm_setegid
659 SCM_VALIDATE_INUM (1,id
);
661 rv
= setegid (SCM_INUM (id
));
663 rv
= setgid (SCM_INUM (id
));
667 return SCM_UNSPECIFIED
;
673 SCM_DEFINE (scm_getpgrp
, "getpgrp", 0, 0, 0,
675 "Returns an integer representing the current process group ID.\n"
676 "This is the POSIX definition, not BSD.")
677 #define FUNC_NAME s_scm_getpgrp
680 fn
= (int (*) ()) getpgrp
;
681 return SCM_MAKINUM (fn (0));
686 SCM_DEFINE (scm_setpgid
, "setpgid", 2, 0, 0,
688 "Move the process @var{pid} into the process group @var{pgid}. @var{pid} or\n"
689 "@var{pgid} must be integers: they can be zero to indicate the ID of the\n"
691 "Fails on systems that do not support job control.\n"
692 "The return value is unspecified.")
693 #define FUNC_NAME s_scm_setpgid
695 SCM_VALIDATE_INUM (1,pid
);
696 SCM_VALIDATE_INUM (2,pgid
);
697 /* FIXME(?): may be known as setpgrp. */
698 if (setpgid (SCM_INUM (pid
), SCM_INUM (pgid
)) != 0)
700 return SCM_UNSPECIFIED
;
703 #endif /* HAVE_SETPGID */
706 SCM_DEFINE (scm_setsid
, "setsid", 0, 0, 0,
708 "Creates a new session. The current process becomes the session leader\n"
709 "and is put in a new process group. The process will be detached\n"
710 "from its controlling terminal if it has one.\n"
711 "The return value is an integer representing the new process group ID.")
712 #define FUNC_NAME s_scm_setsid
714 pid_t sid
= setsid ();
717 return SCM_UNSPECIFIED
;
720 #endif /* HAVE_SETSID */
722 SCM_DEFINE (scm_ttyname
, "ttyname", 1, 0, 0,
724 "Returns a string with the name of the serial terminal device underlying\n"
726 #define FUNC_NAME s_scm_ttyname
731 port
= SCM_COERCE_OUTPORT (port
);
732 SCM_VALIDATE_OPPORT (1,port
);
733 if (!SCM_FPORTP (port
))
735 fd
= SCM_FPORT_FDES (port
);
736 SCM_SYSCALL (ans
= ttyname (fd
));
739 /* ans could be overwritten by another call to ttyname */
740 return (scm_makfrom0str (ans
));
745 SCM_DEFINE (scm_ctermid
, "ctermid", 0, 0, 0,
747 "Returns a string containing the file name of the controlling terminal\n"
748 "for the current process.")
749 #define FUNC_NAME s_scm_ctermid
751 char *result
= ctermid (NULL
);
754 return scm_makfrom0str (result
);
757 #endif /* HAVE_CTERMID */
759 #ifdef HAVE_TCGETPGRP
760 SCM_DEFINE (scm_tcgetpgrp
, "tcgetpgrp", 1, 0, 0,
762 "Returns the process group ID of the foreground\n"
763 "process group associated with the terminal open on the file descriptor\n"
764 "underlying @var{port}.\n\n"
765 "If there is no foreground process group, the return value is a\n"
766 "number greater than 1 that does not match the process group ID\n"
767 "of any existing process group. This can happen if all of the\n"
768 "processes in the job that was formerly the foreground job have\n"
769 "terminated, and no other job has yet been moved into the\n"
771 #define FUNC_NAME s_scm_tcgetpgrp
776 port
= SCM_COERCE_OUTPORT (port
);
778 SCM_VALIDATE_OPFPORT (1,port
);
779 fd
= SCM_FPORT_FDES (port
);
780 if ((pgid
= tcgetpgrp (fd
)) == -1)
782 return SCM_MAKINUM (pgid
);
785 #endif /* HAVE_TCGETPGRP */
787 #ifdef HAVE_TCSETPGRP
788 SCM_DEFINE (scm_tcsetpgrp
, "tcsetpgrp", 2, 0, 0,
789 (SCM port
, SCM pgid
),
790 "Set the foreground process group ID for the terminal used by the file\n"
791 "descriptor underlying @var{port} to the integer @var{pgid}.\n"
792 "The calling process\n"
793 "must be a member of the same session as @var{pgid} and must have the same\n"
794 "controlling terminal. The return value is unspecified.")
795 #define FUNC_NAME s_scm_tcsetpgrp
799 port
= SCM_COERCE_OUTPORT (port
);
801 SCM_VALIDATE_OPFPORT (1,port
);
802 SCM_VALIDATE_INUM (2,pgid
);
803 fd
= SCM_FPORT_FDES (port
);
804 if (tcsetpgrp (fd
, SCM_INUM (pgid
)) == -1)
806 return SCM_UNSPECIFIED
;
809 #endif /* HAVE_TCSETPGRP */
811 /* Create a new C argv array from a scheme list of strings. */
812 /* Dirk:FIXME:: A quite similar function is implemented in dynl.c */
813 /* Dirk:FIXME:: In case of assertion errors, we get memory leaks */
816 scm_convert_exec_args (SCM args
, int argn
, const char *subr
)
822 argc
= scm_ilength (args
);
823 SCM_ASSERT (argc
>= 0, args
, argn
, subr
);
824 argv
= (char **) scm_must_malloc ((argc
+ 1) * sizeof (char *), subr
);
825 for (i
= 0; !SCM_NULLP (args
); args
= SCM_CDR (args
), ++i
)
827 SCM arg
= SCM_CAR (args
);
832 SCM_ASSERT (SCM_STRINGP (arg
), args
, argn
, subr
);
833 len
= SCM_STRING_LENGTH (arg
);
834 src
= SCM_STRING_CHARS (arg
);
835 dst
= (char *) scm_must_malloc (len
+ 1, subr
);
836 memcpy (dst
, src
, len
);
844 SCM_DEFINE (scm_execl
, "execl", 1, 0, 1,
845 (SCM filename
, SCM args
),
846 "Executes the file named by @var{path} as a new process image.\n"
847 "The remaining arguments are supplied to the process; from a C program\n"
848 "they are accessable as the @code{argv} argument to @code{main}.\n"
849 "Conventionally the first @var{arg} is the same as @var{path}.\n"
850 "All arguments must be strings. \n\n"
851 "If @var{arg} is missing, @var{path} is executed with a null\n"
852 "argument list, which may have system-dependent side-effects.\n\n"
853 "This procedure is currently implemented using the @code{execv} system\n"
854 "call, but we call it @code{execl} because of its Scheme calling interface.")
855 #define FUNC_NAME s_scm_execl
858 SCM_VALIDATE_STRING (1, filename
);
859 SCM_STRING_COERCE_0TERMINATION_X (filename
);
860 execargv
= scm_convert_exec_args (args
, SCM_ARG2
, FUNC_NAME
);
861 execv (SCM_STRING_CHARS (filename
), execargv
);
868 SCM_DEFINE (scm_execlp
, "execlp", 1, 0, 1,
869 (SCM filename
, SCM args
),
870 "Similar to @code{execl}, however if\n"
871 "@var{filename} does not contain a slash\n"
872 "then the file to execute will be located by searching the\n"
873 "directories listed in the @code{PATH} environment variable.\n\n"
874 "This procedure is currently implemented using the @code{execvp} system\n"
875 "call, but we call it @code{execlp} because of its Scheme calling interface.")
876 #define FUNC_NAME s_scm_execlp
879 SCM_VALIDATE_STRING (1, filename
);
880 SCM_STRING_COERCE_0TERMINATION_X (filename
);
881 execargv
= scm_convert_exec_args (args
, SCM_ARG2
, FUNC_NAME
);
882 execvp (SCM_STRING_CHARS (filename
), execargv
);
890 environ_list_to_c (SCM envlist
, int arg
, const char *proc
)
896 num_strings
= scm_ilength (envlist
);
897 SCM_ASSERT (num_strings
>= 0, envlist
, arg
, proc
);
898 result
= (char **) malloc ((num_strings
+ 1) * sizeof (char *));
900 scm_memory_error (proc
);
901 for (i
= 0; !SCM_NULLP (envlist
); ++i
, envlist
= SCM_CDR (envlist
))
903 SCM str
= SCM_CAR (envlist
);
907 SCM_ASSERT (SCM_STRINGP (str
), envlist
, arg
, proc
);
908 len
= SCM_STRING_LENGTH (str
);
909 src
= SCM_STRING_CHARS (str
);
910 result
[i
] = malloc (len
+ 1);
911 if (result
[i
] == NULL
)
912 scm_memory_error (proc
);
913 memcpy (result
[i
], src
, len
);
920 SCM_DEFINE (scm_execle
, "execle", 2, 0, 1,
921 (SCM filename
, SCM env
, SCM args
),
922 "Similar to @code{execl}, but the environment of the new process is\n"
923 "specified by @var{env}, which must be a list of strings as returned by the\n"
924 "@code{environ} procedure.\n\n"
925 "This procedure is currently implemented using the @code{execve} system\n"
926 "call, but we call it @code{execle} because of its Scheme calling interface.")
927 #define FUNC_NAME s_scm_execle
932 SCM_VALIDATE_STRING (1, filename
);
933 SCM_STRING_COERCE_0TERMINATION_X (filename
);
935 execargv
= scm_convert_exec_args (args
, SCM_ARG1
, FUNC_NAME
);
936 exec_env
= environ_list_to_c (env
, SCM_ARG2
, FUNC_NAME
);
937 execve (SCM_STRING_CHARS (filename
), execargv
, exec_env
);
944 SCM_DEFINE (scm_fork
, "primitive-fork", 0, 0, 0,
946 "Creates a new \"child\" process by duplicating the current \"parent\" process.\n"
947 "In the child the return value is 0. In the parent the return value is\n"
948 "the integer process ID of the child.\n\n"
949 "This procedure has been renamed from @code{fork} to avoid a naming conflict\n"
950 "with the scsh fork.")
951 #define FUNC_NAME s_scm_fork
957 return SCM_MAKINUM (0L+pid
);
962 SCM_DEFINE (scm_uname
, "uname", 0, 0, 0,
964 "Returns an object with some information about the computer system the\n"
965 "program is running on.")
966 #define FUNC_NAME s_scm_uname
969 SCM ans
= scm_c_make_vector (5, SCM_UNSPECIFIED
);
970 SCM
*ve
= SCM_VELTS (ans
);
971 if (uname (&buf
) < 0)
973 ve
[0] = scm_makfrom0str (buf
.sysname
);
974 ve
[1] = scm_makfrom0str (buf
.nodename
);
975 ve
[2] = scm_makfrom0str (buf
.release
);
976 ve
[3] = scm_makfrom0str (buf
.version
);
977 ve
[4] = scm_makfrom0str (buf
.machine
);
980 ve[5] = scm_makfrom0str (buf.domainname);
985 #endif /* HAVE_UNAME */
987 SCM_DEFINE (scm_environ
, "environ", 0, 1, 0,
989 "If @var{env} is omitted, returns the current environment as a list of strings.\n"
990 "Otherwise it sets the current environment, which is also the\n"
991 "default environment for child processes, to the supplied list of strings.\n"
992 "Each member of @var{env} should be of the form\n"
993 "@code{NAME=VALUE} and values of @code{NAME} should not be duplicated.\n"
994 "If @var{env} is supplied then the return value is unspecified.")
995 #define FUNC_NAME s_scm_environ
997 if (SCM_UNBNDP (env
))
998 return scm_makfromstrs (-1, environ
);
1003 new_environ
= environ_list_to_c (env
, SCM_ARG1
, FUNC_NAME
);
1004 /* Free the old environment, except when called for the first
1009 static int first
= 1;
1012 for (ep
= environ
; *ep
!= NULL
; ep
++)
1014 free ((char *) environ
);
1018 environ
= new_environ
;
1019 return SCM_UNSPECIFIED
;
1026 SCM_DEFINE (scm_tmpnam
, "tmpnam", 0, 0, 0,
1028 "Create a new file in the file system with a unique name. The return\n"
1029 "value is the name of the new file. This function is implemented with\n"
1030 "the @code{tmpnam} function in the system libraries.")
1031 #define FUNC_NAME s_scm_tmpnam
1033 char name
[L_tmpnam
];
1034 SCM_SYSCALL (tmpnam (name
););
1035 return scm_makfrom0str (name
);
1041 SCM_DEFINE (scm_utime
, "utime", 1, 2, 0,
1042 (SCM pathname
, SCM actime
, SCM modtime
),
1043 "@code{utime} sets the access and modification times for\n"
1044 "the file named by @var{path}. If @var{actime} or @var{modtime}\n"
1045 "is not supplied, then the current time is used.\n"
1046 "@var{actime} and @var{modtime}\n"
1047 "must be integer time values as returned by the @code{current-time}\n"
1051 "(utime \"foo\" (- (current-time) 3600))\n"
1052 "@end smalllisp\n\n"
1053 "will set the access time to one hour in the past and the modification\n"
1054 "time to the current time.")
1055 #define FUNC_NAME s_scm_utime
1058 struct utimbuf utm_tmp
;
1060 SCM_VALIDATE_STRING (1, pathname
);
1061 SCM_STRING_COERCE_0TERMINATION_X (pathname
);
1062 if (SCM_UNBNDP (actime
))
1063 SCM_SYSCALL (time (&utm_tmp
.actime
));
1065 utm_tmp
.actime
= SCM_NUM2ULONG (2,actime
);
1067 if (SCM_UNBNDP (modtime
))
1068 SCM_SYSCALL (time (&utm_tmp
.modtime
));
1070 utm_tmp
.modtime
= SCM_NUM2ULONG (3,modtime
);
1072 SCM_SYSCALL (rv
= utime (SCM_STRING_CHARS (pathname
), &utm_tmp
));
1075 return SCM_UNSPECIFIED
;
1079 SCM_DEFINE (scm_access
, "access?", 2, 0, 0,
1080 (SCM path
, SCM how
),
1081 "Returns @code{#t} if @var{path} corresponds to an existing\n"
1082 "file and the current process\n"
1083 "has the type of access specified by @var{how}, otherwise \n"
1085 "@var{how} should be specified\n"
1086 "using the values of the variables listed below. Multiple values can\n"
1087 "be combined using a bitwise or, in which case @code{#t} will only\n"
1088 "be returned if all accesses are granted.\n\n"
1089 "Permissions are checked using the real id of the current process,\n"
1090 "not the effective id, although it's the effective id which determines\n"
1091 "whether the access would actually be granted.\n\n"
1093 "test for read permission.\n"
1096 "test for write permission.\n"
1099 "test for execute permission.\n"
1102 "test for existence of the file.\n"
1104 #define FUNC_NAME s_scm_access
1108 SCM_VALIDATE_STRING (1, path
);
1109 SCM_STRING_COERCE_0TERMINATION_X (path
);
1110 SCM_VALIDATE_INUM (2, how
);
1111 rv
= access (SCM_STRING_CHARS (path
), SCM_INUM (how
));
1112 return SCM_NEGATE_BOOL(rv
);
1116 SCM_DEFINE (scm_getpid
, "getpid", 0, 0, 0,
1118 "Returns an integer representing the current process ID.")
1119 #define FUNC_NAME s_scm_getpid
1121 return SCM_MAKINUM ((unsigned long) getpid ());
1125 SCM_DEFINE (scm_putenv
, "putenv", 1, 0, 0,
1127 "Modifies the environment of the current process, which is\n"
1128 "also the default environment inherited by child processes.\n\n"
1129 "If @var{string} is of the form @code{NAME=VALUE} then it will be written\n"
1130 "directly into the environment, replacing any existing environment string\n"
1132 "name matching @code{NAME}. If @var{string} does not contain an equal\n"
1133 "sign, then any existing string with name matching @var{string} will\n"
1135 "The return value is unspecified.")
1136 #define FUNC_NAME s_scm_putenv
1141 SCM_VALIDATE_STRING (1, str
);
1142 /* must make a new copy to be left in the environment, safe from gc. */
1143 ptr
= malloc (SCM_STRING_LENGTH (str
) + 1);
1146 strncpy (ptr
, SCM_STRING_CHARS (str
), SCM_STRING_LENGTH (str
));
1147 ptr
[SCM_STRING_LENGTH (str
)] = 0;
1151 return SCM_UNSPECIFIED
;
1155 #ifdef HAVE_SETLOCALE
1156 SCM_DEFINE (scm_setlocale
, "setlocale", 1, 1, 0,
1157 (SCM category
, SCM locale
),
1158 "If @var{locale} is omitted, returns the current value of the specified\n"
1159 "locale category \n"
1160 "as a system-dependent string.\n"
1161 "@var{category} should be specified using the values @code{LC_COLLATE},\n"
1162 "@code{LC_ALL} etc.\n\n"
1163 "Otherwise the specified locale category is set to\n"
1164 "the string @var{locale}\n"
1165 "and the new value is returned as a system-dependent string. If @var{locale}\n"
1166 "is an empty string, the locale will be set using envirionment variables.")
1167 #define FUNC_NAME s_scm_setlocale
1172 SCM_VALIDATE_INUM (1,category
);
1173 if (SCM_UNBNDP (locale
))
1179 SCM_VALIDATE_STRING (2, locale
);
1180 SCM_STRING_COERCE_0TERMINATION_X (locale
);
1181 clocale
= SCM_STRING_CHARS (locale
);
1184 rv
= setlocale (SCM_INUM (category
), clocale
);
1187 return scm_makfrom0str (rv
);
1190 #endif /* HAVE_SETLOCALE */
1193 SCM_DEFINE (scm_mknod
, "mknod", 4, 0, 0,
1194 (SCM path
, SCM type
, SCM perms
, SCM dev
),
1195 "Creates a new special file, such as a file corresponding to a device.\n"
1196 "@var{path} specifies the name of the file. @var{type} should\n"
1197 "be one of the following symbols:\n"
1198 "regular, directory, symlink, block-special, char-special,\n"
1199 "fifo, or socket. @var{perms} (an integer) specifies the file permissions.\n"
1200 "@var{dev} (an integer) specifies which device the special file refers\n"
1201 "to. Its exact interpretation depends on the kind of special file\n"
1202 "being created.\n\n"
1205 "(mknod \"/dev/fd0\" 'block-special #o660 (+ (* 2 256) 2))\n"
1207 "The return value is unspecified.")
1208 #define FUNC_NAME s_scm_mknod
1214 SCM_VALIDATE_STRING (1, path
);
1215 SCM_VALIDATE_SYMBOL (2,type
);
1216 SCM_VALIDATE_INUM (3,perms
);
1217 SCM_VALIDATE_INUM (4,dev
);
1218 SCM_STRING_COERCE_0TERMINATION_X (path
);
1220 p
= SCM_SYMBOL_CHARS (type
);
1221 if (strcmp (p
, "regular") == 0)
1223 else if (strcmp (p
, "directory") == 0)
1225 else if (strcmp (p
, "symlink") == 0)
1227 else if (strcmp (p
, "block-special") == 0)
1229 else if (strcmp (p
, "char-special") == 0)
1231 else if (strcmp (p
, "fifo") == 0)
1234 else if (strcmp (p
, "socket") == 0)
1238 SCM_OUT_OF_RANGE (2,type
);
1240 SCM_SYSCALL (val
= mknod (SCM_STRING_CHARS (path
), ctype
| SCM_INUM (perms
),
1244 return SCM_UNSPECIFIED
;
1247 #endif /* HAVE_MKNOD */
1250 SCM_DEFINE (scm_nice
, "nice", 1, 0, 0,
1252 "Increment the priority of the current process by @var{incr}. A higher\n"
1253 "priority value means that the process runs less often.\n"
1254 "The return value is unspecified.")
1255 #define FUNC_NAME s_scm_nice
1257 SCM_VALIDATE_INUM (1,incr
);
1258 if (nice(SCM_INUM(incr
)) != 0)
1260 return SCM_UNSPECIFIED
;
1263 #endif /* HAVE_NICE */
1266 SCM_DEFINE (scm_sync
, "sync", 0, 0, 0,
1268 "Flush the operating system disk buffers.\n"
1269 "The return value is unspecified.")
1270 #define FUNC_NAME s_scm_sync
1273 return SCM_UNSPECIFIED
;
1276 #endif /* HAVE_SYNC */
1278 #if HAVE_LIBCRYPT && HAVE_CRYPT_H
1279 SCM_DEFINE (scm_crypt
, "crypt", 2, 0, 0,
1280 (SCM key
, SCM salt
),
1281 "Encrypt @var{key} using @var{salt} as the salt value to the\n"
1282 "crypt(3) library call\n")
1283 #define FUNC_NAME s_scm_crypt
1287 SCM_VALIDATE_STRING (1, key
);
1288 SCM_VALIDATE_STRING (2, salt
);
1289 SCM_STRING_COERCE_0TERMINATION_X (key
);
1290 SCM_STRING_COERCE_0TERMINATION_X (salt
);
1292 p
= crypt (SCM_STRING_CHARS (key
), SCM_STRING_CHARS (salt
));
1293 return scm_makfrom0str (p
);
1296 #endif /* HAVE_LIBCRYPT && HAVE_CRYPT_H */
1299 SCM_DEFINE (scm_chroot
, "chroot", 1, 0, 0,
1301 "Change the root directory to that specified in @var{path}.\n"
1302 "This directory will be used for path names beginning with\n"
1303 "@file{/}. The root directory is inherited by all children\n"
1304 "of the current process. Only the superuser may change the\n"
1306 #define FUNC_NAME s_scm_chroot
1308 SCM_VALIDATE_STRING (1, path
);
1309 SCM_STRING_COERCE_0TERMINATION_X (path
);
1311 if (chroot (SCM_STRING_CHARS (path
)) == -1)
1313 return SCM_UNSPECIFIED
;
1316 #endif /* HAVE_CHROOT */
1319 SCM_DEFINE (scm_getlogin
, "getlogin", 0, 0, 0,
1321 "Return a string containing the name of the user logged in on\n"
1322 "the controlling terminal of the process, or @code{#f} if this\n"
1323 "information cannot be obtained.")
1324 #define FUNC_NAME s_scm_getlogin
1331 return scm_makfrom0str (p
);
1334 #endif /* HAVE_GETLOGIN */
1337 SCM_DEFINE (scm_cuserid
, "cuserid", 0, 0, 0,
1339 "Return a string containing a user name associated with the\n"
1340 "effective user id of the process. Return @code{#f} if this\n"
1341 "information cannot be obtained.")
1342 #define FUNC_NAME s_scm_cuserid
1349 return scm_makfrom0str (p
);
1352 #endif /* HAVE_CUSERID */
1354 #if HAVE_GETPRIORITY
1355 SCM_DEFINE (scm_getpriority
, "getpriority", 2, 0, 0,
1356 (SCM which
, SCM who
),
1357 "Return the scheduling priority of the process, process group\n"
1358 "or user, as indicated by @var{which} and @var{who}. @var{which}\n"
1359 "is one of the variables @code{PRIO_PROCESS}, @code{PRIO_PGRP}\n"
1360 "or @code{PRIO_USER}, and @var{who} is interpreted relative to\n"
1361 "@var{which} (a process identifier for @code{PRIO_PROCESS},\n"
1362 "process group identifier for @code{PRIO_PGRP}, and a user\n"
1363 "identifier for @code{PRIO_USER}. A zero value of @var{who}\n"
1364 "denotes the current process, process group, or user. Return\n"
1365 "the highest priority (lowest numerical value) of any of the\n"
1366 "specified processes.")
1367 #define FUNC_NAME s_scm_getpriority
1369 int cwhich
, cwho
, ret
;
1371 SCM_VALIDATE_INUM_COPY (1, which
, cwhich
);
1372 SCM_VALIDATE_INUM_COPY (2, who
, cwho
);
1374 /* We have to clear errno and examine it later, because -1 is a
1375 legal return value for getpriority(). */
1377 ret
= getpriority (cwhich
, cwho
);
1380 return SCM_MAKINUM (ret
);
1383 #endif /* HAVE_GETPRIORITY */
1385 #if HAVE_SETPRIORITY
1386 SCM_DEFINE (scm_setpriority
, "setpriority", 3, 0, 0,
1387 (SCM which
, SCM who
, SCM prio
),
1388 "Set the scheduling priority of the process, process group\n"
1389 "or user, as indicated by @var{which} and @var{who}. @var{which}\n"
1390 "is one of the variables @code{PRIO_PROCESS}, @code{PRIO_PGRP}\n"
1391 "or @code{PRIO_USER}, and @var{who} is interpreted relative to\n"
1392 "@var{which} (a process identifier for @code{PRIO_PROCESS},\n"
1393 "process group identifier for @code{PRIO_PGRP}, and a user\n"
1394 "identifier for @code{PRIO_USER}. A zero value of @var{who}\n"
1395 "denotes the current process, process group, or user.\n"
1396 "@var{prio} is a value in the range -20 and 20, the default\n"
1397 "priority is 0; lower priorities cause more favorable\n"
1398 "scheduling. Sets the priority of all of the specified\n"
1399 "processes. Only the super-user may lower priorities.\n"
1400 "The return value is not specified.")
1401 #define FUNC_NAME s_scm_setpriority
1403 int cwhich
, cwho
, cprio
;
1405 SCM_VALIDATE_INUM_COPY (1, which
, cwhich
);
1406 SCM_VALIDATE_INUM_COPY (2, who
, cwho
);
1407 SCM_VALIDATE_INUM_COPY (3, prio
, cprio
);
1409 if (setpriority (cwhich
, cwho
, cprio
) == -1)
1411 return SCM_UNSPECIFIED
;
1414 #endif /* HAVE_SETPRIORITY */
1417 SCM_DEFINE (scm_getpass
, "getpass", 1, 0, 0,
1419 "Display @var{prompt} to the standard error output and read\n"
1420 "a password from @file{/dev/tty}. If this file is not\n"
1421 "accessible, it reads from standard input. The password may be\n"
1422 "up to 127 characters in length. Additional characters and the\n"
1423 "terminating newline character are discarded. While reading\n"
1424 "the password, echoing and the generation of signals by special\n"
1425 "characters is disabled.")
1426 #define FUNC_NAME s_scm_getpass
1431 SCM_VALIDATE_STRING (1, prompt
);
1432 SCM_STRING_COERCE_0TERMINATION_X (prompt
);
1434 p
= getpass(SCM_STRING_CHARS (prompt
));
1435 passwd
= scm_makfrom0str (p
);
1437 /* Clear out the password in the static buffer. */
1438 memset (p
, 0, strlen (p
));
1443 #endif /* HAVE_GETPASS */
1446 SCM_DEFINE (scm_flock
, "flock", 2, 0, 0,
1447 (SCM file
, SCM operation
),
1448 "Apply or remove an advisory lock on an open file.\n"
1449 "@var{operation} specifies the action to be done:\n"
1452 "Shared lock. More than one process may hold a shared lock\n"
1453 "for a given file at a given time.\n"
1455 "Exclusive lock. Only one process may hold an exclusive lock\n"
1456 "for a given file at a given time.\n"
1458 "Unlock the file.\n"
1460 "Don't block when locking. May be specified by bitwise OR'ing\n"
1461 "it to one of the other operations.\n"
1463 "The return value is not specified. @var{file} may be an open\n"
1464 "file descriptor or an open file descriptior port.")
1465 #define FUNC_NAME s_scm_flock
1467 int coperation
, fdes
;
1469 if (SCM_INUMP (file
))
1470 fdes
= SCM_INUM (file
);
1473 SCM_VALIDATE_OPFPORT (2, file
);
1475 fdes
= SCM_FPORT_FDES (file
);
1477 SCM_VALIDATE_INUM_COPY (2, operation
, coperation
);
1478 if (flock (fdes
, coperation
) == -1)
1480 return SCM_UNSPECIFIED
;
1483 #endif /* HAVE_FLOCK */
1485 #if HAVE_SETHOSTNAME
1486 SCM_DEFINE (scm_sethostname
, "sethostname", 1, 0, 0,
1488 "Set the host name of the current processor to @var{name}. May\n"
1489 "only be used by the superuser. The return value is not\n"
1491 #define FUNC_NAME s_scm_sethostname
1493 SCM_VALIDATE_STRING (1, name
);
1494 SCM_STRING_COERCE_0TERMINATION_X (name
);
1496 if (sethostname (SCM_STRING_CHARS (name
), SCM_STRING_LENGTH (name
)) == -1)
1498 return SCM_UNSPECIFIED
;
1501 #endif /* HAVE_SETHOSTNAME */
1503 #if HAVE_GETHOSTNAME
1504 SCM_DEFINE (scm_gethostname
, "gethostname", 0, 0, 0,
1506 "Return the host name of the current processor.")
1507 #define FUNC_NAME s_scm_gethostname
1510 char *p
= scm_must_malloc (len
, "gethostname");
1513 res
= gethostname (p
, len
);
1514 while (res
== -1 && errno
== ENAMETOOLONG
)
1516 p
= scm_must_realloc (p
, len
, len
* 2, "gethostname");
1518 res
= gethostname (p
, len
);
1525 name
= scm_makfrom0str (p
);
1530 #endif /* HAVE_GETHOSTNAME */
1535 scm_add_feature ("posix");
1537 scm_add_feature ("EIDs");
1540 scm_sysintern ("WAIT_ANY", SCM_MAKINUM (WAIT_ANY
));
1543 scm_sysintern ("WAIT_MYPGRP", SCM_MAKINUM (WAIT_MYPGRP
));
1546 scm_sysintern ("WNOHANG", SCM_MAKINUM (WNOHANG
));
1549 scm_sysintern ("WUNTRACED", SCM_MAKINUM (WUNTRACED
));
1552 /* access() symbols. */
1553 scm_sysintern ("R_OK", SCM_MAKINUM (R_OK
));
1554 scm_sysintern ("W_OK", SCM_MAKINUM (W_OK
));
1555 scm_sysintern ("X_OK", SCM_MAKINUM (X_OK
));
1556 scm_sysintern ("F_OK", SCM_MAKINUM (F_OK
));
1559 scm_sysintern ("LC_COLLATE", SCM_MAKINUM (LC_COLLATE
));
1562 scm_sysintern ("LC_CTYPE", SCM_MAKINUM (LC_CTYPE
));
1565 scm_sysintern ("LC_MONETARY", SCM_MAKINUM (LC_MONETARY
));
1568 scm_sysintern ("LC_NUMERIC", SCM_MAKINUM (LC_NUMERIC
));
1571 scm_sysintern ("LC_TIME", SCM_MAKINUM (LC_TIME
));
1574 scm_sysintern ("LC_MESSAGES", SCM_MAKINUM (LC_MESSAGES
));
1577 scm_sysintern ("LC_ALL", SCM_MAKINUM (LC_ALL
));
1580 scm_sysintern ("PIPE_BUF", scm_long2num (PIPE_BUF
));
1584 scm_sysintern ("PRIO_PROCESS", SCM_MAKINUM (PRIO_PROCESS
));
1587 scm_sysintern ("PRIO_PGRP", SCM_MAKINUM (PRIO_PGRP
));
1590 scm_sysintern ("PRIO_USER", SCM_MAKINUM (PRIO_USER
));
1594 scm_sysintern ("LOCK_SH", SCM_MAKINUM (LOCK_SH
));
1597 scm_sysintern ("LOCK_EX", SCM_MAKINUM (LOCK_EX
));
1600 scm_sysintern ("LOCK_UN", SCM_MAKINUM (LOCK_UN
));
1603 scm_sysintern ("LOCK_NB", SCM_MAKINUM (LOCK_NB
));
1606 #include "libguile/cpp_sig_symbols.c"
1607 #ifndef SCM_MAGIC_SNARFER
1608 #include "libguile/posix.x"