164 # define ACH_RESTRICT
165 #elif __STDC_VERSION__ < 199901L
167 # define ACH_RESTRICT
170 # define ACH_RESTRICT restrict
173 #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
175 #define ACH_DEPRECATED(msg) __attribute__((__deprecated__(msg)))
176 #elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
178 #define ACH_DEPRECATED(msg) __attribute__((__deprecated__))
181 #define ACH_DEPRECATED(msg)
185 #ifdef CLOCK_MONOTONIC
187 #define ACH_DEFAULT_CLOCK CLOCK_MONOTONIC
188 #elif defined CLOCK_HIGHRES
191 #define ACH_DEFAULT_CLOCK CLOCK_HIGHRES
192 #elif defined CLOCK_REALTIME
194 #define ACH_DEFAULT_CLOCK CLOCK_REALTIME
196 #error No valid CLOCKS defined. Expecting CLOCK_MONOTONIC.
238 ACH_DEPRECATED(
"The 'map_anon' field is replaced by the 'map' field of type 'enum ach_map'")
320 struct ach_channel_vtab;
348 const struct ach_channel_vtab *
vtab;
390 size_t frame_cnt,
size_t frame_size,
538 void ach_dump(
struct ach_header *shm);
uint64_t seq_num
last sequence number read
Definition: ach.h:342
enum ach_status ACH_WARN_UNUSED ach_create_attr_set_map(ach_create_attr_t *attr, enum ach_map map)
Set the mapping.
enum ach_status ACH_WARN_UNUSED ach_channel_fd(const struct ach_channel *channel, int *file_descriptor)
Return the file descriptor associated with this channel.
Use the default mapping for channels.
Definition: ach.h:209
enum ach_status ACH_WARN_UNUSED ach_open(ach_channel_t *channel, const char *name, ach_attr_t *attr)
Opens a handle to channel.
uint64_t reserve_bits
reserve space for bit flags
Definition: ach.h:286
uint64_t reserved[16]
Reserve space to compatibly add future options.
Definition: ach.h:351
Attributes to pass to ach_create.
Definition: ach.h:275
unsigned int set_clock
if true, set the clock of the condition variable
Definition: ach.h:289
struct ach_header * shm
the memory buffer used by anonymous channels
Definition: ach.h:244
struct ach_header * shm
pointer to mmap'ed block
Definition: ach.h:338
Use kernel memory for channels - requires ach kernel module to be loaded.
Definition: ach.h:213
unsigned int lock_source
if true, take the source lock when opening or fail
Definition: ach.h:248
enum ach_map map
replaces map_anon
Definition: ach.h:280
enum ach_status ach_attr_set_lock_source(ach_attr_t *attr, int lock_source)
Set lock source value.
int map_anon
anonymous channel (put it in process heap, not shm).
Definition: ach.h:239
uint64_t reserved[16]
Reserve space to compatibly add future options.
Definition: ach.h:293
enum ach_status ACH_WARN_UNUSED ach_create_attr_set_clock(ach_create_attr_t *attr, clockid_t clock)
Set the clockid.
int map_anon
allocate channel in heap, rather than shm
Definition: ach.h:279
unsigned int truncate
remove and recreate an existing shm file
Definition: ach.h:288
volatile sig_atomic_t cancel
cancel a waiting ach_get
Definition: ach.h:347
Struct containing 'cache' of kernel module data to avoid updating when no changes exist...
Definition: generic.h:269
achk_opt_t k_opts
Used by kernel devices.
Definition: ach.h:343
void ach_attr_init(ach_attr_t *attr)
Initialize attributes for opening channels.
#define ACH_RESTRICT
Alias restrict keyword.
Definition: ach.h:167
enum ach_status ach_chmod(ach_channel_t *chan, mode_t mode)
Sets permissions of chan to specified mode.
void ach_create_attr_init(ach_create_attr_t *attr)
Initialize attributes for creating channels.
enum ach_status ACH_WARN_UNUSED ach_get(ach_channel_t *chan, void *buf, size_t size, size_t *frame_size, const struct timespec *ACH_RESTRICT abstime, int options)
Pulls a message from the channel.
enum ach_status ach_status_t
return status codes for ach functions.
enum ach_map map
Where to put channel backing memory.
Definition: ach.h:242
const char * ach_errstr()
Return a string describing the most recent ach error in detail.
enum ach_status ACH_WARN_UNUSED ach_create_attr_get_shm(ach_create_attr_t *attr, struct ach_header **shm)
Get backing memory for anonymous channel.
enum ach_status ACH_WARN_UNUSED ach_unlink(const char *name)
Delete an ach channel.
ach_map
Options to specify the mapping for a channels backing memory buffer.
Definition: ach.h:208
const char * ach_result_to_string(ach_status_t result)
Converts return code from ach call to a human readable string;.
unsigned int async_unsafe
If true, permit calls that are unsafe in a signal handler.
Definition: ach.h:561
size_t next_index
next index entry to try get from
Definition: ach.h:345
enum ach_status ACH_WARN_UNUSED ach_create_attr_set_truncate(ach_create_attr_t *attr, int truncate)
Set to truncate.
anonymous channel - use heap memory
Definition: ach.h:210
enum ach_status ACH_WARN_UNUSED ach_cancel_attr_set_async_unsafe(ach_cancel_attr_t *attr, int asyn_unsafe)
Set async unsafe field.
enum ach_status ACH_WARN_UNUSED ach_cancel(ach_channel_t *chan, const ach_cancel_attr_t *attr)
Cancel a pending ach_get() on channel.
Attributes parameter for ach_cancel.
Definition: ach.h:556
struct ach_cancel_attr ach_cancel_attr_t
Attributes parameter for ach_cancel.
int fd_source_lock
file descriptor for source lock
Definition: ach.h:349
#define ACH_WARN_UNUSED
Warn if result is unused.
Definition: generic.h:73
enum ach_status ACH_WARN_UNUSED ach_channel_map(const struct ach_channel *channel, enum ach_map *map)
Return the mapping of the channel.
void ach_cancel_attr_init(ach_cancel_attr_t *attr)
Initialize attributes.
clockid_t clock
Which clock to use if set_clock is true.
Definition: ach.h:283
uint64_t reserved_size[8]
Reserve space to compatibly add future options.
Definition: ach.h:252
Attributes to pass to ach_open.
Definition: ach.h:229
uint64_t reserve_bits
reserve space for bit flags
Definition: ach.h:246
Descriptor for an Ach channel.
Definition: ach.h:335
enum ach_status ACH_WARN_UNUSED ach_attr_set_shm(ach_attr_t *attr, struct ach_header *shm)
Set shared memory area for anonymous channels.
struct ach_channel ach_channel_t
Descriptor for an Ach channel.
void ach_dump(struct ach_header *shm)
Prints information about the channel shm to stderr.
ach_status
return status codes for ach functions.
Definition: generic.h:84
enum ach_status ACH_WARN_UNUSED ach_channel_clock(const struct ach_channel *channel, clockid_t *clock)
Return the clock used by the channel.
Use shared memory for channels.
Definition: ach.h:211
clockid_t clock
attributes used to create this channel
Definition: ach.h:346
int fd
file descriptor of mmap'ed file
Definition: ach.h:340
enum ach_status ACH_WARN_UNUSED ach_create(const char *name, size_t frame_cnt, size_t frame_size, ach_create_attr_t *attr)
Creates a new channel.
enum ach_status ACH_WARN_UNUSED ach_flush(ach_channel_t *chan)
Discards all previously received messages for this handle.
enum ach_status ach_put(ach_channel_t *channel, const void *buf, size_t len)
Copy a new message into the channel.
const struct ach_channel_vtab * vtab
virtual method table
Definition: ach.h:348
struct ach_header * shm
pointer to channel, set on output of create iff map_anon
Definition: ach.h:282
#define ACH_DEPRECATED(msg)
Deprecated old symbol.
Definition: ach.h:181
enum ach_status ACH_WARN_UNUSED ach_close(ach_channel_t *chan)
Closes the shared memory block.
size_t len
length of memory mapping
Definition: ach.h:339
This file contains declarations needed by both the userspace public interface and the Linux kernel im...