source: rtems/cpukit/posix/src/semaphorenametoid.c @ 3bacb250

4.104.115
Last change on this file since 3bacb250 was 3507c6df, checked in by Joel Sherrill <joel.sherrill@…>, on 01/05/09 at 20:26:01

2009-01-05 Joel Sherrill <joel.sherrill@…>

  • libcsupport/src/gxx_wrappers.c, posix/include/mqueue.h, posix/include/rtems/posix/semaphore.h, posix/inline/rtems/posix/barrier.inl, posix/inline/rtems/posix/key.inl, posix/inline/rtems/posix/mqueue.inl, posix/inline/rtems/posix/rwlock.inl, posix/inline/rtems/posix/semaphore.inl, posix/inline/rtems/posix/spinlock.inl, posix/inline/rtems/posix/timer.inl, posix/src/condget.c, posix/src/mqueuenametoid.c, posix/src/mutexget.c, posix/src/semaphorenametoid.c, posix/src/semopen.c, sapi/src/itronapi.c, sapi/src/posixapi.c: Make changes necessary for all tests to run on SPARC with 16-bit Ids. This required ensuring that all POSIX and compilering binding code makes a distinction between the public Id type (e.g. pthread_t, etc.) and the RTEMS Object_Id type. All POSIX Object Get routines should not take the POSIX Id type as the argument. Sixteen bit RTEMS Ids should be placed into the 32-bits reserved by the POSIX API type in a uniform manner now. This removed all assumptions that the external Id types in POSIX and ITRON are the same as the internal Object Id type.
  • Property mode set to 100644
File size: 1.2 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  Objects_Id                        the_id;
45
46   if ( !name )
47     return EINVAL;
48
49  if ( !name[0] )
50    return EINVAL;
51
52  status = _Objects_Name_to_id_string(
53    &_POSIX_Semaphore_Information,
54    name,
55    &the_id
56  );
57  *id = the_id;
58
59  if ( status == OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL )
60    return 0;
61
62  return ENOENT;
63}
Note: See TracBrowser for help on using the repository browser.