Sponsored Content
Operating Systems Linux segmentation fault help required Post 302382099 by nvprnth on Tuesday 22nd of December 2009 06:28:54 AM
Old 12-22-2009
fep is front end processor

I did a initial debugging using gdb, the problem seems to be with value of pty, master referes master pseudo terminal,

Code:
     pty = ptsname(master);
     strncpy(slave_tty, pty, sizeof(slave_tty));[/COLOR]

I wrote a sample code using ptsname and ran it, It ran fine, I hardcoded pty with the slave pseudo terminal i got from the script, It was fine

my sample script was
Code:
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
 
main() {
char *pty;
unsigned int master;
 
master = open("/dev/ptmx", O_RDWR);
pty = ptsname(master);
if(pty != NULL) {
    printf ("%s\n", pty);
}
return 0;


Last edited by pludi; 12-22-2009 at 07:51 AM.. Reason: code tags,
 

10 More Discussions You Might Find Interesting

1. Programming

segmentation fault

hi all i'm trying to execute a c program under linux RH and it gives me segmentation fault, this program was running under unix at&t anybody kow what the problem could be? thanx in advance regards (2 Replies)
Discussion started by: omran
2 Replies

2. AIX

Segmentation fault

I am tring to install Lotus Domino/Notes 5.0.5 on a AIX 4.3.3 server. I go to run the cdrom/ibmpow/install and I get the following error. Lotus Notes for Unix Install Program --------------------------------------------- ./install: 10088 Segmentation fault This had Lotus Notes installed... (1 Reply)
Discussion started by: jshaulis
1 Replies

3. UNIX for Dummies Questions & Answers

Segmentation Fault

hello all, I tried a program on an array to intialise array elements from the standard input device.it is an integer array of 5 elements.but after entering the 4th element it throws a message called "Segmentation Fault" and returns to the command prompt without asking for the 5th element. ... (3 Replies)
Discussion started by: compbug
3 Replies

4. Programming

segmentation fault

ive written my code in C for implementation of a simple lexical analyser using singly linked list hence am making use of dynamic allocation,but when run in linux it gives a segmentation fault is it cause of the malloc function that ive made use of????any suggestions as to what i could do??? thank... (8 Replies)
Discussion started by: rockgal
8 Replies

5. AIX

Segmentation fault

Hi , During execution a backup binary i get following error "Program error 11 (Segmentation fault), saving core file in '/usr/datatools" Riyaz (2 Replies)
Discussion started by: rshaikh
2 Replies

6. Programming

segmentation fault

If I do this. Assume struct life { char *nolife; } struct life **life; // malloc initialization & everything if(life->nolife == 0) Would I get error at life->nolife if it is equal to 0. wrong accession? (3 Replies)
Discussion started by: joey
3 Replies

7. Programming

segmentation fault

Hi, I am having this segmentation fault not in the following program, bt. in my lab program . My lab program is horrible long so cannot post it here bt. I am using the following logic in my program which is giving the segmentation fault. Bt. if I run this sample program as it is it dosen't give... (3 Replies)
Discussion started by: mind@work
3 Replies

8. Programming

Using gdb, ignore beginning segmentation fault until reproduce environment segmentation fault

I use a binary name (ie polo) it gets some parameter , so for debugging normally i do this : i wrote script for watchdog my app (polo) and check every second if it's not running then start it , the problem is , if my app , remain in state of segmentation fault for a while (ie 15 ... (6 Replies)
Discussion started by: pooyair
6 Replies

9. Homework & Coursework Questions

Segmentation Fault

this is a network programming code to run a rock paper scissors in a client and server. I completed it and it was working without any error. After I added the findWinner function to the server code it starts giving me segmentation fault. -the segmentation fault is fixed Current problem -Also... (3 Replies)
Discussion started by: femchi
3 Replies

10. Programming

C. To segmentation fault or not to segmentation fault, that is the question.

Oddities with gcc, 2.95.3 for the AMIGA and 4.2.1 for MY current OSX 10.14.1... I am creating a basic calculator for the AMIGA ADE *NIX emulator in C as it does not have one. Below are two very condensed snippets of which I have added the results inside the each code section. IMPORTANT!... (11 Replies)
Discussion started by: wisecracker
11 Replies
PTM(4)							   BSD Kernel Interfaces Manual 						    PTM(4)

NAME
ptm -- pseudo-terminal multiplexor device SYNOPSIS
pseudo-device pty [count] DESCRIPTION
The ptm driver is the backend for the /dev/ptm device. It supports three ioctl(2)s. The first is TIOCPTMGET, which allocates a free pseudo- terminal device, sets its user ID to the calling user, revoke(2)s it, and returns the opened file descriptors for both the master and the slave pseudo-terminal device to the caller in a struct ptmget. This struct has the following content: struct ptmget { int cfd; int sfd; char cn[16]; char sn[16]; }; where cfd and sfd contain the master resp. slave device's file descriptor and cn and sn the corresponding paths in the file system. The /dev/ptmx device supports two more ioctl(2)s, TIOCGRANTPT, which is used by grantpt(3), TIOCPTSNAME, which is used by ptsname(3). The ptm device is included with the pseudo-device pty(4). It can be disabled by adding ``options NO_DEV_PTM'' to the kernel configuration. FILES
/dev/ptm ptm access device /dev/ptmx ptm cloning device, used to implement Unix98 ptys SEE ALSO
grantpt(3), openpty(3), posix_openpt(3), ptsname(3), unlockpt(3), pty(4) HISTORY
The /dev/ptm device appeared in OpenBSD 3.5 and was ported to NetBSD 3.0. BSD
November 12, 2005 BSD
All times are GMT -4. The time now is 01:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy