- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I tried to compile a small example and I get an error (implicit declaration vfork()). Is it possible to create a new process with uClinux. An other point, i'm usign Nios IDE to compile my application. int main() { int taille, lecture, i; struct sockaddr_in serveur; char tampon[1024]; int nds, ds; signal(SIGINT, intercept); if ((ds = socket(AF_INET, SOCK_STREAM, 0 )) < 0) exit(1); serveur.sin_family = AF_INET; serveur.sin_addr.s_addr = INADDR_ANY; serveur.sin_port = SERV_PORT; if (bind(ds, (struct sockaddr *)&serveur, sizeof serveur) < 0) exit(1); taille = sizeof(serveur); if (getsockname(ds, (struct sockaddr *)&serveur, &taille) < 0 ) exit(1); listen(ds, 5); while (1) { if (( nds = accept(ds, (struct sockaddr *)0, (int *)0)) == -1 ) exit(1); if (vfork() == 0) { // ERROR HERE!!!! if ((lecture = read(nds, tampon, 6))==-1) exit(1); printf("Je viens de lire: %s\n", tampon); exit(0); } } }Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You forgot to indicate which files you're including -- vfork requires sys/types.h and unistd.h
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page