Sponsored Content
Top Forums Programming Write into shared memory segments Post 302261653 by techlinux on Tuesday 25th of November 2008 09:32:04 AM
Old 11-25-2008
mmap PROT_READ and PROT_WRITE I think would probably work for what you want to do
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Shared memory shortage but lots of unused memory

I am running HP-UX B.11.11. I'm increasing a parameter for a database engine so that it uses more memory to buffer the disk drive (to speed up performance). I have over 5GB of memory not being used. But when I try to start the DB with the increased buffer parameter I get told. "Not... (1 Reply)
Discussion started by: cjcamaro
1 Replies

2. HP-UX

Shared Memory segments

Hello.... AIX has a limit of 11 shared memory segments per process, does any one know how many HP have?? If so how do I find that out?? Thanks in advance...... (2 Replies)
Discussion started by: catwomen
2 Replies

3. Programming

Shared memory in shared library

I need to create a shared library to access an in memory DB. The DB is not huge, but big enough to make it cumbersome to carry around in every single process using the shared library. Luckily, it is pretty static information, so I don't need to worry much about synchronizing the data between... (12 Replies)
Discussion started by: DreamWarrior
12 Replies

4. HP-UX

HP-UX Trying to Understand Shared Memory Segments

I am fairly new to HP-UX and trying to get a better understanding of the operating system. While poking around a bit I find myself questioning whether I should be concerned about Shared Memory segments with missing CPID and LPID? For example: ipcs -mp IPC status from /dev/kmem as of Mon Mar... (2 Replies)
Discussion started by: scotbuff
2 Replies

5. Programming

shared memory read/write using threads

I am looking for C program source code. Could you please help me in finding the source code required mentioned below. program to create multiple threads (one master thread and rest worker threads) and using the threads write into and read from shared memory Restrictions: Only one thread... (2 Replies)
Discussion started by: kumars
2 Replies

6. Programming

Shared memory for shared library

I am writing a shared library in Linux (but compatible with other UNIXes) and I want to allow multiple instances to share a piece of memory -- 1 byte is enough. What's the "best" way to do this? I want to optimize for speed and portability. Obviously, I'll have to worry about mutual exclusion. (0 Replies)
Discussion started by: otheus
0 Replies

7. Programming

C programming - Memory Segments

Can someone tell me how many bytes are allocated for C segments(text,data,heap,stack). (3 Replies)
Discussion started by: nandumishra
3 Replies

8. Programming

Urgent!!!! - Write/read to/from shared memory

I created a shared memory and attached it. I also created the appropriate semaphores to sync. my read/write operations. However I do not know how am I supposed to do so. Anyone has got any ideas? I want to write int the form of 1234:23:444:... where each number between : means something to the... (0 Replies)
Discussion started by: tyron
0 Replies

9. UNIX for Dummies Questions & Answers

Write/Read in Shared memory

I have created and attached a shared memory segment. However I do not know how am I supposed to write and read data from it. I want to save various different data on this segment such as process IDs and other. Do you know how am I supposed to write these and be able to read such data in the correct... (1 Reply)
Discussion started by: tyron
1 Replies

10. Programming

Shared library with acces to shared memory.

Hello. I am new to this forum and I would like to ask for advice about low level POSIX programming. I have to implement a POSIX compliant C shared library. A file will have some variables and the shared library will have some functions which need those variables. There is one special... (5 Replies)
Discussion started by: iamjag
5 Replies
MPROTECT(3P)						     POSIX Programmer's Manual						      MPROTECT(3P)

PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the correspond- ing Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. NAME
mprotect - set protection of memory mapping SYNOPSIS
#include <sys/mman.h> int mprotect(void *addr, size_t len, int prot); DESCRIPTION
The mprotect() function shall change the access protections to be that specified by prot for those whole pages containing any part of the address space of the process starting at address addr and continuing for len bytes. The parameter prot determines whether read, write, exe- cute, or some combination of accesses are permitted to the data being mapped. The prot argument should be either PROT_NONE or the bitwise- inclusive OR of one or more of PROT_READ, PROT_WRITE, and PROT_EXEC. If an implementation cannot support the combination of access types specified by prot, the call to mprotect() shall fail. An implementation may permit accesses other than those specified by prot; however, no implementation shall permit a write to succeed where PROT_WRITE has not been set or shall permit any access where PROT_NONE alone has been set. Implementations shall support at least the fol- lowing values of prot: PROT_NONE, PROT_READ, PROT_WRITE, and the bitwise-inclusive OR of PROT_READ and PROT_WRITE. If PROT_WRITE is speci- fied, the application shall ensure that it has opened the mapped objects in the specified address range with write permission, unless MAP_PRIVATE was specified in the original mapping, regardless of whether the file descriptors used to map the objects have since been closed. The implementation shall require that addr be a multiple of the page size as returned by sysconf(). The behavior of this function is unspecified if the mapping was not established by a call to mmap(). When mprotect() fails for reasons other than [EINVAL], the protections on some of the pages in the range [addr,addr+len) may have been changed. RETURN VALUE
Upon successful completion, mprotect() shall return 0; otherwise, it shall return -1 and set errno to indicate the error. ERRORS
The mprotect() function shall fail if: EACCES The prot argument specifies a protection that violates the access permission the process has to the underlying memory object. EAGAIN The prot argument specifies PROT_WRITE over a MAP_PRIVATE mapping and there are insufficient memory resources to reserve for locking the private page. EINVAL The addr argument is not a multiple of the page size as returned by sysconf(). ENOMEM Addresses in the range [addr,addr+len) are invalid for the address space of a process, or specify one or more pages which are not mapped. ENOMEM The prot argument specifies PROT_WRITE on a MAP_PRIVATE mapping, and it would require more space than the system is able to supply for locking the private pages, if required. ENOTSUP The implementation does not support the combination of accesses requested in the prot argument. The following sections are informative. EXAMPLES
None. APPLICATION USAGE
The [EINVAL] error above is marked EX because it is defined as an optional error in the POSIX Realtime Extension. RATIONALE
None. FUTURE DIRECTIONS
None. SEE ALSO
mmap(), sysconf(), the Base Definitions volume of IEEE Std 1003.1-2001, <sys/mman.h> COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . IEEE
/The Open Group 2003 MPROTECT(3P)
All times are GMT -4. The time now is 04:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy