Download | Plain Text | No Line Numbers
- /*
- * Name: global
- * Author: Manuel Mausz, 0728348
- * Description: Shared definitions and functions for gluefile + insertfile
- * Created: 12.03.2009
- */
-
- #ifndef _GLOBAL_H
- #define _GLOBAL_H 1
-
- /*
- * IPC/msg queue stuff
- */
- #include <sys/types.h>
- #include <sys/ipc.h>
- #include <sys/msg.h>
-
- #define IPC_KEY ((key_t) 49583L) /* ipc key */
- #define IPC_PERMS 0600 /* permissions */
-
- /* message structure for msg queue. struct size shouldn't exceed MSGMAX
- * (default: 8192 byte on Linux. only ~2048 byte on FreeBSD)
- */
- typedef struct
- {
- long mtype; /* message type, must be > 0 */
- unsigned int len; /* data length */
- char data[256]; /* message data */
- } msg_t;
-
- #define MSGSIZE (sizeof(msg_t) - sizeof(long))
-
- /*
- * Signal stuff
- */
- #include <signal.h>
-
- /* install signal handler macro */
- #define INSTALL_SIGNAL(signum, act, oldact) \
- sigaction(signum, NULL, &oldact); \
- if (oldact.sa_handler != SIG_IGN) \
- sigaction(signum, &act, NULL);
-
- /*
- * global.c stuff
- */
- #include <stdarg.h>
-
- /* function declarations */
- void vprintferr(const char *fmt, va_list ap);
- void printferr(const char *fmt, ...);
- void bailout(const char *fmt, ...);
-
- /* global variable definitions */
- /* libc manual: Handlers that return normally must modify some global variable
- * in order to have any effect. Typically, the variable is one that is examined
- * periodically by the program during normal operation. Its data type should be
- * sig_atomic_t for reasons described in Atomic Data Access.
- */
- extern volatile sig_atomic_t error; /* error flag */
- extern char *me; /* name of myself (argv[0]) */
-
- #endif /* global.h */
-