Print this page
OS-3820 lxbrand ptrace(2): the next generation
OS-3685 lxbrand PTRACE_O_TRACEFORK race condition
OS-3834 lxbrand 64-bit strace(1) reports 64-bit process as using x32 ABI
OS-3794 lxbrand panic on init signal death
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Bryan Cantrill <bryan@joyent.com>


 397 #define TP_WATCHSTOP    0x4000  /* thread is stopping via holdwatch() */
 398 
 399 /*
 400  * Thread scheduler flag (t_schedflag) definitions.
 401  *      The thread must be locked via thread_lock() or equiv. to change these.
 402  */
 403 #define TS_LOAD         0x0001  /* thread is in memory */
 404 #define TS_DONT_SWAP    0x0002  /* thread/lwp should not be swapped */
 405 #define TS_SWAPENQ      0x0004  /* swap thread when it reaches a safe point */
 406 #define TS_ON_SWAPQ     0x0008  /* thread is on the swap queue */
 407 #define TS_SIGNALLED    0x0010  /* thread was awakened by cv_signal() */
 408 #define TS_PROJWAITQ    0x0020  /* thread is on its project's waitq */
 409 #define TS_ZONEWAITQ    0x0040  /* thread is on its zone's waitq */
 410 #define TS_CSTART       0x0100  /* setrun() by continuelwps() */
 411 #define TS_UNPAUSE      0x0200  /* setrun() by unpauselwps() */
 412 #define TS_XSTART       0x0400  /* setrun() by SIGCONT */
 413 #define TS_PSTART       0x0800  /* setrun() by /proc */
 414 #define TS_RESUME       0x1000  /* setrun() by CPR resume process */
 415 #define TS_CREATE       0x2000  /* setrun() by syslwp_create() */
 416 #define TS_RUNQMATCH    0x4000  /* exact run queue balancing by setbackdq() */

 417 #define TS_ALLSTART     \
 418         (TS_CSTART|TS_UNPAUSE|TS_XSTART|TS_PSTART|TS_RESUME|TS_CREATE)
 419 #define TS_ANYWAITQ     (TS_PROJWAITQ|TS_ZONEWAITQ)
 420 
 421 /*
 422  * Thread binding types
 423  */
 424 #define TB_ALLHARD      0
 425 #define TB_CPU_SOFT     0x01            /* soft binding to CPU */
 426 #define TB_PSET_SOFT    0x02            /* soft binding to pset */
 427 
 428 #define TB_CPU_SOFT_SET(t)              ((t)->t_bindflag |= TB_CPU_SOFT)
 429 #define TB_CPU_HARD_SET(t)              ((t)->t_bindflag &= ~TB_CPU_SOFT)
 430 #define TB_PSET_SOFT_SET(t)             ((t)->t_bindflag |= TB_PSET_SOFT)
 431 #define TB_PSET_HARD_SET(t)             ((t)->t_bindflag &= ~TB_PSET_SOFT)
 432 #define TB_CPU_IS_SOFT(t)               ((t)->t_bindflag & TB_CPU_SOFT)
 433 #define TB_CPU_IS_HARD(t)               (!TB_CPU_IS_SOFT(t))
 434 #define TB_PSET_IS_SOFT(t)              ((t)->t_bindflag & TB_PSET_SOFT)
 435 
 436 /*
 437  * No locking needed for AST field.
 438  */
 439 #define aston(t)                ((t)->t_astflag = 1)
 440 #define astoff(t)               ((t)->t_astflag = 0)
 441 
 442 /* True if thread is stopped on an event of interest */
 443 #define ISTOPPED(t) ((t)->t_state == TS_STOPPED && \
 444                         !((t)->t_schedflag & TS_PSTART))
 445 




 446 /* True if thread is asleep and wakeable */
 447 #define ISWAKEABLE(t) (((t)->t_state == TS_SLEEP && \
 448                         ((t)->t_flag & T_WAKEABLE)))
 449 
 450 /* True if thread is on the wait queue */
 451 #define ISWAITING(t) ((t)->t_state == TS_WAIT)
 452 
 453 /* similar to ISTOPPED except the event of interest is CPR */
 454 #define CPR_ISTOPPED(t) ((t)->t_state == TS_STOPPED && \
 455                         !((t)->t_schedflag & TS_RESUME))
 456 
 457 /*
 458  * True if thread is virtually stopped (is or was asleep in
 459  * one of the lwp_*() system calls and marked to stop by /proc.)
 460  */
 461 #define VSTOPPED(t)     ((t)->t_proc_flag & TP_PRVSTOP)
 462 
 463 /* similar to VSTOPPED except the point of interest is CPR */
 464 #define CPR_VSTOPPED(t)                         \
 465         ((t)->t_state == TS_SLEEP &&         \




 397 #define TP_WATCHSTOP    0x4000  /* thread is stopping via holdwatch() */
 398 
 399 /*
 400  * Thread scheduler flag (t_schedflag) definitions.
 401  *      The thread must be locked via thread_lock() or equiv. to change these.
 402  */
 403 #define TS_LOAD         0x0001  /* thread is in memory */
 404 #define TS_DONT_SWAP    0x0002  /* thread/lwp should not be swapped */
 405 #define TS_SWAPENQ      0x0004  /* swap thread when it reaches a safe point */
 406 #define TS_ON_SWAPQ     0x0008  /* thread is on the swap queue */
 407 #define TS_SIGNALLED    0x0010  /* thread was awakened by cv_signal() */
 408 #define TS_PROJWAITQ    0x0020  /* thread is on its project's waitq */
 409 #define TS_ZONEWAITQ    0x0040  /* thread is on its zone's waitq */
 410 #define TS_CSTART       0x0100  /* setrun() by continuelwps() */
 411 #define TS_UNPAUSE      0x0200  /* setrun() by unpauselwps() */
 412 #define TS_XSTART       0x0400  /* setrun() by SIGCONT */
 413 #define TS_PSTART       0x0800  /* setrun() by /proc */
 414 #define TS_RESUME       0x1000  /* setrun() by CPR resume process */
 415 #define TS_CREATE       0x2000  /* setrun() by syslwp_create() */
 416 #define TS_RUNQMATCH    0x4000  /* exact run queue balancing by setbackdq() */
 417 #define TS_BSTART       0x8000  /* setrun() by brand */
 418 #define TS_ALLSTART     \
 419         (TS_CSTART|TS_UNPAUSE|TS_XSTART|TS_PSTART|TS_RESUME|TS_CREATE|TS_BSTART)
 420 #define TS_ANYWAITQ     (TS_PROJWAITQ|TS_ZONEWAITQ)
 421 
 422 /*
 423  * Thread binding types
 424  */
 425 #define TB_ALLHARD      0
 426 #define TB_CPU_SOFT     0x01            /* soft binding to CPU */
 427 #define TB_PSET_SOFT    0x02            /* soft binding to pset */
 428 
 429 #define TB_CPU_SOFT_SET(t)              ((t)->t_bindflag |= TB_CPU_SOFT)
 430 #define TB_CPU_HARD_SET(t)              ((t)->t_bindflag &= ~TB_CPU_SOFT)
 431 #define TB_PSET_SOFT_SET(t)             ((t)->t_bindflag |= TB_PSET_SOFT)
 432 #define TB_PSET_HARD_SET(t)             ((t)->t_bindflag &= ~TB_PSET_SOFT)
 433 #define TB_CPU_IS_SOFT(t)               ((t)->t_bindflag & TB_CPU_SOFT)
 434 #define TB_CPU_IS_HARD(t)               (!TB_CPU_IS_SOFT(t))
 435 #define TB_PSET_IS_SOFT(t)              ((t)->t_bindflag & TB_PSET_SOFT)
 436 
 437 /*
 438  * No locking needed for AST field.
 439  */
 440 #define aston(t)                ((t)->t_astflag = 1)
 441 #define astoff(t)               ((t)->t_astflag = 0)
 442 
 443 /* True if thread is stopped on an event of interest */
 444 #define ISTOPPED(t) ((t)->t_state == TS_STOPPED && \
 445                         !((t)->t_schedflag & TS_PSTART))
 446 
 447 /* True if thread is stopped for a brand-specific reason */
 448 #define BSTOPPED(t)     ((t)->t_state == TS_STOPPED && \
 449                             !((t)->t_schedflag & TS_BSTART))
 450 
 451 /* True if thread is asleep and wakeable */
 452 #define ISWAKEABLE(t) (((t)->t_state == TS_SLEEP && \
 453                         ((t)->t_flag & T_WAKEABLE)))
 454 
 455 /* True if thread is on the wait queue */
 456 #define ISWAITING(t) ((t)->t_state == TS_WAIT)
 457 
 458 /* similar to ISTOPPED except the event of interest is CPR */
 459 #define CPR_ISTOPPED(t) ((t)->t_state == TS_STOPPED && \
 460                         !((t)->t_schedflag & TS_RESUME))
 461 
 462 /*
 463  * True if thread is virtually stopped (is or was asleep in
 464  * one of the lwp_*() system calls and marked to stop by /proc.)
 465  */
 466 #define VSTOPPED(t)     ((t)->t_proc_flag & TP_PRVSTOP)
 467 
 468 /* similar to VSTOPPED except the point of interest is CPR */
 469 #define CPR_VSTOPPED(t)                         \
 470         ((t)->t_state == TS_SLEEP &&         \