bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

new module 'getumask'


From: Bruno Haible
Subject: new module 'getumask'
Date: Sat, 04 Jul 2020 18:22:46 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-179-generic; KDE/5.18.0; x86_64; ; )

It is remarkable that the only direct way, in POSIX, to determine the umask
of the current process is through a non-MT-safe function umask().

I understand that the idea was that umask() gets called only in the main()
function, during initialization of the process.

Nevertheless, this makes it hard to write library code that uses the umask,
without requiring extra code in the main() function of the program that
uses the library.

This module fixes the problem: it provides an MT-safe getumask() function.
Like - so far - only the Hurd has in its libc.


2020-07-04  Bruno Haible  <bruno@clisp.org>

        getumask: Add tests.
        * tests/test-getumask.c: New file.
        * modules/getumask-tests: New file.

        getumask: New module.
        * lib/sys_stat.in.h (getumask): New declaration.
        * lib/getumask.c: New file.
        * m4/getumask.m4: New file.
        * m4/sys_stat_h.m4 (gl_HEADER_SYS_STAT_H): Test whether getumask is
        declared.
        (gl_SYS_STAT_H_DEFAULTS): Initialize GNULIB_GETUMASK, HAVE_GETUMASK.
        * modules/sys_stat (Makefile.am): Substitute GNULIB_GETUMASK,
        HAVE_GETUMASK.
        * modules/getumask: New file.
        * tests/test-sys_stat-c++.cc (getumask): Check signature.
        * doc/glibc-functions/getumask.texi: New file.
        * doc/gnulib.texi (Glibc sys/stat.h): Include it.

Attachment: 0001-getumask-New-module.patch
Description: Text Data

Attachment: 0002-getumask-Add-tests.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]