| 1 |
//po4a: entry man manual |
| 2 |
= ll2_write_entry(3) |
| 3 |
:doctype: manpage |
| 4 |
:man manual: Programmer's Manual |
| 5 |
:man source: util-linux {release-version} |
| 6 |
:page-layout: base |
| 7 |
:lib: liblastlog2 |
| 8 |
:firstversion: 2.40 |
| 9 |
|
| 10 |
== NAME |
| 11 |
|
| 12 |
ll2_write_entry - Writes a new entry into the database. |
| 13 |
|
| 14 |
== SYNOPSIS |
| 15 |
|
| 16 |
*#include <lastlog2.h>* |
| 17 |
|
| 18 |
*int ll2_write_entry (struct ll2_context *__context__, const char *__user__, |
| 19 |
int64_t __ll_time__, const char *__tty__, |
| 20 |
const char *__rhost__, const char *__pam_service__, |
| 21 |
char **__error__);* |
| 22 |
|
| 23 |
== DESCRIPTION |
| 24 |
|
| 25 |
Writes a new entry into database, which is defined in _context_. |
| 26 |
If _context_ is NULL, the default database, defined in _LL2_DEFAULT_DATABASE_, |
| 27 |
will be taken. |
| 28 |
|
| 29 |
|
| 30 |
-------------------------------------- |
| 31 |
time_t login_time = time(0); // Get the system time |
| 32 |
char *error = NULL; |
| 33 |
const char *user = "root"; |
| 34 |
|
| 35 |
int ret = ll2_write_entry (NULL, user, login_time, "pts/0", |
| 36 |
"192.168.122.1", NULL, &error); |
| 37 |
-------------------------------------- |
| 38 |
|
| 39 |
_pam_service_ is the service or instance name which has generated the entry (optional). |
| 40 |
|
| 41 |
== RETURN VALUE |
| 42 |
|
| 43 |
Returns 0 on success, -ENOMEM or -1 on other failure. |
| 44 |
_error_ contains an error string if the return value is -1. |
| 45 |
_error_ is not guaranteed to contain an error string, could also be NULL. |
| 46 |
_error_ should be freed by the caller. |
| 47 |
|
| 48 |
== AUTHORS |
| 49 |
|
| 50 |
mailto:[email protected][Thorsten Kukuk] |
| 51 |
|
| 52 |
== SEE ALSO |
| 53 |
|
| 54 |
*lastlog2*(3), |
| 55 |
*ll2_new_context*(3), |
| 56 |
*ll2_unref_context*(3), |
| 57 |
*ll2_read_all*(3), |
| 58 |
*ll2_read_entry*(3), |
| 59 |
*ll2_update_login_time*(3), |
| 60 |
*ll2_remove_entry*(3), |
| 61 |
*ll2_rename_user*(3), |
| 62 |
*ll2_import_lastlog*(3) |
| 63 |
|
| 64 |
include::man-common/bugreports.adoc[] |
| 65 |
|
| 66 |
include::man-common/footer-lib.adoc[] |
| 67 |
|
| 68 |
ifdef::translation[] |
| 69 |
include::man-common/translation.adoc[] |
| 70 |
endif::[] |