| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We test the .txr_history file for bad permissions also, not
only .txr_profile. Though commands are not automatically
executed out of .txr_history, a user could execute a harmful
command due to not noticing the malicious modification.
An additional useful diagnostic is added: if a dotfile is
found to have the wrong permission, it's possible that this is
due to a poor umask setting. We check for a weak umask and
warn the user.
Note: the .txr_history check doesn't use the open stream,
therefore it is vulnerable to TOCTTOU race condition:
the file looks good, but between the time we verify this
and open the file to load it, the file has been replaced
by a malicious one.
* parser.c (report_security_problem): New static function,
factored out of load_rcfile. Includes umask test.
(load_rcfile): Call report_security_problem if the
.txr_profile is writable to others. Also, no need to call stat
any more; the path testing function now takes a stream
argument.
(repl): Check .txr_history for inappropriate writepermissions
also and call report_security_problem if so.
* sysif.c (umask_wrap): Change static function to external
linkage.
* sysif.c (umask_wrap): Declaration updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is the eight and final round of an effort to enable
GCC's -Wextra option. The C++ compiler, with -Wextra,
doesn't like C's universal struct initializer { 0 },
individually complaining about all the remaining members
not being initialized. What works in C++ is the { }
initializer. Conditional definition to the rescue.
* lib.h (all_zero_init): New macro which expands to
{ } under C++, and { 0 } under C.
* lib.c (make_time_impl, epoch_tm, time_string_meth,
time_parse_meth): Use all_zero_init.
* parser.c (prime_parser): Likewise.
* socket.c (sock_mark_connected): Likewise.
* sysif.c (fcntl_wrap): Likewise.
* termios.c (encode_speeds, decode_speeds): Likewise.
* configure (diag_flags): Add -Wextra.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is the seventh round of an effort to enable GCC's -Wextra
option. Warnings about switch fallthrough situations are
addressed. GCC now has a diagnostic for this that is enabled
by -Wextra in such a way that if a fallthrough comment is
present, the diagnostic is suppressed. In much of the code,
we have such a comment. It's missing in a few places, or
misplaced. There are also some real bugs.
* hash.c (hash_buf): Add fallthrough comments to intentional
fallthrough cases.
(hash_hash_op): bugfix: add break statement. The 32 and 64
bit cases are independent (at compile time).
* lib.c (cdr, nullify, list_collect, empty): Add fallthrough
comment.
(int_str): Add missing break. This has not caused a
bug though because setting the octzero flag in the zerox
case is harmless to the logic which follows.
* linenoise.c (edit): Move misplaced fallthrough.
* sysif.c (fcntl_wrap): Bugfix: add missing break, without
which errno is tampered to hold EINVAL, in spite of a
successful F_SETLK, F_SETLKW or F_GETLK operation.
* unwind.h (jmp_restore): Declare noreturn, so that GCC
does not issue a false positive warning about a fallthrough
in uw_unwind_to_exit_point.
* utf8.c (utf8_from_buf, utf8_decode): Move a fallthrough
comment outside of preprocessing, so it is properly processed
by GCC's diagnostic.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is the sixth round of an effort to enable GCC's -Wextra
option. Warnings about uninitialized members are addressed.
I am not happy with what had to be done in linenoise.c.
We just need a dummy circular list node for the lino_list,
which we achieved with a dummy all zero struture, with
statially initialized next and prev pointers. There are way
too many members to initialize, including one that has struct
termios type containing a nonportable set of members.
On the plus size, the lino_list structure now moves into the
BSS section, reducing the executable size slightly.
* lib.c (cptr_ops): Initialize using cobj_ops_init, which has
all the initializers already, and should have been used for
this in the first place.
* linenoise/linenoise.c (lino_list): Remove initializer,
which eliminates the warning about some members not being
initialized.
(lino_init): Initialize the next and prev pointers here.
* parser.c (parser_ops): Initialize with cobj_ops_init.
* stream.h (stdio_mode_init_blank, stdio_mode_init_r,
stdio_mode_init_rpb): Add initializer corresponding to redir
array member of struct stdio_mode.
* sysif.c (cptr_dl_ops): Use cobj_ops_init.
* tree.c (tree_iter_init): Add initializer for the path
array member of struct tree_iter.
(tr_rebuild): Initialize all fields of the dummy object.
Since it's a union, we just have to deal with the any
member. There are two layouts for the obj_common fields
based on whether CONFIG_GEN_GC is enabled. This is ugly, but
occurs in one place only.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is the third round of an effort to enable GCC's -Wextra
option. Instances of signed/unsigned mismatch between
the branches of ternary conditionals are addressed.
* ffi.c (pad_retval): Add cast into the consequent of
the conditional so it yields size_t, like the alternative.
* lib.c (split_str_keep): Likewise.
(vector): Cast -1 to ucnum so it has the same type as the
alloc_plus opposite to it.
* parser.c (lino_getch): Add a cast to wint_t to match
return value and opposite WEOF operand.
* stream.c (generic_get_line): Likewise.
* sysif.c (c_time): Convert both consequent and alternative
to time_t to silence warning.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is the second round of an effort to enable GCC's -Wextra
option. All function parameters that are unused and
are removable are removed. They are eliminated from the
function defintions, declarations, callers, and any related
function pointer variables or structure members.
* arith.c (nary_simple_op): Remove unused self parameter.
See lib.c: maxv, minv.
* chksum.c (crc32_buf, crc32_str): Remove unused self
parameter.
(crc32): Don't pass self to the above functions.
* eval.c (copy_env_handler, copy_bh_env_handler): Remove
unused parent parameter. See unwind.c.
(supplement_op_syms): Remove unused max parameter.
(me_op): Don't pass max to supplement_op_syms.
* lib.c (seq_iter_rewind): Remove unused self parameter.
(lazy_flatten_func): Remove unused env parameter.
(lazy_flatten): Use func_n1 to create non-environment-carrying
funtion out of lazy_flatten_func.
(maxv, minv): Don't pass self parameter to nary_simple_op.
(middle_pivot): Remove unused lessfun param.
(quicksort): Don't pass lessfun to middle_pivot.
(diff, isec): Don't pass self to seq_iter_rewind.
* lib.h (seq_iter_rewind, nary_simple_op): Declarations
updated.
* struct.c (get_super_slots): Remove unused self parameteer.
(make_struct_type): Don't pass self to get_super_slots.
* sysif.c (flock_unpack): Remove unused self parameter.
(fcntl_wrap): Don't pass self to flock_unpack.
* unwind.c (uw_push_cont_copy): Remove parent parameter from
function pointer parameter. See eval.c: copy_env_handler.
(call_copy_handlers): Remove parent parameter and don't
pass that argument to the indirect call via pointer
to the copy handler function.
(revive_cont, capture_cont): Don't pass 0 value to
removed parent parameter of call_copy_handlers.
* unwind.h (struct uw_cont_copy): Function pointer member copy
loses parent parameter.
(uw_push_cont_copy): Declaration updated.
|
|
|
|
|
| |
* sysif.c (sysif_init): Fix misspelled FNM_EXTMATCH in #ifdef
causing registration of fnm-extmatch being excluded.
|
|
|
|
|
|
|
|
|
|
| |
* sysif.c (validate_salt): Take const wchar_t * argument
instead of val. Set errno and return null pointer instead of
throwing, so we don't have two places that throw an exception
related to crypt.
(crypt_wrap): Put exception at the end. Return hash only if
validate_salt returns a non-null pointer and so does crypt.
In all other cases, reach exception call.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The crypt function on glibc, and maybe other platforms, simply
crashes when given a perfectly valid salt string that contains
invalid salt syntax. This is nasty; we want TXR Lisp
library functions to be robust; bringing down the image is not
acceptable.
Also, crypt may return a null pointer. glibc's crypt does
this in certain situations, like when the "2a" (Blowfish)
algorithm is specified when not available. We are not checking
for this null return, in which case the ensuing crash is our
fault.
* sysif.c (salt_char_p, validate_salt): New functions.
(crypt_wrap): Validate the salt via validate_salt.
Check the return value from crypt/crypt_r; if null,
then throw an exception that incorporates the errno
information.
|
|
|
|
|
|
|
|
|
| |
This is Coreutils chmod behavior.
* sysif.c (chmod_wrap): Sample cmode into oldm at the start of
every assigment before punching the masked hole into cmode.
* tests/018/chmod.tl: Breaking test case added.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Within the same clause, permissions given by ugo must refer to
the unaltered permissions, before the target bits were masked
out, otherwise self-assignment like o=o just clears the
permissions. The other self-referential perm is X: it checks
for existing x permissions. That works with the current
value.
* sysif.c (chmod_wrap): Keep the old permissions in a new loop
variable called oldm. The u, g and o perms refer to oldm
rather than to the updated value in cmode. When we hit a
comma, we update oldm to the current value. The code for
this is now in one place with a goto.
* tests/018/chmod.tl: New test case that fails in the
absence of this fix. Test cases confirming that X
refers to the current permissions.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* sysif.c (chmod_wrap): The chm_comma state is transitioned to
after seeing a right hand side u, g or o. These do not combine
with other letters, so ch_comma expects a comma after which a
new permission clause we start,. Therefore the srcm and who
variables must be rest. It's also a good idea to continue the
loop.
* tests/018/chmod.tl: New test case which exposed
the above issue.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* sysif.c (chmod_wrap): Again, related to the = operator, we
must not punch a hole in the suid and sgid bits for all
non-directory objects. This was based on a misinterpretation
of some coreutils documentation, and doesn't match the
actual behavior. Rather, if the owner is a target (including
implicitly) then we mask out suid; and if the group owner is a
targe, then we mask out sgid. Thus when we are doing a
permission set not targetting the owner we don't touch suid,
and similarly for the group owner and setgid.
* tests/018/chmod.tl: Failed test diagnostics now
identify which mode string was used.
Some existing tests involving the suid/sgid bits
have to be revised because this commit reflects
a correction in the requirements. One new test is added.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* sysif.c (chmod_wrap): When processing set (=), only punch a
hole in the target permission area once per clause, so as not
to clobber previously set modes. We do this by checking for
the chm_perm state. Whenever '=' is processed, the state machine
enters into that state; when any permission letter is then
processed, it transitions out of that state. This gets the
"u=rwsx" test to pass.
* tests/018/chmod.tl: New tests.
|
|
|
|
|
|
|
|
|
| |
* sysif.c (chmod_wrap): The umask logic is not activating
after the first iteration through the loop, because when who
is zero, we clobber it by adding the bits for u, g, and o.
Then on subsequent iterations, who is no longer zero.
Instead, let us leave the value of who alone, and in
all the relevant places, check for it being zero.
|
|
|
|
|
| |
* sysif.c (chmod_wrap): Clear the sticky bit from the right
variable: cmode rather than bits.
|
|
|
|
|
|
| |
* sysif.c (chmod_wrap): The uw_throw expression contains an
otal format specifier ~o which requires an integer argument;
but the mode can be a string now. Split into two cases.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We can get rid of fstat_wrap entirely and make
the lstat and fstat function bindings point to the same
function.
* parser.c (load_rcfile): Call stat_wrap instead of
fstat_wrap.
* sysif.c (stat_wrap): Static function becomes extern. Useless
forward declaration removed.
(fstat_wrap): Static function removed.
(sysif_init): Bind fstat and lstat to the same function
object.
* sysif.h (fstat_wrap): Declaration removed.
(stat_wrap): Declaration added.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* sysif.c (get_fd): Move this function higher in the file to
avoid forward declarations. The do_fstatt code being moved into
do_stat needs to call it.
(do_stat): Provide stat and fstat functionality in one
function.
(do_fstat): Static function removed.
(fstat_wrap): Call do_stat instead of do_fstat.
* txr.1: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The chmod function can now take a string, which uses the same
conventions as the symbolic mode argument of the chmod utility.
* sysif.c (CHM_O, CHM_G, CHM_U): New preprocessor symbols.
(enum chm_state, enum chm_op): New enums.
(chmod_wrap): Allow argument to be a string, and in that case
interpret the chmod symbolic permission language.
* txr.1: Documented.
|
|
|
|
|
|
|
| |
* sysif.c (rmdir_wrap): New static function.
(sysif_init): rmdir intrinsic registered.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
* configure: New configure test for chown, fchown and lchown.
* sysif.c (get_fd): Define for HAVE_CHOWN also.
(do_chown, chown_wrap, lchown_wrap): New functions.
(sysif_init): chown and lchown intrinsics registered.
* txr.1: Documented.
|
|
|
|
|
|
|
| |
* sysif.c (mkdir_nothrow_exists): Return nil in the existence
case, when the object is a directory or a symlink to one.
* txr.1: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* sysif.c (do_stat, do_lstat): Functions relocated before
mkdir_nothrow_exists.
(mkdir_nothrow_exists): In the EEXIST case, call stat on the
object. If it's not a directory or a symlink to a directory,
then do not suppress the error; propagate it to the caller,
where it will become an exception.
* txr.1: Specify the behavior of ensure-dir more precisely:
that it only supresses the existence error for directories
and directory symlinks.
|
|
|
|
|
|
|
| |
* configure: detect mkfifo.
(sysif_init): Register mkfifo intrinsic.
* txr.1: Documented.
|
|
|
|
|
| |
* sysif.c (sysif_init): Fix incorrect registration of mknod,
whose third argument (dev) is documented as optional.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* configure: Detect various functions for setting file
timestamps.
* sysif.c (get_fd): Define this function for use by utimes
also.
(timens, do_utimes): New static functions.
(wrap_utimes, wrap_lutimes): New static functions.
(sysif_init): Register utimes and lutimes intrinsics.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some functions in utf8.c have w_ prefixes. They are wide
character wrappers for functions that take multi-byte string
inputs.
The prefix is being inappropriately used in the names of a
few sysif functions that should be named _wrap.
* sysif.c (w_stat, w_lstat, w_fstat): Rename to do_stat,
do_lstat and do_fstat, respectively. These are callbacks
used with stat_impl.
(statp, statl, statf): Rename to stat_wrap, lstat_wrap and
fstat_wrap, following existing convention. Additionally,
stat_wrap becomes static since nothing outside this file
calls it.
(sysif_init): Follow renames of statp, statl and statf.
* sysif.h (statp): Declaration removed.
(statf): Renamed to fstat_wrap.
* parser.c (load_rcfile): Follow statf rename.
|
|
|
|
|
|
|
| |
* sysif.c (get_fd): Make available under HAVE_SYS_STAT.
(fstat): Allow fd or stream argument using get_fd.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
| |
* configure: extend chmod detection to cover fchmod.
* sysif.c (get_fd): New static functions.
(chmod_wrap): Include fchmod wrapping for integer
or stream argument.
(sysif_init): Register fchmod intrinsic.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The sysif.h header breaks on some systems because it
references off_t, which requires <sys/types.h>. But the off_t
materials in this header are unnecessary; we can remove
them.
* sysif.c (off_t_num, num_off_t): Extern functions become static,
and are wrapped with #if HAVE_FSEEKO. These functions are
only called from sysif.c, only from code relying on fseeko.
* sysif.h (OFF_T_MAX, OFF_T_MIN): Macros not used anywhere are removed.
(off_t_num, num_off_t): Declarations removed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* LICENSE, LICENSE-CYG, METALICENSE, Makefile, alloca.h, args.c,
args.h, arith.c, arith.h, buf.c, buf.h, cadr.c, cadr.h,
chksum.c, chksum.h, chksums/crc32.c, chksums/crc32.h, combi.c,
combi.h, configure, debug.c, debug.h, eval.c, eval.h, ffi.c,
ffi.h, filter.c, filter.h, ftw.c, ftw.h, gc.c, gc.h, glob.c,
glob.h, hash.c, hash.h, itypes.c, itypes.h, jmp.S, lib.c,
lib.h, linenoise/linenoise.c, linenoise/linenoise.h,
lisplib.c, lisplib.h, match.c, match.h, parser.c, parser.h,
parser.l, parser.y, protsym.c, rand.c, rand.h, regex.c,
regex.h, share/txr/stdlib/asm.tl, share/txr/stdlib/awk.tl,
share/txr/stdlib/build.tl, share/txr/stdlib/cadr.tl,
share/txr/stdlib/compiler.tl, share/txr/stdlib/conv.tl,
share/txr/stdlib/debugger.tl, share/txr/stdlib/defset.tl,
share/txr/stdlib/doloop.tl, share/txr/stdlib/error.tl,
share/txr/stdlib/except.tl, share/txr/stdlib/ffi.tl,
share/txr/stdlib/getopts.tl, share/txr/stdlib/getput.tl,
share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl,
share/txr/stdlib/keyparams.tl, share/txr/stdlib/op.tl,
share/txr/stdlib/package.tl, share/txr/stdlib/param.tl,
share/txr/stdlib/path-test.tl, share/txr/stdlib/place.tl,
share/txr/stdlib/pmac.tl, share/txr/stdlib/save-exe.tl,
share/txr/stdlib/socket.tl, share/txr/stdlib/stream-wrap.tl,
share/txr/stdlib/struct.tl, share/txr/stdlib/tagbody.tl,
share/txr/stdlib/termios.tl, share/txr/stdlib/trace.tl,
share/txr/stdlib/txr-case.tl, share/txr/stdlib/type.tl,
share/txr/stdlib/vm-param.tl,
share/txr/stdlib/with-resources.tl,
share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl,
signal.c, signal.h, socket.c, socket.h, stream.c, stream.h,
struct.c, struct.h, strudel.c, strudel.h, sysif.c, sysif.h,
syslog.c, syslog.h, termios.c, termios.h, tree.c, tree.h,
txr.1, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h, vm.c,
vm.h, vmop.h, win/cleansvg.txr: Extended copyright notices
to 2020.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We introduce the function c_time to convert a Lisp integer
to time_t, and num_time to do the reverse conversion.
The FFI type time-t already does this right.
(See registration of time-t in ffi_init_extra_types).
* hash.c (gen_hash_seed): The first value out of time_sec_usec
corresponds to a time_t value. We now convert this to C number
using c_time rather than c_num. Also, while we are touching
this code, the microseconds value can convert directly to
ucnum with c_unum.
* lib.c (time_sec_usec): Use num_time for seconds.
(time_string_local, time_string_utc, time_fields_local,
time_fields_utc, time_struct_local, time_struct_utc): Use c_time.
(make_time_impl, time_parse_utc): Use num_time instead of num.
* signal.h (getitimer_wrap, setitimer_wrap): Convert tv_sec
members of struct timeval using c_time and num_time.
* sysif.c (c_time, num_time): New functions.
(stat_to_struct): Convert st_atime, st_mtime and st_ctime
to Lisp using num_time instead of num.
* sysif.c (c_time, num_time): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* configure (have_sys_stat): New variable. Set to y when our
test detects <sys/stat.h>. New test added for the presence of
high resolution time stamps in struct stat. If we have these,
we #define HAVE_STAT_NSEC 1 in config.h.
* share/txr/stdlib/path-test.tl (path-newer): Compare
nanosecond parts of the modification time if the seconds are
equal, improving the resolution of the test.
* sysif.c (atime_nsec_s, mtime_nsec_s, ctime_nsec_s): New
symbol variables.
(stat_to_struct): If nanosecond resolution is available, set
the new nanosecond slots from the three tv_nsec fields in
struct stat. Otherwise, set the new slots to zero.
(sysif_init): Initialize the new symbol variables. Add the
three new slots to the stat struct.
* sysif.c (atime_nsec_s, mtime_nsec_s, ctime_nsec_s):
Declared.
* txr.1: Documented new atime-nsec, mtime-nsec and ctime-nsec
slots of stat structure. Added note to path-newer mentioning
high resolution support.
|
|
|
|
|
|
|
|
|
|
| |
* configure: New test for crypt_r, depositing HAVE_CRYPT_R
preprocessor symbol in config.h.
* sysif.c: Conditionally include <crypt.h> header.
(crypt_wrap): Use crypt_r if HAVE_CRYPT_R is nonzero.
(sysif_init): Register crypt intrinsic if we HAVE_CRYPT or if
we HAVE_CRYPT_R.
|
|
|
|
|
| |
* sysif.c (at_exit_do_not_call): Reverse Boolean polarity of
return value to match documentation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* sysif.c (sysif_init): registering variables e2big, eacces,
eaddrinuse, eaddrnotavail, eafnosupport, eagain, ealready,
ebadf, ebadmsg, ebusy, ecanceled, echild, econnaborted,
econnrefused, econnreset, edeadlk, edestaddrreq, edom,
edquot, eexist, efault, efbig, ehostunreach, eidrm, eilseq,
einprogress, eintr, einval, eio, eisconn, eisdir, eloop,
emfile, emlink, emsgsize, emultihop, enametoolong, enetdown,
enetreset, enetunreach, enfile, enobufs, enodata, enodev,
enoent, enoexec, enolck, enolink, enomem, enomsg,
enoprotoopt, enospc, enosr, enostr, enosys, enotconn,
enotdir, enotempty, enotrecoverable, enotsock, enotsup,
enotty, enxio, eopnotsupp, eoverflow, eownerdead, eperm,
epipe, eproto, eprotonosupport, eprototype, erange, erofs,
espipe, esrch, estale, etime, etimedout, etxtbsy ewouldblock
and exdev.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* configure: changing HAVE_FCNTL_H to HAVE_FCNTL.
* sysif.c (flock_s, type_s, whence_s, start_s, len_s, pid_s):
New symbol variables.
(flock_pack, flock_unpack, fcntl_wrap): New static functions.
(sysif_init): Initialize new symbol variables.
Create flock struct type. Register new intrinsic variables:
o-accmode, o-rdonly, o-wronly, o-rdwr, o-creat, o-noctty,
o-trunc, o-append, o-nonblock, o-sync, o-async, o-directory,
o-nofollow, o-cloexec, o-direct, o-noatime, o-path, f-dupfd,
f-dupfd-cloexec, f-getfd, f-setfd, fd-cloexec, f-getfl,
f-setfl, f-getlk, f-setlk, f-setlkw, f-rdlck, f-wrlck,
f-unlck, seek-set, seek-cur and seek-end.
Register fcntl intrinsic function.
* txr.1: Documented.
|
|
|
|
|
|
|
| |
* sysif.c (close_wrap): New static function.
(sysif_init): close intrinsic registered.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Several new more specific exception types are derived from
file-error and used. Error handlers can distinguish unexpected
non-existence, unexpected existence and permission errors
from each other and other errors.
* lib.c (path_not_found_s, path_exists_s, path_permission_s):
New symbol variables.
(obj_init): New variables initialized.
* lib.h (path_not_found_s, path_exists_s, path_permission_s):
Declared.
* parser.c (open_txr_file): Use new errno_to_file_error
function to convert errno to exception symbol.
* socket.c (open_sockfd): Likewise.
* stream.c (open_directory, open_file, open_fileno,
open_command, open_process, run, remove_path, rename_path):
Likewise, and process-error is used in open_process and run
instead of file-error for problems related to creating the
process.
* sysif.c (errno_to_file_error): New function.
(mkdir_wrap, ensure_dir, chdir_wrap, getcwd_wrap, mknod_wrap,
chmod_wrap, symlink_wrap, link_wrap, readlink_wrap, stat_impl,
umask_wrap, ): Use
errno_to_file_error to convert errno to exception symbol.
(exec_wrap): Use process-error instead of file-error.
* sysif.c (errno_to_file_error): Declared.
* unwind.c (uw_init): Register path-not-found, path-exists and
path-permission as subtypes of file-error.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (stdio_seek): Handle new-style Boolean return from
stdio_fseek.
* sysif.c (stdio_fseek): Return an int indication that is 1
for success, 0 for failure. There was a mistaken assumption
here that fseeko returns the file offset, and the return value
in the fseek case was mistakenly harmonized, using a wasteful
call to stdio_ftell. The only call to this function relies
only on a Boolean success/fail indication.
* sysif.h (stdio_fseek): Declaration updated.
|
|
|
|
|
|
| |
* sysif.c (num_off_t): Remove #ifdef here and just use num_64
if off_t fits into 64 bits. Now this code compiles even if
HAVE_DOUBLE_INTPTR_T is missing.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* hash.c (equal_hash, eql_hash, cobj_eq_hash_op,
hash_hash_op): Multiply object size by CHAR_BIT and switch on
number of bits, rather than bytes.
* sysif.c (off_t_num): Likewise.
* arith.c, ffi.c, itypes.c, rand.c: In numerous #if directive,
fix size tests from bytes to bits.
* configure: in the test that detects integer types, and in
the test for enabling large file offsets, detect one more
variable from the system: the value of CHAR_BIT. This
turns into SIZEOF_BYTE. We use that value instead of a
hard-coded 8.
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c (bignum_dbl_ipt): Change internal function to
external linkage.
* arith.h (bignum_dbl_ipt): Conditionally declared.
* sysif.c (num_off_t): Use bignum_dbl_ipt instead of
open-coding exactly the same thing that bignum_dbl_ipt does.
Abort is changed to same internal_error as in off_t_num.
|
|
|
|
|
|
|
|
|
|
|
| |
* sysif.c (off_t_num): Retarget to just use c_i32 or c_i64
from ctypes.c, depending on which of these types is the same
width as off_t.
(stdio_fseek): Pass identifying "self" string to off_t_num.
Don't use off_t_num for fseek's offset argument which is of
type long; for that we can use c_long from ctypes.c.
* sysif.h (off_t_num): Declaration updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* mpi/mpi.h (mp_sign, mp_isneg, mp_used, mp_alloc, mp_digits,
mp_digit): New macros, based on renaming SIGN, ISNEG, USED,
ALLOC, DIGITS and DIGIT.
(mp_set_prec): Use mp_digits instead of DIGITS.
* mpi/mpi.c (SIGN, ISNEG, USED, ALLOC, DIGITS, DIGIT): Macros
defined here now, as local aliases for their namespaced
counterparts.
* arith.c (signum, floordiv): Replace ISNEG with mp_isneg.
* rand.c (random): Replace ISNEG with mp_isneg.
* sysif.c (off_t_num): Replace USED, DIGITS and ISNEG with
mp_used, mp_digits and mp_isneg.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* LICENSE, LICENSE-CYG, METALICENSE, Makefile, args.c, args.h,
arith.c, arith.h, buf.c, buf.h, cadr.c, cadr.h, combi.c,
combi.h, configure, debug.c, debug.h, eval.c, eval.h, ffi.c,
ffi.h, filter.c, filter.h, ftw.h, gc.c, gc.h, glob.c, glob.h,
hash.c, hash.h, itypes.c, itypes.h, jmp.S, lib.c, lib.h,
lisplib.c, lisplib.h, match.c, match.h, parser.c, parser.h,
parser.l, parser.y, protsym.c, rand.c, rand.h, regex.c,
regex.h, share/txr/stdlib/asm.tl, share/txr/stdlib/awk.tl,
share/txr/stdlib/build.tl, share/txr/stdlib/cadr.tl,
share/txr/stdlib/compiler.tl, share/txr/stdlib/conv.tl,
share/txr/stdlib/doloop.tl, share/txr/stdlib/error.tl,
share/txr/stdlib/except.tl, share/txr/stdlib/ffi.tl,
share/txr/stdlib/getopts.tl, share/txr/stdlib/getput.tl,
share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl,
share/txr/stdlib/keyparams.tl, share/txr/stdlib/op.tl,
share/txr/stdlib/package.tl, share/txr/stdlib/path-test.tl,
share/txr/stdlib/place.tl, share/txr/stdlib/pmac.tl,
share/txr/stdlib/socket.tl, share/txr/stdlib/stream-wrap.tl,
share/txr/stdlib/struct.tl, share/txr/stdlib/tagbody.tl,
share/txr/stdlib/termios.tl, share/txr/stdlib/trace.tl,
share/txr/stdlib/txr-case.tl, share/txr/stdlib/type.tl,
share/txr/stdlib/vm-param.tl, share/txr/stdlib/with-resources.tl,
share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl,
signal.c, signal.h, socket.c, socket.h, stream.c, stream.h,
struct.c, struct.h, strudel.c, strudel.h, sysif.c, sysif.h,
syslog.c, syslog.h, termios.c, termios.h, txr.1, txr.c, txr.h,
unwind.c, unwind.h, utf8.c, utf8.h, vm.c, vm.h, vmop.h,
win/cleansvg.txr: Extended Copyright line to 2018.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* configure: Instead of generating a definition of ALLOCA_H,
generate the variable HAVE_ALLOCA_<name> with a value of 1,
where <name> is one of stdlib, alloca or malloc.
* alloca.h: New header.
* args.c, eval.c, ffi.c ffi.c, ftw.c, hash.c, lib.c, match.c,
parser.c, parser.y, regex.c, socket.c, stream.c, struct.c,
sysif.c, syslog.c, termios.c, unwind.c, vm.c: Include
"alloca.h" instead of ALLOCA_H.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The <dirent.h> header is included all over the place because
it is needed by a single declaration in stream.h. That
declaration is for a function that is only called within
stream.c, so we make it internal. Now only stream.c has
to include <dirent.h>.
* buf.c, debug.c, eval.c, ffi.c, filter.c, gc.c, gencadr.txr,
hash.c, lib.c, lisplib.c, match.c, parser.c, regex.c, socket.c,
struct.c, strudel.c, sysif.c, syslog.c, termios.c, txr.c,
unwind.c, vm.c: Remove #include <dirent.h>.
* cadr.c: Regenerated.
* stream.c (make_dir_stream): Make external function static.
* stream.h (make_dir_stream): Declaration updated.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (make_ffi_type_enum): Use ~a for function name rather
than ~s because it's a string which is quoted under ~s.
* lib.c (chk_xalloc, string_extend, find_symbol,
intern_fallback): Likewise.
* stream.c (open_process, run): Likewise.
* sysif.c (exec_wrap, setgroups_wrap, dlclose_wrap): Likewise.
|