mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
07ade5e488
The problem we have is this: - we want the client smbd processes to be able to 'shortcut' access to the ltdb, by directly accessing the ltdb, and if the header of the record shows we are the dmaster then process immediately, with no overhead of talking across the unix domain socket - a client doing a shortcut will use tdb_chainlock() to lock the record while processing - we want the main ctdb daemon to be able to set locks on the record, and when those locks collide with a 'shortcut' fcntl lock, we want the ctdb daemon to keep processing other operations - we don't want to have to send a message from a smbd client to the ctdbd each time it releases a lock The solution is shown in this example. Note that the expensive fork() and blocking lock is only paid in case of contention, so in the median case I think this is zero cost. (This used to be ctdb commit a3248c3e2b740cd2403acffd3c1f6a33dca0ea03)
37 lines
993 B
C
37 lines
993 B
C
#define HAVE_UNIXSOCKET 1
|
|
|
|
#include "replace.h"
|
|
#include "talloc.h"
|
|
#include "tdb.h"
|
|
#include "idtree.h"
|
|
#include "ctdb.h"
|
|
#include "lib/util/dlinklist.h"
|
|
|
|
typedef bool BOOL;
|
|
|
|
#define True 1
|
|
#define False 0
|
|
|
|
#define LogLevel 0
|
|
|
|
#define DEBUG(lvl, x) if ((lvl) <= LogLevel) (printf x)
|
|
|
|
#define _PUBLIC_
|
|
|
|
#define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))
|
|
|
|
#ifndef discard_const
|
|
#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
|
|
#endif
|
|
|
|
struct timeval timeval_zero(void);
|
|
bool timeval_is_zero(const struct timeval *tv);
|
|
struct timeval timeval_current(void);
|
|
struct timeval timeval_set(uint32_t secs, uint32_t usecs);
|
|
int timeval_compare(const struct timeval *tv1, const struct timeval *tv2);
|
|
struct timeval timeval_until(const struct timeval *tv1,
|
|
const struct timeval *tv2);
|
|
_PUBLIC_ struct timeval timeval_current_ofs(uint32_t secs, uint32_t usecs);
|
|
double timeval_elapsed(struct timeval *tv);
|
|
char **file_lines_load(const char *fname, int *numlines, TALLOC_CTX *mem_ctx);
|