table of contents
- trixie 4.27.0-1
- trixie-backports 4.29.1-1~bpo13+1
- testing 4.29.1-1
- unstable 4.29.1-1
| login(3) | Library Functions Manual | login(3) |
NOM¶
login, logout - Écrire les entrées utmp et wtmp
BIBLIOTHÈQUE¶
System utilities library (libutil, -lutil)
SYNOPSIS¶
#include <utmp.h>
void login(const struct utmp *ut); int logout(const char *ut_line);
DESCRIPTION¶
The utmp file records who is currently using the system. The wtmp file records all logins and logouts. See utmp(5).
The function login() takes the supplied struct utmp, ut, and writes it to both the utmp and the wtmp file.
The function logout() clears the entry in the utmp file again.
Détails à propos des spécificités GNU¶
More precisely, login() takes the argument ut struct, fills the field ut->ut_type (if there is such a field) with the value USER_PROCESS, and fills the field ut->ut_pid (if there is such a field) with the process ID of the calling process. Then it tries to fill the field ut->ut_line. It takes the first of stdin, stdout, stderr that is a terminal, and stores the corresponding pathname minus a possible leading /dev/ into this field, and then writes the struct to the utmp file. On the other hand, if no terminal name was found, this field is filled with "???" and the struct is not written to the utmp file. After this, the struct is written to the wtmp file.
The logout() function searches the utmp file for an entry matching the ut_line argument. If a record is found, it is updated by zeroing out the ut_name and ut_host fields, updating the ut_tv timestamp field and setting ut_type (if there is such a field) to DEAD_PROCESS.
VALEUR RENVOYÉE¶
La fonction logout() renvoie 1 si l'entrée a été correctement écrite dans la base de données, ou zéro en cas d'erreur.
FICHIERS¶
- /var/run/utmp
- base de données de comptabilité utilisateur, configurée par _PATH_UTMP dans <paths.h>
- /var/log/wtmp
- fichier de journalisation de comptabilité utilisateur, configuré par _PATH_WTMP dans <paths.h>
ATTRIBUTS¶
Pour une explication des termes utilisés dans cette section, consulter attributes(7).
| Interface | Attribut | Valeur |
| login(), logout() | Sécurité des threads | MT-Unsafe race:utent sig:ALRM timer |
Dans la table ci-dessus, utent dans race:utent veut dire que si une des fonctions setutent(3), getutent(3) ou endutent(3) est utilisée en parallèle dans différents fils d'exécution (thread) d'un programme, alors des situations de concurrences de données peuvent se produire. login() et logout() appellent ces fonctions, nous utilisons donc race:utent pour le rappeler aux utilisateurs.
VERSIONS¶
Le membre ut_user de la structure utmp est appelé ut_name dans BSD. C'est pourquoi ut_name est défini comme un alias de ut_user dans <utmp.h>.
STANDARDS¶
BSD.
VOIR AUSSI¶
TRADUCTION¶
La traduction française de cette page de manuel a été créée par Christophe Blaess <https://www.blaess.fr/christophe/>, Stéphan Rafin <stephan.rafin@laposte.net>, Thierry Vignaud <tvignaud@mandriva.com>, François Micaux, Alain Portal <aportal@univ-montp2.fr>, Jean-Philippe Guérard <fevrier@tigreraye.org>, Jean-Luc Coulon (f5ibh) <jean-luc.coulon@wanadoo.fr>, Julien Cristau <jcristau@debian.org>, Thomas Huriaux <thomas.huriaux@gmail.com>, Nicolas François <nicolas.francois@centraliens.net>, Florentin Duneau <fduneau@gmail.com>, Simon Paillard <simon.paillard@resel.enst-bretagne.fr>, Denis Barbier <barbier@debian.org>, David Prévot <david@tilapin.org>, Jean-Baptiste Holcroft <jean-baptiste@holcroft.fr> et Grégoire Scano <gregoire.scano@malloc.fr>
Cette traduction est une documentation libre ; veuillez vous reporter à la GNU General Public License version 3 concernant les conditions de copie et de distribution. Il n'y a aucune RESPONSABILITÉ LÉGALE.
Si vous découvrez un bogue dans la traduction de cette page de manuel, veuillez envoyer un message à debian-l10n-french@lists.debian.org.
| 6 septembre 2025 | Pages du manuel de Linux 6.16 |