PennMUSH Community

Changeset 1208

Show
Ignore:
Timestamp:
01/26/08 05:56:11 (7 months ago)
Author:
shawnw
Message:

#7540: Queue pids

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 1.8.3/branches/devel/CHANGES.183

    r1205 r1208  
    1515 
    1616========================================================================== 
    17  
     17  
    1818Version 1.8.3 patchlevel 7                      ??? ??, 2008 
    1919 
     
    2626   are changed and automatically reload them instead of waiting for a  
    2727   @readcache. 
     28 * New map data structure with integer keys, used in various places. 
     29 * Queue entries now have process ids, used to identify and act on that 
     30   particular action list. This and associated commands inspired 
     31   by [Rhost]. 
     32 
     33Commands: 
    2834 * '@hook/override cmd=#1234' will look at all attributes on the object 
    2935   for a matching $command. By Talvo. 
    3036 * @sitelock/delete NNN will remove the sitelock rule with that number. 
     37 * @halt/pid NNN will remove a specific queue entry. Get the pid from  
     38   @ps. [Rhost] 
     39 * @wait/pid will adjust the wait time of queue entries. [Rhost] 
    3140 
    3241Functions: 
  • 1.8.3/branches/devel/MANIFEST

    r1143 r1208  
    9999hdrs/htab.h 
    100100hdrs/ident.h 
     101hdrs/intmap.h 
    101102hdrs/intrface.h 
    102103hdrs/lock.h 
     
    196197src/htmltab.c 
    197198src/htmltab.gperf 
     199src/intmap.c 
    198200src/match.c 
    199201src/memcheck.c 
  • 1.8.3/branches/devel/game/txt/hlp/penncmd.hlp

    r1146 r1208  
    16191619& @halt 
    16201620  @halt <object> [=<new_command>]  
     1621  @halt/pid <pid> 
    16211622  @halt/all 
    16221623  
    1623   The @halt command removes all queued actions for <object>.  
    1624   If <new command> is specified, that new command is placed 
    1625   in the queue for the object instead. If no new command is 
    1626   specified, the object is set HALT. 
    1627  
    1628   If <object> is a player, it clears the queue for the player and 
    1629   and all of his objects. You can use "@halt me" to clear your own 
    1630   queue without setting yourself HALT. Only wizards can @halt  
    1631   other players. 
    1632    
    1633   Note that halting an object does NOT affect any objects waiting 
    1634   on it as a semaphore. 
     1624  The @halt command removes all queued actions for <object>.  If <new 
     1625  command> is specified, that new command is placed in the queue for 
     1626  the object instead. If no new command is specified, the object is 
     1627  set HALT. 
     1628 
     1629  If <object> is a player, it clears the queue for the player and and 
     1630  all of his objects. You can use "@halt me" to clear your own queue 
     1631  without setting yourself HALT. 
     1632 
     1633  Only wizards and objects with the halt @power can @halt other 
     1634  player's objects. Note that halting an object does NOT affect any 
     1635  objects waiting on it as a semaphore. 
     1636 
     1637  @halt/pid will cancel a single queue entry with the given pid (The 
     1638  number in parenthesis before it in @ps). You must control the object 
     1639  that queued the command or have the halt power to do this. 
    16351640 
    16361641  @halt/all is a synonym for @allhalt and is a wizard-only command. 
     
    28612866  @ps/summary just displays the queue totals for the whole queue. 
    28622867  @ps/quick displays the queue totals for just your queue. 
     2868 
     2869  Each line includes the proccess id of the queue entry, the object 
     2870  and attribute being used as a semaphore (If any), the number of 
     2871  seconds left before it executes (For waits and semaphores), the 
     2872  object that is going to execute the entry, and the command. 
     2873 
    28632874& @purge 
    28642875  @purge is a wizard only command that calls the internal purge routine to  
     
    35143525  @wait[/until] <time> = <command_list> 
    35153526  @wait <object> = <command_list> 
    3516   @wait[/until] <object>/<time> = <command_list> 
    3517    
     3527  @wait[/until] <object>/<time> = <command_list>   
     3528 
    35183529  The basic form of this command puts the command list (a semicolon-separated  
    35193530  list of commands) into the wait queue to execute in <time> seconds. If the 
     
    35463557  You cannot do a non-timed semaphore on an attribute with a numeric name, 
    35473558  as that is taken as a timeout instead. 
     3559 
     3560  Continued in HELP @WAIT3 
     3561& @wait3 
     3562  @wait/pid <PID>=<SECONDS> 
     3563  @wait/pid <PID>=[+-]<ADJUSTMENT> 
     3564  @wait/pid/until <PID>=<TIME> 
     3565 
     3566  The /pid switch can be used to alter the timeout of entries in the 
     3567  wait and semaphore queues. You can set a new wait time, increase or 
     3568  decrease the current time, or set a new absolute time in seconds. 
     3569 
     3570  You must control the object doing the wait, or have the halt @power. 
     3571 
    35483572& @wall 
    35493573  @wall[/<switch>] <message> 
  • 1.8.3/branches/devel/hdrs/game.h

    r944 r1208  
    2121 
    2222/* From bsd.c */ 
    23 extern void fcache_init(void); 
    24 extern void fcache_load(dbref player); 
    25 extern void hide_player(dbref player, int hide); 
     23void fcache_init(void); 
     24void fcache_load(dbref player); 
     25void hide_player(dbref player, int hide); 
    2626enum motd_type { MOTD_MOTD, MOTD_WIZ, MOTD_DOWN, MOTD_FULL, MOTD_LIST }; 
    27 extern void do_motd(dbref player, enum motd_type key, const char *message); 
    28 extern void do_poll(dbref player, const char *message, int clear); 
     27void do_motd(dbref player, enum motd_type key, const char *message); 
     28void do_poll(dbref player, const char *message, int clear); 
    2929/* From cque.c */ 
    30 extern void do_wait 
    31   (dbref player, dbref cause, char *arg1, char *cmd, int until); 
     30void do_wait 
     31  (dbref player, dbref cause, char *arg1, const char *cmd, bool until); 
     32void do_waitpid(dbref, const char *, const char *, bool); 
    3233enum queue_type { QUEUE_ALL, QUEUE_NORMAL, QUEUE_SUMMARY, QUEUE_QUICK }; 
    33 extern void do_queue(dbref player, const char *what, enum queue_type flag); 
    34 extern void do_halt1(dbref player, const char *arg1, const char *arg2); 
    35 extern void do_allhalt(dbref player); 
    36 extern void do_allrestart(dbref player); 
    37 extern void do_restart(void); 
    38 extern void do_restart_com(dbref player, const char *arg1); 
     34void do_queue(dbref player, const char *what, enum queue_type flag); 
     35void do_halt1(dbref player, const char *arg1, const char *arg2); 
     36void do_haltpid(dbref, const char *); 
     37void do_allhalt(dbref player); 
     38void do_allrestart(dbref player); 
     39void do_restart(void); 
     40void do_restart_com(dbref player, const char *arg1); 
    3941 
    4042/* From command.c */ 
  • 1.8.3/branches/devel/src/Makefile.in

    r1159 r1208  
    1818    flags.c funcrypt.c function.c fundb.c funlist.c funlocal.c  \ 
    1919    funmath.c funmisc.c funstr.c funtime.c funufun.c game.c help.c  \ 
    20     htab.c ident.c local.c lock.c log.c look.c malias.c markup.c  \ 
    21     match.c memcheck.c move.c mycrypt.c mymalloc.c mysocket.c
    22     myrlimit.c myssl.c notify.c parse.c pcre.c player.c plyrlist.c    \ 
    23     predicat.c privtab.c info_master.c ptab.c rob.c services.c    \ 
    24     set.c shs.c sig.c sort.c speech.c sql.c strdup.c strtree.c    \ 
    25     strutil.c tables.c timer.c unparse.c utils.c version.c wait.c
    26     warnings.c wild.c wiz.c 
     20    htab.c ident.c intmap.c local.c lock.c log.c look.c malias.c  \ 
     21    markup.c match.c memcheck.c move.c mycrypt.c mymalloc.c       \ 
     22    mysocket.c myrlimit.c myssl.c notify.c parse.c pcre.c player.c    \ 
     23    plyrlist.c predicat.c privtab.c info_master.c ptab.c rob.c    \ 
     24    services.c set.c shs.c sig.c sort.c speech.c sql.c strdup.c   \ 
     25    strtree.c strutil.c tables.c timer.c unparse.c utils.c    \ 
     26    version.c wait.c warnings.c wild.c wiz.c 
    2727 
    2828 
     
    3333    flags.o funcrypt.o function.o fundb.o funlist.o funlocal.o  \ 
    3434    funmath.o funmisc.o funstr.o funtime.o funufun.o game.o help.o  \ 
    35     htab.o ident.o local.o lock.o log.o look.o malias.o markup.o  \ 
    36     match.o memcheck.o move.o mycrypt.o mymalloc.o mysocket.o
    37     myrlimit.o myssl.o notify.o parse.o pcre.o player.o plyrlist.o    \ 
    38     info_master.o predicat.o privtab.o ptab.o rob.o services.o    \ 
    39     set.o shs.o sig.o sort.o speech.o sql.o strdup.o strtree.o    \ 
    40     strutil.o tables.o timer.o unparse.o utils.o version.o wait.o
    41     warnings.o wild.o wiz.o 
     35    htab.o ident.o intmap.o local.o lock.o log.o look.o malias.o  \ 
     36    markup.o match.o memcheck.o move.o mycrypt.o mymalloc.o       \ 
     37    mysocket.o myrlimit.o myssl.o notify.o parse.o pcre.o player.o    \ 
     38    plyrlist.o info_master.o predicat.o privtab.o ptab.o rob.o    \ 
     39    services.o set.o shs.o sig.o sort.o speech.o sql.o strdup.o   \ 
     40    strtree.o strutil.o tables.o timer.o unparse.o utils.o    \ 
     41    version.o wait.o warnings.o wild.o wiz.o 
    4242 
    4343# This is a dummy target, in case you type 'make' in the source 
     
    321321bsd.o: ../hdrs/game.h 
    322322bsd.o: ../hdrs/dbio.h 
     323bsd.o: ../hdrs/intmap.h 
    323324bufferq.o: ../hdrs/copyrite.h 
    324325bufferq.o: ../config.h 
     
    429430command.o: ../hdrs/access.h 
    430431command.o: ../hdrs/version.h 
     432command.o: ../hdrs/strtree.h 
    431433command.o: ../hdrs/function.h 
    432434command.o: ../hdrs/command.h 
     
    504506cque.o: ../hdrs/attrib.h 
    505507cque.o: ../hdrs/log.h 
     508cque.o: ../hdrs/intmap.h 
    506509create.o: ../hdrs/copyrite.h 
    507510create.o: ../config.h 
     
    10331036ident.o: ../hdrs/mysocket.h 
    10341037ident.o: ../hdrs/mymalloc.h 
     1038intmap.o: ../config.h 
     1039intmap.o: ../hdrs/conf.h 
     1040intmap.o: ../hdrs/copyrite.h 
     1041intmap.o: ../options.h 
     1042intmap.o: ../hdrs/mushtype.h 
     1043intmap.o: ../hdrs/htab.h 
     1044intmap.o: ../hdrs/externs.h 
     1045intmap.o: ../hdrs/compile.h 
     1046intmap.o: ../hdrs/dbdefs.h 
     1047intmap.o: ../hdrs/mushdb.h 
     1048intmap.o: ../hdrs/flags.h 
     1049intmap.o: ../hdrs/ptab.h 
     1050intmap.o: ../hdrs/chunk.h 
     1051intmap.o: ../confmagic.h 
     1052intmap.o: ../hdrs/mypcre.h 
     1053intmap.o: ../hdrs/mymalloc.h 
     1054intmap.o: ../hdrs/intmap.h 
    10351055local.o: ../hdrs/copyrite.h 
    10361056local.o: ../config.h 
     
    13671387parse.o: ../hdrs/mymalloc.h 
    13681388pcre.o: ../config.h 
     1389pcre.o: ../hdrs/mypcre.h 
    13691390player.o: ../hdrs/copyrite.h 
    13701391player.o: ../config.h 
  • 1.8.3/branches/devel/src/bsd.c

    r1195 r1208  
    130130#include "game.h" 
    131131#include "dbio.h" 
     132#include "intmap.h" 
    132133#include "confmagic.h" 
    133134 
     
    266267 
    267268DESC *descriptor_list = NULL;   /**< The linked list of descriptors */ 
     269intmap *descs_by_fd = NULL; /**< Map of ports to DESC* objects */ 
    268270 
    269271static int sock; 
     
    606608#endif 
    607609 
     610  descs_by_fd = im_new(); 
     611 
    608612  /* go do it */ 
    609613#ifdef CSRI 
     
    14671471  if (d->next) 
    14681472    d->next->prev = d->prev; 
     1473 
     1474  im_delete(descs_by_fd, d->descriptor); 
    14691475 
    14701476#ifdef HAS_OPENSSL 
     
    15431549  } 
    15441550#endif 
     1551  im_insert(descs_by_fd, d->descriptor, d); 
    15451552  test_telnet(d); 
    15461553  welcome_user(d); 
     
    37333740  if (is_strict_integer(name)) { 
    37343741    int fd = parse_integer(name); 
    3735     DESC_ITER_CONN(d) { 
    3736       if (d->descriptor == fd) { 
    3737         if (Priv_Who(executor) || d->player == executor) 
    3738           return d; 
    3739         else 
    3740           return NULL; 
    3741       } 
    3742     } 
    3743     return NULL; 
     3742 
     3743    d = im_find(descs_by_fd, fd); 
     3744    if (d && (Priv_Who(executor) || d->player == executor)) 
     3745      return d; 
     3746    else 
     3747      return NULL; 
    37443748  } else {                      /* Look up player name */ 
    37453749    DESC *match = NULL; 
     
    46094613      d->prev = NULL; 
    46104614      descriptor_list = d; 
     4615      im_insert(descs_by_fd, d->descriptor, d); 
    46114616      if (d->connected && d->player && GoodObject(d->player) && 
    46124617          IsPlayer(d->player)) 
  • 1.8.3/branches/devel/src/cmds.c

    r1148 r1208  
    427427  if (SW_ISSET(sw, SWITCH_ALL)) 
    428428    do_allhalt(player); 
     429  else if (SW_BY_NAME(sw, "PID")) 
     430    do_haltpid(player, arg_left); 
    429431  else 
    430432    do_halt1(player, arg_left, arg_right); 
     
    10751077COMMAND(cmd_wait) 
    10761078{ 
    1077   do_wait(player, cause, arg_left, arg_right, SW_ISSET(sw, SWITCH_UNTIL)); 
     1079  if (SW_BY_NAME(sw, "PID"))  
     1080    do_waitpid(player, arg_left, arg_right, SW_ISSET(sw, SWITCH_UNTIL)); 
     1081  else 
     1082    do_wait(player, cause, arg_left, arg_right, SW_ISSET(sw, SWITCH_UNTIL)); 
    10781083} 
    10791084 
  • 1.8.3/branches/devel/src/command.c

    r1202 r1208  
    168168  {"@GREP", "LIST PRINT ILIST IPRINT", cmd_grep, 
    169169   CMD_T_ANY | CMD_T_EQSPLIT | CMD_T_RS_NOPARSE | CMD_T_NOGAGGED, 0, 0}, 
    170   {"@HALT", "ALL", cmd_halt, CMD_T_ANY | CMD_T_EQSPLIT, 0, 0}, 
     170  {"@HALT", "ALL PID", cmd_halt, CMD_T_ANY | CMD_T_EQSPLIT, 0, 0}, 
    171171  {"@HIDE", "NO OFF YES ON", cmd_hide, CMD_T_ANY, 0, 0}, 
    172172  {"@HOOK", "LIST AFTER BEFORE IGNORE OVERRIDE", cmd_hook, 
     
    300300  {"@VERB", NULL, cmd_verb, CMD_T_ANY | CMD_T_EQSPLIT | CMD_T_RS_ARGS, 0, 0}, 
    301301  {"@VERSION", NULL, cmd_version, CMD_T_ANY, 0, 0}, 
    302   {"@WAIT", "UNTIL", cmd_wait, CMD_T_ANY | CMD_T_EQSPLIT | CMD_T_RS_NOPARSE, 
     302  {"@WAIT", "PID UNTIL", cmd_wait, CMD_T_ANY | CMD_T_EQSPLIT | CMD_T_RS_NOPARSE, 
    303303   0, 0}, 
    304304  {"@WALL", "NOEVAL EMIT", cmd_wall, CMD_T_ANY, "WIZARD ROYALTY", "ANNOUNCE"}, 
  • 1.8.3/branches/devel/src/cque.c

    r1150 r1208  
    2323#include <time.h> 
    2424#endif 
     25#ifdef HAVE_STDINT_H 
     26#include <stdint.h> 
     27#endif 
    2528 
    2629#include "conf.h" 
     
    3740#include "dbdefs.h" 
    3841#include "log.h" 
     42#include "intmap.h" 
    3943#include "confmagic.h" 
    4044 
     
    5761  char *rval[NUMQ];             /**< environment, from setq() */ 
    5862  char *comm;                   /**< command to be executed */ 
     63  uint32_t pid;                 /**< Process id of this entry */ 
     64  uint32_t flags;               /**< Flags */ 
    5965} BQUE; 
    6066 
     67#define QUEUE_HALTED 0x1U 
     68 
    6169slab *bque_slab = NULL; /**< slab for 'struct bque' allocations */ 
     70 
     71static intmap *queue_map = NULL; /**< Intmap for looking up queue entries by pid */ 
     72static uint32_t top_pid = 0; 
    6273 
    6374static BQUE *qfirst = NULL, *qlast = NULL, *qwait = NULL; 
     
    98109  bque_slab = slab_create("command queues", sizeof(BQUE)); 
    99110  slab_set_opt(bque_slab, SLAB_ALLOC_BEST_FIT, 1); 
     111  queue_map = im_new(); 
    100112} 
    101113 
     
    186198  for (a = 0; a < 10; a++) 
    187199    if (point->env[a]) { 
    188       mush_free((Malloc_t) point->env[a], "bqueue_env"); 
     200      mush_free(point->env[a], "bqueue_env"); 
    189201    } 
    190202  for (a = 0; a < NUMQ; a++) 
    191203    if (point->rval[a]) { 
    192       mush_free((Malloc_t) point->rval[a], "bqueue_rval"); 
     204      mush_free(point->rval[a], "bqueue_rval"); 
    193205    } 
    194206  if (point->semattr) 
    195     mush_free((Malloc_t) point->semattr, "bqueue_semattr"); 
     207    mush_free(point->semattr, "bqueue_semattr"); 
    196208  if (point->comm) 
    197     mush_free((Malloc_t) point->comm, "bqueue_comm"); 
     209    mush_free(point->comm, "bqueue_comm"); 
     210  im_delete(queue_map, point->pid); 
    198211  slab_free(bque_slab, point); 
    199212} 
     
    246259} 
    247260 
     261static uint32_t 
     262next_pid(void) 
     263{ 
     264  uint32_t pid = top_pid; 
     265 
     266  while (1) { 
     267    if (pid > (1U << 16)) 
     268      pid = 0; 
     269    if (im_exists(queue_map, pid)) 
     270      pid++; 
     271    else { 
     272      top_pid = pid + 1; 
     273      return pid; 
     274    } 
     275  } 
     276} 
     277 
    248278/** Add a new entry onto the player or object command queues. 
    249279 * This function adds a new entry to the back of the player or 
     
    264294    return; 
    265295  tmp = slab_malloc(bque_slab, NULL); 
     296  tmp->pid = next_pid(); 
    266297  tmp->comm = mush_strdup(command, "bqueue_comm"); 
    267298  tmp->semattr = NULL; 
     
    296327      qllast = qlfirst = tmp; 
    297328  } 
     329  im_insert(queue_map, tmp->pid, tmp); 
    298330} 
    299331 
     
    382414  tmp = slab_malloc(bque_slab, NULL); 
    383415  tmp->comm = mush_strdup(command, "bqueue_comm"); 
     416  tmp->pid = next_pid(); 
    384417  tmp->player = player; 
    385418  tmp->queued = QUEUE_PER_OWNER ? Owner(player) : player; 
     
    436469    } 
    437470  } 
     471  im_insert(queue_map, tmp->pid, tmp); 
    438472} 
    439473 
     
    544578    if (!(qfirst = entry->next)) 
    545579      qlast = NULL; 
    546     if (GoodObject(entry->player) && !IsGarbage(entry->player)) { 
     580    if (GoodObject(entry->player) && !IsGarbage(entry->player) 
     581    && !(entry->flags & QUEUE_HALTED)) { 
    547582      global_eval_context.cplr = entry->player; 
    548583      giveto(global_eval_context.cplr, QUEUE_COST); 
     
    828863 * \param player the enactor 
    829864 * \param cause the object causing the command to be added. 
    830  * \param arg1 the wait time, semaphore object/attribute, or both. 
     865 * \param arg1 the wait time, semaphore object/attribute, or both. Modified! 
    831866 * \param cmd command to queue. 
    832867 * \param until if 1, wait until an absolute time. 
    833868 */ 
    834869void 
    835 do_wait(dbref player, dbref cause, char *arg1, char *cmd, int until) 
     870do_wait(dbref player, dbref cause, char *arg1, const char *cmd, bool until) 
    836871{ 
    837872  dbref thing; 
     
    912947} 
    913948 
     949/** Interface to @wait/pid; modifies the wait times of queue 
     950 * entries. 
     951 * \param player the object doing the command. 
     952 * \param pidstr the process id to modify. 
     953 * \param timestr the new timeout. 
     954 * \param until true if timeout is an absolute time. 
     955 */ 
     956void 
     957do_waitpid(dbref player, const char *pidstr, const char *timestr, bool until) 
     958{ 
     959  uint32_t pid; 
     960  BQUE *q, *tmp, *last; 
     961  bool found; 
     962 
     963  if (!is_uinteger(pidstr)) { 
     964    notify(player, T("That is not a valid pid!")); 
     965    return; 
     966  } 
     967 
     968  pid = parse_uint32(pidstr, NULL, 10); 
     969  q = im_find(queue_map, pid); 
     970   
     971  if (!q) { 
     972    notify(player, T("That is not a valid pid!")); 
     973    return; 
     974  } 
     975 
     976  if (!controls(player, q->player) && !HaltAny(player)) { 
     977    notify(player, T("Permission denied.")); 
     978    return; 
     979  } 
     980 
     981  if (q->sem != NOTHING && q->left == 0) { 
     982    notify(player, 
     983       T("You cannot adjust the timeout of an indefinite semaphore.")); 
     984    return; 
     985  } 
     986 
     987  if (!is_strict_integer(timestr)) { 
     988    notify(player, T("That is not a valid timestamp.")); 
     989    return; 
     990  } 
     991 
     992  if (until) { 
     993    int when;     
     994 
     995    when = parse_integer(timestr); 
     996 
     997    if (when < 0) 
     998      when = 0; 
     999 
     1000    q->left = (time_t) when; 
     1001 
     1002  } else { 
     1003    int offset = parse_integer(timestr); 
     1004 
     1005    /* If timestr looks like +NNN or -NNN, add or subtract a number 
     1006       of seconds to the current timeout. Otherwise, change timeout.  
     1007    */ 
     1008    if (timestr[0] == '+' || timestr[0] == '-') 
     1009      q->left += offset; 
     1010    else 
     1011      q->left = mudtime + offset; 
     1012 
     1013    if (q->left < 0) 
     1014      q->left = 0; 
     1015  } 
     1016 
     1017  /* Now adjust it in the wait queue. Not a clever approach, but I 
     1018     wrote it at 3 am and clever was not an option. */ 
     1019  for (tmp = qwait, last = NULL; tmp; last = tmp, tmp = tmp->next) { 
     1020    if (tmp == q) { 
     1021      if (last) 
     1022    last->next = q->next; 
     1023      else 
     1024    qwait = qwait->next; 
     1025 
     1026      break; 
     1027    } 
     1028  } 
     1029  found = false; 
     1030  for (tmp = qwait, last = NULL; tmp; last = tmp, tmp = tmp->next) { 
     1031    if (tmp->left > q->left) { 
     1032      if (last) { 
     1033    last->next = q; 
     1034    q->next = tmp; 
     1035      } else { 
     1036    q->next = qwait; 
     1037    qwait = q; 
     1038      } 
     1039      found = true; 
     1040      break; 
     1041    } 
     1042  } 
     1043  if (!found) { 
     1044    if (last)  
     1045      last->next = q; 
     1046    else 
     1047      qwait = q; 
     1048    q->next = NULL; 
     1049  } 
     1050 
     1051  notify_format(player, T("Queue entry with pid %u updated."), pid); 
     1052} 
     1053 
    9141054static void 
    9151055show_queue(dbref player, dbref victim, int q_type, int q_quiet, int q_all, 
     
    9191059  for (tmp = q_ptr; tmp; tmp = tmp->next) { 
    9201060    (*tot)++; 
     1061    if (tmp->flags & QUEUE_HALTED) 
     1062      continue; 
    9211063    if (!GoodObject(tmp->player)) 
    9221064      (*del)++; 
     
    9291071        switch (q_type) { 
    9301072        case 1:                /* wait queue */ 
    931           notify_format(player, "[%ld]%s: %s"
     1073          notify_format(player, "(Pid: %u) [%ld]%s: %s", tmp->pid
    9321074                        (long) difftime(tmp->left, mudtime), 
    9331075                        unparse_object(player, tmp->player), tmp->comm); 
     
    9351077        case 2:                /* semaphore queue */ 
    9361078          if (tmp->left != 0) { 
    937             notify_format(player, "[#%d/%s/%ld]%s: %s", tmp->sem, 
     1079            notify_format(player, "(Pid: %u) [#%d/%s/%ld]%s: %s", tmp->pid, tmp->sem, 
    9381080                          tmp->semattr, (long) difftime(tmp->left, mudtime), 
    9391081                          unparse_object(player, tmp->player), tmp->comm); 
    9401082          } else { 
    941             notify_format(player, "[#%d/%s]%s: %s", tmp->sem, 
     1083            notify_format(player, "(Pid: %u) [#%d/%s]%s: %s", tmp->pid, tmp->sem, 
    9421084                          tmp->semattr, unparse_object(player, tmp->player), 
    9431085                          tmp->comm); 
     
    9451087          break; 
    9461088        default:               /* player or object queue */ 
    947           notify_format(player, "%s: %s", unparse_object(player, 
     1089          notify_format(player, "(Pid: %u) %s: %s", tmp->pid, unparse_object(player, 
    9481090                                                         tmp->player), 
    9491091                        tmp->comm); 
     
    11601302} 
    11611303 
     1304/** Halt a particular pid 
     1305 * \param player the enactor. 
     1306 * \param arg1 string representing the pid to halt. 
     1307 */ 
     1308void  
     1309do_haltpid(dbref player, const char *arg1) 
     1310{ 
     1311  uint32_t pid; 
     1312  BQUE *q; 
     1313  dbref victim; 
     1314 
     1315  if (!is_uinteger(arg1)) { 
     1316    notify(player, T("That is not a valid pid!")); 
     1317    return; 
     1318  } 
     1319 
     1320  pid = parse_uint32(arg1, NULL, 10); 
     1321 
     1322  q = im_find(queue_map, pid); 
     1323 
     1324  if (!q) { 
     1325    notify(player, T("That is not a valid pid!")); 
     1326     return; 
     1327  } 
     1328 
     1329  victim = q->player; 
     1330  if (!controls(player, victim) && !HaltAny(player)) { 
     1331    notify(player, T("Permission denied.")); 
     1332    return; 
     1333  } 
     1334   
     1335  /* Instead of trying to track what queue this entry currently 
     1336     belongs too, flag it as halted and just not execute it when its 
     1337     turn comes up (Or show it in @ps, etc.).  Exception is for 
     1338     semaphores, which otherwise might wait forever. */ 
     1339  q->flags |= QUEUE_HALTED; 
     1340 
     1341  if (q->semattr) { 
     1342    BQUE *last = NULL, *tmp; 
     1343     
     1344    for (tmp = qsemfirst; tmp; last = tmp, tmp = tmp->next) { 
     1345      if (tmp == q) { 
     1346    if (last) 
     1347      last->next = tmp->next; 
     1348    else 
     1349      qsemfirst = tmp->next; 
     1350     
     1351    if (qsemlast == tmp) 
     1352      qsemlast = last; 
     1353     
     1354    break; 
     1355      } 
     1356    } 
     1357 
     1358    giveto(victim, QUEUE_COST); 
     1359    add_to_sem(q->sem, -1, q->semattr); 
     1360    free_qentry(q); 
     1361  } 
     1362 
     1363  notify_format(player, T("Queue entry with pid %u halted."), pid); 
     1364} 
     1365 
     1366 
     1367 
    11621368/** Halt all objects in the database. 
    11631369 * \param player the enactor. 
  • 1.8.3/branches/devel/src/mymalloc.c

    r1051 r1208  
    553553  *bvm_strnode_slab, *flag_slab, *player_dbref_slab, 
    554554  *command_slab, *channel_slab, *chanuser_slab, *chanlist_slab, *mail_slab, 
    555   *bque_slab, *text_block_slab, *function_slab, *memcheck_slab
     555  *bque_slab, *text_block_slab, *function_slab, *memcheck_slab, *intmap_slab
    556556 
    557557#if COMPRESSION_TYPE == 1 || COMPRESSION_TYPE == 2 
     
    590590  slab_describe(player, text_block_slab); 
    591591  slab_describe(player, player_dbref_slab); 
     592  slab_describe(player, intmap_slab); 
    592593 
    593594  if (options.mem_check) {