2006-03-01 03:21:20 +00:00
|
|
|
'\" t
|
|
|
|
.\" Hey Emacs! This file is -*- nroff -*- source.
|
|
|
|
.\"
|
2007-09-20 06:52:22 +00:00
|
|
|
.\" Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
|
2006-03-01 03:21:20 +00:00
|
|
|
.\"
|
|
|
|
.\" Permission is granted to make and distribute verbatim copies of this
|
|
|
|
.\" manual provided the copyright notice and this permission notice are
|
|
|
|
.\" preserved on all copies.
|
|
|
|
.\"
|
|
|
|
.\" Permission is granted to copy and distribute modified versions of this
|
|
|
|
.\" manual under the conditions for verbatim copying, provided that the
|
|
|
|
.\" entire resulting derived work is distributed under the terms of a
|
|
|
|
.\" permission notice identical to this one.
|
2007-04-12 22:42:49 +00:00
|
|
|
.\"
|
2006-03-01 03:21:20 +00:00
|
|
|
.\" Since the Linux kernel and libraries are constantly changing, this
|
|
|
|
.\" manual page may be incorrect or out-of-date. The author(s) assume no
|
|
|
|
.\" responsibility for errors or omissions, or for damages resulting from
|
2008-03-18 14:47:54 +00:00
|
|
|
.\" the use of the information contained herein. The author(s) may not
|
|
|
|
.\" have taken the same level of care in the production of this manual,
|
|
|
|
.\" which is licensed free of charge, as they might when working
|
|
|
|
.\" professionally.
|
2007-04-12 22:42:49 +00:00
|
|
|
.\"
|
2006-03-01 03:21:20 +00:00
|
|
|
.\" Formatted or processed versions of this manual, if unaccompanied by
|
|
|
|
.\" the source, must acknowledge the copyright and authors of this work.
|
|
|
|
.\"
|
_exit.2, brk.2, capget.2, chdir.2, chmod.2, chown.2, chroot.2, getdtablesize.2, gethostname.2, getpagesize.2, getsid.2, killpg.2, mknod.2, mknodat.2, poll.2, posix_fadvise.2, pread.2, readlink.2, setpgid.2, setreuid.2, sigaltstack.2, stat.2, symlink.2, sync.2, truncate.2, vfork.2, wait.2, wait4.2, a64l.3, abs.3, acos.3, acosh.3, asin.3, asinh.3, atan.3, atan2.3, atoi.3, cbrt.3, ceil.3, copysign.3, cosh.3, dirfd.3, div.3, ecvt.3, erf.3, erfc.3, exp.3, exp2.3, fabs.3, fdim.3, ffs.3, floor.3, fma.3, fmax.3, fmin.3, fmod.3, fpclassify.3, frexp.3, ftw.3, fwide.3, gcvt.3, getcwd.3, getdate.3, getgrent.3, gethostid.3, getpass.3, getpwent.3, getsubopt.3, getw.3, hypot.3, ilogb.3, index.3, isalpha.3, isgreater.3, iswblank.3, j0.3, ldexp.3, lockf.3, log.3, log10.3, log1p.3, logb.3, lrint.3, lround.3, mkstemp.3, mktemp.3, modf.3, mq_receive.3, mq_send.3, nan.3, nextafter.3, posix_fallocate.3, posix_memalign.3, printf.3, qecvt.3, random.3, realpath.3, remainder.3, remquo.3, rint.3, round.3, scalb.3, scalbln.3, scanf.3, siginterrupt.3, signbit.3, sigset.3, sinh.3, sqrt.3, strcasecmp.3, strcat.3, strchr.3, strcmp.3, strcoll.3, strcpy.3, strfry.3, strpbrk.3, strsep.3, strspn.3, strstr.3, strtod.3, strtok.3, strtol.3, strtoul.3, strxfrm.3, tanh.3, tgamma.3, trunc.3, ttyslot.3, ualarm.3, usleep.3, wprintf.3, armscii-8.7, cp1251.7, iso_8859-10.7, iso_8859-11.7, iso_8859-13.7, iso_8859-14.7, iso_8859-3.7, iso_8859-5.7, iso_8859-6.7, iso_8859-8.7, koi8-u.7: tstamp
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-09-19 17:19:13 +00:00
|
|
|
.TH MQ_SEND 3 2010-09-20 "Linux" "Linux Programmer's Manual"
|
2006-03-01 03:21:20 +00:00
|
|
|
.SH NAME
|
|
|
|
mq_send, mq_timedsend \- send a message to a message queue
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.nf
|
|
|
|
.B #include <mqueue.h>
|
|
|
|
.sp
|
2010-08-29 05:28:13 +00:00
|
|
|
.BI "int mq_send(mqd_t " mqdes ", const char *" msg_ptr ,
|
2007-04-03 15:32:52 +00:00
|
|
|
.BI " size_t " msg_len ", unsigned " msg_prio );
|
2006-03-01 03:21:20 +00:00
|
|
|
.sp
|
|
|
|
.B #include <time.h>
|
|
|
|
.B #include <mqueue.h>
|
|
|
|
.sp
|
2010-08-29 05:28:13 +00:00
|
|
|
.BI "int mq_timedsend(mqd_t " mqdes ", const char *" msg_ptr ,
|
2007-04-03 15:32:52 +00:00
|
|
|
.BI " size_t " msg_len ", unsigned " msg_prio ,
|
|
|
|
.BI " const struct timespec *" abs_timeout );
|
2006-03-01 03:21:20 +00:00
|
|
|
.fi
|
2007-08-02 16:48:31 +00:00
|
|
|
.sp
|
|
|
|
Link with \fI\-lrt\fP.
|
2010-09-19 16:32:23 +00:00
|
|
|
.sp
|
|
|
|
.ad l
|
|
|
|
.in -4n
|
|
|
|
Feature Test Macro Requirements for glibc (see
|
|
|
|
.BR feature_test_macros (7)):
|
|
|
|
.in
|
|
|
|
.sp
|
|
|
|
.BR mq_timedsend ():
|
|
|
|
.RS 4
|
|
|
|
_XOPEN_SOURCE\ >=\ 600 || _POSIX_C_SOURCE\ >=\ 200112L
|
|
|
|
.RE
|
|
|
|
.ad
|
2006-03-01 03:21:20 +00:00
|
|
|
.SH DESCRIPTION
|
|
|
|
.BR mq_send ()
|
|
|
|
adds the message pointed to by
|
2007-09-20 16:26:31 +00:00
|
|
|
.I msg_ptr
|
2006-03-01 03:21:20 +00:00
|
|
|
to the message queue referred to by the descriptor
|
|
|
|
.IR mqdes .
|
2007-04-12 22:42:49 +00:00
|
|
|
The
|
2006-03-01 03:21:20 +00:00
|
|
|
.I msg_len
|
|
|
|
argument specifies the length of the message pointed to by
|
|
|
|
.IR msg_ptr ;
|
|
|
|
this length must be less than or equal to the queue's
|
|
|
|
.I mq_msgsize
|
|
|
|
attribute.
|
|
|
|
Zero-length messages are allowed.
|
|
|
|
|
2007-04-12 22:42:49 +00:00
|
|
|
The
|
2006-03-01 03:21:20 +00:00
|
|
|
.I msg_prio
|
_syscall.2, accept.2, epoll_create.2, inotify_add_watch.2, ioctl.2, msgget.2, msgop.2, open.2, prctl.2, sched_setscheduler.2, semctl.2, semget.2, swapon.2, addseverity.3, cacosh.3, csqrt.3, dirfd.3, drand48.3, fputws.3, mq_send.3, posix_openpt.3, puts.3, sched_getcpu.3, shm_open.3, sqrt.3, sysconf.3, tgamma.3, ulimit.3, credentials.7, svipc.7: Global fix: s/non-negative/nonnegative/
The tendency in English, as prescribed in style guides like
Chicago MoS, is towards removing hyphens after prefixes
like "non-" etc.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-01-16 16:44:48 +00:00
|
|
|
argument is a nonnegative integer that specifies the priority
|
2006-03-01 03:21:20 +00:00
|
|
|
of this message.
|
2007-04-12 22:42:49 +00:00
|
|
|
Messages are placed on the queue in decreasing order of priority,
|
|
|
|
with newer messages of the same priority being placed after
|
2006-03-01 03:21:20 +00:00
|
|
|
older messages with the same priority.
|
|
|
|
|
2007-04-12 22:42:49 +00:00
|
|
|
If the message queue is already full
|
2006-03-01 03:21:20 +00:00
|
|
|
(i.e., the number of messages on the queue equals the queue's
|
|
|
|
.I mq_maxmsg
|
|
|
|
attribute), then, by default,
|
|
|
|
.BR mq_send ()
|
2007-04-12 22:42:49 +00:00
|
|
|
blocks until sufficient space becomes available to allow the message
|
2006-03-01 03:21:20 +00:00
|
|
|
to be queued, or until the call is interrupted by a signal handler.
|
2007-04-12 22:42:49 +00:00
|
|
|
If the
|
2006-03-01 03:21:20 +00:00
|
|
|
.B O_NONBLOCK
|
|
|
|
flag is enabled for the message queue description,
|
|
|
|
then the call instead fails immediately with the error
|
|
|
|
.BR EAGAIN .
|
|
|
|
|
|
|
|
.BR mq_timedsend ()
|
|
|
|
behaves just like
|
|
|
|
.BR mq_send (),
|
|
|
|
except that if the queue is full and the
|
|
|
|
.B O_NONBLOCK
|
|
|
|
flag is not enabled for the message queue description, then
|
|
|
|
.I abs_timeout
|
2007-04-12 22:42:49 +00:00
|
|
|
points to a structure which specifies a ceiling on the time for which
|
2006-03-01 03:21:20 +00:00
|
|
|
the call will block.
|
|
|
|
This ceiling is an absolute timeout in seconds and nanoseconds
|
stime.2, time.2, utimensat.2, ctime.3, difftime.3, ftime.3, getspnam.3, mq_receive.3, mq_send.3, rtime.3, sem_wait.3, strftime.3, strptime.3, timeradd.3, rtc.4, core.5, proc.5, icmp.7, time.7: Global fix: Consistently define the Epoch
All definitions of the Epoch have been refactored to the following:
1970-01-01 00:00:00 +0000 (UTC)
That form is more consistent, logical, precise, and internationally
recognizable than the other variants.
Also, some wording has been altered as well.
Signed-off-by: Michael Witten <mfwitten@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-01-17 03:53:52 +00:00
|
|
|
since the Epoch, 1970-01-01 00:00:00 +0000 (UTC), and it is
|
2006-03-01 03:21:20 +00:00
|
|
|
specified in the following structure:
|
|
|
|
.sp
|
2007-12-19 06:16:04 +00:00
|
|
|
.in +4n
|
2006-03-01 03:21:20 +00:00
|
|
|
.nf
|
|
|
|
struct timespec {
|
|
|
|
time_t tv_sec; /* seconds */
|
|
|
|
long tv_nsec; /* nanoseconds */
|
|
|
|
};
|
|
|
|
|
|
|
|
.fi
|
2007-12-19 06:16:04 +00:00
|
|
|
.in
|
2006-03-01 03:21:20 +00:00
|
|
|
If the message queue is full,
|
|
|
|
and the timeout has already expired by the time of the call,
|
|
|
|
.BR mq_timedsend ()
|
|
|
|
returns immediately.
|
|
|
|
.SH RETURN VALUE
|
|
|
|
On success,
|
|
|
|
.BR mq_send ()
|
|
|
|
and
|
|
|
|
.BR mq_timedsend ()
|
|
|
|
return zero; on error, \-1 is returned, with
|
2007-04-12 22:42:49 +00:00
|
|
|
.I errno
|
2006-03-01 03:21:20 +00:00
|
|
|
set to indicate the error.
|
|
|
|
.SH ERRORS
|
|
|
|
.TP
|
|
|
|
.B EAGAIN
|
2010-08-31 04:22:19 +00:00
|
|
|
The queue was full, and the
|
2006-03-01 03:21:20 +00:00
|
|
|
.B O_NONBLOCK
|
|
|
|
flag was set for the message queue description referred to by
|
|
|
|
.IR mqdes .
|
|
|
|
.TP
|
|
|
|
.B EBADF
|
2007-04-12 22:42:49 +00:00
|
|
|
The descriptor specified in
|
2006-03-01 03:21:20 +00:00
|
|
|
.I mqdes
|
|
|
|
was invalid.
|
|
|
|
.TP
|
|
|
|
.B EINTR
|
2008-07-04 15:50:36 +00:00
|
|
|
The call was interrupted by a signal handler; see
|
|
|
|
.BR signal (7).
|
2006-03-01 03:21:20 +00:00
|
|
|
.TP
|
|
|
|
.B EINVAL
|
2007-04-12 22:42:49 +00:00
|
|
|
The call would have blocked, and
|
2006-03-01 03:21:20 +00:00
|
|
|
.I abs_timeout
|
|
|
|
was invalid, either because
|
|
|
|
.I tv_sec
|
|
|
|
was less than zero, or because
|
2007-04-12 22:42:49 +00:00
|
|
|
.I tv_nsec
|
2006-03-01 03:21:20 +00:00
|
|
|
was less than zero or greater than 1000 million.
|
|
|
|
.TP
|
2007-08-27 07:56:52 +00:00
|
|
|
.B EMSGSIZE
|
2007-09-20 16:26:31 +00:00
|
|
|
.I msg_len
|
2007-08-27 07:56:52 +00:00
|
|
|
was greater than the
|
|
|
|
.I mq_msgsize
|
|
|
|
attribute of the message queue.
|
|
|
|
.TP
|
2006-03-01 03:21:20 +00:00
|
|
|
.B ETIMEDOUT
|
|
|
|
The call timed out before a message could be transferred.
|
|
|
|
.SH CONFORMING TO
|
|
|
|
POSIX.1-2001.
|
2008-09-29 03:36:48 +00:00
|
|
|
.SH NOTES
|
|
|
|
On Linux,
|
|
|
|
.BR mq_timedsend ()
|
|
|
|
is a system call, and
|
|
|
|
.BR mq_send ()
|
|
|
|
is a library function layered on top of that system call.
|
2006-03-01 03:21:20 +00:00
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR mq_close (3),
|
|
|
|
.BR mq_getattr (3),
|
|
|
|
.BR mq_notify (3),
|
|
|
|
.BR mq_open (3),
|
|
|
|
.BR mq_receive (3),
|
|
|
|
.BR mq_unlink (3),
|
2007-01-28 20:00:24 +00:00
|
|
|
.BR feature_test_macros (7),
|
2008-06-23 08:48:25 +00:00
|
|
|
.BR mq_overview (7),
|
|
|
|
.BR time (7)
|