10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 52248Sraf * Common Development and Distribution License (the "License"). 62248Sraf * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 212248Sraf 22*6247Sraf /* 23*6247Sraf * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 24*6247Sraf * Use is subject to license terms. 25*6247Sraf */ 26*6247Sraf 270Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 280Sstevel@tonic-gate /* All Rights Reserved */ 290Sstevel@tonic-gate 300Sstevel@tonic-gate #ifndef _SYS_PRIOCNTL_H 310Sstevel@tonic-gate #define _SYS_PRIOCNTL_H 320Sstevel@tonic-gate 330Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" /* from SVR4 1.6 */ 340Sstevel@tonic-gate 350Sstevel@tonic-gate #include <sys/types.h> 360Sstevel@tonic-gate #include <sys/procset.h> 370Sstevel@tonic-gate 380Sstevel@tonic-gate #ifdef __cplusplus 390Sstevel@tonic-gate extern "C" { 400Sstevel@tonic-gate #endif 410Sstevel@tonic-gate 420Sstevel@tonic-gate #define PC_VERSION 1 /* First version of priocntl */ 430Sstevel@tonic-gate 440Sstevel@tonic-gate #ifdef __STDC__ 450Sstevel@tonic-gate extern long priocntl(idtype_t, id_t, int, ...); 460Sstevel@tonic-gate extern long priocntlset(procset_t *, int, ...); 470Sstevel@tonic-gate #else 480Sstevel@tonic-gate extern long priocntl(), priocntlset(); 490Sstevel@tonic-gate #endif /* __STDC__ */ 500Sstevel@tonic-gate 510Sstevel@tonic-gate /* 520Sstevel@tonic-gate * The following are the possible values of the command 530Sstevel@tonic-gate * argument for the priocntl system call. 540Sstevel@tonic-gate */ 550Sstevel@tonic-gate 560Sstevel@tonic-gate #define PC_GETCID 0 /* Get class ID */ 570Sstevel@tonic-gate #define PC_GETCLINFO 1 /* Get info about a configured class */ 580Sstevel@tonic-gate #define PC_SETPARMS 2 /* Set scheduling parameters */ 590Sstevel@tonic-gate #define PC_GETPARMS 3 /* Get scheduling parameters */ 600Sstevel@tonic-gate #define PC_ADMIN 4 /* Scheduler administration (used by */ 61*6247Sraf /* dispadmin(1M), not for general use) */ 62*6247Sraf #define PC_GETPRIRANGE 5 /* Get priority range for a class */ 630Sstevel@tonic-gate /* posix.4 scheduling, not for general use */ 640Sstevel@tonic-gate #define PC_DONICE 6 /* Set or get nice value */ 650Sstevel@tonic-gate #define PC_SETXPARMS 7 /* Set extended scheduling parameters */ 660Sstevel@tonic-gate #define PC_GETXPARMS 8 /* Get extended scheduling parameters */ 670Sstevel@tonic-gate #define PC_SETDFLCL 9 /* Set default class, not for general use */ 683247Sgjelinek #define PC_GETDFLCL 10 /* Get default class, not for general use */ 69*6247Sraf #define PC_DOPRIO 11 /* Set or get priority, not for general use */ 700Sstevel@tonic-gate 710Sstevel@tonic-gate #define PC_CLNULL -1 720Sstevel@tonic-gate 730Sstevel@tonic-gate #define PC_CLNMSZ 16 740Sstevel@tonic-gate #define PC_CLINFOSZ (32 / sizeof (int)) 750Sstevel@tonic-gate #define PC_CLPARMSZ (32 / sizeof (int)) 760Sstevel@tonic-gate 770Sstevel@tonic-gate #define PC_GETNICE 0 780Sstevel@tonic-gate #define PC_SETNICE 1 790Sstevel@tonic-gate 80*6247Sraf #define PC_GETPRIO 0 81*6247Sraf #define PC_SETPRIO 1 82*6247Sraf 830Sstevel@tonic-gate typedef struct pcinfo { 840Sstevel@tonic-gate id_t pc_cid; /* class id */ 850Sstevel@tonic-gate char pc_clname[PC_CLNMSZ]; /* class name */ 860Sstevel@tonic-gate int pc_clinfo[PC_CLINFOSZ]; /* class information */ 870Sstevel@tonic-gate } pcinfo_t; 880Sstevel@tonic-gate 890Sstevel@tonic-gate typedef struct pcparms { 900Sstevel@tonic-gate id_t pc_cid; /* process class */ 910Sstevel@tonic-gate int pc_clparms[PC_CLPARMSZ]; /* class specific parameters */ 920Sstevel@tonic-gate } pcparms_t; 930Sstevel@tonic-gate 940Sstevel@tonic-gate typedef struct pcnice { 950Sstevel@tonic-gate int pc_val; /* nice value */ 960Sstevel@tonic-gate int pc_op; /* type of operation, set or get */ 970Sstevel@tonic-gate } pcnice_t; 980Sstevel@tonic-gate 99*6247Sraf typedef struct pcprio { 100*6247Sraf int pc_op; /* type of operation, set or get */ 101*6247Sraf id_t pc_cid; /* class id */ 102*6247Sraf int pc_val; /* priority value */ 103*6247Sraf } pcprio_t; 104*6247Sraf 1050Sstevel@tonic-gate /* 1060Sstevel@tonic-gate * The following is used by the priocntl(2) varargs interface (command 1070Sstevel@tonic-gate * codes: PC_SETXPARMS and PC_GETXPARMS). 1080Sstevel@tonic-gate */ 1090Sstevel@tonic-gate 1100Sstevel@tonic-gate #define PC_VAPARMCNT 8 /* maximal number of (key, value) pairs */ 1110Sstevel@tonic-gate #define PC_KY_NULL 0 /* terminates the (key, value) pair chain */ 1120Sstevel@tonic-gate #define PC_KY_CLNAME 1 /* get the class name of a process or LWP. */ 1130Sstevel@tonic-gate 1140Sstevel@tonic-gate typedef struct pc_vaparm { 1150Sstevel@tonic-gate int pc_key; /* describing key */ 1160Sstevel@tonic-gate u_longlong_t pc_parm; /* associated parameter */ 1170Sstevel@tonic-gate } pc_vaparm_t; 1180Sstevel@tonic-gate 1190Sstevel@tonic-gate typedef struct pc_vaparms { 1200Sstevel@tonic-gate uint_t pc_vaparmscnt; /* # of (key, value) pairs */ 1210Sstevel@tonic-gate pc_vaparm_t pc_parms[PC_VAPARMCNT]; /* parameter buffer */ 1220Sstevel@tonic-gate } pc_vaparms_t; 1230Sstevel@tonic-gate 1240Sstevel@tonic-gate #if defined(_SYSCALL32) && \ 1250Sstevel@tonic-gate _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 1260Sstevel@tonic-gate 1270Sstevel@tonic-gate /* 1280Sstevel@tonic-gate * These structures are needed by the 64-bit kernel on certain architectures 1290Sstevel@tonic-gate * to translate pc_vaparms_t/pc_vaparm_t data structures from 32-bit userland. 1300Sstevel@tonic-gate */ 1310Sstevel@tonic-gate #pragma pack(4) 1320Sstevel@tonic-gate 1330Sstevel@tonic-gate typedef struct { 1340Sstevel@tonic-gate int32_t pc_key; /* describing key */ 1350Sstevel@tonic-gate uint64_t pc_parm; /* associated parameter */ 1360Sstevel@tonic-gate } pc_vaparm32_t; 1370Sstevel@tonic-gate 1380Sstevel@tonic-gate #pragma pack() 1390Sstevel@tonic-gate 1400Sstevel@tonic-gate typedef struct { 1410Sstevel@tonic-gate uint32_t pc_vaparmscnt; /* # of (key, value) pairs */ 1420Sstevel@tonic-gate pc_vaparm32_t pc_parms[PC_VAPARMCNT]; /* parameter buffer */ 1430Sstevel@tonic-gate } pc_vaparms32_t; 1440Sstevel@tonic-gate 1450Sstevel@tonic-gate #endif /* _SYSCALL32 && ... */ 1460Sstevel@tonic-gate 1470Sstevel@tonic-gate /* 1482248Sraf * The following is used by libc for posix.4 1492248Sraf * scheduler interfaces and is not for general use. 1500Sstevel@tonic-gate */ 1510Sstevel@tonic-gate 1520Sstevel@tonic-gate typedef struct pcpri { 1530Sstevel@tonic-gate id_t pc_cid; /* process class */ 154*6247Sraf pri_t pc_clpmax; /* class priority max */ 155*6247Sraf pri_t pc_clpmin; /* class priority min */ 1560Sstevel@tonic-gate } pcpri_t; 1570Sstevel@tonic-gate 1580Sstevel@tonic-gate /* 1590Sstevel@tonic-gate * The following is used by the dispadmin(1M) command for 1600Sstevel@tonic-gate * scheduler administration and is not for general use. 1610Sstevel@tonic-gate */ 1620Sstevel@tonic-gate 1630Sstevel@tonic-gate #ifdef _SYSCALL32 1640Sstevel@tonic-gate /* Data structure for ILP32 clients */ 1650Sstevel@tonic-gate typedef struct pcadmin32 { 1660Sstevel@tonic-gate id32_t pc_cid; 1670Sstevel@tonic-gate caddr32_t pc_cladmin; 1680Sstevel@tonic-gate } pcadmin32_t; 1690Sstevel@tonic-gate #endif /* _SYSCALL32 */ 1700Sstevel@tonic-gate 1710Sstevel@tonic-gate typedef struct pcadmin { 1720Sstevel@tonic-gate id_t pc_cid; 1730Sstevel@tonic-gate caddr_t pc_cladmin; 1740Sstevel@tonic-gate } pcadmin_t; 1750Sstevel@tonic-gate 1760Sstevel@tonic-gate #ifdef __cplusplus 1770Sstevel@tonic-gate } 1780Sstevel@tonic-gate #endif 1790Sstevel@tonic-gate 1800Sstevel@tonic-gate #endif /* _SYS_PRIOCNTL_H */ 181