Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

copymsg(9r) [osf1 man page]

copymsg(9r)															       copymsg(9r)

copymsg - STREAMS: Copies a message to a new message SYNOPSIS
#include <sys/stream.h> MBLKP copymsg( MBLKP message_block ); ARGUMENTS
Specifies a pointer to the message block from which copymsg copies the data. (Actually, copymsg calls the copyb interface to copy the data.) The typedef MBLKP is an alternate name for typedef struct msgb *. DESCRIPTION
The copymsg interface: Forms a new message by allocating new message blocks Copies (by calling the copyb interface) the contents of the message referred to by the message_block argument Returns a pointer to the new message block. RETURN VALUES
Upon successful completion, the copymsg interface returns a pointer to the newly allocated message block that contains the copied data. This newly allocated message block is of type struct msgb *. The msgb data structure is defined in the /usr/sys/include/sys/stream.h file. Otherwise, copymsg returns a NULL pointer. SEE ALSO
Kernel Interfaces: allocb(9r), copyb(9r) Programmer's Guide: STREAMS copymsg(9r)

Check Out this Related Man Page

copymsg(9F)						   Kernel Functions for Drivers 					       copymsg(9F)

copymsg - copy a message SYNOPSIS
#include <sys/stream.h> mblk_t *copymsg(mblk_t *mp); INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI). PARAMETERS
mp Pointer to the message to be copied. DESCRIPTION
copymsg() forms a new message by allocating new message blocks, and copying the contents of the message referred to by mp (using the copyb(9F) function). It returns a pointer to the new message. RETURN VALUES
If the copy is successful, copymsg() returns a pointer to the new message. Otherwise, it returns a NULL pointer. CONTEXT
copymsg() can be called from user or interrupt context. EXAMPLES
Example 1: : Using copymsg The routine lctouc() converts all the lowercase ASCII characters in the message to uppercase. If the reference count is greater than one (line 8), then the message is shared, and must be copied before changing the contents of the data buffer. If the call to the copymsg() function fails (line 9), return NULL (line 10), otherwise, free the original message (line 11). If the reference count was equal to 1, the message can be modified. For each character (line 16) in each message block (line 15), if it is a lowercase letter, convert it to an upper- case letter (line 18). A pointer to the converted message is returned (line 21). 1 mblk_t *lctouc(mp) 2 mblk_t *mp; 3 { 4 mblk_t *cmp; 5 mblk_t *tmp; 6 unsigned char *cp; 7 8 if (mp->b_datap->db_ref > 1) { 9 if ((cmp = copymsg(mp)) == NULL) 10 return (NULL); 11 freemsg(mp); 12 } else { 13 cmp = mp; 14 } 15 for (tmp = cmp; tmp; tmp = tmp->b_cont) { 16 for (cp = tmp->b_rptr; cp < tmp->b_wptr; cp++) { 17 if ((*cp <= 'z') && (*cp >= 'a')) 18 *cp -= 0x20; 19 } 20 } 21 return(cmp); 22 } SEE ALSO
allocb(9F), copyb(9F), msgb(9S) Writing Device Drivers STREAMS Programming Guide SunOS 5.10 27 Jun 1995 copymsg(9F)
Man Page

We Also Found This Discussion For You

1. What is on Your Mind?

Throw my Toys out of the Pram!

Hi Folks, Today hasn't been the best one of my career in IT. I've been a contractor for a major utility company for a number of years, on a number of seperate IT contracts mostly Unix. The company had 10 different flavours of unix and multiple different varsions of most of them. At the... (3 Replies)
Discussion started by: gull04
3 Replies