source: rtems/cpukit/posix/src/semaphorenametoid.c @ 92f4671

4.104.115
Last change on this file since 92f4671 was 74d0cb44, checked in by Joel Sherrill <joel.sherrill@…>, on 01/31/08 at 16:15:34

2008-01-31 Joel Sherrill <joel.sherrill@…>

  • posix/src/cond.c, posix/src/key.c, posix/src/mqueuenametoid.c, posix/src/mutex.c, posix/src/pbarrier.c, posix/src/prwlock.c, posix/src/pspin.c, posix/src/pthread.c, posix/src/ptimer.c, posix/src/semaphorenametoid.c: Add option for all POSIX objects whether named or unnamed to have a string name. If the API does not directly support having a name, then the user must explicitly assign it using rtems_object_set_name().
  • rtems/src/rtemsobjectgetapiclassname.c: Improved testability.
  • score/include/rtems/score/object.h, score/src/objectgetnameasstring.c, score/src/objectnametoidstring.c, score/src/objectsetname.c: Modifications required to pass testing of recently modified object name operations. Also eliminated multiprocessing related code that was not reachable.
  • Property mode set to 100644
File size: 1.1 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2007.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#if HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <stdarg.h>
17
18#include <errno.h>
19#include <fcntl.h>
20#include <pthread.h>
21#include <semaphore.h>
22#include <limits.h>
23
24#include <rtems/system.h>
25#include <rtems/score/object.h>
26#include <rtems/posix/semaphore.h>
27#include <rtems/posix/time.h>
28#include <rtems/seterr.h>
29
30/*PAGE
31 *
32 *  _POSIX_Semaphore_Name_to_id
33 *
34 *  Look up the specified name and attempt to locate the id
35 *  for the associated semaphore.
36 */
37
38int _POSIX_Semaphore_Name_to_id(
39  const char          *name,
40  sem_t          *id
41)
42{
43  Objects_Name_or_id_lookup_errors  status;
44
45   if ( !name )
46     return EINVAL;
47
48  if ( !name[0] )
49    return EINVAL;
50
51  status = _Objects_Name_to_id_string(
52    &_POSIX_Semaphore_Information, name, (Objects_Id*)id );
53
54  if ( status == OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL )
55    return 0;
56
57  return ENOENT;
58}
Note: See TracBrowser for help on using the repository browser.