Sponsored Content
Full Discussion: Function open() sets errno
Top Forums Programming Function open() sets errno Post 302827009 by alister on Thursday 27th of June 2013 05:55:59 PM
Old 06-27-2013
The OP should post the operating system they're using and the code for the shortest program which reproduces the behavior (with a printf or two and the output they generate).

For all we know, the determination of "valid handler" is incorrect.

Regards,
Alister
This User Gave Thanks to alister For This Post:
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

function to test if file is open

I need to write a function that will work in sh/ksh shell that will test to see if a file has already been opened for writting by another user has anyone written something like this? (3 Replies)
Discussion started by: johnsonbryce
3 Replies

2. Virtualization and Cloud Computing

Clouds (Partially Order Sets) - Streams (Linearly Ordered Sets) - Part 2

timbass Sat, 28 Jul 2007 10:07:53 +0000 Originally posted in Yahoo! CEP-Interest Here is my follow-up note on posets (partially ordered sets) and tosets (totally or linearly ordered sets) as background set theory for event processing, and in particular CEP and ESP. In my last note, we... (0 Replies)
Discussion started by: Linux Bot
0 Replies

3. UNIX and Linux Applications

(lmgrd) Can't open /usr/tmp/.flexlm/lmgrdl.4081, errno: 24

We are a tool vendor and one of our users is getting this error. The user is using several macrovision(FLEXLM) license enabled products including ours. (lmgrd) Can't open /usr/tmp/.flexlm/lmgrdl.4081, errno: 24 At this time, it stops checking out licenses, and will not respond to query's.... (2 Replies)
Discussion started by: return_user
2 Replies

4. Programming

errno

Hey, Can I assume that for certain function calls, errno can never be set to a certain value. More specifically, can I assume that for if the stat function call fails, the errno can never be or "No space left on device." I am assuming that a read function cannot fail because of no space... (5 Replies)
Discussion started by: the_learner
5 Replies

5. UNIX and Linux Applications

Sybase help: Open client, bcp function

To begin: I use Linux The Problem: I need bcp functionality for scripts. Perl modules, such as Sybase:xfer, require ctlib which comes with Sybase Open Client. Talking with Sybase sales reps is an exercise in futility and hate. They know absolutely nothing about their own products and will... (0 Replies)
Discussion started by: Bubnoff
0 Replies

6. Programming

Open function of sys/stat.h

If a process already has the entire file locked for read and write using newstruct.l_type = F_WRLCK; what would happen if another process would try to open it in read only mode using open(filename, O_RDONLY); ? I want to check if the file exists and I want it to work even if another process has... (4 Replies)
Discussion started by: cyler
4 Replies

7. Shell Programming and Scripting

Help !! perl open function

Help Please perl Gurus, I am trying to add ungrouped passengers in a group and I creating a script however it fails on first step only I tried all the options it returns following error. syntax error at junki line 4, near "open " Execution of junki aborted due to compilation errors. ... (2 Replies)
Discussion started by: dynamax
2 Replies

8. Shell Programming and Scripting

Open file function

Hello all, just a quick little part of code i'm writing to check if the file i'm writing too in my automatic process is not being written too manually. #!/bin/bash FUSER=$(/sbin/fuser -s /toto.tmp >/dev/null 2>&1) LSOF=$(/usr/sbin/lsof | grep -q "toto.tmp") PGREP=$(pgrep -f "toto.tmp" >... (6 Replies)
Discussion started by: maverick72
6 Replies

9. HP-UX

Failed to open tape device /dev/rmt/0mn:Device busy (errno = 16)

Hi, Unable to make tape backup, please help. /opt/ignite/bin/make_tape_recovery -a /dev/rmt/?mn -I -v -m tar -x inc_entire=vg00 * Creating local directories for configuration files and archive. ======= 04/25/16 16:28:08 IST Started /opt/ignite/bin/make_tape_recovery. (Mon... (4 Replies)
Discussion started by: anuragr
4 Replies
SHM_OPEN(3)						     Linux Programmer's Manual						       SHM_OPEN(3)

NAME
shm_open, shm_unlink - Create/open or unlink POSIX shared memory objects SYNOPSIS
#include <sys/types.h> #include <sys/mman.h> void * shm_open(const char *name, int oflag, mode_t mode); int shm_inlink(const char *name); DESCRIPTION
shm_open creates and opens a new, or opens an existing, POSIX shared memory object. A POSIX shared memory object is in effect a handle which can be used by unrelated processes to mmap(2) the same region of shared memory. The shm_unlink function performs the converse opera- tion, removing an object previously created by shm_open. The operation of shm_open is analogous to that of open(2). name specifies the shared memory object to be created or opened. For portable use, name should have an initial slash (/) and contain no embedded slashes. oflag is a bit mask created by ORing together exactly one of O_RDONLY or O_RWDR and any of the other flags listed here: O_RDONLY Open the object for read access. A shared memory object opened in this way can only be mmap(2)ed for read (PROT_READ) access. O_RDWR Open the object for read-write access. O_CREAT Create the shared memory object if it does not exist. The user and group ownership of the object are set as for open(2), and the object's permission bits are set according to the low-order 9 bits of mode, except that those bits set in the process file mode creation mask (see umask(2)) are cleared for the new object. (A set of macro constants which can be used to define mode is listed in open(2).) A new shared memory object initially has zero length - the size of the object can be set using ftruncate(2). (The newly-allo- cated bytes of a shared memory object are automatically initialised to 0.) O_EXCL If O_CREAT was also specified, and a share memory object with the given name already exists, return an error. The check for the existence of the object, and its creation if it does not exist, are performed atomically. O_TRUNC If the shared memory object already exists, truncate it to zero bytes. On successful completion shm_open returns a new file descriptor referring to the shared memory object. This file descriptor is guaranteed to be the lowest-numbered file descriptor not previously opened within the process. The FD_CLOEXEC flag (see fcntl(2)) is set for the file descriptor. The file descriptor is normally used in subsequent calls to ftruncate(2) (for a newly-created object) and mmap(2). After a call to mmap(2) the file descriptor may be closed without affecting the memory mapping. The operation of shm_unlink is analogous to unlink(2): it removes a shared memory object name, and, once all processes have unmapped the object, de-allocates and destroys the contents of the associated memory region. After a successful shm_unlink, attempts to shm_open an object with the same name will fail (unless O_CREAT was specified, in which case a new, distinct object is created). RETURN VALUE
On success, shm_open returns a non-negative file descriptor. On failure, shm_open returns -1. shm_unlink returns 0 on success, or -1 on error. ERRORS
On failure, errno is set to indicate the cause of the error. Values which may appear in errno include the following: EACCES Permission was denied to shm_open name in the specified mode, or O_TRUNC was specified and the caller does not have write permission on the object. EACCES Permission to shm_unlink the shared memory object was denied. EEXIST Both O_CREAT and O_EXCL were specified to shm_open and the shared memory object specified by name already exists. EINVAL The name argument to shm_open was invalid. EMFILE The process already has the maximum number of files open. ENAMETOOLONG The length of name exceeds PATH_MAX. ENFILE The limit on the total number of files open on the system has been reached. ENOENT An attempt was made to shm_open a name that did not exist, and O_CREAT was not specified. ENOENT An attempt was to made to shm_unlink a name that does not exist. NOTES
These functions are provided in glibc 2.2 and later. Programs using these functions must specify the -lrt flag to cc in order to link against the required ("realtime") library. POSIX leaves the behavior of the combination of O_RDONLY and O_TRUNC unspecified. On Linux, this will successfully truncate an existing shared memory object - this may not be so on other Unices. The POSIX shared memory object implementation on Linux 2.4 makes use of a dedicated file system, which is normally mounted under /dev/shm. CONFORMING TO
POSIX 1003.1 (2001). SEE ALSO
mmap(2), open(2), close(2), ftruncate(2), fstat(2), fchown(2), fchmod(2), umask(2), fcntl(2) Linux 2.4 2002-02-22 SHM_OPEN(3)
All times are GMT -4. The time now is 06:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy