OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [newlib/] [libc/] [sys/] [linux/] [mq_close.c] - Blame information for rev 258

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 207 jeremybenn
/* Copyright 2002, Red Hat Inc. */
2
 
3
#include <mqueue.h>
4
#include <errno.h>
5
#include <sys/sem.h>
6
#define _LIBC 1
7
#include <sys/lock.h>
8
#undef _LIBC
9
 
10
#include "mqlocal.h"
11
 
12
int
13
mq_close (mqd_t msgid)
14
{
15
  struct libc_mq *info;
16
  struct sembuf sb0 = {0, -1, 0};
17
  int rc;
18
  int semid;
19
 
20
  info = __find_mq (msgid);
21
 
22
  if (info == NULL)
23
    {
24
      errno = EBADF;
25
      return -1;
26
    }
27
 
28
  /* lock message queue */
29
  semid = info->semid;
30
  rc = semop (semid, &sb0, 1);
31
 
32
  if (rc == 0)
33
    {
34
      __cleanup_mq (msgid);
35
 
36
      /* unlock message queue */
37
      sb0.sem_op = 1;
38
      semop (semid, &sb0, 1);
39
    }
40
 
41
  return rc;
42
}
43
 
44
 
45
 
46
 
47
 
48
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.