Privilege.xs revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* Privilege.xs contains XS wrappers for the process privilege maniplulation
* functions.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/* Solaris includes. */
#include <priv.h>
#include <ctype.h>
/* Perl includes. */
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#define RETPRIVSET(set) \
ST(0) = sv_newmortal(); \
(void*)(set)); \
typedef int sysret;
static priv_set_t *
dupset(const priv_set_t *s)
{
return (NULL);
priv_copyset(s, new);
return (new);
}
/*
* Automatically derive the #define constant from the constant value.
* This is the uppercase value of the constant with "PRIV_" prepended.
* The (name, value) pair computed in that way is stored twice:
* once as constant subroutine in the module's hash table.
* once as (key, value) in a hash table.
*/
static void
{
char upname[128];
int i;
return;
}
/*
* The XS code exported to perl is below here. Note that the XS preprocessor
* has its own commenting syntax, so all comments from this point on are in
* that form.
*
* Inside perl, privilege sets are represented as expanded strings;
* privileges and privilege sets are only known by name.
*/
#
#
BOOT:
{
const char *p;
int i;
/*
* Global constants
*/
/*
* %PRIVILEGES hash and the privilege constants
*/
for (i = 0; (p = priv_getbynum(i++)) != NULL; )
/*
* %PRIVSETS hash and the privset constants
*/
for (i = 0; (p = priv_getsetbynum(i++)) != NULL; )
}
const char *which;
CODE:
RETVAL = priv_allocset();
} else {
}
int op;
const char *which;
CODE:
RETVAL = priv_allocset();
}
CODE:
RETVAL = priv_allocset();
}
const char *priv;
const char *priv;
CODE:
}
CODE:
}
CODE:
}
const char *priv;
CODE:
}
const char *priv;
const char *
int i;
const char *
int i;
char *
priv_set_to_str(s, c, f)
char c;
int f;
const char *buf;
const char *sep;
CODE:
}
char *
const char *priv
void
CODE: