Hi,
"restrict" is a keyword in C99 so it mustn't be used as a field name.
I couldn't come up with a better name, so I replaced it with
"restricted".
Reported in:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=689696
Cheers,
David
---------------------------------------------------------
commit a87f2f788b60c1efa7b813de307f1834e73a592d
Author: David Weber <wb(a)munzinger.de>
Date: Mon Oct 8 09:05:57 2012 +0200
Replace restrict field name with restricted
"restrict" is a keyword in C99 so it mustn't be used.
diff --git a/src/cmd.c b/src/cmd.c
index 1f60e04..d443e92 100644
--- a/src/cmd.c
+++ b/src/cmd.c
static void cmd_acquire(struct task *task, struct cmd_args *ca)
token->host_generation = spi.host_generation;
token->pid = cl_pid;
token->io_timeout = spi.io_timeout;
- if (cl->restrict & SANLK_RESTRICT_SIGKILL)
+ if (cl->restricted & SANLK_RESTRICT_SIGKILL)
token->flags |= T_RESTRICT_SIGKILL;
/* save a record of what this token_id is for later debugging */
static int print_state_client(struct client *cl, int ci, char *str)
"fd=%d "
"pid=%d "
"flags=%x "
- "restrict=%x "
+ "restricted=%x "
"cmd_active=%d "
"cmd_last=%d "
"pid_dead=%d "
static int print_state_client(struct client *cl, int ci, char *str)
cl->fd,
cl->pid,
cl->flags,
- cl->restrict,
+ cl->restricted,
cl->cmd_active,
cl->cmd_last,
cl->pid_dead,
static void cmd_restrict(int ci, int fd, struct sm_header *h_recv)
log_debug("cmd_restrict ci %d fd %d pid %d flags %x",
ci, fd, client[ci].pid, h_recv->cmd_flags);
- client[ci].restrict = h_recv->cmd_flags;
+ client[ci].restricted = h_recv->cmd_flags;
send_result(fd, h_recv, 0);
}
diff --git a/src/main.c b/src/main.c
index dea78f7..478e436 100644
--- a/src/main.c
+++ b/src/main.c
static void _client_free(int ci)
cl->need_free = 0;
cl->kill_count = 0;
cl->kill_last = 0;
- cl->restrict = 0;
+ cl->restricted = 0;
cl->flags = 0;
memset(cl->owner_name, 0, sizeof(cl->owner_name));
memset(cl->killpath, 0, SANLK_HELPER_PATH_LEN);
static void kill_pids(struct space *sp)
* sigkill will be used in place of sigterm if restricted
*/
- if ((sig == SIGKILL) && (cl->restrict & SANLK_RESTRICT_SIGKILL))
+ if ((sig == SIGKILL) && (cl->restricted & SANLK_RESTRICT_SIGKILL))
sig = SIGTERM;
- if ((sig == SIGTERM) && (cl->restrict & SANLK_RESTRICT_SIGTERM))
+ if ((sig == SIGTERM) && (cl->restricted & SANLK_RESTRICT_SIGTERM))
sig = SIGKILL;
do_kill = 1;
static void process_connection(int ci)
ci, rv, h.magic, SM_MAGIC);
goto dead;
}
- if (client[ci].restrict & SANLK_RESTRICT_ALL) {
+ if (client[ci].restricted & SANLK_RESTRICT_ALL) {
log_error("ci %d fd %d pid %d cmd %d restrict all",
ci, client[ci].fd, client[ci].pid, h.cmd);
goto dead;
diff --git a/src/sanlock_internal.h b/src/sanlock_internal.h
index 2c67fc8..bce00f6 100644
--- a/src/sanlock_internal.h
+++ b/src/sanlock_internal.h
struct sync_disk {
* 'struct resource' keeps track of resources globally, resources list
*/
-#define T_RESTRICT_SIGKILL 0x00000001 /* inherited from client->restrict */
+#define T_RESTRICT_SIGKILL 0x00000001 /* inherited from client->restricted */
#define T_LS_DEAD 0x00000002 /* don't bother trying to release if ls is dead */
struct token {
struct client {
int need_free;
int kill_count;
uint32_t flags;
- uint32_t restrict;
+ uint32_t restricted;
uint64_t kill_last;
char owner_name[SANLK_NAME_LEN+1];
char killpath[SANLK_HELPER_PATH_LEN];