Linux Red Hat. I've build it also on openvms alpha 8.3. May be I can check it on a small example, where a stack corruption will be practically impossible.
---------- Post updated at 05:25 AM ---------- Previous update was at 04:44 AM ----------
So the experiment:
1. Without copying main.c Result:
$ ./a.out
123 - 321
Segmentation fault
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)
Hi all,
Well I've had a bit more experience with Unix-like environments since my last post, now that I have started working on my website in earnest and am doing much of the file manipulation via the command line through SSH.
The thing is, I want to be able to log all console activity,... (4 Replies)
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)
I am trying to figure a way to have a log file and still keep the output in the terminal in a script.
The example below logs to a file nicely but i still want the output in the terminal as well
#!/bin/bash
#Create a log
exec >> /path/to/my/logfile
echo "hello world"
Any help would be... (3 Replies)
We are trying to install third party software on this unix server...
Here is the error message we are getting...
error while loading shared libraries: libodbc.so.1: cannot open shared object file: No such file or directory
It seems like odbc driver is not installed...
>rpm -q unixODBC... (1 Reply)
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)
Hi,
I've the following code to log the errors any after the command is executed.
# Ksh 88 Version
log_path=/home/etc/fls/fls_log.log
del_path=/home/etc/fls/to_day
rm $del_path/* >> $log_path 2>&1
But I even want to log if the rm command is success without any error along with... (1 Reply)
When unlocking a Linux server's console there's no event indicating successful logging
Is there a way I can fix this ?
I have the following in my rsyslog.conf
auth.info /var/log/secure
authpriv.info /var/log/secure (1 Reply)
Hi,
While running tcpdump command on my Fedora 16 machine I am get shared library issue.
# tcpdump
tcpdump: error while loading shared libraries: libcrypto.so.6: cannot open shared object file: No such file or directory
# which tcpdump
/usr/software/sbin/tcpdump
I have tried... (3 Replies)
Discussion started by: muzaffar.k
3 Replies
LEARN ABOUT OSX
sem_init
SEM_INIT(3) Linux Programmer's Manual SEM_INIT(3)NAME
sem_init - initialize an unnamed semaphore
SYNOPSIS
#include <semaphore.h>
int sem_init(sem_t *sem, int pshared, unsigned int value);
Link with -pthread.
DESCRIPTION
sem_init() initializes the unnamed semaphore at the address pointed to by sem. The value argument specifies the initial value for the sem-
aphore.
The pshared argument indicates whether this semaphore is to be shared between the threads of a process, or between processes.
If pshared has the value 0, then the semaphore is shared between the threads of a process, and should be located at some address that is
visible to all threads (e.g., a global variable, or a variable allocated dynamically on the heap).
If pshared is nonzero, then the semaphore is shared between processes, and should be located in a region of shared memory (see shm_open(3),
mmap(2), and shmget(2)). (Since a child created by fork(2) inherits its parent's memory mappings, it can also access the semaphore.) Any
process that can access the shared memory region can operate on the semaphore using sem_post(3), sem_wait(3), and so on.
Initializing a semaphore that has already been initialized results in undefined behavior.
RETURN VALUE
sem_init() returns 0 on success; on error, -1 is returned, and errno is set to indicate the error.
ERRORS
EINVAL value exceeds SEM_VALUE_MAX.
ENOSYS pshared is nonzero, but the system does not support process-shared semaphores (see sem_overview(7)).
ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7).
+-----------+---------------+---------+
|Interface | Attribute | Value |
+-----------+---------------+---------+
|sem_init() | Thread safety | MT-Safe |
+-----------+---------------+---------+
CONFORMING TO
POSIX.1-2001.
NOTES
Bizarrely, POSIX.1-2001 does not specify the value that should be returned by a successful call to sem_init(). POSIX.1-2008 rectifies
this, specifying the zero return on success.
SEE ALSO sem_destroy(3), sem_post(3), sem_wait(3), sem_overview(7)COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the
latest version of this page, can be found at https://www.kernel.org/doc/man-pages/.
Linux 2017-09-15 SEM_INIT(3)