Changeset 1910 for trunk/src/emx/include


Ignore:
Timestamp:
Apr 25, 2005, 5:58:57 AM (20 years ago)
Author:
bird
Message:

Implemented (not tested) process priority manangement.

Location:
trunk/src/emx/include
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/include/InnoTekLIBC/backend.h

    • Property cvs2svn:cvs-rev changed from 1.18 to 1.19
    r1909 r1910  
    789789int __libc_Back_processSetGidAll(gid_t rgid, gid_t egid, gid_t svgid);
    790790
     791/**
     792 * Gets the most favourable priority of a process, group of processes
     793 * or all processed owned by a user.
     794 *
     795 * @returns 0 on success.
     796 * @returns Negative error code (errno.h) on failure.
     797 * @param   iWhich      PRIO_PROCESS, PRIO_PGRP, or PRIO_USER.
     798 * @param   idWho       Id of the type specified by iWhich. 0 means the current process/pgrp/user.
     799 * @param   piPrio      Where to store the priority.
     800 */
     801int __libc_Back_processGetPriority(int iWhich, id_t idWho, int *piPrio);
     802
     803/**
     804 * Sets the priority of a process, a group of processes
     805 * or all processed owned by a user.
     806 *
     807 * @returns 0 on success.
     808 * @returns Negative error code (errno.h) on failure.
     809 * @param   iWhich      PRIO_PROCESS, PRIO_PGRP, or PRIO_USER.
     810 * @param   idWho       Id of the type specified by iWhich. 0 means the current process/pgrp/user.
     811 * @param   iPrio       The new priority.
     812 */
     813int __libc_Back_processSetPriority(int iWhich, id_t idWho, int iPrio);
     814
    791815
    792816/** @} */
  • trunk/src/emx/include/InnoTekLIBC/sharedpm.h

    • Property cvs2svn:cvs-rev changed from 1.19 to 1.20
    r1909 r1910  
    316316    /** User & Group
    317317     * @{ */
    318     /** 28 - User id. */
     318    /** 28 - User id (also called Real User id). */
    319319    uid_t                       uid;
    320320    /** 32 - Effective user id. */
     
    322322    /** 36 - Saved user id. */
    323323    uid_t                       svuid;
    324     /** 40 - Group id. */
     324    /** 40 - Group id (also called Real Group id). */
    325325    gid_t                       gid;
    326326    /** 44 - Effecive group id. */
     
    392392    /** @} */
    393393
    394     /** 180 - Per Process Sockets Reference Counters. */
     394    /** 180 - Per Process Sockets Reference Counters. (Data is process local.) */
    395395    uint16_t                   *pacTcpipRefs;
    396 
    397     /** 184 - Reserved pool pointer field with default value 0. */
    398     unsigned                    auReserved[56 - 46];
    399 
    400 
    401     /** 224 - Number of possible pointers to shared memory starting at pvInherit.
     396    /** 184 - The Process priority (unix). */
     397    int                         iNice;
     398    /** 188 - Reserved fields with default value 0. */
     399    unsigned                    auReserved[56 - 47];
     400
     401
     402    /** 224 - Number of possible pointers to shared memory starting at pInherit.
    402403     * This means we can extend the structure with pointers for as long as we
    403404     * want and still have older LIBC versions cleanup the mess. */
     
    645646
    646647/**
     648 * Process enumeration callback function.
     649 *
     650 * @returns 0 to continue the enumeration.
     651 * @returns Non-zero to stop the enumeration. The enumeration
     652 *          api will return this same value.
     653 *
     654 * @param   pProcess    The current process.
     655 * @param   pvUser      The user argument.
     656 * @remark  It is *not* allowed to terminate the thread or process, do long jumps
     657 *          or anything else which causes the enumeration function not to release
     658 *          the lock.
     659 *          It is not allowed to do expensive stuff either as it will harm other
     660 *          processes in the system which want to access the shared process facility!
     661 */
     662typedef int __LIBC_FNSPNENUM(__LIBC_PSPMPROCESS pProcess, void *pvUser);
     663/** Pointer to an process enumeration callback function. */
     664typedef __LIBC_FNSPNENUM *__LIBC_PFNSPNENUM;
     665
     666/**
     667 * Enumerates all alive processes in a group.
     668 *
     669 * @returns 0 on success.
     670 * @returns -ESRCH if the process group wasn't found.
     671 * @returns -EINVAL if pgrp is negative.
     672 * @returns Whatever non-zero value the pfnCallback function returns to stop the enumeration.
     673 *
     674 * @param   pgrp            The process group id. 0 is an alias for the process group the caller belongs to.
     675 * @param   pfnCallback     Callback function.
     676 * @param   pvUser          User argument to the callback.
     677 */
     678int __libc_spmEnumProcessesByPGrp(pid_t pgrp, __LIBC_PFNSPNENUM pfnCallback, void *pvUser);
     679
     680/**
     681 * Enumerates all alive processes owned by a user.
     682 *
     683 * @returns 0 on success.
     684 * @returns -ESRCH if the process group wasn't found.
     685 * @returns -EINVAL if uid is negative.
     686 * @returns Whatever non-zero value the pfnCallback function returns to stop the enumeration.
     687 *
     688 * @param   uid             The process user id.
     689 * @param   pfnCallback     Callback function.
     690 * @param   pvUser          User argument to the callback.
     691 */
     692int __libc_spmEnumProcessesByUser(uid_t uid, __LIBC_PFNSPNENUM pfnCallback, void *pvUser);
     693
     694/**
    647695 * Release reference to the given process.
    648696 *
     
    652700 */
    653701int __libc_spmRelease(__LIBC_PSPMPROCESS pProcess);
     702
     703/**
     704 * Checks if the calling process can see the specfied one.
     705 *
     706 * @returns 0 if it can see it.
     707 * @returns -ESRCH (or other approriate error code) if it cannot.
     708 *
     709 * @param   pProcess    The process in question.
     710 */
     711int __libc_spmCanSee(__LIBC_PSPMPROCESS pProcess);
     712
     713/**
     714 * Checks if we are a system-wide super user.
     715 *
     716 * @returns 0 if we are.
     717 * @returns -EPERM if we aren't.
     718 */
     719int __libc_spmIsSuperUser(void);
     720
     721/**
     722 * Checks if the caller can modify the specified process.
     723 *
     724 * @returns 0 if we can modify it.
     725 * @returns -EPERM if we cannot modify it.
     726 * @param   pProcess    The process in question.
     727 */
     728int __libc_spmCanModify(__LIBC_PSPMPROCESS pProcess);
    654729
    655730/**
     
    691766 * Identificators which can be obtained using __libc_spmGetId().
    692767 */
    693 typedef enum __LIBC_SPMId
     768typedef enum __LIBC_SPMID
    694769{
    695770    __LIBC_SPMID_PID = 0,
  • trunk/src/emx/include/sys/resource.h

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r1909 r1910  
    3737/** @file
    3838 * FreeBSD 5.1
     39 * @changed bird: get/setpriority takes id_t not int according to SuS.
    3940 */
    4041
     
    156157
    157158__BEGIN_DECLS
    158 int     getpriority(int, int);
     159int     getpriority(int, /*int*/ id_t);         /* bird: SuS uses id_t */
    159160int     getrlimit(int, struct rlimit *);
    160161int     getrusage(int, struct rusage *);
    161 int     setpriority(int, int, int);
     162int     setpriority(int, /*int*/ id_t, int);    /* bird: SuS uses id_t */
    162163int     setrlimit(int, const struct rlimit *);
    163164__END_DECLS
  • trunk/src/emx/include/unistd.h

    • Property cvs2svn:cvs-rev changed from 1.27 to 1.28
    r1909 r1910  
    448448int      lchown(const char *, uid_t, gid_t);
    449449int      lockf(int, int, off_t);
    450 /** @todo int    nice(int); */
     450int      nice(int);
    451451ssize_t  pread(int, void *, size_t, off_t);
    452452ssize_t  pwrite(int, const void *, size_t, off_t);
Note: See TracChangeset for help on using the changeset viewer.