]> git.ipfire.org Git - thirdparty/glibc.git/blame - login/getutent_r.c
Update copyright dates with scripts/update-copyrights
[thirdparty/glibc.git] / login / getutent_r.c
CommitLineData
2b778ceb 1/* Copyright (C) 1996-2021 Free Software Foundation, Inc.
8a523922
UD
2 This file is part of the GNU C Library.
3 Contributed by Ulrich Drepper <drepper@cygnus.com>
4 and Paul Janzen <pcj@primenet.com>, 1996.
b8fe19fa 5
8a523922 6 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
b8fe19fa 10
8a523922
UD
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41bdb6e2 14 Lesser General Public License for more details.
b8fe19fa 15
41bdb6e2 16 You should have received a copy of the GNU Lesser General Public
59ba27a6 17 License along with the GNU C Library; if not, see
5a82c748 18 <https://www.gnu.org/licenses/>. */
b8fe19fa 19
ec999b8e 20#include <libc-lock.h>
282cbdef 21#include <stdlib.h>
b8fe19fa
RM
22#include <utmp.h>
23
8a523922 24#include "utmp-private.h"
b8fe19fa 25
8a523922 26/* We need to protect the opening of the file. */
ab26a24a 27__libc_lock_define_initialized (, __libc_utmp_lock attribute_hidden)
8a523922 28
5107cf1d 29
0413b54c
UD
30void
31__setutent (void)
32{
33 __libc_lock_lock (__libc_utmp_lock);
34
1a7fe2eb 35 __libc_setutent ();
0413b54c
UD
36
37 __libc_lock_unlock (__libc_utmp_lock);
38}
39weak_alias (__setutent, setutent)
0413b54c
UD
40
41
8a523922
UD
42int
43__getutent_r (struct utmp *buffer, struct utmp **result)
44{
45 int retval;
46
47 __libc_lock_lock (__libc_utmp_lock);
48
1a7fe2eb 49 retval = __libc_getutent_r (buffer, result);
8a523922
UD
50
51 __libc_lock_unlock (__libc_utmp_lock);
52
53 return retval;
b8fe19fa 54}
59c04e67 55libc_hidden_def (__getutent_r)
23396375 56weak_alias (__getutent_r, getutent_r)
8a523922
UD
57
58
a401eea9 59struct utmp *
8a523922
UD
60__pututline (const struct utmp *data)
61{
a401eea9
UD
62 struct utmp *buffer;
63
8a523922
UD
64 __libc_lock_lock (__libc_utmp_lock);
65
1a7fe2eb 66 buffer = __libc_pututline (data);
8a523922
UD
67
68 __libc_lock_unlock (__libc_utmp_lock);
a401eea9
UD
69
70 return buffer;
8a523922 71}
59c04e67 72libc_hidden_def (__pututline)
a401eea9 73weak_alias (__pututline, pututline)
8a523922 74
8f2ece69 75
0413b54c
UD
76void
77__endutent (void)
8a523922 78{
0413b54c 79 __libc_lock_lock (__libc_utmp_lock);
8a523922 80
1a7fe2eb 81 __libc_endutent ();
0413b54c
UD
82
83 __libc_lock_unlock (__libc_utmp_lock);
8a523922 84}
0413b54c 85weak_alias (__endutent, endutent)