xref: /aoo42x/main/sal/rtl/source/rtl_process.c (revision 509a48ff)
1647f063dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3647f063dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4647f063dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5647f063dSAndrew Rist  * distributed with this work for additional information
6647f063dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7647f063dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8647f063dSAndrew Rist  * "License"); you may not use this file except in compliance
9647f063dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10647f063dSAndrew Rist  *
11647f063dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12647f063dSAndrew Rist  *
13647f063dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14647f063dSAndrew Rist  * software distributed under the License is distributed on an
15647f063dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16647f063dSAndrew Rist  * KIND, either express or implied.  See the License for the
17647f063dSAndrew Rist  * specific language governing permissions and limitations
18647f063dSAndrew Rist  * under the License.
19647f063dSAndrew Rist  *
20647f063dSAndrew Rist  *************************************************************/
21647f063dSAndrew Rist 
22647f063dSAndrew Rist 
23cdf0e10cSrcweir #include <string.h>
24cdf0e10cSrcweir #include <osl/mutex.h>
25cdf0e10cSrcweir #include <rtl/uuid.h>
26cdf0e10cSrcweir 
27cdf0e10cSrcweir /* rtl_getCommandArg, rtl_getCommandArgCount see cmdargs.cxx  */
28cdf0e10cSrcweir 
rtl_getGlobalProcessId(sal_uInt8 * pTargetUUID)29cdf0e10cSrcweir void SAL_CALL rtl_getGlobalProcessId( sal_uInt8 *pTargetUUID )
30cdf0e10cSrcweir {
31*509a48ffSpfg 	static sal_uInt8 *pUuid = NULL;
32cdf0e10cSrcweir 	if( ! pUuid )
33cdf0e10cSrcweir 	{
34cdf0e10cSrcweir 		osl_acquireMutex( * osl_getGlobalMutex() );
35cdf0e10cSrcweir 		if( ! pUuid )
36cdf0e10cSrcweir 		{
37cdf0e10cSrcweir 			static sal_uInt8 aUuid[16];
38cdf0e10cSrcweir 			rtl_createUuid( aUuid , 0 , sal_False );
39cdf0e10cSrcweir 			pUuid = aUuid;
40cdf0e10cSrcweir 		}
41cdf0e10cSrcweir 		osl_releaseMutex( * osl_getGlobalMutex() );
42cdf0e10cSrcweir 	}
43cdf0e10cSrcweir 	memcpy( pTargetUUID , pUuid , 16 );
44cdf0e10cSrcweir }
45cdf0e10cSrcweir 
46