~ubuntu-branches/ubuntu/saucy/manpages/saucy

« back to all changes in this revision

Viewing changes to man3/mq_notify.3

  • Committer: Bazaar Package Importer
  • Author(s): Benjamin Drung
  • Date: 2010-11-17 16:35:58 UTC
  • mfrom: (1.1.45 upstream) (2.2.8 sid)
  • Revision ID: james.westby@ubuntu.com-20101117163558-9h3ho5jumqm3rdmd
Tags: 3.27-1ubuntu1
* Merge from Debian unstable; remaining changes:
  - ptrace.2, prctl.2: document Ubuntu-specific PTRACE_ATTACH,
    PR_SET_PTRACER behavior.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
.\" Formatted or processed versions of this manual, if unaccompanied by
24
24
.\" the source, must acknowledge the copyright and authors of this work.
25
25
.\"
26
 
.TH MQ_NOTIFY 3 2010-08-29 "Linux" "Linux Programmer's Manual"
 
26
.TH MQ_NOTIFY 3 2010-09-19 "Linux" "Linux Programmer's Manual"
27
27
.SH NAME
28
28
mq_notify \- register for notification when a message is available
29
29
.SH SYNOPSIS
45
45
.I notification
46
46
argument is a pointer to a
47
47
.I sigevent
48
 
structure that is defined something like the following:
49
 
.in +4n
50
 
.nf
51
 
 
52
 
union sigval {          /* Data passed with notification */
53
 
    int     sival_int;         /* Integer value */
54
 
    void   *sival_ptr;         /* Pointer value */
55
 
};
56
 
 
57
 
struct sigevent {
58
 
    int          sigev_notify; /* Notification method */
59
 
    int          sigev_signo;  /* Notification signal */
60
 
    union sigval sigev_value;  /* Data passed with
61
 
                                  notification */
62
 
    void       (*sigev_notify_function) (union sigval);
63
 
                               /* Function for thread
64
 
                                  notification */
65
 
    void        *sigev_notify_attributes;
66
 
                               /* Thread function attributes */
67
 
};
68
 
.fi
69
 
.in
 
48
structure.
 
49
For the definition and general details of this structure, see
 
50
.BR sigevent (7).
70
51
.PP
71
52
If
72
53
.I notification
77
58
.I sigev_notify
78
59
field of the
79
60
.I sigevent
80
 
to which
 
61
structure to which
81
62
.I notification
82
63
points specifies how notification is to be performed.
83
64
This field has one of the following values:
90
71
.B SIGEV_SIGNAL
91
72
Notify the process by sending the signal specified in
92
73
.IR sigev_signo .
93
 
If the signal is caught with a signal handler that
94
 
was registered using the
95
 
.BR sigaction (2)
96
 
.B SA_SIGINFO
97
 
flag, then the following fields are set in the
 
74
See
 
75
.BR sigevent (7)
 
76
for general details.
 
77
The
 
78
.I si_code
 
79
field of the
98
80
.I siginfo_t
99
 
structure that is passed as the second argument of the handler:
100
 
.I si_code
101
 
is set to
102
 
.BR SI_MESGQ ;
103
 
.I si_signo
104
 
is set to the signal number;
105
 
.I si_value
106
 
is set to the value specified in
107
 
.IR notification\->sigev_value ;
 
81
structure will be set to
 
82
.BR SI_MESGQ .
 
83
In addition,
108
84
.\" I don't know of other implementations that set
109
85
.\" si_pid and si_uid -- MTK
110
86
.I si_pid
111
 
is set to the PID of the process that sent the message; and
 
87
will be set to the PID of the process that sent the message, and
112
88
.I si_uid
113
 
is set to the real user ID of the sending process.
114
 
The same information is available if the signal is accepted using
115
 
.BR sigwaitinfo (2).
 
89
will be set to the real user ID of the sending process.
116
90
.TP
117
91
.B SIGEV_THREAD
118
 
Deliver notification by invoking
119
 
.I notification\->sigev_notify_function
120
 
as the start function of a new thread.
121
 
The function is invoked with
122
 
.I notification\->sigev_value
123
 
as its sole argument.
124
 
If
125
 
.I notification\->sigev_notify_attributes
126
 
is not NULL, then it should point to a
127
 
.I pthread_attr_t
128
 
structure that defines attributes for the thread (see
129
 
.BR pthread_attr_init (3)).
 
92
Upon message delivery, invoke
 
93
.I sigev_notify_function
 
94
as if it were the start function of a new thread.
 
95
See
 
96
.BR sigevent (7)
 
97
for details.
130
98
.PP
131
99
Only one process can be registered to receive notification
132
100
from a message queue.
279
247
.BR mq_receive (3),
280
248
.BR mq_send (3),
281
249
.BR mq_unlink (3),
282
 
.BR mq_overview (7)
 
250
.BR mq_overview (7),
 
251
.BR sigevent (7)
283
252
.SH COLOPHON
284
 
This page is part of release 3.26 of the Linux
 
253
This page is part of release 3.27 of the Linux
285
254
.I man-pages
286
255
project.
287
256
A description of the project,