17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5f841f6adSraf * Common Development and Distribution License (the "License"). 6f841f6adSraf * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 21f841f6adSraf 227c478bd9Sstevel@tonic-gate /* 23*ba3594baSGarrett D'Amore * Copyright 2014 Garrett D'Amore <garrett@damore.org> 24*ba3594baSGarrett D'Amore * 25d4204c85Sraf * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 267c478bd9Sstevel@tonic-gate * Use is subject to license terms. 277c478bd9Sstevel@tonic-gate */ 287c478bd9Sstevel@tonic-gate 29d4204c85Sraf /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 30d4204c85Sraf /* All Rights Reserved */ 31d4204c85Sraf 327c478bd9Sstevel@tonic-gate #ifndef _SYS_PRIOCNTL_H 337c478bd9Sstevel@tonic-gate #define _SYS_PRIOCNTL_H 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate #include <sys/types.h> 367c478bd9Sstevel@tonic-gate #include <sys/procset.h> 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate #ifdef __cplusplus 397c478bd9Sstevel@tonic-gate extern "C" { 407c478bd9Sstevel@tonic-gate #endif 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gate #define PC_VERSION 1 /* First version of priocntl */ 437c478bd9Sstevel@tonic-gate 447c478bd9Sstevel@tonic-gate extern long priocntl(idtype_t, id_t, int, ...); 457c478bd9Sstevel@tonic-gate extern long priocntlset(procset_t *, int, ...); 467c478bd9Sstevel@tonic-gate 477c478bd9Sstevel@tonic-gate /* 487c478bd9Sstevel@tonic-gate * The following are the possible values of the command 497c478bd9Sstevel@tonic-gate * argument for the priocntl system call. 507c478bd9Sstevel@tonic-gate */ 517c478bd9Sstevel@tonic-gate 527c478bd9Sstevel@tonic-gate #define PC_GETCID 0 /* Get class ID */ 537c478bd9Sstevel@tonic-gate #define PC_GETCLINFO 1 /* Get info about a configured class */ 547c478bd9Sstevel@tonic-gate #define PC_SETPARMS 2 /* Set scheduling parameters */ 557c478bd9Sstevel@tonic-gate #define PC_GETPARMS 3 /* Get scheduling parameters */ 567c478bd9Sstevel@tonic-gate #define PC_ADMIN 4 /* Scheduler administration (used by */ 577c478bd9Sstevel@tonic-gate /* dispadmin(1M), not for general use) */ 58d4204c85Sraf #define PC_GETPRIRANGE 5 /* Get priority range for a class */ 597c478bd9Sstevel@tonic-gate /* posix.4 scheduling, not for general use */ 607c478bd9Sstevel@tonic-gate #define PC_DONICE 6 /* Set or get nice value */ 617c478bd9Sstevel@tonic-gate #define PC_SETXPARMS 7 /* Set extended scheduling parameters */ 627c478bd9Sstevel@tonic-gate #define PC_GETXPARMS 8 /* Get extended scheduling parameters */ 637c478bd9Sstevel@tonic-gate #define PC_SETDFLCL 9 /* Set default class, not for general use */ 640209230bSgjelinek #define PC_GETDFLCL 10 /* Get default class, not for general use */ 65d4204c85Sraf #define PC_DOPRIO 11 /* Set or get priority, not for general use */ 667c478bd9Sstevel@tonic-gate 677c478bd9Sstevel@tonic-gate #define PC_CLNULL -1 687c478bd9Sstevel@tonic-gate 697c478bd9Sstevel@tonic-gate #define PC_CLNMSZ 16 707c478bd9Sstevel@tonic-gate #define PC_CLINFOSZ (32 / sizeof (int)) 717c478bd9Sstevel@tonic-gate #define PC_CLPARMSZ (32 / sizeof (int)) 727c478bd9Sstevel@tonic-gate 737c478bd9Sstevel@tonic-gate #define PC_GETNICE 0 747c478bd9Sstevel@tonic-gate #define PC_SETNICE 1 757c478bd9Sstevel@tonic-gate 76d4204c85Sraf #define PC_GETPRIO 0 77d4204c85Sraf #define PC_SETPRIO 1 78d4204c85Sraf 797c478bd9Sstevel@tonic-gate typedef struct pcinfo { 807c478bd9Sstevel@tonic-gate id_t pc_cid; /* class id */ 817c478bd9Sstevel@tonic-gate char pc_clname[PC_CLNMSZ]; /* class name */ 827c478bd9Sstevel@tonic-gate int pc_clinfo[PC_CLINFOSZ]; /* class information */ 837c478bd9Sstevel@tonic-gate } pcinfo_t; 847c478bd9Sstevel@tonic-gate 857c478bd9Sstevel@tonic-gate typedef struct pcparms { 867c478bd9Sstevel@tonic-gate id_t pc_cid; /* process class */ 877c478bd9Sstevel@tonic-gate int pc_clparms[PC_CLPARMSZ]; /* class specific parameters */ 887c478bd9Sstevel@tonic-gate } pcparms_t; 897c478bd9Sstevel@tonic-gate 907c478bd9Sstevel@tonic-gate typedef struct pcnice { 917c478bd9Sstevel@tonic-gate int pc_val; /* nice value */ 927c478bd9Sstevel@tonic-gate int pc_op; /* type of operation, set or get */ 937c478bd9Sstevel@tonic-gate } pcnice_t; 947c478bd9Sstevel@tonic-gate 95d4204c85Sraf typedef struct pcprio { 96d4204c85Sraf int pc_op; /* type of operation, set or get */ 97d4204c85Sraf id_t pc_cid; /* class id */ 98d4204c85Sraf int pc_val; /* priority value */ 99d4204c85Sraf } pcprio_t; 100d4204c85Sraf 1017c478bd9Sstevel@tonic-gate /* 1027c478bd9Sstevel@tonic-gate * The following is used by the priocntl(2) varargs interface (command 1037c478bd9Sstevel@tonic-gate * codes: PC_SETXPARMS and PC_GETXPARMS). 1047c478bd9Sstevel@tonic-gate */ 1057c478bd9Sstevel@tonic-gate 1067c478bd9Sstevel@tonic-gate #define PC_VAPARMCNT 8 /* maximal number of (key, value) pairs */ 1077c478bd9Sstevel@tonic-gate #define PC_KY_NULL 0 /* terminates the (key, value) pair chain */ 1087c478bd9Sstevel@tonic-gate #define PC_KY_CLNAME 1 /* get the class name of a process or LWP. */ 1097c478bd9Sstevel@tonic-gate 1107c478bd9Sstevel@tonic-gate typedef struct pc_vaparm { 1117c478bd9Sstevel@tonic-gate int pc_key; /* describing key */ 1127c478bd9Sstevel@tonic-gate u_longlong_t pc_parm; /* associated parameter */ 1137c478bd9Sstevel@tonic-gate } pc_vaparm_t; 1147c478bd9Sstevel@tonic-gate 1157c478bd9Sstevel@tonic-gate typedef struct pc_vaparms { 1167c478bd9Sstevel@tonic-gate uint_t pc_vaparmscnt; /* # of (key, value) pairs */ 1177c478bd9Sstevel@tonic-gate pc_vaparm_t pc_parms[PC_VAPARMCNT]; /* parameter buffer */ 1187c478bd9Sstevel@tonic-gate } pc_vaparms_t; 1197c478bd9Sstevel@tonic-gate 1207c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) && \ 1217c478bd9Sstevel@tonic-gate _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 1227c478bd9Sstevel@tonic-gate 1237c478bd9Sstevel@tonic-gate /* 1247c478bd9Sstevel@tonic-gate * These structures are needed by the 64-bit kernel on certain architectures 1257c478bd9Sstevel@tonic-gate * to translate pc_vaparms_t/pc_vaparm_t data structures from 32-bit userland. 1267c478bd9Sstevel@tonic-gate */ 1277c478bd9Sstevel@tonic-gate #pragma pack(4) 1287c478bd9Sstevel@tonic-gate 1297c478bd9Sstevel@tonic-gate typedef struct { 1307c478bd9Sstevel@tonic-gate int32_t pc_key; /* describing key */ 1317c478bd9Sstevel@tonic-gate uint64_t pc_parm; /* associated parameter */ 1327c478bd9Sstevel@tonic-gate } pc_vaparm32_t; 1337c478bd9Sstevel@tonic-gate 1347c478bd9Sstevel@tonic-gate #pragma pack() 1357c478bd9Sstevel@tonic-gate 1367c478bd9Sstevel@tonic-gate typedef struct { 1377c478bd9Sstevel@tonic-gate uint32_t pc_vaparmscnt; /* # of (key, value) pairs */ 1387c478bd9Sstevel@tonic-gate pc_vaparm32_t pc_parms[PC_VAPARMCNT]; /* parameter buffer */ 1397c478bd9Sstevel@tonic-gate } pc_vaparms32_t; 1407c478bd9Sstevel@tonic-gate 1417c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 && ... */ 1427c478bd9Sstevel@tonic-gate 1437c478bd9Sstevel@tonic-gate /* 144f841f6adSraf * The following is used by libc for posix.4 145f841f6adSraf * scheduler interfaces and is not for general use. 1467c478bd9Sstevel@tonic-gate */ 1477c478bd9Sstevel@tonic-gate 1487c478bd9Sstevel@tonic-gate typedef struct pcpri { 1497c478bd9Sstevel@tonic-gate id_t pc_cid; /* process class */ 150d4204c85Sraf pri_t pc_clpmax; /* class priority max */ 151d4204c85Sraf pri_t pc_clpmin; /* class priority min */ 1527c478bd9Sstevel@tonic-gate } pcpri_t; 1537c478bd9Sstevel@tonic-gate 1547c478bd9Sstevel@tonic-gate /* 1557c478bd9Sstevel@tonic-gate * The following is used by the dispadmin(1M) command for 1567c478bd9Sstevel@tonic-gate * scheduler administration and is not for general use. 1577c478bd9Sstevel@tonic-gate */ 1587c478bd9Sstevel@tonic-gate 1597c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32 1607c478bd9Sstevel@tonic-gate /* Data structure for ILP32 clients */ 1617c478bd9Sstevel@tonic-gate typedef struct pcadmin32 { 1627c478bd9Sstevel@tonic-gate id32_t pc_cid; 1637c478bd9Sstevel@tonic-gate caddr32_t pc_cladmin; 1647c478bd9Sstevel@tonic-gate } pcadmin32_t; 1657c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 1667c478bd9Sstevel@tonic-gate 1677c478bd9Sstevel@tonic-gate typedef struct pcadmin { 1687c478bd9Sstevel@tonic-gate id_t pc_cid; 1697c478bd9Sstevel@tonic-gate caddr_t pc_cladmin; 1707c478bd9Sstevel@tonic-gate } pcadmin_t; 1717c478bd9Sstevel@tonic-gate 1727c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1737c478bd9Sstevel@tonic-gate } 1747c478bd9Sstevel@tonic-gate #endif 1757c478bd9Sstevel@tonic-gate 1767c478bd9Sstevel@tonic-gate #endif /* _SYS_PRIOCNTL_H */ 177