| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | .\" $NetBSD: mq.3,v 1.1 2010/06/07 07:11:28 jruoho Exp $ | | 1 | .\" $NetBSD: mq.3,v 1.2 2010/06/07 07:39:43 jruoho Exp $ |
2 | .\" | | 2 | .\" |
3 | .\" Copyright (c) 2010 Jukka Ruohonen <jruohonen@iki.fi> | | 3 | .\" Copyright (c) 2010 Jukka Ruohonen <jruohonen@iki.fi> |
4 | .\" | | 4 | .\" |
5 | .\" Redistribution and use in source and binary forms, with or without | | 5 | .\" Redistribution and use in source and binary forms, with or without |
6 | .\" modification, are permitted provided that the following conditions | | 6 | .\" modification, are permitted provided that the following conditions |
7 | .\" are met: | | 7 | .\" are met: |
8 | .\" 1. Redistributions of source code must retain the above copyright | | 8 | .\" 1. Redistributions of source code must retain the above copyright |
9 | .\" notice, this list of conditions and the following disclaimer. | | 9 | .\" notice, this list of conditions and the following disclaimer. |
10 | .\" 2. Redistributions in binary form must reproduce the above copyright | | 10 | .\" 2. Redistributions in binary form must reproduce the above copyright |
11 | .\" notice, this list of conditions and the following disclaimer in the | | 11 | .\" notice, this list of conditions and the following disclaimer in the |
12 | .\" documentation and/or other materials provided with the distribution. | | 12 | .\" documentation and/or other materials provided with the distribution. |
13 | .\" | | 13 | .\" |
14 | .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | | 14 | .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS |
| @@ -216,29 +216,26 @@ an error is returned if a message larger | | | @@ -216,29 +216,26 @@ an error is returned if a message larger |
216 | .Va mq_msgsize | | 216 | .Va mq_msgsize |
217 | is sent, and if the message queue is already full, as determined by | | 217 | is sent, and if the message queue is already full, as determined by |
218 | .Va mq_maxmsg , | | 218 | .Va mq_maxmsg , |
219 | the call to queue a message will either block or error out. | | 219 | the call to queue a message will either block or error out. |
220 | .Pp | | 220 | .Pp |
221 | Although there are two functions, | | 221 | Although there are two functions, |
222 | .Fn mq_getattr | | 222 | .Fn mq_getattr |
223 | and | | 223 | and |
224 | .Fn mq_setattr , | | 224 | .Fn mq_setattr , |
225 | to retrieve and set attributes once | | 225 | to retrieve and set attributes once |
226 | the message queue has been created, | | 226 | the message queue has been created, |
227 | the resource limits cannot be changed | | 227 | the resource limits cannot be changed |
228 | by an user once the queue has been created. | | 228 | by an user once the queue has been created. |
229 | .\" The super user can however control the limits via few | | | |
230 | .\" .Xr sysctl 7 | | | |
231 | .\" variables. | | | |
232 | To avoid blocking in case the maximum number of messages has been reached, the | | 229 | To avoid blocking in case the maximum number of messages has been reached, the |
233 | .Dv O_NONBLOCK | | 230 | .Dv O_NONBLOCK |
234 | flag can be set as an argument to | | 231 | flag can be set as an argument to |
235 | .Fn mq_open . | | 232 | .Fn mq_open . |
236 | .Ss Asynchronous Notification | | 233 | .Ss Asynchronous Notification |
237 | Instead of blocking in the functions that receive messages, | | 234 | Instead of blocking in the functions that receive messages, |
238 | .Nm | | 235 | .Nm |
239 | offers an asynchronous mechanism for a process to receive | | 236 | offers an asynchronous mechanism for a process to receive |
240 | notifications that messages are available in the message queue. | | 237 | notifications that messages are available in the message queue. |
241 | The function | | 238 | The function |
242 | .Fn mq_notify | | 239 | .Fn mq_notify |
243 | is used to register for notification. | | 240 | is used to register for notification. |
244 | Either a signal or a thread can be used as the type of notification; see | | 241 | Either a signal or a thread can be used as the type of notification; see |
| @@ -281,81 +278,42 @@ principle. | | | @@ -281,81 +278,42 @@ principle. |
281 | .Pp | | 278 | .Pp |
282 | The basic rule of thumb with realtime prioritization is that low priority | | 279 | The basic rule of thumb with realtime prioritization is that low priority |
283 | tasks should never unnecessarily delay high priority tasks. | | 280 | tasks should never unnecessarily delay high priority tasks. |
284 | Priority inheritance is not however part of the provided | | 281 | Priority inheritance is not however part of the provided |
285 | .Tn API . | | 282 | .Tn API . |
286 | The receiver process may run at low priority even | | 283 | The receiver process may run at low priority even |
287 | when receiving high priority messages. | | 284 | when receiving high priority messages. |
288 | To address this limitation and other potential realtime problems, | | 285 | To address this limitation and other potential realtime problems, |
289 | the user may consider other functions from the | | 286 | the user may consider other functions from the |
290 | .Lb librt . | | 287 | .Lb librt . |
291 | The process scheduling interface described in | | 288 | The process scheduling interface described in |
292 | .Xr sched 3 | | 289 | .Xr sched 3 |
293 | can be mentioned as an example. | | 290 | can be mentioned as an example. |
294 | .\" | | | |
295 | .\" XXX: Move this to sysctl(7). | | | |
296 | .\" | | | |
297 | .\" .Sh SYSCTL | | | |
298 | .\" The | | | |
299 | .\" .Nx | | | |
300 | .\" implementation defines few | | | |
301 | .\" .Xr sysctl 8 | | | |
302 | .\" variables available for the superuser. | | | |
303 | .\" .Bl -tag -width "kern.mq_max_msgsize "-offset indent | | | |
304 | .\" .It kern.posix_msg | | | |
305 | .\" The version of the | | | |
306 | .\" .Tn POSIX | | | |
307 | .\" standard to which the system attempts | | | |
308 | .\" to conform with respect to the message queues. | | | |
309 | .\" .It kern.mq_open_max | | | |
310 | .\" The maximum number of message queue descriptors | | | |
311 | .\" that any process is able to open. | | | |
312 | .\" .It kern.mq_prio_max | | | |
313 | .\" The maximum priority of any message. | | | |
314 | .\" .It kern.mq_max_msgsize | | | |
315 | .\" The maximum size of any message. | | | |
316 | .\" .It kern.mq_def_maxmsg | | | |
317 | .\" The default number of messages in a message queue. | | | |
318 | .\" .El | | | |
319 | .Sh FUNCTIONS | | 291 | .Sh FUNCTIONS |
320 | The following functions are available in the | | 292 | The following functions are available in the |
321 | .Tn API. | | 293 | .Tn API. |
322 | .Bl -column -offset indent "mq_timedreceive " "XXX" | | 294 | .Bl -column -offset indent "mq_timedreceive " "XXX" |
323 | .It Sy Function Ta Sy Description | | 295 | .It Sy Function Ta Sy Description |
324 | .It Xr mq_open 3 Ta open a message queue | | 296 | .It Xr mq_open 3 Ta open a message queue |
325 | .It Xr mq_close 3 Ta close a message queue | | 297 | .It Xr mq_close 3 Ta close a message queue |
326 | .It Xr mq_unlink 3 Ta remove a message queue | | 298 | .It Xr mq_unlink 3 Ta remove a message queue |
327 | .It Xr mq_send 3 Ta send a message | | 299 | .It Xr mq_send 3 Ta send a message |
328 | .It Xr mq_receive 3 Ta receive a message | | 300 | .It Xr mq_receive 3 Ta receive a message |
329 | .It Xr mq_timedsend 3 Ta send a message with a timeout | | 301 | .It Xr mq_timedsend 3 Ta send a message with a timeout |
330 | .It Xr mq_timedreceive 3 Ta receive a message with a timeout | | 302 | .It Xr mq_timedreceive 3 Ta receive a message with a timeout |
331 | .It Xr mq_getattr 3 Ta get message queue attributes | | 303 | .It Xr mq_getattr 3 Ta get message queue attributes |
332 | .It Xr mq_setattr 3 Ta set message queue attributes | | 304 | .It Xr mq_setattr 3 Ta set message queue attributes |
333 | .It Xr mq_notify 3 Ta register asynchronous notify | | 305 | .It Xr mq_notify 3 Ta register asynchronous notify |
334 | .El | | 306 | .El |
335 | .\" | | | |
336 | .\" XXX: Fill this with fileops? | | | |
337 | .\" | | | |
338 | .\" .In addition, the | | | |
339 | .\" .Nx | | | |
340 | .\" implementation allows the following standard | | | |
341 | .\" .Tn I/O | | | |
342 | .\" and file manipulation calls to be used with message queues: | | | |
343 | .\" The following functions are available in the | | | |
344 | .\" .Tn API. | | | |
345 | .\" .Bl -column -offset indent "mq_timedreceive " "XXX" | | | |
346 | .\" .It Sy Function Ta Sy Description | | | |
347 | .\" .It Xr ... | | | |
348 | .\" .El | | | |
349 | .Sh COMPATIBILITY | | 307 | .Sh COMPATIBILITY |
350 | Despite of some early fears, the | | 308 | Despite of some early fears, the |
351 | .Tn POSIX | | 309 | .Tn POSIX |
352 | message queue implementations are fairly compatible with each other. | | 310 | message queue implementations are fairly compatible with each other. |
353 | Nevertheless, few points can be noted for portable applications. | | 311 | Nevertheless, few points can be noted for portable applications. |
354 | .Bl -bullet | | 312 | .Bl -bullet |
355 | .It | | 313 | .It |
356 | It is not portable to use functions external to the | | 314 | It is not portable to use functions external to the |
357 | .Tn API | | 315 | .Tn API |
358 | with message queue descriptors. | | 316 | with message queue descriptors. |
359 | .It | | 317 | .It |
360 | The standard leaves the rules loose with | | 318 | The standard leaves the rules loose with |
361 | respect to the message queue names. | | 319 | respect to the message queue names. |