Project.xs revision 7c478bd95313f5f23a4c958a745db2134aa03244
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * CDDL HEADER START
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner * The contents of this file are subject to the terms of the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Common Development and Distribution License, Version 1.0 only
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * (the "License"). You may not use this file except in compliance
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin * with the License.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * See the License for the specific language governing permissions
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * and limitations under the License.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * When distributing Covered Code, include this CDDL HEADER in each
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * If applicable, add the following below this CDDL HEADER, with the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * fields enclosed by brackets "[]" replaced with your own identifying
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * information: Portions Copyright [yyyy] [name of copyright owner]
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * CDDL HEADER END
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Use is subject to license terms.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Project.xs contains XS wrappers for the project database maniplulation
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * functions as provided by libproject and described in getprojent(3EXACCT).
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#pragma ident "%Z%%M% %I% %E% SMI"
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* Solaris includes. */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* Perl includes. */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Convert and save a struct project on the perl XS return stack.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * In a void context it returns nothing, in a scalar context it returns just
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * the name of the project and in a list context it returns a 6-element list
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * consisting of (name, projid, comment, users, groups, attr), where users and
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * groups are references to arrays containing the appropriate lists.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return (1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return (6);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return (0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return (0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * The XS code exported to perl is below here. Note that the XS preprocessor
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * has its own commenting syntax, so all comments from this point on are in
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * that form. Note also that the PUTBACK; lines are necessary to synchronise
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * the local and global views of the perl stack before calling pushret_project,
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * as the code generated by the perl XS compiler twiddles with the stack on
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * entry to an XSUB.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinMODULE = Sun::Solaris::Project PACKAGE = Sun::Solaris::Project
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin # Define any constants that need to be exported. By doing it this way we can
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin # avoid the overhead of using the DynaLoader package, and in addition constants
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin # defined using this mechanism are eligible for inlining by the perl
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin newCONSTSUB(stash, "PROJNAME_MAX", newSViv(PROJNAME_MAX));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin newCONSTSUB(stash, "PROJECT_BUFSZ", newSViv(PROJECT_BUFSZ));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin newCONSTSUB(stash, "SETPROJ_ERR_TASK", newSViv(SETPROJ_ERR_TASK));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin newCONSTSUB(stash, "SETPROJ_ERR_POOL", newSViv(SETPROJ_ERR_POOL));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin const char *name;
nitems = 0;
char *name
char *user
char *user
char *proj
CODE:
char *proj
int id;