14321Scasper /*
24321Scasper * CDDL HEADER START
34321Scasper *
44321Scasper * The contents of this file are subject to the terms of the
54321Scasper * Common Development and Distribution License (the "License").
64321Scasper * You may not use this file except in compliance with the License.
74321Scasper *
84321Scasper * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
94321Scasper * or http://www.opensolaris.org/os/licensing.
104321Scasper * See the License for the specific language governing permissions
114321Scasper * and limitations under the License.
124321Scasper *
134321Scasper * When distributing Covered Code, include this CDDL HEADER in each
144321Scasper * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
154321Scasper * If applicable, add the following below this CDDL HEADER, with the
164321Scasper * fields enclosed by brackets "[]" replaced with your own identifying
174321Scasper * information: Portions Copyright [yyyy] [name of copyright owner]
184321Scasper *
194321Scasper * CDDL HEADER END
204321Scasper */
214321Scasper
224321Scasper /*
23*11963SAfshin.Ardakani@Sun.COM * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
244321Scasper * Use is subject to license terms.
254321Scasper */
264321Scasper
274321Scasper /*
284321Scasper * UID/SID mapping system call entries.
294321Scasper */
304321Scasper
316812Sraf #include "lint.h"
324321Scasper #include <sys/sid.h>
334321Scasper #include <sys/syscall.h>
344321Scasper
354321Scasper
364321Scasper int
allocids(int flag,int nuids,uid_t * suid,int ngids,gid_t * sgid)374321Scasper allocids(int flag, int nuids, uid_t *suid, int ngids, gid_t *sgid)
384321Scasper {
394321Scasper sysret_t rv;
404321Scasper int e;
414321Scasper
424321Scasper e = __systemcall(&rv, SYS_sidsys, SIDSYS_ALLOC_IDS, flag, nuids, ngids);
434321Scasper
444321Scasper if (e != 0) {
454321Scasper (void) __set_errno(e);
464321Scasper return (-1);
474321Scasper }
484321Scasper
494321Scasper if (suid != NULL)
504321Scasper *suid = (uid_t)rv.sys_rval1;
514321Scasper if (sgid != NULL)
524321Scasper *sgid = (gid_t)rv.sys_rval2;
534321Scasper
544321Scasper return (0);
554321Scasper }
564321Scasper
574321Scasper int
__idmap_reg(int fd)58*11963SAfshin.Ardakani@Sun.COM __idmap_reg(int fd)
594321Scasper {
604321Scasper return (syscall(SYS_sidsys, SIDSYS_IDMAP_REG, fd));
614321Scasper }
624321Scasper
634321Scasper int
__idmap_unreg(int fd)64*11963SAfshin.Ardakani@Sun.COM __idmap_unreg(int fd)
654321Scasper {
664321Scasper return (syscall(SYS_sidsys, SIDSYS_IDMAP_UNREG, fd));
674321Scasper }
68*11963SAfshin.Ardakani@Sun.COM
69*11963SAfshin.Ardakani@Sun.COM int
__idmap_flush_kcache(void)70*11963SAfshin.Ardakani@Sun.COM __idmap_flush_kcache(void)
71*11963SAfshin.Ardakani@Sun.COM {
72*11963SAfshin.Ardakani@Sun.COM return (syscall(SYS_sidsys, SIDSYS_IDMAP_FLUSH_KCACHE));
73*11963SAfshin.Ardakani@Sun.COM }
74