Elektra  0.8.19
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   (21)
 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. More...
 
#define KDB_PATH_SEPARATOR   '/'
 Separator for key names. More...
 
#define KDB_PATH_ESCAPE   '\\'
 Escape symbol for special characters in the key name. More...
 
#define KDB_MAX_UCHAR   (UCHAR_MAX + 1)
 For iteration over trie children/values. More...
 

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 uid_t User identification 0,.. gid_t Group identification 0,..

Following Elektra specific types must be defined with at least 32 bit:

Type Purpose keyswitch_t For keyNew option_t For kdbGet, kdbSet and ksLookup* cursor_t stores information to find a position in a keyset

Following constants must be defined:

KDB_PATH_SEPARATOR how to delimit pathnames KDB_FILE_MODE the standard mode for keys KDB_DIR_MODE the mode to add (|=) for key directories KDB_MAX_UCHAR the maximum value of unsigned char

Following limits must be defined (in addition to limits mentioned above for types):

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

#define ELEKTRA_MAX_ARRAY_SIZE   (21)

The buffer size needed for an array name.

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

  • a # in the beginning
  • up to 9 underscores are needed as prefix
  • a 32bit number has a maximum of 10 digits
  • one byte for null termination

E.g. #_________4000000000\0

#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.

#define KDB_FILE_MODE   0600

Default Mode.

This mode will be used for new files

#define KDB_MAX_PATH_LENGTH   _POSIX_PATH_MAX

KDB_MAX_PATH_LENGTH will be the value for longest possible filenames on the system.

#define KDB_MAX_UCHAR   (UCHAR_MAX + 1)

For iteration over trie children/values.

for (i=0; i<KDB_MAX_UCHAR; ++i)

#define KDB_PATH_ESCAPE   '\\'

Escape symbol for special characters in the key name.

See also
here .
#define KDB_PATH_SEPARATOR   '/'

Separator for key names.

This character will be used to separate key names

See also
here .