Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
ConfigEntry.cxx
Go to the documentation of this file.
1
36
37#include <sys/types.h>
38#include <unistd.h>
39#include "utils/logging.h"
40#include "utils/FdUtils.hxx"
41
42namespace openlcb
43{
44
45void ConfigEntryBase::repeated_read(int fd, void *buf, size_t size) const
46{
47 int ret = lseek(fd, offset_, SEEK_SET);
48 ERRNOCHECK("seek_config", ret);
49 FdUtils::repeated_read(fd, buf, size);
50}
51
52void ConfigEntryBase::repeated_write(int fd, const void *buf, size_t size) const
53{
54 int ret = lseek(fd, offset_, SEEK_SET);
55 ERRNOCHECK("seek_config", ret);
56 FdUtils::repeated_write(fd, buf, size);
57}
58
59} // namespace openlcb
void repeated_read(int fd, void *buf, size_t size) const
Performs a reliable read from the given FD.
void repeated_write(int fd, const void *buf, size_t size) const
Performs a reliable write to the given FD.
unsigned offset_
zero-based offset from the beginning of the configuration file.
#define ERRNOCHECK(where, x...)
Calls the function x, and if the return value is negative, prints errno as error message to stderr an...
Definition logging.h:174
static void repeated_read(int fd, void *buf, size_t size)
Performs a reliable read from the given FD.
Definition FdUtils.hxx:50
static void repeated_write(int fd, const void *buf, size_t size)
Performs a reliable write to the given FD.
Definition FdUtils.hxx:71