Sponsored Content
Full Discussion: noob error quesion
Top Forums Programming noob error quesion Post 302512842 by mellowcandle on Monday 11th of April 2011 05:13:32 PM
Old 04-11-2011
noob error quesion

Hey, I a newbie in unix programming.

I type the following command
if ((configfd = open(CONFIGFILE, O_CREAT | O_WRONLY)) == -1)

and the result I get from open is -1, which means error.
how can I figure out the cause of the error ?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Another "green horn" quesion.

I have read this thread : http://forums.unix.com/showthread.php?threadid=75 Which was very informative, but I still have a question or two. I am getting ready to put a box together and put UNIX on it so when I buy the first two books listed I can start practicing. That said, what version of... (2 Replies)
Discussion started by: ICE
2 Replies

2. Solaris

pam module quesion

quick question about PAM module. Here may pam.conf file. How do I verify that pam modules work correctly? Does it mean when it run cron job, it checks the pam module for authentication? Thanks in advance. # passwd auth required pam_passwd_auth.so.1 # # cron service (explicit... (0 Replies)
Discussion started by: mokkan
0 Replies

3. UNIX for Dummies Questions & Answers

FreeBSD filesystem is full error by Noob

Hello, Max here, I have installed FreeBSD on a compaq Intel box an have filesystem problems. I am now on install number 3 and encounter the same error. This time after DL the ports list and DL a number of programs the DL stopped and I got an error message that the filesystem is full I am looking... (6 Replies)
Discussion started by: madMax8911
6 Replies

4. Linux

noob help needed

i'm having trouble putting together a program :( any help would be much appreciated! Write a Shell Program to automate the process of collecting assignments from the directories of students of any specified class. The person running the program should be able to pass a parameter to the... (1 Reply)
Discussion started by: ace_face
1 Replies

5. Solaris

xterm quesion

Can we throw a window from solaris to Linux redhat? (1 Reply)
Discussion started by: mokkan
1 Replies

6. Shell Programming and Scripting

another quesion to merge file

hi experts yesterday, I asked a question that is very like today's quesion, I think this one will be more difficult than yesterday, I really want to get the answer so I post here again file1 arch : x86 install : pass make os : pass make build kernel : pass=100 failed=45 ... (0 Replies)
Discussion started by: yanglei_fage
0 Replies

7. Shell Programming and Scripting

I suspect a simple quesion

I bet this is really simple but I can only find silly long solutions. Im trying to read the second word of each line in a file and pipe it out, in Win32 it looks something like: for /F "tokens=2" %%b in (file.txt) do etc.. Sorry for the probably dumbass question! (1 Reply)
Discussion started by: joe19oo.c
1 Replies

8. Shell Programming and Scripting

Noob: Syntax error near unexpected token 'else'

Hi guys, Completely new to all this and finding it soooooooo hard. Any help appreciated. The idea is to check a list of .conf files and maintain a hash, if it does not match its hash it needs to do some more stuff, but I can't even get this first bit sorted... No idea if any of this is right.... (5 Replies)
Discussion started by: Jandiedonkerman
5 Replies

9. HP-UX

Anybody wants to help a complete Noob?

Hello there, first post here so go easy on me! :D I just aquired an old HP 9000 Dclass d220 server, all I know is that it's running HP-UX, and it appears to boot fine (I see the modules loading, etc..) Now, I have been an MS guy all my life (yeah I know, make fun of me), so I really have no... (9 Replies)
Discussion started by: Marvio
9 Replies

10. Shell Programming and Scripting

Cron-Noob

Hi guys! Consider the following PERL script, #!/usr/bin/perl my $userID = `whoami`; open(TMP, ">user.txt"); print TMP "$userID"; close(TMP); Run on the command line it works no problem. Run using crontab it doesn't work. Where do I go to check errors from crontab? I've read things... (25 Replies)
Discussion started by: Jaymoney
25 Replies
mq_open(3RT)															      mq_open(3RT)

NAME
mq_open - open a message queue SYNOPSIS
cc [ flag... ] file... -lrt [ library... ] #include <mqueue.h> mqd_t mq_open(const char *name, int oflag, /* unsigned long mode, mq_attr attr */ ...); The mq_open() function establishes the connection between a process and a message queue with a message queue descriptor. It creates a open message queue description that refers to the message queue, and a message queue descriptor that refers to that open message queue descrip- tion. The message queue descriptor is used by other functions to refer to that message queue. The name argument points to a string naming a message queue. The name argument must conform to the construction rules for a path-name. If name is not the name of an existing message queue and its creation is not requested, mq_open() fails and returns an error. The first char- acter of name must be a slash (/) character and the remaining characters of name cannot include any slash characters. For maximum portability, name should include no more than 14 characters, but this limit is not enforced. The oflag argument requests the desired receive and/or send access to the message queue. The requested access permission to receive mes- sages or send messages is granted if the calling process would be granted read or write access, respectively, to a file with the equivalent permissions. The value of oflag is the bitwise inclusive OR of values from the following list. Applications must specify exactly one of the first three values (access modes) below in the value of oflag: O_RDONLY Open the message queue for receiving messages. The process can use the returned message queue descriptor with mq_receive(3RT), but not mq_send(3RT). A message queue may be open multiple times in the same or different processes for receiving messages. O_WRONLY Open the queue for sending messages. The process can use the returned message queue descriptor with mq_send(3RT) but not mq_receive(3RT). A message queue may be open multiple times in the same or different processes for sending messages. O_RDWR Open the queue for both receiving and sending messages. The process can use any of the functions allowed for O_RDONLY and O_WRONLY. A message queue may be open multiple times in the same or different processes for sending messages. Any combination of the remaining flags may additionally be specified in the value of oflag: O_CREAT This option is used to create a message queue, and it requires two additional arguments: mode, which is of type mode_t, and attr, which is pointer to a mq_attr structure. If the pathname, name, has already been used to create a message queue that still exists, then this flag has no effect, except as noted under O_EXCL (see below). Otherwise, a message queue is created without any messages in it. The user ID of the message queue is set to the effective user ID of process, and the group ID of the message queue is set to the effective group ID of the process. The file permission bits are set to the value of mode, and modified by clearing all bits set in the file mode creation mask of the process (see umask(2)). If attr is non-NULL and the calling process has the appropriate privilege on name, the message queue mq_maxmsg and mq_msg- size attributes are set to the values of the corresponding members in the mq_attr structure referred to by attr. If attr is non-NULL, but the calling process does not have the appropriate privilege on name, the mq_open() function fails and returns an error without creating the message queue. O_EXCL If both O_EXCL and O_CREAT are set, mq_open() will fail if the message queue name exists. The check for the existence of the message queue and the creation of the message queue if it does not exist are atomic with respect to other processes executing mq_open() naming the same name with both O_EXCL and O_CREAT set. If O_EXCL and O_CREAT are not set, the result is undefined. O_NONBLOCK The setting of this flag is associated with the open message queue description and determines whether a mq_send(3RT) or mq_receive(3RT) waits for resources or messages that are not currently available, or fails with errno set to EAGAIN. See mq_send(3RT) and mq_receive(3RT) for details. Upon successful completion, mq_open() returns a message queue descriptor; otherwise the function returns (mqd_t)-1 and sets errno to indi- cate the error condition. The mq_open() function will fail if: EACCES The message queue exists and the permissions specified by oflag are denied, or the message queue does not exist and permission to create the message queue is denied. EEXIST O_CREAT and O_EXCL are set and the named message queue already exists. EINTR The mq_open() operation was interrupted by a signal. EINVAL The mq_open() operation is not supported for the given name, or O_CREAT was specified in oflag, the value of attr is not NULL, and either mq_maxmsg or mq_msgsize was less than or equal to zero. EMFILE The number of open message queue descriptors in this process exceeds MQ_OPEN_MAX, of the number of open file descriptors in this process exceeds OPEN_MAX. ENAMETOOLONG The length of the name string exceeds PATH_MAX, or a pathname component is longer than NAME_MAX while _POSIX_NO_TRUNC is in effect. ENFILE Too many message queues are currently open in the system. ENOENT O_CREAT is not set and the named message queue does not exist. ENOSPC There is insufficient space for the creation of the new message queue. ENOSYS The mq_open() function is not supported by the system. See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ exec(2), exit(2), umask(2), sysconf(3C), mqueue.h(3HEAD), mq_close(3RT), mq_receive(3RT), mq_send(3RT), mq_setattr(3RT), mq_unlink(3RT), attributes(5), standards(5) Due to the manner in which message queues are implemented, they should not be considered secure and should not be used in security-sensi- tive applications. Solaris 2.6 was the first release to support the Asynchronous Input and Output option. Prior to this release, this function always returned -1 and set errno to ENOSYS. 28 Jun 2002 mq_open(3RT)
All times are GMT -4. The time now is 03:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy