System programming in C


 
Thread Tools Search this Thread
Top Forums Programming System programming in C
# 1  
Old 11-17-2010
System programming in C

Hi guys, i'm programming in C for Linux but i preferred to program in FreeBSD and some FreeBSD system calls are not available in Linux and i want to make my code portable but i don't now really how, but i think if i used some C preprocessors i can make it portable, and the problems is that i don't know how. I'd appreciate if someone enlightened me. Thank you in advance.
# 2  
Old 11-17-2010
What you want to do is get a copy of Stevens 'Advanced Programming in the UNIX Environment'

It shows all of the system calls for linux/solaris/FreeBSD and shows how to get portability.

...your question involves a lot more than you may think.
This User Gave Thanks to jim mcnamara For This Post:
# 3  
Old 11-17-2010
Quote:
Originally Posted by pharaoh
Hi guys, i'm programming in C for Linux but i preferred to program in FreeBSD and some FreeBSD system calls are not available in Linux and i want to make my code portable but i don't now really how, but i think if i used some C preprocessors i can make it portable, and the problems is that i don't know how. I'd appreciate if someone enlightened me. Thank you in advance.
What system calls have you found to be missing?
This User Gave Thanks to Corona688 For This Post:
# 4  
Old 11-18-2010
unless you are coding based on POSIX standards it doesn't matter what platform your are using. all of them will do the trick.
"Advanced Programming in the UNIX Environment" is one of the best (no i think the best) books for this problem.
This User Gave Thanks to majid.merkava For This Post:
# 5  
Old 11-18-2010
If you want portability, you should not be using FreeBSD specific APIs. Stick to the set of APIs defined by the POSIX.1 standard.
This User Gave Thanks to fpmurphy For This Post:
# 6  
Old 11-19-2010
The original APUE from Steven's has been reworked by Rago, which gave birth the APUE 2nd edition, see APUE2e. This book is good, no point.

The most recent and comprehensive resource about UNIX system programming, is in my opinion Michael Kerrisk's book: The Linux Programming Interface . While this book deals with Linux specifics, it emphasizes on UNIX standards and writing portable programs.

HTH,
Loïc
This User Gave Thanks to Loic Domaigne For This Post:
# 7  
Old 11-20-2010
I'm sorry about the delay on answering, now in "Advanced Programming" we are working with "Shared memory" to work with functions as shmat(),shmdt(), shmctl(),... and so on i need to include these libraries: sys/ipc.h, sys/ipc.h, sys/shm.h and machine/param.h, and the last one isn't a C library in Linux, i'm wondering how i can include then only if i am running FreeBSD.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

From iOS programming to Linux system programming

Hello. I like Linux and C programming language. Allways wanted to understand kernel and become a Linux system programmer. And I also like Objective-C and iOS. These two programming areas have relations: 1. Linux and iOS are UNIX-like systems, POSIX compliant. 2. It is useful to know C language... (2 Replies)
Discussion started by: Rockatansky
2 Replies

2. Shell Programming and Scripting

System programming with Unix

Hi All I want to learn System programming with the help of Unix. System Programming mean to say 1) Playing with the memory of computer 2) Designing some graphical units Hope you understand... (2 Replies)
Discussion started by: parthmittal2007
2 Replies

3. Programming

c programming system call

newPerm = oldPerm & ~0100; where oldPerm holds the value of st_mode from the system call stat(). When I try and compile every line where ive attempted to do these operations gives the warning "parameter names without declaration types in function declaration". what could be the problem? the... (2 Replies)
Discussion started by: bjhum33
2 Replies

4. Programming

What is Unix System Programming???

Hi friends, Hope u r doing well. I really find the phrase, "Unix System Programming" very very cool, I don't know the reason, but it since I love UNIX, I want to do system programming in unix. Could you please tell me what is really the meaning of unix system programming. I have a couple of books... (5 Replies)
Discussion started by: gabam
5 Replies

5. UNIX for Dummies Questions & Answers

How does unix system administration, unix programming, unix network programming differ?

How does unix system administration, unix programming, unix network programming differ? Please help. (0 Replies)
Discussion started by: thulasidharan2k
0 Replies

6. Programming

system Programming using JAVA.

Dear Sir, How to write Code using JAVA technology for system programming ? I want to develop a new compiler for my own language. thanks in advance roy (1 Reply)
Discussion started by: swapan
1 Replies

7. Programming

System programming in C

Hi there, Am very very interested in system level programming in C???? Please give me a good site or a sample program to start with.. will be of a great help to me.. Thanks, Nisha (7 Replies)
Discussion started by: Nisha
7 Replies

8. Programming

System programming book

please tell me the best book for Unix's System programming..... so that i become expert in System programming.I have completed shell programming and i know C programming in Unix. please tell me which book i should prefer... -ajit (1 Reply)
Discussion started by: ajit_gupta
1 Replies

9. Programming

unix system programming

hey there i have to execute commands that are written on the command line in unix. i have already separated the commands into tokens but now im stuck with the problem of how to actually execute those commands. eg: lets say the user entered " ls -l" to list all the files in a directory ... (1 Reply)
Discussion started by: mile1982
1 Replies

10. Programming

System Programming

Hi all, I am working on a c program (in a unix environment) making system calls. My program makes references to POSIX, _POSIX_SOURCE 1. When trying to compile the c program, I received a message "Language optional software package not installed." I am not sure if this message refers to... (3 Replies)
Discussion started by: rachael
3 Replies
Login or Register to Ask a Question