Home About BC DR HA Support Training Download
You are here: Home/ Downloads/ C-Code/ Please Login or Register

-
Current Location
-

js
  Downloads
    C-Code
-
AIX Admin Methodology
Global Consolidation Project
All AIX admins should join
www.aixexpert.com


Join our LinkedIn Group
AIX Advanced Technical Experts
Contract Opportunities

www.LinkedIn.com

-
digg Digg this page
del.icio.us Post to del.icio.us
Slashdot Slashdot it!


LPAR Leasing
Lease an AIX / i5 LPAR
Reduce your costs

www.mtxia.com

Server Leasing
Lease a Server off-site
Reduce your costs

www.mtxia.com

Data Center Automation
Business Continuity and DR
Virtualization/Consolidation

www.mtxia.com

HMC Service
Hardware Management Console
Manage Remote AIX / i5 LPARs

www.siteox.com

Business Web Site Hosting
$3.99 / month includes Tools,
Shopping Cart, Site Builder

www.siteox.com

Disaster Recovery
Small Business Oriented
Off-Site Facilities

www.mtxia.com

IBM pSeries / iSeries
Reduce your Costs
Off-Site Server Hosting

www.mtxia.com

setlinuxpri.c C-Language Source Code

/* Set a process to a constant and permanent priority

   Name:   setlinuxpri.c

   Compile using:  gcc -o setlinuxpri setlinuxpri.c
                   chown root setlinuxpri
                   chmod 0500 setlinuxpri

   Usage:  setlinuxpri -p ProcessID -P Priority

*/

#include 
#include 
int setpriority(int which, id_t who, int value);
int getopt (ArgumentC,  ArgumentV,  OptionString);
int ArgumentC;
char *const ArgumentV [ ];
const char *OptionString;

extern int  optind;
extern int  optopt;
extern int  opterr;
extern char * optarg;

/* ############################################################# */

int main(int argc, char** argv)
{
        int arg;
        int ProcessID;
        int Priority;
        int out;

        ProcessID = -1;
        Priority = 60;

        while (arg!=EOF)
        {
                arg=getopt(argc, argv, "p:P:");
                switch(arg)
                {
/* Set the process id number */
                case 'p':
                        ProcessID=atoi(optarg);
                        break;
/* Set the priority number */
                case 'P':
                        Priority=atoi(optarg);   /* Set the priority */
                        break;
                case '?':
                        exit(usage());
                }
        }

        if ( ProcessID >= 0 ) {
            out = setpriority ( PRIO_PROCESS, ProcessID, Priority);
        } else {
          printf("setlinuxpri: -p option is required\n");
          exit(usage());
        }
}

/* ################################################################ */
/* usage */

int usage()
{
    printf("\nSyntax: setlinuxpri -p ProcessID [-P Priority]\n");
    printf("        Maximum Priority =   1\n");
    printf("        Default Priority =  60\n");
    printf("        Minimum Priority = 254\n");
    return(1);
}

-
Set Linux Priority
-
 

HTML2tex
Set AIX Priority
Set Linux Priority
Set AIX Password
Set WLM tag


LPAR Leasing
Lease an AIX / i5 LPAR
Reduce your costs

www.mtxia.com

Server Leasing
Lease a Server off-site
Reduce your costs

www.mtxia.com

Data Center Automation
Business Continuity and DR
Virtualization/Consolidation

www.mtxia.com

HMC Service
Hardware Management Console
Manage Remote AIX / i5 LPARs

www.siteox.com

Business Web Site Hosting
$3.99 / month includes Tools,
Shopping Cart, Site Builder

www.siteox.com

FREE Domain Registration
included with Web Site Hosting
Tools, Social Networking, Blog

www.siteox.com

Disaster Recovery
Small Business Oriented
Off-Site Facilities

www.mtxia.com

IBM pSeries / iSeries
Reduce your Costs
Off-Site Server Hosting

www.mtxia.com