Sponsored Content
Full Discussion: Errno.h symbols
Operating Systems AIX Errno.h symbols Post 303038378 by topcat on Sunday 1st of September 2019 09:11:17 AM
Old 09-01-2019
Errno.h symbols

Hi, I need to look at a recent copy of /usr/include/errno.h from AIX 7.2 to check some symbols. In particular, I'm curious if it defines EOWNERDEAD and ENOTRECOVERABLE. Can someone who has access to 7.2 please check for me? Thanks!
 

10 More Discussions You Might Find Interesting

1. Programming

Getting errno in a Multithreaded program

In Tru64 Unix, the 'errno' variable is not thread safe. Could anybody help me about how to make it thread safe or how to check 'errno' in a Multithreaded program ???? The Programming process is like this. There are some definite number of threads having their own task. There is one... (2 Replies)
Discussion started by: S.Vishwanath
2 Replies

2. Programming

errno pb

Hello, I need to make a lib with pthread, when I run my make file all is good. But when I run my test program, I test errno in the begining and is already set to 251. Is it normal ??? What can I modify in my Makefile to have errno set to 0 ??? Thanks $make gcc -D_REENTRANT -shared -fpic... (3 Replies)
Discussion started by: dts
3 Replies

3. Programming

Hi errno in sys/stat.h

How should I use errno in a c program and what info does it have . I am working with directories and files. So can any one tell me How to access errno?I am using the stat() function on \etc directory and I am alble to access only the half of the directories.I am not able to access other half and... (6 Replies)
Discussion started by: vijlak
6 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. Programming

does perror() set errno?

here the program gives a odd result: #include <stdio.h> int main(){ perror("first"); perror("next"); return 0; } result: first: Success next: Illegal seek why? any resonable explanation? i found no information about this in man pages. thanks in advance (2 Replies)
Discussion started by: ebd
2 Replies

6. Programming

need help about get errno [ENXIO] for mmap

from mmap manpage I get it's errors discription: The addresses specified by the range [off, off + len) are invalid for filedes. How could I trigger a ENXIO ? anyone can input the code? Lei (3 Replies)
Discussion started by: yanglei_fage
3 Replies

7. Linux

[Errno 256] No more mirrors to try.

Dear all, CentOS 6 After executing "yum update -y" command I am facing this error. Please help me out. thanks in advance. Full error & error code is given as follow: ... (7 Replies)
Discussion started by: saqlain.bashir
7 Replies

8. Programming

Getpwnam_r returning null with errno 25

I am calling getpwnam_r with all proper argument as below:- rv = getpwnam_r(name, result, buffer, buflen); This program runs fine on sol 8/9/10. But on sol 11 it returns NULL with errno set to 25 (#define ENOTTY 25 /* Inappropriate ioctl for device */) All boxes are... (2 Replies)
Discussion started by: Ranajit
2 Replies

9. Programming

Function open() sets errno

I am opening a text file using open() system call in O_RDONLY mode. open() returns me a valid handler but also sets errno to 13 i.e. EACCES(Permission denied). Question is when open() is returning a valid handler then why does it sets the errno? Should not errno be set only in case of error... (10 Replies)
Discussion started by: rupeshkp728
10 Replies

10. UNIX for Dummies Questions & Answers

[Ultrix] /etc/init failed, errno 2

I am running the gxemul software under cygwin, Just when installing the .iso image, I got the error shown in the picture. Any ideas what's happening? Thanks Jack (1 Reply)
Discussion started by: lucky7456969
1 Replies
PTHREAD_MUTEXATTR_SETROBUST(3)				     Linux Programmer's Manual				    PTHREAD_MUTEXATTR_SETROBUST(3)

NAME
pthread_mutexattr_getrobust, pthread_mutexattr_setrobust - get and set the robustness attribute of a mutex attributes object SYNOPSIS
#include <pthread.h> int pthread_mutexattr_getrobust(const pthread_mutexattr_t *attr, int *robustness); int pthread_mutexattr_setrobust(const pthread_mutexattr_t *attr, int robustness); Compile and link with -pthread. Feature Test Macro Requirements for glibc (see feature_test_macros(7)): pthread_mutexattr_getrobust(), pthread_mutexattr_setrobust(): _POSIX_C_SOURCE >= 200809L DESCRIPTION
The pthread_mutexattr_getrobust() function places the value of the robustness attribute of the mutex attributes object referred to by attr in *robustness. The pthread_mutexattr_setrobust() function sets the value of the robustness attribute of the mutex attributes object referred to by attr to the value specified in *robustness. The robustness attribute specifies the behavior of the mutex when the owning thread dies without unlocking the mutex. The following values are valid for robustness: PTHREAD_MUTEX_STALLED This is the default value for a mutex attributes object. If a mutex is initialized with the PTHREAD_MUTEX_STALLED attribute and its owner dies without unlocking it, the mutex remains locked afterwards and any future attempts to call pthread_mutex_lock(3) on the mutex will block indefinitely. PTHREAD_MUTEX_ROBUST If a mutex is initialized with the PTHREAD_MUTEX_ROBUST attribute and its owner dies without unlocking it, any future attempts to call pthread_mutex_lock(3) on this mutex will succeed and return EOWNERDEAD to indicate that the original owner no longer exists and the mutex is in an inconsistent state. Usually after EOWNERDEAD is returned, the next owner should call pthread_mutex_consistent(3) on the acquired mutex to make it consistent again before using it any further. If the next owner unlocks the mutex using pthread_mutex_unlock(3) before making it consistent, the mutex will be permanently unus- able and any subsequent attempts to lock it using pthread_mutex_lock(3) will fail with the error ENOTRECOVERABLE. The only permit- ted operation on such a mutex is pthread_mutex_destroy(3). If the next owner terminates before calling pthread_mutex_consistent(3), further pthread_mutex_lock(3) operations on this mutex will still return EOWNERDEAD. Note that the attr argument of pthread_mutexattr_getrobust() and pthread_mutexattr_setrobust() should refer to a mutex attributes object that was initialized by pthread_mutexattr_init(3), otherwise the behavior is undefined. RETURN VALUE
On success, these functions return 0. On error, they return a positive error number. In the glibc implementation, pthread_mutexattr_getrobust() always return zero. ERRORS
EINVAL A value other than PTHREAD_MUTEX_STALLED or PTHREAD_MUTEX_ROBUST was passed to pthread_mutexattr_setrobust(). VERSIONS
pthread_mutexattr_getrobust() and pthread_mutexattr_setrobust() were added to glibc in version 2.12. CONFORMING TO
POSIX.1-2008. NOTES
In the Linux implementation, when using process-shared robust mutexes, a waiting thread also receives the EOWNERDEAD notification if the owner of a robust mutex performs an execve(2) without first unlocking the mutex. POSIX.1 does not specify this detail, but the same behav- ior also occurs in at least some other implementations. Before the addition of pthread_mutexattr_getrobust() and pthread_mutexattr_setrobust() to POSIX, glibc defined the following equivalent nonstandard functions if _GNU_SOURCE was defined: int pthread_mutexattr_getrobust_np(const pthread_mutexattr_t *attr, int *robustness); int pthread_mutexattr_setrobust_np(const pthread_mutexattr_t *attr, int robustness); Correspondingly, the constants PTHREAD_MUTEX_STALLED_NP and PTHREAD_MUTEX_ROBUST_NP were also defined. These GNU-specific APIs, which first appeared in glibc 2.4, are nowadays obsolete and should not be used in new programs. EXAMPLE
The program below demonstrates the use of the robustness attribute of a mutex attributes object. In this program, a thread holding the mutex dies prematurely without unlocking the mutex. The main thread subsequently acquires the mutex successfully and gets the error EOWN- ERDEAD, after which it makes the mutex consistent. The following shell session shows what we see when running this program: $ ./a.out [original owner] Setting lock... [original owner] Locked. Now exiting without unlocking. [main thread] Attempting to lock the robust mutex. [main thread] pthread_mutex_lock() returned EOWNERDEAD [main thread] Now make the mutex consistent [main thread] Mutex is now consistent; unlocking Program source #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <pthread.h> #include <errno.h> #define handle_error_en(en, msg) do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0) static pthread_mutex_t mtx; static void * original_owner_thread(void *ptr) { printf("[original owner] Setting lock... "); pthread_mutex_lock(&mtx); printf("[original owner] Locked. Now exiting without unlocking. "); pthread_exit(NULL); } int main(int argc, char *argv[]) { pthread_t thr; pthread_mutexattr_t attr; int s; pthread_mutexattr_init(&attr); /* initialize the attributes object */ pthread_mutexattr_setrobust(&attr, PTHREAD_MUTEX_ROBUST); /* set robustness */ pthread_mutex_init(&mtx, &attr); /* initialize the mutex */ pthread_create(&thr, NULL, original_owner_thread, NULL); sleep(2); /* "original_owner_thread" should have exited by now */ printf("[main thread] Attempting to lock the robust mutex. "); s = pthread_mutex_lock(&mtx); if (s == EOWNERDEAD) { printf("[main thread] pthread_mutex_lock() returned EOWNERDEAD "); printf("[main thread] Now make the mutex consistent "); s = pthread_mutex_consistent(&mtx); if (s != 0) handle_error_en(s, "pthread_mutex_consistent"); printf("[main thread] Mutex is now consistent; unlocking "); s = pthread_mutex_unlock(&mtx); if (s != 0) handle_error_en(s, "pthread_mutex_unlock"); exit(EXIT_SUCCESS); } else if (s == 0) { printf("[main thread] pthread_mutex_lock() unexpectedly succeeded "); exit(EXIT_FAILURE); } else { printf("[main thread] pthread_mutex_lock() unexpectedly failed "); handle_error_en(s, "pthread_mutex_lock"); } } SEE ALSO
get_robust_list(2), set_robust_list(2), pthread_mutex_init(3), pthread_mutex_consistent(3), pthread_mutex_lock(3), pthreads(7) Linux 2019-03-06 PTHREAD_MUTEXATTR_SETROBUST(3)
All times are GMT -4. The time now is 08:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy