2014-09-22 17:29:37 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* include/sys/shm.h
|
|
|
|
*
|
2021-02-03 11:33:49 +01:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2014-09-22 17:29:37 +02:00
|
|
|
*
|
2021-02-03 11:33:49 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2014-09-22 17:29:37 +02:00
|
|
|
*
|
2021-02-03 11:33:49 +01:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2014-09-22 17:29:37 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __INCLUDE_SYS_SHM_H
|
|
|
|
#define __INCLUDE_SYS_SHM_H
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/ipc.h>
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
/****************************************************************************
|
2015-02-16 21:29:43 +01:00
|
|
|
* Pre-processor Definitions
|
2014-09-22 17:29:37 +02:00
|
|
|
****************************************************************************/
|
2021-02-03 09:42:38 +01:00
|
|
|
|
2014-09-23 16:46:31 +02:00
|
|
|
/* Definitions required by POSIX */
|
2014-09-22 17:29:37 +02:00
|
|
|
|
|
|
|
#define SHM_RDONLY 0x01 /* Attach read-only (else read-write) */
|
2014-09-22 22:53:56 +02:00
|
|
|
#define SHM_RND 0x02 /* Round attach address to SHMLBA */
|
2014-09-22 17:29:37 +02:00
|
|
|
|
2023-11-20 07:23:14 +01:00
|
|
|
#define SHM_R 0x03 /* or S_IRUGO */
|
|
|
|
#define SHM_W 0x04 /* or S_IWUGO */
|
|
|
|
#define SHM_HUGETLB 0x05 /* segment will use huge TLB pages */
|
|
|
|
|
2014-09-22 17:29:37 +02:00
|
|
|
/* Segment low boundary address multiple */
|
|
|
|
|
|
|
|
#ifdef CONFIG_SHM_SHMLBA
|
|
|
|
# define SHMLBA CONFIG_SHM_SHMLBA
|
|
|
|
#else
|
|
|
|
# define SHMLBA 0x0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Type Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/* Unsigned integer used for the number of current attaches that must be
|
|
|
|
* able to store values at least as large as a type unsigned short.
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef unsigned short shmatt_t;
|
|
|
|
|
|
|
|
struct shmid_ds
|
|
|
|
{
|
|
|
|
struct ipc_perm shm_perm; /* Operation permission structure */
|
|
|
|
size_t shm_segsz; /* Size of segment in bytes */
|
|
|
|
pid_t shm_lpid; /* Process ID of last shared memory operation */
|
|
|
|
pid_t shm_cpid; /* Process ID of creator */
|
|
|
|
shmatt_t shm_nattch; /* Number of current attaches */
|
|
|
|
time_t shm_atime; /* Time of last shmat() */
|
|
|
|
time_t shm_dtime; /* Time of last shmdt() */
|
|
|
|
time_t shm_ctime; /* Time of last change by shmctl() */
|
|
|
|
};
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Data
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#undef EXTERN
|
|
|
|
#if defined(__cplusplus)
|
|
|
|
#define EXTERN extern "C"
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#else
|
|
|
|
#define EXTERN extern
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Function Prototypes
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
FAR void *shmat(int shmid, FAR const void *shmaddr, int shmflg);
|
|
|
|
int shmctl(int shmid, int cmd, FAR struct shmid_ds *buf);
|
|
|
|
int shmdt(FAR const void *shmaddr);
|
|
|
|
int shmget(key_t key, size_t size, int shmflg);
|
|
|
|
|
|
|
|
#undef EXTERN
|
|
|
|
#if defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __INCLUDE_SYS_SHM_H */
|