mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-19 18:20:22 +02:00
* stime.h: prototype for scm_times.
* stime.c (scm_times): new procedure. * ioext.c (scm_fseek): if the first argument is a file descriptor call lseek. (scm_ftell): if the first argument is a file descriptor call lseek (sic). * filesys.h: prototypes for scm_open_fdes, scm_fsync. * filesys.c (scm_chmod): if the first argument is a file descriptor, call fchmod. (scm_chown): if the first argument is a port or file descriptor, call fchown. (scm_truncate_file): new procedure. Add DEFER/ALLOW INTS to a few other procedures. (scm_fsync): new procedure. (scm_open_fdes): new procedure. (scm_open): use scm_open_fdes. If mode isn't specified, 666 will now be used. (scm_fcntl): the first argument can now be a file descriptor. The third argument is now optional. * posix.c (scm_execl, scm_execlp): make the filename argument compulsory, since omitting it causes SEGV. (scm_sync): return unspecified instead of #f. (scm_execle): new procedure. (environ_list_to_c): new procedure. (scm_environ): use environ_list_to_c. disable interrupts. (scm_convert_exec_args): take pos and subr arguments and improve error checking. * boot-9.scm: define tms accessors: clock, utime, stime, cutime, cstime.
This commit is contained in:
parent
db75135d74
commit
6afcd3b2b6
12 changed files with 469 additions and 169 deletions
|
@ -160,6 +160,29 @@ scm_get_internal_real_time()
|
|||
}
|
||||
#endif
|
||||
|
||||
SCM_PROC (s_times, "times", 0, 0, 0, scm_times);
|
||||
SCM
|
||||
scm_times (void)
|
||||
{
|
||||
#ifdef HAVE_TIMES
|
||||
struct tms t;
|
||||
clock_t rv;
|
||||
|
||||
SCM result = scm_make_vector (SCM_MAKINUM(5), SCM_UNDEFINED, SCM_UNDEFINED);
|
||||
rv = times (&t);
|
||||
if (rv == -1)
|
||||
scm_syserror (s_times);
|
||||
SCM_VELTS (result)[0] = scm_long2num (rv);
|
||||
SCM_VELTS (result)[1] = scm_long2num (t.tms_utime);
|
||||
SCM_VELTS (result)[2] = scm_long2num (t.tms_stime);
|
||||
SCM_VELTS (result)[3] = scm_long2num (t.tms_cutime);
|
||||
SCM_VELTS (result)[4] = scm_long2num (t.tms_cstime);
|
||||
return result;
|
||||
#else
|
||||
scm_sysmissing (s_times);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef HAVE_TZSET
|
||||
/* GNU-WIN32's cygwin.dll doesn't have this. */
|
||||
#define tzset()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue