Modified backend exit strategy so that 2nd ^C actually exits
Copied creator cvec if modified with REPLACE
This commit is contained in:
parent
53ceb35d51
commit
a1e7c6f126
5 changed files with 33 additions and 8 deletions
|
|
@ -64,6 +64,7 @@ Developers may need to change their code
|
||||||
|
|
||||||
### Minor features
|
### Minor features
|
||||||
|
|
||||||
|
* Modified backend exit strategy so that 2nd ^C actually exits
|
||||||
* Performance: A change in the `merge` code made "co-located" config and non-config get retrieval go considerable faster. This is done by a specialized `xml_child_each_attr()` function.
|
* Performance: A change in the `merge` code made "co-located" config and non-config get retrieval go considerable faster. This is done by a specialized `xml_child_each_attr()` function.
|
||||||
* CLI: Added `show statistics` example code for backend and CLI memory stats
|
* CLI: Added `show statistics` example code for backend and CLI memory stats
|
||||||
* [Support yang type union with are same subtypes with SNMP](https://github.com/clicon/clixon/pull/427)
|
* [Support yang type union with are same subtypes with SNMP](https://github.com/clicon/clixon/pull/427)
|
||||||
|
|
|
||||||
|
|
@ -158,6 +158,8 @@ backend_sig_term(int arg)
|
||||||
if (i++ == 0)
|
if (i++ == 0)
|
||||||
clicon_log(LOG_NOTICE, "%s: %s: pid: %u Signal %d",
|
clicon_log(LOG_NOTICE, "%s: %s: pid: %u Signal %d",
|
||||||
__PROGRAM__, __FUNCTION__, getpid(), arg);
|
__PROGRAM__, __FUNCTION__, getpid(), arg);
|
||||||
|
else
|
||||||
|
exit(1);
|
||||||
clixon_exit_set(1); /* checked in clixon_event_loop() */
|
clixon_exit_set(1); /* checked in clixon_event_loop() */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -232,6 +232,7 @@ int xml_creator_add(cxobj *xn, char *name);
|
||||||
int xml_creator_rm(cxobj *xn, char *name);
|
int xml_creator_rm(cxobj *xn, char *name);
|
||||||
int xml_creator_find(cxobj *xn, char *name);
|
int xml_creator_find(cxobj *xn, char *name);
|
||||||
size_t xml_creator_len(cxobj *xn);
|
size_t xml_creator_len(cxobj *xn);
|
||||||
|
int xml_creator_copy(cxobj *x0, cxobj *x1);
|
||||||
int xml_creator_print(FILE *f, cxobj *xn);
|
int xml_creator_print(FILE *f, cxobj *xn);
|
||||||
|
|
||||||
char *xml_value(cxobj *xn);
|
char *xml_value(cxobj *xn);
|
||||||
|
|
|
||||||
|
|
@ -188,8 +188,7 @@ check_body_namespace(cxobj *x0,
|
||||||
if (ns0 != NULL && ns1 != NULL){ /* namespace exists in both x1 and x0 */
|
if (ns0 != NULL && ns1 != NULL){ /* namespace exists in both x1 and x0 */
|
||||||
if (strcmp(ns0, ns1)){
|
if (strcmp(ns0, ns1)){
|
||||||
/* prefixes in x1 and x0 refers to different namespaces
|
/* prefixes in x1 and x0 refers to different namespaces
|
||||||
* XXX return netconf error instead
|
* XXX return netconf error instead bad-attribue?
|
||||||
bad-attribue?
|
|
||||||
*/
|
*/
|
||||||
if ((cberr = cbuf_new()) == NULL){
|
if ((cberr = cbuf_new()) == NULL){
|
||||||
clicon_err(OE_UNIX, errno, "cbuf_new");
|
clicon_err(OE_UNIX, errno, "cbuf_new");
|
||||||
|
|
@ -848,6 +847,8 @@ text_modify(clicon_handle h,
|
||||||
#ifdef XML_PARENT_CANDIDATE
|
#ifdef XML_PARENT_CANDIDATE
|
||||||
xml_parent_candidate_set(x0, x0p);
|
xml_parent_candidate_set(x0, x0p);
|
||||||
#endif
|
#endif
|
||||||
|
if (xml_creator_copy(x1, x0) < 0)
|
||||||
|
goto done;
|
||||||
changed++;
|
changed++;
|
||||||
/* Get namespace from x1
|
/* Get namespace from x1
|
||||||
* Check if namespace exists in x0 parent
|
* Check if namespace exists in x0 parent
|
||||||
|
|
|
||||||
|
|
@ -705,6 +705,29 @@ xml_creator_len(cxobj *xn)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! Copy creator info from x0 to x1
|
||||||
|
*
|
||||||
|
* @param[in] x0 Source XML node
|
||||||
|
* @param[in] x1 Destination XML node
|
||||||
|
* @retval 0 OK
|
||||||
|
* @retval -1 Error
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
xml_creator_copy(cxobj *x0,
|
||||||
|
cxobj *x1)
|
||||||
|
{
|
||||||
|
int retval = -1;
|
||||||
|
|
||||||
|
if (x0->x_creators)
|
||||||
|
if ((x1->x_creators = cvec_dup(x0->x_creators)) == NULL){
|
||||||
|
clicon_err(OE_UNIX, errno, "cvec_dup");
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
retval = 0;
|
||||||
|
done:
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
/*! Print XML and creator tags where they exists, apply help function
|
/*! Print XML and creator tags where they exists, apply help function
|
||||||
*
|
*
|
||||||
* @param[in] x XML tree
|
* @param[in] x XML tree
|
||||||
|
|
@ -737,7 +760,7 @@ int
|
||||||
xml_creator_print(FILE *f,
|
xml_creator_print(FILE *f,
|
||||||
cxobj *xn)
|
cxobj *xn)
|
||||||
{
|
{
|
||||||
return xml_apply(xn, CX_ELMNT, creator_print_fn, f);
|
return xml_apply0(xn, CX_ELMNT, creator_print_fn, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Get value of xnode
|
/*! Get value of xnode
|
||||||
|
|
@ -2079,11 +2102,8 @@ xml_copy_one(cxobj *x0,
|
||||||
switch (xml_type(x0)){
|
switch (xml_type(x0)){
|
||||||
case CX_ELMNT:
|
case CX_ELMNT:
|
||||||
xml_spec_set(x1, xml_spec(x0));
|
xml_spec_set(x1, xml_spec(x0));
|
||||||
if (x0->x_creators)
|
if (xml_creator_copy(x0, x1) < 0)
|
||||||
if ((x1->x_creators = cvec_dup(x0->x_creators)) == NULL){
|
|
||||||
clicon_err(OE_UNIX, errno, "cvec_dup");
|
|
||||||
goto done;
|
goto done;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case CX_BODY:
|
case CX_BODY:
|
||||||
case CX_ATTR:
|
case CX_ATTR:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue