Elektra  0.9.8
Macros
kdbos.h File Reference

Operating system specific workarounds. More...

#include <limits.h>
#include <inttypes.h>
#include <sys/types.h>
#include <stdarg.h>
Include dependency graph for kdbos.h:

Macros

#define ELEKTRA_MAX_ARRAY_SIZE   (1 + 19 + 20 + 1)
 The buffer size needed for an array name. More...
 
#define KDB_FILE_MODE   0600
 Default Mode. More...
 
#define KDB_DIR_MODE   0100
 Default directory mode. More...
 
#define KDB_MAX_PATH_LENGTH   _POSIX_PATH_MAX
 KDB_MAX_PATH_LENGTH will be the value for longest possible filenames on the system.
 

Detailed Description

Operating system specific workarounds.

Integer Types must be at least 32bit:

Type Purpose Limits int Integral Fast Type INT_MIN, INT_MAX size_t size of array or string 0, SIZE_MAX ssize_t size with error cond. -1, SSIZE_MAX(<SIZE_MAX) time_t Seconds since 1970 0,.. recommended: 64 bit

Following constants must be defined:

KDB_FILE_MODE the standard mode for keys KDB_DIR_MODE the mode to add (|=) for key directories

Following limits must be defined:

KDB_MAX_PATH_LENGTH the maximum length for a pathname

In addition to the types the ... or va_list must be supported, this is ISO C and should happen by including <stdarg.h>.

Go ahead and write a #ifdef block for your operating system when the POSIX defaults are not ok

Macro Definition Documentation

◆ ELEKTRA_MAX_ARRAY_SIZE

#define ELEKTRA_MAX_ARRAY_SIZE   (1 + 19 + 20 + 1)

The buffer size needed for an array name.

The size of the buffer so that the buffer can contain:

  • (1) a # in the beginning
  • (9) up to 19 underscores are needed as prefix
  • (20) a 64bit number has a maximum of 20 digits
  • (1) one byte for null termination

E.g. #___________________18446744073709551615\0

◆ KDB_DIR_MODE

#define KDB_DIR_MODE   0100

Default directory mode.

This mode will be used for new directories. Will be ORed together with KDB_FILE_MODE to get the permissions of an directory.

◆ KDB_FILE_MODE

#define KDB_FILE_MODE   0600

Default Mode.

This mode will be used for new files