Changeset 1208
- Timestamp:
- 01/26/08 05:56:11 (7 months ago)
- Files:
-
- 1.8.3/branches/devel/CHANGES.183 (modified) (2 diffs)
- 1.8.3/branches/devel/MANIFEST (modified) (2 diffs)
- 1.8.3/branches/devel/game/txt/hlp/penncmd.hlp (modified) (4 diffs)
- 1.8.3/branches/devel/hdrs/game.h (modified) (1 diff)
- 1.8.3/branches/devel/hdrs/intmap.h (added)
- 1.8.3/branches/devel/src/Makefile.in (modified) (7 diffs)
- 1.8.3/branches/devel/src/bsd.c (modified) (7 diffs)
- 1.8.3/branches/devel/src/cmds.c (modified) (2 diffs)
- 1.8.3/branches/devel/src/command.c (modified) (2 diffs)
- 1.8.3/branches/devel/src/cque.c (modified) (18 diffs)
- 1.8.3/branches/devel/src/intmap.c (added)
- 1.8.3/branches/devel/src/mymalloc.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
1.8.3/branches/devel/CHANGES.183
r1205 r1208 15 15 16 16 ========================================================================== 17 17 18 18 Version 1.8.3 patchlevel 7 ??? ??, 2008 19 19 … … 26 26 are changed and automatically reload them instead of waiting for a 27 27 @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 33 Commands: 28 34 * '@hook/override cmd=#1234' will look at all attributes on the object 29 35 for a matching $command. By Talvo. 30 36 * @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] 31 40 32 41 Functions: 1.8.3/branches/devel/MANIFEST
r1143 r1208 99 99 hdrs/htab.h 100 100 hdrs/ident.h 101 hdrs/intmap.h 101 102 hdrs/intrface.h 102 103 hdrs/lock.h … … 196 197 src/htmltab.c 197 198 src/htmltab.gperf 199 src/intmap.c 198 200 src/match.c 199 201 src/memcheck.c 1.8.3/branches/devel/game/txt/hlp/penncmd.hlp
r1146 r1208 1619 1619 & @halt 1620 1620 @halt <object> [=<new_command>] 1621 @halt/pid <pid> 1621 1622 @halt/all 1622 1623 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. 1635 1640 1636 1641 @halt/all is a synonym for @allhalt and is a wizard-only command. … … 2861 2866 @ps/summary just displays the queue totals for the whole queue. 2862 2867 @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 2863 2874 & @purge 2864 2875 @purge is a wizard only command that calls the internal purge routine to … … 3514 3525 @wait[/until] <time> = <command_list> 3515 3526 @wait <object> = <command_list> 3516 @wait[/until] <object>/<time> = <command_list> 3517 3527 @wait[/until] <object>/<time> = <command_list> 3528 3518 3529 The basic form of this command puts the command list (a semicolon-separated 3519 3530 list of commands) into the wait queue to execute in <time> seconds. If the … … 3546 3557 You cannot do a non-timed semaphore on an attribute with a numeric name, 3547 3558 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 3548 3572 & @wall 3549 3573 @wall[/<switch>] <message> 1.8.3/branches/devel/hdrs/game.h
r944 r1208 21 21 22 22 /* From bsd.c */ 23 externvoid fcache_init(void);24 externvoid fcache_load(dbref player);25 externvoid hide_player(dbref player, int hide);23 void fcache_init(void); 24 void fcache_load(dbref player); 25 void hide_player(dbref player, int hide); 26 26 enum motd_type { MOTD_MOTD, MOTD_WIZ, MOTD_DOWN, MOTD_FULL, MOTD_LIST }; 27 externvoid do_motd(dbref player, enum motd_type key, const char *message);28 externvoid do_poll(dbref player, const char *message, int clear);27 void do_motd(dbref player, enum motd_type key, const char *message); 28 void do_poll(dbref player, const char *message, int clear); 29 29 /* From cque.c */ 30 extern void do_wait 31 (dbref player, dbref cause, char *arg1, char *cmd, int until); 30 void do_wait 31 (dbref player, dbref cause, char *arg1, const char *cmd, bool until); 32 void do_waitpid(dbref, const char *, const char *, bool); 32 33 enum 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); 34 void do_queue(dbref player, const char *what, enum queue_type flag); 35 void do_halt1(dbref player, const char *arg1, const char *arg2); 36 void do_haltpid(dbref, const char *); 37 void do_allhalt(dbref player); 38 void do_allrestart(dbref player); 39 void do_restart(void); 40 void do_restart_com(dbref player, const char *arg1); 39 41 40 42 /* From command.c */ 1.8.3/branches/devel/src/Makefile.in
r1159 r1208 18 18 flags.c funcrypt.c function.c fundb.c funlist.c funlocal.c \ 19 19 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 ma tch.c memcheck.c move.c mycrypt.c mymalloc.c mysocket.c\22 my rlimit.c myssl.c notify.c parse.c pcre.c player.c plyrlist.c \23 p redicat.c privtab.c info_master.c ptab.c rob.c services.c \24 se t.c shs.c sig.c sort.c speech.c sql.c strdup.c strtree.c \25 str util.c tables.c timer.c unparse.c utils.c version.c wait.c\26 warnings.c wild.c wiz.c20 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 27 27 28 28 … … 33 33 flags.o funcrypt.o function.o fundb.o funlist.o funlocal.o \ 34 34 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 ma tch.o memcheck.o move.o mycrypt.o mymalloc.o mysocket.o\37 my rlimit.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 se t.o shs.o sig.o sort.o speech.o sql.o strdup.o strtree.o \40 str util.o tables.o timer.o unparse.o utils.o version.o wait.o\41 warnings.o wild.o wiz.o35 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 42 42 43 43 # This is a dummy target, in case you type 'make' in the source … … 321 321 bsd.o: ../hdrs/game.h 322 322 bsd.o: ../hdrs/dbio.h 323 bsd.o: ../hdrs/intmap.h 323 324 bufferq.o: ../hdrs/copyrite.h 324 325 bufferq.o: ../config.h … … 429 430 command.o: ../hdrs/access.h 430 431 command.o: ../hdrs/version.h 432 command.o: ../hdrs/strtree.h 431 433 command.o: ../hdrs/function.h 432 434 command.o: ../hdrs/command.h … … 504 506 cque.o: ../hdrs/attrib.h 505 507 cque.o: ../hdrs/log.h 508 cque.o: ../hdrs/intmap.h 506 509 create.o: ../hdrs/copyrite.h 507 510 create.o: ../config.h … … 1033 1036 ident.o: ../hdrs/mysocket.h 1034 1037 ident.o: ../hdrs/mymalloc.h 1038 intmap.o: ../config.h 1039 intmap.o: ../hdrs/conf.h 1040 intmap.o: ../hdrs/copyrite.h 1041 intmap.o: ../options.h 1042 intmap.o: ../hdrs/mushtype.h 1043 intmap.o: ../hdrs/htab.h 1044 intmap.o: ../hdrs/externs.h 1045 intmap.o: ../hdrs/compile.h 1046 intmap.o: ../hdrs/dbdefs.h 1047 intmap.o: ../hdrs/mushdb.h 1048 intmap.o: ../hdrs/flags.h 1049 intmap.o: ../hdrs/ptab.h 1050 intmap.o: ../hdrs/chunk.h 1051 intmap.o: ../confmagic.h 1052 intmap.o: ../hdrs/mypcre.h 1053 intmap.o: ../hdrs/mymalloc.h 1054 intmap.o: ../hdrs/intmap.h 1035 1055 local.o: ../hdrs/copyrite.h 1036 1056 local.o: ../config.h … … 1367 1387 parse.o: ../hdrs/mymalloc.h 1368 1388 pcre.o: ../config.h 1389 pcre.o: ../hdrs/mypcre.h 1369 1390 player.o: ../hdrs/copyrite.h 1370 1391 player.o: ../config.h 1.8.3/branches/devel/src/bsd.c
r1195 r1208 130 130 #include "game.h" 131 131 #include "dbio.h" 132 #include "intmap.h" 132 133 #include "confmagic.h" 133 134 … … 266 267 267 268 DESC *descriptor_list = NULL; /**< The linked list of descriptors */ 269 intmap *descs_by_fd = NULL; /**< Map of ports to DESC* objects */ 268 270 269 271 static int sock; … … 606 608 #endif 607 609 610 descs_by_fd = im_new(); 611 608 612 /* go do it */ 609 613 #ifdef CSRI … … 1467 1471 if (d->next) 1468 1472 d->next->prev = d->prev; 1473 1474 im_delete(descs_by_fd, d->descriptor); 1469 1475 1470 1476 #ifdef HAS_OPENSSL … … 1543 1549 } 1544 1550 #endif 1551 im_insert(descs_by_fd, d->descriptor, d); 1545 1552 test_telnet(d); 1546 1553 welcome_user(d); … … 3733 3740 if (is_strict_integer(name)) { 3734 3741 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; 3744 3748 } else { /* Look up player name */ 3745 3749 DESC *match = NULL; … … 4609 4613 d->prev = NULL; 4610 4614 descriptor_list = d; 4615 im_insert(descs_by_fd, d->descriptor, d); 4611 4616 if (d->connected && d->player && GoodObject(d->player) && 4612 4617 IsPlayer(d->player)) 1.8.3/branches/devel/src/cmds.c
r1148 r1208 427 427 if (SW_ISSET(sw, SWITCH_ALL)) 428 428 do_allhalt(player); 429 else if (SW_BY_NAME(sw, "PID")) 430 do_haltpid(player, arg_left); 429 431 else 430 432 do_halt1(player, arg_left, arg_right); … … 1075 1077 COMMAND(cmd_wait) 1076 1078 { 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)); 1078 1083 } 1079 1084 1.8.3/branches/devel/src/command.c
r1202 r1208 168 168 {"@GREP", "LIST PRINT ILIST IPRINT", cmd_grep, 169 169 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}, 171 171 {"@HIDE", "NO OFF YES ON", cmd_hide, CMD_T_ANY, 0, 0}, 172 172 {"@HOOK", "LIST AFTER BEFORE IGNORE OVERRIDE", cmd_hook, … … 300 300 {"@VERB", NULL, cmd_verb, CMD_T_ANY | CMD_T_EQSPLIT | CMD_T_RS_ARGS, 0, 0}, 301 301 {"@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, 303 303 0, 0}, 304 304 {"@WALL", "NOEVAL EMIT", cmd_wall, CMD_T_ANY, "WIZARD ROYALTY", "ANNOUNCE"}, 1.8.3/branches/devel/src/cque.c
r1150 r1208 23 23 #include <time.h> 24 24 #endif 25 #ifdef HAVE_STDINT_H 26 #include <stdint.h> 27 #endif 25 28 26 29 #include "conf.h" … … 37 40 #include "dbdefs.h" 38 41 #include "log.h" 42 #include "intmap.h" 39 43 #include "confmagic.h" 40 44 … … 57 61 char *rval[NUMQ]; /**< environment, from setq() */ 58 62 char *comm; /**< command to be executed */ 63 uint32_t pid; /**< Process id of this entry */ 64 uint32_t flags; /**< Flags */ 59 65 } BQUE; 60 66 67 #define QUEUE_HALTED 0x1U 68 61 69 slab *bque_slab = NULL; /**< slab for 'struct bque' allocations */ 70 71 static intmap *queue_map = NULL; /**< Intmap for looking up queue entries by pid */ 72 static uint32_t top_pid = 0; 62 73 63 74 static BQUE *qfirst = NULL, *qlast = NULL, *qwait = NULL; … … 98 109 bque_slab = slab_create("command queues", sizeof(BQUE)); 99 110 slab_set_opt(bque_slab, SLAB_ALLOC_BEST_FIT, 1); 111 queue_map = im_new(); 100 112 } 101 113 … … 186 198 for (a = 0; a < 10; a++) 187 199 if (point->env[a]) { 188 mush_free( (Malloc_t)point->env[a], "bqueue_env");200 mush_free(point->env[a], "bqueue_env"); 189 201 } 190 202 for (a = 0; a < NUMQ; a++) 191 203 if (point->rval[a]) { 192 mush_free( (Malloc_t)point->rval[a], "bqueue_rval");204 mush_free(point->rval[a], "bqueue_rval"); 193 205 } 194 206 if (point->semattr) 195 mush_free( (Malloc_t)point->semattr, "bqueue_semattr");207 mush_free(point->semattr, "bqueue_semattr"); 196 208 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); 198 211 slab_free(bque_slab, point); 199 212 } … … 246 259 } 247 260 261 static uint32_t 262 next_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 248 278 /** Add a new entry onto the player or object command queues. 249 279 * This function adds a new entry to the back of the player or … … 264 294 return; 265 295 tmp = slab_malloc(bque_slab, NULL); 296 tmp->pid = next_pid(); 266 297 tmp->comm = mush_strdup(command, "bqueue_comm"); 267 298 tmp->semattr = NULL; … … 296 327 qllast = qlfirst = tmp; 297 328 } 329 im_insert(queue_map, tmp->pid, tmp); 298 330 } 299 331 … … 382 414 tmp = slab_malloc(bque_slab, NULL); 383 415 tmp->comm = mush_strdup(command, "bqueue_comm"); 416 tmp->pid = next_pid(); 384 417 tmp->player = player; 385 418 tmp->queued = QUEUE_PER_OWNER ? Owner(player) : player; … … 436 469 } 437 470 } 471 im_insert(queue_map, tmp->pid, tmp); 438 472 } 439 473 … … 544 578 if (!(qfirst = entry->next)) 545 579 qlast = NULL; 546 if (GoodObject(entry->player) && !IsGarbage(entry->player)) { 580 if (GoodObject(entry->player) && !IsGarbage(entry->player) 581 && !(entry->flags & QUEUE_HALTED)) { 547 582 global_eval_context.cplr = entry->player; 548 583 giveto(global_eval_context.cplr, QUEUE_COST); … … 828 863 * \param player the enactor 829 864 * \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! 831 866 * \param cmd command to queue. 832 867 * \param until if 1, wait until an absolute time. 833 868 */ 834 869 void 835 do_wait(dbref player, dbref cause, char *arg1, c har *cmd, intuntil)870 do_wait(dbref player, dbref cause, char *arg1, const char *cmd, bool until) 836 871 { 837 872 dbref thing; … … 912 947 } 913 948 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 */ 956 void 957 do_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 914 1054 static void 915 1055 show_queue(dbref player, dbref victim, int q_type, int q_quiet, int q_all, … … 919 1059 for (tmp = q_ptr; tmp; tmp = tmp->next) { 920 1060 (*tot)++; 1061 if (tmp->flags & QUEUE_HALTED) 1062 continue; 921 1063 if (!GoodObject(tmp->player)) 922 1064 (*del)++; … … 929 1071 switch (q_type) { 930 1072 case 1: /* wait queue */ 931 notify_format(player, " [%ld]%s: %s",1073 notify_format(player, "(Pid: %u) [%ld]%s: %s", tmp->pid, 932 1074 (long) difftime(tmp->left, mudtime), 933 1075 unparse_object(player, tmp->player), tmp->comm); … … 935 1077 case 2: /* semaphore queue */ 936 1078 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, 938 1080 tmp->semattr, (long) difftime(tmp->left, mudtime), 939 1081 unparse_object(player, tmp->player), tmp->comm); 940 1082 } 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, 942 1084 tmp->semattr, unparse_object(player, tmp->player), 943 1085 tmp->comm); … … 945 1087 break; 946 1088 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, 948 1090 tmp->player), 949 1091 tmp->comm); … … 1160 1302 } 1161 1303 1304 /** Halt a particular pid 1305 * \param player the enactor. 1306 * \param arg1 string representing the pid to halt. 1307 */ 1308 void 1309 do_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 1162 1368 /** Halt all objects in the database. 1163 1369 * \param player the enactor. 1.8.3/branches/devel/src/mymalloc.c
r1051 r1208 553 553 *bvm_strnode_slab, *flag_slab, *player_dbref_slab, 554 554 *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; 556 556 557 557 #if COMPRESSION_TYPE == 1 || COMPRESSION_TYPE == 2 … … 590 590 slab_describe(player, text_block_slab); 591 591 slab_describe(player, player_dbref_slab); 592 slab_describe(player, intmap_slab); 592 593 593 594 if (options.mem_check) {
