netatalk
4.4.3
Free and Open Source Apple Filing Protocol (AFP) Server
Toggle main menu visibility
Loading...
Searching...
No Matches
lantest_io_monitor.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2025, Andy Lemin (andylemin)
3
* Credits; Based on work by Netatalk contributors
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*/
15
16
#ifndef LANTEST_IO_MONITOR_H
17
#define LANTEST_IO_MONITOR_H
18
19
#include <stdbool.h>
20
#include <stdint.h>
21
#include <sys/types.h>
22
23
/* Define PID_MAX if not available from system headers */
24
#ifndef PID_MAX
26
#define PID_MAX 99999
27
#endif
28
30
extern
bool
Debug
;
31
32
#ifdef __linux__
33
37
typedef
struct
{
38
const
char
*process_name;
39
const
char
*username;
40
int32_t filter_by_cmdline;
41
uid_t target_uid;
42
} ProcessFilter;
43
47
typedef
struct
{
48
pid_t pids[10];
49
int32_t count;
50
} ProcessList;
51
52
/* External variables for IO monitoring */
53
extern
bool
io_monitoring_enabled
;
54
extern
pid_t
afpd_pid
;
55
extern
pid_t
cnid_dbd_pid
;
56
extern
uint64_t
afpd_start_reads
,
afpd_start_writes
;
57
extern
uint64_t
cnid_start_reads
,
cnid_start_writes
;
58
extern
uint64_t
afpd_end_reads
,
afpd_end_writes
;
59
extern
uint64_t
cnid_end_reads
,
cnid_end_writes
;
60
61
/* Constants for capture_io_values() */
62
#define TEST_START 1
63
#define TEST_STOP 0
64
65
/* Function declarations */
66
int32_t
check_proc_io_availability
(
void
);
67
pid_t
find_process_pid
(
const
char
*process_name,
const
char
*username,
68
int32_t filter_by_cmdline);
69
void
capture_io_values
(int32_t is_start);
70
uint64_t
iodiff_io
(pid_t pid, int32_t is_write);
71
73
void
init_io_monitoring
(
const
char
*username);
74
75
#endif
/* __linux__ */
76
77
#endif
/* LANTEST_IO_MONITOR_H */
Debug
bool Debug
Definition
lantest.c:93
iodiff_io
uint64_t iodiff_io(pid_t pid, int32_t is_write)
Definition
lantest_io_monitor.c:725
afpd_end_reads
uint64_t afpd_end_reads
Definition
lantest_io_monitor.c:701
capture_io_values
void capture_io_values(int32_t is_start)
Definition
lantest_io_monitor.c:719
cnid_dbd_pid
pid_t cnid_dbd_pid
Definition
lantest_io_monitor.c:698
cnid_end_reads
uint64_t cnid_end_reads
Definition
lantest_io_monitor.c:702
init_io_monitoring
void init_io_monitoring(const char *username)
Definition
lantest_io_monitor.c:732
io_monitoring_enabled
bool io_monitoring_enabled
Definition
lantest_io_monitor.c:696
check_proc_io_availability
int32_t check_proc_io_availability(void)
Definition
lantest_io_monitor.c:705
find_process_pid
pid_t find_process_pid(const char *process_name, const char *username, int32_t filter_by_cmdline)
Definition
lantest_io_monitor.c:710
cnid_start_reads
uint64_t cnid_start_reads
Definition
lantest_io_monitor.c:700
afpd_end_writes
uint64_t afpd_end_writes
Definition
lantest_io_monitor.c:701
afpd_start_writes
uint64_t afpd_start_writes
Definition
lantest_io_monitor.c:699
cnid_start_writes
uint64_t cnid_start_writes
Definition
lantest_io_monitor.c:700
afpd_start_reads
uint64_t afpd_start_reads
Definition
lantest_io_monitor.c:699
cnid_end_writes
uint64_t cnid_end_writes
Definition
lantest_io_monitor.c:702
afpd_pid
static pid_t afpd_pid
Definition
netatalk.c:63
test
testsuite
lantest_io_monitor.h
Generated by
1.17.0