Ignore:
Timestamp:
Nov 7, 2004, 10:33:03 AM (21 years ago)
Author:
bird
Message:

Debugging signals.

File:
1 edited

Legend:

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

    • Property cvs2svn:cvs-rev changed from 1.8 to 1.9
    r1616 r1617  
    3030#include <sys/cdefs.h>
    3131#include <sys/types.h>
     32#include <signal.h>
    3233#include <emx/io.h>
     34
    3335
    3436__BEGIN_DECLS
     
    446448
    447449
     450/** @defgroup   __libc_Back_signal      LIBC Backend - Signals
     451 * @{
     452 */
     453
     454/** @defgroup __libc_Back_signalRaise_return    __libc_back_signalRaise() returns.
     455 * These are only valid for positive return values.
     456 * @{ */
     457/** Try restart any interrupted system call. */
     458#define __LIBC_BSRR_RESTART     0x01
     459/** Go ahead interrupt system call in progress. */
     460#define __LIBC_BSRR_INTERRUPT   0x02
     461/** If set execution should be resumed. */
     462#define __LIBC_BSRR_CONTINUE    0x10
     463/** If set execution should not be resumed but the signal should be passed
     464 * on to the system. */
     465#define __LIBC_BSRR_PASSITON    0x20
     466/** If set the passed in SIGQUEUED structure was used. */
     467#define __LIBC_BSRR_USED_QUEUED 0x40
     468/** @} */
     469
     470/** @defgroup __libc_back_signalRaise_flags     __libc_back_signalRaise() flags.
     471 * @{ */
     472/** The signal is thread specific and must be delivered to the current thread. */
     473#define __LIBC_BSRF_THREAD      0x01
     474/** The signal was send from an unknown process. */
     475#define __LIBC_BSRF_EXTERNAL    0x02
     476/** The signal was generated by the hardware (i.e. CPUs and such). */
     477#define __LIBC_BSRF_HARDWARE    0x04
     478/** The signal should be queued. */
     479#define __LIBC_BSRF_QUEUED      0x08
     480/** @} */
     481
     482
     483/**
     484 * Raises a signal in the current process.
     485 *
     486 * @returns On success a flag mask out of the __LIBC_BSRR_* #defines is returned.
     487 * @returns On failure a negative error code (errno.h) is returned.
     488 * @param   iSignalNo           Signal to raise.
     489 * @param   pSigInfo            Pointer to signal info for this signal.
     490 *                              NULL is allowed.
     491 * @param   pvXcptOrQueued      Exception handler parameter list.
     492 *                              Or if __LIBC_BSRF_QUEUED is set, a pointer to locally malloced
     493 *                              SIGQUEUED node.
     494 * @param   fFlags              Flags of the #defines __LIBC_BSRF_* describing how to
     495 *                              deliver the signal.
     496 *
     497 * @remark  This Backend Signal API does NOT require the caller to own the signal semaphore.
     498 */
     499int __libc_Back_signalRaise(int iSignalNo, siginfo_t *pSigInfo, void *pvXcptOrQueued, unsigned fFlags);
     500
     501/**
     502 * Worker called after __libc_Back_signalRaise() was called with a
     503 * preallocated signal queue entry. This function will make sure
     504 * we're not ending up with too many heap allocated packets in the
     505 * free list.
     506 */
     507void __libc_Back_signalFreeWorker(void);
     508
     509/**
     510 * Send a signal to a process.
     511 *
     512 * @returns 0 on if signal sent.
     513 * @returns -errno on failure.
     514 *
     515 * @param   pid         Process Id of the process which the signal is to be sent to.
     516 * @param   iSignalNo   The signal to send.
     517 * @remark  This Backend Signal API does NOT require the caller to own the signal semaphore.
     518 */
     519int __libc_Back_signalSendPid(pid_t pid, int iSignalNo);
     520
     521/**
     522 * Verify the existance of another process and that the current process
     523 * is allowed to signal it.
     524 *
     525 * @return 0 on success.
     526 * @return -ESRCH if pid doesn't exist.
     527 * @return -EPERM if we aren't allowed to signal the pid.
     528 * @param   pid     Process Id for the process which we wanna signal.
     529 * @todo    Do EPERM check, no ideas here yet.
     530 * @remark  This Backend Signal API does NOT require the caller to own the signal semaphore.
     531 */
     532int __libc_Back_signalVerifyPid(pid_t pid);
     533
     534/**
     535 * Not implemented.
     536 *
     537 * @returns -ENOSYS.
     538 * @param   pgrp        Process group (positive).
     539 *                      0 means the process group of this process.
     540 *                      1 means all process in the system.
     541 * @param   iSignalNo   Signal to send to all the processes in the group.
     542 */
     543int __libc_Back_signalSendPGrp(pid_t pgrp, int iSignalNo);
     544
     545/**
     546 * Verify the existance of a process group and that the current process
     547 * is allowed to signal it.
     548 *
     549 * @return 0 on success.
     550 * @return -ESRCH if pgid doesn't exist.
     551 * @return -EPERM if we aren't allowed to signal the pgid.
     552 * @param   pgid    Process group id which the current process intend to signal.
     553 * @todo    Do EPERM check, no ideas here yet.
     554 * @remark  This Backend Signal API does NOT require the caller to own the signal semaphore.
     555 */
     556int __libc_Back_signalVerifyPGrp(pid_t pgid);
     557
     558/**
     559 * sigaction worker; queries and/or sets the action for a signal.
     560 *
     561 * @returns 0 on success.
     562 * @returns -Negative errno on failure.
     563 * @param   iSignalNo   Signal number.
     564 * @param   pSigAct     Pointer to new signal action.
     565 *                      If NULL no update is done.
     566 * @param   pSigActOld  Where to store the old signal action.
     567 *                      If NULL nothing is attempted stored.
     568 */
     569int __libc_Back_signalAction(int iSignalNo, const struct sigaction *pSigAct, struct sigaction *pSigActOld);
     570
     571/**
     572 * Changes and/or queries the alternative signal stack settings of a thread.
     573 *
     574 * @returns 0 on success.
     575 * @returns Negative error number (errno.h) on failure.
     576 * @param   pThrd       Thread which signal stack to change and/or query.
     577 * @param   pStack      New stack settings. (Optional)
     578 * @param   pOldStack   Old stack settings. (Optional)
     579 */
     580int __libc_Back_signalStack(__LIBC_PTHREAD pThrd, const stack_t *pStack, stack_t *pOldStack);
     581
     582/**
     583 * Block or unblock signal deliveries of a thread.
     584 *
     585 * @returns 0 on success.
     586 * @returns -1 and errno set to EINVAL on failure.
     587 * @param   pThrd       Thread to apply this to.
     588 * @param   iHow        Describes the action taken if pSigSetNew not NULL. Recognized
     589 *                      values are SIG_BLOCK, SIG_UNBLOCK or SIG_SETMASK.
     590 *
     591 *                      SIG_BLOCK means to or the sigset pointed to by pSigSetNew with
     592 *                          the signal mask for the current thread.
     593 *                      SIG_UNBLOCK means to and the 0 complement of the sigset pointed
     594 *                          to by pSigSetNew with the signal mask of the current thread.
     595 *                      SIG_SETMASK means to set the signal mask of the current thread
     596 *                          to the sigset pointed to by pSigSetNew.
     597 *
     598 * @param   pSigSetNew  Pointer to signal set which will be applied to the current
     599 *                      threads signal mask according to iHow. If NULL no change
     600 *                      will be made the the current threads signal mask.
     601 * @param   pSigSetOld  Where to store the current threads signal mask prior to applying
     602 *                      pSigSetNew to it. This parameter can be NULL.
     603 */
     604int __libc_Back_signalMask(__LIBC_PTHREAD pThrd, int iHow, const sigset_t * __restrict pSigSetNew, sigset_t * __restrict pSigSetOld);
     605
     606/** @} */
     607
    448608__END_DECLS
    449609
Note: See TracChangeset for help on using the changeset viewer.