open-src/xserver/xorg/sun-src/os/solaris/mdb/modules/Xserver_device_grabs.c
changeset 1673 16162eea97d8
parent 1486 4c25b042694c
equal deleted inserted replaced
1672:1b50d0ebe41a 1673:16162eea97d8
     1 /*
     1 /*
     2  * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
     3  *
     3  *
     4  * Permission is hereby granted, free of charge, to any person obtaining a
     4  * Permission is hereby granted, free of charge, to any person obtaining a
     5  * copy of this software and associated documentation files (the "Software"),
     5  * copy of this software and associated documentation files (the "Software"),
     6  * to deal in the Software without restriction, including without limitation
     6  * to deal in the Software without restriction, including without limitation
     7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
     7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
   110 	"of DeviceIntRec entries starting at the entry stored in the global\n"
   110 	"of DeviceIntRec entries starting at the entry stored in the global\n"
   111 	"variable \"InputInfo\" and print information about each one.\n"
   111 	"variable \"InputInfo\" and print information about each one.\n"
   112 	);
   112 	);
   113 }
   113 }
   114 
   114 
       
   115 /*
       
   116  * Functions required by resource.h to implement CLIENT_BITS macro below.
       
   117  */
       
   118 
       
   119 static unsigned int
       
   120 ilog2(int val)
       
   121 {
       
   122     int bits;
       
   123 
       
   124     if (val <= 0)
       
   125         return 0;
       
   126     for (bits = 0; val != 0; bits++)
       
   127         val >>= 1;
       
   128     return bits - 1;
       
   129 }
       
   130 
       
   131 
       
   132 _X_HIDDEN unsigned int
       
   133 ResourceClientBits(void)
       
   134 {
       
   135     int LimitClients;
       
   136 
       
   137     if (mdb_readsym(&LimitClients, sizeof (LimitClients), "LimitClients") == -1)
       
   138     {
       
   139 	mdb_warn("failed to read LimitClients");
       
   140 	LimitClients = LIMITCLIENTS;
       
   141     }
       
   142 
       
   143     return (ilog2(LimitClients));
       
   144 }
       
   145 
   115 _X_HIDDEN int
   146 _X_HIDDEN int
   116 inputdev_grabs(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
   147 inputdev_grabs(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
   117 {
   148 {
   118     uintptr_t inputdevP;
   149     uintptr_t inputdevP;
   119     DeviceIntPtr dev;
   150     DeviceIntPtr dev;