Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]

#include <resource.h>
Link against: libc.lib

PRIO_PROCESS

Interface status: externallyDefinedApi

PRIO_PROCESS 0

Description

Process priority specifications to get or set priority.

[Top]


PRIO_PGRP

Interface status: externallyDefinedApi

PRIO_PGRP 1

Description

Process priority specifications to get or set priority.

[Top]


PRIO_USER

Interface status: externallyDefinedApi

PRIO_USER 2

Description

Process priority specifications to get or set priority.

[Top]


RUSAGE_SELF

Interface status: externallyDefinedApi

RUSAGE_SELF 0

Description

Resource utilization information.

[Top]


RUSAGE_CHILDREN

Interface status: externallyDefinedApi

RUSAGE_CHILDREN -1

Description

Resource utilization information.

[Top]


RLIMIT_CPU

Interface status: externallyDefinedApi

RLIMIT_CPU 0

Description

cpu time in milliseconds

[Top]


RLIMIT_FSIZE

Interface status: externallyDefinedApi

RLIMIT_FSIZE 1

Description

maximum file size

[Top]


RLIMIT_DATA

Interface status: externallyDefinedApi

RLIMIT_DATA 2

Description

data size

[Top]


RLIMIT_STACK

Interface status: externallyDefinedApi

RLIMIT_STACK 3

Description

stack size

[Top]


RLIMIT_CORE

Interface status: externallyDefinedApi

RLIMIT_CORE 4

Description

core file size

[Top]


RLIMIT_NOFILE

Interface status: externallyDefinedApi

RLIMIT_NOFILE 8

Description

number of open files

[Top]


RLIMIT_AS

Interface status: externallyDefinedApi

RLIMIT_AS RLIMIT_VMEM

Description

standard name for RLIMIT_VMEM

[Top]


RLIM_INFINITY

Interface status: externallyDefinedApi

RLIM_INFINITY ((rlim_t)(((uint64_t)1 << 63) - 1))

Description

unsigned long int

[Top]


Typedef rlim_t

Interface status: externallyDefinedApi

typedef __rlim_t rlim_t;

Description

Unsigned integer type used for limit values.

[Top]


getpriority(int,int)

Interface status: externallyDefinedApi

IMPORT_C int getpriority(int, int);

Description

The scheduling priority of the process, process group, or user, as indicated by which and who is obtained with the getpriority system call and set with the setpriority system call. The which argument is one of PRIO_PROCESS, PRIO_PGRP, or PRIO_USER, and who is interpreted relative to which (a process identifier for PRIO_PROCESS, process group identifier for PRIO_PGRP, and a user ID for PRIO_USER ). A zero value of who denotes the current process, process group, or user. The prio argument is a value in the range -20 to 20. The default priority is 0; lower priorities cause more favorable scheduling.

If the prio is greater than the greatest priority supported, it is set to the greatest priority supported. If the prio is lesser than the least priority supported, it is set to the least priority supported.

Examples:

#include<sys/resource.h>        
#include<unistd.h>
#include<stdio.h>
int test_getpriority()
{
   int retVal;
   errno = 0;
   retVal = getpriority(PRIO_PROCESS, 0);
   if((retVal == -1) && (errno == ENOSYS))
   {
      printf("Failed");
      return -1;
   }
   else
   {
      printf("getpriority passed");
      printf("
priority = %d ", retVal);
   }    
   return 0;
}

Output

getpriority passed
priority = 0
#include<sys/resource.h>        
#include<unistd.h>
#include<stdio.h>
int test_setpriority()
{
   int retVal;
   errno = 0;
   retVal = setpriority(PRIO_PROCESS, 0, 0);
  
   if((retVal == -1) && (errno == ENOSYS))
   {
      printf("Failed");
      return -1;
   }
   else
   {
      printf("Setpriority passed");
      printf(" getpriority now: %d", getpriority(PRIO_PROCESS,0))
    }   
   return 0;
}

Output

Setpriority passed
getpriority now: 0

Limitations:

1. The values PRIO_PGRP and PRIO_USER for the which and any value other than 0 for who are not supported, when given return ENOSYS. 2. To effectively increase or decrease the priority of the process, one should consider the following: Highest -16 to -20 Above Normal -6 to -15 Normal +4 to -5 Below Normal +14 to +5 Lowest +20 to +15 3. The setting of the priority to values -16 to -20 is not supported, the use of which sets errno to EINVAL.

Parameters

int

int

Note: This description also covers the following functions - setpriority(int,int,int)setpriority(int,int,int)

Return value

int

Since getpriority can legitimately return the value -1, it is necessary to clear the external variable errno prior to the call, then check it afterward to determine if a -1 is an error or a legitimate value. The setpriority returns 0 on success and -1 on error with the errno set.

See also:

[Top]


setpriority(int,int,int)

Interface status: externallyDefinedApi

IMPORT_C int setpriority(int, int, int);

Description

Parameters

int

int

int

Refer to getpriority(int,int)getpriority(int,int) for the documentation

Return value

int

See also: