Server Wait On Clients System - API Documentation  v1.6.4
Server Wait On Clients System.
optionproc.c File Reference

Functions to process client lock flag options. More...

#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include <unistd.h>
#include <libmgec/libmgec.h>
#include <libmgec/mge-message.h>
#include <libmgec/mge-errno.h>
#include <libmgesysutils/mge-remsyslog.h>
#include <swoc/libswocclient.h>
#include <swoc/libswoccommon.h>
Include dependency graph for optionproc.c:

Macros

#define _Bool   signed char
 
#define bool   _Bool
 
#define false   0
 
#define true   1
 
#define __bool_true_false_are_defined   1
 

Functions

int swc_show_status (void)
 Display client's lock status. More...
 
int swc_show_srv_block_status (void)
 Display status of server blocking. More...
 
int swc_block (void)
 Set block flag on server to prevent this client from setting any more locks. More...
 
int swc_unblock (void)
 Remove block flag on server to allow this client to set locks. More...
 
int swc_set_lock (void)
 Set lock flag on server. More...
 
int swc_rel_lock (void)
 Release lock flag on server. More...
 
int swc_client_wait (char *cnumlocks)
 Wait until only a maximum of cnumlocks for this client remains. More...
 
int swc_reset (void)
 Reset the client on the server to 0 locks and unblocked. More...
 

Variables

char locks_held [10] = "0"
 Holds the number of locks currently held during swc_client_wait(). More...
 

Detailed Description

Functions to process client lock flag options.

Author
Copyright (C) 2016-2019, 2021, 2022 Mark Grant

Released under the GPLv3 only.
SPDX-License-Identifier: GPL-3.0-only

Version
v1.1.17 ==== 17/09/2022

Macro Definition Documentation

◆ __bool_true_false_are_defined

#define __bool_true_false_are_defined   1

◆ _Bool

#define _Bool   signed char

◆ bool

#define bool   _Bool

◆ false

#define false   0

◆ true

#define true   1

Function Documentation

◆ swc_block()

int swc_block ( void  )

Set block flag on server to prevent this client from setting any more locks.

On error mge_errno will be set.

Returns
0 on success, < zero on failure.

◆ swc_client_wait()

int swc_client_wait ( char *  cnumlocks)

Wait until only a maximum of cnumlocks for this client remains.

If cnumlocks > 0 this realistically means that a previous command in this sequence would have been a lock request. On error mge_errno will be set.

Parameters
cnumlocksWait until the number of locks is <= this value. This value must be 0 or 1.
Returns
0 on success, < zero on failure.

◆ swc_rel_lock()

int swc_rel_lock ( void  )

Release lock flag on server.

On error mge_errno will be set.

Returns
0 on success, < zero on failure.

◆ swc_reset()

int swc_reset ( void  )

Reset the client on the server to 0 locks and unblocked.

On error mge_errno will be set.

Returns
0 on success, < zero on failure.

◆ swc_set_lock()

int swc_set_lock ( void  )

Set lock flag on server.

On error mge_errno will be set.

Returns
0 on success, < zero on failure.

◆ swc_show_srv_block_status()

int swc_show_srv_block_status ( void  )

Display status of server blocking.

On error mge_errno will be set.

Returns
0 on success, < zero on failure.

◆ swc_show_status()

int swc_show_status ( void  )

Display client's lock status.

On error mge_errno will be set.

Returns
0 on success, < zero on failure.

◆ swc_unblock()

int swc_unblock ( void  )

Remove block flag on server to allow this client to set locks.

On error mge_errno will be set.

Returns
0 on success, < zero on failure.

Variable Documentation

◆ locks_held

char locks_held[10] = "0"

Holds the number of locks currently held during swc_client_wait().

This value can be accessed in a handler if a signal is received.