1 /* 2 * proc-llist.h 3 * Copyright (c) 2009 Red Hat Inc., Durham, North Carolina. 4 * All Rights Reserved. 5 * 6 * This software may be freely redistributed and/or modified under the 7 * terms of the GNU General Public License as published by the Free 8 * Software Foundation; either version 2, or (at your option) any 9 * later version. 10 * 11 * This program 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 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; see the file COPYING. If not, write to the 18 * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 * 20 * Authors: 21 * Steve Grubb <sgrubb (at) redhat.com> 22 */ 23 24 #ifndef PROC_HEADER 25 #define PROC_HEADER 26 27 #include "config.h" 28 29 30 /* This is the node of the linked list. Any data elements that are per 31 * record goes here. */ 32 typedef struct _lnode{ 33 pid_t ppid; // parent process ID 34 pid_t pid; // process ID 35 uid_t uid; // user ID 36 char *cmd; // command run by user 37 unsigned long inode; // inode of socket 38 char *capabilities; // Text of partial capabilities 39 char *bounds; // Text for bounding set 40 struct _lnode* next; // Next node pointer 41 } lnode; 42 43 /* This is the linked list head. Only data elements that are 1 per 44 * event goes here. */ 45 typedef struct { 46 lnode *head; // List head 47 lnode *cur; // Pointer to current node 48 unsigned int cnt; // How many items in this list 49 } llist; 50 51 void list_create(llist *l); 52 static inline lnode *list_get_cur(llist *l) { return l->cur; } 53 void list_append(llist *l, lnode *node); 54 void list_clear(llist* l); 55 56 /* Given a message type, find the matching node */ 57 lnode *list_find_inode(llist *l, unsigned long i); 58 59 #endif 60 61