.\" $Id: ksql_role.3,v 1.5 2018/04/05 15:15:34 kristaps Exp $ .\" .\" Copyright (c) 2018 Kristaps Dzonsons .\" .\" Permission to use, copy, modify, and distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above .\" copyright notice and this permission notice appear in all copies. .\" .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" .Dd $Mdocdate: April 5 2018 $ .Dt KSQL_ROLE 3 .Os .Sh NAME .Nm ksql_role .Nd set role in ksql context .Sh LIBRARY .Lb ksql .Sh SYNOPSIS .In sys/types.h .In stdint.h .In ksql.h .Ft void .Fo ksql_role .Fa "struct ksql *sql" .Fa "size_t role" .Fc .Sh DESCRIPTION The .Nm function sets the current role of .Fa sql . The .Fa role is the index of a role defined in .Fa cfg->roles as passed to .Xr ksql_alloc 3 or .Xr ksql_alloc_child 3 . The role affects all subsequent .Xr ksql_exec 3 and .Xr ksql_stmt_alloc 3 calls. .Pp The new role must be allowed by having a non-zero value in the .Fa roles array within the current role's .Ft struct ksqlrole object. Otherwise, the situation is logged to .Dv stderr and the program is immediately terminated. .Pp In split-process mode, .Fn ksql_role automatically sets .Dv KSQL_EXIT_ON_ERR on .Fa cfg->flags and .Fa cfg->err to .Dv NULL , restoring both if/when it returns. These guarantee that the function will never return without having properly set the new role. .\" .Sh CONTEXT .\" For section 9 functions only. .\" .Sh IMPLEMENTATION NOTES .\" Not used in OpenBSD. .\" .Sh RETURN VALUES .\" For sections 2, 3, and 9 function return values only. .\" .Sh ENVIRONMENT .\" For sections 1, 6, 7, and 8 only. .\" .Sh FILES .\" .Sh EXIT STATUS .\" For sections 1, 6, and 8 only. .\" .Sh EXAMPLES .\" .Sh DIAGNOSTICS .\" For sections 1, 4, 6, 7, 8, and 9 printf/stderr messages only. .\" .Sh ERRORS .\" For sections 2, 3, 4, and 9 errno settings only. .Sh SEE ALSO .Xr ksql_alloc 3 , .Xr ksql_alloc_child 3 , .Xr ksql_exec 3 , .Xr ksql_stmt_alloc 3 .\" .Sh STANDARDS .\" .Sh HISTORY .\" .Sh AUTHORS .\" .Sh CAVEATS .\" .Sh BUGS .\" .Sh SECURITY CONSIDERATIONS .\" Not used in OpenBSD.