$ cat mq.c
#include <fcntl.h> /* For O_* constants */
#include <sys/stat.h> /* For mode constants */
#include <mqueue.h>
#include <stdio.h>
#include <string.h>
mqd_t mqopen2(const char * pName,
unsigned long Flags,
long maxMsg,
long msgSz);
int main(void)
{
mqd_t m=mqopen2(NULL, 0, 16, 1024);
printf("mq is %d\n", m);
mq_close(m);
}
mqd_t mqopen2(const char * pName,
unsigned long Flags,
long maxMsg,
long msgSz)
{
int perms = 0600; /* permissions */
int oflags= O_RDWR| O_CREAT;
int rd=0, wr=0; /* -r and -w options */
mqd_t mqd; /* returned msg queue descriptor */
int c;
char *path="/iothread8"; /* ->first non-option argument */
struct mq_attr buf; /* buffer for stat info */
memset(&buf, 0, sizeof(buf)); // WILL NOT WORK without this!
buf.mq_msgsize = msgSz;
buf.mq_maxmsg = maxMsg;
buf.mq_flags = Flags;
/* while */
//if (optind < argc)
// path = argv[optind]; /* first non-option argument */
//else
// { printf("Queue pathname required\n"); return -1; }
mqd = mq_open(path,oflags,perms,&buf);
if (-1 != mqd)
{
printf("Reached inside the loop\n");
if ( ! mq_getattr(mqd,&buf) )
{
printf("flags: 0x%lx maxmsg: %ld msgsize: %ld curmsgs: %ld\n",
buf.mq_flags, buf.mq_maxmsg, buf.mq_msgsize, buf.mq_curmsgs);
}
else
perror("mq_getattr()");
}
else
perror("mq_open()");
return mqd;
}
$ gcc mq.c -o mq -lrt
$ ./mq
Reached inside the loop
flags: 0x0 maxmsg: 10 msgsize: 8192 curmsgs: 0
mq is 3
$
It doesn't give you the sizes you want but it does go... Try it in a .c file by itself like above. I'm beginning to suspect the problem isn't related to message queues but an error somewhere else in the larger part of your code (the part we of course haven't seen).
Ok, I'm sure this is a total newbie question, but I think I'm in the right place, no?
I'm trying to call a perl module from a cgi script - Mail::Sendmail - and my web host installed the module in a directory that doesn't seem to be accessible, at least not the way I'm trying. But I thought you... (1 Reply)
Hi,
Is there any system call which changes the time of symbolic link apart from utime? or if tere is no system call any other option of how to do it?
Thanks (4 Replies)
I need to write a script that can find a bad record (for example: there is date field colom but value provided in the file for this field is N/A) then script shoud searches this pattern and then insert the whole record into the bad file.
Example:
File1
Name designation dateOfJoining... (1 Reply)
I need to write a script that can find a bad record (for example: there is date field colom but value provided in the file for this field is N/A) then script shoud searches this pattern and then insert the whole record into the bad file.
Example:
File1
Name designation dateOfJoining... (2 Replies)
Hi All
I have a dedicated backup server running ubuntu 10.04, which has recently been rebuilt (same OS, just different h/w)
This is used to receive ufsdump output from a number of Solaris servers, using the following syntax:
ufsdump 1uf :/path/to/backup/file /fs/to/be/backed/up
This has... (1 Reply)
Hi ,
One of my zone went down and when i booted it up i could see the pool in degraded state with some check sum errors . we have brought the pool online after scrubbing. But few files are showing this error
Bad exchange descriptor
Please let me know how to remove these files (2 Replies)
I'm learning SED command. And while doing that i got to this place where i'm taking a copy of my existing file. The code i used is -
sed -n '/Storm/ w Storm.txt' books.txt
As expected, the file 'books.txt' is read , and lines with 'Storm' is put in to the new file 'Storm.txt'. However, it also... (4 Replies)
Discussion started by: justo
4 Replies
LEARN ABOUT OSX
ttk_image
ttk_image(n) Tk Themed Widget ttk_image(n)
__________________________________________________________________________________________________________________________________________________NAME
ttk_image - Define an element based on an image
SYNOPSIS
ttk::style element create name image imageSpec ?options?
_________________________________________________________________DESCRIPTION
The image element factory creates a new element in the current theme whose visual appearance is determined by Tk images. imageSpec is a
list of one or more elements. The first element is the default image name. The rest of the list is a sequence of statespec / value pairs
specifying other images to use when the element is in a particular state or combination of states.
OPTIONS
Valid options are:
-border padding
padding is a list of up to four integers, specifying the left, top, right, and bottom borders, respectively. See IMAGE STRETCHING,
below.
-height height
Specifies a minimum height for the element. If less than zero, the base image's height is used as a default.
-padding padding
Specifies the element's interior padding. Defaults to -border if not specified.
-sticky spec
Specifies how the image is placed within the final parcel. spec contains zero or more characters "n", "s", "w", or "e".
-width width
Specifies a minimum width for the element. If less than zero, the base image's width is used as a default.
IMAGE STRETCHING
If the element's allocated parcel is larger than the image, the image will be placed in the parcel based on the -sticky option. If the
image needs to stretch horizontally (i.e., -sticky ew) or vertically (-sticky ns), subregions of the image are replicated to fill the par-
cel based on the -border option. The -border divides the image into 9 regions: four fixed corners, top and left edges (which may be tiled
horizontally), left and right edges (which may be tiled vertically), and the central area (which may be tiled in both directions).
EXAMPLE
set img1 [image create photo -file button.png]
set img2 [image create photo -file button-pressed.png]
set img3 [image create photo -file button-active.png]
style element create Button.button image
[list $img1 pressed $img2 active $img3]
-border {2 4} -sticky we
SEE ALSO
ttk::intro(n), ttk::style(n), ttk_vsapi(n), image(n), photo(n)
KEYWORDS
style, theme, appearance, pixmap theme, image
Tk 8.5 ttk_image(n)