SET(9) BSD Kernel Developer's Manual SET(9)NAME
SET -- primitive bit macros
SYNOPSIS
#include <sys/types.h>
void
SET(val, x);
void
ISSET(val, x);
void
CLR(val, x);
DESCRIPTION
These macros define three standard bit-operations:
1. SET() sets the bit x in val;
2. CLR() clears the bit x in val; and
3. ISSET() returns 1 if the bit x is set in val.
SEE ALSO bits(3)BUGS
The rationale is to provide clarity in the source code, but arguably these operations are clear enough without the use of the macros.
BSD April 13, 2010 BSD
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
Hi
I try to configure snedmail as smtp for my solaris box. if the useres are local there's no problem everything's working fine, but is it outside, sendmail says it could find the host. why?! all other tools find diffrent host?
Could anyone tell me how I set up an easy mx ? So I test it with... (29 Replies)
hey,
I was wondering if anybody could help me setup my telnet on my linux 7.1 machine. I need it so i can do some remote work on soem stuff i've got going when i go away next month. I've tried a few times before but it didn't work, i don't know why.
thanks for your help. (23 Replies)
Hi all,
Can anyone please tell me how to setup internet on solaris10, b72?
I own an airtel broadband, with a beetel 220BXI modem.
I am new to solaris so was wondering as to how it can be done?
Thanks (23 Replies)
Hi all,
I just bought a new system, but am unable to configure network on it..
am using a nge0 ethernet interface to login.
i've tried all i knew but not of the webpages seem to open.
Here is what i've done..
ifconfig nge0 plumb
ifconfig -a
(nge0) was being displayed as up and running.
... (23 Replies)
Hello Good People of Linux World!!!
Background: Recent Networking Graduate, thrown in line of fire.
For the past couple of days I have been searching online for answers and haven't gotten anywhere regarding Mailx, Sendmail functionality on SunOS 5.9.
My dilemma:
Mailx / sendmail are... (28 Replies)
Hi Guys,
I have been trying to resolve a printing problem but nothing works out .
I have an Epson LQ 680 (dot matrix printer) . I need to print a file . The paper length should be 34 .Left margin should be 5. I have tried the following things after researching from the man pages.
pr -t... (24 Replies)
Hi all,
I need a script to delete a large set of files from a directory under / based on an input file and want to redirect errors into separate file.
I have already prepared a list of files in the input file.
Kndly help me.
Thanks,
Prash (36 Replies)
Hi,
I have the following 3 test files to test setuid bit which if it works I would like to implement in our application. However setuid doesnot seem to be having any impact on my test below.Following are the 3 files of interest in /tmp/ folder.
$ ls -ltr *env*
-rw------- 1 g332008 users 6... (23 Replies)
Hey guys!
So I decided to set up some basic user authentication on my apache2 server, and I am running into some problems. I followed the documentation provided by apache on their website, but I cant create the password file for some reason. I did a little trouble shooting myself, and found... (40 Replies)
Hi GUys
I have a script where i am counting the number of files that the user has read permissions to in a folder . They are asked for this folder at the start
if they dont enter anything then i want to be able to do the search on the current directory, can you help me with that part please... (25 Replies)
Hi,
I have set alias rm='rm -i' and i m able to see that in the list of aliases.
however, when i fire the rm command the '-i' interactive flag does not seem to kick in.
I login to a free online terminal and then i say bash to set the bash profile.
Join
Here is the output... (27 Replies)
Centos Behind The Proxy Server In My System , How Can I Set In Terminal Proxy ( Username & Password )
When Using The Command yum & rpm online I Will Respond Error
Thank You For Your Guidance (28 Replies)
My original files are like this below and I distinguish them from the AP_ID (file1 has 572 and file2 has 544). Also, the header on file1 has “G_” pre-pended. NOTE: these are only snippets of very large files and much of the data is not present here.
Original File 1:
... (36 Replies)
Hi Guys,
Is there a way to export a sas file i.e .sas7bdat file to .csv file with header and data using unix. I dont want to use SAS program instead using unix tool or unix scripting is it possible ? (25 Replies)