QlgSem_unlink()--Unlink Named Semaphore (using NLS-enabled path name)
Syntax
#include <semaphore.h> #include <qlg.h> int QlgSem_unlink(const Qlg_Path_Name_T *name);
Service Program Name: QP0ZPSEM
Default Public Authority: *USE
Threadsafe: Yes
The QlgSem_unlink() function, like the sem_unlink() function, unlinks a named semaphore. The QlgSem_unlink() function takes a pointer to a Qlg_Path_Name_T structure, while the sem_unlink() function takes a pointer to a character string.
Limited information about the name parameter is provided in this API. For additional information about the name parameter, authorities required, return values, and related information, see sem_unlink()--Unlink Named Semaphore.
Parameters
- name
- (Input) A pointer a Qlg_Path_Name_T structure that contains a path name or a pointer to a path name of the semaphore to be unlinked. For more information on the Qlg_Path_Name_T structure, see Path name format.
Error Conditions
If QlgSem_unlink() is not successful, errno usually indicates the following error or one of the errors identified in sem_unlink()--Unlink Named Semaphore.
- [ECONVERT]
- A conversion error for the parameter name.
Related Information
- The <qlg.h> file (see Header
Files for UNIX®-Type Functions)
- sem_unlink()--Unlink Named Semaphore
- QlgSem_open()--Open Named Semaphore (using
NLS-enabled path name)
- QlgSem_open_np()--Open Named Semaphore with Maximum Value (using NLS-enabled path name)
Note: All of the related information for sem_unlink() applies to QlgSem_unlink(). See Related Information in sem_unlink().
Example
The following example unlinks the named semaphore "/mysem".
Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.
#include <semaphore.h>
#include <qlg.h>
main() {
int rc;
#define mypath "/mysem"
const char US_const[3]= "US";
const char Language_const[4]="ENU";
const char Path_Name_Del_const[2]= "/";
typedef struct pnstruct
{
Qlg_Path_Name_T qlg_struct;
char[100] pn; /* This size must be >= the path */
/* name length or be a pointer */
/* to the path name. */
};
struct pnstruct path;
/***************************************************************/
/* Initialize Qlg_Path_Name_T parameters */
/***************************************************************/
memset((void*)path name, 0x00, sizeof(struct pnstruct));
path.qlg_struct.CCSID = 37;
memcpy(path.qlg_struct.Country_ID,US_const,2);
memcpy(path.qlg_struct.Language_ID,Language_const,3);
path.qlg_struct.Path_Type = QLG_CHAR_SINGLE;
path.qlg_struct.Path_Length = sizeof(mypath)-1;
memcpy(path.qlg_struct.Path_Name_Delimiter,Path_Name_Del_const,1);
memcpy(path.pn,mypath,sizeof(mypath));
rc = QlgSem_unlink((Qlg_Path_Name_T *)path name);
}
API introduced: V5R1