2014-01-01 11:03:15 +00:00
|
|
|
/* Copyright (C) 2004-2014 Free Software Foundation, Inc.
|
2004-04-13 02:15:43 +00:00
|
|
|
This file is part of the GNU C Library.
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-02-09 23:18:22 +00:00
|
|
|
License along with the GNU C Library; if not, see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
2004-04-13 02:15:43 +00:00
|
|
|
|
|
|
|
#include <errno.h>
|
|
|
|
#include <mqueue.h>
|
|
|
|
#include <sysdep.h>
|
|
|
|
|
|
|
|
#ifdef __NR_mq_unlink
|
|
|
|
|
|
|
|
/* Remove message queue named NAME. */
|
|
|
|
int
|
|
|
|
mq_unlink (const char *name)
|
|
|
|
{
|
|
|
|
if (name[0] != '/')
|
|
|
|
{
|
|
|
|
__set_errno (EINVAL);
|
|
|
|
return -1;
|
|
|
|
}
|
2004-04-19 17:28:57 +00:00
|
|
|
|
2004-04-20 04:31:12 +00:00
|
|
|
INTERNAL_SYSCALL_DECL (err);
|
|
|
|
int ret = INTERNAL_SYSCALL (mq_unlink, err, 1, name + 1);
|
2004-04-19 17:28:57 +00:00
|
|
|
|
|
|
|
/* While unlink can return either EPERM or EACCES, mq_unlink should
|
|
|
|
return just EACCES. */
|
2014-02-10 13:45:42 +00:00
|
|
|
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (ret, err)))
|
2004-04-20 04:31:12 +00:00
|
|
|
{
|
|
|
|
ret = INTERNAL_SYSCALL_ERRNO (ret, err);
|
|
|
|
if (ret == EPERM)
|
|
|
|
ret = EACCES;
|
|
|
|
__set_errno (ret);
|
|
|
|
ret = -1;
|
|
|
|
}
|
2004-04-19 17:28:57 +00:00
|
|
|
|
|
|
|
return ret;
|
2004-04-13 02:15:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
2005-12-15 21:13:14 +00:00
|
|
|
# include <rt/mq_unlink.c>
|
2004-04-13 02:15:43 +00:00
|
|
|
#endif
|