revert between 56095 -> 55830 in arch
[AROS.git] / rom / exec / findport.c
blob5cd97e7fc7ca244e88161d429728d66f318616b4
1 /*
2 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Search for a port by name.
6 Lang: english
7 */
8 #include <exec/execbase.h>
9 #include <aros/libcall.h>
10 #include <proto/exec.h>
12 #include "exec_intern.h"
13 #include "exec_debug.h"
15 /*****************************************************************************
17 NAME */
19 AROS_LH1(struct MsgPort *, FindPort,
21 /* SYNOPSIS */
22 AROS_LHA(CONST_STRPTR, name, A1),
24 /* LOCATION */
25 struct ExecBase *, SysBase, 65, Exec)
27 /* FUNCTION
28 Look for a public messageport by name. This function doesn't
29 arbitrate for the port list and must be protected with a Forbid()
30 Permit() pair.
32 INPUTS
33 port - Pointer to NUL terminated C string.
35 RESULT
36 Pointer to struct MsgPort or NULL if there is no port of that name.
38 NOTES
40 EXAMPLE
42 BUGS
44 SEE ALSO
46 INTERNALS
48 ******************************************************************************/
50 AROS_LIBFUNC_INIT
52 struct MsgPort *retVal;
54 /* Nothing spectacular - just look for that name. */
55 #if defined(__AROSEXEC_SMP__)
56 EXEC_SPINLOCK_LOCK(&PrivExecBase(SysBase)->PortListSpinLock, NULL, SPINLOCK_MODE_READ);
57 #endif
58 retVal = (struct MsgPort *)FindName(&SysBase->PortList,name);
59 #if defined(__AROSEXEC_SMP__)
60 EXEC_SPINLOCK_UNLOCK(&PrivExecBase(SysBase)->PortListSpinLock);
61 #endif
63 return retVal;
65 AROS_LIBFUNC_EXIT
66 } /* FindPort */