1 /* 2 * Copyright (C) 2023 The Android Open Source Project 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * * Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * * Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in 12 * the documentation and/or other materials provided with the 13 * distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 18 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 19 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 22 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 */ 28 29 #pragma once 30 31 /** 32 * @file utmpx.h 33 * @brief No-op implementation of POSIX login records. 34 */ 35 36 #include <sys/cdefs.h> 37 #include <sys/types.h> 38 #include <time.h> 39 40 #define EMPTY 0 41 #define RUN_LVL 1 42 #define BOOT_TIME 2 43 #define NEW_TIME 3 44 #define OLD_TIME 4 45 #define INIT_PROCESS 5 46 #define LOGIN_PROCESS 6 47 #define USER_PROCESS 7 48 #define DEAD_PROCESS 8 49 #define ACCOUNTING 9 50 51 struct utmpx { 52 short ut_type; 53 pid_t ut_pid; 54 char ut_line[32]; 55 char ut_id[4]; 56 char ut_user[32]; 57 char ut_host[256]; 58 59 struct { 60 short e_termination; 61 short e_exit; 62 } ut_exit; 63 64 long ut_session; 65 struct timeval ut_tv; 66 67 int32_t ut_addr_v6[4]; 68 char unused[20]; 69 }; 70 71 __BEGIN_DECLS 72 73 /** 74 * Does nothing. 75 */ 76 void setutxent(void) __RENAME(setutent); 77 78 /** 79 * Does nothing and returns null. 80 */ 81 struct utmpx* _Nullable getutxent(void) __RENAME(getutent); 82 83 /** 84 * Does nothing and returns null. 85 */ 86 struct utmpx* _Nullable getutxid(const struct utmpx* _Nonnull __entry) __RENAME(getutent); 87 88 /** 89 * Does nothing and returns null. 90 */ 91 struct utmpx* _Nullable getutxline(const struct utmpx* _Nonnull __entry) __RENAME(getutent); 92 93 /** 94 * Does nothing and returns null. 95 */ 96 struct utmpx* _Nullable pututxline(const struct utmpx* _Nonnull __entry) __RENAME(pututline); 97 98 /** 99 * Does nothing. 100 */ 101 void endutxent(void) __RENAME(endutent); 102 103 __END_DECLS 104