ddi_ffs(9F) Kernel Functions for Drivers ddi_ffs(9F)NAME
ddi_ffs, ddi_fls - find first (last) bit set in a long integer
SYNOPSIS
#include <sys/conf.h>
#include <sys/ddi.h>
#include <sys/sunddi.h>
intddi_ffs(long mask);
int ddi_fls(long mask);
INTERFACE LEVEL
Solaris DDI specific (Solaris DDI).
PARAMETERS
mask A 32-bit argument value to search through.
DESCRIPTION
The function ddi_ffs() takes its argument and returns the shift count that the first (least significant) bit set in the argument corre-
sponds to. The function ddi_fls() does the same, only it returns the shift count for the last (most significant) bit set in the argument.
RETURN VALUES
0 No bits are set in mask.
N Bit N is the least significant (ddi_ffs) or most significant (ddi_fls) bit set in mask. Bits are numbered from 1 to 32, with bit 1
being the least significant bit position and bit 32 the most significant position.
CONTEXT
This function can be called from user, interrupt, or kernel context.
SEE ALSO
Writing Device Drivers
SunOS 5.11 16 Jan 2006 ddi_ffs(9F)
Check Out this Related Man Page
BITS(3) BSD Library Functions Manual BITS(3)NAME
__BIT, __BITS, __SHIFTIN, __SHIFTOUT, __SHIFTOUT_MASK -- macros for preparing bitmasks and operating on bit fields
SYNOPSIS
#include <sys/param.h>
#include <sys/cdefs.h>
uintmax_t
__BIT(n);
uintmax_t
__BITS(m, n);
__SHIFTIN(v, mask);
__SHIFTOUT(v, mask);
__SHIFTOUT_MASK(mask);
DESCRIPTION
These macros prepare bitmasks, extract bitfields from words, and insert bitfields into words. A ``bitfield'' is a span of consecutive bits
defined by a bitmask, where 1s select the bits in the bitfield.
Use __BIT() and __BITS() to define bitmasks:
__BIT(n)
Return a bitmask with bit n set, where the least significant bit is bit 0.
__BITS(m, n)
Return a bitmask with bits m through n, inclusive, set. It does not matter whether m > n or m <= n. The least significant bit
is bit 0.
__SHIFTIN(), __SHIFTOUT(), and __SHIFTOUT_MASK() help read and write bitfields from words:
__SHIFTIN(v, mask)
Left-shift bits v into the bitfield defined by mask, and return them. No side-effects.
__SHIFTOUT(v, mask)
Extract and return the bitfield selected by mask from v, right-shifting the bits so that the rightmost selected bit is
at bit 0. No side-effects.
__SHIFTOUT_MASK(mask)
Right-shift the bits in mask so that the rightmost non-zero bit is at bit 0. This is useful for finding the greatest
unsigned value that a bitfield can hold. No side-effects. Note that __SHIFTOUT_MASK(m) = __SHIFTOUT(m, m).
EXAMPLES
The following example demonstrates basic usage of the bits macros:
uint32_t bits, mask, val;
bits = __BITS(2, 3); /* 00001100 */
mask = __BIT(2) | __BIT(3); /* 00001100 */
val = __SHIFTIN(0x03, mask); /* 00001100 */
val = __SHIFTOUT(0xf, mask); /* 00000011 */
SEE ALSO bitops(3), cdefs(3)HISTORY
The bits macros first appeared in atw(4), with different names and implementation. In their current form these macros appeared in
NetBSD 4.0.
AUTHORS
The bits macros were written by David Young <dyoung@NetBSD.org>.
Matt Thomas <matt@NetBSD.org> suggested important improvements to the implementation, and contributed the macro names SHIFTIN() and
SHIFTOUT().
BUGS
__BIT() and __BITS() can only express 32-bit bitmasks.
BSD October 17, 2012 BSD
I have this code that doesnt do what it is suppose to do. It should block signal that I send while process is running. I press control+z while this process is running and it should be blocked but it isnt. When i press control+z it gives me this....
+ Stopped
When I change SIGTSP into SIGINT then... (5 Replies)
First question is how do you learn UNIX on a home lab. I understand that HP-UX isn't free and neither is SCO Unix and they don't run on x86 based systems anyways. The choices I believe are going to be OpenSolaris and FreeBSD. My question is UNIX commands the same across the board so if I learn... (11 Replies)
Hello all,
I am a newbie in shell scripting.
I want to know what does the below text means?
6.355u 1.679s 0:12.68 63.2% 0+0k 0+0io 0pf+0w
I am getting this line (on terminal) after every successful execution of my script.
Thanks in advance . . :)
-MD (15 Replies)
Hi all,
I hope you are fine,
I'd like study Os I tried a book like Silberschatz it's a good book but like
other books it talks about the concepts abstractly and that's due to it try
to encompass many concepts from many operating systems in GENERAL.
i am not too much comfortable from these... (20 Replies)
Hi,
Some of the process in th environment are producing a core file.
These core files are produced by default in the directory from which they were launched.
I want to change the default directory to say /tmp of that environment.
I am using both Linux and Solaris, so will need the solution... (2 Replies)
my request is:
i have to create a script , which will grep the 'not running' jobs and will send the update in mail with its name(job)
Scenario:
logged in to machine abc
went to particular path: cd /a/b/c
then ./script1.sh status (script.sh is a script,whose status gives info about 10 jobs... (1 Reply)
Hi all,
My home server was Solaris for quite a while- I started with an Ultra 2 about 20 years ago, ended with a Blade 2000- but I've transitioned to Linux and am not going back. I miss the Solaris experience a bit (but not the Oracle experience), besides running with modern and small and quiet... (0 Replies)
can anyone spot a problem with the below:
$
$ cat getopts.sh
#!/bin/sh
usage() { echo "myscript.sh local /tmp data.txt 600s -query" 1>&2; exit 1; }
while... (4 Replies)
All
I see cpu and memory usage are under control, only cache gets high upto 99% using sar -r command
I did echo3 and cleaned the drop caches
do we need to monitor this , why my application going high upto 99.8% memused in sar command , this is cache memory which is going high
will this... (12 Replies)
I have been trying to enable password complexity variables on Solaris 10 by editing the /etc/default/passwd file but none of my changes are taking effect (I'm still able to set passwords that violate the rules I am trying to implement).
I've tried an O/S reboot after the changes but that had no... (6 Replies)
Hello everyone, I am using centos,
1) solaris is free right?
2) I want to learn solaris and install it in a computer that I am mounting, I would like know what is strong in solaris and if do it is wise. I am programmer python, learning machine and programming in general,..any help thanks,.. (6 Replies)
Hello!
Yesterday we added over 10,000 PHP man pages to our man page section.
I've not yet got our unique and special recursive search feature working; but you can still access the PHP man pages directly by selecting PHP in the man sets drop down menu (left side) and then section 3 (right... (3 Replies)
What is the point of this? Whenever I close my shell it appends to the history file without adding this. I have never seen it overwrite my history file.
# When the shell exits, append to the history file instead of overwriting it
shopt -s histappend (3 Replies)