Commit Graph

10 Commits

Author SHA1 Message Date
Xavier Delaruelle
00e8d8c911 lib: call getgroups to determine number of groups
Update Envmodules_InitStateUsergroupsObjCmd to make a first dummy call
to "getgroups" function in order to retrieve the number of groups and
then be able to allocate the right array size.

With such change, our function does not rely anymore on sysconf function
and on NGROUPS_MAX and DEFAULT_MAXGROUPS defines.
2024-05-11 16:21:38 +02:00
Xavier Delaruelle
2d4a7f9584 lib: re-license envmodules lib from GPLv3+ to GPLv2+
Change license of the Modules Tcl extension library from GPLv3+ to
GPLv2+.

Align this way all files from the Modules project under the GPLv2+
license.

Consent has been obtained from copyright holder to perform such move (I
hold the full copyright for this library).

Related to #389
2021-02-28 19:11:03 +01:00
Xavier Delaruelle
a756e3034e lib: add must_have_cookie arg to readFile proc
Update C-version of the readFile procedure to add it the
`must_have_cookie` argument that tells if the Modules magic cookie
(#%Module) has to be checked when reading file to abort reading as soon
as possible if read file must be a modulefile.

Bump version of Tcl Envmodules library to 1.3.0.

Fixes #375.
2021-01-10 20:42:05 +01:00
Xavier Delaruelle
0e4e8caecc lib: implement parseDateTimeArg
Add function in libtclenvmodules to implement 'parseDateTimeArg' as a
Tcl command, which provides a more efficient way to convert a datetime
string into an Epoch time.
2020-09-18 06:50:26 +02:00
Xavier Delaruelle
19353c1304 lib: implement initStateClockSeconds
Add function in libtclenvmodules to implement 'initStateClockSeconds' as
a Tcl command, which provides a more efficient way to retrieve current
Epoch time.
2020-09-16 22:32:22 +02:00
Xavier Delaruelle
452b3ffb25 lib: implement initStateUsergroups
Add function in libtclenvmodules to implement `initStateUsergroups` as a
Tcl command, which provides a more efficient way to retrieve current
groups of running process, rather forking to execute `id` external
binary.

Note that if current system does not support the `getgroups` system
call, only the primary group name of current user will be returned.
2020-07-16 21:53:51 +02:00
Xavier Delaruelle
11e6099aec lib: Implement initStateUsername
Add function in libtclenvmodules to implement `initStateUsername` as a
Tcl command, which provides a more efficient way to retrieve current
username, rather forking to execute `id` external binary.
2020-07-16 21:53:51 +02:00
Xavier Delaruelle
a5d0c0e3c5 lib: bump copyright year mention 2019-08-09 21:15:10 +02:00
Xavier Delaruelle
9b8e5981a7 Implement getFilesInDirectory in Tcl extension library
Add function in libtclenvmodules to implement getFilesInDirectory as a
command, which provides a more IO-optimized way than native Tcl commands
perform by avoiding specific additional queries to get hidden files like
.modulerc and .version. As a result 1 stat and 2 access syscalls are
saved per directory read.
2019-04-29 16:02:13 +02:00
Xavier Delaruelle
3c360a9937 Introduce Modules Tcl extension library
Introduce Modules Tcl extension library (written in C) to extend Tcl
language in order to provide more optimized I/O commands than native Tcl
commands do.

This library first provides a 'readFile' command which performs an open,
read, close of a given modulefile to fetch its content. Compared to the
Tcl native open, read, close commands it saves 1 ioctl + 1 fcntl + N
lstat system calls per modulefile.
2019-04-29 15:56:23 +02:00